Mercurial > vim
annotate src/gui_w32.c @ 17394:969a28736055
Added tag v8.1.1695 for changeset 372f2eaa544ae8d191a6c9afc34b43d61d90bb16
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 15 Jul 2019 20:45:08 +0200 |
parents | ce562b9f702e |
children | 1d69e11db360 |
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); |
f52504c10387
commit https://github.com/vim/vim/commit/065bbac8adfe29a09958570237d223457f235c6c
Christian Brabandt <cb@256bit.org>
parents:
8108
diff
changeset
|
43 #endif |
f52504c10387
commit https://github.com/vim/vim/commit/065bbac8adfe29a09958570237d223457f235c6c
Christian Brabandt <cb@256bit.org>
parents:
8108
diff
changeset
|
44 |
6110 | 45 #if defined(FEAT_RENDER_OPTIONS) || defined(PROTO) |
46 int | |
47 gui_mch_set_rendering_options(char_u *s) | |
48 { | |
13028
cfce9ac1d1e8
patch 8.0.1390: DirectX scrolling can be slow, vertical positioning is off
Christian Brabandt <cb@256bit.org>
parents:
12994
diff
changeset
|
49 # ifdef FEAT_DIRECTX |
6110 | 50 char_u *p, *q; |
51 | |
52 int dx_enable = 0; | |
53 int dx_flags = 0; | |
54 float dx_gamma = 0.0f; | |
55 float dx_contrast = 0.0f; | |
56 float dx_level = 0.0f; | |
57 int dx_geom = 0; | |
58 int dx_renmode = 0; | |
59 int dx_taamode = 0; | |
60 | |
61 /* parse string as rendering options. */ | |
62 for (p = s; p != NULL && *p != NUL; ) | |
63 { | |
64 char_u item[256]; | |
65 char_u name[128]; | |
66 char_u value[128]; | |
67 | |
7009 | 68 copy_option_part(&p, item, sizeof(item), ","); |
6110 | 69 if (p == NULL) |
70 break; | |
71 q = &item[0]; | |
72 copy_option_part(&q, name, sizeof(name), ":"); | |
73 if (q == NULL) | |
74 return FAIL; | |
75 copy_option_part(&q, value, sizeof(value), ":"); | |
76 | |
77 if (STRCMP(name, "type") == 0) | |
78 { | |
79 if (STRCMP(value, "directx") == 0) | |
80 dx_enable = 1; | |
81 else | |
82 return FAIL; | |
83 } | |
84 else if (STRCMP(name, "gamma") == 0) | |
85 { | |
86 dx_flags |= 1 << 0; | |
8108
50515f2e81d1
commit https://github.com/vim/vim/commit/7f0608fb5219645d776fadfe13efb867c2460698
Christian Brabandt <cb@256bit.org>
parents:
8102
diff
changeset
|
87 dx_gamma = (float)atof((char *)value); |
6110 | 88 } |
89 else if (STRCMP(name, "contrast") == 0) | |
90 { | |
91 dx_flags |= 1 << 1; | |
8108
50515f2e81d1
commit https://github.com/vim/vim/commit/7f0608fb5219645d776fadfe13efb867c2460698
Christian Brabandt <cb@256bit.org>
parents:
8102
diff
changeset
|
92 dx_contrast = (float)atof((char *)value); |
6110 | 93 } |
94 else if (STRCMP(name, "level") == 0) | |
95 { | |
96 dx_flags |= 1 << 2; | |
8108
50515f2e81d1
commit https://github.com/vim/vim/commit/7f0608fb5219645d776fadfe13efb867c2460698
Christian Brabandt <cb@256bit.org>
parents:
8102
diff
changeset
|
97 dx_level = (float)atof((char *)value); |
6110 | 98 } |
99 else if (STRCMP(name, "geom") == 0) | |
100 { | |
101 dx_flags |= 1 << 3; | |
8108
50515f2e81d1
commit https://github.com/vim/vim/commit/7f0608fb5219645d776fadfe13efb867c2460698
Christian Brabandt <cb@256bit.org>
parents:
8102
diff
changeset
|
102 dx_geom = atoi((char *)value); |
6110 | 103 if (dx_geom < 0 || dx_geom > 2) |
104 return FAIL; | |
105 } | |
106 else if (STRCMP(name, "renmode") == 0) | |
107 { | |
108 dx_flags |= 1 << 4; | |
8108
50515f2e81d1
commit https://github.com/vim/vim/commit/7f0608fb5219645d776fadfe13efb867c2460698
Christian Brabandt <cb@256bit.org>
parents:
8102
diff
changeset
|
109 dx_renmode = atoi((char *)value); |
6110 | 110 if (dx_renmode < 0 || dx_renmode > 6) |
111 return FAIL; | |
112 } | |
113 else if (STRCMP(name, "taamode") == 0) | |
114 { | |
115 dx_flags |= 1 << 5; | |
8108
50515f2e81d1
commit https://github.com/vim/vim/commit/7f0608fb5219645d776fadfe13efb867c2460698
Christian Brabandt <cb@256bit.org>
parents:
8102
diff
changeset
|
116 dx_taamode = atoi((char *)value); |
6110 | 117 if (dx_taamode < 0 || dx_taamode > 3) |
118 return FAIL; | |
119 } | |
12986
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
120 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
|
121 { |
13150
808625d4b71b
patch 8.0.1449: slow redrawing with DirectX
Christian Brabandt <cb@256bit.org>
parents:
13028
diff
changeset
|
122 /* 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
|
123 } |
6110 | 124 else |
125 return FAIL; | |
126 } | |
127 | |
12994
8566eaa08788
patch 8.0.1373: no error when settting 'renderoptions' before starting GUI
Christian Brabandt <cb@256bit.org>
parents:
12986
diff
changeset
|
128 if (!gui.in_use) |
8566eaa08788
patch 8.0.1373: no error when settting 'renderoptions' before starting GUI
Christian Brabandt <cb@256bit.org>
parents:
12986
diff
changeset
|
129 return OK; /* only checking the syntax of the value */ |
8566eaa08788
patch 8.0.1373: no error when settting 'renderoptions' before starting GUI
Christian Brabandt <cb@256bit.org>
parents:
12986
diff
changeset
|
130 |
6110 | 131 /* Enable DirectX/DirectWrite */ |
132 if (dx_enable) | |
133 { | |
134 if (!directx_enabled()) | |
135 return FAIL; | |
136 DWriteContext_SetRenderingParams(s_dwc, NULL); | |
137 if (dx_flags) | |
138 { | |
139 DWriteRenderingParams param; | |
140 DWriteContext_GetRenderingParams(s_dwc, ¶m); | |
141 if (dx_flags & (1 << 0)) | |
142 param.gamma = dx_gamma; | |
143 if (dx_flags & (1 << 1)) | |
144 param.enhancedContrast = dx_contrast; | |
145 if (dx_flags & (1 << 2)) | |
146 param.clearTypeLevel = dx_level; | |
147 if (dx_flags & (1 << 3)) | |
148 param.pixelGeometry = dx_geom; | |
149 if (dx_flags & (1 << 4)) | |
150 param.renderingMode = dx_renmode; | |
151 if (dx_flags & (1 << 5)) | |
152 param.textAntialiasMode = dx_taamode; | |
153 DWriteContext_SetRenderingParams(s_dwc, ¶m); | |
154 } | |
155 } | |
156 s_directx_enabled = dx_enable; | |
157 | |
158 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
|
159 # else |
6110 | 160 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
|
161 # endif |
6110 | 162 } |
163 #endif | |
164 | |
7 | 165 /* |
166 * These are new in Windows ME/XP, only defined in recent compilers. | |
167 */ | |
168 #ifndef HANDLE_WM_XBUTTONUP | |
169 # define HANDLE_WM_XBUTTONUP(hwnd, wParam, lParam, fn) \ | |
170 ((fn)((hwnd), (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) | |
171 #endif | |
172 #ifndef HANDLE_WM_XBUTTONDOWN | |
173 # define HANDLE_WM_XBUTTONDOWN(hwnd, wParam, lParam, fn) \ | |
174 ((fn)((hwnd), FALSE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) | |
175 #endif | |
176 #ifndef HANDLE_WM_XBUTTONDBLCLK | |
177 # define HANDLE_WM_XBUTTONDBLCLK(hwnd, wParam, lParam, fn) \ | |
178 ((fn)((hwnd), TRUE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) | |
179 #endif | |
180 | |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
181 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
182 #include "version.h" /* used by dialog box routine for default title */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
183 #ifdef DEBUG |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
184 # include <tchar.h> |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
185 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
186 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
187 /* cproto fails on missing include files */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
188 #ifndef PROTO |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
189 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
190 #ifndef __MINGW32__ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
191 # include <shellapi.h> |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
192 #endif |
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
|
193 #if defined(FEAT_TOOLBAR) || defined(FEAT_BEVAL_GUI) || defined(FEAT_GUI_TABLINE) |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
194 # include <commctrl.h> |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
195 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
196 #include <windowsx.h> |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
197 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
198 #ifdef GLOBAL_IME |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
199 # include "glbl_ime.h" |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
200 #endif |
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 #endif /* PROTO */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
203 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
204 #ifdef FEAT_MENU |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
205 # define MENUHINTS /* show menu hints in command line */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
206 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
207 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
208 /* Some parameters for dialog boxes. All in pixels. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
209 #define DLG_PADDING_X 10 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
210 #define DLG_PADDING_Y 10 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
211 #define DLG_OLD_STYLE_PADDING_X 5 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
212 #define DLG_OLD_STYLE_PADDING_Y 5 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
213 #define DLG_VERT_PADDING_X 4 /* For vertical buttons */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
214 #define DLG_VERT_PADDING_Y 4 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
215 #define DLG_ICON_WIDTH 34 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
216 #define DLG_ICON_HEIGHT 34 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
217 #define DLG_MIN_WIDTH 150 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
218 #define DLG_FONT_NAME "MS Sans Serif" |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
219 #define DLG_FONT_POINT_SIZE 8 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
220 #define DLG_MIN_MAX_WIDTH 400 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
221 #define DLG_MIN_MAX_HEIGHT 400 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
222 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
223 #define DLG_NONBUTTON_CONTROL 5000 /* First ID of non-button controls */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
224 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
225 #ifndef WM_XBUTTONDOWN /* For Win2K / winME ONLY */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
226 # define WM_XBUTTONDOWN 0x020B |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
227 # define WM_XBUTTONUP 0x020C |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
228 # define WM_XBUTTONDBLCLK 0x020D |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
229 # define MK_XBUTTON1 0x0020 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
230 # define MK_XBUTTON2 0x0040 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
231 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
232 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
233 #ifdef PROTO |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
234 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
235 * 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
|
236 * 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
|
237 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
238 # define APIENTRY |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
239 # define CALLBACK |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
240 # define CONST |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
241 # define FAR |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
242 # define NEAR |
9834
80ace3687eec
commit https://github.com/vim/vim/commit/a6b7a08ae04a3cd4d9c45c906bb7a197e2135179
Christian Brabandt <cb@256bit.org>
parents:
9428
diff
changeset
|
243 # undef _cdecl |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
244 # define _cdecl |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
245 typedef int BOOL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
246 typedef int BYTE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
247 typedef int DWORD; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
248 typedef int WCHAR; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
249 typedef int ENUMLOGFONT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
250 typedef int FINDREPLACE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
251 typedef int HANDLE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
252 typedef int HBITMAP; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
253 typedef int HBRUSH; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
254 typedef int HDROP; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
255 typedef int INT; |
16152
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
256 typedef int LOGFONTW[]; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
257 typedef int LPARAM; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
258 typedef int LPCREATESTRUCT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
259 typedef int LPCSTR; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
260 typedef int LPCTSTR; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
261 typedef int LPRECT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
262 typedef int LPSTR; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
263 typedef int LPWINDOWPOS; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
264 typedef int LPWORD; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
265 typedef int LRESULT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
266 typedef int HRESULT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
267 # undef MSG |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
268 typedef int MSG; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
269 typedef int NEWTEXTMETRIC; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
270 typedef int OSVERSIONINFO; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
271 typedef int PWORD; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
272 typedef int RECT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
273 typedef int UINT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
274 typedef int WORD; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
275 typedef int WPARAM; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
276 typedef int POINT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
277 typedef void *HINSTANCE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
278 typedef void *HMENU; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
279 typedef void *HWND; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
280 typedef void *HDC; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
281 typedef void VOID; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
282 typedef int LPNMHDR; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
283 typedef int LONG; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
284 typedef int WNDPROC; |
9834
80ace3687eec
commit https://github.com/vim/vim/commit/a6b7a08ae04a3cd4d9c45c906bb7a197e2135179
Christian Brabandt <cb@256bit.org>
parents:
9428
diff
changeset
|
285 typedef int UINT_PTR; |
13963 | 286 typedef int COLORREF; |
287 typedef int HCURSOR; | |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
288 #endif |
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 #ifndef GET_X_LPARAM |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
291 # define GET_X_LPARAM(lp) ((int)(short)LOWORD(lp)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
292 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
293 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
294 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
|
295 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
|
296 static void clear_rect(RECT *rcp); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
297 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
298 static WORD s_dlgfntheight; /* height of the dialog font */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
299 static WORD s_dlgfntwidth; /* width of the dialog font */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
300 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
301 #ifdef FEAT_MENU |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
302 static HMENU s_menuBar = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
303 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
304 #ifdef FEAT_TEAROFF |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
305 static void rebuild_tearoff(vimmenu_T *menu); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
306 static HBITMAP s_htearbitmap; /* bitmap used to indicate tearoff */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
307 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
308 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
309 /* Flag that is set while processing a message that must not be interrupted by |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
310 * processing another message. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
311 static int s_busy_processing = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
312 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
313 static int destroying = FALSE; /* call DestroyWindow() ourselves */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
314 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
315 #ifdef MSWIN_FIND_REPLACE |
16196
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
316 static UINT s_findrep_msg = 0; // set in gui_w[16/32].c |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
317 static FINDREPLACEW s_findrep_struct; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
318 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
|
319 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
|
320 // for find/replace dialog |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
321 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
322 |
8281
74b15ed0a259
commit https://github.com/vim/vim/commit/85b11769ab507c7df93f319fd964fa579701b76b
Christian Brabandt <cb@256bit.org>
parents:
8273
diff
changeset
|
323 #if !defined(FEAT_GUI) |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
324 static |
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 HWND s_hwnd = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
327 static HDC s_hdc = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
328 static HBRUSH s_brush = NULL; |
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 #ifdef FEAT_TOOLBAR |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
331 static HWND s_toolbarhwnd = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
332 static WNDPROC s_toolbar_wndproc = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
333 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
334 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
335 #ifdef FEAT_GUI_TABLINE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
336 static HWND s_tabhwnd = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
337 static WNDPROC s_tabline_wndproc = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
338 static int showing_tabline = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
339 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
340 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
341 static WPARAM s_wParam = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
342 static LPARAM s_lParam = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
343 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
344 static HWND s_textArea = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
345 static UINT s_uMsg = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
346 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
347 static char_u *s_textfield; /* Used by dialogs to pass back strings */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
348 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
349 static int s_need_activate = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
350 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
351 /* This variable is set when waiting for an event, which is the only moment |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
352 * scrollbar dragging can be done directly. It's not allowed while commands |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
353 * are executed, because it may move the cursor and that may cause unexpected |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
354 * problems (e.g., while ":s" is working). |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
355 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
356 static int allow_scrollbar = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
357 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
358 #ifdef GLOBAL_IME |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
359 # define MyTranslateMessage(x) global_ime_TranslateMessage(x) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
360 #else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
361 # define MyTranslateMessage(x) TranslateMessage(x) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
362 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
363 |
12934
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
364 #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
|
365 static int |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
366 directx_enabled(void) |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
367 { |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
368 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
|
369 return 1; |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
370 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
|
371 return 0; |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
372 /* load DirectX */ |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
373 DWrite_Init(); |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
374 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
|
375 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
|
376 directx_binddc(); |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
377 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
|
378 } |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
379 |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
380 static void |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
381 directx_binddc(void) |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
382 { |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
383 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
|
384 { |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
385 RECT rect; |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
386 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
|
387 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
|
388 } |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
389 } |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
390 #endif |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
391 |
16196
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
392 /* use of WindowProc depends on Global IME */ |
15597
536dd2bc5ac9
patch 8.1.0806: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15549
diff
changeset
|
393 #define MyWindowProc vim_WindowProc |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
394 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
395 extern int current_font_height; /* this is in os_mswin.c */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
396 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
397 static struct |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
398 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
399 UINT key_sym; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
400 char_u vim_code0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
401 char_u vim_code1; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
402 } special_keys[] = |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
403 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
404 {VK_UP, 'k', 'u'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
405 {VK_DOWN, 'k', 'd'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
406 {VK_LEFT, 'k', 'l'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
407 {VK_RIGHT, 'k', 'r'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
408 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
409 {VK_F1, 'k', '1'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
410 {VK_F2, 'k', '2'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
411 {VK_F3, 'k', '3'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
412 {VK_F4, 'k', '4'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
413 {VK_F5, 'k', '5'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
414 {VK_F6, 'k', '6'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
415 {VK_F7, 'k', '7'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
416 {VK_F8, 'k', '8'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
417 {VK_F9, 'k', '9'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
418 {VK_F10, 'k', ';'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
419 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
420 {VK_F11, 'F', '1'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
421 {VK_F12, 'F', '2'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
422 {VK_F13, 'F', '3'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
423 {VK_F14, 'F', '4'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
424 {VK_F15, 'F', '5'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
425 {VK_F16, 'F', '6'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
426 {VK_F17, 'F', '7'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
427 {VK_F18, 'F', '8'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
428 {VK_F19, 'F', '9'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
429 {VK_F20, 'F', 'A'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
430 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
431 {VK_F21, 'F', 'B'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
432 #ifdef FEAT_NETBEANS_INTG |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
433 {VK_PAUSE, 'F', 'B'}, /* Pause == F21 (see gui_gtk_x11.c) */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
434 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
435 {VK_F22, 'F', 'C'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
436 {VK_F23, 'F', 'D'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
437 {VK_F24, 'F', 'E'}, /* winuser.h defines up to F24 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
438 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
439 {VK_HELP, '%', '1'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
440 {VK_BACK, 'k', 'b'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
441 {VK_INSERT, 'k', 'I'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
442 {VK_DELETE, 'k', 'D'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
443 {VK_HOME, 'k', 'h'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
444 {VK_END, '@', '7'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
445 {VK_PRIOR, 'k', 'P'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
446 {VK_NEXT, 'k', 'N'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
447 {VK_PRINT, '%', '9'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
448 {VK_ADD, 'K', '6'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
449 {VK_SUBTRACT, 'K', '7'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
450 {VK_DIVIDE, 'K', '8'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
451 {VK_MULTIPLY, 'K', '9'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
452 {VK_SEPARATOR, 'K', 'A'}, /* Keypad Enter */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
453 {VK_DECIMAL, 'K', 'B'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
454 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
455 {VK_NUMPAD0, 'K', 'C'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
456 {VK_NUMPAD1, 'K', 'D'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
457 {VK_NUMPAD2, 'K', 'E'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
458 {VK_NUMPAD3, 'K', 'F'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
459 {VK_NUMPAD4, 'K', 'G'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
460 {VK_NUMPAD5, 'K', 'H'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
461 {VK_NUMPAD6, 'K', 'I'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
462 {VK_NUMPAD7, 'K', 'J'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
463 {VK_NUMPAD8, 'K', 'K'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
464 {VK_NUMPAD9, 'K', 'L'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
465 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
466 /* Keys that we want to be able to use any modifier with: */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
467 {VK_SPACE, ' ', NUL}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
468 {VK_TAB, TAB, NUL}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
469 {VK_ESCAPE, ESC, NUL}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
470 {NL, NL, NUL}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
471 {CAR, CAR, NUL}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
472 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
473 /* End of list marker: */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
474 {0, 0, 0} |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
475 }; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
476 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
477 /* Local variables */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
478 static int s_button_pending = -1; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
479 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
480 /* s_getting_focus is set when we got focus but didn't see mouse-up event yet, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
481 * so don't reset s_button_pending. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
482 static int s_getting_focus = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
483 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
484 static int s_x_pending; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
485 static int s_y_pending; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
486 static UINT s_kFlags_pending; |
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
|
487 static UINT 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
|
488 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
|
489 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
|
490 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
|
491 // else a high surrogate |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
492 |
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
|
493 #ifdef FEAT_BEVAL_GUI |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
494 /* balloon-eval WM_NOTIFY_HANDLER */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
495 static void Handle_WM_Notify(HWND hwnd, LPNMHDR pnmh); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
496 static void TrackUserActivity(UINT uMsg); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
497 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
498 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
499 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
500 * For control IME. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
501 * |
16152
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
502 * These LOGFONTW used for IME. |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
503 */ |
12950
e60b2aa04903
patch 8.0.1351: warning for unused variables building with MinGW
Christian Brabandt <cb@256bit.org>
parents:
12934
diff
changeset
|
504 #if defined(FEAT_MBYTE_IME) || defined(GLOBAL_IME) |
16152
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
505 /* holds LOGFONTW for 'guifontwide' if available, otherwise 'guifont' */ |
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
506 static LOGFONTW norm_logfont; |
12950
e60b2aa04903
patch 8.0.1351: warning for unused variables building with MinGW
Christian Brabandt <cb@256bit.org>
parents:
12934
diff
changeset
|
507 #endif |
e60b2aa04903
patch 8.0.1351: warning for unused variables building with MinGW
Christian Brabandt <cb@256bit.org>
parents:
12934
diff
changeset
|
508 #ifdef FEAT_MBYTE_IME |
16152
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
509 /* holds LOGFONTW for 'guifont' always. */ |
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
510 static LOGFONTW sub_logfont; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
511 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
512 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
513 #ifdef FEAT_MBYTE_IME |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
514 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
|
515 #endif |
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 #if defined(FEAT_BROWSE) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
518 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
|
519 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
520 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
521 #ifdef DEBUG_PRINT_ERROR |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
522 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
523 * 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
|
524 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
525 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
526 print_windows_error(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
527 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
528 LPVOID lpMsgBuf; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
529 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
530 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
|
531 NULL, GetLastError(), |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
532 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
533 (LPTSTR) &lpMsgBuf, 0, NULL); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
534 TRACE1("Error: %s\n", lpMsgBuf); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
535 LocalFree(lpMsgBuf); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
536 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
537 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
538 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
539 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
540 * Cursor blink functions. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
541 * |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
542 * This is a simple state machine: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
543 * BLINK_NONE not blinking at all |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
544 * 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
|
545 * BLINK_ON blinking, cursor is shown |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
546 */ |
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 #define BLINK_NONE 0 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
549 #define BLINK_OFF 1 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
550 #define BLINK_ON 2 |
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 static int blink_state = BLINK_NONE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
553 static long_u blink_waittime = 700; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
554 static long_u blink_ontime = 400; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
555 static long_u blink_offtime = 250; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
556 static UINT blink_timer = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
557 |
9213
bb86514cad15
commit https://github.com/vim/vim/commit/703a8044b5393d37d355b0b1054a9a5a13912a3f
Christian Brabandt <cb@256bit.org>
parents:
9181
diff
changeset
|
558 int |
bb86514cad15
commit https://github.com/vim/vim/commit/703a8044b5393d37d355b0b1054a9a5a13912a3f
Christian Brabandt <cb@256bit.org>
parents:
9181
diff
changeset
|
559 gui_mch_is_blinking(void) |
bb86514cad15
commit https://github.com/vim/vim/commit/703a8044b5393d37d355b0b1054a9a5a13912a3f
Christian Brabandt <cb@256bit.org>
parents:
9181
diff
changeset
|
560 { |
bb86514cad15
commit https://github.com/vim/vim/commit/703a8044b5393d37d355b0b1054a9a5a13912a3f
Christian Brabandt <cb@256bit.org>
parents:
9181
diff
changeset
|
561 return blink_state != BLINK_NONE; |
bb86514cad15
commit https://github.com/vim/vim/commit/703a8044b5393d37d355b0b1054a9a5a13912a3f
Christian Brabandt <cb@256bit.org>
parents:
9181
diff
changeset
|
562 } |
bb86514cad15
commit https://github.com/vim/vim/commit/703a8044b5393d37d355b0b1054a9a5a13912a3f
Christian Brabandt <cb@256bit.org>
parents:
9181
diff
changeset
|
563 |
9428
0c7f47088e55
commit https://github.com/vim/vim/commit/9d5d3c9c4468ad76f16b50eabd3d9e7eab2ed44d
Christian Brabandt <cb@256bit.org>
parents:
9252
diff
changeset
|
564 int |
0c7f47088e55
commit https://github.com/vim/vim/commit/9d5d3c9c4468ad76f16b50eabd3d9e7eab2ed44d
Christian Brabandt <cb@256bit.org>
parents:
9252
diff
changeset
|
565 gui_mch_is_blink_off(void) |
0c7f47088e55
commit https://github.com/vim/vim/commit/9d5d3c9c4468ad76f16b50eabd3d9e7eab2ed44d
Christian Brabandt <cb@256bit.org>
parents:
9252
diff
changeset
|
566 { |
0c7f47088e55
commit https://github.com/vim/vim/commit/9d5d3c9c4468ad76f16b50eabd3d9e7eab2ed44d
Christian Brabandt <cb@256bit.org>
parents:
9252
diff
changeset
|
567 return blink_state == BLINK_OFF; |
0c7f47088e55
commit https://github.com/vim/vim/commit/9d5d3c9c4468ad76f16b50eabd3d9e7eab2ed44d
Christian Brabandt <cb@256bit.org>
parents:
9252
diff
changeset
|
568 } |
0c7f47088e55
commit https://github.com/vim/vim/commit/9d5d3c9c4468ad76f16b50eabd3d9e7eab2ed44d
Christian Brabandt <cb@256bit.org>
parents:
9252
diff
changeset
|
569 |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
570 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
571 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
|
572 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
573 blink_waittime = wait; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
574 blink_ontime = on; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
575 blink_offtime = off; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
576 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
577 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
578 static VOID CALLBACK |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
579 _OnBlinkTimer( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
580 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
|
581 UINT uMsg UNUSED, |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
582 UINT 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
|
583 DWORD dwTime UNUSED) |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
584 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
585 MSG msg; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
586 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
587 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
588 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
|
589 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
590 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
591 KillTimer(NULL, idEvent); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
592 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
593 /* Eat spurious WM_TIMER messages */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
594 while (pPeekMessage(&msg, hwnd, WM_TIMER, WM_TIMER, PM_REMOVE)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
595 ; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
596 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
597 if (blink_state == BLINK_ON) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
598 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
599 gui_undraw_cursor(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
600 blink_state = BLINK_OFF; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
601 blink_timer = (UINT) SetTimer(NULL, 0, (UINT)blink_offtime, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
602 (TIMERPROC)_OnBlinkTimer); |
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 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
605 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
606 gui_update_cursor(TRUE, FALSE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
607 blink_state = BLINK_ON; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
608 blink_timer = (UINT) SetTimer(NULL, 0, (UINT)blink_ontime, |
10783
04eb70c77cf4
patch 8.0.0281: some files are still using ARGSUSED instead of UNUSED
Christian Brabandt <cb@256bit.org>
parents:
10440
diff
changeset
|
609 (TIMERPROC)_OnBlinkTimer); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
610 } |
12986
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
611 gui_mch_flush(); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
612 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
613 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
614 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
615 gui_mswin_rm_blink_timer(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
616 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
617 MSG msg; |
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 if (blink_timer != 0) |
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 KillTimer(NULL, blink_timer); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
622 /* Eat spurious WM_TIMER messages */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
623 while (pPeekMessage(&msg, s_hwnd, WM_TIMER, WM_TIMER, PM_REMOVE)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
624 ; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
625 blink_timer = 0; |
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 |
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 * 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
|
631 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
632 void |
13152
f4c3a7f410f4
patch 8.0.1450: GUI: endless loop when stopping cursor blinking
Christian Brabandt <cb@256bit.org>
parents:
13150
diff
changeset
|
633 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
|
634 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
635 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
|
636 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
|
637 { |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
638 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
|
639 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
|
640 } |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
641 blink_state = BLINK_NONE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
642 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
643 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
644 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
645 * 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
|
646 * waiting time and shows the cursor. |
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 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
649 gui_mch_start_blink(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
650 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
651 gui_mswin_rm_blink_timer(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
652 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
653 /* Only switch blinking on if none of the times is zero */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
654 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
|
655 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
656 blink_timer = (UINT)SetTimer(NULL, 0, (UINT)blink_waittime, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
657 (TIMERPROC)_OnBlinkTimer); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
658 blink_state = BLINK_ON; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
659 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
|
660 gui_mch_flush(); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
661 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
662 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
663 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
664 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
665 * Call-back routines. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
666 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
667 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
668 static VOID CALLBACK |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
669 _OnTimer( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
670 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
|
671 UINT uMsg UNUSED, |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
672 UINT 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
|
673 DWORD dwTime UNUSED) |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
674 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
675 MSG msg; |
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 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
678 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
|
679 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
680 KillTimer(NULL, idEvent); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
681 s_timed_out = TRUE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
682 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
683 /* Eat spurious WM_TIMER messages */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
684 while (pPeekMessage(&msg, hwnd, WM_TIMER, WM_TIMER, PM_REMOVE)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
685 ; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
686 if (idEvent == s_wait_timer) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
687 s_wait_timer = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
688 } |
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 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
691 _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
|
692 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
|
693 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
|
694 int cRepeat UNUSED) |
8140
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 dead_key = 1; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
697 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
698 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
699 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
700 * 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
|
701 * 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
|
702 * 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
|
703 * 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
|
704 * 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
|
705 * 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
|
706 * 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
|
707 * 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
|
708 * matching low surrogate. |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
709 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
710 static int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
711 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
|
712 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
713 int len; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
714 int i; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
715 WCHAR wstring[2]; |
9252
c25898cc99c1
commit https://github.com/vim/vim/commit/945ec093cd4ddefab930239990564b12eb232153
Christian Brabandt <cb@256bit.org>
parents:
9236
diff
changeset
|
716 char_u *ws = NULL; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
717 |
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
|
718 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
|
719 { |
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
|
720 /* We don't guarantee ch is a low surrogate to match the high 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
|
721 * we already have; it should be, but if it isn't, tough luck. */ |
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
|
722 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
|
723 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
|
724 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
|
725 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
|
726 } |
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
|
727 else if (ch >= 0xD800 && ch <= 0xDBFF) /* high 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
|
728 { |
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
|
729 /* We don't have the entire code point yet, only the first UTF-16 code |
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
|
730 * unit; so just remember it and use it in the next call. */ |
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 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
|
732 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
|
733 } |
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 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
|
735 { |
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 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
|
737 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
|
738 } |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
739 |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
740 /* "ch" is a UTF-16 character. Convert it to a string of bytes. When |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
741 * "enc_codepage" is non-zero use the standard Win32 function, |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
742 * otherwise use our own conversion function (e.g., for UTF-8). */ |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
743 if (enc_codepage > 0) |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
744 { |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
745 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
|
746 (LPSTR)string, slen, 0, NULL); |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
747 /* If we had included the ALT key into the character but now the |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
748 * upper bit is no longer set, that probably means the conversion |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
749 * failed. Convert the original character and set the upper bit |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
750 * afterwards. */ |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
751 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
|
752 { |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
753 wstring[0] = ch & 0x7f; |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
754 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
|
755 (LPSTR)string, slen, 0, NULL); |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
756 if (len == 1) /* safety check */ |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
757 string[0] |= 0x80; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
758 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
759 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
760 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
761 { |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
762 ws = utf16_to_enc(wstring, &len); |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
763 if (ws == NULL) |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
764 len = 0; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
765 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
766 { |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
767 if (len > slen) /* just in case */ |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
768 len = slen; |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
769 mch_memmove(string, ws, len); |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
770 vim_free(ws); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
771 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
772 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
773 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
774 if (len == 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
775 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
776 string[0] = ch; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
777 len = 1; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
778 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
779 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
780 for (i = 0; i < len; ++i) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
781 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
|
782 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
783 /* Insert CSI as K_CSI. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
784 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
|
785 string[++i] = KS_EXTRA; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
786 string[++i] = (int)KE_CSI; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
787 len += 2; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
788 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
789 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
790 return len; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
791 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
792 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
793 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
794 * 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
|
795 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
796 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
797 _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
|
798 HWND hwnd UNUSED, |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
799 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
|
800 int cRepeat UNUSED) |
8140
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 char_u string[40]; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
803 int len = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
804 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
805 dead_key = 0; |
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 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
|
808 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
|
809 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
810 trash_input_buf(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
811 got_int = TRUE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
812 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
813 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
814 add_to_input_buf(string, len); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
815 } |
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 * 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
|
819 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
820 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
821 _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
|
822 HWND hwnd UNUSED, |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
823 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
|
824 int cRepeat UNUSED) |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
825 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
826 char_u string[40]; /* Enough for multibyte character */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
827 int len; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
828 int modifiers; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
829 int ch = cch; /* special keys are negative */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
830 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
831 dead_key = 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 /* TRACE("OnSysChar(%d, %c)\n", ch, ch); */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
834 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
835 /* OK, we have a character key (given by ch) which was entered with the |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
836 * ALT key pressed. Eg, if the user presses Alt-A, then ch == 'A'. Note |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
837 * that the system distinguishes Alt-a and Alt-A (Alt-Shift-a unless |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
838 * CAPSLOCK is pressed) at this point. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
839 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
840 modifiers = MOD_MASK_ALT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
841 if (GetKeyState(VK_SHIFT) & 0x8000) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
842 modifiers |= MOD_MASK_SHIFT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
843 if (GetKeyState(VK_CONTROL) & 0x8000) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
844 modifiers |= MOD_MASK_CTRL; |
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 ch = simplify_key(ch, &modifiers); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
847 /* remove the SHIFT modifier for keys where it's already included, e.g., |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
848 * '(' and '*' */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
849 if (ch < 0x100 && !isalpha(ch) && isprint(ch)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
850 modifiers &= ~MOD_MASK_SHIFT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
851 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
852 /* Interpret the ALT key as making the key META, include SHIFT, etc. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
853 ch = extract_modifiers(ch, &modifiers); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
854 if (ch == CSI) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
855 ch = K_CSI; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
856 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
857 len = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
858 if (modifiers) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
859 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
860 string[len++] = CSI; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
861 string[len++] = KS_MODIFIER; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
862 string[len++] = modifiers; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
863 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
864 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
865 if (IS_SPECIAL((int)ch)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
866 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
867 string[len++] = CSI; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
868 string[len++] = K_SECOND((int)ch); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
869 string[len++] = K_THIRD((int)ch); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
870 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
871 else |
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 /* Although the documentation isn't clear about it, we assume "ch" is |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
874 * a Unicode character. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
875 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
|
876 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
877 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
878 add_to_input_buf(string, len); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
879 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
880 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
881 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
882 _OnMouseEvent( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
883 int button, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
884 int x, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
885 int y, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
886 int repeated_click, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
887 UINT keyFlags) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
888 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
889 int vim_modifiers = 0x0; |
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 s_getting_focus = FALSE; |
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 if (keyFlags & MK_SHIFT) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
894 vim_modifiers |= MOUSE_SHIFT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
895 if (keyFlags & MK_CONTROL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
896 vim_modifiers |= MOUSE_CTRL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
897 if (GetKeyState(VK_MENU) & 0x8000) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
898 vim_modifiers |= MOUSE_ALT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
899 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
900 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
|
901 } |
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 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
904 _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
|
905 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
|
906 BOOL fDoubleClick UNUSED, |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
907 int x, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
908 int y, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
909 UINT keyFlags) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
910 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
911 static LONG s_prevTime = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
912 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
913 LONG currentTime = GetMessageTime(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
914 int button = -1; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
915 int repeated_click; |
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 /* Give main window the focus: this is so the cursor isn't hollow. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
918 (void)SetFocus(s_hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
919 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
920 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
|
921 button = MOUSE_LEFT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
922 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
|
923 button = MOUSE_MIDDLE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
924 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
|
925 button = MOUSE_RIGHT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
926 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
|
927 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
928 #ifndef GET_XBUTTON_WPARAM |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
929 # define GET_XBUTTON_WPARAM(wParam) (HIWORD(wParam)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
930 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
931 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
|
932 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
933 else if (s_uMsg == WM_CAPTURECHANGED) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
934 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
935 /* on W95/NT4, somehow you get in here with an odd Msg |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
936 * if you press one button while holding down the other..*/ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
937 if (s_button_pending == MOUSE_LEFT) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
938 button = MOUSE_RIGHT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
939 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
940 button = MOUSE_LEFT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
941 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
942 if (button >= 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
943 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
944 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
|
945 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
946 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
947 * 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
|
948 * button. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
949 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
950 if (repeated_click |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
951 && ((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
|
952 || (button == MOUSE_RIGHT |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
953 && s_button_pending == MOUSE_LEFT))) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
954 { |
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 * 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
|
957 * 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
|
958 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
959 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
|
960 button = MOUSE_MIDDLE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
961 repeated_click = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
962 s_button_pending = -1; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
963 _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
|
964 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
965 else if ((repeated_click) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
966 || (mouse_model_popup() && (button == MOUSE_RIGHT))) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
967 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
968 if (s_button_pending > -1) |
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 _OnMouseEvent(s_button_pending, x, y, FALSE, keyFlags); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
971 s_button_pending = -1; |
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 /* TRACE("Button down at x %d, y %d\n", x, y); */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
974 _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
|
975 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
976 else |
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 * 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
|
980 * 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
|
981 * i) button-up |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
982 * ii) mouse move |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
983 * iii) another button press |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
984 * before using it. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
985 * 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
|
986 * 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
|
987 * 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
|
988 * 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
|
989 * this is hardly a problem. |
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 s_button_pending = button; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
992 s_x_pending = x; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
993 s_y_pending = y; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
994 s_kFlags_pending = keyFlags; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
995 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
996 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
997 s_prevTime = currentTime; |
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 } |
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 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1002 _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
|
1003 HWND hwnd UNUSED, |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1004 int x, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1005 int y, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1006 UINT keyFlags) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1007 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1008 int button; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1009 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1010 s_getting_focus = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1011 if (s_button_pending > -1) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1012 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1013 /* Delayed action for mouse down event */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1014 _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
|
1015 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
|
1016 s_button_pending = -1; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1017 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1018 if (s_uMsg == WM_MOUSEMOVE) |
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 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1021 * 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
|
1022 * down. |
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 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
|
1025 | MK_XBUTTON1 | MK_XBUTTON2))) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1026 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1027 gui_mouse_moved(x, y); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1028 return; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1029 } |
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 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1032 * 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
|
1033 * the mouse goes outside the window |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1034 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1035 SetCapture(s_textArea); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1036 button = MOUSE_DRAG; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1037 /* TRACE(" move at x %d, y %d\n", x, y); */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1038 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1039 else |
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 ReleaseCapture(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1042 button = MOUSE_RELEASE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1043 /* TRACE(" up at x %d, y %d\n", x, y); */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1044 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1045 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1046 _OnMouseEvent(button, x, y, FALSE, keyFlags); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1047 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1048 |
12934
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
1049 static void |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
1050 _OnSizeTextArea( |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
1051 HWND hwnd UNUSED, |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
1052 UINT state UNUSED, |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
1053 int cx UNUSED, |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
1054 int cy UNUSED) |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
1055 { |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
1056 #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
|
1057 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
|
1058 directx_binddc(); |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
1059 #endif |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
1060 } |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
1061 |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1062 #ifdef FEAT_MENU |
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 * 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
|
1065 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1066 static vimmenu_T * |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1067 gui_mswin_find_menu( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1068 vimmenu_T *pMenu, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1069 int id) |
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 vimmenu_T *pChildMenu; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1072 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1073 while (pMenu) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1074 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1075 if (pMenu->id == (UINT)id) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1076 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1077 if (pMenu->children != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1078 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1079 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
|
1080 if (pChildMenu) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1081 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1082 pMenu = pChildMenu; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1083 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1084 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1085 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1086 pMenu = pMenu->next; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1087 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1088 return pMenu; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1089 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1090 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1091 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1092 _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
|
1093 HWND hwnd UNUSED, |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1094 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
|
1095 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
|
1096 UINT codeNotify UNUSED) |
8140
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 vimmenu_T *pMenu; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1099 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1100 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
|
1101 if (pMenu) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1102 gui_menu_cb(pMenu); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1103 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1104 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1105 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1106 #ifdef MSWIN_FIND_REPLACE |
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 * Handle a Find/Replace window message. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1109 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1110 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1111 _OnFindRepl(void) |
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 int flags = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1114 int down; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1115 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1116 if (s_findrep_struct.Flags & FR_DIALOGTERM) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1117 /* Give main window the focus back. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1118 (void)SetFocus(s_hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1119 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1120 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
|
1121 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1122 flags = FRD_FINDNEXT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1123 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1124 /* Give main window the focus back: this is so the cursor isn't |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1125 * hollow. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1126 (void)SetFocus(s_hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1127 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1128 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
|
1129 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1130 flags = FRD_REPLACE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1131 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1132 /* Give main window the focus back: this is so the cursor isn't |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1133 * hollow. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1134 (void)SetFocus(s_hwnd); |
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 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
|
1137 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1138 flags = FRD_REPLACEALL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1139 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1140 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1141 if (flags != 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1142 { |
16196
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
1143 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
|
1144 |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1145 /* Call the generic GUI function to do the actual work. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1146 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
|
1147 flags |= FRD_WHOLE_WORD; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1148 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
|
1149 flags |= FRD_MATCH_CASE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1150 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
|
1151 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
|
1152 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
|
1153 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
|
1154 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
|
1155 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
|
1156 vim_free(q); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1157 } |
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 #endif |
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 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1162 HandleMouseHide(UINT uMsg, LPARAM lParam) |
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 static LPARAM last_lParam = 0L; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1165 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1166 /* We sometimes get a mousemove when the mouse didn't move... */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1167 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
|
1168 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1169 if (lParam == last_lParam) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1170 return; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1171 last_lParam = lParam; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1172 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1173 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1174 /* Handle specially, to centralise coding. We need to be sure we catch all |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1175 * possible events which should cause us to restore the cursor (as it is a |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1176 * shared resource, we take full responsibility for it). |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1177 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1178 switch (uMsg) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1179 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1180 case WM_KEYUP: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1181 case WM_CHAR: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1182 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1183 * blank out the pointer if necessary |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1184 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1185 if (p_mh) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1186 gui_mch_mousehide(TRUE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1187 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1188 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1189 case WM_SYSKEYUP: /* show the pointer when a system-key is pressed */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1190 case WM_SYSCHAR: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1191 case WM_MOUSEMOVE: /* show the pointer on any mouse action */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1192 case WM_LBUTTONDOWN: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1193 case WM_LBUTTONUP: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1194 case WM_MBUTTONDOWN: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1195 case WM_MBUTTONUP: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1196 case WM_RBUTTONDOWN: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1197 case WM_RBUTTONUP: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1198 case WM_XBUTTONDOWN: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1199 case WM_XBUTTONUP: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1200 case WM_NCMOUSEMOVE: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1201 case WM_NCLBUTTONDOWN: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1202 case WM_NCLBUTTONUP: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1203 case WM_NCMBUTTONDOWN: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1204 case WM_NCMBUTTONUP: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1205 case WM_NCRBUTTONDOWN: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1206 case WM_NCRBUTTONUP: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1207 case WM_KILLFOCUS: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1208 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1209 * 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
|
1210 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1211 gui_mch_mousehide(FALSE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1212 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1213 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1214 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1215 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1216 static LRESULT CALLBACK |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1217 _TextAreaWndProc( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1218 HWND hwnd, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1219 UINT uMsg, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1220 WPARAM wParam, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1221 LPARAM lParam) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1222 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1223 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1224 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
|
1225 hwnd, uMsg, wParam, lParam); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1226 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1227 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1228 HandleMouseHide(uMsg, lParam); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1229 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1230 s_uMsg = uMsg; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1231 s_wParam = wParam; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1232 s_lParam = lParam; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1233 |
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
|
1234 #ifdef FEAT_BEVAL_GUI |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1235 TrackUserActivity(uMsg); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1236 #endif |
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 switch (uMsg) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1239 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1240 HANDLE_MSG(hwnd, WM_LBUTTONDBLCLK,_OnMouseButtonDown); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1241 HANDLE_MSG(hwnd, WM_LBUTTONDOWN,_OnMouseButtonDown); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1242 HANDLE_MSG(hwnd, WM_LBUTTONUP, _OnMouseMoveOrRelease); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1243 HANDLE_MSG(hwnd, WM_MBUTTONDBLCLK,_OnMouseButtonDown); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1244 HANDLE_MSG(hwnd, WM_MBUTTONDOWN,_OnMouseButtonDown); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1245 HANDLE_MSG(hwnd, WM_MBUTTONUP, _OnMouseMoveOrRelease); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1246 HANDLE_MSG(hwnd, WM_MOUSEMOVE, _OnMouseMoveOrRelease); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1247 HANDLE_MSG(hwnd, WM_PAINT, _OnPaint); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1248 HANDLE_MSG(hwnd, WM_RBUTTONDBLCLK,_OnMouseButtonDown); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1249 HANDLE_MSG(hwnd, WM_RBUTTONDOWN,_OnMouseButtonDown); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1250 HANDLE_MSG(hwnd, WM_RBUTTONUP, _OnMouseMoveOrRelease); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1251 HANDLE_MSG(hwnd, WM_XBUTTONDBLCLK,_OnMouseButtonDown); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1252 HANDLE_MSG(hwnd, WM_XBUTTONDOWN,_OnMouseButtonDown); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1253 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
|
1254 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
|
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 |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1257 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
|
1258 return TRUE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1259 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1260 default: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1261 return MyWindowProc(hwnd, uMsg, wParam, lParam); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1262 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1263 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1264 |
15597
536dd2bc5ac9
patch 8.1.0806: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15549
diff
changeset
|
1265 #ifdef PROTO |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1266 typedef int WINAPI; |
15597
536dd2bc5ac9
patch 8.1.0806: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15549
diff
changeset
|
1267 #endif |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1268 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1269 LRESULT WINAPI |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1270 vim_WindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1271 { |
15597
536dd2bc5ac9
patch 8.1.0806: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15549
diff
changeset
|
1272 #ifdef GLOBAL_IME |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1273 return global_ime_DefWindowProc(hwnd, message, wParam, lParam); |
15597
536dd2bc5ac9
patch 8.1.0806: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15549
diff
changeset
|
1274 #else |
16196
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
1275 return DefWindowProcW(hwnd, message, wParam, lParam); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1276 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1277 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1278 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1279 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1280 * 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
|
1281 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1282 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1283 gui_mch_new_colors(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1284 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1285 /* nothing to do? */ |
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 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1289 * 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
|
1290 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1291 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1292 gui_mch_def_colors(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1293 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1294 gui.norm_pixel = GetSysColor(COLOR_WINDOWTEXT); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1295 gui.back_pixel = GetSysColor(COLOR_WINDOW); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1296 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
|
1297 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
|
1298 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1299 |
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 * 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
|
1302 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1303 int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1304 gui_mch_open(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1305 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1306 /* Actually open the window, if not already visible |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1307 * (may be done already in gui_mch_set_shellsize) */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1308 if (!IsWindowVisible(s_hwnd)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1309 ShowWindow(s_hwnd, SW_SHOWDEFAULT); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1310 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1311 #ifdef MSWIN_FIND_REPLACE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1312 /* Init replace string here, so that we keep it when re-opening the |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1313 * dialog. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1314 s_findrep_struct.lpstrReplaceWith[0] = NUL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1315 #endif |
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 return OK; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1318 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1319 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1320 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1321 * 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
|
1322 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1323 int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1324 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
|
1325 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1326 RECT rect; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1327 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1328 GetWindowRect(s_hwnd, &rect); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1329 *x = rect.left; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1330 *y = rect.top; |
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 * 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
|
1336 * coordinates. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1337 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1338 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1339 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
|
1340 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1341 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
|
1342 SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1343 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1344 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1345 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
|
1346 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1347 static int oldx = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1348 static int oldy = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1349 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1350 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
|
1351 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1352 #ifdef FEAT_TOOLBAR |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1353 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
|
1354 SendMessage(s_toolbarhwnd, WM_SIZE, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1355 (WPARAM)0, (LPARAM)(w + ((long)(TOOLBAR_BUTTON_HEIGHT+8)<<16))); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1356 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1357 #if defined(FEAT_GUI_TABLINE) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1358 if (showing_tabline) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1359 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1360 int top = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1361 RECT rect; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1362 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1363 # ifdef FEAT_TOOLBAR |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1364 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
|
1365 top = TOOLBAR_BUTTON_HEIGHT + TOOLBAR_BORDER_HEIGHT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1366 # endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1367 GetClientRect(s_hwnd, &rect); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1368 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
|
1369 } |
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1372 /* When side scroll bar is unshown, the size of window will change. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1373 * then, the text area move left or right. thus client rect should be |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1374 * forcedly redrawn. (Yasuhiro Matsumoto) */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1375 if (oldx != x || oldy != y) |
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 InvalidateRect(s_hwnd, NULL, FALSE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1378 oldx = x; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1379 oldy = y; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1380 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1381 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1382 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1383 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1384 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1385 * Scrollbar stuff: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1386 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1387 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1388 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1389 gui_mch_enable_scrollbar( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1390 scrollbar_T *sb, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1391 int flag) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1392 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1393 ShowScrollBar(sb->id, SB_CTL, flag); |
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 /* TODO: When the window is maximized, the size of the window stays the |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1396 * same, thus the size of the text area changes. On Win98 it's OK, on Win |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1397 * NT 4.0 it's not... */ |
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1400 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1401 gui_mch_set_scrollbar_pos( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1402 scrollbar_T *sb, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1403 int x, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1404 int y, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1405 int w, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1406 int h) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1407 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1408 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
|
1409 SWP_NOZORDER | SWP_NOACTIVATE | SWP_SHOWWINDOW); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1410 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1411 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1412 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1413 gui_mch_create_scrollbar( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1414 scrollbar_T *sb, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1415 int orient) /* SBAR_VERT or SBAR_HORIZ */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1416 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1417 sb->id = CreateWindow( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1418 "SCROLLBAR", "Scrollbar", |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1419 WS_CHILD | ((orient == SBAR_VERT) ? SBS_VERT : SBS_HORZ), 0, 0, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1420 10, /* Any value will do for now */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1421 10, /* Any value will do for now */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1422 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
|
1423 g_hinst, NULL); |
8140
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1426 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1427 * 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
|
1428 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1429 static scrollbar_T * |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1430 gui_mswin_find_scrollbar(HWND hwnd) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1431 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1432 win_T *wp; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1433 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1434 if (gui.bottom_sbar.id == hwnd) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1435 return &gui.bottom_sbar; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1436 FOR_ALL_WINDOWS(wp) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1437 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1438 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
|
1439 return &wp->w_scrollbars[SBAR_LEFT]; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1440 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
|
1441 return &wp->w_scrollbars[SBAR_RIGHT]; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1442 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1443 return NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1444 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1445 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1446 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1447 * 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
|
1448 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1449 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1450 GetFontSize(GuiFont font) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1451 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1452 HWND hwnd = GetDesktopWindow(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1453 HDC hdc = GetWindowDC(hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1454 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
|
1455 SIZE size; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1456 TEXTMETRIC tm; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1457 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1458 GetTextMetrics(hdc, &tm); |
16582
9a7d98e11954
patch 8.1.1294: MS-Windows: Some fonts return wrong average char width
Bram Moolenaar <Bram@vim.org>
parents:
16468
diff
changeset
|
1459 // GetTextMetrics() may not return the right value in tmAveCharWidth |
9a7d98e11954
patch 8.1.1294: MS-Windows: Some fonts return wrong average char width
Bram Moolenaar <Bram@vim.org>
parents:
16468
diff
changeset
|
1460 // for some fonts. Do our own average computation. |
9a7d98e11954
patch 8.1.1294: MS-Windows: Some fonts return wrong average char width
Bram Moolenaar <Bram@vim.org>
parents:
16468
diff
changeset
|
1461 GetTextExtentPoint(hdc, |
9a7d98e11954
patch 8.1.1294: MS-Windows: Some fonts return wrong average char width
Bram Moolenaar <Bram@vim.org>
parents:
16468
diff
changeset
|
1462 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", |
9a7d98e11954
patch 8.1.1294: MS-Windows: Some fonts return wrong average char width
Bram Moolenaar <Bram@vim.org>
parents:
16468
diff
changeset
|
1463 52, &size); |
9a7d98e11954
patch 8.1.1294: MS-Windows: Some fonts return wrong average char width
Bram Moolenaar <Bram@vim.org>
parents:
16468
diff
changeset
|
1464 gui.char_width = (size.cx / 26 + 1) / 2 + tm.tmOverhang; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1465 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1466 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
|
1467 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1468 SelectFont(hdc, hfntOld); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1469 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1470 ReleaseDC(hwnd, hdc); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1471 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1472 |
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 * 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
|
1475 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1476 int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1477 gui_mch_adjust_charheight(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1478 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1479 GetFontSize(gui.norm_font); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1480 return OK; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1481 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1482 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1483 static GuiFont |
16152
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
1484 get_font_handle(LOGFONTW *lf) |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1485 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1486 HFONT font = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1487 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1488 /* Load the font */ |
16152
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
1489 font = CreateFontIndirectW(lf); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1490 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1491 if (font == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1492 return NOFONT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1493 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1494 return (GuiFont)font; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1495 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1496 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1497 static int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1498 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
|
1499 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1500 int points; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1501 HWND hwnd; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1502 HDC hdc; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1503 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1504 hwnd = GetDesktopWindow(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1505 hdc = GetWindowDC(hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1506 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1507 points = MulDiv(pixels, 72, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1508 GetDeviceCaps(hdc, vertical ? LOGPIXELSY : LOGPIXELSX)); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1509 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1510 ReleaseDC(hwnd, hdc); |
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 return points; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1513 } |
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 GuiFont |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1516 gui_mch_get_font( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1517 char_u *name, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1518 int giveErrorIfMissing) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1519 { |
16152
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
1520 LOGFONTW lf; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1521 GuiFont font = NOFONT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1522 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1523 if (get_logfont(&lf, name, NULL, giveErrorIfMissing) == OK) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1524 font = get_font_handle(&lf); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1525 if (font == NOFONT && giveErrorIfMissing) |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15288
diff
changeset
|
1526 semsg(_(e_font), name); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1527 return font; |
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1530 #if defined(FEAT_EVAL) || defined(PROTO) |
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 * 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
|
1533 * 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
|
1534 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1535 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
|
1536 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
|
1537 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1538 if (name == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1539 return NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1540 return vim_strsave(name); |
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 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1543 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1544 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1545 gui_mch_free_font(GuiFont font) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1546 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1547 if (font) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1548 DeleteObject((HFONT)font); |
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1551 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1552 * 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
|
1553 * Return INVALCOLOR for error. |
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 guicolor_T |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1556 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
|
1557 { |
9017
7b1200ea03a1
commit https://github.com/vim/vim/commit/c285fe7c3ffdb3ec4eff20a1d1d5accfc80f1a86
Christian Brabandt <cb@256bit.org>
parents:
9013
diff
changeset
|
1558 int i; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1559 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1560 typedef struct SysColorTable |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1561 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1562 char *name; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1563 int color; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1564 } SysColorTable; |
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 static SysColorTable sys_table[] = |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1567 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1568 {"SYS_3DDKSHADOW", COLOR_3DDKSHADOW}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1569 {"SYS_3DHILIGHT", COLOR_3DHILIGHT}, |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1570 #ifdef COLOR_3DHIGHLIGHT |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1571 {"SYS_3DHIGHLIGHT", COLOR_3DHIGHLIGHT}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1572 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1573 {"SYS_BTNHILIGHT", COLOR_BTNHILIGHT}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1574 {"SYS_BTNHIGHLIGHT", COLOR_BTNHIGHLIGHT}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1575 {"SYS_3DLIGHT", COLOR_3DLIGHT}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1576 {"SYS_3DSHADOW", COLOR_3DSHADOW}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1577 {"SYS_DESKTOP", COLOR_DESKTOP}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1578 {"SYS_INFOBK", COLOR_INFOBK}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1579 {"SYS_INFOTEXT", COLOR_INFOTEXT}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1580 {"SYS_3DFACE", COLOR_3DFACE}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1581 {"SYS_BTNFACE", COLOR_BTNFACE}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1582 {"SYS_BTNSHADOW", COLOR_BTNSHADOW}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1583 {"SYS_ACTIVEBORDER", COLOR_ACTIVEBORDER}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1584 {"SYS_ACTIVECAPTION", COLOR_ACTIVECAPTION}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1585 {"SYS_APPWORKSPACE", COLOR_APPWORKSPACE}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1586 {"SYS_BACKGROUND", COLOR_BACKGROUND}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1587 {"SYS_BTNTEXT", COLOR_BTNTEXT}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1588 {"SYS_CAPTIONTEXT", COLOR_CAPTIONTEXT}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1589 {"SYS_GRAYTEXT", COLOR_GRAYTEXT}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1590 {"SYS_HIGHLIGHT", COLOR_HIGHLIGHT}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1591 {"SYS_HIGHLIGHTTEXT", COLOR_HIGHLIGHTTEXT}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1592 {"SYS_INACTIVEBORDER", COLOR_INACTIVEBORDER}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1593 {"SYS_INACTIVECAPTION", COLOR_INACTIVECAPTION}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1594 {"SYS_INACTIVECAPTIONTEXT", COLOR_INACTIVECAPTIONTEXT}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1595 {"SYS_MENU", COLOR_MENU}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1596 {"SYS_MENUTEXT", COLOR_MENUTEXT}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1597 {"SYS_SCROLLBAR", COLOR_SCROLLBAR}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1598 {"SYS_WINDOW", COLOR_WINDOW}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1599 {"SYS_WINDOWFRAME", COLOR_WINDOWFRAME}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1600 {"SYS_WINDOWTEXT", COLOR_WINDOWTEXT} |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1601 }; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1602 |
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 * 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
|
1605 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1606 for (i = 0; i < sizeof(sys_table) / sizeof(sys_table[0]); i++) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1607 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
|
1608 return GetSysColor(sys_table[i].color); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1609 |
9013
22c29a515b53
commit https://github.com/vim/vim/commit/ab3022196ea4f1496e79b8ee85996e31c45d02f1
Christian Brabandt <cb@256bit.org>
parents:
8835
diff
changeset
|
1610 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
|
1611 } |
9017
7b1200ea03a1
commit https://github.com/vim/vim/commit/c285fe7c3ffdb3ec4eff20a1d1d5accfc80f1a86
Christian Brabandt <cb@256bit.org>
parents:
9013
diff
changeset
|
1612 |
11745
5a5709918a98
patch 8.0.0755: terminal window does not have colors in the GUI
Christian Brabandt <cb@256bit.org>
parents:
11410
diff
changeset
|
1613 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
|
1614 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
|
1615 { |
5a5709918a98
patch 8.0.0755: terminal window does not have colors in the GUI
Christian Brabandt <cb@256bit.org>
parents:
11410
diff
changeset
|
1616 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
|
1617 } |
5a5709918a98
patch 8.0.0755: terminal window does not have colors in the GUI
Christian Brabandt <cb@256bit.org>
parents:
11410
diff
changeset
|
1618 |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1619 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1620 * 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
|
1621 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1622 int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1623 gui_mch_haskey(char_u *name) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1624 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1625 int i; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1626 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1627 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
|
1628 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
|
1629 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
|
1630 return OK; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1631 return FAIL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1632 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1633 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1634 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1635 gui_mch_beep(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1636 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1637 MessageBeep(MB_OK); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1638 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1639 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1640 * 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
|
1641 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1642 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1643 gui_mch_invert_rectangle( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1644 int r, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1645 int c, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1646 int nr, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1647 int nc) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1648 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1649 RECT rc; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1650 |
12934
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
1651 #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
|
1652 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
|
1653 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
|
1654 #endif |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
1655 |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1656 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1657 * 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
|
1658 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1659 rc.left = FILL_X(c); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1660 rc.top = FILL_Y(r); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1661 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
|
1662 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
|
1663 InvertRect(s_hdc, &rc); |
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 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1667 * Iconify the GUI window. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1668 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1669 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1670 gui_mch_iconify(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1671 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1672 ShowWindow(s_hwnd, SW_MINIMIZE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1673 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1674 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1675 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1676 * Draw a cursor without focus. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1677 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1678 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1679 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
|
1680 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1681 HBRUSH hbr; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1682 RECT rc; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1683 |
12934
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
1684 #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
|
1685 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
|
1686 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
|
1687 #endif |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
1688 |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1689 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1690 * 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
|
1691 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1692 rc.left = FILL_X(gui.col); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1693 rc.top = FILL_Y(gui.row); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1694 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
|
1695 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
|
1696 rc.right += gui.char_width; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1697 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
|
1698 hbr = CreateSolidBrush(color); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1699 FrameRect(s_hdc, &rc, hbr); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1700 DeleteBrush(hbr); |
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 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1703 * 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
|
1704 * color "color". |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1705 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1706 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1707 gui_mch_draw_part_cursor( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1708 int w, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1709 int h, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1710 guicolor_T color) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1711 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1712 RECT rc; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1713 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1714 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1715 * 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
|
1716 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1717 rc.left = |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1718 #ifdef FEAT_RIGHTLEFT |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1719 /* vertical line should be on the right of current point */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1720 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
|
1721 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1722 FILL_X(gui.col); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1723 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
|
1724 rc.right = rc.left + w; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1725 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
|
1726 |
12986
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
1727 fill_rect(&rc, NULL, color); |
8140
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 |
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 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1732 * 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
|
1733 * 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
|
1734 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1735 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1736 outputDeadKey_rePost(MSG originalMsg) |
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 static MSG deadCharExpel; |
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 if (!dead_key) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1741 return; |
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 dead_key = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1744 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1745 /* Make Windows generate the dead key's character */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1746 deadCharExpel.message = originalMsg.message; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1747 deadCharExpel.hwnd = originalMsg.hwnd; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1748 deadCharExpel.wParam = VK_SPACE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1749 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1750 MyTranslateMessage(&deadCharExpel); |
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 /* re-generate the current character free of the dead char influence */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1753 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
|
1754 originalMsg.lParam); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1755 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1756 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1757 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1758 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1759 * Process a single Windows message. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1760 * 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
|
1761 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1762 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1763 process_message(void) |
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 MSG msg; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1766 UINT vk = 0; /* Virtual key */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1767 char_u string[40]; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1768 int i; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1769 int modifiers = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1770 int key; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1771 #ifdef FEAT_MENU |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1772 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
|
1773 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1774 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1775 pGetMessage(&msg, NULL, 0, 0); |
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 #ifdef FEAT_OLE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1778 /* Look after OLE Automation commands */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1779 if (msg.message == WM_OLE) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1780 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1781 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
|
1782 if (str == NULL || *str == NUL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1783 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1784 /* Message can't be ours, forward it. Fixes problem with Ultramon |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1785 * 3.0.4 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1786 pDispatchMessage(&msg); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1787 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1788 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1789 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1790 add_to_input_buf(str, (int)STRLEN(str)); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1791 vim_free(str); /* was allocated in CVim::SendKeys() */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1792 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1793 return; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1794 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1795 #endif |
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 #ifdef MSWIN_FIND_REPLACE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1798 /* Don't process messages used by the dialog */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1799 if (s_findrep_hwnd != NULL && pIsDialogMessage(s_findrep_hwnd, &msg)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1800 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1801 HandleMouseHide(msg.message, msg.lParam); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1802 return; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1803 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1804 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1805 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1806 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1807 * 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
|
1808 * TranslateMessage(). |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1809 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1810 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
|
1811 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1812 vk = (int) msg.wParam; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1813 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1814 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1815 * 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
|
1816 * handle them and do not interfere. |
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 * 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
|
1819 * - 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
|
1820 * 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
|
1821 * dead character on its own) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1822 * |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1823 * - 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
|
1824 * expel the dead character as this could trigger an infinite loop if |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1825 * for some reason MyTranslateMessage() do not trigger a call |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1826 * immediately to _OnChar() (or _OnSysChar()). |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1827 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1828 if (dead_key) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1829 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1830 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1831 * 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
|
1832 * 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
|
1833 * 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
|
1834 * handle it. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1835 * |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1836 * 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
|
1837 * 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
|
1838 * 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
|
1839 * 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
|
1840 * user expects. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1841 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1842 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
|
1843 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1844 dead_key = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1845 MyTranslateMessage(&msg); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1846 return; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1847 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1848 /* In modes where we are not typing, dead keys should behave |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1849 * normally */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1850 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
|
1851 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1852 outputDeadKey_rePost(msg); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1853 return; |
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 } |
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 /* Check for CTRL-BREAK */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1858 if (vk == VK_CANCEL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1859 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1860 trash_input_buf(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1861 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
|
1862 ctrl_break_was_pressed = TRUE; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1863 string[0] = Ctrl_C; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1864 add_to_input_buf(string, 1); |
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1867 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
|
1868 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1869 /* ignore VK_SPACE when ALT key pressed: system menu */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1870 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
|
1871 && (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
|
1872 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1873 /* |
9252
c25898cc99c1
commit https://github.com/vim/vim/commit/945ec093cd4ddefab930239990564b12eb232153
Christian Brabandt <cb@256bit.org>
parents:
9236
diff
changeset
|
1874 * 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
|
1875 * 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
|
1876 * 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
|
1877 * the TAB key, etc...). |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1878 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1879 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
|
1880 || vk == VK_TAB || vk == CAR)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1881 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1882 outputDeadKey_rePost(msg); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1883 return; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1884 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1885 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1886 #ifdef FEAT_MENU |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1887 /* Check for <F10>: Windows selects the menu. When <F10> is |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1888 * mapped we want to use the mapping instead. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1889 if (vk == VK_F10 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1890 && gui.menu_is_active |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1891 && 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
|
1892 NULL, NULL) == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1893 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1894 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1895 if (GetKeyState(VK_SHIFT) & 0x8000) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1896 modifiers |= MOD_MASK_SHIFT; |
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 * 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
|
1899 * 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
|
1900 * shifted -- webb |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1901 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1902 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1903 if (GetKeyState(VK_CAPITAL) & 0x0001) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1904 modifiers ^= MOD_MASK_SHIFT; |
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 if (GetKeyState(VK_CONTROL) & 0x8000) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1907 modifiers |= MOD_MASK_CTRL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1908 if (GetKeyState(VK_MENU) & 0x8000) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1909 modifiers |= MOD_MASK_ALT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1910 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1911 if (special_keys[i].vim_code1 == NUL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1912 key = special_keys[i].vim_code0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1913 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1914 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
|
1915 special_keys[i].vim_code1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1916 key = simplify_key(key, &modifiers); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1917 if (key == CSI) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1918 key = K_CSI; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1919 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1920 if (modifiers) |
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 string[0] = CSI; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1923 string[1] = KS_MODIFIER; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1924 string[2] = modifiers; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1925 add_to_input_buf(string, 3); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1926 } |
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 if (IS_SPECIAL(key)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1929 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1930 string[0] = CSI; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1931 string[1] = K_SECOND(key); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1932 string[2] = K_THIRD(key); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1933 add_to_input_buf(string, 3); |
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 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1936 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1937 int len; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1938 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1939 /* Handle "key" as a Unicode character. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1940 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
|
1941 add_to_input_buf(string, len); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1942 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1943 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1944 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1945 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1946 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
|
1947 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1948 /* Some keys need C-S- where they should only need C-. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1949 * Ignore 0xff, Windows XP sends it when NUMLOCK has changed since |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1950 * system startup (Helmut Stiegler, 2003 Oct 3). */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1951 if (vk != 0xff |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1952 && (GetKeyState(VK_CONTROL) & 0x8000) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1953 && !(GetKeyState(VK_SHIFT) & 0x8000) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1954 && !(GetKeyState(VK_MENU) & 0x8000)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1955 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1956 /* CTRL-6 is '^'; Japanese keyboard maps '^' to vk == 0xDE */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1957 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
|
1958 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1959 string[0] = Ctrl_HAT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1960 add_to_input_buf(string, 1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1961 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1962 /* vk == 0xBD AZERTY for CTRL-'-', but CTRL-[ for * QWERTY! */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1963 else if (vk == 0xBD) /* QWERTY for CTRL-'-' */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1964 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1965 string[0] = Ctrl__; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1966 add_to_input_buf(string, 1); |
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 /* CTRL-2 is '@'; Japanese keyboard maps '@' to vk == 0xC0 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1969 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
|
1970 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1971 string[0] = Ctrl_AT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1972 add_to_input_buf(string, 1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1973 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1974 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1975 MyTranslateMessage(&msg); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1976 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1977 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1978 MyTranslateMessage(&msg); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1979 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1980 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1981 #ifdef FEAT_MBYTE_IME |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1982 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
|
1983 _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
|
1984 else if (msg.message == WM_KEYUP && im_get_status()) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1985 /* added for non-MS IME (Yasuhiro Matsumoto) */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1986 MyTranslateMessage(&msg); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1987 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1988 #if !defined(FEAT_MBYTE_IME) && defined(GLOBAL_IME) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1989 /* GIME_TEST */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1990 else if (msg.message == WM_IME_STARTCOMPOSITION) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1991 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1992 POINT point; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1993 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1994 global_ime_set_font(&norm_logfont); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1995 point.x = FILL_X(gui.col); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1996 point.y = FILL_Y(gui.row); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1997 MapWindowPoints(s_textArea, s_hwnd, &point, 1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1998 global_ime_set_position(&point); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1999 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2000 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2001 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2002 #ifdef FEAT_MENU |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2003 /* Check for <F10>: Default effect is to select the menu. When <F10> is |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2004 * mapped we need to stop it here to avoid strange effects (e.g., for the |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2005 * key-up event) */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2006 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
|
2007 NULL, NULL) == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2008 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2009 pDispatchMessage(&msg); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2010 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2011 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2012 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2013 * 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
|
2014 * 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
|
2015 * 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
|
2016 * immediately. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2017 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2018 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2019 gui_mch_update(void) |
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 MSG msg; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2022 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2023 if (!s_busy_processing) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2024 while (pPeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2025 && !vim_is_input_buf_full()) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2026 process_message(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2027 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2028 |
9179
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2029 static void |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2030 remove_any_timer(void) |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2031 { |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2032 MSG msg; |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2033 |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2034 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
|
2035 { |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2036 KillTimer(NULL, s_wait_timer); |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2037 |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2038 /* Eat spurious WM_TIMER messages */ |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2039 while (pPeekMessage(&msg, s_hwnd, WM_TIMER, WM_TIMER, PM_REMOVE)) |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2040 ; |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2041 s_wait_timer = 0; |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2042 } |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2043 } |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2044 |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2045 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2046 * 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
|
2047 * from the keyboard. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2048 * wtime == -1 Wait forever. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2049 * wtime == 0 This should never happen. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2050 * 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
|
2051 * 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
|
2052 * or FAIL otherwise. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2053 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2054 int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2055 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
|
2056 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2057 int focus; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2058 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2059 s_timed_out = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2060 |
15665
31367ce5aac7
patch 8.1.0840: getchar(0) never returns a character in the terminal
Bram Moolenaar <Bram@vim.org>
parents:
15601
diff
changeset
|
2061 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
|
2062 { |
31367ce5aac7
patch 8.1.0840: getchar(0) never returns a character in the terminal
Bram Moolenaar <Bram@vim.org>
parents:
15601
diff
changeset
|
2063 // 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
|
2064 if (s_busy_processing) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2065 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
|
2066 |
31367ce5aac7
patch 8.1.0840: getchar(0) never returns a character in the terminal
Bram Moolenaar <Bram@vim.org>
parents:
15601
diff
changeset
|
2067 // When called with "wtime" zero, just want one msec. |
31367ce5aac7
patch 8.1.0840: getchar(0) never returns a character in the terminal
Bram Moolenaar <Bram@vim.org>
parents:
15601
diff
changeset
|
2068 s_wait_timer = (UINT)SetTimer(NULL, 0, (UINT)(wtime == 0 ? 1 : wtime), |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2069 (TIMERPROC)_OnTimer); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2070 } |
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 allow_scrollbar = TRUE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2073 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2074 focus = gui.in_focus; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2075 while (!s_timed_out) |
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 /* Stop or start blinking when focus changes */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2078 if (gui.in_focus != focus) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2079 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2080 if (gui.in_focus) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2081 gui_mch_start_blink(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2082 else |
13152
f4c3a7f410f4
patch 8.0.1450: GUI: endless loop when stopping cursor blinking
Christian Brabandt <cb@256bit.org>
parents:
13150
diff
changeset
|
2083 gui_mch_stop_blink(TRUE); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2084 focus = gui.in_focus; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2085 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2086 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2087 if (s_need_activate) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2088 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2089 (void)SetForegroundWindow(s_hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2090 s_need_activate = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2091 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2092 |
9179
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2093 #ifdef FEAT_TIMERS |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2094 did_add_timer = FALSE; |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2095 #endif |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2096 #ifdef MESSAGE_QUEUE |
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
|
2097 /* 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
|
2098 for (;;) |
4f0677020a43
commit https://github.com/vim/vim/commit/9186a276222ea8a7c88f4092ac5b4201381f4e20
Christian Brabandt <cb@256bit.org>
parents:
8172
diff
changeset
|
2099 { |
4f0677020a43
commit https://github.com/vim/vim/commit/9186a276222ea8a7c88f4092ac5b4201381f4e20
Christian Brabandt <cb@256bit.org>
parents:
8172
diff
changeset
|
2100 MSG msg; |
4f0677020a43
commit https://github.com/vim/vim/commit/9186a276222ea8a7c88f4092ac5b4201381f4e20
Christian Brabandt <cb@256bit.org>
parents:
8172
diff
changeset
|
2101 |
4f0677020a43
commit https://github.com/vim/vim/commit/9186a276222ea8a7c88f4092ac5b4201381f4e20
Christian Brabandt <cb@256bit.org>
parents:
8172
diff
changeset
|
2102 parse_queued_messages(); |
4f0677020a43
commit https://github.com/vim/vim/commit/9186a276222ea8a7c88f4092ac5b4201381f4e20
Christian Brabandt <cb@256bit.org>
parents:
8172
diff
changeset
|
2103 |
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
|
2104 if (pPeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) |
c4caf49c8bf4
patch 8.0.0925: MS-Windows GUI: channel I/O not handled right away
Christian Brabandt <cb@256bit.org>
parents:
12066
diff
changeset
|
2105 { |
c4caf49c8bf4
patch 8.0.0925: MS-Windows GUI: channel I/O not handled right away
Christian Brabandt <cb@256bit.org>
parents:
12066
diff
changeset
|
2106 process_message(); |
8222
4f0677020a43
commit https://github.com/vim/vim/commit/9186a276222ea8a7c88f4092ac5b4201381f4e20
Christian Brabandt <cb@256bit.org>
parents:
8172
diff
changeset
|
2107 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
|
2108 } |
c4caf49c8bf4
patch 8.0.0925: MS-Windows GUI: channel I/O not handled right away
Christian Brabandt <cb@256bit.org>
parents:
12066
diff
changeset
|
2109 else if (MsgWaitForMultipleObjects(0, NULL, FALSE, 100, QS_ALLINPUT) |
c4caf49c8bf4
patch 8.0.0925: MS-Windows GUI: channel I/O not handled right away
Christian Brabandt <cb@256bit.org>
parents:
12066
diff
changeset
|
2110 != WAIT_TIMEOUT) |
c4caf49c8bf4
patch 8.0.0925: MS-Windows GUI: channel I/O not handled right away
Christian Brabandt <cb@256bit.org>
parents:
12066
diff
changeset
|
2111 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
|
2112 } |
c4caf49c8bf4
patch 8.0.0925: MS-Windows GUI: channel I/O not handled right away
Christian Brabandt <cb@256bit.org>
parents:
12066
diff
changeset
|
2113 #else |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2114 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2115 * Don't use gui_mch_update() because then we will spin-lock until a |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2116 * char arrives, instead we use GetMessage() to hang until an |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2117 * event arrives. No need to check for input_buf_full because we are |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2118 * returning as soon as it contains a single char -- webb |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2119 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2120 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
|
2121 #endif |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2122 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2123 if (input_available()) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2124 { |
9179
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2125 remove_any_timer(); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2126 allow_scrollbar = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2127 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2128 /* Clear pending mouse button, the release event may have been |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2129 * taken by the dialog window. But don't do this when getting |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2130 * focus, we need the mouse-up event then. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2131 if (!s_getting_focus) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2132 s_button_pending = -1; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2133 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2134 return OK; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2135 } |
9179
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2136 |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2137 #ifdef FEAT_TIMERS |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2138 if (did_add_timer) |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2139 { |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2140 /* Need to recompute the waiting time. */ |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2141 remove_any_timer(); |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2142 break; |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2143 } |
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 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2146 allow_scrollbar = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2147 return FAIL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2148 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2149 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2150 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2151 * 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
|
2152 * (row2, col2) inclusive. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2153 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2154 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2155 gui_mch_clear_block( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2156 int row1, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2157 int col1, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2158 int row2, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2159 int col2) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2160 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2161 RECT rc; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2162 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2163 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2164 * 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
|
2165 * spilled over to the window border. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2166 * 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
|
2167 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2168 rc.left = FILL_X(col1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2169 rc.top = FILL_Y(row1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2170 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
|
2171 rc.bottom = FILL_Y(row2 + 1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2172 clear_rect(&rc); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2173 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2174 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2175 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2176 * Clear the whole text window. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2177 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2178 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2179 gui_mch_clear_all(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2180 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2181 RECT rc; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2182 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2183 rc.left = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2184 rc.top = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2185 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
|
2186 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
|
2187 clear_rect(&rc); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2188 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2189 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2190 * Menu stuff. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2191 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2192 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2193 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2194 gui_mch_enable_menu(int flag) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2195 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2196 #ifdef FEAT_MENU |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2197 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
|
2198 #endif |
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2201 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2202 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
|
2203 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
|
2204 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
|
2205 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
|
2206 int h UNUSED) |
8140
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 /* It will be in the right place anyway */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2209 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2210 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2211 #if defined(FEAT_MENU) || defined(PROTO) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2212 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2213 * 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
|
2214 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2215 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2216 gui_mch_menu_hidden( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2217 vimmenu_T *menu, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2218 int hidden) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2219 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2220 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2221 * 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
|
2222 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2223 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2224 if (hidden) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2225 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
|
2226 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2227 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
|
2228 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2229 gui_mch_menu_grey(menu, hidden); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2230 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2231 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2232 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2233 * 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
|
2234 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2235 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2236 gui_mch_draw_menubar(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2237 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2238 DrawMenuBar(s_hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2239 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2240 #endif /*FEAT_MENU*/ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2241 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2242 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2243 * 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
|
2244 */ |
9939
ccb6461b82df
commit https://github.com/vim/vim/commit/1b58cdd160c2e0ada0f638679a2aa27e4665fc48
Christian Brabandt <cb@256bit.org>
parents:
9834
diff
changeset
|
2245 guicolor_T |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2246 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
|
2247 { |
9939
ccb6461b82df
commit https://github.com/vim/vim/commit/1b58cdd160c2e0ada0f638679a2aa27e4665fc48
Christian Brabandt <cb@256bit.org>
parents:
9834
diff
changeset
|
2248 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
|
2249 + GetBValue(pixel)); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2250 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2251 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2252 #if defined(FEAT_GUI_DIALOG) || defined(PROTO) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2253 /* Convert pixels in X to dialog units */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2254 static WORD |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2255 PixelToDialogX(int numPixels) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2256 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2257 return (WORD)((numPixels * 4) / s_dlgfntwidth); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2258 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2259 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2260 /* Convert pixels in Y to dialog units */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2261 static WORD |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2262 PixelToDialogY(int numPixels) |
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 return (WORD)((numPixels * 8) / s_dlgfntheight); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2265 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2266 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2267 /* Return the width in pixels of the given text in the given DC. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2268 static int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2269 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
|
2270 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2271 SIZE size; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2272 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2273 GetTextExtentPoint(hdc, (LPCSTR)str, len, &size); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2274 return size.cx; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2275 } |
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 * 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
|
2279 * of 'encoding' to active codepage conversion. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2280 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2281 static int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2282 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
|
2283 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2284 SIZE size; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2285 WCHAR *wstr; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2286 int n; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2287 int wlen = len; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2288 |
16196
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2289 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
|
2290 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
|
2291 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
|
2292 |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2293 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
|
2294 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
|
2295 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
|
2296 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
|
2297 return 0; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2298 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2299 |
10438
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2300 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
|
2301 |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2302 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2303 * 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
|
2304 * 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
|
2305 * monitors. |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2306 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2307 static BOOL |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2308 CenterWindow( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2309 HWND hwndChild, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2310 HWND hwndParent) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2311 { |
10438
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2312 HMONITOR mon; |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2313 MONITORINFO moninfo; |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2314 RECT rChild, rParent, rScreen; |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2315 int wChild, hChild, wParent, hParent; |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2316 int xNew, yNew; |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2317 HDC hdc; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2318 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2319 GetWindowRect(hwndChild, &rChild); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2320 wChild = rChild.right - rChild.left; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2321 hChild = rChild.bottom - rChild.top; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2322 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2323 /* If Vim is minimized put the window in the middle of the screen. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2324 if (hwndParent == NULL || IsMinimized(hwndParent)) |
10438
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2325 get_work_area(&rParent); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2326 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2327 GetWindowRect(hwndParent, &rParent); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2328 wParent = rParent.right - rParent.left; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2329 hParent = rParent.bottom - rParent.top; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2330 |
10438
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2331 moninfo.cbSize = sizeof(MONITORINFO); |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2332 mon = MonitorFromWindow(hwndChild, MONITOR_DEFAULTTOPRIMARY); |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2333 if (mon != NULL && GetMonitorInfo(mon, &moninfo)) |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2334 { |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2335 rScreen = moninfo.rcWork; |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2336 } |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2337 else |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2338 { |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2339 hdc = GetDC(hwndChild); |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2340 rScreen.left = 0; |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2341 rScreen.top = 0; |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2342 rScreen.right = GetDeviceCaps(hdc, HORZRES); |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2343 rScreen.bottom = GetDeviceCaps(hdc, VERTRES); |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2344 ReleaseDC(hwndChild, hdc); |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2345 } |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2346 |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2347 xNew = rParent.left + ((wParent - wChild) / 2); |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2348 if (xNew < rScreen.left) |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2349 xNew = rScreen.left; |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2350 else if ((xNew + wChild) > rScreen.right) |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2351 xNew = rScreen.right - wChild; |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2352 |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2353 yNew = rParent.top + ((hParent - hChild) / 2); |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2354 if (yNew < rScreen.top) |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2355 yNew = rScreen.top; |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2356 else if ((yNew + hChild) > rScreen.bottom) |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2357 yNew = rScreen.bottom - hChild; |
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 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
|
2360 SWP_NOSIZE | SWP_NOZORDER); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2361 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2362 #endif /* FEAT_GUI_DIALOG */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2363 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2364 #if defined(FEAT_TOOLBAR) || defined(PROTO) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2365 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2366 gui_mch_show_toolbar(int showit) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2367 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2368 if (s_toolbarhwnd == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2369 return; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2370 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2371 if (showit) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2372 { |
15597
536dd2bc5ac9
patch 8.1.0806: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15549
diff
changeset
|
2373 # ifndef TB_SETUNICODEFORMAT |
16196
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2374 // For older compilers. We assume this never changes. |
15597
536dd2bc5ac9
patch 8.1.0806: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15549
diff
changeset
|
2375 # define TB_SETUNICODEFORMAT 0x2005 |
536dd2bc5ac9
patch 8.1.0806: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15549
diff
changeset
|
2376 # 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
|
2377 // 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
|
2378 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
|
2379 (LPARAM)0); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2380 ShowWindow(s_toolbarhwnd, SW_SHOW); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2381 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2382 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2383 ShowWindow(s_toolbarhwnd, SW_HIDE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2384 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2385 |
16196
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2386 /* The number of bitmaps is fixed. Exit is missing! */ |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2387 #define TOOLBAR_BITMAP_COUNT 31 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2388 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2389 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2390 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2391 #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
|
2392 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2393 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
|
2394 { |
16196
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2395 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
|
2396 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
|
2397 |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2398 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
|
2399 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
|
2400 return; |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2401 |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2402 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
|
2403 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
|
2404 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
|
2405 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
|
2406 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
|
2407 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
|
2408 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
|
2409 vim_free(wn); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2410 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2411 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2412 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2413 show_tabline_popup_menu(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2414 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2415 HMENU tab_pmenu; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2416 long rval; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2417 POINT pt; |
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 /* When ignoring events don't show the menu. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2420 if (hold_gui_events |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2421 # ifdef FEAT_CMDWIN |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2422 || cmdwin_type != 0 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2423 # endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2424 ) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2425 return; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2426 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2427 tab_pmenu = CreatePopupMenu(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2428 if (tab_pmenu == 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 (first_tabpage->tp_next != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2432 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
|
2433 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
|
2434 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
|
2435 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
|
2436 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
|
2437 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
|
2438 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2439 GetCursorPos(&pt); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2440 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
|
2441 NULL); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2442 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2443 DestroyMenu(tab_pmenu); |
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 /* Add the string cmd into input buffer */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2446 if (rval > 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2447 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2448 TCHITTESTINFO htinfo; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2449 int idx; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2450 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2451 if (ScreenToClient(s_tabhwnd, &pt) == 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2452 return; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2453 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2454 htinfo.pt.x = pt.x; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2455 htinfo.pt.y = pt.y; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2456 idx = TabCtrl_HitTest(s_tabhwnd, &htinfo); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2457 if (idx == -1) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2458 idx = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2459 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2460 idx += 1; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2461 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2462 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
|
2463 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2464 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2465 |
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 * Show or hide the tabline. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2468 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2469 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2470 gui_mch_show_tabline(int showit) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2471 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2472 if (s_tabhwnd == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2473 return; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2474 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2475 if (!showit != !showing_tabline) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2476 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2477 if (showit) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2478 ShowWindow(s_tabhwnd, SW_SHOW); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2479 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2480 ShowWindow(s_tabhwnd, SW_HIDE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2481 showing_tabline = showit; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2482 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2483 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2484 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2485 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2486 * Return TRUE when tabline is displayed. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2487 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2488 int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2489 gui_mch_showing_tabline(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2490 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2491 return s_tabhwnd != NULL && showing_tabline; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2492 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2493 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2494 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2495 * Update the labels of the tabline. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2496 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2497 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2498 gui_mch_update_tabline(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2499 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2500 tabpage_T *tp; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2501 TCITEM tie; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2502 int nr = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2503 int curtabidx = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2504 int tabadded = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2505 WCHAR *wstr = NULL; |
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 (s_tabhwnd == NULL) |
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 |
15597
536dd2bc5ac9
patch 8.1.0806: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15549
diff
changeset
|
2510 #ifndef CCM_SETUNICODEFORMAT |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2511 /* For older compilers. We assume this never changes. */ |
15597
536dd2bc5ac9
patch 8.1.0806: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15549
diff
changeset
|
2512 # define CCM_SETUNICODEFORMAT 0x2005 |
536dd2bc5ac9
patch 8.1.0806: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15549
diff
changeset
|
2513 #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
|
2514 // 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
|
2515 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
|
2516 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2517 tie.mask = TCIF_TEXT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2518 tie.iImage = -1; |
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 /* Disable redraw for tab updates to eliminate O(N^2) draws. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2521 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
|
2522 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2523 /* Add a label for each tab page. They all contain the same text area. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2524 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
|
2525 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2526 if (tp == curtab) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2527 curtabidx = nr; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2528 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2529 if (nr >= TabCtrl_GetItemCount(s_tabhwnd)) |
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 /* Add the tab */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2532 tie.pszText = "-Empty-"; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2533 TabCtrl_InsertItem(s_tabhwnd, nr, &tie); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2534 tabadded = 1; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2535 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2536 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2537 get_tabline_label(tp, FALSE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2538 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
|
2539 |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2540 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
|
2541 if (wstr != NULL) |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2542 { |
16196
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2543 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
|
2544 |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2545 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
|
2546 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
|
2547 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
|
2548 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
|
2549 vim_free(wstr); |
8140
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 } |
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 /* Remove any old labels. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2554 while (nr < TabCtrl_GetItemCount(s_tabhwnd)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2555 TabCtrl_DeleteItem(s_tabhwnd, nr); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2556 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2557 if (!tabadded && TabCtrl_GetCurSel(s_tabhwnd) != curtabidx) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2558 TabCtrl_SetCurSel(s_tabhwnd, curtabidx); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2559 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2560 /* Re-enable redraw and redraw. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2561 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
|
2562 RedrawWindow(s_tabhwnd, NULL, NULL, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2563 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
|
2564 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2565 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
|
2566 TabCtrl_SetCurSel(s_tabhwnd, curtabidx); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2567 } |
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 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2570 * 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
|
2571 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2572 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2573 gui_mch_set_curtab(int nr) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2574 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2575 if (s_tabhwnd == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2576 return; |
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 (TabCtrl_GetCurSel(s_tabhwnd) != nr - 1) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2579 TabCtrl_SetCurSel(s_tabhwnd, nr - 1); |
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2582 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2583 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2584 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2585 * ":simalt" command. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2586 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2587 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2588 ex_simalt(exarg_T *eap) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2589 { |
11386
e2b34123c7dc
patch 8.0.0578: :simalt on MS-Windows does not work properly
Christian Brabandt <cb@256bit.org>
parents:
11129
diff
changeset
|
2590 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
|
2591 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
|
2592 char_u key_name[4]; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2593 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2594 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
|
2595 while (*keys) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2596 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2597 if (*keys == '~') |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2598 *keys = ' '; /* for showing system menu */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2599 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
|
2600 keys++; |
11386
e2b34123c7dc
patch 8.0.0578: :simalt on MS-Windows does not work properly
Christian Brabandt <cb@256bit.org>
parents:
11129
diff
changeset
|
2601 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
|
2602 } |
e2b34123c7dc
patch 8.0.0578: :simalt on MS-Windows does not work properly
Christian Brabandt <cb@256bit.org>
parents:
11129
diff
changeset
|
2603 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
|
2604 { |
11410
db21cc7b40f0
patch 8.0.0589: :simalt still does not work
Christian Brabandt <cb@256bit.org>
parents:
11386
diff
changeset
|
2605 /* Put a NOP in the typeahead buffer so that the message will get |
11386
e2b34123c7dc
patch 8.0.0578: :simalt on MS-Windows does not work properly
Christian Brabandt <cb@256bit.org>
parents:
11129
diff
changeset
|
2606 * processed. */ |
e2b34123c7dc
patch 8.0.0578: :simalt on MS-Windows does not work properly
Christian Brabandt <cb@256bit.org>
parents:
11129
diff
changeset
|
2607 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
|
2608 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
|
2609 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
|
2610 key_name[3] = NUL; |
e2b34123c7dc
patch 8.0.0578: :simalt on MS-Windows does not work properly
Christian Brabandt <cb@256bit.org>
parents:
11129
diff
changeset
|
2611 typebuf_was_filled = TRUE; |
e2b34123c7dc
patch 8.0.0578: :simalt on MS-Windows does not work properly
Christian Brabandt <cb@256bit.org>
parents:
11129
diff
changeset
|
2612 (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
|
2613 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2614 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2615 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2616 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2617 * Create the find & replace dialogs. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2618 * 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
|
2619 * 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
|
2620 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2621 #ifdef MSWIN_FIND_REPLACE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2622 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2623 initialise_findrep(char_u *initial_string) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2624 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2625 int wword = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2626 int mcase = !p_ic; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2627 char_u *entry_text; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2628 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2629 /* Get the search string to use. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2630 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
|
2631 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2632 s_findrep_struct.hwndOwner = s_hwnd; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2633 s_findrep_struct.Flags = FR_DOWN; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2634 if (mcase) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2635 s_findrep_struct.Flags |= FR_MATCHCASE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2636 if (wword) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2637 s_findrep_struct.Flags |= FR_WHOLEWORD; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2638 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
|
2639 { |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2640 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
|
2641 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
|
2642 { |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2643 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
|
2644 |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2645 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
|
2646 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
|
2647 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
|
2648 } |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2649 } |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2650 vim_free(entry_text); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2651 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2652 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2653 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2654 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2655 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
|
2656 { |
16196
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2657 if (title != NULL) |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2658 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2659 WCHAR *wbuf; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2660 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2661 /* Convert the title from 'encoding' to UTF-16. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2662 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
|
2663 if (wbuf != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2664 { |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
2665 SetWindowTextW(hwnd, wbuf); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2666 vim_free(wbuf); |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
2667 } |
16196
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2668 } |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2669 else |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2670 (void)SetWindowTextW(hwnd, NULL); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2671 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2672 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2673 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2674 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
|
2675 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2676 #ifdef MSWIN_FIND_REPLACE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2677 if (s_findrep_msg != 0) |
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 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
|
2680 DestroyWindow(s_findrep_hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2681 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2682 if (!IsWindow(s_findrep_hwnd)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2683 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2684 initialise_findrep(eap->arg); |
16196
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2685 s_findrep_hwnd = FindTextW((LPFINDREPLACEW) &s_findrep_struct); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2686 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2687 |
14364
d876b8588731
patch 8.1.0197: Windows GUI: title for search/replace is wrong
Christian Brabandt <cb@256bit.org>
parents:
14208
diff
changeset
|
2688 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
|
2689 (void)SetFocus(s_findrep_hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2690 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2691 s_findrep_is_find = TRUE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2692 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2693 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2694 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2695 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2696 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2697 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2698 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
|
2699 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2700 #ifdef MSWIN_FIND_REPLACE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2701 if (s_findrep_msg != 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2702 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2703 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
|
2704 DestroyWindow(s_findrep_hwnd); |
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 if (!IsWindow(s_findrep_hwnd)) |
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 initialise_findrep(eap->arg); |
16196
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
2709 s_findrep_hwnd = ReplaceTextW((LPFINDREPLACEW) &s_findrep_struct); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2710 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2711 |
14364
d876b8588731
patch 8.1.0197: Windows GUI: title for search/replace is wrong
Christian Brabandt <cb@256bit.org>
parents:
14208
diff
changeset
|
2712 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
|
2713 (void)SetFocus(s_findrep_hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2714 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2715 s_findrep_is_find = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2716 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2717 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2718 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2719 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2720 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2721 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2722 * Set visibility of the pointer. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2723 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2724 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2725 gui_mch_mousehide(int hide) |
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 if (hide != gui.pointer_hidden) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2728 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2729 ShowCursor(!hide); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2730 gui.pointer_hidden = hide; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2731 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2732 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2733 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2734 #ifdef FEAT_MENU |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2735 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2736 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
|
2737 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2738 /* Unhide the mouse, we don't get move events here. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2739 gui_mch_mousehide(FALSE); |
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 (void)TrackPopupMenu( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2742 (HMENU)menu->submenu_id, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2743 TPM_LEFTALIGN | TPM_LEFTBUTTON, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2744 x, y, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2745 (int)0, /*reserved param*/ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2746 s_hwnd, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2747 NULL); |
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 * 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
|
2750 * 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
|
2751 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2752 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2753 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2754 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2755 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2756 * 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
|
2757 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2758 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2759 _OnEndSession(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2760 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2761 getout_preserve_modified(1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2762 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2763 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2764 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2765 * 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
|
2766 * of a Windows95 window. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2767 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2768 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
|
2769 _OnClose(HWND hwnd UNUSED) |
8140
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 gui_shell_closed(); |
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 * 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
|
2776 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2777 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
|
2778 _OnDestroy(HWND hwnd) |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2779 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2780 if (!destroying) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2781 _OnClose(hwnd); |
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2784 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2785 _OnPaint( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2786 HWND hwnd) |
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 if (!IsMinimized(hwnd)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2789 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2790 PAINTSTRUCT ps; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2791 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2792 out_flush(); /* make sure all output has been processed */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2793 (void)BeginPaint(hwnd, &ps); |
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 /* prevent multi-byte characters from misprinting on an invalid |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2796 * rectangle */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2797 if (has_mbyte) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2798 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2799 RECT rect; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2800 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2801 GetClientRect(hwnd, &rect); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2802 ps.rcPaint.left = rect.left; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2803 ps.rcPaint.right = rect.right; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2804 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2805 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2806 if (!IsRectEmpty(&ps.rcPaint)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2807 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2808 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
|
2809 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
|
2810 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
|
2811 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2812 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2813 EndPaint(hwnd, &ps); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2814 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2815 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2816 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2817 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2818 _OnSize( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2819 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
|
2820 UINT state UNUSED, |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2821 int cx, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2822 int cy) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2823 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2824 if (!IsMinimized(hwnd)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2825 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2826 gui_resize_shell(cx, cy); |
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 #ifdef FEAT_MENU |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2829 /* Menu bar may wrap differently now */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2830 gui_mswin_get_menu_height(TRUE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2831 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2832 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2833 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2834 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2835 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2836 _OnSetFocus( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2837 HWND hwnd, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2838 HWND hwndOldFocus) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2839 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2840 gui_focus_change(TRUE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2841 s_getting_focus = TRUE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2842 (void)MyWindowProc(hwnd, WM_SETFOCUS, (WPARAM)hwndOldFocus, 0); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2843 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2844 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2845 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2846 _OnKillFocus( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2847 HWND hwnd, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2848 HWND hwndNewFocus) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2849 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2850 gui_focus_change(FALSE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2851 s_getting_focus = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2852 (void)MyWindowProc(hwnd, WM_KILLFOCUS, (WPARAM)hwndNewFocus, 0); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2853 } |
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 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2856 * 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
|
2857 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2858 static LRESULT |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2859 _OnActivateApp( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2860 HWND hwnd, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2861 BOOL fActivate, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2862 DWORD dwThreadId) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2863 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2864 /* we call gui_focus_change() in _OnSetFocus() */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2865 /* gui_focus_change((int)fActivate); */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2866 return MyWindowProc(hwnd, WM_ACTIVATEAPP, fActivate, (DWORD)dwThreadId); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2867 } |
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 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2870 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
|
2871 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2872 DestroyWindow(sb->id); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2873 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2874 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2875 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2876 * 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
|
2877 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2878 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2879 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
|
2880 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2881 RECT rct; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2882 POINT mp; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2883 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2884 (void)GetWindowRect(s_textArea, &rct); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2885 (void)GetCursorPos((LPPOINT)&mp); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2886 *x = (int)(mp.x - rct.left); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2887 *y = (int)(mp.y - rct.top); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2888 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2889 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2890 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2891 * 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
|
2892 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2893 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2894 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
|
2895 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2896 RECT rct; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2897 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2898 (void)GetWindowRect(s_textArea, &rct); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2899 (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
|
2900 y + gui.border_offset + rct.top); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2901 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2902 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2903 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2904 gui_mswin_get_valid_dimensions( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2905 int w, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2906 int h, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2907 int *valid_w, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2908 int *valid_h) |
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 int base_width, base_height; |
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 base_width = gui_get_base_width() |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2913 + (GetSystemMetrics(SM_CXFRAME) + |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2914 GetSystemMetrics(SM_CXPADDEDBORDER)) * 2; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2915 base_height = gui_get_base_height() |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2916 + (GetSystemMetrics(SM_CYFRAME) + |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2917 GetSystemMetrics(SM_CXPADDEDBORDER)) * 2 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2918 + GetSystemMetrics(SM_CYCAPTION) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2919 #ifdef FEAT_MENU |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2920 + gui_mswin_get_menu_height(FALSE) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2921 #endif |
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 *valid_w = base_width + |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2924 ((w - base_width) / gui.char_width) * gui.char_width; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2925 *valid_h = base_height + |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2926 ((h - base_height) / gui.char_height) * gui.char_height; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
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 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2930 gui_mch_flash(int msec) |
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 RECT rc; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2933 |
12934
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
2934 #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
|
2935 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
|
2936 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
|
2937 #endif |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
2938 |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2939 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2940 * 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
|
2941 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2942 rc.left = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2943 rc.top = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2944 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
|
2945 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
|
2946 InvertRect(s_hdc, &rc); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2947 gui_mch_flush(); /* make sure it's displayed */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2948 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2949 ui_delay((long)msec, TRUE); /* wait for a few msec */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2950 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2951 InvertRect(s_hdc, &rc); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2952 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2953 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2954 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2955 * Return flags used for scrolling. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2956 * 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
|
2957 * 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
|
2958 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2959 static int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2960 get_scroll_flags(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2961 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2962 HWND hwnd; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2963 RECT rcVim, rcOther, rcDest; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2964 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2965 GetWindowRect(s_hwnd, &rcVim); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2966 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2967 /* Check if the window is partly above or below the screen. We don't care |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2968 * about partly left or right of the screen, it is not relevant when |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2969 * scrolling up or down. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2970 if (rcVim.top < 0 || rcVim.bottom > GetSystemMetrics(SM_CYFULLSCREEN)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2971 return SW_INVALIDATE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2972 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2973 /* Check if there is an window (partly) on top of us. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2974 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
|
2975 if (IsWindowVisible(hwnd)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2976 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2977 GetWindowRect(hwnd, &rcOther); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2978 if (IntersectRect(&rcDest, &rcVim, &rcOther)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2979 return SW_INVALIDATE; |
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 return 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2982 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2983 |
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 * 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
|
2986 * may not be scrolled out properly. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2987 * 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
|
2988 * 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
|
2989 * 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
|
2990 * the region before ScrollWindowEx(). |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2991 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2992 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2993 intel_gpu_workaround(void) |
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 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
|
2996 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2997 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2998 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2999 * 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
|
3000 * 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
|
3001 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3002 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3003 gui_mch_delete_lines( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3004 int row, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3005 int num_lines) |
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 RECT rc; |
12934
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
3008 |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3009 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
|
3010 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
|
3011 rc.top = FILL_Y(row); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3012 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
|
3013 |
12986
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
3014 #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
|
3015 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
|
3016 { |
13150
808625d4b71b
patch 8.0.1449: slow redrawing with DirectX
Christian Brabandt <cb@256bit.org>
parents:
13028
diff
changeset
|
3017 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
|
3018 DWriteContext_Flush(s_dwc); |
808625d4b71b
patch 8.0.1449: slow redrawing with DirectX
Christian Brabandt <cb@256bit.org>
parents:
13028
diff
changeset
|
3019 } |
808625d4b71b
patch 8.0.1449: slow redrawing with DirectX
Christian Brabandt <cb@256bit.org>
parents:
13028
diff
changeset
|
3020 else |
12986
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
3021 #endif |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
3022 { |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
3023 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
|
3024 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
|
3025 &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
|
3026 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
|
3027 } |
cfce9ac1d1e8
patch 8.0.1390: DirectX scrolling can be slow, vertical positioning is off
Christian Brabandt <cb@256bit.org>
parents:
12994
diff
changeset
|
3028 |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3029 /* This seems to be required to avoid the cursor disappearing when |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3030 * scrolling such that the cursor ends up in the top-left character on |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3031 * the screen... But why? (Webb) */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3032 /* It's probably fixed by disabling drawing the cursor while scrolling. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3033 /* gui.cursor_is_valid = FALSE; */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3034 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3035 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
|
3036 gui.scroll_region_left, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3037 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
|
3038 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3039 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3040 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3041 * 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
|
3042 * following text within the scroll region. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3043 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3044 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3045 gui_mch_insert_lines( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3046 int row, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3047 int num_lines) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3048 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3049 RECT rc; |
12934
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
3050 |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3051 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
|
3052 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
|
3053 rc.top = FILL_Y(row); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3054 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
|
3055 |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
3056 #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
|
3057 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
|
3058 { |
13150
808625d4b71b
patch 8.0.1449: slow redrawing with DirectX
Christian Brabandt <cb@256bit.org>
parents:
13028
diff
changeset
|
3059 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
|
3060 DWriteContext_Flush(s_dwc); |
808625d4b71b
patch 8.0.1449: slow redrawing with DirectX
Christian Brabandt <cb@256bit.org>
parents:
13028
diff
changeset
|
3061 } |
808625d4b71b
patch 8.0.1449: slow redrawing with DirectX
Christian Brabandt <cb@256bit.org>
parents:
13028
diff
changeset
|
3062 else |
12986
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
3063 #endif |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
3064 { |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
3065 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
|
3066 /* The SW_INVALIDATE is required when part of the window is covered or |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
3067 * off-screen. How do we avoid it when it's not needed? */ |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
3068 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
|
3069 &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
|
3070 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
|
3071 } |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3072 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3073 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
|
3074 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
|
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 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
|
3079 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
|
3080 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3081 #if defined(FEAT_DIRECTX) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3082 DWriteContext_Close(s_dwc); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3083 DWrite_Final(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3084 s_dwc = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3085 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3086 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3087 ReleaseDC(s_textArea, s_hdc); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3088 DeleteObject(s_brush); |
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 #ifdef FEAT_TEAROFF |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3091 /* Unload the tearoff bitmap */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3092 (void)DeleteObject((HGDIOBJ)s_htearbitmap); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3093 #endif |
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 /* Destroy our window (if we have one). */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3096 if (s_hwnd != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3097 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3098 destroying = TRUE; /* ignore WM_DESTROY message now */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3099 DestroyWindow(s_hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3100 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3101 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3102 #ifdef GLOBAL_IME |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3103 global_ime_end(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3104 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3105 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3106 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3107 static char_u * |
16152
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
3108 logfont2name(LOGFONTW lf) |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3109 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3110 char *p; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3111 char *res; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3112 char *charset_name; |
8835
c1a5623cfc86
commit https://github.com/vim/vim/commit/7c1c6dbb6817640fd3956a0d5417da23fde336d8
Christian Brabandt <cb@256bit.org>
parents:
8813
diff
changeset
|
3113 char *quality_name; |
16152
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
3114 char *font_name; |
16439
9d20e26dc13c
patch 8.1.1224: MS-Windows: cannot specify font weight
Bram Moolenaar <Bram@vim.org>
parents:
16425
diff
changeset
|
3115 int points; |
16152
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
3116 |
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
3117 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
|
3118 if (font_name == NULL) |
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
3119 return NULL; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3120 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
|
3121 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
|
3122 |
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
|
3123 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
|
3124 + (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
|
3125 + (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
|
3126 if (res != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3127 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3128 p = res; |
16439
9d20e26dc13c
patch 8.1.1224: MS-Windows: cannot specify font weight
Bram Moolenaar <Bram@vim.org>
parents:
16425
diff
changeset
|
3129 // 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
|
3130 points = pixels_to_points( |
9d20e26dc13c
patch 8.1.1224: MS-Windows: cannot specify font weight
Bram Moolenaar <Bram@vim.org>
parents:
16425
diff
changeset
|
3131 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
|
3132 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
|
3133 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
|
3134 else |
16468
045ab97fe320
patch 8.1.1238: MS-Windows: compiler warning for sprintf() format
Bram Moolenaar <Bram@vim.org>
parents:
16451
diff
changeset
|
3135 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
|
3136 while (*p) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3137 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3138 if (*p == ' ') |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3139 *p = '_'; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3140 ++p; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3141 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3142 if (lf.lfItalic) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3143 STRCAT(p, ":i"); |
16439
9d20e26dc13c
patch 8.1.1224: MS-Windows: cannot specify font weight
Bram Moolenaar <Bram@vim.org>
parents:
16425
diff
changeset
|
3144 if (lf.lfWeight == FW_BOLD) |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3145 STRCAT(p, ":b"); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3146 if (lf.lfUnderline) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3147 STRCAT(p, ":u"); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3148 if (lf.lfStrikeOut) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3149 STRCAT(p, ":s"); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3150 if (charset_name != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3151 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3152 STRCAT(p, ":c"); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3153 STRCAT(p, charset_name); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3154 } |
8835
c1a5623cfc86
commit https://github.com/vim/vim/commit/7c1c6dbb6817640fd3956a0d5417da23fde336d8
Christian Brabandt <cb@256bit.org>
parents:
8813
diff
changeset
|
3155 if (quality_name != NULL) |
c1a5623cfc86
commit https://github.com/vim/vim/commit/7c1c6dbb6817640fd3956a0d5417da23fde336d8
Christian Brabandt <cb@256bit.org>
parents:
8813
diff
changeset
|
3156 { |
c1a5623cfc86
commit https://github.com/vim/vim/commit/7c1c6dbb6817640fd3956a0d5417da23fde336d8
Christian Brabandt <cb@256bit.org>
parents:
8813
diff
changeset
|
3157 STRCAT(p, ":q"); |
c1a5623cfc86
commit https://github.com/vim/vim/commit/7c1c6dbb6817640fd3956a0d5417da23fde336d8
Christian Brabandt <cb@256bit.org>
parents:
8813
diff
changeset
|
3158 STRCAT(p, quality_name); |
c1a5623cfc86
commit https://github.com/vim/vim/commit/7c1c6dbb6817640fd3956a0d5417da23fde336d8
Christian Brabandt <cb@256bit.org>
parents:
8813
diff
changeset
|
3159 } |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3160 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3161 |
16152
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
3162 vim_free(font_name); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3163 return (char_u *)res; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3164 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3165 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3166 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3167 #ifdef FEAT_MBYTE_IME |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3168 /* |
16152
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
3169 * Set correct LOGFONTW to IME. Use 'guifontwide' if available, otherwise use |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3170 * 'guifont' |
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 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3173 update_im_font(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3174 { |
16152
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
3175 LOGFONTW lf_wide; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3176 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3177 if (p_guifontwide != NULL && *p_guifontwide != NUL |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3178 && 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
|
3179 && 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
|
3180 norm_logfont = lf_wide; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3181 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3182 norm_logfont = sub_logfont; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3183 im_set_font(&norm_logfont); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3184 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3185 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3186 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3187 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3188 * 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
|
3189 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3190 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3191 gui_mch_wide_font_changed(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3192 { |
16152
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
3193 LOGFONTW lf; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3194 |
15597
536dd2bc5ac9
patch 8.1.0806: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15549
diff
changeset
|
3195 #ifdef FEAT_MBYTE_IME |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3196 update_im_font(); |
15597
536dd2bc5ac9
patch 8.1.0806: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15549
diff
changeset
|
3197 #endif |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3198 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3199 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
|
3200 gui.wide_ital_font = NOFONT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3201 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
|
3202 gui.wide_bold_font = NOFONT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3203 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
|
3204 gui.wide_boldital_font = NOFONT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3205 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3206 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
|
3207 && 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
|
3208 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3209 if (!lf.lfItalic) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3210 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3211 lf.lfItalic = TRUE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3212 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
|
3213 lf.lfItalic = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3214 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3215 if (lf.lfWeight < FW_BOLD) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3216 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3217 lf.lfWeight = FW_BOLD; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3218 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
|
3219 if (!lf.lfItalic) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3220 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3221 lf.lfItalic = TRUE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3222 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
|
3223 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3224 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3225 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3226 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3227 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3228 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3229 * 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
|
3230 * 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
|
3231 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3232 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
|
3233 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
|
3234 { |
16152
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
3235 LOGFONTW lf; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3236 GuiFont font = NOFONT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3237 char_u *p; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3238 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3239 /* Load the font */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3240 if (get_logfont(&lf, font_name, NULL, TRUE) == OK) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3241 font = get_font_handle(&lf); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3242 if (font == NOFONT) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3243 return FAIL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3244 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3245 if (font_name == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3246 font_name = (char_u *)lf.lfFaceName; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3247 #if defined(FEAT_MBYTE_IME) || defined(GLOBAL_IME) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3248 norm_logfont = lf; |
12950
e60b2aa04903
patch 8.0.1351: warning for unused variables building with MinGW
Christian Brabandt <cb@256bit.org>
parents:
12934
diff
changeset
|
3249 #endif |
e60b2aa04903
patch 8.0.1351: warning for unused variables building with MinGW
Christian Brabandt <cb@256bit.org>
parents:
12934
diff
changeset
|
3250 #ifdef FEAT_MBYTE_IME |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3251 sub_logfont = lf; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3252 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3253 #ifdef FEAT_MBYTE_IME |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3254 update_im_font(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3255 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3256 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
|
3257 gui.norm_font = font; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3258 current_font_height = lf.lfHeight; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3259 GetFontSize(font); |
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 p = logfont2name(lf); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3262 if (p != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3263 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3264 hl_set_font_name(p); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3265 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3266 /* When setting 'guifont' to "*" replace it with the actual font name. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3267 * */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3268 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
|
3269 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3270 vim_free(p_guifont); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3271 p_guifont = p; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3272 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3273 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3274 vim_free(p); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3275 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3276 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3277 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
|
3278 gui.ital_font = NOFONT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3279 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
|
3280 gui.bold_font = NOFONT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3281 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
|
3282 gui.boldital_font = NOFONT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3283 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3284 if (!lf.lfItalic) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3285 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3286 lf.lfItalic = TRUE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3287 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
|
3288 lf.lfItalic = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3289 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3290 if (lf.lfWeight < FW_BOLD) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3291 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3292 lf.lfWeight = FW_BOLD; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3293 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
|
3294 if (!lf.lfItalic) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3295 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3296 lf.lfItalic = TRUE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3297 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
|
3298 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3299 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3300 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3301 return OK; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3302 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3303 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3304 #ifndef WPF_RESTORETOMAXIMIZED |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3305 # define WPF_RESTORETOMAXIMIZED 2 /* just in case someone doesn't have it */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3306 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3307 |
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 * Return TRUE if the GUI window is maximized, filling the whole screen. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3310 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3311 int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3312 gui_mch_maximized(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3313 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3314 WINDOWPLACEMENT wp; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3315 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3316 wp.length = sizeof(WINDOWPLACEMENT); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3317 if (GetWindowPlacement(s_hwnd, &wp)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3318 return wp.showCmd == SW_SHOWMAXIMIZED |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3319 || (wp.showCmd == SW_SHOWMINIMIZED |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3320 && wp.flags == WPF_RESTORETOMAXIMIZED); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3321 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3322 return 0; |
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 /* |
12802
29a728529f92
patch 8.0.1278: GUI window always resizes when adding scrollbar
Christian Brabandt <cb@256bit.org>
parents:
12712
diff
changeset
|
3326 * 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
|
3327 * 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
|
3328 * window. |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3329 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3330 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3331 gui_mch_newfont(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3332 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3333 RECT rect; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3334 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3335 GetWindowRect(s_hwnd, &rect); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3336 if (win_socket_id == 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3337 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3338 gui_resize_shell(rect.right - rect.left |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3339 - (GetSystemMetrics(SM_CXFRAME) + |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3340 GetSystemMetrics(SM_CXPADDEDBORDER)) * 2, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3341 rect.bottom - rect.top |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3342 - (GetSystemMetrics(SM_CYFRAME) + |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3343 GetSystemMetrics(SM_CXPADDEDBORDER)) * 2 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3344 - GetSystemMetrics(SM_CYCAPTION) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3345 #ifdef FEAT_MENU |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3346 - gui_mswin_get_menu_height(FALSE) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3347 #endif |
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 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3350 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3351 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3352 /* Inside another window, don't use the frame and border. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3353 gui_resize_shell(rect.right - rect.left, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3354 rect.bottom - rect.top |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3355 #ifdef FEAT_MENU |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3356 - gui_mswin_get_menu_height(FALSE) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3357 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3358 ); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3359 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3360 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3361 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3362 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3363 * Set the window title |
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 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3366 gui_mch_settitle( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3367 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
|
3368 char_u *icon UNUSED) |
8140
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 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
|
3371 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3372 |
9834
80ace3687eec
commit https://github.com/vim/vim/commit/a6b7a08ae04a3cd4d9c45c906bb7a197e2135179
Christian Brabandt <cb@256bit.org>
parents:
9428
diff
changeset
|
3373 #if defined(FEAT_MOUSESHAPE) || defined(PROTO) |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3374 /* Table for shape IDCs. Keep in sync with the mshape_names[] table in |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3375 * misc2.c! */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3376 static LPCSTR mshape_idcs[] = |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3377 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3378 IDC_ARROW, /* arrow */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3379 MAKEINTRESOURCE(0), /* blank */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3380 IDC_IBEAM, /* beam */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3381 IDC_SIZENS, /* updown */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3382 IDC_SIZENS, /* udsizing */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3383 IDC_SIZEWE, /* leftright */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3384 IDC_SIZEWE, /* lrsizing */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3385 IDC_WAIT, /* busy */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3386 IDC_NO, /* no */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3387 IDC_ARROW, /* crosshair */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3388 IDC_ARROW, /* hand1 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3389 IDC_ARROW, /* hand2 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3390 IDC_ARROW, /* pencil */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3391 IDC_ARROW, /* question */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3392 IDC_ARROW, /* right-arrow */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3393 IDC_UPARROW, /* up-arrow */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3394 IDC_ARROW /* last one */ |
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3397 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3398 mch_set_mouse_shape(int shape) |
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 LPCSTR idc; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3401 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3402 if (shape == MSHAPE_HIDE) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3403 ShowCursor(FALSE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3404 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3405 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3406 if (shape >= MSHAPE_NUMBERED) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3407 idc = IDC_ARROW; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3408 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3409 idc = mshape_idcs[shape]; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3410 #ifdef SetClassLongPtr |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3411 SetClassLongPtr(s_textArea, GCLP_HCURSOR, (__int3264)(LONG_PTR)LoadCursor(NULL, idc)); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3412 #else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3413 SetClassLong(s_textArea, GCL_HCURSOR, (long_u)LoadCursor(NULL, idc)); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3414 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3415 if (!p_mh) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3416 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3417 POINT mp; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3418 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3419 /* Set the position to make it redrawn with the new shape. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3420 (void)GetCursorPos((LPPOINT)&mp); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3421 (void)SetCursorPos(mp.x, mp.y); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3422 ShowCursor(TRUE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3423 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3424 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3425 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3426 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3427 |
9834
80ace3687eec
commit https://github.com/vim/vim/commit/a6b7a08ae04a3cd4d9c45c906bb7a197e2135179
Christian Brabandt <cb@256bit.org>
parents:
9428
diff
changeset
|
3428 #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
|
3429 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3430 * Wide version of convert_filter(). |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3431 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3432 static WCHAR * |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3433 convert_filterW(char_u *s) |
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 char_u *tmp; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3436 int len; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3437 WCHAR *res; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3438 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3439 tmp = convert_filter(s); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3440 if (tmp == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3441 return NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3442 len = (int)STRLEN(s) + 3; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3443 res = enc_to_utf16(tmp, &len); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3444 vim_free(tmp); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3445 return res; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3446 } |
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 /* |
15597
536dd2bc5ac9
patch 8.1.0806: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15549
diff
changeset
|
3449 * 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
|
3450 * or NULL if Cancel is hit. |
536dd2bc5ac9
patch 8.1.0806: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15549
diff
changeset
|
3451 * 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
|
3452 * 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
|
3453 * dflt - Default name of file. |
536dd2bc5ac9
patch 8.1.0806: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15549
diff
changeset
|
3454 * 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
|
3455 * 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
|
3456 * 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
|
3457 */ |
15601
8ab9ad27fca4
patch 8.1.0808: MS-Windows: build error with GUI
Bram Moolenaar <Bram@vim.org>
parents:
15597
diff
changeset
|
3458 char_u * |
15597
536dd2bc5ac9
patch 8.1.0806: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15549
diff
changeset
|
3459 gui_mch_browse( |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3460 int saving, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3461 char_u *title, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3462 char_u *dflt, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3463 char_u *ext, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3464 char_u *initdir, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3465 char_u *filter) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3466 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3467 /* We always use the wide function. This means enc_to_utf16() must work, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3468 * otherwise it fails miserably! */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3469 OPENFILENAMEW fileStruct; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3470 WCHAR fileBuf[MAXPATHL]; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3471 WCHAR *wp; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3472 int i; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3473 WCHAR *titlep = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3474 WCHAR *extp = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3475 WCHAR *initdirp = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3476 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
|
3477 char_u *p, *q; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3478 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3479 if (dflt == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3480 fileBuf[0] = NUL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3481 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3482 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3483 wp = enc_to_utf16(dflt, NULL); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3484 if (wp == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3485 fileBuf[0] = NUL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3486 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3487 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3488 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
|
3489 fileBuf[i] = wp[i]; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3490 fileBuf[i] = NUL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3491 vim_free(wp); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3492 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3493 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3494 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3495 /* Convert the filter to Windows format. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3496 filterp = convert_filterW(filter); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3497 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3498 vim_memset(&fileStruct, 0, sizeof(OPENFILENAMEW)); |
10440
f54e4c691de4
commit https://github.com/vim/vim/commit/b04a98f6c3cca14bf055934b0a793f4dc376858b
Christian Brabandt <cb@256bit.org>
parents:
10438
diff
changeset
|
3499 # ifdef OPENFILENAME_SIZE_VERSION_400W |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3500 /* 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
|
3501 fileStruct.lStructSize = OPENFILENAME_SIZE_VERSION_400W; |
10440
f54e4c691de4
commit https://github.com/vim/vim/commit/b04a98f6c3cca14bf055934b0a793f4dc376858b
Christian Brabandt <cb@256bit.org>
parents:
10438
diff
changeset
|
3502 # else |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3503 fileStruct.lStructSize = sizeof(fileStruct); |
10440
f54e4c691de4
commit https://github.com/vim/vim/commit/b04a98f6c3cca14bf055934b0a793f4dc376858b
Christian Brabandt <cb@256bit.org>
parents:
10438
diff
changeset
|
3504 # endif |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3505 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3506 if (title != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3507 titlep = enc_to_utf16(title, NULL); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3508 fileStruct.lpstrTitle = titlep; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3509 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3510 if (ext != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3511 extp = enc_to_utf16(ext, NULL); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3512 fileStruct.lpstrDefExt = extp; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3513 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3514 fileStruct.lpstrFile = fileBuf; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3515 fileStruct.nMaxFile = MAXPATHL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3516 fileStruct.lpstrFilter = filterp; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3517 fileStruct.hwndOwner = s_hwnd; /* main Vim window is owner*/ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3518 /* has an initial dir been specified? */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3519 if (initdir != NULL && *initdir != NUL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3520 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3521 /* Must have backslashes here, no matter what 'shellslash' says */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3522 initdirp = enc_to_utf16(initdir, NULL); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3523 if (initdirp != NULL) |
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 for (wp = initdirp; *wp != NUL; ++wp) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3526 if (*wp == '/') |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3527 *wp = '\\'; |
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 fileStruct.lpstrInitialDir = initdirp; |
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3532 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3533 * 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
|
3534 * 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
|
3535 * 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
|
3536 * 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
|
3537 * OFN_PATHMUSTEXIST? |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3538 * 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
|
3539 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3540 fileStruct.Flags = (OFN_NOCHANGEDIR | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY); |
10440
f54e4c691de4
commit https://github.com/vim/vim/commit/b04a98f6c3cca14bf055934b0a793f4dc376858b
Christian Brabandt <cb@256bit.org>
parents:
10438
diff
changeset
|
3541 # ifdef FEAT_SHORTCUT |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3542 if (curbuf->b_p_bin) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3543 fileStruct.Flags |= OFN_NODEREFERENCELINKS; |
10440
f54e4c691de4
commit https://github.com/vim/vim/commit/b04a98f6c3cca14bf055934b0a793f4dc376858b
Christian Brabandt <cb@256bit.org>
parents:
10438
diff
changeset
|
3544 # endif |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3545 if (saving) |
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 if (!GetSaveFileNameW(&fileStruct)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3548 return NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3549 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3550 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3551 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3552 if (!GetOpenFileNameW(&fileStruct)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3553 return NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3554 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3555 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3556 vim_free(filterp); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3557 vim_free(initdirp); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3558 vim_free(titlep); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3559 vim_free(extp); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3560 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3561 /* Convert from UCS2 to 'encoding'. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3562 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
|
3563 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
|
3564 return NULL; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3565 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3566 /* Give focus back to main window (when using MDI). */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3567 SetFocus(s_hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3568 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3569 /* 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
|
3570 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
|
3571 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
|
3572 return q; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3573 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3574 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3575 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3576 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3577 * 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
|
3578 * 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
|
3579 * 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
|
3580 * |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3581 * 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
|
3582 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3583 static char_u * |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3584 convert_filter(char_u *s) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3585 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3586 char_u *res; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3587 unsigned s_len = (unsigned)STRLEN(s); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3588 unsigned i; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3589 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3590 res = alloc(s_len + 3); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3591 if (res != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3592 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3593 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
|
3594 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
|
3595 res[i] = '\0'; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3596 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3597 res[i] = s[i]; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3598 res[s_len] = NUL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3599 /* Add two extra NULs to make sure it's properly terminated. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3600 res[s_len + 1] = NUL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3601 res[s_len + 2] = NUL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3602 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3603 return res; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3604 } |
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 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3607 * Select a directory. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3608 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3609 char_u * |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3610 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
|
3611 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3612 /* We fake this: Use a filter that doesn't select anything and a default |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3613 * file name that won't be used. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3614 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
|
3615 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
|
3616 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3617 #endif /* FEAT_BROWSE */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3618 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3619 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3620 _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
|
3621 HWND hwnd UNUSED, |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3622 HDROP hDrop) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3623 { |
12477
68d7bc045dbe
patch 8.0.1118: FEAT_WINDOWS adds a lot of #ifdefs
Christian Brabandt <cb@256bit.org>
parents:
12317
diff
changeset
|
3624 #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
|
3625 #define DRAGQVAL 0xFFFFFFFF |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3626 WCHAR wszFile[BUFPATHLEN]; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3627 char szFile[BUFPATHLEN]; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3628 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
|
3629 UINT i; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3630 char_u **fnames; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3631 POINT pt; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3632 int_u modifiers = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3633 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3634 /* TRACE("_OnDropFiles: %d files dropped\n", cFiles); */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3635 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3636 /* Obtain dropped position */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3637 DragQueryPoint(hDrop, &pt); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3638 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
|
3639 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3640 reset_VIsual(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3641 |
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
|
3642 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
|
3643 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3644 if (fnames != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3645 for (i = 0; i < cFiles; ++i) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3646 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3647 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
|
3648 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
|
3649 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3650 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3651 DragQueryFile(hDrop, i, szFile, BUFPATHLEN); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3652 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
|
3653 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3654 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3655 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3656 DragFinish(hDrop); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3657 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3658 if (fnames != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3659 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3660 if ((GetKeyState(VK_SHIFT) & 0x8000) != 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3661 modifiers |= MOUSE_SHIFT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3662 if ((GetKeyState(VK_CONTROL) & 0x8000) != 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3663 modifiers |= MOUSE_CTRL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3664 if ((GetKeyState(VK_MENU) & 0x8000) != 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3665 modifiers |= MOUSE_ALT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3666 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3667 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
|
3668 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3669 s_need_activate = TRUE; |
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 static int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3674 _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
|
3675 HWND hwnd UNUSED, |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3676 HWND hwndCtl, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3677 UINT code, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3678 int pos) |
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 UINT prev_code = 0; /* code of previous call */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3681 scrollbar_T *sb, *sb_info; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3682 long val; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3683 int dragging = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3684 int dont_scroll_save = dont_scroll; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3685 SCROLLINFO si; |
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 si.cbSize = sizeof(si); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3688 si.fMask = SIF_POS; |
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 sb = gui_mswin_find_scrollbar(hwndCtl); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3691 if (sb == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3692 return 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3693 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3694 if (sb->wp != NULL) /* Left or right scrollbar */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3695 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3696 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3697 * 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
|
3698 * 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
|
3699 * gui_drag_scrollbar(). |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3700 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3701 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
|
3702 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3703 else /* Bottom scrollbar */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3704 sb_info = sb; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3705 val = sb_info->value; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3706 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3707 switch (code) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3708 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3709 case SB_THUMBTRACK: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3710 val = pos; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3711 dragging = TRUE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3712 if (sb->scroll_shift > 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3713 val <<= sb->scroll_shift; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3714 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3715 case SB_LINEDOWN: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3716 val++; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3717 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3718 case SB_LINEUP: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3719 val--; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3720 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3721 case SB_PAGEDOWN: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3722 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
|
3723 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3724 case SB_PAGEUP: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3725 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
|
3726 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3727 case SB_TOP: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3728 val = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3729 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3730 case SB_BOTTOM: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3731 val = sb_info->max; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3732 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3733 case SB_ENDSCROLL: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3734 if (prev_code == SB_THUMBTRACK) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3735 { |
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 * "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
|
3738 * 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
|
3739 * 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
|
3740 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3741 val = GetScrollPos(hwndCtl, SB_CTL); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3742 if (sb->scroll_shift > 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3743 val <<= sb->scroll_shift; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3744 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3745 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3746 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3747 default: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3748 /* TRACE("Unknown scrollbar event %d\n", code); */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3749 return 0; |
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 prev_code = code; |
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 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
|
3754 SetScrollInfo(hwndCtl, SB_CTL, &si, TRUE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3755 |
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 * 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
|
3758 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3759 if (sb->wp != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3760 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3761 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
|
3762 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
|
3763 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3764 SetScrollInfo(id, SB_CTL, &si, TRUE); |
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3767 /* Don't let us be interrupted here by another message. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3768 s_busy_processing = TRUE; |
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 /* When "allow_scrollbar" is FALSE still need to remember the new |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3771 * position, but don't actually scroll by setting "dont_scroll". */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3772 dont_scroll = !allow_scrollbar; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3773 |
13150
808625d4b71b
patch 8.0.1449: slow redrawing with DirectX
Christian Brabandt <cb@256bit.org>
parents:
13028
diff
changeset
|
3774 mch_disable_flush(); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3775 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
|
3776 mch_enable_flush(); |
808625d4b71b
patch 8.0.1449: slow redrawing with DirectX
Christian Brabandt <cb@256bit.org>
parents:
13028
diff
changeset
|
3777 gui_may_flush(); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3778 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3779 s_busy_processing = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3780 dont_scroll = dont_scroll_save; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3781 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3782 return 0; |
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3785 |
7 | 3786 #ifdef FEAT_XPM_W32 |
3787 # include "xpm_w32.h" | |
3788 #endif | |
3789 | |
3790 #ifdef PROTO | |
3791 # define WINAPI | |
3792 #endif | |
3793 | |
3794 #ifdef __MINGW32__ | |
3795 /* | |
3796 * Add a lot of missing defines. | |
3797 * They are not always missing, we need the #ifndef's. | |
3798 */ | |
3799 # ifndef IsMinimized | |
3800 # define IsMinimized(hwnd) IsIconic(hwnd) | |
3801 # endif | |
3802 # ifndef IsMaximized | |
3803 # define IsMaximized(hwnd) IsZoomed(hwnd) | |
3804 # endif | |
3805 # ifndef SelectFont | |
3806 # define SelectFont(hdc, hfont) ((HFONT)SelectObject((hdc), (HGDIOBJ)(HFONT)(hfont))) | |
3807 # endif | |
3808 # ifndef GetStockBrush | |
3809 # define GetStockBrush(i) ((HBRUSH)GetStockObject(i)) | |
3810 # endif | |
3811 # ifndef DeleteBrush | |
3812 # define DeleteBrush(hbr) DeleteObject((HGDIOBJ)(HBRUSH)(hbr)) | |
3813 # endif | |
3814 | |
3815 # ifndef HANDLE_WM_RBUTTONDBLCLK | |
3816 # define HANDLE_WM_RBUTTONDBLCLK(hwnd, wParam, lParam, fn) \ | |
3817 ((fn)((hwnd), TRUE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) | |
3818 # endif | |
3819 # ifndef HANDLE_WM_MBUTTONUP | |
3820 # define HANDLE_WM_MBUTTONUP(hwnd, wParam, lParam, fn) \ | |
3821 ((fn)((hwnd), (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) | |
3822 # endif | |
3823 # ifndef HANDLE_WM_MBUTTONDBLCLK | |
3824 # define HANDLE_WM_MBUTTONDBLCLK(hwnd, wParam, lParam, fn) \ | |
3825 ((fn)((hwnd), TRUE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) | |
3826 # endif | |
3827 # ifndef HANDLE_WM_LBUTTONDBLCLK | |
3828 # define HANDLE_WM_LBUTTONDBLCLK(hwnd, wParam, lParam, fn) \ | |
3829 ((fn)((hwnd), TRUE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) | |
3830 # endif | |
3831 # ifndef HANDLE_WM_RBUTTONDOWN | |
3832 # define HANDLE_WM_RBUTTONDOWN(hwnd, wParam, lParam, fn) \ | |
3833 ((fn)((hwnd), FALSE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) | |
3834 # endif | |
3835 # ifndef HANDLE_WM_MOUSEMOVE | |
3836 # define HANDLE_WM_MOUSEMOVE(hwnd, wParam, lParam, fn) \ | |
3837 ((fn)((hwnd), (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) | |
3838 # endif | |
3839 # ifndef HANDLE_WM_RBUTTONUP | |
3840 # define HANDLE_WM_RBUTTONUP(hwnd, wParam, lParam, fn) \ | |
3841 ((fn)((hwnd), (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) | |
3842 # endif | |
3843 # ifndef HANDLE_WM_MBUTTONDOWN | |
3844 # define HANDLE_WM_MBUTTONDOWN(hwnd, wParam, lParam, fn) \ | |
3845 ((fn)((hwnd), FALSE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) | |
3846 # endif | |
3847 # ifndef HANDLE_WM_LBUTTONUP | |
3848 # define HANDLE_WM_LBUTTONUP(hwnd, wParam, lParam, fn) \ | |
3849 ((fn)((hwnd), (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) | |
3850 # endif | |
3851 # ifndef HANDLE_WM_LBUTTONDOWN | |
3852 # define HANDLE_WM_LBUTTONDOWN(hwnd, wParam, lParam, fn) \ | |
3853 ((fn)((hwnd), FALSE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) | |
3854 # endif | |
3855 # ifndef HANDLE_WM_SYSCHAR | |
3856 # define HANDLE_WM_SYSCHAR(hwnd, wParam, lParam, fn) \ | |
3857 ((fn)((hwnd), (TCHAR)(wParam), (int)(short)LOWORD(lParam)), 0L) | |
3858 # endif | |
3859 # ifndef HANDLE_WM_ACTIVATEAPP | |
3860 # define HANDLE_WM_ACTIVATEAPP(hwnd, wParam, lParam, fn) \ | |
3861 ((fn)((hwnd), (BOOL)(wParam), (DWORD)(lParam)), 0L) | |
3862 # endif | |
3863 # ifndef HANDLE_WM_WINDOWPOSCHANGING | |
3864 # define HANDLE_WM_WINDOWPOSCHANGING(hwnd, wParam, lParam, fn) \ | |
3865 (LRESULT)(DWORD)(BOOL)(fn)((hwnd), (LPWINDOWPOS)(lParam)) | |
3866 # endif | |
3867 # ifndef HANDLE_WM_VSCROLL | |
3868 # define HANDLE_WM_VSCROLL(hwnd, wParam, lParam, fn) \ | |
3869 ((fn)((hwnd), (HWND)(lParam), (UINT)(LOWORD(wParam)), (int)(short)HIWORD(wParam)), 0L) | |
3870 # endif | |
3871 # ifndef HANDLE_WM_SETFOCUS | |
3872 # define HANDLE_WM_SETFOCUS(hwnd, wParam, lParam, fn) \ | |
3873 ((fn)((hwnd), (HWND)(wParam)), 0L) | |
3874 # endif | |
3875 # ifndef HANDLE_WM_KILLFOCUS | |
3876 # define HANDLE_WM_KILLFOCUS(hwnd, wParam, lParam, fn) \ | |
3877 ((fn)((hwnd), (HWND)(wParam)), 0L) | |
3878 # endif | |
3879 # ifndef HANDLE_WM_HSCROLL | |
3880 # define HANDLE_WM_HSCROLL(hwnd, wParam, lParam, fn) \ | |
3881 ((fn)((hwnd), (HWND)(lParam), (UINT)(LOWORD(wParam)), (int)(short)HIWORD(wParam)), 0L) | |
3882 # endif | |
3883 # ifndef HANDLE_WM_DROPFILES | |
3884 # define HANDLE_WM_DROPFILES(hwnd, wParam, lParam, fn) \ | |
3885 ((fn)((hwnd), (HDROP)(wParam)), 0L) | |
3886 # endif | |
3887 # ifndef HANDLE_WM_CHAR | |
3888 # define HANDLE_WM_CHAR(hwnd, wParam, lParam, fn) \ | |
3889 ((fn)((hwnd), (TCHAR)(wParam), (int)(short)LOWORD(lParam)), 0L) | |
3890 # endif | |
3891 # ifndef HANDLE_WM_SYSDEADCHAR | |
3892 # define HANDLE_WM_SYSDEADCHAR(hwnd, wParam, lParam, fn) \ | |
3893 ((fn)((hwnd), (TCHAR)(wParam), (int)(short)LOWORD(lParam)), 0L) | |
3894 # endif | |
3895 # ifndef HANDLE_WM_DEADCHAR | |
3896 # define HANDLE_WM_DEADCHAR(hwnd, wParam, lParam, fn) \ | |
3897 ((fn)((hwnd), (TCHAR)(wParam), (int)(short)LOWORD(lParam)), 0L) | |
3898 # endif | |
3899 #endif /* __MINGW32__ */ | |
3900 | |
3901 | |
3902 /* Some parameters for tearoff menus. All in pixels. */ | |
3903 #define TEAROFF_PADDING_X 2 | |
3904 #define TEAROFF_BUTTON_PAD_X 8 | |
3905 #define TEAROFF_MIN_WIDTH 200 | |
3906 #define TEAROFF_SUBMENU_LABEL ">>" | |
3907 #define TEAROFF_COLUMN_PADDING 3 // # spaces to pad column with. | |
3908 | |
3909 | |
3910 /* For the Intellimouse: */ | |
3911 #ifndef WM_MOUSEWHEEL | |
3912 #define WM_MOUSEWHEEL 0x20a | |
3913 #endif | |
3914 | |
3915 | |
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
|
3916 #ifdef FEAT_BEVAL_GUI |
7 | 3917 # define ID_BEVAL_TOOLTIP 200 |
3918 # define BEVAL_TEXT_LEN MAXPATHL | |
3919 | |
2224
a0cce15dd2a9
Fix definition of UINT_PTR for 64 bit systems.
Bram Moolenaar <bram@vim.org>
parents:
2217
diff
changeset
|
3920 #if (defined(_MSC_VER) && _MSC_VER < 1300) || !defined(MAXULONG_PTR) |
1621 | 3921 /* Work around old versions of basetsd.h which wrongly declares |
3922 * UINT_PTR as unsigned long. */ | |
2224
a0cce15dd2a9
Fix definition of UINT_PTR for 64 bit systems.
Bram Moolenaar <bram@vim.org>
parents:
2217
diff
changeset
|
3923 # undef UINT_PTR |
837 | 3924 # define UINT_PTR UINT |
3925 #endif | |
840 | 3926 |
7 | 3927 static BalloonEval *cur_beval = NULL; |
835 | 3928 static UINT_PTR BevalTimerId = 0; |
7 | 3929 static DWORD LastActivity = 0; |
435 | 3930 |
3927 | 3931 |
3932 /* cproto fails on missing include files */ | |
3933 #ifndef PROTO | |
3934 | |
435 | 3935 /* |
3936 * excerpts from headers since this may not be presented | |
843 | 3937 * in the extremely old compilers |
435 | 3938 */ |
3927 | 3939 # include <pshpack1.h> |
3940 | |
3941 #endif | |
435 | 3942 |
3943 typedef struct _DllVersionInfo | |
3944 { | |
3945 DWORD cbSize; | |
3946 DWORD dwMajorVersion; | |
3947 DWORD dwMinorVersion; | |
3948 DWORD dwBuildNumber; | |
3949 DWORD dwPlatformID; | |
3950 } DLLVERSIONINFO; | |
3951 | |
3927 | 3952 #ifndef PROTO |
3953 # include <poppack.h> | |
3954 #endif | |
2026 | 3955 |
435 | 3956 typedef struct tagTOOLINFOA_NEW |
3957 { | |
15277
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
3958 UINT cbSize; |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
3959 UINT uFlags; |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
3960 HWND hwnd; |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
3961 UINT_PTR uId; |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
3962 RECT rect; |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
3963 HINSTANCE hinst; |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
3964 LPSTR lpszText; |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
3965 LPARAM lParam; |
435 | 3966 } TOOLINFO_NEW; |
3967 | |
3968 typedef struct tagNMTTDISPINFO_NEW | |
3969 { | |
3970 NMHDR hdr; | |
2026 | 3971 LPSTR lpszText; |
435 | 3972 char szText[80]; |
3973 HINSTANCE hinst; | |
3974 UINT uFlags; | |
3975 LPARAM lParam; | |
3976 } NMTTDISPINFO_NEW; | |
3977 | |
15277
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
3978 typedef struct tagTOOLINFOW_NEW |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
3979 { |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
3980 UINT cbSize; |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
3981 UINT uFlags; |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
3982 HWND hwnd; |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
3983 UINT_PTR uId; |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
3984 RECT rect; |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
3985 HINSTANCE hinst; |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
3986 LPWSTR lpszText; |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
3987 LPARAM lParam; |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
3988 void *lpReserved; |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
3989 } TOOLINFOW_NEW; |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
3990 |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
3991 typedef struct tagNMTTDISPINFOW_NEW |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
3992 { |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
3993 NMHDR hdr; |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
3994 LPWSTR lpszText; |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
3995 WCHAR szText[80]; |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
3996 HINSTANCE hinst; |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
3997 UINT uFlags; |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
3998 LPARAM lParam; |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
3999 } NMTTDISPINFOW_NEW; |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
4000 |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
4001 |
435 | 4002 typedef HRESULT (WINAPI* DLLGETVERSIONPROC)(DLLVERSIONINFO *); |
4003 #ifndef TTM_SETMAXTIPWIDTH | |
842 | 4004 # define TTM_SETMAXTIPWIDTH (WM_USER+24) |
7 | 4005 #endif |
4006 | |
435 | 4007 #ifndef TTF_DI_SETITEM |
842 | 4008 # define TTF_DI_SETITEM 0x8000 |
435 | 4009 #endif |
4010 | |
4011 #ifndef TTN_GETDISPINFO | |
842 | 4012 # define TTN_GETDISPINFO (TTN_FIRST - 0) |
435 | 4013 #endif |
4014 | |
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
|
4015 #endif /* defined(FEAT_BEVAL_GUI) */ |
435 | 4016 |
1213 | 4017 #if defined(FEAT_TOOLBAR) || defined(FEAT_GUI_TABLINE) |
4018 /* Older MSVC compilers don't have LPNMTTDISPINFO[AW] thus we need to define | |
4019 * it here if LPNMTTDISPINFO isn't defined. | |
4020 * MingW doesn't define LPNMTTDISPINFO but typedefs it. Thus we need to check | |
4021 * _MSC_VER. */ | |
4022 # if !defined(LPNMTTDISPINFO) && defined(_MSC_VER) | |
4023 typedef struct tagNMTTDISPINFOA { | |
4024 NMHDR hdr; | |
4025 LPSTR lpszText; | |
4026 char szText[80]; | |
4027 HINSTANCE hinst; | |
4028 UINT uFlags; | |
4029 LPARAM lParam; | |
4030 } NMTTDISPINFOA, *LPNMTTDISPINFOA; | |
4031 # define LPNMTTDISPINFO LPNMTTDISPINFOA | |
4032 | |
4033 typedef struct tagNMTTDISPINFOW { | |
4034 NMHDR hdr; | |
4035 LPWSTR lpszText; | |
4036 WCHAR szText[80]; | |
4037 HINSTANCE hinst; | |
4038 UINT uFlags; | |
4039 LPARAM lParam; | |
4040 } NMTTDISPINFOW, *LPNMTTDISPINFOW; | |
4041 # endif | |
4042 #endif | |
4043 | |
842 | 4044 #ifndef TTN_GETDISPINFOW |
4045 # define TTN_GETDISPINFOW (TTN_FIRST - 10) | |
4046 #endif | |
4047 | |
7 | 4048 /* Local variables: */ |
4049 | |
4050 #ifdef FEAT_MENU | |
4051 static UINT s_menu_id = 100; | |
2614 | 4052 #endif |
7 | 4053 |
4054 /* | |
4055 * Use the system font for dialogs and tear-off menus. Remove this line to | |
4056 * use DLG_FONT_NAME. | |
4057 */ | |
2614 | 4058 #define USE_SYSMENU_FONT |
7 | 4059 |
4060 #define VIM_NAME "vim" | |
4061 #define VIM_CLASSW L"Vim" | |
4062 | |
4063 /* Initial size for the dialog template. For gui_mch_dialog() it's fixed, | |
4064 * thus there should be room for every dialog. For tearoffs it's made bigger | |
4065 * when needed. */ | |
4066 #define DLG_ALLOC_SIZE 16 * 1024 | |
4067 | |
4068 /* | |
4069 * stuff for dialogs, menus, tearoffs etc. | |
4070 */ | |
4071 static PWORD | |
4072 add_dialog_element( | |
4073 PWORD p, | |
4074 DWORD lStyle, | |
4075 WORD x, | |
4076 WORD y, | |
4077 WORD w, | |
4078 WORD h, | |
4079 WORD Id, | |
4080 WORD clss, | |
4081 const char *caption); | |
4082 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
|
4083 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
|
4084 #if defined(FEAT_MENU) && defined(FEAT_TEAROFF) |
7 | 4085 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
|
4086 #endif |
7 | 4087 static void get_dialog_font_metrics(void); |
4088 | |
4089 static int dialog_default_button = -1; | |
4090 | |
4091 /* Intellimouse support */ | |
4092 static int mouse_scroll_lines = 0; | |
4093 | |
4094 static int s_usenewlook; /* emulate W95/NT4 non-bold dialogs */ | |
4095 #ifdef FEAT_TOOLBAR | |
4096 static void initialise_toolbar(void); | |
5223
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
4097 static LRESULT CALLBACK toolbar_wndproc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); |
7 | 4098 static int get_toolbar_bitmap(vimmenu_T *menu); |
4099 #endif | |
4100 | |
810 | 4101 #ifdef FEAT_GUI_TABLINE |
4102 static void initialise_tabline(void); | |
5223
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
4103 static LRESULT CALLBACK tabline_wndproc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); |
810 | 4104 #endif |
4105 | |
7 | 4106 #ifdef FEAT_MBYTE_IME |
4107 static LRESULT _OnImeComposition(HWND hwnd, WPARAM dbcs, LPARAM param); | |
4108 static char_u *GetResultStr(HWND hwnd, int GCS, int *lenp); | |
4109 #endif | |
4110 #if defined(FEAT_MBYTE_IME) && defined(DYNAMIC_IME) | |
4111 # ifdef NOIME | |
4112 typedef struct tagCOMPOSITIONFORM { | |
4113 DWORD dwStyle; | |
4114 POINT ptCurrentPos; | |
4115 RECT rcArea; | |
4116 } COMPOSITIONFORM, *PCOMPOSITIONFORM, NEAR *NPCOMPOSITIONFORM, FAR *LPCOMPOSITIONFORM; | |
4117 typedef HANDLE HIMC; | |
4118 # endif | |
4119 | |
344 | 4120 static HINSTANCE hLibImm = NULL; |
4121 static LONG (WINAPI *pImmGetCompositionStringA)(HIMC, DWORD, LPVOID, DWORD); | |
4122 static LONG (WINAPI *pImmGetCompositionStringW)(HIMC, DWORD, LPVOID, DWORD); | |
4123 static HIMC (WINAPI *pImmGetContext)(HWND); | |
4124 static HIMC (WINAPI *pImmAssociateContext)(HWND, HIMC); | |
4125 static BOOL (WINAPI *pImmReleaseContext)(HWND, HIMC); | |
4126 static BOOL (WINAPI *pImmGetOpenStatus)(HIMC); | |
4127 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
|
4128 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
|
4129 static BOOL (WINAPI *pImmSetCompositionFontW)(HIMC, LPLOGFONTW); |
344 | 4130 static BOOL (WINAPI *pImmSetCompositionWindow)(HIMC, LPCOMPOSITIONFORM); |
4131 static BOOL (WINAPI *pImmGetConversionStatus)(HIMC, LPDWORD, LPDWORD); | |
777 | 4132 static BOOL (WINAPI *pImmSetConversionStatus)(HIMC, DWORD, DWORD); |
7 | 4133 static void dyn_imm_load(void); |
4134 #else | |
4135 # define pImmGetCompositionStringA ImmGetCompositionStringA | |
4136 # define pImmGetCompositionStringW ImmGetCompositionStringW | |
4137 # define pImmGetContext ImmGetContext | |
4138 # define pImmAssociateContext ImmAssociateContext | |
4139 # define pImmReleaseContext ImmReleaseContext | |
4140 # define pImmGetOpenStatus ImmGetOpenStatus | |
4141 # define pImmSetOpenStatus ImmSetOpenStatus | |
16152
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
4142 # define pImmGetCompositionFontW ImmGetCompositionFontW |
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
4143 # define pImmSetCompositionFontW ImmSetCompositionFontW |
7 | 4144 # define pImmSetCompositionWindow ImmSetCompositionWindow |
4145 # define pImmGetConversionStatus ImmGetConversionStatus | |
777 | 4146 # define pImmSetConversionStatus ImmSetConversionStatus |
7 | 4147 #endif |
4148 | |
4149 #ifdef FEAT_MENU | |
4150 /* | |
4151 * Figure out how high the menu bar is at the moment. | |
4152 */ | |
4153 static int | |
4154 gui_mswin_get_menu_height( | |
4155 int fix_window) /* If TRUE, resize window if menu height changed */ | |
4156 { | |
4157 static int old_menu_height = -1; | |
4158 | |
4159 RECT rc1, rc2; | |
4160 int num; | |
4161 int menu_height; | |
4162 | |
4163 if (gui.menu_is_active) | |
4164 num = GetMenuItemCount(s_menuBar); | |
4165 else | |
4166 num = 0; | |
4167 | |
4168 if (num == 0) | |
4169 menu_height = 0; | |
6714 | 4170 else if (IsMinimized(s_hwnd)) |
4171 { | |
4172 /* The height of the menu cannot be determined while the window is | |
4173 * minimized. Take the previous height if the menu is changed in that | |
4174 * state, to avoid that Vim's vertical window size accidentally | |
4175 * increases due to the unaccounted-for menu height. */ | |
4176 menu_height = old_menu_height == -1 ? 0 : old_menu_height; | |
4177 } | |
7 | 4178 else |
4179 { | |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
4180 /* |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
4181 * 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
|
4182 * 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
|
4183 * 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
|
4184 * 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
|
4185 * 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
|
4186 */ |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
4187 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
|
4188 if (gui.starting) |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
4189 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
|
4190 else |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
4191 { |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
4192 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
|
4193 menu_height = rc2.bottom - rc1.top + 1; |
7 | 4194 } |
4195 } | |
4196 | |
4197 if (fix_window && menu_height != old_menu_height) | |
812 | 4198 gui_set_shellsize(FALSE, FALSE, RESIZE_VERT); |
6714 | 4199 old_menu_height = menu_height; |
7 | 4200 |
4201 return menu_height; | |
4202 } | |
4203 #endif /*FEAT_MENU*/ | |
4204 | |
4205 | |
4206 /* | |
4207 * Setup for the Intellimouse | |
4208 */ | |
4209 static void | |
4210 init_mouse_wheel(void) | |
4211 { | |
4212 | |
4213 #ifndef SPI_GETWHEELSCROLLLINES | |
4214 # define SPI_GETWHEELSCROLLLINES 104 | |
4215 #endif | |
336 | 4216 #ifndef SPI_SETWHEELSCROLLLINES |
4217 # define SPI_SETWHEELSCROLLLINES 105 | |
4218 #endif | |
7 | 4219 |
4220 #define VMOUSEZ_CLASSNAME "MouseZ" /* hidden wheel window class */ | |
4221 #define VMOUSEZ_TITLE "Magellan MSWHEEL" /* hidden wheel window title */ | |
4222 #define VMSH_MOUSEWHEEL "MSWHEEL_ROLLMSG" | |
4223 #define VMSH_SCROLL_LINES "MSH_SCROLL_LINES_MSG" | |
4224 | |
4225 mouse_scroll_lines = 3; /* reasonable default */ | |
4226 | |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
4227 /* if NT 4.0+ (or Win98) get scroll lines directly from system */ |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
4228 SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
4229 &mouse_scroll_lines, 0); |
7 | 4230 } |
4231 | |
4232 | |
4233 /* Intellimouse wheel handler */ | |
4234 static void | |
4235 _OnMouseWheel( | |
4236 HWND hwnd, | |
4237 short zDelta) | |
4238 { | |
4239 /* Treat a mouse wheel event as if it were a scroll request */ | |
4240 int i; | |
4241 int size; | |
4242 HWND hwndCtl; | |
4243 | |
4244 if (curwin->w_scrollbars[SBAR_RIGHT].id != 0) | |
4245 { | |
4246 hwndCtl = curwin->w_scrollbars[SBAR_RIGHT].id; | |
4247 size = curwin->w_scrollbars[SBAR_RIGHT].size; | |
4248 } | |
4249 else if (curwin->w_scrollbars[SBAR_LEFT].id != 0) | |
4250 { | |
4251 hwndCtl = curwin->w_scrollbars[SBAR_LEFT].id; | |
4252 size = curwin->w_scrollbars[SBAR_LEFT].size; | |
4253 } | |
4254 else | |
4255 return; | |
4256 | |
4257 size = curwin->w_height; | |
4258 if (mouse_scroll_lines == 0) | |
4259 init_mouse_wheel(); | |
4260 | |
13150
808625d4b71b
patch 8.0.1449: slow redrawing with DirectX
Christian Brabandt <cb@256bit.org>
parents:
13028
diff
changeset
|
4261 mch_disable_flush(); |
7 | 4262 if (mouse_scroll_lines > 0 |
4263 && mouse_scroll_lines < (size > 2 ? size - 2 : 1)) | |
4264 { | |
4265 for (i = mouse_scroll_lines; i > 0; --i) | |
4266 _OnScroll(hwnd, hwndCtl, zDelta >= 0 ? SB_LINEUP : SB_LINEDOWN, 0); | |
4267 } | |
4268 else | |
4269 _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
|
4270 mch_enable_flush(); |
808625d4b71b
patch 8.0.1449: slow redrawing with DirectX
Christian Brabandt <cb@256bit.org>
parents:
13028
diff
changeset
|
4271 gui_may_flush(); |
7 | 4272 } |
4273 | |
843 | 4274 #ifdef USE_SYSMENU_FONT |
4275 /* | |
4276 * Get Menu Font. | |
4277 * Return OK or FAIL. | |
4278 */ | |
4279 static int | |
16152
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
4280 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
|
4281 { |
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
4282 NONCLIENTMETRICSW nm; |
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
4283 |
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
4284 nm.cbSize = sizeof(NONCLIENTMETRICSW); |
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
4285 if (!SystemParametersInfoW( |
843 | 4286 SPI_GETNONCLIENTMETRICS, |
16152
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
4287 sizeof(NONCLIENTMETRICSW), |
843 | 4288 &nm, |
4289 0)) | |
4290 return FAIL; | |
4291 *lf = nm.lfMenuFont; | |
4292 return OK; | |
4293 } | |
4294 #endif | |
4295 | |
4296 | |
4297 #if defined(FEAT_GUI_TABLINE) && defined(USE_SYSMENU_FONT) | |
4298 /* | |
4299 * Set the GUI tabline font to the system menu font | |
4300 */ | |
4301 static void | |
4302 set_tabline_font(void) | |
4303 { | |
16152
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
4304 LOGFONTW lfSysmenu; |
843 | 4305 HFONT font; |
4306 HWND hwnd; | |
4307 HDC hdc; | |
4308 HFONT hfntOld; | |
4309 TEXTMETRIC tm; | |
4310 | |
4311 if (gui_w32_get_menu_font(&lfSysmenu) != OK) | |
4312 return; | |
4313 | |
16152
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
4314 font = CreateFontIndirectW(&lfSysmenu); |
843 | 4315 |
4316 SendMessage(s_tabhwnd, WM_SETFONT, (WPARAM)font, TRUE); | |
4317 | |
4318 /* | |
4319 * Compute the height of the font used for the tab text | |
4320 */ | |
4321 hwnd = GetDesktopWindow(); | |
4322 hdc = GetWindowDC(hwnd); | |
4323 hfntOld = SelectFont(hdc, font); | |
4324 | |
4325 GetTextMetrics(hdc, &tm); | |
4326 | |
4327 SelectFont(hdc, hfntOld); | |
4328 ReleaseDC(hwnd, hdc); | |
4329 | |
4330 /* | |
4331 * The space used by the tab border and the space between the tab label | |
4332 * and the tab border is included as 7. | |
4333 */ | |
4334 gui.tabline_height = tm.tmHeight + tm.tmInternalLeading + 7; | |
4335 } | |
4336 #endif | |
4337 | |
333 | 4338 /* |
4339 * Invoked when a setting was changed. | |
4340 */ | |
4341 static LRESULT CALLBACK | |
4342 _OnSettingChange(UINT n) | |
4343 { | |
4344 if (n == SPI_SETWHEELSCROLLLINES) | |
4345 SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, | |
4346 &mouse_scroll_lines, 0); | |
843 | 4347 #if defined(FEAT_GUI_TABLINE) && defined(USE_SYSMENU_FONT) |
4348 if (n == SPI_SETNONCLIENTMETRICS) | |
4349 set_tabline_font(); | |
4350 #endif | |
333 | 4351 return 0; |
4352 } | |
4353 | |
7 | 4354 #ifdef FEAT_NETBEANS_INTG |
4355 static void | |
4356 _OnWindowPosChanged( | |
4357 HWND hwnd, | |
4358 const LPWINDOWPOS lpwpos) | |
4359 { | |
4360 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
|
4361 extern int WSInitialized; |
7 | 4362 |
4363 if (WSInitialized && (lpwpos->x != x || lpwpos->y != y | |
4364 || lpwpos->cx != cx || lpwpos->cy != cy)) | |
4365 { | |
4366 x = lpwpos->x; | |
4367 y = lpwpos->y; | |
4368 cx = lpwpos->cx; | |
4369 cy = lpwpos->cy; | |
4370 netbeans_frame_moved(x, y); | |
4371 } | |
4372 /* Allow to send WM_SIZE and WM_MOVE */ | |
4373 FORWARD_WM_WINDOWPOSCHANGED(hwnd, lpwpos, MyWindowProc); | |
4374 } | |
4375 #endif | |
4376 | |
4377 static int | |
4378 _DuringSizing( | |
4379 UINT fwSide, | |
4380 LPRECT lprc) | |
4381 { | |
4382 int w, h; | |
4383 int valid_w, valid_h; | |
4384 int w_offset, h_offset; | |
4385 | |
4386 w = lprc->right - lprc->left; | |
4387 h = lprc->bottom - lprc->top; | |
4388 gui_mswin_get_valid_dimensions(w, h, &valid_w, &valid_h); | |
4389 w_offset = w - valid_w; | |
4390 h_offset = h - valid_h; | |
4391 | |
4392 if (fwSide == WMSZ_LEFT || fwSide == WMSZ_TOPLEFT | |
4393 || fwSide == WMSZ_BOTTOMLEFT) | |
4394 lprc->left += w_offset; | |
4395 else if (fwSide == WMSZ_RIGHT || fwSide == WMSZ_TOPRIGHT | |
4396 || fwSide == WMSZ_BOTTOMRIGHT) | |
4397 lprc->right -= w_offset; | |
4398 | |
4399 if (fwSide == WMSZ_TOP || fwSide == WMSZ_TOPLEFT | |
4400 || fwSide == WMSZ_TOPRIGHT) | |
4401 lprc->top += h_offset; | |
4402 else if (fwSide == WMSZ_BOTTOM || fwSide == WMSZ_BOTTOMLEFT | |
4403 || fwSide == WMSZ_BOTTOMRIGHT) | |
4404 lprc->bottom -= h_offset; | |
4405 return TRUE; | |
4406 } | |
4407 | |
4408 | |
4409 | |
4410 static LRESULT CALLBACK | |
4411 _WndProc( | |
4412 HWND hwnd, | |
4413 UINT uMsg, | |
4414 WPARAM wParam, | |
4415 LPARAM lParam) | |
4416 { | |
4417 /* | |
4418 TRACE("WndProc: hwnd = %08x, msg = %x, wParam = %x, lParam = %x\n", | |
4419 hwnd, uMsg, wParam, lParam); | |
4420 */ | |
4421 | |
4422 HandleMouseHide(uMsg, lParam); | |
4423 | |
4424 s_uMsg = uMsg; | |
4425 s_wParam = wParam; | |
4426 s_lParam = lParam; | |
4427 | |
4428 switch (uMsg) | |
4429 { | |
4430 HANDLE_MSG(hwnd, WM_DEADCHAR, _OnDeadChar); | |
4431 HANDLE_MSG(hwnd, WM_SYSDEADCHAR, _OnDeadChar); | |
4432 /* HANDLE_MSG(hwnd, WM_ACTIVATE, _OnActivate); */ | |
4433 HANDLE_MSG(hwnd, WM_CLOSE, _OnClose); | |
4434 /* HANDLE_MSG(hwnd, WM_COMMAND, _OnCommand); */ | |
4435 HANDLE_MSG(hwnd, WM_DESTROY, _OnDestroy); | |
4436 HANDLE_MSG(hwnd, WM_DROPFILES, _OnDropFiles); | |
4437 HANDLE_MSG(hwnd, WM_HSCROLL, _OnScroll); | |
4438 HANDLE_MSG(hwnd, WM_KILLFOCUS, _OnKillFocus); | |
4439 #ifdef FEAT_MENU | |
4440 HANDLE_MSG(hwnd, WM_COMMAND, _OnMenu); | |
4441 #endif | |
4442 /* HANDLE_MSG(hwnd, WM_MOVE, _OnMove); */ | |
4443 /* HANDLE_MSG(hwnd, WM_NCACTIVATE, _OnNCActivate); */ | |
4444 HANDLE_MSG(hwnd, WM_SETFOCUS, _OnSetFocus); | |
4445 HANDLE_MSG(hwnd, WM_SIZE, _OnSize); | |
4446 /* HANDLE_MSG(hwnd, WM_SYSCOMMAND, _OnSysCommand); */ | |
4447 /* HANDLE_MSG(hwnd, WM_SYSKEYDOWN, _OnAltKey); */ | |
4448 HANDLE_MSG(hwnd, WM_VSCROLL, _OnScroll); | |
4449 // HANDLE_MSG(hwnd, WM_WINDOWPOSCHANGING, _OnWindowPosChanging); | |
4450 HANDLE_MSG(hwnd, WM_ACTIVATEAPP, _OnActivateApp); | |
4451 #ifdef FEAT_NETBEANS_INTG | |
4452 HANDLE_MSG(hwnd, WM_WINDOWPOSCHANGED, _OnWindowPosChanged); | |
4453 #endif | |
4454 | |
812 | 4455 #ifdef FEAT_GUI_TABLINE |
4456 case WM_RBUTTONUP: | |
4457 { | |
4458 if (gui_mch_showing_tabline()) | |
4459 { | |
4460 POINT pt; | |
4461 RECT rect; | |
4462 | |
4463 /* | |
4464 * If the cursor is on the tabline, display the tab menu | |
4465 */ | |
4466 GetCursorPos((LPPOINT)&pt); | |
4467 GetWindowRect(s_textArea, &rect); | |
4468 if (pt.y < rect.top) | |
4469 { | |
4470 show_tabline_popup_menu(); | |
3225 | 4471 return 0L; |
812 | 4472 } |
4473 } | |
4474 return MyWindowProc(hwnd, uMsg, wParam, lParam); | |
4475 } | |
819 | 4476 case WM_LBUTTONDBLCLK: |
4477 { | |
4478 /* | |
4479 * If the user double clicked the tabline, create a new tab | |
4480 */ | |
4481 if (gui_mch_showing_tabline()) | |
4482 { | |
4483 POINT pt; | |
4484 RECT rect; | |
4485 | |
4486 GetCursorPos((LPPOINT)&pt); | |
4487 GetWindowRect(s_textArea, &rect); | |
4488 if (pt.y < rect.top) | |
824 | 4489 send_tabline_menu_event(0, TABLINE_MENU_NEW); |
819 | 4490 } |
4491 return MyWindowProc(hwnd, uMsg, wParam, lParam); | |
4492 } | |
812 | 4493 #endif |
4494 | |
7 | 4495 case WM_QUERYENDSESSION: /* System wants to go down. */ |
4496 gui_shell_closed(); /* Will exit when no changed buffers. */ | |
4497 return FALSE; /* Do NOT allow system to go down. */ | |
4498 | |
4499 case WM_ENDSESSION: | |
4500 if (wParam) /* system only really goes down when wParam is TRUE */ | |
3225 | 4501 { |
7 | 4502 _OnEndSession(); |
3225 | 4503 return 0L; |
4504 } | |
7 | 4505 break; |
4506 | |
4507 case WM_CHAR: | |
4508 /* Don't use HANDLE_MSG() for WM_CHAR, it truncates wParam to a single | |
4509 * byte while we want the UTF-16 character value. */ | |
835 | 4510 _OnChar(hwnd, (UINT)wParam, (int)(short)LOWORD(lParam)); |
7 | 4511 return 0L; |
4512 | |
4513 case WM_SYSCHAR: | |
4514 /* | |
4515 * if 'winaltkeys' is "no", or it's "menu" and it's not a menu | |
4516 * shortcut key, handle like a typed ALT key, otherwise call Windows | |
4517 * ALT key handling. | |
4518 */ | |
4519 #ifdef FEAT_MENU | |
4520 if ( !gui.menu_is_active | |
4521 || p_wak[0] == 'n' | |
4522 || (p_wak[0] == 'm' && !gui_is_menu_shortcut((int)wParam)) | |
4523 ) | |
4524 #endif | |
4525 { | |
835 | 4526 _OnSysChar(hwnd, (UINT)wParam, (int)(short)LOWORD(lParam)); |
7 | 4527 return 0L; |
4528 } | |
4529 #ifdef FEAT_MENU | |
4530 else | |
4531 return MyWindowProc(hwnd, uMsg, wParam, lParam); | |
4532 #endif | |
4533 | |
4534 case WM_SYSKEYUP: | |
4535 #ifdef FEAT_MENU | |
4536 /* This used to be done only when menu is active: ALT key is used for | |
4537 * that. But that caused problems when menu is disabled and using | |
4538 * Alt-Tab-Esc: get into a strange state where no mouse-moved events | |
4539 * are received, mouse pointer remains hidden. */ | |
4540 return MyWindowProc(hwnd, uMsg, wParam, lParam); | |
4541 #else | |
3225 | 4542 return 0L; |
7 | 4543 #endif |
4544 | |
4545 case WM_SIZING: /* HANDLE_MSG doesn't seem to handle this one */ | |
323 | 4546 return _DuringSizing((UINT)wParam, (LPRECT)lParam); |
7 | 4547 |
4548 case WM_MOUSEWHEEL: | |
4549 _OnMouseWheel(hwnd, HIWORD(wParam)); | |
3225 | 4550 return 0L; |
7 | 4551 |
333 | 4552 /* Notification for change in SystemParametersInfo() */ |
4553 case WM_SETTINGCHANGE: | |
4554 return _OnSettingChange((UINT)wParam); | |
4555 | |
810 | 4556 #if defined(FEAT_TOOLBAR) || defined(FEAT_GUI_TABLINE) |
7 | 4557 case WM_NOTIFY: |
4558 switch (((LPNMHDR) lParam)->code) | |
4559 { | |
840 | 4560 case TTN_GETDISPINFOW: |
948 | 4561 case TTN_GETDISPINFO: |
7 | 4562 { |
948 | 4563 LPNMHDR hdr = (LPNMHDR)lParam; |
4564 char_u *str = NULL; | |
4565 static void *tt_text = NULL; | |
4566 | |
13244
ac42c4b11dbc
patch 8.0.1496: clearing a pointer takes two lines
Christian Brabandt <cb@256bit.org>
parents:
13152
diff
changeset
|
4567 VIM_CLEAR(tt_text); |
948 | 4568 |
4569 # ifdef FEAT_GUI_TABLINE | |
4570 if (gui_mch_showing_tabline() | |
4571 && hdr->hwndFrom == TabCtrl_GetToolTips(s_tabhwnd)) | |
840 | 4572 { |
948 | 4573 POINT pt; |
840 | 4574 /* |
948 | 4575 * Mouse is over the GUI tabline. Display the |
4576 * tooltip for the tab under the cursor | |
4577 * | |
4578 * Get the cursor position within the tab control | |
840 | 4579 */ |
948 | 4580 GetCursorPos(&pt); |
4581 if (ScreenToClient(s_tabhwnd, &pt) != 0) | |
840 | 4582 { |
948 | 4583 TCHITTESTINFO htinfo; |
4584 int idx; | |
4585 | |
4586 /* | |
4587 * Get the tab under the cursor | |
4588 */ | |
4589 htinfo.pt.x = pt.x; | |
4590 htinfo.pt.y = pt.y; | |
4591 idx = TabCtrl_HitTest(s_tabhwnd, &htinfo); | |
4592 if (idx != -1) | |
840 | 4593 { |
948 | 4594 tabpage_T *tp; |
4595 | |
4596 tp = find_tabpage(idx + 1); | |
4597 if (tp != NULL) | |
840 | 4598 { |
948 | 4599 get_tabline_label(tp, TRUE); |
4600 str = NameBuff; | |
840 | 4601 } |
4602 } | |
4603 } | |
4604 } | |
4605 # endif | |
4606 # ifdef FEAT_TOOLBAR | |
948 | 4607 # ifdef FEAT_GUI_TABLINE |
4608 else | |
4609 # endif | |
4610 { | |
4611 UINT idButton; | |
4612 vimmenu_T *pMenu; | |
4613 | |
4614 idButton = (UINT) hdr->idFrom; | |
4615 pMenu = gui_mswin_find_menu(root_menu, idButton); | |
4616 if (pMenu) | |
4617 str = pMenu->strings[MENU_INDEX_TIP]; | |
4618 } | |
4619 # endif | |
4620 if (str != NULL) | |
7 | 4621 { |
948 | 4622 if (hdr->code == TTN_GETDISPINFOW) |
7 | 4623 { |
948 | 4624 LPNMTTDISPINFOW lpdi = (LPNMTTDISPINFOW)lParam; |
4625 | |
1481 | 4626 /* Set the maximum width, this also enables using |
4627 * \n for line break. */ | |
4628 SendMessage(lpdi->hdr.hwndFrom, TTM_SETMAXTIPWIDTH, | |
4629 0, 500); | |
4630 | |
1752 | 4631 tt_text = enc_to_utf16(str, NULL); |
948 | 4632 lpdi->lpszText = tt_text; |
4633 /* can't show tooltip if failed */ | |
4634 } | |
4635 else | |
4636 { | |
4637 LPNMTTDISPINFO lpdi = (LPNMTTDISPINFO)lParam; | |
4638 | |
1481 | 4639 /* Set the maximum width, this also enables using |
4640 * \n for line break. */ | |
4641 SendMessage(lpdi->hdr.hwndFrom, TTM_SETMAXTIPWIDTH, | |
4642 0, 500); | |
4643 | |
948 | 4644 if (STRLEN(str) < sizeof(lpdi->szText) |
4645 || ((tt_text = vim_strsave(str)) == NULL)) | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
4646 vim_strncpy((char_u *)lpdi->szText, str, |
948 | 4647 sizeof(lpdi->szText) - 1); |
4648 else | |
4649 lpdi->lpszText = tt_text; | |
7 | 4650 } |
4651 } | |
4652 } | |
4653 break; | |
810 | 4654 # ifdef FEAT_GUI_TABLINE |
4655 case TCN_SELCHANGE: | |
4656 if (gui_mch_showing_tabline() | |
4657 && ((LPNMHDR)lParam)->hwndFrom == s_tabhwnd) | |
3225 | 4658 { |
810 | 4659 send_tabline_event(TabCtrl_GetCurSel(s_tabhwnd) + 1); |
3225 | 4660 return 0L; |
4661 } | |
810 | 4662 break; |
812 | 4663 |
4664 case NM_RCLICK: | |
4665 if (gui_mch_showing_tabline() | |
4666 && ((LPNMHDR)lParam)->hwndFrom == s_tabhwnd) | |
3225 | 4667 { |
812 | 4668 show_tabline_popup_menu(); |
3225 | 4669 return 0L; |
4670 } | |
812 | 4671 break; |
810 | 4672 # endif |
7 | 4673 default: |
810 | 4674 # ifdef FEAT_GUI_TABLINE |
4675 if (gui_mch_showing_tabline() | |
4676 && ((LPNMHDR)lParam)->hwndFrom == s_tabhwnd) | |
4677 return MyWindowProc(hwnd, uMsg, wParam, lParam); | |
4678 # endif | |
7 | 4679 break; |
4680 } | |
4681 break; | |
4682 #endif | |
4683 #if defined(MENUHINTS) && defined(FEAT_MENU) | |
4684 case WM_MENUSELECT: | |
4685 if (((UINT) HIWORD(wParam) | |
4686 & (0xffff ^ (MF_MOUSESELECT + MF_BITMAP + MF_POPUP))) | |
4687 == MF_HILITE | |
4688 && (State & CMDLINE) == 0) | |
4689 { | |
4690 UINT idButton; | |
4691 vimmenu_T *pMenu; | |
4692 static int did_menu_tip = FALSE; | |
4693 | |
4694 if (did_menu_tip) | |
4695 { | |
4696 msg_clr_cmdline(); | |
4697 setcursor(); | |
4698 out_flush(); | |
4699 did_menu_tip = FALSE; | |
4700 } | |
4701 | |
4702 idButton = (UINT)LOWORD(wParam); | |
4703 pMenu = gui_mswin_find_menu(root_menu, idButton); | |
4704 if (pMenu != NULL && pMenu->strings[MENU_INDEX_TIP] != 0 | |
4705 && GetMenuState(s_menuBar, pMenu->id, MF_BYCOMMAND) != -1) | |
4706 { | |
1288 | 4707 ++msg_hist_off; |
15543
dd725a8ab112
patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15470
diff
changeset
|
4708 msg((char *)pMenu->strings[MENU_INDEX_TIP]); |
1288 | 4709 --msg_hist_off; |
7 | 4710 setcursor(); |
4711 out_flush(); | |
4712 did_menu_tip = TRUE; | |
4713 } | |
3225 | 4714 return 0L; |
7 | 4715 } |
4716 break; | |
4717 #endif | |
4718 case WM_NCHITTEST: | |
4719 { | |
4720 LRESULT result; | |
4721 int x, y; | |
4722 int xPos = GET_X_LPARAM(lParam); | |
4723 | |
4724 result = MyWindowProc(hwnd, uMsg, wParam, lParam); | |
4725 if (result == HTCLIENT) | |
4726 { | |
810 | 4727 #ifdef FEAT_GUI_TABLINE |
4728 if (gui_mch_showing_tabline()) | |
4729 { | |
4730 int yPos = GET_Y_LPARAM(lParam); | |
4731 RECT rct; | |
4732 | |
4733 /* If the cursor is on the GUI tabline, don't process this | |
4734 * event */ | |
4735 GetWindowRect(s_textArea, &rct); | |
4736 if (yPos < rct.top) | |
4737 return result; | |
4738 } | |
4739 #endif | |
7009 | 4740 (void)gui_mch_get_winpos(&x, &y); |
7 | 4741 xPos -= x; |
4742 | |
4743 if (xPos < 48) /* <VN> TODO should use system metric? */ | |
4744 return HTBOTTOMLEFT; | |
4745 else | |
4746 return HTBOTTOMRIGHT; | |
4747 } | |
4748 else | |
4749 return result; | |
4750 } | |
4751 /* break; notreached */ | |
4752 | |
4753 #ifdef FEAT_MBYTE_IME | |
4754 case WM_IME_NOTIFY: | |
4755 if (!_OnImeNotify(hwnd, (DWORD)wParam, (DWORD)lParam)) | |
4756 return MyWindowProc(hwnd, uMsg, wParam, lParam); | |
3225 | 4757 return 1L; |
4758 | |
7 | 4759 case WM_IME_COMPOSITION: |
4760 if (!_OnImeComposition(hwnd, wParam, lParam)) | |
4761 return MyWindowProc(hwnd, uMsg, wParam, lParam); | |
3225 | 4762 return 1L; |
7 | 4763 #endif |
4764 | |
4765 default: | |
4766 #ifdef MSWIN_FIND_REPLACE | |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
4767 if (uMsg == s_findrep_msg && s_findrep_msg != 0) |
7 | 4768 _OnFindRepl(); |
4769 #endif | |
4770 return MyWindowProc(hwnd, uMsg, wParam, lParam); | |
4771 } | |
4772 | |
3212 | 4773 return DefWindowProc(hwnd, uMsg, wParam, lParam); |
7 | 4774 } |
4775 | |
4776 /* | |
4777 * End of call-back routines | |
4778 */ | |
4779 | |
4780 /* parent window, if specified with -P */ | |
4781 HWND vim_parent_hwnd = NULL; | |
4782 | |
4783 static BOOL CALLBACK | |
4784 FindWindowTitle(HWND hwnd, LPARAM lParam) | |
4785 { | |
4786 char buf[2048]; | |
4787 char *title = (char *)lParam; | |
4788 | |
4789 if (GetWindowText(hwnd, buf, sizeof(buf))) | |
4790 { | |
4791 if (strstr(buf, title) != NULL) | |
4792 { | |
9 | 4793 /* Found it. Store the window ref. and quit searching if MDI |
4794 * works. */ | |
7 | 4795 vim_parent_hwnd = FindWindowEx(hwnd, NULL, "MDIClient", NULL); |
9 | 4796 if (vim_parent_hwnd != NULL) |
4797 return FALSE; | |
7 | 4798 } |
4799 } | |
4800 return TRUE; /* continue searching */ | |
4801 } | |
4802 | |
4803 /* | |
4804 * Invoked for '-P "title"' argument: search for parent application to open | |
4805 * our window in. | |
4806 */ | |
4807 void | |
4808 gui_mch_set_parent(char *title) | |
4809 { | |
4810 EnumWindows(FindWindowTitle, (LPARAM)title); | |
4811 if (vim_parent_hwnd == NULL) | |
4812 { | |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15288
diff
changeset
|
4813 semsg(_("E671: Cannot find window title \"%s\""), title); |
7 | 4814 mch_exit(2); |
4815 } | |
4816 } | |
4817 | |
323 | 4818 #ifndef FEAT_OLE |
7 | 4819 static void |
4820 ole_error(char *arg) | |
4821 { | |
1116 | 4822 char buf[IOSIZE]; |
4823 | |
16596
2f86ca0c1e6b
patch 8.1.1301: when compiled with VIMDLL some messages are not shown
Bram Moolenaar <Bram@vim.org>
parents:
16582
diff
changeset
|
4824 # 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
|
4825 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
|
4826 # endif |
2f86ca0c1e6b
patch 8.1.1301: when compiled with VIMDLL some messages are not shown
Bram Moolenaar <Bram@vim.org>
parents:
16582
diff
changeset
|
4827 |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15288
diff
changeset
|
4828 /* Can't use emsg() here, we have not finished initialisation yet. */ |
1116 | 4829 vim_snprintf(buf, IOSIZE, |
4830 _("E243: Argument not supported: \"-%s\"; Use the OLE version."), | |
4831 arg); | |
4832 mch_errmsg(buf); | |
7 | 4833 } |
323 | 4834 #endif |
7 | 4835 |
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
|
4836 #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
|
4837 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
|
4838 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
|
4839 { |
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 char *msg = _("E988: GUI cannot be used. Cannot execute 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
|
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 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
|
4843 { |
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 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
|
4845 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
|
4846 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
|
4847 } |
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 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
|
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 |
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 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
|
4852 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
|
4853 { |
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 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
|
4855 # 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
|
4856 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
|
4857 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
|
4858 # 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
|
4859 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
|
4860 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
|
4861 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
|
4862 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
|
4863 |
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 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
|
4865 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
|
4866 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
|
4867 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
|
4868 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
|
4869 // 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
|
4870 # 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
|
4871 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
|
4872 # 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
|
4873 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
|
4874 # 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
|
4875 |
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 # 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
|
4877 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
|
4878 # 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
|
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 // 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
|
4881 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
|
4882 // 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
|
4883 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
|
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 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
|
4886 { |
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 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
|
4888 ++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
|
4889 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
|
4890 ++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
|
4891 } |
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 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
|
4893 ++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
|
4894 } |
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
|
4895 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
|
4896 } |
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 # 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
|
4898 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
|
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 // 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
|
4901 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
|
4902 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
|
4903 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
|
4904 |
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 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
|
4906 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
|
4907 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
|
4908 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
|
4909 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
|
4910 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
|
4911 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
|
4912 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
|
4913 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
|
4914 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
|
4915 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
|
4916 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
|
4917 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
|
4918 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
|
4919 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
|
4920 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
|
4921 { |
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
|
4922 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
|
4923 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
|
4924 } |
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
|
4925 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
|
4926 _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
|
4927 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
|
4928 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
|
4929 } |
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
|
4930 # 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
|
4931 |
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
|
4932 // 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
|
4933 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
|
4934 { |
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
|
4935 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
|
4936 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
|
4937 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
|
4938 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
|
4939 } |
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
|
4940 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
|
4941 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
|
4942 |
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
|
4943 // 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
|
4944 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
|
4945 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
|
4946 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
|
4947 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
|
4948 _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
|
4949 |
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
|
4950 // 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
|
4951 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
|
4952 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
|
4953 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
|
4954 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
|
4955 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
|
4956 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
|
4957 |
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
|
4958 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
|
4959 # 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
|
4960 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
|
4961 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
|
4962 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
|
4963 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
|
4964 # 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
|
4965 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
|
4966 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
|
4967 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
|
4968 } |
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
|
4969 #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
|
4970 |
7 | 4971 /* |
4972 * Parse the GUI related command-line arguments. Any arguments used are | |
4973 * deleted from argv, and *argc is decremented accordingly. This is called | |
4974 * when vim is started, whether or not the GUI has been started. | |
4975 */ | |
4976 void | |
4977 gui_mch_prepare(int *argc, char **argv) | |
4978 { | |
4979 int silent = FALSE; | |
4980 int idx; | |
4981 | |
4982 /* Check for special OLE command line parameters */ | |
4983 if ((*argc == 2 || *argc == 3) && (argv[1][0] == '-' || argv[1][0] == '/')) | |
4984 { | |
4985 /* Check for a "-silent" argument first. */ | |
4986 if (*argc == 3 && STRICMP(argv[1] + 1, "silent") == 0 | |
4987 && (argv[2][0] == '-' || argv[2][0] == '/')) | |
4988 { | |
4989 silent = TRUE; | |
4990 idx = 2; | |
4991 } | |
4992 else | |
4993 idx = 1; | |
4994 | |
4995 /* Register Vim as an OLE Automation server */ | |
4996 if (STRICMP(argv[idx] + 1, "register") == 0) | |
4997 { | |
4998 #ifdef FEAT_OLE | |
4999 RegisterMe(silent); | |
5000 mch_exit(0); | |
5001 #else | |
5002 if (!silent) | |
5003 ole_error("register"); | |
5004 mch_exit(2); | |
5005 #endif | |
5006 } | |
5007 | |
5008 /* Unregister Vim as an OLE Automation server */ | |
5009 if (STRICMP(argv[idx] + 1, "unregister") == 0) | |
5010 { | |
5011 #ifdef FEAT_OLE | |
5012 UnregisterMe(!silent); | |
5013 mch_exit(0); | |
5014 #else | |
5015 if (!silent) | |
5016 ole_error("unregister"); | |
5017 mch_exit(2); | |
5018 #endif | |
5019 } | |
5020 | |
5021 /* Ignore an -embedding argument. It is only relevant if the | |
5022 * application wants to treat the case when it is started manually | |
5023 * differently from the case where it is started via automation (and | |
5024 * we don't). | |
5025 */ | |
5026 if (STRICMP(argv[idx] + 1, "embedding") == 0) | |
5027 { | |
5028 #ifdef FEAT_OLE | |
5029 *argc = 1; | |
5030 #else | |
5031 ole_error("embedding"); | |
5032 mch_exit(2); | |
5033 #endif | |
5034 } | |
5035 } | |
5036 | |
5037 #ifdef FEAT_OLE | |
5038 { | |
5039 int bDoRestart = FALSE; | |
5040 | |
5041 InitOLE(&bDoRestart); | |
5042 /* automatically exit after registering */ | |
5043 if (bDoRestart) | |
5044 mch_exit(0); | |
5045 } | |
5046 #endif | |
5047 | |
5048 #ifdef FEAT_NETBEANS_INTG | |
5049 { | |
4352 | 5050 /* stolen from gui_x11.c */ |
7 | 5051 int arg; |
5052 | |
5053 for (arg = 1; arg < *argc; arg++) | |
5054 if (strncmp("-nb", argv[arg], 3) == 0) | |
5055 { | |
5056 netbeansArg = argv[arg]; | |
5057 mch_memmove(&argv[arg], &argv[arg + 1], | |
5058 (--*argc - arg) * sizeof(char *)); | |
5059 argv[*argc] = NULL; | |
5060 break; /* enough? */ | |
5061 } | |
5062 } | |
5063 #endif | |
5064 } | |
5065 | |
5066 /* | |
5067 * Initialise the GUI. Create all the windows, set up all the call-backs | |
5068 * etc. | |
5069 */ | |
5070 int | |
5071 gui_mch_init(void) | |
5072 { | |
5073 const WCHAR szVimWndClassW[] = VIM_CLASSW; | |
2078
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5074 const WCHAR szTextAreaClassW[] = L"VimTextArea"; |
7 | 5075 WNDCLASSW wndclassw; |
5076 #ifdef GLOBAL_IME | |
5077 ATOM atom; | |
5078 #endif | |
5079 | |
5080 /* Return here if the window was already opened (happens when | |
5081 * gui_mch_dialog() is called early). */ | |
5082 if (s_hwnd != NULL) | |
153 | 5083 goto theend; |
7 | 5084 |
5085 /* | |
5086 * Load the tearoff bitmap | |
5087 */ | |
5088 #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
|
5089 s_htearbitmap = LoadBitmap(g_hinst, "IDB_TEAROFF"); |
7 | 5090 #endif |
5091 | |
5092 gui.scrollbar_width = GetSystemMetrics(SM_CXVSCROLL); | |
5093 gui.scrollbar_height = GetSystemMetrics(SM_CYHSCROLL); | |
5094 #ifdef FEAT_MENU | |
5095 gui.menu_height = 0; /* Windows takes care of this */ | |
5096 #endif | |
5097 gui.border_width = 0; | |
5098 | |
5099 s_brush = CreateSolidBrush(GetSysColor(COLOR_BTNFACE)); | |
5100 | |
5101 /* First try using the wide version, so that we can use any title. | |
5102 * 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
|
5103 if (GetClassInfoW(g_hinst, szVimWndClassW, &wndclassw) == 0) |
7 | 5104 { |
819 | 5105 wndclassw.style = CS_DBLCLKS; |
7 | 5106 wndclassw.lpfnWndProc = _WndProc; |
5107 wndclassw.cbClsExtra = 0; | |
5108 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
|
5109 wndclassw.hInstance = g_hinst; |
7 | 5110 wndclassw.hIcon = LoadIcon(wndclassw.hInstance, "IDR_VIM"); |
5111 wndclassw.hCursor = LoadCursor(NULL, IDC_ARROW); | |
5112 wndclassw.hbrBackground = s_brush; | |
5113 wndclassw.lpszMenuName = NULL; | |
5114 wndclassw.lpszClassName = szVimWndClassW; | |
5115 | |
5116 if (( | |
5117 #ifdef GLOBAL_IME | |
5118 atom = | |
5119 #endif | |
5120 RegisterClassW(&wndclassw)) == 0) | |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
5121 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
|
5122 } |
7 | 5123 |
5124 if (vim_parent_hwnd != NULL) | |
5125 { | |
5126 #ifdef HAVE_TRY_EXCEPT | |
5127 __try | |
5128 { | |
5129 #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
|
5130 // 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
|
5131 // 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
|
5132 // structure. |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
5133 s_hwnd = CreateWindowExW( |
7 | 5134 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
|
5135 szVimWndClassW, L"Vim MSWindows GUI", |
3006 | 5136 WS_OVERLAPPEDWINDOW | WS_CHILD |
5137 | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | 0xC000, | |
7 | 5138 gui_win_x == -1 ? CW_USEDEFAULT : gui_win_x, |
5139 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
|
5140 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
|
5141 100, // Any value will do |
7 | 5142 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
|
5143 g_hinst, NULL); |
7 | 5144 #ifdef HAVE_TRY_EXCEPT |
5145 } | |
5146 __except(EXCEPTION_EXECUTE_HANDLER) | |
5147 { | |
5148 /* NOP */ | |
5149 } | |
5150 #endif | |
5151 if (s_hwnd == NULL) | |
5152 { | |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15288
diff
changeset
|
5153 emsg(_("E672: Unable to open window inside MDI application")); |
7 | 5154 mch_exit(2); |
5155 } | |
5156 } | |
5157 else | |
1376 | 5158 { |
5159 /* If the provided windowid is not valid reset it to zero, so that it | |
5160 * is ignored and we open our own window. */ | |
5161 if (IsWindow((HWND)win_socket_id) <= 0) | |
5162 win_socket_id = 0; | |
5163 | |
5164 /* Create a window. If win_socket_id is not zero without border and | |
5165 * 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
|
5166 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
|
5167 szVimWndClassW, L"Vim MSWindows GUI", |
3006 | 5168 (win_socket_id == 0 ? WS_OVERLAPPEDWINDOW : WS_POPUP) |
5169 | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, | |
1376 | 5170 gui_win_x == -1 ? CW_USEDEFAULT : gui_win_x, |
5171 gui_win_y == -1 ? CW_USEDEFAULT : gui_win_y, | |
5172 100, /* Any value will do */ | |
5173 100, /* Any value will do */ | |
5174 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
|
5175 g_hinst, NULL); |
1376 | 5176 if (s_hwnd != NULL && win_socket_id != 0) |
5177 { | |
5178 SetParent(s_hwnd, (HWND)win_socket_id); | |
5179 ShowWindow(s_hwnd, SW_SHOWMAXIMIZED); | |
5180 } | |
5181 } | |
7 | 5182 |
5183 if (s_hwnd == NULL) | |
5184 return FAIL; | |
5185 | |
5186 #ifdef GLOBAL_IME | |
5187 global_ime_init(atom, s_hwnd); | |
5188 #endif | |
5189 #if defined(FEAT_MBYTE_IME) && defined(DYNAMIC_IME) | |
5190 dyn_imm_load(); | |
5191 #endif | |
5192 | |
5193 /* 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
|
5194 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
|
5195 { |
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.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
|
5197 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
|
5198 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
|
5199 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
|
5200 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
|
5201 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
|
5202 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
|
5203 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
|
5204 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
|
5205 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
|
5206 |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
5207 if (RegisterClassW(&wndclassw) == 0) |
7 | 5208 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
|
5209 } |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
5210 |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
5211 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
|
5212 0, |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
5213 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
|
5214 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
|
5215 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
|
5216 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
|
5217 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
|
5218 g_hinst, NULL); |
7 | 5219 |
5220 if (s_textArea == NULL) | |
5221 return FAIL; | |
5222 | |
8100
ae50910ce279
commit https://github.com/vim/vim/commit/203219048fa007b5042d9b893fd647aef44722a0
Christian Brabandt <cb@256bit.org>
parents:
8090
diff
changeset
|
5223 #ifdef FEAT_LIBCALL |
6249 | 5224 /* Try loading an icon from $RUNTIMEPATH/bitmaps/vim.ico. */ |
5225 { | |
5226 HANDLE hIcon = NULL; | |
5227 | |
5228 if (mch_icon_load(&hIcon) == OK && hIcon != NULL) | |
6260 | 5229 SendMessage(s_hwnd, WM_SETICON, ICON_SMALL, (LPARAM)hIcon); |
6249 | 5230 } |
8100
ae50910ce279
commit https://github.com/vim/vim/commit/203219048fa007b5042d9b893fd647aef44722a0
Christian Brabandt <cb@256bit.org>
parents:
8090
diff
changeset
|
5231 #endif |
6249 | 5232 |
7 | 5233 #ifdef FEAT_MENU |
5234 s_menuBar = CreateMenu(); | |
5235 #endif | |
5236 s_hdc = GetDC(s_textArea); | |
5237 | |
5238 DragAcceptFiles(s_hwnd, TRUE); | |
5239 | |
5240 /* Do we need to bother with this? */ | |
5241 /* m_fMouseAvail = GetSystemMetrics(SM_MOUSEPRESENT); */ | |
5242 | |
5243 /* Get background/foreground colors from the system */ | |
5244 gui_mch_def_colors(); | |
5245 | |
5246 /* Get the colors from the "Normal" group (set in syntax.c or in a vimrc | |
5247 * file) */ | |
5248 set_normal_colors(); | |
5249 | |
5250 /* | |
5251 * Check that none of the colors are the same as the background color. | |
5252 * Then store the current values as the defaults. | |
5253 */ | |
5254 gui_check_colors(); | |
5255 gui.def_norm_pixel = gui.norm_pixel; | |
5256 gui.def_back_pixel = gui.back_pixel; | |
5257 | |
5258 /* Get the colors for the highlight groups (gui_check_colors() might have | |
5259 * changed them) */ | |
5260 highlight_gui_started(); | |
5261 | |
5262 /* | |
7243
861a44fc5183
commit https://github.com/vim/vim/commit/97b0b0ec764d3a247ef600d809b965d5ab37155d
Christian Brabandt <cb@256bit.org>
parents:
7060
diff
changeset
|
5263 * Start out by adding the configured border width into the border offset. |
7 | 5264 */ |
7243
861a44fc5183
commit https://github.com/vim/vim/commit/97b0b0ec764d3a247ef600d809b965d5ab37155d
Christian Brabandt <cb@256bit.org>
parents:
7060
diff
changeset
|
5265 gui.border_offset = gui.border_width; |
7 | 5266 |
5267 /* | |
5268 * Set up for Intellimouse processing | |
5269 */ | |
5270 init_mouse_wheel(); | |
5271 | |
5272 /* | |
5273 * compute a couple of metrics used for the dialogs | |
5274 */ | |
5275 get_dialog_font_metrics(); | |
5276 #ifdef FEAT_TOOLBAR | |
5277 /* | |
5278 * Create the toolbar | |
5279 */ | |
5280 initialise_toolbar(); | |
5281 #endif | |
810 | 5282 #ifdef FEAT_GUI_TABLINE |
5283 /* | |
5284 * Create the tabline | |
5285 */ | |
5286 initialise_tabline(); | |
5287 #endif | |
7 | 5288 #ifdef MSWIN_FIND_REPLACE |
5289 /* | |
5290 * Initialise the dialog box stuff | |
5291 */ | |
5292 s_findrep_msg = RegisterWindowMessage(FINDMSGSTRING); | |
5293 | |
5294 /* Initialise the struct */ | |
5295 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
|
5296 s_findrep_struct.lpstrFindWhat = ALLOC_MULT(WCHAR, MSWIN_FR_BUFSIZE); |
7 | 5297 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
|
5298 s_findrep_struct.lpstrReplaceWith = ALLOC_MULT(WCHAR, MSWIN_FR_BUFSIZE); |
7 | 5299 s_findrep_struct.lpstrReplaceWith[0] = NUL; |
5300 s_findrep_struct.wFindWhatLen = MSWIN_FR_BUFSIZE; | |
5301 s_findrep_struct.wReplaceWithLen = MSWIN_FR_BUFSIZE; | |
5302 #endif | |
5303 | |
2616 | 5304 #ifdef FEAT_EVAL |
7560
fb84355cd972
commit https://github.com/vim/vim/commit/f32c5cd6e0e6aa6d4aeacb6bf52e3d3ba21e5201
Christian Brabandt <cb@256bit.org>
parents:
7243
diff
changeset
|
5305 # if !defined(_MSC_VER) || (_MSC_VER < 1400) |
fb84355cd972
commit https://github.com/vim/vim/commit/f32c5cd6e0e6aa6d4aeacb6bf52e3d3ba21e5201
Christian Brabandt <cb@256bit.org>
parents:
7243
diff
changeset
|
5306 /* Define HandleToLong for old MS and non-MS compilers if not defined. */ |
fb84355cd972
commit https://github.com/vim/vim/commit/f32c5cd6e0e6aa6d4aeacb6bf52e3d3ba21e5201
Christian Brabandt <cb@256bit.org>
parents:
7243
diff
changeset
|
5307 # ifndef HandleToLong |
8102
441298d72f3c
commit https://github.com/vim/vim/commit/a87e2c277eabf0134925c340e9dc4fe9446f3636
Christian Brabandt <cb@256bit.org>
parents:
8100
diff
changeset
|
5308 # define HandleToLong(h) ((long)(intptr_t)(h)) |
7560
fb84355cd972
commit https://github.com/vim/vim/commit/f32c5cd6e0e6aa6d4aeacb6bf52e3d3ba21e5201
Christian Brabandt <cb@256bit.org>
parents:
7243
diff
changeset
|
5309 # endif |
2943 | 5310 # endif |
2616 | 5311 /* set the v:windowid variable */ |
2865 | 5312 set_vim_var_nr(VV_WINDOWID, HandleToLong(s_hwnd)); |
2616 | 5313 #endif |
5314 | |
6110 | 5315 #ifdef FEAT_RENDER_OPTIONS |
5316 if (p_rop) | |
5317 (void)gui_mch_set_rendering_options(p_rop); | |
5318 #endif | |
5319 | |
153 | 5320 theend: |
5321 /* Display any pending error messages */ | |
5322 display_errors(); | |
5323 | |
7 | 5324 return OK; |
5325 } | |
5326 | |
5327 /* | |
5328 * Get the size of the screen, taking position on multiple monitors into | |
5329 * account (if supported). | |
5330 */ | |
5331 static void | |
5332 get_work_area(RECT *spi_rect) | |
5333 { | |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
5334 HMONITOR mon; |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
5335 MONITORINFO moninfo; |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
5336 |
15034
6e4e0d43b20b
patch 8.1.0528: various typos in comments
Bram Moolenaar <Bram@vim.org>
parents:
14862
diff
changeset
|
5337 /* 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
|
5338 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
|
5339 if (mon != NULL) |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
5340 { |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
5341 moninfo.cbSize = sizeof(MONITORINFO); |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
5342 if (GetMonitorInfo(mon, &moninfo)) |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
5343 { |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
5344 *spi_rect = moninfo.rcWork; |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
5345 return; |
7 | 5346 } |
5347 } | |
5348 /* this is the old method... */ | |
5349 SystemParametersInfo(SPI_GETWORKAREA, 0, spi_rect, 0); | |
5350 } | |
5351 | |
5352 /* | |
5353 * Set the size of the window to the given width and height in pixels. | |
5354 */ | |
5355 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
|
5356 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
|
5357 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
|
5358 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
|
5359 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
|
5360 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
|
5361 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
|
5362 int base_height UNUSED, |
812 | 5363 int direction) |
7 | 5364 { |
5365 RECT workarea_rect; | |
5366 int win_width, win_height; | |
5367 WINDOWPLACEMENT wndpl; | |
5368 | |
819 | 5369 /* Try to keep window completely on screen. */ |
5370 /* Get position of the screen work area. This is the part that is not | |
5371 * used by the taskbar or appbars. */ | |
7 | 5372 get_work_area(&workarea_rect); |
5373 | |
4352 | 5374 /* Get current position of our window. Note that the .left and .top are |
819 | 5375 * relative to the work area. */ |
7 | 5376 wndpl.length = sizeof(WINDOWPLACEMENT); |
5377 GetWindowPlacement(s_hwnd, &wndpl); | |
5378 | |
5379 /* Resizing a maximized window looks very strange, unzoom it first. | |
5380 * But don't do it when still starting up, it may have been requested in | |
5381 * the shortcut. */ | |
5382 if (wndpl.showCmd == SW_SHOWMAXIMIZED && starting == 0) | |
5383 { | |
5384 ShowWindow(s_hwnd, SW_SHOWNORMAL); | |
5385 /* Need to get the settings of the normal window. */ | |
5386 GetWindowPlacement(s_hwnd, &wndpl); | |
5387 } | |
5388 | |
5389 /* compute the size of the outside of the window */ | |
5225
8f983df0299f
updated for version 7.4a.038
Bram Moolenaar <bram@vim.org>
parents:
5223
diff
changeset
|
5390 win_width = width + (GetSystemMetrics(SM_CXFRAME) + |
6110 | 5391 GetSystemMetrics(SM_CXPADDEDBORDER)) * 2; |
5225
8f983df0299f
updated for version 7.4a.038
Bram Moolenaar <bram@vim.org>
parents:
5223
diff
changeset
|
5392 win_height = height + (GetSystemMetrics(SM_CYFRAME) + |
6110 | 5393 GetSystemMetrics(SM_CXPADDEDBORDER)) * 2 |
7 | 5394 + GetSystemMetrics(SM_CYCAPTION) |
5395 #ifdef FEAT_MENU | |
5396 + gui_mswin_get_menu_height(FALSE) | |
5397 #endif | |
5398 ; | |
5399 | |
3248 | 5400 /* The following should take care of keeping Vim on the same monitor, no |
5401 * matter if the secondary monitor is left or right of the primary | |
5402 * monitor. */ | |
5403 wndpl.rcNormalPosition.right = wndpl.rcNormalPosition.left + win_width; | |
5404 wndpl.rcNormalPosition.bottom = wndpl.rcNormalPosition.top + win_height; | |
5405 | |
5406 /* If the window is going off the screen, move it on to the screen. */ | |
819 | 5407 if ((direction & RESIZE_HOR) |
3248 | 5408 && wndpl.rcNormalPosition.right > workarea_rect.right) |
5409 OffsetRect(&wndpl.rcNormalPosition, | |
5410 workarea_rect.right - wndpl.rcNormalPosition.right, 0); | |
5411 | |
5412 if ((direction & RESIZE_HOR) | |
5413 && wndpl.rcNormalPosition.left < workarea_rect.left) | |
5414 OffsetRect(&wndpl.rcNormalPosition, | |
5415 workarea_rect.left - wndpl.rcNormalPosition.left, 0); | |
7 | 5416 |
812 | 5417 if ((direction & RESIZE_VERT) |
3248 | 5418 && wndpl.rcNormalPosition.bottom > workarea_rect.bottom) |
5419 OffsetRect(&wndpl.rcNormalPosition, | |
5420 0, workarea_rect.bottom - wndpl.rcNormalPosition.bottom); | |
5421 | |
5422 if ((direction & RESIZE_VERT) | |
5423 && wndpl.rcNormalPosition.top < workarea_rect.top) | |
5424 OffsetRect(&wndpl.rcNormalPosition, | |
5425 0, workarea_rect.top - wndpl.rcNormalPosition.top); | |
7 | 5426 |
5427 /* set window position - we should use SetWindowPlacement rather than | |
5428 * SetWindowPos as the MSDN docs say the coord systems returned by | |
5429 * these two are not compatible. */ | |
5430 SetWindowPlacement(s_hwnd, &wndpl); | |
5431 | |
5432 SetActiveWindow(s_hwnd); | |
5433 SetFocus(s_hwnd); | |
5434 | |
5435 #ifdef FEAT_MENU | |
5436 /* Menu may wrap differently now */ | |
5437 gui_mswin_get_menu_height(!gui.starting); | |
5438 #endif | |
5439 } | |
5440 | |
5441 | |
5442 void | |
5443 gui_mch_set_scrollbar_thumb( | |
5444 scrollbar_T *sb, | |
5445 long val, | |
5446 long size, | |
5447 long max) | |
5448 { | |
5449 SCROLLINFO info; | |
5450 | |
5451 sb->scroll_shift = 0; | |
5452 while (max > 32767) | |
5453 { | |
5454 max = (max + 1) >> 1; | |
5455 val >>= 1; | |
5456 size >>= 1; | |
5457 ++sb->scroll_shift; | |
5458 } | |
5459 | |
5460 if (sb->scroll_shift > 0) | |
5461 ++size; | |
5462 | |
5463 info.cbSize = sizeof(info); | |
5464 info.fMask = SIF_POS | SIF_RANGE | SIF_PAGE; | |
5465 info.nPos = val; | |
5466 info.nMin = 0; | |
5467 info.nMax = max; | |
5468 info.nPage = size; | |
5469 SetScrollInfo(sb->id, SB_CTL, &info, TRUE); | |
5470 } | |
5471 | |
5472 | |
5473 /* | |
5474 * Set the current text font. | |
5475 */ | |
5476 void | |
5477 gui_mch_set_font(GuiFont font) | |
5478 { | |
5479 gui.currFont = font; | |
5480 } | |
5481 | |
5482 | |
5483 /* | |
5484 * Set the current text foreground color. | |
5485 */ | |
5486 void | |
5487 gui_mch_set_fg_color(guicolor_T color) | |
5488 { | |
5489 gui.currFgColor = color; | |
5490 } | |
5491 | |
5492 /* | |
5493 * Set the current text background color. | |
5494 */ | |
5495 void | |
5496 gui_mch_set_bg_color(guicolor_T color) | |
5497 { | |
5498 gui.currBgColor = color; | |
5499 } | |
5500 | |
205 | 5501 /* |
5502 * Set the current text special color. | |
5503 */ | |
5504 void | |
5505 gui_mch_set_sp_color(guicolor_T color) | |
5506 { | |
5507 gui.currSpColor = color; | |
5508 } | |
5509 | |
12950
e60b2aa04903
patch 8.0.1351: warning for unused variables building with MinGW
Christian Brabandt <cb@256bit.org>
parents:
12934
diff
changeset
|
5510 #ifdef FEAT_MBYTE_IME |
7 | 5511 /* |
5512 * Multi-byte handling, originally by Sung-Hoon Baek. | |
5513 * First static functions (no prototypes generated). | |
5514 */ | |
12950
e60b2aa04903
patch 8.0.1351: warning for unused variables building with MinGW
Christian Brabandt <cb@256bit.org>
parents:
12934
diff
changeset
|
5515 # ifdef _MSC_VER |
16606
7e733046db1d
patch 8.1.1306: Borland support is outdated and doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
5516 # 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
|
5517 # endif |
e60b2aa04903
patch 8.0.1351: warning for unused variables building with MinGW
Christian Brabandt <cb@256bit.org>
parents:
12934
diff
changeset
|
5518 # include <imm.h> |
7 | 5519 |
5520 /* | |
5521 * handle WM_IME_NOTIFY message | |
5522 */ | |
5523 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
|
5524 _OnImeNotify(HWND hWnd, DWORD dwCommand, DWORD dwData UNUSED) |
7 | 5525 { |
5526 LRESULT lResult = 0; | |
5527 HIMC hImc; | |
5528 | |
5529 if (!pImmGetContext || (hImc = pImmGetContext(hWnd)) == (HIMC)0) | |
5530 return lResult; | |
5531 switch (dwCommand) | |
5532 { | |
5533 case IMN_SETOPENSTATUS: | |
5534 if (pImmGetOpenStatus(hImc)) | |
5535 { | |
16152
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
5536 pImmSetCompositionFontW(hImc, &norm_logfont); |
7 | 5537 im_set_position(gui.row, gui.col); |
5538 | |
5539 /* Disable langmap */ | |
5540 State &= ~LANGMAP; | |
5541 if (State & INSERT) | |
5542 { | |
12477
68d7bc045dbe
patch 8.0.1118: FEAT_WINDOWS adds a lot of #ifdefs
Christian Brabandt <cb@256bit.org>
parents:
12317
diff
changeset
|
5543 #if defined(FEAT_KEYMAP) |
7 | 5544 /* Unshown 'keymap' in status lines */ |
5545 if (curbuf->b_p_iminsert == B_IMODE_LMAP) | |
5546 { | |
5547 /* Save cursor position */ | |
5548 int old_row = gui.row; | |
5549 int old_col = gui.col; | |
5550 | |
5551 // This must be called here before | |
5552 // status_redraw_curbuf(), otherwise the mode | |
5553 // message may appear in the wrong position. | |
5554 showmode(); | |
5555 status_redraw_curbuf(); | |
5556 update_screen(0); | |
5557 /* Restore cursor position */ | |
5558 gui.row = old_row; | |
5559 gui.col = old_col; | |
5560 } | |
5561 #endif | |
5562 } | |
5563 } | |
5564 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
|
5565 gui_mch_flush(); |
7 | 5566 lResult = 0; |
5567 break; | |
5568 } | |
5569 pImmReleaseContext(hWnd, hImc); | |
5570 return lResult; | |
5571 } | |
5572 | |
5573 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
|
5574 _OnImeComposition(HWND hwnd, WPARAM dbcs UNUSED, LPARAM param) |
7 | 5575 { |
5576 char_u *ret; | |
5577 int len; | |
5578 | |
5579 if ((param & GCS_RESULTSTR) == 0) /* Composition unfinished. */ | |
5580 return 0; | |
5581 | |
5582 ret = GetResultStr(hwnd, GCS_RESULTSTR, &len); | |
5583 if (ret != NULL) | |
5584 { | |
5585 add_to_input_buf_csi(ret, len); | |
5586 vim_free(ret); | |
5587 return 1; | |
5588 } | |
5589 return 0; | |
5590 } | |
5591 | |
5592 /* | |
5593 * get the current composition string, in UCS-2; *lenp is the number of | |
5594 * *lenp is the number of Unicode characters. | |
5595 */ | |
5596 static short_u * | |
5597 GetCompositionString_inUCS2(HIMC hIMC, DWORD GCS, int *lenp) | |
5598 { | |
5599 LONG ret; | |
5600 LPWSTR wbuf = NULL; | |
5601 char_u *buf; | |
5602 | |
5603 if (!pImmGetContext) | |
5604 return NULL; /* no imm32.dll */ | |
5605 | |
5606 /* Try Unicode; this'll always work on NT regardless of codepage. */ | |
5607 ret = pImmGetCompositionStringW(hIMC, GCS, NULL, 0); | |
5608 if (ret == 0) | |
5609 return NULL; /* empty */ | |
5610 | |
5611 if (ret > 0) | |
5612 { | |
5613 /* Allocate the requested buffer plus space for the NUL character. */ | |
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
|
5614 wbuf = alloc(ret + sizeof(WCHAR)); |
7 | 5615 if (wbuf != NULL) |
5616 { | |
5617 pImmGetCompositionStringW(hIMC, GCS, wbuf, ret); | |
5618 *lenp = ret / sizeof(WCHAR); | |
5619 } | |
5620 return (short_u *)wbuf; | |
5621 } | |
5622 | |
5623 /* ret < 0; we got an error, so try the ANSI version. This'll work | |
5624 * on 9x/ME, but only if the codepage happens to be set to whatever | |
5625 * we're inputting. */ | |
5626 ret = pImmGetCompositionStringA(hIMC, GCS, NULL, 0); | |
5627 if (ret <= 0) | |
5628 return NULL; /* empty or error */ | |
5629 | |
5630 buf = alloc(ret); | |
5631 if (buf == NULL) | |
5632 return NULL; | |
5633 pImmGetCompositionStringA(hIMC, GCS, buf, ret); | |
5634 | |
5635 /* convert from codepage to UCS-2 */ | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
5636 MultiByteToWideChar_alloc(GetACP(), 0, (LPCSTR)buf, ret, &wbuf, lenp); |
7 | 5637 vim_free(buf); |
5638 | |
5639 return (short_u *)wbuf; | |
5640 } | |
5641 | |
5642 /* | |
5643 * void GetResultStr() | |
5644 * | |
5645 * This handles WM_IME_COMPOSITION with GCS_RESULTSTR flag on. | |
5646 * get complete composition string | |
5647 */ | |
5648 static char_u * | |
5649 GetResultStr(HWND hwnd, int GCS, int *lenp) | |
5650 { | |
5651 HIMC hIMC; /* Input context handle. */ | |
5652 short_u *buf = NULL; | |
5653 char_u *convbuf = NULL; | |
5654 | |
5655 if (!pImmGetContext || (hIMC = pImmGetContext(hwnd)) == (HIMC)0) | |
5656 return NULL; | |
5657 | |
5658 /* Reads in the composition string. */ | |
5659 buf = GetCompositionString_inUCS2(hIMC, GCS, lenp); | |
5660 if (buf == NULL) | |
5661 return NULL; | |
5662 | |
1752 | 5663 convbuf = utf16_to_enc(buf, lenp); |
7 | 5664 pImmReleaseContext(hwnd, hIMC); |
5665 vim_free(buf); | |
5666 return convbuf; | |
5667 } | |
5668 #endif | |
5669 | |
5670 /* 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
|
5671 #if defined(FEAT_MBYTE_IME) || defined(PROTO) |
7 | 5672 |
5673 /* | |
5674 * set font to IM. | |
5675 */ | |
5676 void | |
16152
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
5677 im_set_font(LOGFONTW *lf) |
7 | 5678 { |
5679 HIMC hImc; | |
5680 | |
5681 if (pImmGetContext && (hImc = pImmGetContext(s_hwnd)) != (HIMC)0) | |
5682 { | |
16152
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
5683 pImmSetCompositionFontW(hImc, lf); |
7 | 5684 pImmReleaseContext(s_hwnd, hImc); |
5685 } | |
5686 } | |
5687 | |
5688 /* | |
5689 * Notify cursor position to IM. | |
5690 */ | |
5691 void | |
5692 im_set_position(int row, int col) | |
5693 { | |
5694 HIMC hImc; | |
5695 | |
5696 if (pImmGetContext && (hImc = pImmGetContext(s_hwnd)) != (HIMC)0) | |
5697 { | |
5698 COMPOSITIONFORM cfs; | |
5699 | |
5700 cfs.dwStyle = CFS_POINT; | |
5701 cfs.ptCurrentPos.x = FILL_X(col); | |
5702 cfs.ptCurrentPos.y = FILL_Y(row); | |
5703 MapWindowPoints(s_textArea, s_hwnd, &cfs.ptCurrentPos, 1); | |
5704 pImmSetCompositionWindow(hImc, &cfs); | |
5705 | |
5706 pImmReleaseContext(s_hwnd, hImc); | |
5707 } | |
5708 } | |
5709 | |
5710 /* | |
5711 * Set IM status on ("active" is TRUE) or off ("active" is FALSE). | |
5712 */ | |
5713 void | |
5714 im_set_active(int active) | |
5715 { | |
5716 HIMC hImc; | |
5717 static HIMC hImcOld = (HIMC)0; | |
5718 | |
5719 if (pImmGetContext) /* if NULL imm32.dll wasn't loaded (yet) */ | |
5720 { | |
5721 if (p_imdisable) | |
5722 { | |
5723 if (hImcOld == (HIMC)0) | |
5724 { | |
5725 hImcOld = pImmGetContext(s_hwnd); | |
5726 if (hImcOld) | |
5727 pImmAssociateContext(s_hwnd, (HIMC)0); | |
5728 } | |
5729 active = FALSE; | |
5730 } | |
5731 else if (hImcOld != (HIMC)0) | |
5732 { | |
5733 pImmAssociateContext(s_hwnd, hImcOld); | |
5734 hImcOld = (HIMC)0; | |
5735 } | |
5736 | |
5737 hImc = pImmGetContext(s_hwnd); | |
5738 if (hImc) | |
5739 { | |
777 | 5740 /* |
5741 * for Korean ime | |
5742 */ | |
5743 HKL hKL = GetKeyboardLayout(0); | |
5744 | |
5745 if (LOWORD(hKL) == MAKELANGID(LANG_KOREAN, SUBLANG_KOREAN)) | |
5746 { | |
5747 static DWORD dwConversionSaved = 0, dwSentenceSaved = 0; | |
5748 static BOOL bSaved = FALSE; | |
5749 | |
5750 if (active) | |
5751 { | |
5752 /* if we have a saved conversion status, restore it */ | |
5753 if (bSaved) | |
5754 pImmSetConversionStatus(hImc, dwConversionSaved, | |
5755 dwSentenceSaved); | |
5756 bSaved = FALSE; | |
5757 } | |
5758 else | |
5759 { | |
5760 /* save conversion status and disable korean */ | |
5761 if (pImmGetConversionStatus(hImc, &dwConversionSaved, | |
5762 &dwSentenceSaved)) | |
5763 { | |
5764 bSaved = TRUE; | |
5765 pImmSetConversionStatus(hImc, | |
5766 dwConversionSaved & ~(IME_CMODE_NATIVE | |
5767 | IME_CMODE_FULLSHAPE), | |
5768 dwSentenceSaved); | |
5769 } | |
5770 } | |
5771 } | |
5772 | |
7 | 5773 pImmSetOpenStatus(hImc, active); |
5774 pImmReleaseContext(s_hwnd, hImc); | |
5775 } | |
5776 } | |
5777 } | |
5778 | |
5779 /* | |
5780 * Get IM status. When IM is on, return not 0. Else return 0. | |
5781 */ | |
5782 int | |
7823
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
5783 im_get_status(void) |
7 | 5784 { |
5785 int status = 0; | |
5786 HIMC hImc; | |
5787 | |
5788 if (pImmGetContext && (hImc = pImmGetContext(s_hwnd)) != (HIMC)0) | |
5789 { | |
5790 status = pImmGetOpenStatus(hImc) ? 1 : 0; | |
5791 pImmReleaseContext(s_hwnd, hImc); | |
5792 } | |
5793 return status; | |
5794 } | |
5795 | |
12950
e60b2aa04903
patch 8.0.1351: warning for unused variables building with MinGW
Christian Brabandt <cb@256bit.org>
parents:
12934
diff
changeset
|
5796 #endif /* FEAT_MBYTE_IME */ |
7 | 5797 |
15597
536dd2bc5ac9
patch 8.1.0806: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15549
diff
changeset
|
5798 #if !defined(FEAT_MBYTE_IME) && defined(GLOBAL_IME) |
7 | 5799 /* Win32 with GLOBAL IME */ |
5800 | |
5801 /* | |
5802 * Notify cursor position to IM. | |
5803 */ | |
5804 void | |
5805 im_set_position(int row, int col) | |
5806 { | |
5807 /* Win32 with GLOBAL IME */ | |
5808 POINT p; | |
5809 | |
5810 p.x = FILL_X(col); | |
5811 p.y = FILL_Y(row); | |
5812 MapWindowPoints(s_textArea, s_hwnd, &p, 1); | |
5813 global_ime_set_position(&p); | |
5814 } | |
5815 | |
5816 /* | |
5817 * Set IM status on ("active" is TRUE) or off ("active" is FALSE). | |
5818 */ | |
5819 void | |
5820 im_set_active(int active) | |
5821 { | |
5822 global_ime_set_status(active); | |
5823 } | |
5824 | |
5825 /* | |
5826 * Get IM status. When IM is on, return not 0. Else return 0. | |
5827 */ | |
5828 int | |
7856
226ed297307f
commit https://github.com/vim/vim/commit/d14e00ea67afbaa8cb4a7e6b1eb306da6a2d5adb
Christian Brabandt <cb@256bit.org>
parents:
7823
diff
changeset
|
5829 im_get_status(void) |
7 | 5830 { |
5831 return global_ime_get_status(); | |
5832 } | |
5833 #endif | |
5834 | |
26 | 5835 /* |
786 | 5836 * Convert latin9 text "text[len]" to ucs-2 in "unicodebuf". |
26 | 5837 */ |
5838 static void | |
5839 latin9_to_ucs(char_u *text, int len, WCHAR *unicodebuf) | |
5840 { | |
5841 int c; | |
5842 | |
777 | 5843 while (--len >= 0) |
26 | 5844 { |
5845 c = *text++; | |
5846 switch (c) | |
5847 { | |
5848 case 0xa4: c = 0x20ac; break; /* euro */ | |
5849 case 0xa6: c = 0x0160; break; /* S hat */ | |
5850 case 0xa8: c = 0x0161; break; /* S -hat */ | |
5851 case 0xb4: c = 0x017d; break; /* Z hat */ | |
5852 case 0xb8: c = 0x017e; break; /* Z -hat */ | |
5853 case 0xbc: c = 0x0152; break; /* OE */ | |
5854 case 0xbd: c = 0x0153; break; /* oe */ | |
5855 case 0xbe: c = 0x0178; break; /* Y */ | |
5856 } | |
5857 *unicodebuf++ = c; | |
5858 } | |
5859 } | |
7 | 5860 |
5861 #ifdef FEAT_RIGHTLEFT | |
5862 /* | |
5863 * What is this for? In the case where you are using Win98 or Win2K or later, | |
5864 * and you are using a Hebrew font (or Arabic!), Windows does you a favor and | |
5865 * reverses the string sent to the TextOut... family. This sucks, because we | |
5866 * go to a lot of effort to do the right thing, and there doesn't seem to be a | |
5867 * way to tell Windblows not to do this! | |
5868 * | |
5869 * The short of it is that this 'RevOut' only gets called if you are running | |
5870 * one of the new, "improved" MS OSes, and only if you are running in | |
5871 * 'rightleft' mode. It makes display take *slightly* longer, but not | |
5872 * noticeably so. | |
5873 */ | |
5874 static void | |
5875 RevOut( HDC s_hdc, | |
5876 int col, | |
5877 int row, | |
5878 UINT foptions, | |
5879 CONST RECT *pcliprect, | |
5880 LPCTSTR text, | |
5881 UINT len, | |
5882 CONST INT *padding) | |
5883 { | |
5884 int ix; | |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
5885 |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
5886 for (ix = 0; ix < (int)len; ++ix) |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
5887 ExtTextOut(s_hdc, col + TEXT_X(ix), row, foptions, |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
5888 pcliprect, text + ix, 1, padding); |
7 | 5889 } |
5890 #endif | |
5891 | |
12986
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5892 static void |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5893 draw_line( |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5894 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
|
5895 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
|
5896 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
|
5897 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
|
5898 COLORREF color) |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5899 { |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5900 #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
|
5901 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
|
5902 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
|
5903 else |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5904 #endif |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5905 { |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5906 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
|
5907 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
|
5908 MoveToEx(s_hdc, x1, y1, NULL); |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5909 /* Note: LineTo() excludes the last pixel in the line. */ |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5910 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
|
5911 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
|
5912 } |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5913 } |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5914 |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5915 static void |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5916 set_pixel( |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5917 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
|
5918 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
|
5919 COLORREF color) |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5920 { |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5921 #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
|
5922 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
|
5923 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
|
5924 else |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5925 #endif |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5926 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
|
5927 } |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5928 |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5929 static void |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5930 fill_rect( |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5931 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
|
5932 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
|
5933 COLORREF color) |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5934 { |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5935 #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
|
5936 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
|
5937 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
|
5938 else |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5939 #endif |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5940 { |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5941 HBRUSH hbr2; |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5942 |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5943 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
|
5944 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
|
5945 else |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5946 hbr2 = hbr; |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5947 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
|
5948 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
|
5949 DeleteBrush(hbr2); |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5950 } |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5951 } |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
5952 |
7 | 5953 void |
5954 gui_mch_draw_string( | |
5955 int row, | |
5956 int col, | |
5957 char_u *text, | |
5958 int len, | |
5959 int flags) | |
5960 { | |
5961 static int *padding = NULL; | |
5962 static int pad_size = 0; | |
5963 int i; | |
5964 const RECT *pcliprect = NULL; | |
5965 UINT foptions = 0; | |
5966 static WCHAR *unicodebuf = NULL; | |
5967 static int *unicodepdy = NULL; | |
236 | 5968 static int unibuflen = 0; |
7 | 5969 int n = 0; |
5970 int y; | |
5971 | |
5972 /* | |
5973 * Italic and bold text seems to have an extra row of pixels at the bottom | |
5974 * (below where the bottom of the character should be). If we draw the | |
5975 * characters with a solid background, the top row of pixels in the | |
5976 * character below will be overwritten. We can fix this by filling in the | |
5977 * background ourselves, to the correct character proportions, and then | |
5978 * writing the character in transparent mode. Still have a problem when | |
5979 * the character is "_", which gets written on to the character below. | |
5980 * New fix: set gui.char_ascent to -1. This shifts all characters up one | |
5981 * pixel in their slots, which fixes the problem with the bottom row of | |
5982 * pixels. We still need this code because otherwise the top row of pixels | |
5983 * becomes a problem. - webb. | |
5984 */ | |
5985 static HBRUSH hbr_cache[2] = {NULL, NULL}; | |
5986 static guicolor_T brush_color[2] = {INVALCOLOR, INVALCOLOR}; | |
5987 static int brush_lru = 0; | |
5988 HBRUSH hbr; | |
5989 RECT rc; | |
5990 | |
5991 if (!(flags & DRAW_TRANSP)) | |
5992 { | |
5993 /* | |
5994 * Clear background first. | |
5995 * Note: FillRect() excludes right and bottom of rectangle. | |
5996 */ | |
5997 rc.left = FILL_X(col); | |
5998 rc.top = FILL_Y(row); | |
5999 if (has_mbyte) | |
6000 { | |
6001 /* Compute the length in display cells. */ | |
2338
da6ec32d8d8f
Added strwidth() and strchars() functions.
Bram Moolenaar <bram@vim.org>
parents:
2311
diff
changeset
|
6002 rc.right = FILL_X(col + mb_string2cells(text, len)); |
7 | 6003 } |
6004 else | |
6005 rc.right = FILL_X(col + len); | |
6006 rc.bottom = FILL_Y(row + 1); | |
6007 | |
6008 /* Cache the created brush, that saves a lot of time. We need two: | |
6009 * one for cursor background and one for the normal background. */ | |
6010 if (gui.currBgColor == brush_color[0]) | |
6011 { | |
6012 hbr = hbr_cache[0]; | |
6013 brush_lru = 1; | |
6014 } | |
6015 else if (gui.currBgColor == brush_color[1]) | |
6016 { | |
6017 hbr = hbr_cache[1]; | |
6018 brush_lru = 0; | |
6019 } | |
6020 else | |
6021 { | |
6022 if (hbr_cache[brush_lru] != NULL) | |
6023 DeleteBrush(hbr_cache[brush_lru]); | |
6024 hbr_cache[brush_lru] = CreateSolidBrush(gui.currBgColor); | |
6025 brush_color[brush_lru] = gui.currBgColor; | |
6026 hbr = hbr_cache[brush_lru]; | |
6027 brush_lru = !brush_lru; | |
6028 } | |
12934
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
6029 |
12986
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
6030 fill_rect(&rc, hbr, gui.currBgColor); |
7 | 6031 |
6032 SetBkMode(s_hdc, TRANSPARENT); | |
6033 | |
6034 /* | |
6035 * When drawing block cursor, prevent inverted character spilling | |
6036 * over character cell (can happen with bold/italic) | |
6037 */ | |
6038 if (flags & DRAW_CURSOR) | |
6039 { | |
6040 pcliprect = &rc; | |
6041 foptions = ETO_CLIPPED; | |
6042 } | |
6043 } | |
6044 SetTextColor(s_hdc, gui.currFgColor); | |
6045 SelectFont(s_hdc, gui.currFont); | |
6046 | |
6110 | 6047 #ifdef FEAT_DIRECTX |
6048 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
|
6049 DWriteContext_SetFont(s_dwc, (HFONT)gui.currFont); |
6110 | 6050 #endif |
6051 | |
7 | 6052 if (pad_size != Columns || padding == NULL || padding[0] != gui.char_width) |
6053 { | |
6054 vim_free(padding); | |
6055 pad_size = Columns; | |
6056 | |
537 | 6057 /* Don't give an out-of-memory message here, it would call us |
6058 * recursively. */ | |
16827
ce562b9f702e
patch 8.1.1415: build error in MS-Windows GUI
Bram Moolenaar <Bram@vim.org>
parents:
16825
diff
changeset
|
6059 padding = LALLOC_MULT(int, pad_size); |
7 | 6060 if (padding != NULL) |
6061 for (i = 0; i < pad_size; i++) | |
6062 padding[i] = gui.char_width; | |
6063 } | |
6064 | |
6065 /* | |
6066 * We have to provide the padding argument because italic and bold versions | |
6067 * of fixed-width fonts are often one pixel or so wider than their normal | |
6068 * versions. | |
6069 * No check for DRAW_BOLD, Windows will have done it already. | |
6070 */ | |
6071 | |
6072 /* Check if there are any UTF-8 characters. If not, use normal text | |
6073 * output to speed up output. */ | |
6074 if (enc_utf8) | |
6075 for (n = 0; n < len; ++n) | |
6076 if (text[n] >= 0x80) | |
6077 break; | |
6078 | |
15597
536dd2bc5ac9
patch 8.1.0806: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15549
diff
changeset
|
6079 #if defined(FEAT_DIRECTX) |
6110 | 6080 /* Quick hack to enable DirectWrite. To use DirectWrite (antialias), it is |
6081 * required that unicode drawing routine, currently. So this forces it | |
6082 * 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
|
6083 if (IS_ENABLE_DIRECTX()) |
6110 | 6084 n = 0; /* Keep n < len, to enter block for unicode. */ |
15597
536dd2bc5ac9
patch 8.1.0806: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15549
diff
changeset
|
6085 #endif |
6110 | 6086 |
7 | 6087 /* Check if the Unicode buffer exists and is big enough. Create it |
236 | 6088 * with the same length as the multi-byte string, the number of wide |
7 | 6089 * characters is always equal or smaller. */ |
26 | 6090 if ((enc_utf8 |
6091 || (enc_codepage > 0 && (int)GetACP() != enc_codepage) | |
6092 || enc_latin9) | |
7 | 6093 && (unicodebuf == NULL || len > unibuflen)) |
6094 { | |
6095 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
|
6096 unicodebuf = LALLOC_MULT(WCHAR, len); |
7 | 6097 |
6098 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
|
6099 unicodepdy = LALLOC_MULT(int, len); |
7 | 6100 |
6101 unibuflen = len; | |
6102 } | |
6103 | |
6104 if (enc_utf8 && n < len && unicodebuf != NULL) | |
6105 { | |
12712
25f7d8ee04c7
patch 8.0.1234: MS-Windows: composing chars are not shown properly
Christian Brabandt <cb@256bit.org>
parents:
12668
diff
changeset
|
6106 /* Output UTF-8 characters. Composing characters should be |
25f7d8ee04c7
patch 8.0.1234: MS-Windows: composing chars are not shown properly
Christian Brabandt <cb@256bit.org>
parents:
12668
diff
changeset
|
6107 * handled here. */ |
777 | 6108 int i; |
6109 int wlen; /* string length in words */ | |
6110 int clen; /* string length in characters */ | |
7 | 6111 int cells; /* cell width of string up to composing char */ |
6112 int cw; /* width of current cell */ | |
714 | 6113 int c; |
777 | 6114 |
782 | 6115 wlen = 0; |
777 | 6116 clen = 0; |
7 | 6117 cells = 0; |
777 | 6118 for (i = 0; i < len; ) |
7 | 6119 { |
714 | 6120 c = utf_ptr2char(text + i); |
6121 if (c >= 0x10000) | |
6122 { | |
6123 /* Turn into UTF-16 encoding. */ | |
777 | 6124 unicodebuf[wlen++] = ((c - 0x10000) >> 10) + 0xD800; |
6125 unicodebuf[wlen++] = ((c - 0x10000) & 0x3ff) + 0xDC00; | |
714 | 6126 } |
6127 else | |
6128 { | |
777 | 6129 unicodebuf[wlen++] = c; |
714 | 6130 } |
12712
25f7d8ee04c7
patch 8.0.1234: MS-Windows: composing chars are not shown properly
Christian Brabandt <cb@256bit.org>
parents:
12668
diff
changeset
|
6131 |
25f7d8ee04c7
patch 8.0.1234: MS-Windows: composing chars are not shown properly
Christian Brabandt <cb@256bit.org>
parents:
12668
diff
changeset
|
6132 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
|
6133 cw = 0; |
25f7d8ee04c7
patch 8.0.1234: MS-Windows: composing chars are not shown properly
Christian Brabandt <cb@256bit.org>
parents:
12668
diff
changeset
|
6134 else |
25f7d8ee04c7
patch 8.0.1234: MS-Windows: composing chars are not shown properly
Christian Brabandt <cb@256bit.org>
parents:
12668
diff
changeset
|
6135 { |
25f7d8ee04c7
patch 8.0.1234: MS-Windows: composing chars are not shown properly
Christian Brabandt <cb@256bit.org>
parents:
12668
diff
changeset
|
6136 cw = utf_char2cells(c); |
25f7d8ee04c7
patch 8.0.1234: MS-Windows: composing chars are not shown properly
Christian Brabandt <cb@256bit.org>
parents:
12668
diff
changeset
|
6137 if (cw > 2) /* don't use 4 for unprintable char */ |
25f7d8ee04c7
patch 8.0.1234: MS-Windows: composing chars are not shown properly
Christian Brabandt <cb@256bit.org>
parents:
12668
diff
changeset
|
6138 cw = 1; |
25f7d8ee04c7
patch 8.0.1234: MS-Windows: composing chars are not shown properly
Christian Brabandt <cb@256bit.org>
parents:
12668
diff
changeset
|
6139 } |
25f7d8ee04c7
patch 8.0.1234: MS-Windows: composing chars are not shown properly
Christian Brabandt <cb@256bit.org>
parents:
12668
diff
changeset
|
6140 |
7 | 6141 if (unicodepdy != NULL) |
6142 { | |
6143 /* Use unicodepdy to make characters fit as we expect, even | |
6144 * when the font uses different widths (e.g., bold character | |
6145 * is wider). */ | |
8273
0c3210caefa6
commit https://github.com/vim/vim/commit/d804fdf4c25435284333258856bc265f1ff10b09
Christian Brabandt <cb@256bit.org>
parents:
8222
diff
changeset
|
6146 if (c >= 0x10000) |
0c3210caefa6
commit https://github.com/vim/vim/commit/d804fdf4c25435284333258856bc265f1ff10b09
Christian Brabandt <cb@256bit.org>
parents:
8222
diff
changeset
|
6147 { |
0c3210caefa6
commit https://github.com/vim/vim/commit/d804fdf4c25435284333258856bc265f1ff10b09
Christian Brabandt <cb@256bit.org>
parents:
8222
diff
changeset
|
6148 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
|
6149 unicodepdy[wlen - 1] = 0; |
0c3210caefa6
commit https://github.com/vim/vim/commit/d804fdf4c25435284333258856bc265f1ff10b09
Christian Brabandt <cb@256bit.org>
parents:
8222
diff
changeset
|
6150 } |
0c3210caefa6
commit https://github.com/vim/vim/commit/d804fdf4c25435284333258856bc265f1ff10b09
Christian Brabandt <cb@256bit.org>
parents:
8222
diff
changeset
|
6151 else |
0c3210caefa6
commit https://github.com/vim/vim/commit/d804fdf4c25435284333258856bc265f1ff10b09
Christian Brabandt <cb@256bit.org>
parents:
8222
diff
changeset
|
6152 unicodepdy[wlen - 1] = cw * gui.char_width; |
7 | 6153 } |
6154 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
|
6155 i += utf_ptr2len_len(text + i, len - i); |
777 | 6156 ++clen; |
7 | 6157 } |
15597
536dd2bc5ac9
patch 8.1.0806: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15549
diff
changeset
|
6158 #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
|
6159 if (IS_ENABLE_DIRECTX()) |
6110 | 6160 { |
6112 | 6161 /* 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
|
6162 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
|
6163 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
|
6164 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
|
6165 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
|
6166 foptions, pcliprect, unicodepdy); |
6110 | 6167 } |
6168 else | |
15597
536dd2bc5ac9
patch 8.1.0806: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15549
diff
changeset
|
6169 #endif |
6110 | 6170 ExtTextOutW(s_hdc, TEXT_X(col), TEXT_Y(row), |
6171 foptions, pcliprect, unicodebuf, wlen, unicodepdy); | |
7 | 6172 len = cells; /* used for underlining */ |
6173 } | |
26 | 6174 else if ((enc_codepage > 0 && (int)GetACP() != enc_codepage) || enc_latin9) |
7 | 6175 { |
6176 /* If we want to display codepage data, and the current CP is not the | |
6177 * ANSI one, we need to go via Unicode. */ | |
6178 if (unicodebuf != NULL) | |
6179 { | |
26 | 6180 if (enc_latin9) |
6181 latin9_to_ucs(text, len, unicodebuf); | |
6182 else | |
6183 len = MultiByteToWideChar(enc_codepage, | |
7 | 6184 MB_PRECOMPOSED, |
6185 (char *)text, len, | |
6186 (LPWSTR)unicodebuf, unibuflen); | |
6187 if (len != 0) | |
179 | 6188 { |
6189 /* Use unicodepdy to make characters fit as we expect, even | |
6190 * when the font uses different widths (e.g., bold character | |
6191 * is wider). */ | |
6192 if (unicodepdy != NULL) | |
6193 { | |
6194 int i; | |
6195 int cw; | |
6196 | |
6197 for (i = 0; i < len; ++i) | |
6198 { | |
6199 cw = utf_char2cells(unicodebuf[i]); | |
6200 if (cw > 2) | |
6201 cw = 1; | |
6202 unicodepdy[i] = cw * gui.char_width; | |
6203 } | |
6204 } | |
7 | 6205 ExtTextOutW(s_hdc, TEXT_X(col), TEXT_Y(row), |
179 | 6206 foptions, pcliprect, unicodebuf, len, unicodepdy); |
6207 } | |
7 | 6208 } |
6209 } | |
6210 else | |
6211 { | |
6212 #ifdef FEAT_RIGHTLEFT | |
6226 | 6213 /* Windows will mess up RL text, so we have to draw it character by |
6214 * character. Only do this if RL is on, since it's slow. */ | |
6215 if (curwin->w_p_rl) | |
7 | 6216 RevOut(s_hdc, TEXT_X(col), TEXT_Y(row), |
6217 foptions, pcliprect, (char *)text, len, padding); | |
6218 else | |
6219 #endif | |
6220 ExtTextOut(s_hdc, TEXT_X(col), TEXT_Y(row), | |
6221 foptions, pcliprect, (char *)text, len, padding); | |
6222 } | |
6223 | |
205 | 6224 /* Underline */ |
7 | 6225 if (flags & DRAW_UNDERL) |
6226 { | |
6227 /* When p_linespace is 0, overwrite the bottom row of pixels. | |
6228 * Otherwise put the line just below the character. */ | |
6229 y = FILL_Y(row + 1) - 1; | |
6230 if (p_linespace > 1) | |
6231 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
|
6232 draw_line(FILL_X(col), y, FILL_X(col + len), y, gui.currFgColor); |
7 | 6233 } |
205 | 6234 |
12317
2a8890b80923
patch 8.0.1038: strike-through text not supported
Christian Brabandt <cb@256bit.org>
parents:
12090
diff
changeset
|
6235 /* Strikethrough */ |
2a8890b80923
patch 8.0.1038: strike-through text not supported
Christian Brabandt <cb@256bit.org>
parents:
12090
diff
changeset
|
6236 if (flags & DRAW_STRIKE) |
2a8890b80923
patch 8.0.1038: strike-through text not supported
Christian Brabandt <cb@256bit.org>
parents:
12090
diff
changeset
|
6237 { |
2a8890b80923
patch 8.0.1038: strike-through text not supported
Christian Brabandt <cb@256bit.org>
parents:
12090
diff
changeset
|
6238 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
|
6239 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
|
6240 } |
2a8890b80923
patch 8.0.1038: strike-through text not supported
Christian Brabandt <cb@256bit.org>
parents:
12090
diff
changeset
|
6241 |
205 | 6242 /* Undercurl */ |
6243 if (flags & DRAW_UNDERC) | |
6244 { | |
6245 int x; | |
6246 int offset; | |
323 | 6247 static const int val[8] = {1, 0, 0, 0, 1, 2, 2, 2 }; |
205 | 6248 |
6249 y = FILL_Y(row + 1) - 1; | |
6250 for (x = FILL_X(col); x < FILL_X(col + len); ++x) | |
6251 { | |
6252 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
|
6253 set_pixel(x, y - offset, gui.currSpColor); |
205 | 6254 } |
6255 } | |
7 | 6256 } |
6257 | |
6258 | |
6259 /* | |
6260 * Output routines. | |
6261 */ | |
6262 | |
6263 /* Flush any output to the screen */ | |
6264 void | |
6265 gui_mch_flush(void) | |
6266 { | |
12934
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
6267 #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
|
6268 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
|
6269 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
|
6270 #endif |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
6271 |
7 | 6272 GdiFlush(); |
6273 } | |
6274 | |
6275 static void | |
6276 clear_rect(RECT *rcp) | |
6277 { | |
12986
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
6278 fill_rect(rcp, NULL, gui.back_pixel); |
7 | 6279 } |
6280 | |
6281 | |
636 | 6282 void |
6283 gui_mch_get_screen_dimensions(int *screen_w, int *screen_h) | |
6284 { | |
6285 RECT workarea_rect; | |
6286 | |
6287 get_work_area(&workarea_rect); | |
6288 | |
819 | 6289 *screen_w = workarea_rect.right - workarea_rect.left |
5225
8f983df0299f
updated for version 7.4a.038
Bram Moolenaar <bram@vim.org>
parents:
5223
diff
changeset
|
6290 - (GetSystemMetrics(SM_CXFRAME) + |
6110 | 6291 GetSystemMetrics(SM_CXPADDEDBORDER)) * 2; |
636 | 6292 |
6293 /* FIXME: dirty trick: Because the gui_get_base_height() doesn't include | |
6294 * the menubar for MSwin, we subtract it from the screen height, so that | |
6295 * the window size can be made to fit on the screen. */ | |
819 | 6296 *screen_h = workarea_rect.bottom - workarea_rect.top |
5225
8f983df0299f
updated for version 7.4a.038
Bram Moolenaar <bram@vim.org>
parents:
5223
diff
changeset
|
6297 - (GetSystemMetrics(SM_CYFRAME) + |
6110 | 6298 GetSystemMetrics(SM_CXPADDEDBORDER)) * 2 |
636 | 6299 - GetSystemMetrics(SM_CYCAPTION) |
6300 #ifdef FEAT_MENU | |
856 | 6301 - gui_mswin_get_menu_height(FALSE) |
636 | 6302 #endif |
856 | 6303 ; |
636 | 6304 } |
6305 | |
6306 | |
7 | 6307 #if defined(FEAT_MENU) || defined(PROTO) |
6308 /* | |
6309 * Add a sub menu to the menu bar. | |
6310 */ | |
6311 void | |
6312 gui_mch_add_menu( | |
6313 vimmenu_T *menu, | |
6314 int pos) | |
6315 { | |
6316 vimmenu_T *parent = menu->parent; | |
6317 | |
6318 menu->submenu_id = CreatePopupMenu(); | |
6319 menu->id = s_menu_id++; | |
6320 | |
6321 if (menu_is_menubar(menu->name)) | |
6322 { | |
16196
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
6323 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
|
6324 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
|
6325 |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
6326 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
|
6327 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
|
6328 return; |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
6329 |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
6330 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
|
6331 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
|
6332 | 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
|
6333 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
|
6334 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
|
6335 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
|
6336 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
|
6337 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
|
6338 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
|
6339 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
|
6340 ? 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
|
6341 (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
|
6342 vim_free(wn); |
7 | 6343 } |
6344 | |
6345 /* Fix window size if menu may have wrapped */ | |
6346 if (parent == NULL) | |
6347 gui_mswin_get_menu_height(!gui.starting); | |
6348 #ifdef FEAT_TEAROFF | |
6349 else if (IsWindow(parent->tearoff_handle)) | |
6350 rebuild_tearoff(parent); | |
6351 #endif | |
6352 } | |
6353 | |
6354 void | |
6355 gui_mch_show_popupmenu(vimmenu_T *menu) | |
6356 { | |
6357 POINT mp; | |
6358 | |
6359 (void)GetCursorPos((LPPOINT)&mp); | |
6360 gui_mch_show_popupmenu_at(menu, (int)mp.x, (int)mp.y); | |
6361 } | |
6362 | |
6363 void | |
401 | 6364 gui_make_popup(char_u *path_name, int mouse_pos) |
7 | 6365 { |
6366 vimmenu_T *menu = gui_find_menu(path_name); | |
6367 | |
6368 if (menu != NULL) | |
6369 { | |
6370 POINT p; | |
6371 | |
6372 /* Find the position of the current cursor */ | |
6373 GetDCOrgEx(s_hdc, &p); | |
401 | 6374 if (mouse_pos) |
6375 { | |
6376 int mx, my; | |
6377 | |
6378 gui_mch_getmouse(&mx, &my); | |
6379 p.x += mx; | |
6380 p.y += my; | |
6381 } | |
6382 else if (curwin != NULL) | |
7 | 6383 { |
12513
3ca08bf99396
patch 8.0.1135: W_WINCOL() is always the same
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
6384 p.x += TEXT_X(curwin->w_wincol + curwin->w_wcol + 1); |
7 | 6385 p.y += TEXT_Y(W_WINROW(curwin) + curwin->w_wrow + 1); |
6386 } | |
6387 msg_scroll = FALSE; | |
6388 gui_mch_show_popupmenu_at(menu, (int)p.x, (int)p.y); | |
6389 } | |
6390 } | |
6391 | |
6392 #if defined(FEAT_TEAROFF) || defined(PROTO) | |
6393 /* | |
6394 * Given a menu descriptor, e.g. "File.New", find it in the menu hierarchy and | |
6395 * create it as a pseudo-"tearoff menu". | |
6396 */ | |
6397 void | |
6398 gui_make_tearoff(char_u *path_name) | |
6399 { | |
6400 vimmenu_T *menu = gui_find_menu(path_name); | |
6401 | |
6402 /* Found the menu, so tear it off. */ | |
6403 if (menu != NULL) | |
6404 gui_mch_tearoff(menu->dname, menu, 0xffffL, 0xffffL); | |
6405 } | |
6406 #endif | |
6407 | |
6408 /* | |
6409 * Add a menu item to a menu | |
6410 */ | |
6411 void | |
6412 gui_mch_add_menu_item( | |
6413 vimmenu_T *menu, | |
6414 int idx) | |
6415 { | |
6416 vimmenu_T *parent = menu->parent; | |
6417 | |
6418 menu->id = s_menu_id++; | |
6419 menu->submenu_id = NULL; | |
6420 | |
6421 #ifdef FEAT_TEAROFF | |
6422 if (STRNCMP(menu->name, TEAR_STRING, TEAR_LEN) == 0) | |
6423 { | |
6424 InsertMenu(parent->submenu_id, (UINT)idx, MF_BITMAP|MF_BYPOSITION, | |
6425 (UINT)menu->id, (LPCTSTR) s_htearbitmap); | |
6426 } | |
6427 else | |
6428 #endif | |
6429 #ifdef FEAT_TOOLBAR | |
6430 if (menu_is_toolbar(parent->name)) | |
6431 { | |
6432 TBBUTTON newtb; | |
6433 | |
6434 vim_memset(&newtb, 0, sizeof(newtb)); | |
6435 if (menu_is_separator(menu->name)) | |
6436 { | |
6437 newtb.iBitmap = 0; | |
6438 newtb.fsStyle = TBSTYLE_SEP; | |
6439 } | |
6440 else | |
6441 { | |
6442 newtb.iBitmap = get_toolbar_bitmap(menu); | |
6443 newtb.fsStyle = TBSTYLE_BUTTON; | |
6444 } | |
6445 newtb.idCommand = menu->id; | |
6446 newtb.fsState = TBSTATE_ENABLED; | |
6447 newtb.iString = 0; | |
6448 SendMessage(s_toolbarhwnd, TB_INSERTBUTTON, (WPARAM)idx, | |
6449 (LPARAM)&newtb); | |
6450 menu->submenu_id = (HMENU)-1; | |
6451 } | |
6452 else | |
6453 #endif | |
6454 { | |
16196
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
6455 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
|
6456 |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
6457 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
|
6458 if (wn != NULL) |
7 | 6459 { |
16196
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
6460 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
|
6461 (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
|
6462 ? 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
|
6463 (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
|
6464 vim_free(wn); |
7 | 6465 } |
6466 #ifdef FEAT_TEAROFF | |
6467 if (IsWindow(parent->tearoff_handle)) | |
6468 rebuild_tearoff(parent); | |
6469 #endif | |
6470 } | |
6471 } | |
6472 | |
6473 /* | |
6474 * Destroy the machine specific menu widget. | |
6475 */ | |
6476 void | |
6477 gui_mch_destroy_menu(vimmenu_T *menu) | |
6478 { | |
6479 #ifdef FEAT_TOOLBAR | |
6480 /* | |
6481 * is this a toolbar button? | |
6482 */ | |
6483 if (menu->submenu_id == (HMENU)-1) | |
6484 { | |
6485 int iButton; | |
6486 | |
6487 iButton = (int)SendMessage(s_toolbarhwnd, TB_COMMANDTOINDEX, | |
6488 (WPARAM)menu->id, 0); | |
6489 SendMessage(s_toolbarhwnd, TB_DELETEBUTTON, (WPARAM)iButton, 0); | |
6490 } | |
6491 else | |
6492 #endif | |
6493 { | |
6494 if (menu->parent != NULL | |
6495 && menu_is_popup(menu->parent->dname) | |
6496 && menu->parent->submenu_id != NULL) | |
6497 RemoveMenu(menu->parent->submenu_id, menu->id, MF_BYCOMMAND); | |
6498 else | |
6499 RemoveMenu(s_menuBar, menu->id, MF_BYCOMMAND); | |
6500 if (menu->submenu_id != NULL) | |
6501 DestroyMenu(menu->submenu_id); | |
6502 #ifdef FEAT_TEAROFF | |
6503 if (IsWindow(menu->tearoff_handle)) | |
6504 DestroyWindow(menu->tearoff_handle); | |
6505 if (menu->parent != NULL | |
6506 && menu->parent->children != NULL | |
6507 && IsWindow(menu->parent->tearoff_handle)) | |
6508 { | |
6509 /* This menu must not show up when rebuilding the tearoff window. */ | |
6510 menu->modes = 0; | |
6511 rebuild_tearoff(menu->parent); | |
6512 } | |
6513 #endif | |
6514 } | |
6515 } | |
6516 | |
6517 #ifdef FEAT_TEAROFF | |
6518 static void | |
6519 rebuild_tearoff(vimmenu_T *menu) | |
6520 { | |
6521 /*hackish*/ | |
6522 char_u tbuf[128]; | |
6523 RECT trect; | |
6524 RECT rct; | |
6525 RECT roct; | |
6526 int x, y; | |
6527 | |
6528 HWND thwnd = menu->tearoff_handle; | |
6529 | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
6530 GetWindowText(thwnd, (LPSTR)tbuf, 127); |
7 | 6531 if (GetWindowRect(thwnd, &trect) |
6532 && GetWindowRect(s_hwnd, &rct) | |
6533 && GetClientRect(s_hwnd, &roct)) | |
6534 { | |
6535 x = trect.left - rct.left; | |
6536 y = (trect.top - rct.bottom + roct.bottom); | |
6537 } | |
6538 else | |
6539 { | |
6540 x = y = 0xffffL; | |
6541 } | |
6542 DestroyWindow(thwnd); | |
6543 if (menu->children != NULL) | |
6544 { | |
6545 gui_mch_tearoff(tbuf, menu, x, y); | |
6546 if (IsWindow(menu->tearoff_handle)) | |
6547 (void) SetWindowPos(menu->tearoff_handle, | |
6548 NULL, | |
6549 (int)trect.left, | |
6550 (int)trect.top, | |
6551 0, 0, | |
6552 SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); | |
6553 } | |
6554 } | |
6555 #endif /* FEAT_TEAROFF */ | |
6556 | |
6557 /* | |
6558 * Make a menu either grey or not grey. | |
6559 */ | |
6560 void | |
6561 gui_mch_menu_grey( | |
6562 vimmenu_T *menu, | |
6563 int grey) | |
6564 { | |
6565 #ifdef FEAT_TOOLBAR | |
6566 /* | |
6567 * is this a toolbar button? | |
6568 */ | |
6569 if (menu->submenu_id == (HMENU)-1) | |
6570 { | |
6571 SendMessage(s_toolbarhwnd, TB_ENABLEBUTTON, | |
6572 (WPARAM)menu->id, (LPARAM) MAKELONG((grey ? FALSE : TRUE), 0) ); | |
6573 } | |
6574 else | |
6575 #endif | |
9236
9940e9b2a725
commit https://github.com/vim/vim/commit/762f1754370a1278167c8cba6c047ef319fc099c
Christian Brabandt <cb@256bit.org>
parents:
9213
diff
changeset
|
6576 (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
|
6577 menu->id, MF_BYCOMMAND | (grey ? MF_GRAYED : MF_ENABLED)); |
7 | 6578 |
6579 #ifdef FEAT_TEAROFF | |
6580 if ((menu->parent != NULL) && (IsWindow(menu->parent->tearoff_handle))) | |
6581 { | |
6582 WORD menuID; | |
6583 HWND menuHandle; | |
6584 | |
6585 /* | |
6586 * A tearoff button has changed state. | |
6587 */ | |
6588 if (menu->children == NULL) | |
6589 menuID = (WORD)(menu->id); | |
6590 else | |
840 | 6591 menuID = (WORD)((long_u)(menu->submenu_id) | (DWORD)0x8000); |
7 | 6592 menuHandle = GetDlgItem(menu->parent->tearoff_handle, menuID); |
6593 if (menuHandle) | |
6594 EnableWindow(menuHandle, !grey); | |
6595 | |
6596 } | |
6597 #endif | |
6598 } | |
6599 | |
6600 #endif /* FEAT_MENU */ | |
6601 | |
6602 | |
6603 /* define some macros used to make the dialogue creation more readable */ | |
6604 | |
6605 #define add_string(s) strcpy((LPSTR)p, s); (LPSTR)p += (strlen((LPSTR)p) + 1) | |
6606 #define add_word(x) *p++ = (x) | |
615 | 6607 #define add_long(x) dwp = (DWORD *)p; *dwp++ = (x); p = (WORD *)dwp |
7 | 6608 |
6609 #if defined(FEAT_GUI_DIALOG) || defined(PROTO) | |
6610 /* | |
6611 * stuff for dialogs | |
6612 */ | |
6613 | |
6614 /* | |
6615 * The callback routine used by all the dialogs. Very simple. First, | |
6616 * acknowledges the INITDIALOG message so that Windows knows to do standard | |
6617 * dialog stuff (Return = default, Esc = cancel....) Second, if a button is | |
6618 * pressed, return that button's ID - IDCANCEL (2), which is the button's | |
6619 * number. | |
6620 */ | |
6621 static LRESULT CALLBACK | |
6622 dialog_callback( | |
6623 HWND hwnd, | |
6624 UINT message, | |
6625 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
|
6626 LPARAM lParam UNUSED) |
7 | 6627 { |
6628 if (message == WM_INITDIALOG) | |
6629 { | |
6630 CenterWindow(hwnd, GetWindow(hwnd, GW_OWNER)); | |
6631 /* Set focus to the dialog. Set the default button, if specified. */ | |
6632 (void)SetFocus(hwnd); | |
6633 if (dialog_default_button > IDCANCEL) | |
6634 (void)SetFocus(GetDlgItem(hwnd, dialog_default_button)); | |
1356 | 6635 else |
6636 /* We don't have a default, set focus on another element of the | |
6637 * dialog window, probably the icon */ | |
6638 (void)SetFocus(GetDlgItem(hwnd, DLG_NONBUTTON_CONTROL)); | |
7 | 6639 return FALSE; |
6640 } | |
6641 | |
6642 if (message == WM_COMMAND) | |
6643 { | |
6644 int button = LOWORD(wParam); | |
6645 | |
6646 /* Don't end the dialog if something was selected that was | |
6647 * not a button. | |
6648 */ | |
6649 if (button >= DLG_NONBUTTON_CONTROL) | |
6650 return TRUE; | |
6651 | |
6652 /* If the edit box exists, copy the string. */ | |
6653 if (s_textfield != NULL) | |
1795 | 6654 { |
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
|
6655 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
|
6656 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
|
6657 |
973070a30381
patch 8.1.1103: MS-Windows: old API calls are no longer needed
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
6658 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
|
6659 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
|
6660 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
|
6661 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
|
6662 vim_free(wp); |
1795 | 6663 } |
7 | 6664 |
6665 /* | |
6666 * Need to check for IDOK because if the user just hits Return to | |
6667 * accept the default value, some reason this is what we get. | |
6668 */ | |
6669 if (button == IDOK) | |
6670 { | |
6671 if (dialog_default_button > IDCANCEL) | |
6672 EndDialog(hwnd, dialog_default_button); | |
6673 } | |
6674 else | |
6675 EndDialog(hwnd, button - IDCANCEL); | |
6676 return TRUE; | |
6677 } | |
6678 | |
6679 if ((message == WM_SYSCOMMAND) && (wParam == SC_CLOSE)) | |
6680 { | |
6681 EndDialog(hwnd, 0); | |
6682 return TRUE; | |
6683 } | |
6684 return FALSE; | |
6685 } | |
6686 | |
6687 /* | |
6688 * Create a dialog dynamically from the parameter strings. | |
6689 * type = type of dialog (question, alert, etc.) | |
6690 * title = dialog title. may be NULL for default title. | |
6691 * message = text to display. Dialog sizes to accommodate it. | |
6692 * buttons = '\n' separated list of button captions, default first. | |
6693 * dfltbutton = number of default button. | |
6694 * | |
6695 * This routine returns 1 if the first button is pressed, | |
6696 * 2 for the second, etc. | |
6697 * | |
6698 * 0 indicates Esc was pressed. | |
6699 * -1 for unexpected error | |
6700 * | |
6701 * If stubbing out this fn, return 1. | |
6702 */ | |
6703 | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
6704 static const char *dlg_icons[] = /* must match names in resource file */ |
7 | 6705 { |
6706 "IDR_VIM", | |
6707 "IDR_VIM_ERROR", | |
6708 "IDR_VIM_ALERT", | |
6709 "IDR_VIM_INFO", | |
6710 "IDR_VIM_QUESTION" | |
6711 }; | |
6712 | |
6713 int | |
6714 gui_mch_dialog( | |
6715 int type, | |
6716 char_u *title, | |
6717 char_u *message, | |
6718 char_u *buttons, | |
6719 int dfltbutton, | |
2684 | 6720 char_u *textfield, |
6721 int ex_cmd) | |
7 | 6722 { |
6723 WORD *p, *pdlgtemplate, *pnumitems; | |
615 | 6724 DWORD *dwp; |
7 | 6725 int numButtons; |
6726 int *buttonWidths, *buttonPositions; | |
6727 int buttonYpos; | |
6728 int nchar, i; | |
6729 DWORD lStyle; | |
6730 int dlgwidth = 0; | |
6731 int dlgheight; | |
6732 int editboxheight; | |
6733 int horizWidth = 0; | |
6734 int msgheight; | |
6735 char_u *pstart; | |
6736 char_u *pend; | |
158 | 6737 char_u *last_white; |
7 | 6738 char_u *tbuffer; |
6739 RECT rect; | |
6740 HWND hwnd; | |
6741 HDC hdc; | |
6742 HFONT font, oldFont; | |
6743 TEXTMETRIC fontInfo; | |
6744 int fontHeight; | |
6745 int textWidth, minButtonWidth, messageWidth; | |
6746 int maxDialogWidth; | |
153 | 6747 int maxDialogHeight; |
6748 int scroll_flag = 0; | |
7 | 6749 int vertical; |
6750 int dlgPaddingX; | |
6751 int dlgPaddingY; | |
6752 #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
|
6753 LOGFONTW lfSysmenu; |
7 | 6754 int use_lfSysmenu = FALSE; |
6755 #endif | |
158 | 6756 garray_T ga; |
6757 int l; | |
7 | 6758 |
6759 #ifndef NO_CONSOLE | |
6760 /* Don't output anything in silent mode ("ex -s") */ | |
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
|
6761 # ifdef VIMDLL |
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
|
6762 if (!(gui.in_use || gui.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
|
6763 # 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
|
6764 if (silent_mode) |
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
|
6765 return dfltbutton; /* return default option */ |
7 | 6766 #endif |
6767 | |
153 | 6768 if (s_hwnd == NULL) |
6769 get_dialog_font_metrics(); | |
7 | 6770 |
6771 if ((type < 0) || (type > VIM_LAST_TYPE)) | |
6772 type = 0; | |
6773 | |
6774 /* allocate some memory for dialog template */ | |
39 | 6775 /* TODO should compute this really */ |
158 | 6776 pdlgtemplate = p = (PWORD)LocalAlloc(LPTR, |
840 | 6777 DLG_ALLOC_SIZE + STRLEN(message) * 2); |
7 | 6778 |
6779 if (p == NULL) | |
6780 return -1; | |
6781 | |
6782 /* | |
4352 | 6783 * make a copy of 'buttons' to fiddle with it. compiler grizzles because |
7 | 6784 * vim_strsave() doesn't take a const arg (why not?), so cast away the |
6785 * const. | |
6786 */ | |
6787 tbuffer = vim_strsave(buttons); | |
6788 if (tbuffer == NULL) | |
6789 return -1; | |
6790 | |
6791 --dfltbutton; /* Change from one-based to zero-based */ | |
6792 | |
6793 /* Count buttons */ | |
6794 numButtons = 1; | |
6795 for (i = 0; tbuffer[i] != '\0'; i++) | |
6796 { | |
6797 if (tbuffer[i] == DLG_BUTTON_SEP) | |
6798 numButtons++; | |
6799 } | |
6800 if (dfltbutton >= numButtons) | |
6801 dfltbutton = -1; | |
6802 | |
6803 /* 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
|
6804 buttonWidths = ALLOC_MULT(int, numButtons); |
7 | 6805 if (buttonWidths == NULL) |
6806 return -1; | |
6807 | |
6808 /* 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
|
6809 buttonPositions = ALLOC_MULT(int, numButtons); |
7 | 6810 if (buttonPositions == NULL) |
6811 return -1; | |
6812 | |
6813 /* | |
6814 * Calculate how big the dialog must be. | |
6815 */ | |
6816 hwnd = GetDesktopWindow(); | |
6817 hdc = GetWindowDC(hwnd); | |
6818 #ifdef USE_SYSMENU_FONT | |
6819 if (gui_w32_get_menu_font(&lfSysmenu) == OK) | |
6820 { | |
16152
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
6821 font = CreateFontIndirectW(&lfSysmenu); |
7 | 6822 use_lfSysmenu = TRUE; |
6823 } | |
6824 else | |
6825 #endif | |
6826 font = CreateFont(-DLG_FONT_POINT_SIZE, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
6827 VARIABLE_PITCH , DLG_FONT_NAME); | |
6828 if (s_usenewlook) | |
6829 { | |
6830 oldFont = SelectFont(hdc, font); | |
6831 dlgPaddingX = DLG_PADDING_X; | |
6832 dlgPaddingY = DLG_PADDING_Y; | |
6833 } | |
6834 else | |
6835 { | |
6836 oldFont = SelectFont(hdc, GetStockObject(SYSTEM_FONT)); | |
6837 dlgPaddingX = DLG_OLD_STYLE_PADDING_X; | |
6838 dlgPaddingY = DLG_OLD_STYLE_PADDING_Y; | |
6839 } | |
6840 GetTextMetrics(hdc, &fontInfo); | |
6841 fontHeight = fontInfo.tmHeight; | |
6842 | |
6843 /* Minimum width for horizontal button */ | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
6844 minButtonWidth = GetTextWidth(hdc, (char_u *)"Cancel", 6); |
7 | 6845 |
6846 /* Maximum width of a dialog, if possible */ | |
158 | 6847 if (s_hwnd == NULL) |
6848 { | |
6849 RECT workarea_rect; | |
6850 | |
636 | 6851 /* We don't have a window, use the desktop area. */ |
158 | 6852 get_work_area(&workarea_rect); |
6853 maxDialogWidth = workarea_rect.right - workarea_rect.left - 100; | |
6854 if (maxDialogWidth > 600) | |
6855 maxDialogWidth = 600; | |
5249
47a09a572ea6
updated for version 7.4b.001
Bram Moolenaar <bram@vim.org>
parents:
5225
diff
changeset
|
6856 /* Leave some room for the taskbar. */ |
47a09a572ea6
updated for version 7.4b.001
Bram Moolenaar <bram@vim.org>
parents:
5225
diff
changeset
|
6857 maxDialogHeight = workarea_rect.bottom - workarea_rect.top - 150; |
158 | 6858 } |
6859 else | |
6860 { | |
5284
7ed1ec814daf
updated for version 7.4b.018
Bram Moolenaar <bram@vim.org>
parents:
5249
diff
changeset
|
6861 /* Use our own window for the size, unless it's very small. */ |
7ed1ec814daf
updated for version 7.4b.018
Bram Moolenaar <bram@vim.org>
parents:
5249
diff
changeset
|
6862 GetWindowRect(s_hwnd, &rect); |
158 | 6863 maxDialogWidth = rect.right - rect.left |
5225
8f983df0299f
updated for version 7.4a.038
Bram Moolenaar <bram@vim.org>
parents:
5223
diff
changeset
|
6864 - (GetSystemMetrics(SM_CXFRAME) + |
6110 | 6865 GetSystemMetrics(SM_CXPADDEDBORDER)) * 2; |
158 | 6866 if (maxDialogWidth < DLG_MIN_MAX_WIDTH) |
6867 maxDialogWidth = DLG_MIN_MAX_WIDTH; | |
6868 | |
6869 maxDialogHeight = rect.bottom - rect.top | |
5249
47a09a572ea6
updated for version 7.4b.001
Bram Moolenaar <bram@vim.org>
parents:
5225
diff
changeset
|
6870 - (GetSystemMetrics(SM_CYFRAME) + |
6110 | 6871 GetSystemMetrics(SM_CXPADDEDBORDER)) * 4 |
5284
7ed1ec814daf
updated for version 7.4b.018
Bram Moolenaar <bram@vim.org>
parents:
5249
diff
changeset
|
6872 - GetSystemMetrics(SM_CYCAPTION); |
158 | 6873 if (maxDialogHeight < DLG_MIN_MAX_HEIGHT) |
6874 maxDialogHeight = DLG_MIN_MAX_HEIGHT; | |
6875 } | |
6876 | |
6877 /* Set dlgwidth to width of message. | |
6878 * Copy the message into "ga", changing NL to CR-NL and inserting line | |
6879 * breaks where needed. */ | |
7 | 6880 pstart = message; |
6881 messageWidth = 0; | |
158 | 6882 msgheight = 0; |
6883 ga_init2(&ga, sizeof(char), 500); | |
7 | 6884 do |
6885 { | |
158 | 6886 msgheight += fontHeight; /* at least one line */ |
6887 | |
6888 /* Need to figure out where to break the string. The system does it | |
6889 * at a word boundary, which would mean we can't compute the number of | |
6890 * wrapped lines. */ | |
6891 textWidth = 0; | |
6892 last_white = NULL; | |
6893 for (pend = pstart; *pend != NUL && *pend != '\n'; ) | |
153 | 6894 { |
474 | 6895 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
|
6896 if (l == 1 && VIM_ISWHITE(*pend) |
158 | 6897 && textWidth > maxDialogWidth * 3 / 4) |
6898 last_white = pend; | |
4999
b4a71dbdb787
updated for version 7.3.1244
Bram Moolenaar <bram@vim.org>
parents:
4352
diff
changeset
|
6899 textWidth += GetTextWidthEnc(hdc, pend, l); |
158 | 6900 if (textWidth >= maxDialogWidth) |
153 | 6901 { |
158 | 6902 /* Line will wrap. */ |
6903 messageWidth = maxDialogWidth; | |
153 | 6904 msgheight += fontHeight; |
158 | 6905 textWidth = 0; |
6906 | |
6907 if (last_white != NULL) | |
6908 { | |
6909 /* break the line just after a space */ | |
835 | 6910 ga.ga_len -= (int)(pend - (last_white + 1)); |
158 | 6911 pend = last_white + 1; |
6912 last_white = NULL; | |
6913 } | |
6914 ga_append(&ga, '\r'); | |
6915 ga_append(&ga, '\n'); | |
6916 continue; | |
153 | 6917 } |
158 | 6918 |
6919 while (--l >= 0) | |
6920 ga_append(&ga, *pend++); | |
153 | 6921 } |
158 | 6922 if (textWidth > messageWidth) |
7 | 6923 messageWidth = textWidth; |
158 | 6924 |
6925 ga_append(&ga, '\r'); | |
6926 ga_append(&ga, '\n'); | |
7 | 6927 pstart = pend + 1; |
6928 } while (*pend != NUL); | |
153 | 6929 |
158 | 6930 if (ga.ga_data != NULL) |
6931 message = ga.ga_data; | |
6932 | |
153 | 6933 messageWidth += 10; /* roundoff space */ |
6934 | |
7 | 6935 /* Add width of icon to dlgwidth, and some space */ |
5284
7ed1ec814daf
updated for version 7.4b.018
Bram Moolenaar <bram@vim.org>
parents:
5249
diff
changeset
|
6936 dlgwidth = messageWidth + DLG_ICON_WIDTH + 3 * dlgPaddingX |
7ed1ec814daf
updated for version 7.4b.018
Bram Moolenaar <bram@vim.org>
parents:
5249
diff
changeset
|
6937 + GetSystemMetrics(SM_CXVSCROLL); |
7 | 6938 |
6939 if (msgheight < DLG_ICON_HEIGHT) | |
6940 msgheight = DLG_ICON_HEIGHT; | |
6941 | |
6942 /* | |
6943 * Check button names. A long one will make the dialog wider. | |
1116 | 6944 * When called early (-register error message) p_go isn't initialized. |
7 | 6945 */ |
1116 | 6946 vertical = (p_go != NULL && vim_strchr(p_go, GO_VERTICAL) != NULL); |
7 | 6947 if (!vertical) |
6948 { | |
6949 // Place buttons horizontally if they fit. | |
6950 horizWidth = dlgPaddingX; | |
6951 pstart = tbuffer; | |
6952 i = 0; | |
6953 do | |
6954 { | |
6955 pend = vim_strchr(pstart, DLG_BUTTON_SEP); | |
6956 if (pend == NULL) | |
6957 pend = pstart + STRLEN(pstart); // Last button name. | |
5001
43329b2b5b79
updated for version 7.3.1245
Bram Moolenaar <bram@vim.org>
parents:
4999
diff
changeset
|
6958 textWidth = GetTextWidthEnc(hdc, pstart, (int)(pend - pstart)); |
7 | 6959 if (textWidth < minButtonWidth) |
6960 textWidth = minButtonWidth; | |
6961 textWidth += dlgPaddingX; /* Padding within button */ | |
6962 buttonWidths[i] = textWidth; | |
6963 buttonPositions[i++] = horizWidth; | |
6964 horizWidth += textWidth + dlgPaddingX; /* Pad between buttons */ | |
6965 pstart = pend + 1; | |
6966 } while (*pend != NUL); | |
6967 | |
6968 if (horizWidth > maxDialogWidth) | |
6969 vertical = TRUE; // Too wide to fit on the screen. | |
6970 else if (horizWidth > dlgwidth) | |
6971 dlgwidth = horizWidth; | |
6972 } | |
6973 | |
6974 if (vertical) | |
6975 { | |
6976 // Stack buttons vertically. | |
6977 pstart = tbuffer; | |
6978 do | |
6979 { | |
6980 pend = vim_strchr(pstart, DLG_BUTTON_SEP); | |
6981 if (pend == NULL) | |
6982 pend = pstart + STRLEN(pstart); // Last button name. | |
5001
43329b2b5b79
updated for version 7.3.1245
Bram Moolenaar <bram@vim.org>
parents:
4999
diff
changeset
|
6983 textWidth = GetTextWidthEnc(hdc, pstart, (int)(pend - pstart)); |
7 | 6984 textWidth += dlgPaddingX; /* Padding within button */ |
6985 textWidth += DLG_VERT_PADDING_X * 2; /* Padding around button */ | |
6986 if (textWidth > dlgwidth) | |
6987 dlgwidth = textWidth; | |
6988 pstart = pend + 1; | |
6989 } while (*pend != NUL); | |
6990 } | |
6991 | |
6992 if (dlgwidth < DLG_MIN_WIDTH) | |
6993 dlgwidth = DLG_MIN_WIDTH; /* Don't allow a really thin dialog!*/ | |
6994 | |
6995 /* start to fill in the dlgtemplate information. addressing by WORDs */ | |
6996 if (s_usenewlook) | |
6997 lStyle = DS_MODALFRAME | WS_CAPTION |DS_3DLOOK| WS_VISIBLE |DS_SETFONT; | |
6998 else | |
6999 lStyle = DS_MODALFRAME | WS_CAPTION |DS_3DLOOK| WS_VISIBLE; | |
7000 | |
7001 add_long(lStyle); | |
7002 add_long(0); // (lExtendedStyle) | |
7003 pnumitems = p; /*save where the number of items must be stored*/ | |
7004 add_word(0); // NumberOfItems(will change later) | |
7005 add_word(10); // x | |
7006 add_word(10); // y | |
7007 add_word(PixelToDialogX(dlgwidth)); // cx | |
7008 | |
7009 // Dialog height. | |
7010 if (vertical) | |
5284
7ed1ec814daf
updated for version 7.4b.018
Bram Moolenaar <bram@vim.org>
parents:
5249
diff
changeset
|
7011 dlgheight = msgheight + 2 * dlgPaddingY |
7ed1ec814daf
updated for version 7.4b.018
Bram Moolenaar <bram@vim.org>
parents:
5249
diff
changeset
|
7012 + DLG_VERT_PADDING_Y + 2 * fontHeight * numButtons; |
7 | 7013 else |
7014 dlgheight = msgheight + 3 * dlgPaddingY + 2 * fontHeight; | |
7015 | |
7016 // Dialog needs to be taller if contains an edit box. | |
7017 editboxheight = fontHeight + dlgPaddingY + 4 * DLG_VERT_PADDING_Y; | |
7018 if (textfield != NULL) | |
7019 dlgheight += editboxheight; | |
7020 | |
5284
7ed1ec814daf
updated for version 7.4b.018
Bram Moolenaar <bram@vim.org>
parents:
5249
diff
changeset
|
7021 /* Restrict the size to a maximum. Causes a scrollbar to show up. */ |
7ed1ec814daf
updated for version 7.4b.018
Bram Moolenaar <bram@vim.org>
parents:
5249
diff
changeset
|
7022 if (dlgheight > maxDialogHeight) |
7ed1ec814daf
updated for version 7.4b.018
Bram Moolenaar <bram@vim.org>
parents:
5249
diff
changeset
|
7023 { |
6110 | 7024 msgheight = msgheight - (dlgheight - maxDialogHeight); |
7025 dlgheight = maxDialogHeight; | |
7026 scroll_flag = WS_VSCROLL; | |
7027 /* Make sure scrollbar doesn't appear in the middle of the dialog */ | |
7028 messageWidth = dlgwidth - DLG_ICON_WIDTH - 3 * dlgPaddingX; | |
5284
7ed1ec814daf
updated for version 7.4b.018
Bram Moolenaar <bram@vim.org>
parents:
5249
diff
changeset
|
7029 } |
7ed1ec814daf
updated for version 7.4b.018
Bram Moolenaar <bram@vim.org>
parents:
5249
diff
changeset
|
7030 |
7 | 7031 add_word(PixelToDialogY(dlgheight)); |
7032 | |
7033 add_word(0); // Menu | |
7034 add_word(0); // Class | |
7035 | |
7036 /* 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
|
7037 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
|
7038 : (LPSTR)("Vim "VIM_VERSION_MEDIUM)), TRUE); |
7 | 7039 p += nchar; |
7040 | |
7041 if (s_usenewlook) | |
7042 { | |
7043 /* do the font, since DS_3DLOOK doesn't work properly */ | |
7044 #ifdef USE_SYSMENU_FONT | |
7045 if (use_lfSysmenu) | |
7046 { | |
7047 /* point size */ | |
7048 *p++ = -MulDiv(lfSysmenu.lfHeight, 72, | |
7049 GetDeviceCaps(hdc, LOGPIXELSY)); | |
16152
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
7050 wcscpy(p, lfSysmenu.lfFaceName); |
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
7051 nchar = (int)wcslen(lfSysmenu.lfFaceName) + 1; |
7 | 7052 } |
7053 else | |
7054 #endif | |
7055 { | |
7056 *p++ = DLG_FONT_POINT_SIZE; // point size | |
12543
e9028055f6d6
patch 8.0.1150: MS-Windows GUI: dialog font size is incorrect
Christian Brabandt <cb@256bit.org>
parents:
12513
diff
changeset
|
7057 nchar = nCopyAnsiToWideChar(p, DLG_FONT_NAME, FALSE); |
7 | 7058 } |
7059 p += nchar; | |
7060 } | |
7061 | |
7062 buttonYpos = msgheight + 2 * dlgPaddingY; | |
7063 | |
7064 if (textfield != NULL) | |
7065 buttonYpos += editboxheight; | |
7066 | |
7067 pstart = tbuffer; | |
7068 if (!vertical) | |
7069 horizWidth = (dlgwidth - horizWidth) / 2; /* Now it's X offset */ | |
7070 for (i = 0; i < numButtons; i++) | |
7071 { | |
7072 /* get end of this button. */ | |
7073 for ( pend = pstart; | |
7074 *pend && (*pend != DLG_BUTTON_SEP); | |
7075 pend++) | |
7076 ; | |
7077 | |
7078 if (*pend) | |
7079 *pend = '\0'; | |
7080 | |
7081 /* | |
7082 * old NOTE: | |
7083 * setting the BS_DEFPUSHBUTTON style doesn't work because Windows sets | |
7084 * the focus to the first tab-able button and in so doing makes that | |
7085 * the default!! Grrr. Workaround: Make the default button the only | |
7086 * one with WS_TABSTOP style. Means user can't tab between buttons, but | |
7087 * he/she can use arrow keys. | |
7088 * | |
7089 * new NOTE: BS_DEFPUSHBUTTON is required to be able to select the | |
1213 | 7090 * right button when hitting <Enter>. E.g., for the ":confirm quit" |
7 | 7091 * dialog. Also needed for when the textfield is the default control. |
7092 * It appears to work now (perhaps not on Win95?). | |
7093 */ | |
7094 if (vertical) | |
7095 { | |
7096 p = add_dialog_element(p, | |
7097 (i == dfltbutton | |
7098 ? BS_DEFPUSHBUTTON : BS_PUSHBUTTON) | WS_TABSTOP, | |
7099 PixelToDialogX(DLG_VERT_PADDING_X), | |
7100 PixelToDialogY(buttonYpos /* TBK */ | |
7101 + 2 * fontHeight * i), | |
7102 PixelToDialogX(dlgwidth - 2 * DLG_VERT_PADDING_X), | |
7103 (WORD)(PixelToDialogY(2 * fontHeight) - 1), | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
7104 (WORD)(IDCANCEL + 1 + i), (WORD)0x0080, (char *)pstart); |
7 | 7105 } |
7106 else | |
7107 { | |
7108 p = add_dialog_element(p, | |
7109 (i == dfltbutton | |
7110 ? BS_DEFPUSHBUTTON : BS_PUSHBUTTON) | WS_TABSTOP, | |
7111 PixelToDialogX(horizWidth + buttonPositions[i]), | |
7112 PixelToDialogY(buttonYpos), /* TBK */ | |
7113 PixelToDialogX(buttonWidths[i]), | |
7114 (WORD)(PixelToDialogY(2 * fontHeight) - 1), | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
7115 (WORD)(IDCANCEL + 1 + i), (WORD)0x0080, (char *)pstart); |
7 | 7116 } |
7117 pstart = pend + 1; /*next button*/ | |
7118 } | |
7119 *pnumitems += numButtons; | |
7120 | |
7121 /* Vim icon */ | |
7122 p = add_dialog_element(p, SS_ICON, | |
7123 PixelToDialogX(dlgPaddingX), | |
7124 PixelToDialogY(dlgPaddingY), | |
7125 PixelToDialogX(DLG_ICON_WIDTH), | |
7126 PixelToDialogY(DLG_ICON_HEIGHT), | |
7127 DLG_NONBUTTON_CONTROL + 0, (WORD)0x0082, | |
7128 dlg_icons[type]); | |
7129 | |
153 | 7130 /* Dialog message */ |
7131 p = add_dialog_element(p, ES_LEFT|scroll_flag|ES_MULTILINE|ES_READONLY, | |
7132 PixelToDialogX(2 * dlgPaddingX + DLG_ICON_WIDTH), | |
7133 PixelToDialogY(dlgPaddingY), | |
7134 (WORD)(PixelToDialogX(messageWidth) + 1), | |
7135 PixelToDialogY(msgheight), | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
7136 DLG_NONBUTTON_CONTROL + 1, (WORD)0x0081, (char *)message); |
7 | 7137 |
7138 /* Edit box */ | |
7139 if (textfield != NULL) | |
7140 { | |
7141 p = add_dialog_element(p, ES_LEFT|ES_AUTOHSCROLL|WS_TABSTOP|WS_BORDER, | |
7142 PixelToDialogX(2 * dlgPaddingX), | |
7143 PixelToDialogY(2 * dlgPaddingY + msgheight), | |
7144 PixelToDialogX(dlgwidth - 4 * dlgPaddingX), | |
7145 PixelToDialogY(fontHeight + dlgPaddingY), | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
7146 DLG_NONBUTTON_CONTROL + 2, (WORD)0x0081, (char *)textfield); |
7 | 7147 *pnumitems += 1; |
7148 } | |
7149 | |
7150 *pnumitems += 2; | |
7151 | |
7152 SelectFont(hdc, oldFont); | |
7153 DeleteObject(font); | |
7154 ReleaseDC(hwnd, hdc); | |
7155 | |
7156 /* Let the dialog_callback() function know which button to make default | |
7157 * If we have an edit box, make that the default. We also need to tell | |
7158 * dialog_callback() if this dialog contains an edit box or not. We do | |
7159 * this by setting s_textfield if it does. | |
7160 */ | |
7161 if (textfield != NULL) | |
7162 { | |
7163 dialog_default_button = DLG_NONBUTTON_CONTROL + 2; | |
7164 s_textfield = textfield; | |
7165 } | |
7166 else | |
7167 { | |
7168 dialog_default_button = IDCANCEL + 1 + dfltbutton; | |
7169 s_textfield = NULL; | |
7170 } | |
7171 | |
7172 /* show the dialog box modally and get a return value */ | |
7173 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
|
7174 g_hinst, |
7 | 7175 (LPDLGTEMPLATE)pdlgtemplate, |
7176 s_hwnd, | |
7177 (DLGPROC)dialog_callback); | |
7178 | |
7179 LocalFree(LocalHandle(pdlgtemplate)); | |
7180 vim_free(tbuffer); | |
7181 vim_free(buttonWidths); | |
7182 vim_free(buttonPositions); | |
158 | 7183 vim_free(ga.ga_data); |
7 | 7184 |
7185 /* Focus back to our window (for when MDI is used). */ | |
7186 (void)SetFocus(s_hwnd); | |
7187 | |
7188 return nchar; | |
7189 } | |
7190 | |
7191 #endif /* FEAT_GUI_DIALOG */ | |
840 | 7192 |
7 | 7193 /* |
7194 * Put a simple element (basic class) onto a dialog template in memory. | |
7195 * return a pointer to where the next item should be added. | |
7196 * | |
7197 * parameters: | |
7198 * lStyle = additional style flags | |
7199 * (be careful, NT3.51 & Win32s will ignore the new ones) | |
7200 * x,y = x & y positions IN DIALOG UNITS | |
7201 * w,h = width and height IN DIALOG UNITS | |
7202 * Id = ID used in messages | |
7203 * clss = class ID, e.g 0x0080 for a button, 0x0082 for a static | |
7204 * caption = usually text or resource name | |
7205 * | |
7206 * TODO: use the length information noted here to enable the dialog creation | |
7207 * routines to work out more exactly how much memory they need to alloc. | |
7208 */ | |
7209 static PWORD | |
7210 add_dialog_element( | |
7211 PWORD p, | |
7212 DWORD lStyle, | |
7213 WORD x, | |
7214 WORD y, | |
7215 WORD w, | |
7216 WORD h, | |
7217 WORD Id, | |
7218 WORD clss, | |
7219 const char *caption) | |
7220 { | |
7221 int nchar; | |
7222 | |
7223 p = lpwAlign(p); /* Align to dword boundary*/ | |
7224 lStyle = lStyle | WS_VISIBLE | WS_CHILD; | |
7225 *p++ = LOWORD(lStyle); | |
7226 *p++ = HIWORD(lStyle); | |
7227 *p++ = 0; // LOWORD (lExtendedStyle) | |
7228 *p++ = 0; // HIWORD (lExtendedStyle) | |
7229 *p++ = x; | |
7230 *p++ = y; | |
7231 *p++ = w; | |
7232 *p++ = h; | |
7233 *p++ = Id; //9 or 10 words in all | |
7234 | |
7235 *p++ = (WORD)0xffff; | |
7236 *p++ = clss; //2 more here | |
7237 | |
12543
e9028055f6d6
patch 8.0.1150: MS-Windows GUI: dialog font size is incorrect
Christian Brabandt <cb@256bit.org>
parents:
12513
diff
changeset
|
7238 nchar = nCopyAnsiToWideChar(p, (LPSTR)caption, TRUE); //strlen(caption)+1 |
7 | 7239 p += nchar; |
7240 | |
7241 *p++ = 0; // advance pointer over nExtraStuff WORD - 2 more | |
7242 | |
7243 return p; //total = 15+ (strlen(caption)) words | |
7244 // = 30 + 2(strlen(caption) bytes reqd | |
7245 } | |
7246 | |
7247 | |
7248 /* | |
7249 * Helper routine. Take an input pointer, return closest pointer that is | |
7250 * aligned on a DWORD (4 byte) boundary. Taken from the Win32SDK samples. | |
7251 */ | |
7252 static LPWORD | |
7253 lpwAlign( | |
7254 LPWORD lpIn) | |
7255 { | |
840 | 7256 long_u ul; |
7257 | |
7258 ul = (long_u)lpIn; | |
7 | 7259 ul += 3; |
7260 ul >>= 2; | |
7261 ul <<= 2; | |
7262 return (LPWORD)ul; | |
7263 } | |
7264 | |
7265 /* | |
7266 * Helper routine. Takes second parameter as Ansi string, copies it to first | |
7267 * parameter as wide character (16-bits / char) string, and returns integer | |
7268 * number of wide characters (words) in string (including the trailing wide | |
7269 * 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
|
7270 * 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
|
7271 * ACP is used for "lpAnsiIn". */ |
7 | 7272 static int |
7273 nCopyAnsiToWideChar( | |
7274 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
|
7275 LPSTR lpAnsiIn, |
e9028055f6d6
patch 8.0.1150: MS-Windows GUI: dialog font size is incorrect
Christian Brabandt <cb@256bit.org>
parents:
12513
diff
changeset
|
7276 BOOL use_enc) |
7 | 7277 { |
7278 int nChar = 0; | |
7279 int len = lstrlen(lpAnsiIn) + 1; /* include NUL character */ | |
7280 int i; | |
7281 WCHAR *wn; | |
7282 | |
12543
e9028055f6d6
patch 8.0.1150: MS-Windows GUI: dialog font size is incorrect
Christian Brabandt <cb@256bit.org>
parents:
12513
diff
changeset
|
7283 if (use_enc && enc_codepage >= 0 && (int)GetACP() != enc_codepage) |
7 | 7284 { |
7285 /* 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
|
7286 wn = enc_to_utf16((char_u *)lpAnsiIn, NULL); |
7 | 7287 if (wn != NULL) |
7288 { | |
7289 wcscpy(lpWCStr, wn); | |
835 | 7290 nChar = (int)wcslen(wn) + 1; |
7 | 7291 vim_free(wn); |
7292 } | |
7293 } | |
7294 if (nChar == 0) | |
7295 /* Use Win32 conversion function. */ | |
7296 nChar = MultiByteToWideChar( | |
7297 enc_codepage > 0 ? enc_codepage : CP_ACP, | |
7298 MB_PRECOMPOSED, | |
7299 lpAnsiIn, len, | |
7300 lpWCStr, len); | |
7301 for (i = 0; i < nChar; ++i) | |
7302 if (lpWCStr[i] == (WORD)'\t') /* replace tabs with spaces */ | |
7303 lpWCStr[i] = (WORD)' '; | |
7304 | |
7305 return nChar; | |
7306 } | |
7307 | |
7308 | |
7309 #ifdef FEAT_TEAROFF | |
7310 /* | |
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
|
7311 * 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
|
7312 */ |
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
|
7313 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
|
7314 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
|
7315 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
|
7316 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
|
7317 { |
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
|
7318 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
|
7319 { |
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
|
7320 if (menu->modes == 0) /* this menu has just been deleted */ |
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
|
7321 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
|
7322 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
|
7323 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
|
7324 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
|
7325 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
|
7326 } |
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
|
7327 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
|
7328 } |
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
|
7329 |
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
|
7330 /* |
7 | 7331 * The callback function for all the modeless dialogs that make up the |
7332 * "tearoff menus" Very simple - forward button presses (to fool Vim into | |
7333 * thinking its menus have been clicked), and go away when closed. | |
7334 */ | |
7335 static LRESULT CALLBACK | |
7336 tearoff_callback( | |
7337 HWND hwnd, | |
7338 UINT message, | |
7339 WPARAM wParam, | |
7340 LPARAM lParam) | |
7341 { | |
7342 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
|
7343 { |
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
|
7344 SetWindowLongPtr(hwnd, DWLP_USER, (LONG_PTR)lParam); |
7 | 7345 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
|
7346 } |
7 | 7347 |
7348 /* May show the mouse pointer again. */ | |
7349 HandleMouseHide(message, lParam); | |
7350 | |
7351 if (message == WM_COMMAND) | |
7352 { | |
7353 if ((WORD)(LOWORD(wParam)) & 0x8000) | |
7354 { | |
7355 POINT mp; | |
7356 RECT rect; | |
7357 | |
7358 if (GetCursorPos(&mp) && GetWindowRect(hwnd, &rect)) | |
7359 { | |
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
|
7360 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
|
7361 |
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
|
7362 menu = (vimmenu_T*)GetWindowLongPtr(hwnd, DWLP_USER); |
7 | 7363 (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
|
7364 tearoff_lookup_menuhandle(menu, LOWORD(wParam)), |
7 | 7365 TPM_LEFTALIGN | TPM_LEFTBUTTON, |
7366 (int)rect.right - 8, | |
7367 (int)mp.y, | |
7368 (int)0, /*reserved param*/ | |
7369 s_hwnd, | |
7370 NULL); | |
7371 /* | |
7372 * NOTE: The pop-up menu can eat the mouse up event. | |
7373 * We deal with this in normal.c. | |
7374 */ | |
7375 } | |
7376 } | |
7377 else | |
7378 /* Pass on messages to the main Vim window */ | |
7379 PostMessage(s_hwnd, WM_COMMAND, LOWORD(wParam), 0); | |
7380 /* | |
7381 * Give main window the focus back: this is so after | |
7382 * choosing a tearoff button you can start typing again | |
7383 * straight away. | |
7384 */ | |
7385 (void)SetFocus(s_hwnd); | |
7386 return TRUE; | |
7387 } | |
7388 if ((message == WM_SYSCOMMAND) && (wParam == SC_CLOSE)) | |
7389 { | |
7390 DestroyWindow(hwnd); | |
7391 return TRUE; | |
7392 } | |
7393 | |
7394 /* When moved around, give main window the focus back. */ | |
7395 if (message == WM_EXITSIZEMOVE) | |
7396 (void)SetActiveWindow(s_hwnd); | |
7397 | |
7398 return FALSE; | |
7399 } | |
7400 #endif | |
7401 | |
7402 | |
7403 /* | |
7404 * Decide whether to use the "new look" (small, non-bold font) or the "old | |
7405 * look" (big, clanky font) for dialogs, and work out a few values for use | |
7406 * later accordingly. | |
7407 */ | |
7408 static void | |
7409 get_dialog_font_metrics(void) | |
7410 { | |
7411 HDC hdc; | |
7412 HFONT hfontTools = 0; | |
7413 DWORD dlgFontSize; | |
7414 SIZE size; | |
7415 #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
|
7416 LOGFONTW lfSysmenu; |
7 | 7417 #endif |
7418 | |
7419 s_usenewlook = FALSE; | |
7420 | |
7421 #ifdef USE_SYSMENU_FONT | |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7422 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
|
7423 hfontTools = CreateFontIndirectW(&lfSysmenu); |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7424 else |
7 | 7425 #endif |
7426 hfontTools = CreateFont(-DLG_FONT_POINT_SIZE, 0, 0, 0, 0, 0, 0, 0, | |
7427 0, 0, 0, 0, VARIABLE_PITCH , DLG_FONT_NAME); | |
7428 | |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7429 if (hfontTools) |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7430 { |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7431 hdc = GetDC(s_hwnd); |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7432 SelectObject(hdc, hfontTools); |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7433 /* |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7434 * GetTextMetrics() doesn't return the right value in |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7435 * tmAveCharWidth, so we have to figure out the dialog base units |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7436 * ourselves. |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7437 */ |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7438 GetTextExtentPoint(hdc, |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7439 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7440 52, &size); |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7441 ReleaseDC(s_hwnd, hdc); |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7442 |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7443 s_dlgfntwidth = (WORD)((size.cx / 26 + 1) / 2); |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7444 s_dlgfntheight = (WORD)size.cy; |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7445 s_usenewlook = TRUE; |
7 | 7446 } |
7447 | |
7448 if (!s_usenewlook) | |
7449 { | |
7450 dlgFontSize = GetDialogBaseUnits(); /* fall back to big old system*/ | |
7451 s_dlgfntwidth = LOWORD(dlgFontSize); | |
7452 s_dlgfntheight = HIWORD(dlgFontSize); | |
7453 } | |
7454 } | |
7455 | |
7456 #if defined(FEAT_MENU) && defined(FEAT_TEAROFF) | |
7457 /* | |
7458 * Create a pseudo-"tearoff menu" based on the child | |
7459 * items of a given menu pointer. | |
7460 */ | |
7461 static void | |
7462 gui_mch_tearoff( | |
7463 char_u *title, | |
7464 vimmenu_T *menu, | |
7465 int initX, | |
7466 int initY) | |
7467 { | |
7468 WORD *p, *pdlgtemplate, *pnumitems, *ptrueheight; | |
7469 int template_len; | |
7470 int nchar, textWidth, submenuWidth; | |
7471 DWORD lStyle; | |
7472 DWORD lExtendedStyle; | |
7473 WORD dlgwidth; | |
7474 WORD menuID; | |
7475 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
|
7476 vimmenu_T *top_menu; |
7 | 7477 vimmenu_T *the_menu = menu; |
7478 HWND hwnd; | |
7479 HDC hdc; | |
7480 HFONT font, oldFont; | |
7481 int col, spaceWidth, len; | |
7482 int columnWidths[2]; | |
7483 char_u *label, *text; | |
7484 int acLen = 0; | |
7485 int nameLen; | |
7486 int padding0, padding1, padding2 = 0; | |
7487 int sepPadding=0; | |
87 | 7488 int x; |
7489 int y; | |
7 | 7490 #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
|
7491 LOGFONTW lfSysmenu; |
7 | 7492 int use_lfSysmenu = FALSE; |
7493 #endif | |
7494 | |
7495 /* | |
7496 * If this menu is already torn off, move it to the mouse position. | |
7497 */ | |
7498 if (IsWindow(menu->tearoff_handle)) | |
7499 { | |
7500 POINT mp; | |
7501 if (GetCursorPos((LPPOINT)&mp)) | |
7502 { | |
7503 SetWindowPos(menu->tearoff_handle, NULL, mp.x, mp.y, 0, 0, | |
7504 SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER); | |
7505 } | |
7506 return; | |
7507 } | |
7508 | |
7509 /* | |
7510 * Create a new tearoff. | |
7511 */ | |
7512 if (*title == MNU_HIDDEN_CHAR) | |
7513 title++; | |
7514 | |
7515 /* Allocate memory to store the dialog template. It's made bigger when | |
7516 * needed. */ | |
7517 template_len = DLG_ALLOC_SIZE; | |
7518 pdlgtemplate = p = (WORD *)LocalAlloc(LPTR, template_len); | |
7519 if (p == NULL) | |
7520 return; | |
7521 | |
7522 hwnd = GetDesktopWindow(); | |
7523 hdc = GetWindowDC(hwnd); | |
7524 #ifdef USE_SYSMENU_FONT | |
7525 if (gui_w32_get_menu_font(&lfSysmenu) == OK) | |
7526 { | |
16152
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
7527 font = CreateFontIndirectW(&lfSysmenu); |
7 | 7528 use_lfSysmenu = TRUE; |
7529 } | |
7530 else | |
7531 #endif | |
7532 font = CreateFont(-DLG_FONT_POINT_SIZE, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
7533 VARIABLE_PITCH , DLG_FONT_NAME); | |
7534 if (s_usenewlook) | |
7535 oldFont = SelectFont(hdc, font); | |
7536 else | |
7537 oldFont = SelectFont(hdc, GetStockObject(SYSTEM_FONT)); | |
7538 | |
7539 /* Calculate width of a single space. Used for padding columns to the | |
7540 * right width. */ | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
7541 spaceWidth = GetTextWidth(hdc, (char_u *)" ", 1); |
7 | 7542 |
7543 /* Figure out max width of the text column, the accelerator column and the | |
7544 * optional submenu column. */ | |
7545 submenuWidth = 0; | |
7546 for (col = 0; col < 2; col++) | |
7547 { | |
7548 columnWidths[col] = 0; | |
7549 for (pmenu = menu->children; pmenu != NULL; pmenu = pmenu->next) | |
7550 { | |
7551 /* Use "dname" here to compute the width of the visible text. */ | |
7552 text = (col == 0) ? pmenu->dname : pmenu->actext; | |
7553 if (text != NULL && *text != NUL) | |
7554 { | |
7555 textWidth = GetTextWidthEnc(hdc, text, (int)STRLEN(text)); | |
7556 if (textWidth > columnWidths[col]) | |
7557 columnWidths[col] = textWidth; | |
7558 } | |
7559 if (pmenu->children != NULL) | |
7560 submenuWidth = TEAROFF_COLUMN_PADDING * spaceWidth; | |
7561 } | |
7562 } | |
7563 if (columnWidths[1] == 0) | |
7564 { | |
7565 /* no accelerators */ | |
7566 if (submenuWidth != 0) | |
7567 columnWidths[0] += submenuWidth; | |
7568 else | |
7569 columnWidths[0] += spaceWidth; | |
7570 } | |
7571 else | |
7572 { | |
7573 /* there is an accelerator column */ | |
7574 columnWidths[0] += TEAROFF_COLUMN_PADDING * spaceWidth; | |
7575 columnWidths[1] += submenuWidth; | |
7576 } | |
7577 | |
7578 /* | |
7579 * Now find the total width of our 'menu'. | |
7580 */ | |
7581 textWidth = columnWidths[0] + columnWidths[1]; | |
7582 if (submenuWidth != 0) | |
7583 { | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
7584 submenuWidth = GetTextWidth(hdc, (char_u *)TEAROFF_SUBMENU_LABEL, |
7 | 7585 (int)STRLEN(TEAROFF_SUBMENU_LABEL)); |
7586 textWidth += submenuWidth; | |
7587 } | |
7588 dlgwidth = GetTextWidthEnc(hdc, title, (int)STRLEN(title)); | |
7589 if (textWidth > dlgwidth) | |
7590 dlgwidth = textWidth; | |
7591 dlgwidth += 2 * TEAROFF_PADDING_X + TEAROFF_BUTTON_PAD_X; | |
7592 | |
7593 /* start to fill in the dlgtemplate information. addressing by WORDs */ | |
7594 if (s_usenewlook) | |
7595 lStyle = DS_MODALFRAME | WS_CAPTION| WS_SYSMENU |DS_SETFONT| WS_VISIBLE; | |
7596 else | |
7597 lStyle = DS_MODALFRAME | WS_CAPTION| WS_SYSMENU | WS_VISIBLE; | |
7598 | |
7599 lExtendedStyle = WS_EX_TOOLWINDOW|WS_EX_STATICEDGE; | |
7600 *p++ = LOWORD(lStyle); | |
7601 *p++ = HIWORD(lStyle); | |
7602 *p++ = LOWORD(lExtendedStyle); | |
7603 *p++ = HIWORD(lExtendedStyle); | |
7604 pnumitems = p; /* save where the number of items must be stored */ | |
7605 *p++ = 0; // NumberOfItems(will change later) | |
87 | 7606 gui_mch_getmouse(&x, &y); |
7 | 7607 if (initX == 0xffffL) |
87 | 7608 *p++ = PixelToDialogX(x); // x |
7 | 7609 else |
7610 *p++ = PixelToDialogX(initX); // x | |
7611 if (initY == 0xffffL) | |
87 | 7612 *p++ = PixelToDialogY(y); // y |
7 | 7613 else |
7614 *p++ = PixelToDialogY(initY); // y | |
7615 *p++ = PixelToDialogX(dlgwidth); // cx | |
7616 ptrueheight = p; | |
7617 *p++ = 0; // dialog height: changed later anyway | |
7618 *p++ = 0; // Menu | |
7619 *p++ = 0; // Class | |
7620 | |
7621 /* copy the title of the dialog */ | |
7622 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
|
7623 ? (LPSTR)title |
e9028055f6d6
patch 8.0.1150: MS-Windows GUI: dialog font size is incorrect
Christian Brabandt <cb@256bit.org>
parents:
12513
diff
changeset
|
7624 : (LPSTR)("Vim "VIM_VERSION_MEDIUM)), TRUE); |
7 | 7625 p += nchar; |
7626 | |
7627 if (s_usenewlook) | |
7628 { | |
7629 /* do the font, since DS_3DLOOK doesn't work properly */ | |
7630 #ifdef USE_SYSMENU_FONT | |
7631 if (use_lfSysmenu) | |
7632 { | |
7633 /* point size */ | |
7634 *p++ = -MulDiv(lfSysmenu.lfHeight, 72, | |
7635 GetDeviceCaps(hdc, LOGPIXELSY)); | |
16152
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
7636 wcscpy(p, lfSysmenu.lfFaceName); |
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
7637 nchar = (int)wcslen(lfSysmenu.lfFaceName) + 1; |
7 | 7638 } |
7639 else | |
7640 #endif | |
7641 { | |
7642 *p++ = DLG_FONT_POINT_SIZE; // point size | |
12543
e9028055f6d6
patch 8.0.1150: MS-Windows GUI: dialog font size is incorrect
Christian Brabandt <cb@256bit.org>
parents:
12513
diff
changeset
|
7643 nchar = nCopyAnsiToWideChar(p, DLG_FONT_NAME, FALSE); |
7 | 7644 } |
7645 p += nchar; | |
7646 } | |
7647 | |
7648 /* | |
7649 * Loop over all the items in the menu. | |
7650 * But skip over the tearbar. | |
7651 */ | |
7652 if (STRCMP(menu->children->name, TEAR_STRING) == 0) | |
7653 menu = menu->children->next; | |
7654 else | |
7655 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
|
7656 top_menu = menu; |
7 | 7657 for ( ; menu != NULL; menu = menu->next) |
7658 { | |
7659 if (menu->modes == 0) /* this menu has just been deleted */ | |
7660 continue; | |
7661 if (menu_is_separator(menu->dname)) | |
7662 { | |
7663 sepPadding += 3; | |
7664 continue; | |
7665 } | |
7666 | |
7667 /* Check if there still is plenty of room in the template. Make it | |
7668 * larger when needed. */ | |
7669 if (((char *)p - (char *)pdlgtemplate) + 1000 > template_len) | |
7670 { | |
7671 WORD *newp; | |
7672 | |
7673 newp = (WORD *)LocalAlloc(LPTR, template_len + 4096); | |
7674 if (newp != NULL) | |
7675 { | |
7676 template_len += 4096; | |
7677 mch_memmove(newp, pdlgtemplate, | |
7678 (char *)p - (char *)pdlgtemplate); | |
7679 p = newp + (p - pdlgtemplate); | |
7680 pnumitems = newp + (pnumitems - pdlgtemplate); | |
7681 ptrueheight = newp + (ptrueheight - pdlgtemplate); | |
7682 LocalFree(LocalHandle(pdlgtemplate)); | |
7683 pdlgtemplate = newp; | |
7684 } | |
7685 } | |
7686 | |
7687 /* Figure out minimal length of this menu label. Use "name" for the | |
7688 * actual text, "dname" for estimating the displayed size. "name" | |
7689 * has "&a" for mnemonic and includes the accelerator. */ | |
7690 len = nameLen = (int)STRLEN(menu->name); | |
7691 padding0 = (columnWidths[0] - GetTextWidthEnc(hdc, menu->dname, | |
7692 (int)STRLEN(menu->dname))) / spaceWidth; | |
7693 len += padding0; | |
7694 | |
7695 if (menu->actext != NULL) | |
7696 { | |
7697 acLen = (int)STRLEN(menu->actext); | |
7698 len += acLen; | |
7699 textWidth = GetTextWidthEnc(hdc, menu->actext, acLen); | |
7700 } | |
7701 else | |
7702 textWidth = 0; | |
7703 padding1 = (columnWidths[1] - textWidth) / spaceWidth; | |
7704 len += padding1; | |
7705 | |
7706 if (menu->children == NULL) | |
7707 { | |
7708 padding2 = submenuWidth / spaceWidth; | |
7709 len += padding2; | |
7710 menuID = (WORD)(menu->id); | |
7711 } | |
7712 else | |
7713 { | |
7714 len += (int)STRLEN(TEAROFF_SUBMENU_LABEL); | |
840 | 7715 menuID = (WORD)((long_u)(menu->submenu_id) | (DWORD)0x8000); |
7 | 7716 } |
7717 | |
7718 /* 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
|
7719 text = label = alloc(len + 1); |
7 | 7720 if (label == NULL) |
7721 break; | |
7722 | |
419 | 7723 vim_strncpy(text, menu->name, nameLen); |
7 | 7724 text = vim_strchr(text, TAB); /* stop at TAB before actext */ |
7725 if (text == NULL) | |
7726 text = label + nameLen; /* no actext, use whole name */ | |
7727 while (padding0-- > 0) | |
7728 *text++ = ' '; | |
7729 if (menu->actext != NULL) | |
7730 { | |
7731 STRNCPY(text, menu->actext, acLen); | |
7732 text += acLen; | |
7733 } | |
7734 while (padding1-- > 0) | |
7735 *text++ = ' '; | |
7736 if (menu->children != NULL) | |
7737 { | |
7738 STRCPY(text, TEAROFF_SUBMENU_LABEL); | |
7739 text += STRLEN(TEAROFF_SUBMENU_LABEL); | |
7740 } | |
7741 else | |
7742 { | |
7743 while (padding2-- > 0) | |
7744 *text++ = ' '; | |
7745 } | |
7746 *text = NUL; | |
7747 | |
7748 /* | |
7749 * BS_LEFT will just be ignored on Win32s/NT3.5x - on | |
7750 * W95/NT4 it makes the tear-off look more like a menu. | |
7751 */ | |
7752 p = add_dialog_element(p, | |
7753 BS_PUSHBUTTON|BS_LEFT, | |
7754 (WORD)PixelToDialogX(TEAROFF_PADDING_X), | |
7755 (WORD)(sepPadding + 1 + 13 * (*pnumitems)), | |
7756 (WORD)PixelToDialogX(dlgwidth - 2 * TEAROFF_PADDING_X), | |
7757 (WORD)12, | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
7758 menuID, (WORD)0x0080, (char *)label); |
7 | 7759 vim_free(label); |
7760 (*pnumitems)++; | |
7761 } | |
7762 | |
7763 *ptrueheight = (WORD)(sepPadding + 1 + 13 * (*pnumitems)); | |
7764 | |
7765 | |
7766 /* 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
|
7767 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
|
7768 g_hinst, |
7 | 7769 (LPDLGTEMPLATE)pdlgtemplate, |
7770 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
|
7771 (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
|
7772 (LPARAM)top_menu); |
7 | 7773 |
7774 LocalFree(LocalHandle(pdlgtemplate)); | |
7775 SelectFont(hdc, oldFont); | |
7776 DeleteObject(font); | |
7777 ReleaseDC(hwnd, hdc); | |
7778 | |
7779 /* | |
7780 * Reassert ourselves as the active window. This is so that after creating | |
7781 * a tearoff, the user doesn't have to click with the mouse just to start | |
7782 * typing again! | |
7783 */ | |
7784 (void)SetActiveWindow(s_hwnd); | |
7785 | |
7786 /* make sure the right buttons are enabled */ | |
7787 force_menu_update = TRUE; | |
7788 } | |
7789 #endif | |
7790 | |
7791 #if defined(FEAT_TOOLBAR) || defined(PROTO) | |
7792 #include "gui_w32_rc.h" | |
7793 | |
7794 /* This not defined in older SDKs */ | |
7795 # ifndef TBSTYLE_FLAT | |
7796 # define TBSTYLE_FLAT 0x0800 | |
7797 # endif | |
7798 | |
7799 /* | |
7800 * Create the toolbar, initially unpopulated. | |
7801 * (just like the menu, there are no defaults, it's all | |
7802 * set up through menu.vim) | |
7803 */ | |
7804 static void | |
7805 initialise_toolbar(void) | |
7806 { | |
7807 InitCommonControls(); | |
7808 s_toolbarhwnd = CreateToolbarEx( | |
7809 s_hwnd, | |
7810 WS_CHILD | TBSTYLE_TOOLTIPS | TBSTYLE_FLAT, | |
7811 4000, //any old big number | |
1213 | 7812 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
|
7813 g_hinst, |
7 | 7814 IDR_TOOLBAR1, // id of initial bitmap |
7815 NULL, | |
7816 0, // initial number of buttons | |
7817 TOOLBAR_BUTTON_WIDTH, //api guide is wrong! | |
7818 TOOLBAR_BUTTON_HEIGHT, | |
7819 TOOLBAR_BUTTON_WIDTH, | |
7820 TOOLBAR_BUTTON_HEIGHT, | |
7821 sizeof(TBBUTTON) | |
7822 ); | |
5223
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
7823 s_toolbar_wndproc = SubclassWindow(s_toolbarhwnd, toolbar_wndproc); |
7 | 7824 |
7825 gui_mch_show_toolbar(vim_strchr(p_go, GO_TOOLBAR) != NULL); | |
7826 } | |
7827 | |
5223
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
7828 static LRESULT CALLBACK |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
7829 toolbar_wndproc( |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
7830 HWND hwnd, |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
7831 UINT uMsg, |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
7832 WPARAM wParam, |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
7833 LPARAM lParam) |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
7834 { |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
7835 HandleMouseHide(uMsg, lParam); |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
7836 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
|
7837 } |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
7838 |
7 | 7839 static int |
7840 get_toolbar_bitmap(vimmenu_T *menu) | |
7841 { | |
7842 int i = -1; | |
7843 | |
7844 /* | |
7845 * Check user bitmaps first, unless builtin is specified. | |
7846 */ | |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7847 if (!menu->icon_builtin) |
7 | 7848 { |
7849 char_u fname[MAXPATHL]; | |
7850 HANDLE hbitmap = NULL; | |
7851 | |
7852 if (menu->iconfile != NULL) | |
7853 { | |
7854 gui_find_iconfile(menu->iconfile, fname, "bmp"); | |
7855 hbitmap = LoadImage( | |
7856 NULL, | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
7857 (LPCSTR)fname, |
7 | 7858 IMAGE_BITMAP, |
7859 TOOLBAR_BUTTON_WIDTH, | |
7860 TOOLBAR_BUTTON_HEIGHT, | |
7861 LR_LOADFROMFILE | | |
7862 LR_LOADMAP3DCOLORS | |
7863 ); | |
7864 } | |
7865 | |
7866 /* | |
7867 * If the LoadImage call failed, or the "icon=" file | |
7868 * didn't exist or wasn't specified, try the menu name | |
7869 */ | |
7870 if (hbitmap == NULL | |
5020
5eff37e92f03
updated for version 7.3.1254
Bram Moolenaar <bram@vim.org>
parents:
5016
diff
changeset
|
7871 && (gui_find_bitmap( |
5eff37e92f03
updated for version 7.3.1254
Bram Moolenaar <bram@vim.org>
parents:
5016
diff
changeset
|
7872 #ifdef FEAT_MULTI_LANG |
5eff37e92f03
updated for version 7.3.1254
Bram Moolenaar <bram@vim.org>
parents:
5016
diff
changeset
|
7873 menu->en_dname != NULL ? menu->en_dname : |
5eff37e92f03
updated for version 7.3.1254
Bram Moolenaar <bram@vim.org>
parents:
5016
diff
changeset
|
7874 #endif |
5eff37e92f03
updated for version 7.3.1254
Bram Moolenaar <bram@vim.org>
parents:
5016
diff
changeset
|
7875 menu->dname, fname, "bmp") == OK)) |
7 | 7876 hbitmap = LoadImage( |
7877 NULL, | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
7878 (LPCSTR)fname, |
7 | 7879 IMAGE_BITMAP, |
7880 TOOLBAR_BUTTON_WIDTH, | |
7881 TOOLBAR_BUTTON_HEIGHT, | |
7882 LR_LOADFROMFILE | | |
7883 LR_LOADMAP3DCOLORS | |
7884 ); | |
7885 | |
7886 if (hbitmap != NULL) | |
7887 { | |
7888 TBADDBITMAP tbAddBitmap; | |
7889 | |
7890 tbAddBitmap.hInst = NULL; | |
840 | 7891 tbAddBitmap.nID = (long_u)hbitmap; |
7 | 7892 |
7893 i = (int)SendMessage(s_toolbarhwnd, TB_ADDBITMAP, | |
7894 (WPARAM)1, (LPARAM)&tbAddBitmap); | |
7895 /* i will be set to -1 if it fails */ | |
7896 } | |
7897 } | |
7898 if (i == -1 && menu->iconidx >= 0 && menu->iconidx < TOOLBAR_BITMAP_COUNT) | |
7899 i = menu->iconidx; | |
7900 | |
7901 return i; | |
7902 } | |
7903 #endif | |
7904 | |
810 | 7905 #if defined(FEAT_GUI_TABLINE) || defined(PROTO) |
7906 static void | |
7907 initialise_tabline(void) | |
7908 { | |
7909 InitCommonControls(); | |
7910 | |
819 | 7911 s_tabhwnd = CreateWindow(WC_TABCONTROL, "Vim tabline", |
840 | 7912 WS_CHILD|TCS_FOCUSNEVER|TCS_TOOLTIPS, |
810 | 7913 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
|
7914 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
|
7915 s_tabline_wndproc = SubclassWindow(s_tabhwnd, tabline_wndproc); |
819 | 7916 |
843 | 7917 gui.tabline_height = TABLINE_HEIGHT; |
7918 | |
819 | 7919 # ifdef USE_SYSMENU_FONT |
843 | 7920 set_tabline_font(); |
819 | 7921 # endif |
810 | 7922 } |
5223
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
7923 |
12666
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7924 /* |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7925 * 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
|
7926 */ |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7927 static tabpage_T * |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7928 GetTabFromPoint( |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7929 HWND hWnd, |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7930 POINT pt) |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7931 { |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7932 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
|
7933 |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7934 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
|
7935 { |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7936 TCHITTESTINFO htinfo; |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7937 htinfo.pt = pt; |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7938 /* ignore if a window under cusor is not tabcontrol. */ |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7939 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
|
7940 { |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7941 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
|
7942 if (idx != -1) |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7943 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
|
7944 } |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7945 } |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7946 return ptp; |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7947 } |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7948 |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7949 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
|
7950 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
|
7951 |
5223
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
7952 static LRESULT CALLBACK |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
7953 tabline_wndproc( |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
7954 HWND hwnd, |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
7955 UINT uMsg, |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
7956 WPARAM wParam, |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
7957 LPARAM lParam) |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
7958 { |
12666
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7959 POINT pt; |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7960 tabpage_T *tp; |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7961 RECT rect; |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7962 int nCenter; |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7963 int idx0; |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7964 int idx1; |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7965 |
5223
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
7966 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
|
7967 |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7968 switch (uMsg) |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7969 { |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7970 case WM_LBUTTONDOWN: |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7971 { |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7972 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
|
7973 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
|
7974 SetCapture(hwnd); |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7975 s_hCursor = GetCursor(); /* backup default cursor */ |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7976 break; |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7977 } |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7978 case WM_MOUSEMOVE: |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7979 if (GetCapture() == hwnd |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7980 && ((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
|
7981 { |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7982 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
|
7983 pt.y = s_pt.y; |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7984 if (abs(pt.x - s_pt.x) > GetSystemMetrics(SM_CXDRAG)) |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7985 { |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7986 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
|
7987 |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7988 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
|
7989 if (tp != NULL) |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7990 { |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7991 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
|
7992 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
|
7993 |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7994 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
|
7995 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
|
7996 |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7997 /* Check if the mouse cursor goes over the center of |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7998 * the next tab to prevent "flickering". */ |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
7999 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
|
8000 { |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8001 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
|
8002 update_screen(0); |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8003 } |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8004 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
|
8005 { |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8006 tabpage_move(idx1); |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8007 update_screen(0); |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8008 } |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8009 } |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8010 } |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8011 } |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8012 break; |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8013 case WM_LBUTTONUP: |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8014 { |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8015 if (GetCapture() == hwnd) |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8016 { |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8017 SetCursor(s_hCursor); |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8018 ReleaseCapture(); |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8019 } |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8020 break; |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8021 } |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8022 default: |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8023 break; |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8024 } |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8025 |
5223
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8026 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
|
8027 } |
810 | 8028 #endif |
8029 | |
7 | 8030 #if defined(FEAT_OLE) || defined(FEAT_EVAL) || defined(PROTO) |
8031 /* | |
8032 * Make the GUI window come to the foreground. | |
8033 */ | |
8034 void | |
8035 gui_mch_set_foreground(void) | |
8036 { | |
8037 if (IsIconic(s_hwnd)) | |
8038 SendMessage(s_hwnd, WM_SYSCOMMAND, SC_RESTORE, 0); | |
8039 SetForegroundWindow(s_hwnd); | |
8040 } | |
8041 #endif | |
8042 | |
8043 #if defined(FEAT_MBYTE_IME) && defined(DYNAMIC_IME) | |
8044 static void | |
8045 dyn_imm_load(void) | |
8046 { | |
2612 | 8047 hLibImm = vimLoadLib("imm32.dll"); |
7 | 8048 if (hLibImm == NULL) |
8049 return; | |
8050 | |
8051 pImmGetCompositionStringA | |
8052 = (void *)GetProcAddress(hLibImm, "ImmGetCompositionStringA"); | |
8053 pImmGetCompositionStringW | |
8054 = (void *)GetProcAddress(hLibImm, "ImmGetCompositionStringW"); | |
8055 pImmGetContext | |
8056 = (void *)GetProcAddress(hLibImm, "ImmGetContext"); | |
8057 pImmAssociateContext | |
8058 = (void *)GetProcAddress(hLibImm, "ImmAssociateContext"); | |
8059 pImmReleaseContext | |
8060 = (void *)GetProcAddress(hLibImm, "ImmReleaseContext"); | |
8061 pImmGetOpenStatus | |
8062 = (void *)GetProcAddress(hLibImm, "ImmGetOpenStatus"); | |
8063 pImmSetOpenStatus | |
8064 = (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
|
8065 pImmGetCompositionFontW |
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
8066 = (void *)GetProcAddress(hLibImm, "ImmGetCompositionFontW"); |
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
8067 pImmSetCompositionFontW |
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
8068 = (void *)GetProcAddress(hLibImm, "ImmSetCompositionFontW"); |
7 | 8069 pImmSetCompositionWindow |
8070 = (void *)GetProcAddress(hLibImm, "ImmSetCompositionWindow"); | |
8071 pImmGetConversionStatus | |
8072 = (void *)GetProcAddress(hLibImm, "ImmGetConversionStatus"); | |
777 | 8073 pImmSetConversionStatus |
8074 = (void *)GetProcAddress(hLibImm, "ImmSetConversionStatus"); | |
7 | 8075 |
8076 if ( pImmGetCompositionStringA == NULL | |
8077 || pImmGetCompositionStringW == NULL | |
8078 || pImmGetContext == NULL | |
8079 || pImmAssociateContext == NULL | |
8080 || pImmReleaseContext == NULL | |
8081 || pImmGetOpenStatus == NULL | |
8082 || pImmSetOpenStatus == NULL | |
16152
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
8083 || pImmGetCompositionFontW == NULL |
8f4eccaaf2c0
patch 8.1.1081: MS-Windows: cannot use some fonts
Bram Moolenaar <Bram@vim.org>
parents:
16123
diff
changeset
|
8084 || pImmSetCompositionFontW == NULL |
7 | 8085 || pImmSetCompositionWindow == NULL |
777 | 8086 || pImmGetConversionStatus == NULL |
8087 || pImmSetConversionStatus == NULL) | |
7 | 8088 { |
8089 FreeLibrary(hLibImm); | |
8090 hLibImm = NULL; | |
8091 pImmGetContext = NULL; | |
8092 return; | |
8093 } | |
8094 | |
8095 return; | |
8096 } | |
8097 | |
8098 #endif | |
8099 | |
8100 #if defined(FEAT_SIGN_ICONS) || defined(PROTO) | |
8101 | |
8102 # ifdef FEAT_XPM_W32 | |
8103 # define IMAGE_XPM 100 | |
8104 # endif | |
8105 | |
8106 typedef struct _signicon_t | |
8107 { | |
8108 HANDLE hImage; | |
8109 UINT uType; | |
8110 #ifdef FEAT_XPM_W32 | |
8111 HANDLE hShape; /* Mask bitmap handle */ | |
8112 #endif | |
8113 } signicon_t; | |
8114 | |
8115 void | |
7823
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8116 gui_mch_drawsign(int row, int col, int typenr) |
7 | 8117 { |
8118 signicon_t *sign; | |
8119 int x, y, w, h; | |
8120 | |
8121 if (!gui.in_use || (sign = (signicon_t *)sign_get_image(typenr)) == NULL) | |
8122 return; | |
8123 | |
12934
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
8124 #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
|
8125 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
|
8126 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
|
8127 #endif |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
8128 |
7 | 8129 x = TEXT_X(col); |
8130 y = TEXT_Y(row); | |
8131 w = gui.char_width * 2; | |
8132 h = gui.char_height; | |
8133 switch (sign->uType) | |
8134 { | |
8135 case IMAGE_BITMAP: | |
8136 { | |
8137 HDC hdcMem; | |
8138 HBITMAP hbmpOld; | |
8139 | |
8140 hdcMem = CreateCompatibleDC(s_hdc); | |
8141 hbmpOld = (HBITMAP)SelectObject(hdcMem, sign->hImage); | |
8142 BitBlt(s_hdc, x, y, w, h, hdcMem, 0, 0, SRCCOPY); | |
8143 SelectObject(hdcMem, hbmpOld); | |
8144 DeleteDC(hdcMem); | |
8145 } | |
8146 break; | |
8147 case IMAGE_ICON: | |
8148 case IMAGE_CURSOR: | |
8149 DrawIconEx(s_hdc, x, y, (HICON)sign->hImage, w, h, 0, NULL, DI_NORMAL); | |
8150 break; | |
8151 #ifdef FEAT_XPM_W32 | |
8152 case IMAGE_XPM: | |
8153 { | |
8154 HDC hdcMem; | |
8155 HBITMAP hbmpOld; | |
8156 | |
8157 hdcMem = CreateCompatibleDC(s_hdc); | |
8158 hbmpOld = (HBITMAP)SelectObject(hdcMem, sign->hShape); | |
8159 /* Make hole */ | |
8160 BitBlt(s_hdc, x, y, w, h, hdcMem, 0, 0, SRCAND); | |
8161 | |
8162 SelectObject(hdcMem, sign->hImage); | |
8163 /* Paint sign */ | |
8164 BitBlt(s_hdc, x, y, w, h, hdcMem, 0, 0, SRCPAINT); | |
8165 SelectObject(hdcMem, hbmpOld); | |
8166 DeleteDC(hdcMem); | |
8167 } | |
8168 break; | |
8169 #endif | |
8170 } | |
8171 } | |
8172 | |
8173 static void | |
8174 close_signicon_image(signicon_t *sign) | |
8175 { | |
8176 if (sign) | |
8177 switch (sign->uType) | |
8178 { | |
8179 case IMAGE_BITMAP: | |
8180 DeleteObject((HGDIOBJ)sign->hImage); | |
8181 break; | |
8182 case IMAGE_CURSOR: | |
8183 DestroyCursor((HCURSOR)sign->hImage); | |
8184 break; | |
8185 case IMAGE_ICON: | |
8186 DestroyIcon((HICON)sign->hImage); | |
8187 break; | |
8188 #ifdef FEAT_XPM_W32 | |
8189 case IMAGE_XPM: | |
8190 DeleteObject((HBITMAP)sign->hImage); | |
8191 DeleteObject((HBITMAP)sign->hShape); | |
8192 break; | |
8193 #endif | |
8194 } | |
8195 } | |
8196 | |
8197 void * | |
7823
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8198 gui_mch_register_sign(char_u *signfile) |
7 | 8199 { |
8200 signicon_t sign, *psign; | |
8201 char_u *ext; | |
8202 | |
8203 sign.hImage = NULL; | |
4352 | 8204 ext = signfile + STRLEN(signfile) - 4; /* get extension */ |
7 | 8205 if (ext > signfile) |
8206 { | |
8207 int do_load = 1; | |
8208 | |
8209 if (!STRICMP(ext, ".bmp")) | |
8210 sign.uType = IMAGE_BITMAP; | |
8211 else if (!STRICMP(ext, ".ico")) | |
8212 sign.uType = IMAGE_ICON; | |
8213 else if (!STRICMP(ext, ".cur") || !STRICMP(ext, ".ani")) | |
8214 sign.uType = IMAGE_CURSOR; | |
8215 else | |
8216 do_load = 0; | |
8217 | |
8218 if (do_load) | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
8219 sign.hImage = (HANDLE)LoadImage(NULL, (LPCSTR)signfile, sign.uType, |
7 | 8220 gui.char_width * 2, gui.char_height, |
8221 LR_LOADFROMFILE | LR_CREATEDIBSECTION); | |
8222 #ifdef FEAT_XPM_W32 | |
8223 if (!STRICMP(ext, ".xpm")) | |
8224 { | |
8225 sign.uType = IMAGE_XPM; | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
8226 LoadXpmImage((char *)signfile, (HBITMAP *)&sign.hImage, |
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
8227 (HBITMAP *)&sign.hShape); |
7 | 8228 } |
8229 #endif | |
8230 } | |
8231 | |
8232 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
|
8233 if (sign.hImage && (psign = ALLOC_ONE(signicon_t)) != NULL) |
7 | 8234 *psign = sign; |
8235 | |
8236 if (!psign) | |
8237 { | |
8238 if (sign.hImage) | |
8239 close_signicon_image(&sign); | |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15288
diff
changeset
|
8240 emsg(_(e_signdata)); |
7 | 8241 } |
8242 return (void *)psign; | |
8243 | |
8244 } | |
8245 | |
8246 void | |
7823
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8247 gui_mch_destroy_sign(void *sign) |
7 | 8248 { |
8249 if (sign) | |
8250 { | |
8251 close_signicon_image((signicon_t *)sign); | |
8252 vim_free(sign); | |
8253 } | |
8254 } | |
293 | 8255 #endif |
7 | 8256 |
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
|
8257 #if defined(FEAT_BEVAL_GUI) || defined(PROTO) |
7 | 8258 |
8259 /* BALLOON-EVAL IMPLEMENTATION FOR WINDOWS. | |
148 | 8260 * Added by Sergey Khorev <sergey.khorev@gmail.com> |
7 | 8261 * |
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
|
8262 * The only reused thing is beval.h and get_beval_info() |
7 | 8263 * from gui_beval.c (note it uses x and y of the BalloonEval struct |
8264 * to get current mouse position). | |
8265 * | |
8266 * Trying to use as more Windows services as possible, and as less | |
8267 * IE version as possible :)). | |
8268 * | |
8269 * 1) Don't create ToolTip in gui_mch_create_beval_area, only initialize | |
8270 * BalloonEval struct. | |
8271 * 2) Enable/Disable simply create/kill BalloonEval Timer | |
8272 * 3) When there was enough inactivity, timer procedure posts | |
8273 * async request to debugger | |
8274 * 4) gui_mch_post_balloon (invoked from netbeans.c) creates tooltip control | |
8275 * and performs some actions to show it ASAP | |
1621 | 8276 * 5) WM_NOTIFY:TTN_POP destroys created tooltip |
7 | 8277 */ |
8278 | |
435 | 8279 /* |
8280 * determine whether installed Common Controls support multiline tooltips | |
8281 * (i.e. their version is >= 4.70 | |
8282 */ | |
8283 int | |
8284 multiline_balloon_available(void) | |
8285 { | |
8286 HINSTANCE hDll; | |
8287 static char comctl_dll[] = "comctl32.dll"; | |
8288 static int multiline_tip = MAYBE; | |
8289 | |
8290 if (multiline_tip != MAYBE) | |
8291 return multiline_tip; | |
8292 | |
8293 hDll = GetModuleHandle(comctl_dll); | |
8294 if (hDll != NULL) | |
8295 { | |
856 | 8296 DLLGETVERSIONPROC pGetVer; |
8297 pGetVer = (DLLGETVERSIONPROC)GetProcAddress(hDll, "DllGetVersion"); | |
8298 | |
8299 if (pGetVer != NULL) | |
8300 { | |
8301 DLLVERSIONINFO dvi; | |
8302 HRESULT hr; | |
8303 | |
8304 ZeroMemory(&dvi, sizeof(dvi)); | |
8305 dvi.cbSize = sizeof(dvi); | |
8306 | |
8307 hr = (*pGetVer)(&dvi); | |
8308 | |
8309 if (SUCCEEDED(hr) | |
435 | 8310 && (dvi.dwMajorVersion > 4 |
856 | 8311 || (dvi.dwMajorVersion == 4 |
8312 && dvi.dwMinorVersion >= 70))) | |
435 | 8313 { |
8314 multiline_tip = TRUE; | |
8315 return multiline_tip; | |
8316 } | |
856 | 8317 } |
435 | 8318 else |
8319 { | |
8320 /* there is chance we have ancient CommCtl 4.70 | |
8321 which doesn't export DllGetVersion */ | |
8322 DWORD dwHandle = 0; | |
8323 DWORD len = GetFileVersionInfoSize(comctl_dll, &dwHandle); | |
8324 if (len > 0) | |
8325 { | |
8326 VS_FIXEDFILEINFO *ver; | |
8327 UINT vlen = 0; | |
8328 void *data = alloc(len); | |
8329 | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
8330 if ((data != NULL |
435 | 8331 && GetFileVersionInfo(comctl_dll, 0, len, data) |
8332 && VerQueryValue(data, "\\", (void **)&ver, &vlen) | |
8333 && vlen | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
8334 && HIWORD(ver->dwFileVersionMS) > 4) |
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
8335 || ((HIWORD(ver->dwFileVersionMS) == 4 |
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
8336 && LOWORD(ver->dwFileVersionMS) >= 70))) |
435 | 8337 { |
8338 vim_free(data); | |
8339 multiline_tip = TRUE; | |
8340 return multiline_tip; | |
8341 } | |
8342 vim_free(data); | |
8343 } | |
8344 } | |
8345 } | |
8346 multiline_tip = FALSE; | |
8347 return multiline_tip; | |
8348 } | |
8349 | |
15277
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8350 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
|
8351 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
|
8352 { |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8353 TOOLINFOW *pti; |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8354 int ToolInfoSize; |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8355 |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8356 if (multiline_balloon_available() == TRUE) |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8357 ToolInfoSize = sizeof(TOOLINFOW_NEW); |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8358 else |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8359 ToolInfoSize = sizeof(TOOLINFOW); |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8360 |
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
|
8361 pti = alloc(ToolInfoSize); |
15277
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8362 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
|
8363 return; |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8364 |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8365 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
|
8366 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
|
8367 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
|
8368 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
|
8369 |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8370 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
|
8371 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
|
8372 |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8373 pti->cbSize = ToolInfoSize; |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8374 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
|
8375 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
|
8376 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
|
8377 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
|
8378 |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8379 if (multiline_balloon_available() == TRUE) |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8380 { |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8381 RECT rect; |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8382 TOOLINFOW_NEW *ptin = (TOOLINFOW_NEW *)pti; |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8383 pti->lpszText = LPSTR_TEXTCALLBACKW; |
15288
e3dfd25b0679
patch 8.1.0652: freeing memory for balloon eval too early
Bram Moolenaar <Bram@vim.org>
parents:
15277
diff
changeset
|
8384 beval->tofree = enc_to_utf16((char_u*)text, NULL); |
e3dfd25b0679
patch 8.1.0652: freeing memory for balloon eval too early
Bram Moolenaar <Bram@vim.org>
parents:
15277
diff
changeset
|
8385 ptin->lParam = (LPARAM)beval->tofree; |
15277
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8386 // switch multiline tooltips on |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8387 if (GetClientRect(s_textArea, &rect)) |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8388 SendMessageW(beval->balloon, TTM_SETMAXTIPWIDTH, 0, |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8389 (LPARAM)rect.right); |
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 else |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8392 { |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8393 // do this old way |
15288
e3dfd25b0679
patch 8.1.0652: freeing memory for balloon eval too early
Bram Moolenaar <Bram@vim.org>
parents:
15277
diff
changeset
|
8394 beval->tofree = enc_to_utf16((char_u*)text, NULL); |
e3dfd25b0679
patch 8.1.0652: freeing memory for balloon eval too early
Bram Moolenaar <Bram@vim.org>
parents:
15277
diff
changeset
|
8395 pti->lpszText = (LPWSTR)beval->tofree; |
15277
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8396 } |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8397 |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8398 // 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
|
8399 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
|
8400 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
|
8401 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
|
8402 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
|
8403 |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8404 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
|
8405 // 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
|
8406 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
|
8407 // 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
|
8408 // 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
|
8409 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
|
8410 /* |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8411 * 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
|
8412 * 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
|
8413 * 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
|
8414 */ |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8415 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
|
8416 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
|
8417 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
|
8418 } |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8419 |
7 | 8420 static void |
7823
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8421 delete_tooltip(BalloonEval *beval) |
7 | 8422 { |
7056
1ebd7608cfd9
commit https://github.com/vim/vim/commit/8e5f5b47c2198ffa4161c21a4140eaa9bed46f37
Christian Brabandt <cb@256bit.org>
parents:
7032
diff
changeset
|
8423 PostMessage(beval->balloon, WM_CLOSE, 0, 0); |
7 | 8424 } |
8425 | |
8426 static VOID CALLBACK | |
7823
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8427 BevalTimerProc( |
10783
04eb70c77cf4
patch 8.0.0281: some files are still using ARGSUSED instead of UNUSED
Christian Brabandt <cb@256bit.org>
parents:
10440
diff
changeset
|
8428 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
|
8429 UINT uMsg UNUSED, |
04eb70c77cf4
patch 8.0.0281: some files are still using ARGSUSED instead of UNUSED
Christian Brabandt <cb@256bit.org>
parents:
10440
diff
changeset
|
8430 UINT_PTR idEvent UNUSED, |
04eb70c77cf4
patch 8.0.0281: some files are still using ARGSUSED instead of UNUSED
Christian Brabandt <cb@256bit.org>
parents:
10440
diff
changeset
|
8431 DWORD dwTime) |
7 | 8432 { |
8433 POINT pt; | |
8434 RECT rect; | |
8435 | |
8436 if (cur_beval == NULL || cur_beval->showState == ShS_SHOWING || !p_beval) | |
8437 return; | |
8438 | |
8439 GetCursorPos(&pt); | |
8440 if (WindowFromPoint(pt) != s_textArea) | |
8441 return; | |
8442 | |
8443 ScreenToClient(s_textArea, &pt); | |
8444 GetClientRect(s_textArea, &rect); | |
8445 if (!PtInRect(&rect, pt)) | |
8446 return; | |
8447 | |
8448 if (LastActivity > 0 | |
8449 && (dwTime - LastActivity) >= (DWORD)p_bdlay | |
8450 && (cur_beval->showState != ShS_PENDING | |
8451 || abs(cur_beval->x - pt.x) > 3 | |
8452 || abs(cur_beval->y - pt.y) > 3)) | |
8453 { | |
8454 /* Pointer resting in one place long enough, it's time to show | |
8455 * the tooltip. */ | |
8456 cur_beval->showState = ShS_PENDING; | |
8457 cur_beval->x = pt.x; | |
8458 cur_beval->y = pt.y; | |
8459 | |
205 | 8460 // TRACE0("BevalTimerProc: sending request"); |
7 | 8461 |
8462 if (cur_beval->msgCB != NULL) | |
8463 (*cur_beval->msgCB)(cur_beval, 0); | |
8464 } | |
8465 } | |
8466 | |
8467 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
|
8468 gui_mch_disable_beval_area(BalloonEval *beval UNUSED) |
7 | 8469 { |
205 | 8470 // TRACE0("gui_mch_disable_beval_area {{{"); |
7 | 8471 KillTimer(s_textArea, BevalTimerId); |
205 | 8472 // TRACE0("gui_mch_disable_beval_area }}}"); |
7 | 8473 } |
8474 | |
8475 void | |
7823
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8476 gui_mch_enable_beval_area(BalloonEval *beval) |
7 | 8477 { |
205 | 8478 // TRACE0("gui_mch_enable_beval_area |||"); |
7 | 8479 if (beval == NULL) |
8480 return; | |
205 | 8481 // TRACE0("gui_mch_enable_beval_area {{{"); |
2224
a0cce15dd2a9
Fix definition of UINT_PTR for 64 bit systems.
Bram Moolenaar <bram@vim.org>
parents:
2217
diff
changeset
|
8482 BevalTimerId = SetTimer(s_textArea, 0, (UINT)(p_bdlay / 2), BevalTimerProc); |
205 | 8483 // TRACE0("gui_mch_enable_beval_area }}}"); |
7 | 8484 } |
8485 | |
8486 void | |
7823
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8487 gui_mch_post_balloon(BalloonEval *beval, char_u *mesg) |
7 | 8488 { |
8489 POINT pt; | |
11129
f4ea50924c6d
patch 8.0.0452: some macros are in lower case
Christian Brabandt <cb@256bit.org>
parents:
10783
diff
changeset
|
8490 |
16600
ff3c99bd1038
patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents:
16596
diff
changeset
|
8491 vim_free(beval->msg); |
ff3c99bd1038
patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents:
16596
diff
changeset
|
8492 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
|
8493 if (beval->msg == NULL) |
ff3c99bd1038
patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents:
16596
diff
changeset
|
8494 { |
ff3c99bd1038
patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents:
16596
diff
changeset
|
8495 delete_tooltip(beval); |
ff3c99bd1038
patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents:
16596
diff
changeset
|
8496 beval->showState = ShS_NEUTRAL; |
ff3c99bd1038
patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents:
16596
diff
changeset
|
8497 return; |
ff3c99bd1038
patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents:
16596
diff
changeset
|
8498 } |
ff3c99bd1038
patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents:
16596
diff
changeset
|
8499 |
205 | 8500 // TRACE0("gui_mch_post_balloon {{{"); |
7 | 8501 if (beval->showState == ShS_SHOWING) |
8502 return; | |
8503 GetCursorPos(&pt); | |
8504 ScreenToClient(s_textArea, &pt); | |
8505 | |
8506 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
|
8507 { |
7 | 8508 /* cursor is still here */ |
8509 gui_mch_disable_beval_area(cur_beval); | |
8510 beval->showState = ShS_SHOWING; | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
8511 make_tooltip(beval, (char *)mesg, pt); |
7 | 8512 } |
205 | 8513 // TRACE0("gui_mch_post_balloon }}}"); |
7 | 8514 } |
8515 | |
8516 BalloonEval * | |
7823
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8517 gui_mch_create_beval_area( |
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8518 void *target, /* ignored, always use s_textArea */ |
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8519 char_u *mesg, |
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8520 void (*mesgCB)(BalloonEval *, int), |
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8521 void *clientData) |
7 | 8522 { |
8523 /* partially stolen from gui_beval.c */ | |
8524 BalloonEval *beval; | |
8525 | |
8526 if (mesg != NULL && mesgCB != NULL) | |
8527 { | |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15288
diff
changeset
|
8528 iemsg(_("E232: Cannot create BalloonEval with both message and callback")); |
7 | 8529 return NULL; |
8530 } | |
8531 | |
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
|
8532 beval = ALLOC_CLEAR_ONE(BalloonEval); |
7 | 8533 if (beval != NULL) |
8534 { | |
8535 beval->target = s_textArea; | |
8536 | |
8537 beval->showState = ShS_NEUTRAL; | |
8538 beval->msg = mesg; | |
8539 beval->msgCB = mesgCB; | |
8540 beval->clientData = clientData; | |
8541 | |
8542 InitCommonControls(); | |
8543 cur_beval = beval; | |
8544 | |
8545 if (p_beval) | |
8546 gui_mch_enable_beval_area(beval); | |
8547 } | |
8548 return beval; | |
8549 } | |
8550 | |
8551 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
|
8552 Handle_WM_Notify(HWND hwnd UNUSED, LPNMHDR pnmh) |
7 | 8553 { |
8554 if (pnmh->idFrom != ID_BEVAL_TOOLTIP) /* it is not our tooltip */ | |
8555 return; | |
8556 | |
8557 if (cur_beval != NULL) | |
8558 { | |
435 | 8559 switch (pnmh->code) |
7 | 8560 { |
435 | 8561 case TTN_SHOW: |
205 | 8562 // TRACE0("TTN_SHOW {{{"); |
8563 // TRACE0("TTN_SHOW }}}"); | |
435 | 8564 break; |
8565 case TTN_POP: /* Before tooltip disappear */ | |
205 | 8566 // TRACE0("TTN_POP {{{"); |
7 | 8567 delete_tooltip(cur_beval); |
8568 gui_mch_enable_beval_area(cur_beval); | |
205 | 8569 // TRACE0("TTN_POP }}}"); |
7 | 8570 |
8571 cur_beval->showState = ShS_NEUTRAL; | |
435 | 8572 break; |
8573 case TTN_GETDISPINFO: | |
1481 | 8574 { |
8575 /* if you get there then we have new common controls */ | |
8576 NMTTDISPINFO_NEW *info = (NMTTDISPINFO_NEW *)pnmh; | |
8577 info->lpszText = (LPSTR)info->lParam; | |
8578 info->uFlags |= TTF_DI_SETITEM; | |
8579 } | |
435 | 8580 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
|
8581 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
|
8582 { |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8583 // if we get here then we have new common controls |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8584 NMTTDISPINFOW_NEW *info = (NMTTDISPINFOW_NEW *)pnmh; |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8585 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
|
8586 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
|
8587 } |
71b762af30c3
patch 8.1.0647: MS-Windows: balloon_show() does not handle wide characters
Bram Moolenaar <Bram@vim.org>
parents:
15034
diff
changeset
|
8588 break; |
7 | 8589 } |
8590 } | |
8591 } | |
8592 | |
8593 static void | |
8594 TrackUserActivity(UINT uMsg) | |
8595 { | |
8596 if ((uMsg >= WM_MOUSEFIRST && uMsg <= WM_MOUSELAST) | |
8597 || (uMsg >= WM_KEYFIRST && uMsg <= WM_KEYLAST)) | |
8598 LastActivity = GetTickCount(); | |
8599 } | |
8600 | |
8601 void | |
7823
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8602 gui_mch_destroy_beval_area(BalloonEval *beval) |
7 | 8603 { |
14175
2ad722003b36
patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
14124
diff
changeset
|
8604 #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
|
8605 vim_free(beval->vts); |
e3dfd25b0679
patch 8.1.0652: freeing memory for balloon eval too early
Bram Moolenaar <Bram@vim.org>
parents:
15277
diff
changeset
|
8606 #endif |
e3dfd25b0679
patch 8.1.0652: freeing memory for balloon eval too early
Bram Moolenaar <Bram@vim.org>
parents:
15277
diff
changeset
|
8607 vim_free(beval->tofree); |
7 | 8608 vim_free(beval); |
8609 } | |
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
|
8610 #endif /* FEAT_BEVAL_GUI */ |
7 | 8611 |
8612 #if defined(FEAT_NETBEANS_INTG) || defined(PROTO) | |
8613 /* | |
8614 * We have multiple signs to draw at the same location. Draw the | |
8615 * multi-sign indicator (down-arrow) instead. This is the Win32 version. | |
8616 */ | |
8617 void | |
8618 netbeans_draw_multisign_indicator(int row) | |
8619 { | |
8620 int i; | |
8621 int y; | |
8622 int x; | |
8623 | |
2210 | 8624 if (!netbeans_active()) |
2311
ccda151dde4e
Support completion for ":find". (Nazri Ramliy)
Bram Moolenaar <bram@vim.org>
parents:
2224
diff
changeset
|
8625 return; |
2210 | 8626 |
7 | 8627 x = 0; |
8628 y = TEXT_Y(row); | |
8629 | |
12934
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
8630 #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
|
8631 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
|
8632 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
|
8633 #endif |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
8634 |
7 | 8635 for (i = 0; i < gui.char_height - 3; i++) |
8636 SetPixel(s_hdc, x+2, y++, gui.currFgColor); | |
8637 | |
8638 SetPixel(s_hdc, x+0, y, gui.currFgColor); | |
8639 SetPixel(s_hdc, x+2, y, gui.currFgColor); | |
8640 SetPixel(s_hdc, x+4, y++, gui.currFgColor); | |
8641 SetPixel(s_hdc, x+1, y, gui.currFgColor); | |
8642 SetPixel(s_hdc, x+2, y, gui.currFgColor); | |
8643 SetPixel(s_hdc, x+3, y++, gui.currFgColor); | |
8644 SetPixel(s_hdc, x+2, y, gui.currFgColor); | |
8645 } | |
7743
6069f43cea4e
commit https://github.com/vim/vim/commit/e0874f8cbcddfcf9965a85ba35199964efb1d01a
Christian Brabandt <cb@256bit.org>
parents:
7560
diff
changeset
|
8646 #endif |