Mercurial > vim
annotate src/gui_w32.c @ 13738:1d8601bdd6e6 v8.0.1741
patch 8.0.1741: MS-Windows with msys2 cannot build Ruby statically
commit https://github.com/vim/vim/commit/259a90f7ce4d6d983a7fe5461da88cc52c46d9fe
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Apr 21 19:08:55 2018 +0200
patch 8.0.1741: MS-Windows with msys2 cannot build Ruby statically
Problem: MS-Windows with msys2 cannot build Ruby statically.
Solution: Add RUBY_VERSION to CFLAGS later. (Gray Wolf, closes https://github.com/vim/vim/issues/2833)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 21 Apr 2018 19:15:05 +0200 |
parents | ac42c4b11dbc |
children | 74294f0fbf28 |
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) |
13028
cfce9ac1d1e8
patch 8.0.1390: DirectX scrolling can be slow, vertical positioning is off
Christian Brabandt <cb@256bit.org>
parents:
12994
diff
changeset
|
33 # ifndef FEAT_MBYTE |
cfce9ac1d1e8
patch 8.0.1390: DirectX scrolling can be slow, vertical positioning is off
Christian Brabandt <cb@256bit.org>
parents:
12994
diff
changeset
|
34 # error FEAT_MBYTE is required for FEAT_DIRECTX. |
cfce9ac1d1e8
patch 8.0.1390: DirectX scrolling can be slow, vertical positioning is off
Christian Brabandt <cb@256bit.org>
parents:
12994
diff
changeset
|
35 # endif |
6110 | 36 static DWriteContext *s_dwc = NULL; |
37 static int s_directx_enabled = 0; | |
38 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
|
39 # 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
|
40 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
|
41 static void directx_binddc(void); |
6359 | 42 #endif |
43 | |
8138
f52504c10387
commit https://github.com/vim/vim/commit/065bbac8adfe29a09958570237d223457f235c6c
Christian Brabandt <cb@256bit.org>
parents:
8108
diff
changeset
|
44 #ifdef FEAT_MENU |
f52504c10387
commit https://github.com/vim/vim/commit/065bbac8adfe29a09958570237d223457f235c6c
Christian Brabandt <cb@256bit.org>
parents:
8108
diff
changeset
|
45 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
|
46 #endif |
f52504c10387
commit https://github.com/vim/vim/commit/065bbac8adfe29a09958570237d223457f235c6c
Christian Brabandt <cb@256bit.org>
parents:
8108
diff
changeset
|
47 |
6110 | 48 #if defined(FEAT_RENDER_OPTIONS) || defined(PROTO) |
49 int | |
50 gui_mch_set_rendering_options(char_u *s) | |
51 { | |
13028
cfce9ac1d1e8
patch 8.0.1390: DirectX scrolling can be slow, vertical positioning is off
Christian Brabandt <cb@256bit.org>
parents:
12994
diff
changeset
|
52 # ifdef FEAT_DIRECTX |
6110 | 53 char_u *p, *q; |
54 | |
55 int dx_enable = 0; | |
56 int dx_flags = 0; | |
57 float dx_gamma = 0.0f; | |
58 float dx_contrast = 0.0f; | |
59 float dx_level = 0.0f; | |
60 int dx_geom = 0; | |
61 int dx_renmode = 0; | |
62 int dx_taamode = 0; | |
63 | |
64 /* parse string as rendering options. */ | |
65 for (p = s; p != NULL && *p != NUL; ) | |
66 { | |
67 char_u item[256]; | |
68 char_u name[128]; | |
69 char_u value[128]; | |
70 | |
7009 | 71 copy_option_part(&p, item, sizeof(item), ","); |
6110 | 72 if (p == NULL) |
73 break; | |
74 q = &item[0]; | |
75 copy_option_part(&q, name, sizeof(name), ":"); | |
76 if (q == NULL) | |
77 return FAIL; | |
78 copy_option_part(&q, value, sizeof(value), ":"); | |
79 | |
80 if (STRCMP(name, "type") == 0) | |
81 { | |
82 if (STRCMP(value, "directx") == 0) | |
83 dx_enable = 1; | |
84 else | |
85 return FAIL; | |
86 } | |
87 else if (STRCMP(name, "gamma") == 0) | |
88 { | |
89 dx_flags |= 1 << 0; | |
8108
50515f2e81d1
commit https://github.com/vim/vim/commit/7f0608fb5219645d776fadfe13efb867c2460698
Christian Brabandt <cb@256bit.org>
parents:
8102
diff
changeset
|
90 dx_gamma = (float)atof((char *)value); |
6110 | 91 } |
92 else if (STRCMP(name, "contrast") == 0) | |
93 { | |
94 dx_flags |= 1 << 1; | |
8108
50515f2e81d1
commit https://github.com/vim/vim/commit/7f0608fb5219645d776fadfe13efb867c2460698
Christian Brabandt <cb@256bit.org>
parents:
8102
diff
changeset
|
95 dx_contrast = (float)atof((char *)value); |
6110 | 96 } |
97 else if (STRCMP(name, "level") == 0) | |
98 { | |
99 dx_flags |= 1 << 2; | |
8108
50515f2e81d1
commit https://github.com/vim/vim/commit/7f0608fb5219645d776fadfe13efb867c2460698
Christian Brabandt <cb@256bit.org>
parents:
8102
diff
changeset
|
100 dx_level = (float)atof((char *)value); |
6110 | 101 } |
102 else if (STRCMP(name, "geom") == 0) | |
103 { | |
104 dx_flags |= 1 << 3; | |
8108
50515f2e81d1
commit https://github.com/vim/vim/commit/7f0608fb5219645d776fadfe13efb867c2460698
Christian Brabandt <cb@256bit.org>
parents:
8102
diff
changeset
|
105 dx_geom = atoi((char *)value); |
6110 | 106 if (dx_geom < 0 || dx_geom > 2) |
107 return FAIL; | |
108 } | |
109 else if (STRCMP(name, "renmode") == 0) | |
110 { | |
111 dx_flags |= 1 << 4; | |
8108
50515f2e81d1
commit https://github.com/vim/vim/commit/7f0608fb5219645d776fadfe13efb867c2460698
Christian Brabandt <cb@256bit.org>
parents:
8102
diff
changeset
|
112 dx_renmode = atoi((char *)value); |
6110 | 113 if (dx_renmode < 0 || dx_renmode > 6) |
114 return FAIL; | |
115 } | |
116 else if (STRCMP(name, "taamode") == 0) | |
117 { | |
118 dx_flags |= 1 << 5; | |
8108
50515f2e81d1
commit https://github.com/vim/vim/commit/7f0608fb5219645d776fadfe13efb867c2460698
Christian Brabandt <cb@256bit.org>
parents:
8102
diff
changeset
|
119 dx_taamode = atoi((char *)value); |
6110 | 120 if (dx_taamode < 0 || dx_taamode > 3) |
121 return FAIL; | |
122 } | |
12986
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
123 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
|
124 { |
13150
808625d4b71b
patch 8.0.1449: slow redrawing with DirectX
Christian Brabandt <cb@256bit.org>
parents:
13028
diff
changeset
|
125 /* 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
|
126 } |
6110 | 127 else |
128 return FAIL; | |
129 } | |
130 | |
12994
8566eaa08788
patch 8.0.1373: no error when settting 'renderoptions' before starting GUI
Christian Brabandt <cb@256bit.org>
parents:
12986
diff
changeset
|
131 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
|
132 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
|
133 |
6110 | 134 /* Enable DirectX/DirectWrite */ |
135 if (dx_enable) | |
136 { | |
137 if (!directx_enabled()) | |
138 return FAIL; | |
139 DWriteContext_SetRenderingParams(s_dwc, NULL); | |
140 if (dx_flags) | |
141 { | |
142 DWriteRenderingParams param; | |
143 DWriteContext_GetRenderingParams(s_dwc, ¶m); | |
144 if (dx_flags & (1 << 0)) | |
145 param.gamma = dx_gamma; | |
146 if (dx_flags & (1 << 1)) | |
147 param.enhancedContrast = dx_contrast; | |
148 if (dx_flags & (1 << 2)) | |
149 param.clearTypeLevel = dx_level; | |
150 if (dx_flags & (1 << 3)) | |
151 param.pixelGeometry = dx_geom; | |
152 if (dx_flags & (1 << 4)) | |
153 param.renderingMode = dx_renmode; | |
154 if (dx_flags & (1 << 5)) | |
155 param.textAntialiasMode = dx_taamode; | |
156 DWriteContext_SetRenderingParams(s_dwc, ¶m); | |
157 } | |
158 } | |
159 s_directx_enabled = dx_enable; | |
160 | |
161 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
|
162 # else |
6110 | 163 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
|
164 # endif |
6110 | 165 } |
166 #endif | |
167 | |
7 | 168 /* |
169 * These are new in Windows ME/XP, only defined in recent compilers. | |
170 */ | |
171 #ifndef HANDLE_WM_XBUTTONUP | |
172 # define HANDLE_WM_XBUTTONUP(hwnd, wParam, lParam, fn) \ | |
173 ((fn)((hwnd), (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) | |
174 #endif | |
175 #ifndef HANDLE_WM_XBUTTONDOWN | |
176 # define HANDLE_WM_XBUTTONDOWN(hwnd, wParam, lParam, fn) \ | |
177 ((fn)((hwnd), FALSE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) | |
178 #endif | |
179 #ifndef HANDLE_WM_XBUTTONDBLCLK | |
180 # define HANDLE_WM_XBUTTONDBLCLK(hwnd, wParam, lParam, fn) \ | |
181 ((fn)((hwnd), TRUE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) | |
182 #endif | |
183 | |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
184 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
185 #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
|
186 #ifdef DEBUG |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
187 # include <tchar.h> |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
188 #endif |
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 /* cproto fails on missing include files */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
191 #ifndef PROTO |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
192 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
193 #ifndef __MINGW32__ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
194 # include <shellapi.h> |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
195 #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
|
196 #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
|
197 # include <commctrl.h> |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
198 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
199 #include <windowsx.h> |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
200 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
201 #ifdef GLOBAL_IME |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
202 # include "glbl_ime.h" |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
203 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
204 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
205 #endif /* PROTO */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
206 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
207 #ifdef FEAT_MENU |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
208 # 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
|
209 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
210 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
211 /* 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
|
212 #define DLG_PADDING_X 10 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
213 #define DLG_PADDING_Y 10 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
214 #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
|
215 #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
|
216 #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
|
217 #define DLG_VERT_PADDING_Y 4 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
218 #define DLG_ICON_WIDTH 34 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
219 #define DLG_ICON_HEIGHT 34 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
220 #define DLG_MIN_WIDTH 150 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
221 #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
|
222 #define DLG_FONT_POINT_SIZE 8 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
223 #define DLG_MIN_MAX_WIDTH 400 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
224 #define DLG_MIN_MAX_HEIGHT 400 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
225 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
226 #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
|
227 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
228 #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
|
229 # define WM_XBUTTONDOWN 0x020B |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
230 # define WM_XBUTTONUP 0x020C |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
231 # define WM_XBUTTONDBLCLK 0x020D |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
232 # define MK_XBUTTON1 0x0020 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
233 # define MK_XBUTTON2 0x0040 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
234 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
235 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
236 #ifdef PROTO |
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 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
|
239 * 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
|
240 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
241 # define APIENTRY |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
242 # define CALLBACK |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
243 # define CONST |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
244 # define FAR |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
245 # define NEAR |
9834
80ace3687eec
commit https://github.com/vim/vim/commit/a6b7a08ae04a3cd4d9c45c906bb7a197e2135179
Christian Brabandt <cb@256bit.org>
parents:
9428
diff
changeset
|
246 # undef _cdecl |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
247 # define _cdecl |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
248 typedef int BOOL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
249 typedef int BYTE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
250 typedef int DWORD; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
251 typedef int WCHAR; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
252 typedef int ENUMLOGFONT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
253 typedef int FINDREPLACE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
254 typedef int HANDLE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
255 typedef int HBITMAP; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
256 typedef int HBRUSH; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
257 typedef int HDROP; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
258 typedef int INT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
259 typedef int LOGFONT[]; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
260 typedef int LPARAM; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
261 typedef int LPCREATESTRUCT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
262 typedef int LPCSTR; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
263 typedef int LPCTSTR; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
264 typedef int LPRECT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
265 typedef int LPSTR; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
266 typedef int LPWINDOWPOS; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
267 typedef int LPWORD; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
268 typedef int LRESULT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
269 typedef int HRESULT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
270 # undef MSG |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
271 typedef int MSG; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
272 typedef int NEWTEXTMETRIC; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
273 typedef int OSVERSIONINFO; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
274 typedef int PWORD; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
275 typedef int RECT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
276 typedef int UINT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
277 typedef int WORD; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
278 typedef int WPARAM; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
279 typedef int POINT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
280 typedef void *HINSTANCE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
281 typedef void *HMENU; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
282 typedef void *HWND; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
283 typedef void *HDC; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
284 typedef void VOID; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
285 typedef int LPNMHDR; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
286 typedef int LONG; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
287 typedef int WNDPROC; |
9834
80ace3687eec
commit https://github.com/vim/vim/commit/a6b7a08ae04a3cd4d9c45c906bb7a197e2135179
Christian Brabandt <cb@256bit.org>
parents:
9428
diff
changeset
|
288 typedef int UINT_PTR; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
289 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
290 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
291 #ifndef GET_X_LPARAM |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
292 # 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
|
293 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
294 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
295 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
|
296 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
|
297 static void clear_rect(RECT *rcp); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
298 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
299 static 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
|
300 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
|
301 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
302 #ifdef FEAT_MENU |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
303 static HMENU s_menuBar = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
304 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
305 #ifdef FEAT_TEAROFF |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
306 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
|
307 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
|
308 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
309 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
310 /* 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
|
311 * processing another message. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
312 static int s_busy_processing = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
313 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
314 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
|
315 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
316 #ifdef MSWIN_FIND_REPLACE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
317 static UINT s_findrep_msg = 0; /* set in gui_w[16/32].c */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
318 static FINDREPLACE s_findrep_struct; |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
319 # ifdef FEAT_MBYTE |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
320 static FINDREPLACEW s_findrep_struct_w; |
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 static HWND s_findrep_hwnd = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
323 static int s_findrep_is_find; /* TRUE for find dialog, FALSE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
324 for find/replace dialog */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
325 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
326 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
327 static HINSTANCE s_hinst = NULL; |
8281
74b15ed0a259
commit https://github.com/vim/vim/commit/85b11769ab507c7df93f319fd964fa579701b76b
Christian Brabandt <cb@256bit.org>
parents:
8273
diff
changeset
|
328 #if !defined(FEAT_GUI) |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
329 static |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
330 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
331 HWND s_hwnd = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
332 static HDC s_hdc = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
333 static HBRUSH s_brush = NULL; |
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_TOOLBAR |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
336 static HWND s_toolbarhwnd = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
337 static WNDPROC s_toolbar_wndproc = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
338 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
339 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
340 #ifdef FEAT_GUI_TABLINE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
341 static HWND s_tabhwnd = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
342 static WNDPROC s_tabline_wndproc = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
343 static int showing_tabline = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
344 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
345 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
346 static WPARAM s_wParam = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
347 static LPARAM s_lParam = 0; |
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 HWND s_textArea = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
350 static UINT s_uMsg = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
351 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
352 static 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
|
353 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
354 static int s_need_activate = FALSE; |
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 /* 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
|
357 * 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
|
358 * 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
|
359 * 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
|
360 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
361 static int allow_scrollbar = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
362 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
363 #ifdef GLOBAL_IME |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
364 # 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
|
365 #else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
366 # define MyTranslateMessage(x) TranslateMessage(x) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
367 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
368 |
12934
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
369 #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
|
370 static int |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
371 directx_enabled(void) |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
372 { |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
373 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
|
374 return 1; |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
375 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
|
376 return 0; |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
377 /* load DirectX */ |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
378 DWrite_Init(); |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
379 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
|
380 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
|
381 directx_binddc(); |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
382 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
|
383 } |
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 static void |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
386 directx_binddc(void) |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
387 { |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
388 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
|
389 { |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
390 RECT rect; |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
391 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
|
392 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
|
393 } |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
394 } |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
395 #endif |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
396 |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
397 #if defined(FEAT_MBYTE) || defined(GLOBAL_IME) |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
398 /* use of WindowProc depends on wide_WindowProc */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
399 # define MyWindowProc vim_WindowProc |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
400 #else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
401 /* use ordinary WindowProc */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
402 # define MyWindowProc DefWindowProc |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
403 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
404 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
405 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
|
406 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
407 static struct |
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 UINT key_sym; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
410 char_u vim_code0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
411 char_u vim_code1; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
412 } special_keys[] = |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
413 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
414 {VK_UP, 'k', 'u'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
415 {VK_DOWN, 'k', 'd'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
416 {VK_LEFT, 'k', 'l'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
417 {VK_RIGHT, 'k', 'r'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
418 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
419 {VK_F1, 'k', '1'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
420 {VK_F2, 'k', '2'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
421 {VK_F3, 'k', '3'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
422 {VK_F4, 'k', '4'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
423 {VK_F5, 'k', '5'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
424 {VK_F6, 'k', '6'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
425 {VK_F7, 'k', '7'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
426 {VK_F8, 'k', '8'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
427 {VK_F9, 'k', '9'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
428 {VK_F10, 'k', ';'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
429 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
430 {VK_F11, 'F', '1'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
431 {VK_F12, 'F', '2'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
432 {VK_F13, 'F', '3'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
433 {VK_F14, 'F', '4'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
434 {VK_F15, 'F', '5'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
435 {VK_F16, 'F', '6'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
436 {VK_F17, 'F', '7'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
437 {VK_F18, 'F', '8'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
438 {VK_F19, 'F', '9'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
439 {VK_F20, 'F', 'A'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
440 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
441 {VK_F21, 'F', 'B'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
442 #ifdef FEAT_NETBEANS_INTG |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
443 {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
|
444 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
445 {VK_F22, 'F', 'C'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
446 {VK_F23, 'F', 'D'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
447 {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
|
448 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
449 {VK_HELP, '%', '1'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
450 {VK_BACK, 'k', 'b'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
451 {VK_INSERT, 'k', 'I'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
452 {VK_DELETE, 'k', 'D'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
453 {VK_HOME, 'k', 'h'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
454 {VK_END, '@', '7'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
455 {VK_PRIOR, 'k', 'P'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
456 {VK_NEXT, 'k', 'N'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
457 {VK_PRINT, '%', '9'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
458 {VK_ADD, 'K', '6'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
459 {VK_SUBTRACT, 'K', '7'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
460 {VK_DIVIDE, 'K', '8'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
461 {VK_MULTIPLY, 'K', '9'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
462 {VK_SEPARATOR, 'K', 'A'}, /* Keypad Enter */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
463 {VK_DECIMAL, 'K', 'B'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
464 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
465 {VK_NUMPAD0, 'K', 'C'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
466 {VK_NUMPAD1, 'K', 'D'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
467 {VK_NUMPAD2, 'K', 'E'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
468 {VK_NUMPAD3, 'K', 'F'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
469 {VK_NUMPAD4, 'K', 'G'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
470 {VK_NUMPAD5, 'K', 'H'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
471 {VK_NUMPAD6, 'K', 'I'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
472 {VK_NUMPAD7, 'K', 'J'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
473 {VK_NUMPAD8, 'K', 'K'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
474 {VK_NUMPAD9, 'K', 'L'}, |
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 /* 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
|
477 {VK_SPACE, ' ', NUL}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
478 {VK_TAB, TAB, NUL}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
479 {VK_ESCAPE, ESC, NUL}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
480 {NL, NL, NUL}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
481 {CAR, CAR, NUL}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
482 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
483 /* End of list marker: */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
484 {0, 0, 0} |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
485 }; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
486 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
487 /* Local variables */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
488 static int s_button_pending = -1; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
489 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
490 /* 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
|
491 * 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
|
492 static int s_getting_focus = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
493 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
494 static int s_x_pending; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
495 static int s_y_pending; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
496 static UINT s_kFlags_pending; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
497 static UINT s_wait_timer = 0; /* Timer for get char from user */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
498 static int s_timed_out = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
499 static int dead_key = 0; /* 0: no dead key, 1: dead key pressed */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
500 |
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
|
501 #ifdef FEAT_BEVAL_GUI |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
502 /* balloon-eval WM_NOTIFY_HANDLER */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
503 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
|
504 static void TrackUserActivity(UINT uMsg); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
505 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
506 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
507 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
508 * For control IME. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
509 * |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
510 * These LOGFONT used for IME. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
511 */ |
12950
e60b2aa04903
patch 8.0.1351: warning for unused variables building with MinGW
Christian Brabandt <cb@256bit.org>
parents:
12934
diff
changeset
|
512 #if defined(FEAT_MBYTE_IME) || defined(GLOBAL_IME) |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
513 /* holds LOGFONT for 'guifontwide' if available, otherwise 'guifont' */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
514 static LOGFONT norm_logfont; |
12950
e60b2aa04903
patch 8.0.1351: warning for unused variables building with MinGW
Christian Brabandt <cb@256bit.org>
parents:
12934
diff
changeset
|
515 #endif |
e60b2aa04903
patch 8.0.1351: warning for unused variables building with MinGW
Christian Brabandt <cb@256bit.org>
parents:
12934
diff
changeset
|
516 #ifdef FEAT_MBYTE_IME |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
517 /* holds LOGFONT for 'guifont' always. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
518 static LOGFONT sub_logfont; |
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 FEAT_MBYTE_IME |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
522 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
|
523 #endif |
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 #if defined(FEAT_BROWSE) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
526 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
|
527 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
528 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
529 #ifdef DEBUG_PRINT_ERROR |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
530 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
531 * 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
|
532 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
533 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
534 print_windows_error(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
535 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
536 LPVOID lpMsgBuf; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
537 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
538 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
|
539 NULL, GetLastError(), |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
540 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
541 (LPTSTR) &lpMsgBuf, 0, NULL); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
542 TRACE1("Error: %s\n", lpMsgBuf); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
543 LocalFree(lpMsgBuf); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
544 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
545 #endif |
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 * Cursor blink functions. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
549 * |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
550 * This is a simple state machine: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
551 * BLINK_NONE not blinking at all |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
552 * 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
|
553 * BLINK_ON blinking, cursor is shown |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
554 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
555 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
556 #define BLINK_NONE 0 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
557 #define BLINK_OFF 1 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
558 #define BLINK_ON 2 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
559 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
560 static int blink_state = BLINK_NONE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
561 static long_u blink_waittime = 700; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
562 static long_u blink_ontime = 400; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
563 static long_u blink_offtime = 250; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
564 static UINT blink_timer = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
565 |
9213
bb86514cad15
commit https://github.com/vim/vim/commit/703a8044b5393d37d355b0b1054a9a5a13912a3f
Christian Brabandt <cb@256bit.org>
parents:
9181
diff
changeset
|
566 int |
bb86514cad15
commit https://github.com/vim/vim/commit/703a8044b5393d37d355b0b1054a9a5a13912a3f
Christian Brabandt <cb@256bit.org>
parents:
9181
diff
changeset
|
567 gui_mch_is_blinking(void) |
bb86514cad15
commit https://github.com/vim/vim/commit/703a8044b5393d37d355b0b1054a9a5a13912a3f
Christian Brabandt <cb@256bit.org>
parents:
9181
diff
changeset
|
568 { |
bb86514cad15
commit https://github.com/vim/vim/commit/703a8044b5393d37d355b0b1054a9a5a13912a3f
Christian Brabandt <cb@256bit.org>
parents:
9181
diff
changeset
|
569 return blink_state != BLINK_NONE; |
bb86514cad15
commit https://github.com/vim/vim/commit/703a8044b5393d37d355b0b1054a9a5a13912a3f
Christian Brabandt <cb@256bit.org>
parents:
9181
diff
changeset
|
570 } |
bb86514cad15
commit https://github.com/vim/vim/commit/703a8044b5393d37d355b0b1054a9a5a13912a3f
Christian Brabandt <cb@256bit.org>
parents:
9181
diff
changeset
|
571 |
9428
0c7f47088e55
commit https://github.com/vim/vim/commit/9d5d3c9c4468ad76f16b50eabd3d9e7eab2ed44d
Christian Brabandt <cb@256bit.org>
parents:
9252
diff
changeset
|
572 int |
0c7f47088e55
commit https://github.com/vim/vim/commit/9d5d3c9c4468ad76f16b50eabd3d9e7eab2ed44d
Christian Brabandt <cb@256bit.org>
parents:
9252
diff
changeset
|
573 gui_mch_is_blink_off(void) |
0c7f47088e55
commit https://github.com/vim/vim/commit/9d5d3c9c4468ad76f16b50eabd3d9e7eab2ed44d
Christian Brabandt <cb@256bit.org>
parents:
9252
diff
changeset
|
574 { |
0c7f47088e55
commit https://github.com/vim/vim/commit/9d5d3c9c4468ad76f16b50eabd3d9e7eab2ed44d
Christian Brabandt <cb@256bit.org>
parents:
9252
diff
changeset
|
575 return blink_state == BLINK_OFF; |
0c7f47088e55
commit https://github.com/vim/vim/commit/9d5d3c9c4468ad76f16b50eabd3d9e7eab2ed44d
Christian Brabandt <cb@256bit.org>
parents:
9252
diff
changeset
|
576 } |
0c7f47088e55
commit https://github.com/vim/vim/commit/9d5d3c9c4468ad76f16b50eabd3d9e7eab2ed44d
Christian Brabandt <cb@256bit.org>
parents:
9252
diff
changeset
|
577 |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
578 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
579 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
|
580 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
581 blink_waittime = wait; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
582 blink_ontime = on; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
583 blink_offtime = off; |
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
586 static VOID CALLBACK |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
587 _OnBlinkTimer( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
588 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
|
589 UINT uMsg UNUSED, |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
590 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
|
591 DWORD dwTime UNUSED) |
8140
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 MSG msg; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
594 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
595 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
596 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
|
597 */ |
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 KillTimer(NULL, idEvent); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
600 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
601 /* Eat spurious WM_TIMER messages */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
602 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
|
603 ; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
604 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
605 if (blink_state == BLINK_ON) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
606 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
607 gui_undraw_cursor(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
608 blink_state = BLINK_OFF; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
609 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
|
610 (TIMERPROC)_OnBlinkTimer); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
611 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
612 else |
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 gui_update_cursor(TRUE, FALSE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
615 blink_state = BLINK_ON; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
616 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
|
617 (TIMERPROC)_OnBlinkTimer); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
618 } |
12986
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
619 gui_mch_flush(); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
620 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
621 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
622 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
623 gui_mswin_rm_blink_timer(void) |
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 MSG msg; |
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 if (blink_timer != 0) |
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 KillTimer(NULL, blink_timer); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
630 /* Eat spurious WM_TIMER messages */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
631 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
|
632 ; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
633 blink_timer = 0; |
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 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
636 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
637 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
638 * 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
|
639 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
640 void |
13152
f4c3a7f410f4
patch 8.0.1450: GUI: endless loop when stopping cursor blinking
Christian Brabandt <cb@256bit.org>
parents:
13150
diff
changeset
|
641 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
|
642 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
643 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
|
644 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
|
645 { |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
646 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
|
647 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
|
648 } |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
649 blink_state = BLINK_NONE; |
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 |
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 * 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
|
654 * waiting time and shows the cursor. |
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 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
657 gui_mch_start_blink(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
658 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
659 gui_mswin_rm_blink_timer(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
660 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
661 /* 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
|
662 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
|
663 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
664 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
|
665 (TIMERPROC)_OnBlinkTimer); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
666 blink_state = BLINK_ON; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
667 gui_update_cursor(TRUE, FALSE); |
12986
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
668 gui_mch_flush(); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
669 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
670 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
671 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
672 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
673 * Call-back routines. |
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
676 static VOID CALLBACK |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
677 _OnTimer( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
678 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
|
679 UINT uMsg UNUSED, |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
680 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
|
681 DWORD dwTime UNUSED) |
8140
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 MSG msg; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
684 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
685 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
686 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
|
687 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
688 KillTimer(NULL, idEvent); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
689 s_timed_out = TRUE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
690 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
691 /* Eat spurious WM_TIMER messages */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
692 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
|
693 ; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
694 if (idEvent == s_wait_timer) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
695 s_wait_timer = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
696 } |
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 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
699 _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
|
700 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
|
701 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
|
702 int cRepeat UNUSED) |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
703 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
704 dead_key = 1; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
705 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
706 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
707 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
708 * 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
|
709 * 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
|
710 * Return the length. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
711 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
712 static int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
713 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
|
714 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
715 int len; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
716 int i; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
717 #ifdef FEAT_MBYTE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
718 WCHAR wstring[2]; |
9252
c25898cc99c1
commit https://github.com/vim/vim/commit/945ec093cd4ddefab930239990564b12eb232153
Christian Brabandt <cb@256bit.org>
parents:
9236
diff
changeset
|
719 char_u *ws = NULL; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
720 |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
721 wstring[0] = ch; |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
722 len = 1; |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
723 |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
724 /* "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
|
725 * "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
|
726 * 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
|
727 if (enc_codepage > 0) |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
728 { |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
729 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
|
730 (LPSTR)string, slen, 0, NULL); |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
731 /* 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
|
732 * 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
|
733 * 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
|
734 * afterwards. */ |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
735 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
|
736 { |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
737 wstring[0] = ch & 0x7f; |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
738 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
|
739 (LPSTR)string, slen, 0, NULL); |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
740 if (len == 1) /* safety check */ |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
741 string[0] |= 0x80; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
742 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
743 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
744 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
745 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
746 len = 1; |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
747 ws = utf16_to_enc(wstring, &len); |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
748 if (ws == NULL) |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
749 len = 0; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
750 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
751 { |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
752 if (len > slen) /* just in case */ |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
753 len = slen; |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
754 mch_memmove(string, ws, len); |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
755 vim_free(ws); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
756 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
757 } |
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 if (len == 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
760 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
761 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
762 string[0] = ch; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
763 len = 1; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
764 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
765 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
766 for (i = 0; i < len; ++i) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
767 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
|
768 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
769 /* Insert CSI as K_CSI. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
770 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
|
771 string[++i] = KS_EXTRA; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
772 string[++i] = (int)KE_CSI; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
773 len += 2; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
774 } |
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 return len; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
777 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
778 |
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 * 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
|
781 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
782 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
783 _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
|
784 HWND hwnd UNUSED, |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
785 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
|
786 int cRepeat UNUSED) |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
787 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
788 char_u string[40]; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
789 int len = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
790 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
791 dead_key = 0; |
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 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
|
794 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
|
795 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
796 trash_input_buf(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
797 got_int = TRUE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
798 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
799 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
800 add_to_input_buf(string, len); |
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
803 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
804 * 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
|
805 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
806 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
807 _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
|
808 HWND hwnd UNUSED, |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
809 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
|
810 int cRepeat UNUSED) |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
811 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
812 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
|
813 int len; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
814 int modifiers; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
815 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
|
816 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
817 dead_key = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
818 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
819 /* 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
|
820 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
821 /* 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
|
822 * 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
|
823 * 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
|
824 * CAPSLOCK is pressed) at this point. |
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 modifiers = MOD_MASK_ALT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
827 if (GetKeyState(VK_SHIFT) & 0x8000) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
828 modifiers |= MOD_MASK_SHIFT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
829 if (GetKeyState(VK_CONTROL) & 0x8000) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
830 modifiers |= MOD_MASK_CTRL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
831 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
832 ch = simplify_key(ch, &modifiers); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
833 /* 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
|
834 * '(' and '*' */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
835 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
|
836 modifiers &= ~MOD_MASK_SHIFT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
837 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
838 /* 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
|
839 ch = extract_modifiers(ch, &modifiers); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
840 if (ch == CSI) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
841 ch = K_CSI; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
842 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
843 len = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
844 if (modifiers) |
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 string[len++] = CSI; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
847 string[len++] = KS_MODIFIER; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
848 string[len++] = modifiers; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
849 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
850 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
851 if (IS_SPECIAL((int)ch)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
852 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
853 string[len++] = CSI; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
854 string[len++] = K_SECOND((int)ch); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
855 string[len++] = K_THIRD((int)ch); |
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 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
858 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
859 /* 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
|
860 * a Unicode character. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
861 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
|
862 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
863 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
864 add_to_input_buf(string, len); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
865 } |
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 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
868 _OnMouseEvent( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
869 int button, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
870 int x, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
871 int y, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
872 int repeated_click, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
873 UINT keyFlags) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
874 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
875 int vim_modifiers = 0x0; |
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 s_getting_focus = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
878 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
879 if (keyFlags & MK_SHIFT) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
880 vim_modifiers |= MOUSE_SHIFT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
881 if (keyFlags & MK_CONTROL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
882 vim_modifiers |= MOUSE_CTRL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
883 if (GetKeyState(VK_MENU) & 0x8000) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
884 vim_modifiers |= MOUSE_ALT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
885 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
886 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
|
887 } |
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 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
890 _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
|
891 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
|
892 BOOL fDoubleClick UNUSED, |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
893 int x, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
894 int y, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
895 UINT keyFlags) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
896 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
897 static LONG s_prevTime = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
898 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
899 LONG currentTime = GetMessageTime(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
900 int button = -1; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
901 int repeated_click; |
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 /* 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
|
904 (void)SetFocus(s_hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
905 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
906 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
|
907 button = MOUSE_LEFT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
908 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
|
909 button = MOUSE_MIDDLE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
910 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
|
911 button = MOUSE_RIGHT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
912 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
|
913 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
914 #ifndef GET_XBUTTON_WPARAM |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
915 # 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
|
916 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
917 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
|
918 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
919 else if (s_uMsg == WM_CAPTURECHANGED) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
920 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
921 /* 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
|
922 * 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
|
923 if (s_button_pending == MOUSE_LEFT) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
924 button = MOUSE_RIGHT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
925 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
926 button = MOUSE_LEFT; |
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 if (button >= 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
929 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
930 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
|
931 |
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 * 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
|
934 * button. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
935 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
936 if (repeated_click |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
937 && ((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
|
938 || (button == MOUSE_RIGHT |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
939 && s_button_pending == MOUSE_LEFT))) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
940 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
941 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
942 * 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
|
943 * 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
|
944 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
945 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
|
946 button = MOUSE_MIDDLE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
947 repeated_click = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
948 s_button_pending = -1; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
949 _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
|
950 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
951 else if ((repeated_click) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
952 || (mouse_model_popup() && (button == MOUSE_RIGHT))) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
953 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
954 if (s_button_pending > -1) |
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 _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
|
957 s_button_pending = -1; |
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 /* 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
|
960 _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
|
961 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
962 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
963 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
964 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
965 * If 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
|
966 * 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
|
967 * i) button-up |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
968 * ii) mouse move |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
969 * iii) another button press |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
970 * before using it. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
971 * 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
|
972 * 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
|
973 * 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
|
974 * 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
|
975 * this is hardly a problem. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
976 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
977 s_button_pending = button; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
978 s_x_pending = x; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
979 s_y_pending = y; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
980 s_kFlags_pending = keyFlags; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
981 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
982 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
983 s_prevTime = currentTime; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
984 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
985 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
986 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
987 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
988 _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
|
989 HWND hwnd UNUSED, |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
990 int x, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
991 int y, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
992 UINT keyFlags) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
993 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
994 int button; |
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 s_getting_focus = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
997 if (s_button_pending > -1) |
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 /* Delayed action for mouse down event */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1000 _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
|
1001 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
|
1002 s_button_pending = -1; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1003 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1004 if (s_uMsg == WM_MOUSEMOVE) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1005 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1006 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1007 * 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
|
1008 * down. |
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 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
|
1011 | MK_XBUTTON1 | MK_XBUTTON2))) |
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 gui_mouse_moved(x, y); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1014 return; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1015 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1016 |
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 * 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
|
1019 * the mouse goes outside the window |
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 SetCapture(s_textArea); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1022 button = MOUSE_DRAG; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1023 /* 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
|
1024 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1025 else |
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 ReleaseCapture(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1028 button = MOUSE_RELEASE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1029 /* 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
|
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 _OnMouseEvent(button, x, y, FALSE, keyFlags); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1033 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1034 |
12934
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
1035 static void |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
1036 _OnSizeTextArea( |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
1037 HWND hwnd UNUSED, |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
1038 UINT state UNUSED, |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
1039 int cx UNUSED, |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
1040 int cy UNUSED) |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
1041 { |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
1042 #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
|
1043 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
|
1044 directx_binddc(); |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
1045 #endif |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
1046 } |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
1047 |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1048 #ifdef FEAT_MENU |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1049 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1050 * 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
|
1051 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1052 static vimmenu_T * |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1053 gui_mswin_find_menu( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1054 vimmenu_T *pMenu, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1055 int id) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1056 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1057 vimmenu_T *pChildMenu; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1058 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1059 while (pMenu) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1060 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1061 if (pMenu->id == (UINT)id) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1062 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1063 if (pMenu->children != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1064 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1065 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
|
1066 if (pChildMenu) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1067 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1068 pMenu = pChildMenu; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1069 break; |
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 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1072 pMenu = pMenu->next; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1073 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1074 return pMenu; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1075 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1076 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1077 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1078 _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
|
1079 HWND hwnd UNUSED, |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1080 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
|
1081 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
|
1082 UINT codeNotify UNUSED) |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1083 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1084 vimmenu_T *pMenu; |
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 = 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
|
1087 if (pMenu) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1088 gui_menu_cb(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 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1091 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1092 #ifdef MSWIN_FIND_REPLACE |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1093 # ifdef FEAT_MBYTE |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1094 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1095 * copy useful data from structure LPFINDREPLACE to structure LPFINDREPLACEW |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1096 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1097 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1098 findrep_atow(LPFINDREPLACEW lpfrw, LPFINDREPLACE lpfr) |
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 WCHAR *wp; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1101 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1102 lpfrw->hwndOwner = lpfr->hwndOwner; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1103 lpfrw->Flags = lpfr->Flags; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1104 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1105 wp = enc_to_utf16((char_u *)lpfr->lpstrFindWhat, NULL); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1106 wcsncpy(lpfrw->lpstrFindWhat, wp, lpfrw->wFindWhatLen - 1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1107 vim_free(wp); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1108 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1109 /* the field "lpstrReplaceWith" doesn't need to be copied */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1110 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1111 |
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 * copy useful data from structure LPFINDREPLACEW to structure LPFINDREPLACE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1114 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1115 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1116 findrep_wtoa(LPFINDREPLACE lpfr, LPFINDREPLACEW lpfrw) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1117 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1118 char_u *p; |
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 lpfr->Flags = lpfrw->Flags; |
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 p = utf16_to_enc((short_u*)lpfrw->lpstrFindWhat, NULL); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1123 vim_strncpy((char_u *)lpfr->lpstrFindWhat, p, lpfr->wFindWhatLen - 1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1124 vim_free(p); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1125 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1126 p = utf16_to_enc((short_u*)lpfrw->lpstrReplaceWith, NULL); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1127 vim_strncpy((char_u *)lpfr->lpstrReplaceWith, p, lpfr->wReplaceWithLen - 1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1128 vim_free(p); |
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 # endif |
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 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1133 * Handle a Find/Replace window message. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1134 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1135 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1136 _OnFindRepl(void) |
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 int flags = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1139 int down; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1140 |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1141 # ifdef FEAT_MBYTE |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1142 /* If the OS is Windows NT, and 'encoding' differs from active codepage: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1143 * convert text from wide string. */ |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1144 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1145 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1146 findrep_wtoa(&s_findrep_struct, &s_findrep_struct_w); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1147 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1148 # endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1149 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1150 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
|
1151 /* Give main window the focus back. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1152 (void)SetFocus(s_hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1153 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1154 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
|
1155 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1156 flags = FRD_FINDNEXT; |
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 /* 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
|
1159 * hollow. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1160 (void)SetFocus(s_hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1161 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1162 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
|
1163 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1164 flags = FRD_REPLACE; |
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 /* 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
|
1167 * hollow. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1168 (void)SetFocus(s_hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1169 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1170 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
|
1171 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1172 flags = FRD_REPLACEALL; |
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1175 if (flags != 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1176 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1177 /* 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
|
1178 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
|
1179 flags |= FRD_WHOLE_WORD; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1180 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
|
1181 flags |= FRD_MATCH_CASE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1182 down = (s_findrep_struct.Flags & FR_DOWN) != 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1183 gui_do_findrepl(flags, (char_u *)s_findrep_struct.lpstrFindWhat, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1184 (char_u *)s_findrep_struct.lpstrReplaceWith, down); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1185 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1186 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1187 #endif |
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 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1190 HandleMouseHide(UINT uMsg, LPARAM lParam) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1191 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1192 static LPARAM last_lParam = 0L; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1193 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1194 /* 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
|
1195 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
|
1196 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1197 if (lParam == last_lParam) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1198 return; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1199 last_lParam = lParam; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1200 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1201 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1202 /* 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
|
1203 * 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
|
1204 * 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
|
1205 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1206 switch (uMsg) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1207 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1208 case WM_KEYUP: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1209 case WM_CHAR: |
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 * blank out the pointer if necessary |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1212 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1213 if (p_mh) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1214 gui_mch_mousehide(TRUE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1215 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1216 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1217 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
|
1218 case WM_SYSCHAR: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1219 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
|
1220 case WM_LBUTTONDOWN: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1221 case WM_LBUTTONUP: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1222 case WM_MBUTTONDOWN: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1223 case WM_MBUTTONUP: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1224 case WM_RBUTTONDOWN: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1225 case WM_RBUTTONUP: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1226 case WM_XBUTTONDOWN: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1227 case WM_XBUTTONUP: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1228 case WM_NCMOUSEMOVE: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1229 case WM_NCLBUTTONDOWN: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1230 case WM_NCLBUTTONUP: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1231 case WM_NCMBUTTONDOWN: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1232 case WM_NCMBUTTONUP: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1233 case WM_NCRBUTTONDOWN: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1234 case WM_NCRBUTTONUP: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1235 case WM_KILLFOCUS: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1236 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1237 * 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
|
1238 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1239 gui_mch_mousehide(FALSE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1240 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1241 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1242 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1243 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1244 static LRESULT CALLBACK |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1245 _TextAreaWndProc( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1246 HWND hwnd, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1247 UINT uMsg, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1248 WPARAM wParam, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1249 LPARAM lParam) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1250 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1251 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1252 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
|
1253 hwnd, uMsg, wParam, lParam); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1254 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1255 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1256 HandleMouseHide(uMsg, lParam); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1257 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1258 s_uMsg = uMsg; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1259 s_wParam = wParam; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1260 s_lParam = lParam; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1261 |
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
|
1262 #ifdef FEAT_BEVAL_GUI |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1263 TrackUserActivity(uMsg); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1264 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1265 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1266 switch (uMsg) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1267 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1268 HANDLE_MSG(hwnd, WM_LBUTTONDBLCLK,_OnMouseButtonDown); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1269 HANDLE_MSG(hwnd, WM_LBUTTONDOWN,_OnMouseButtonDown); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1270 HANDLE_MSG(hwnd, WM_LBUTTONUP, _OnMouseMoveOrRelease); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1271 HANDLE_MSG(hwnd, WM_MBUTTONDBLCLK,_OnMouseButtonDown); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1272 HANDLE_MSG(hwnd, WM_MBUTTONDOWN,_OnMouseButtonDown); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1273 HANDLE_MSG(hwnd, WM_MBUTTONUP, _OnMouseMoveOrRelease); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1274 HANDLE_MSG(hwnd, WM_MOUSEMOVE, _OnMouseMoveOrRelease); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1275 HANDLE_MSG(hwnd, WM_PAINT, _OnPaint); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1276 HANDLE_MSG(hwnd, WM_RBUTTONDBLCLK,_OnMouseButtonDown); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1277 HANDLE_MSG(hwnd, WM_RBUTTONDOWN,_OnMouseButtonDown); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1278 HANDLE_MSG(hwnd, WM_RBUTTONUP, _OnMouseMoveOrRelease); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1279 HANDLE_MSG(hwnd, WM_XBUTTONDBLCLK,_OnMouseButtonDown); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1280 HANDLE_MSG(hwnd, WM_XBUTTONDOWN,_OnMouseButtonDown); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1281 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
|
1282 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
|
1283 |
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
|
1284 #ifdef FEAT_BEVAL_GUI |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1285 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
|
1286 return TRUE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1287 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1288 default: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1289 return MyWindowProc(hwnd, uMsg, wParam, lParam); |
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 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1292 |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1293 #if defined(FEAT_MBYTE) \ |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1294 || defined(GLOBAL_IME) \ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1295 || defined(PROTO) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1296 # ifdef PROTO |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1297 typedef int WINAPI; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1298 # endif |
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 LRESULT WINAPI |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1301 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
|
1302 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1303 # ifdef GLOBAL_IME |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1304 return global_ime_DefWindowProc(hwnd, message, wParam, lParam); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1305 # else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1306 if (wide_WindowProc) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1307 return DefWindowProcW(hwnd, message, wParam, lParam); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1308 return DefWindowProc(hwnd, message, wParam, lParam); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1309 #endif |
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 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1312 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1313 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1314 * 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
|
1315 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1316 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1317 gui_mch_new_colors(void) |
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 /* nothing to do? */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1320 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1321 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1322 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1323 * 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
|
1324 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1325 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1326 gui_mch_def_colors(void) |
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 gui.norm_pixel = GetSysColor(COLOR_WINDOWTEXT); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1329 gui.back_pixel = GetSysColor(COLOR_WINDOW); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1330 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
|
1331 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
|
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 * 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
|
1336 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1337 int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1338 gui_mch_open(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1339 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1340 #ifndef SW_SHOWDEFAULT |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1341 # define SW_SHOWDEFAULT 10 /* Borland 5.0 doesn't have it */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1342 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1343 /* 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
|
1344 * (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
|
1345 if (!IsWindowVisible(s_hwnd)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1346 ShowWindow(s_hwnd, SW_SHOWDEFAULT); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1347 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1348 #ifdef MSWIN_FIND_REPLACE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1349 /* 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
|
1350 * dialog. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1351 s_findrep_struct.lpstrReplaceWith[0] = NUL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1352 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1353 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1354 return OK; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1355 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1356 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1357 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1358 * 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
|
1359 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1360 int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1361 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
|
1362 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1363 RECT rect; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1364 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1365 GetWindowRect(s_hwnd, &rect); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1366 *x = rect.left; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1367 *y = rect.top; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1368 return OK; |
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 |
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 * 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
|
1373 * coordinates. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1374 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1375 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1376 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
|
1377 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1378 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
|
1379 SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE); |
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 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1382 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
|
1383 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1384 static int oldx = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1385 static int oldy = 0; |
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 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
|
1388 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1389 #ifdef FEAT_TOOLBAR |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1390 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
|
1391 SendMessage(s_toolbarhwnd, WM_SIZE, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1392 (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
|
1393 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1394 #if defined(FEAT_GUI_TABLINE) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1395 if (showing_tabline) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1396 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1397 int top = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1398 RECT rect; |
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 # ifdef FEAT_TOOLBAR |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1401 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
|
1402 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
|
1403 # endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1404 GetClientRect(s_hwnd, &rect); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1405 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
|
1406 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1407 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1408 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1409 /* 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
|
1410 * 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
|
1411 * forcedly redrawn. (Yasuhiro Matsumoto) */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1412 if (oldx != x || oldy != y) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1413 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1414 InvalidateRect(s_hwnd, NULL, FALSE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1415 oldx = x; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1416 oldy = y; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1417 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1418 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1419 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1420 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1421 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1422 * Scrollbar stuff: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1423 */ |
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 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1426 gui_mch_enable_scrollbar( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1427 scrollbar_T *sb, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1428 int flag) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1429 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1430 ShowScrollBar(sb->id, SB_CTL, flag); |
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 /* 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
|
1433 * 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
|
1434 * NT 4.0 it's not... */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1435 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1436 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1437 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1438 gui_mch_set_scrollbar_pos( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1439 scrollbar_T *sb, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1440 int x, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1441 int y, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1442 int w, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1443 int h) |
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 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
|
1446 SWP_NOZORDER | SWP_NOACTIVATE | SWP_SHOWWINDOW); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1447 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1448 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1449 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1450 gui_mch_create_scrollbar( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1451 scrollbar_T *sb, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1452 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
|
1453 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1454 sb->id = CreateWindow( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1455 "SCROLLBAR", "Scrollbar", |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1456 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
|
1457 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
|
1458 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
|
1459 s_hwnd, NULL, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1460 s_hinst, NULL); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1461 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1462 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1463 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1464 * 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
|
1465 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1466 static scrollbar_T * |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1467 gui_mswin_find_scrollbar(HWND hwnd) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1468 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1469 win_T *wp; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1470 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1471 if (gui.bottom_sbar.id == hwnd) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1472 return &gui.bottom_sbar; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1473 FOR_ALL_WINDOWS(wp) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1474 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1475 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
|
1476 return &wp->w_scrollbars[SBAR_LEFT]; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1477 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
|
1478 return &wp->w_scrollbars[SBAR_RIGHT]; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1479 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1480 return NULL; |
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 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1484 * 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
|
1485 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1486 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1487 GetFontSize(GuiFont font) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1488 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1489 HWND hwnd = GetDesktopWindow(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1490 HDC hdc = GetWindowDC(hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1491 HFONT hfntOld = SelectFont(hdc, (HFONT)font); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1492 TEXTMETRIC tm; |
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 GetTextMetrics(hdc, &tm); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1495 gui.char_width = tm.tmAveCharWidth + tm.tmOverhang; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1496 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1497 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
|
1498 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1499 SelectFont(hdc, hfntOld); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1500 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1501 ReleaseDC(hwnd, hdc); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1502 } |
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 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1505 * 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
|
1506 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1507 int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1508 gui_mch_adjust_charheight(void) |
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 GetFontSize(gui.norm_font); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1511 return OK; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1512 } |
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 static GuiFont |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1515 get_font_handle(LOGFONT *lf) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1516 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1517 HFONT font = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1518 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1519 /* Load the font */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1520 font = CreateFontIndirect(lf); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1521 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1522 if (font == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1523 return NOFONT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1524 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1525 return (GuiFont)font; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1526 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1527 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1528 static int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1529 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
|
1530 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1531 int points; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1532 HWND hwnd; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1533 HDC hdc; |
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 hwnd = GetDesktopWindow(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1536 hdc = GetWindowDC(hwnd); |
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 points = MulDiv(pixels, 72, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1539 GetDeviceCaps(hdc, vertical ? LOGPIXELSY : LOGPIXELSX)); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1540 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1541 ReleaseDC(hwnd, hdc); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1542 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1543 return points; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1544 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1545 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1546 GuiFont |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1547 gui_mch_get_font( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1548 char_u *name, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1549 int giveErrorIfMissing) |
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 LOGFONT lf; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1552 GuiFont font = NOFONT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1553 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1554 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
|
1555 font = get_font_handle(&lf); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1556 if (font == NOFONT && giveErrorIfMissing) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1557 EMSG2(_(e_font), name); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1558 return font; |
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1561 #if defined(FEAT_EVAL) || defined(PROTO) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1562 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1563 * 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
|
1564 * 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
|
1565 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1566 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
|
1567 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
|
1568 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1569 if (name == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1570 return NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1571 return vim_strsave(name); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1572 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1573 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1574 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1575 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1576 gui_mch_free_font(GuiFont font) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1577 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1578 if (font) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1579 DeleteObject((HFONT)font); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1580 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1581 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1582 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1583 * 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
|
1584 * Return INVALCOLOR for error. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1585 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1586 guicolor_T |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1587 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
|
1588 { |
9017
7b1200ea03a1
commit https://github.com/vim/vim/commit/c285fe7c3ffdb3ec4eff20a1d1d5accfc80f1a86
Christian Brabandt <cb@256bit.org>
parents:
9013
diff
changeset
|
1589 int i; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1590 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1591 typedef struct SysColorTable |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1592 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1593 char *name; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1594 int color; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1595 } SysColorTable; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1596 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1597 static SysColorTable sys_table[] = |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1598 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1599 {"SYS_3DDKSHADOW", COLOR_3DDKSHADOW}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1600 {"SYS_3DHILIGHT", COLOR_3DHILIGHT}, |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
1601 #ifdef COLOR_3DHIGHLIGHT |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1602 {"SYS_3DHIGHLIGHT", COLOR_3DHIGHLIGHT}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1603 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1604 {"SYS_BTNHILIGHT", COLOR_BTNHILIGHT}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1605 {"SYS_BTNHIGHLIGHT", COLOR_BTNHIGHLIGHT}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1606 {"SYS_3DLIGHT", COLOR_3DLIGHT}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1607 {"SYS_3DSHADOW", COLOR_3DSHADOW}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1608 {"SYS_DESKTOP", COLOR_DESKTOP}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1609 {"SYS_INFOBK", COLOR_INFOBK}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1610 {"SYS_INFOTEXT", COLOR_INFOTEXT}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1611 {"SYS_3DFACE", COLOR_3DFACE}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1612 {"SYS_BTNFACE", COLOR_BTNFACE}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1613 {"SYS_BTNSHADOW", COLOR_BTNSHADOW}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1614 {"SYS_ACTIVEBORDER", COLOR_ACTIVEBORDER}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1615 {"SYS_ACTIVECAPTION", COLOR_ACTIVECAPTION}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1616 {"SYS_APPWORKSPACE", COLOR_APPWORKSPACE}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1617 {"SYS_BACKGROUND", COLOR_BACKGROUND}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1618 {"SYS_BTNTEXT", COLOR_BTNTEXT}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1619 {"SYS_CAPTIONTEXT", COLOR_CAPTIONTEXT}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1620 {"SYS_GRAYTEXT", COLOR_GRAYTEXT}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1621 {"SYS_HIGHLIGHT", COLOR_HIGHLIGHT}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1622 {"SYS_HIGHLIGHTTEXT", COLOR_HIGHLIGHTTEXT}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1623 {"SYS_INACTIVEBORDER", COLOR_INACTIVEBORDER}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1624 {"SYS_INACTIVECAPTION", COLOR_INACTIVECAPTION}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1625 {"SYS_INACTIVECAPTIONTEXT", COLOR_INACTIVECAPTIONTEXT}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1626 {"SYS_MENU", COLOR_MENU}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1627 {"SYS_MENUTEXT", COLOR_MENUTEXT}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1628 {"SYS_SCROLLBAR", COLOR_SCROLLBAR}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1629 {"SYS_WINDOW", COLOR_WINDOW}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1630 {"SYS_WINDOWFRAME", COLOR_WINDOWFRAME}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1631 {"SYS_WINDOWTEXT", COLOR_WINDOWTEXT} |
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 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1635 * 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
|
1636 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1637 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
|
1638 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
|
1639 return GetSysColor(sys_table[i].color); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1640 |
9013
22c29a515b53
commit https://github.com/vim/vim/commit/ab3022196ea4f1496e79b8ee85996e31c45d02f1
Christian Brabandt <cb@256bit.org>
parents:
8835
diff
changeset
|
1641 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
|
1642 } |
9017
7b1200ea03a1
commit https://github.com/vim/vim/commit/c285fe7c3ffdb3ec4eff20a1d1d5accfc80f1a86
Christian Brabandt <cb@256bit.org>
parents:
9013
diff
changeset
|
1643 |
11745
5a5709918a98
patch 8.0.0755: terminal window does not have colors in the GUI
Christian Brabandt <cb@256bit.org>
parents:
11410
diff
changeset
|
1644 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
|
1645 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
|
1646 { |
5a5709918a98
patch 8.0.0755: terminal window does not have colors in the GUI
Christian Brabandt <cb@256bit.org>
parents:
11410
diff
changeset
|
1647 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
|
1648 } |
5a5709918a98
patch 8.0.0755: terminal window does not have colors in the GUI
Christian Brabandt <cb@256bit.org>
parents:
11410
diff
changeset
|
1649 |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1650 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1651 * 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
|
1652 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1653 int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1654 gui_mch_haskey(char_u *name) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1655 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1656 int i; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1657 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1658 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
|
1659 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
|
1660 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
|
1661 return OK; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1662 return FAIL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1663 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1664 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1665 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1666 gui_mch_beep(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1667 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1668 MessageBeep(MB_OK); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1669 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1670 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1671 * 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
|
1672 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1673 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1674 gui_mch_invert_rectangle( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1675 int r, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1676 int c, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1677 int nr, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1678 int nc) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1679 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1680 RECT rc; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1681 |
12934
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
1682 #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
|
1683 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
|
1684 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
|
1685 #endif |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
1686 |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1687 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1688 * 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
|
1689 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1690 rc.left = FILL_X(c); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1691 rc.top = FILL_Y(r); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1692 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
|
1693 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
|
1694 InvertRect(s_hdc, &rc); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1695 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1696 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1697 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1698 * Iconify the GUI window. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1699 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1700 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1701 gui_mch_iconify(void) |
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 ShowWindow(s_hwnd, SW_MINIMIZE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1704 } |
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 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1707 * Draw a cursor without focus. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1708 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1709 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1710 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
|
1711 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1712 HBRUSH hbr; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1713 RECT rc; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1714 |
12934
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
1715 #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
|
1716 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
|
1717 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
|
1718 #endif |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
1719 |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1720 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1721 * 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
|
1722 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1723 rc.left = FILL_X(gui.col); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1724 rc.top = FILL_Y(gui.row); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1725 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
|
1726 #ifdef FEAT_MBYTE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1727 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
|
1728 rc.right += gui.char_width; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1729 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1730 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
|
1731 hbr = CreateSolidBrush(color); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1732 FrameRect(s_hdc, &rc, hbr); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1733 DeleteBrush(hbr); |
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 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1736 * 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
|
1737 * color "color". |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1738 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1739 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1740 gui_mch_draw_part_cursor( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1741 int w, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1742 int h, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1743 guicolor_T color) |
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 RECT rc; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1746 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1747 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1748 * 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
|
1749 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1750 rc.left = |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1751 #ifdef FEAT_RIGHTLEFT |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1752 /* 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
|
1753 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
|
1754 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1755 FILL_X(gui.col); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1756 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
|
1757 rc.right = rc.left + w; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1758 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
|
1759 |
12986
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
1760 fill_rect(&rc, NULL, color); |
8140
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1763 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1764 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1765 * 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
|
1766 * 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
|
1767 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1768 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1769 outputDeadKey_rePost(MSG originalMsg) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1770 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1771 static MSG deadCharExpel; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1772 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1773 if (!dead_key) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1774 return; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1775 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1776 dead_key = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1777 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1778 /* 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
|
1779 deadCharExpel.message = originalMsg.message; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1780 deadCharExpel.hwnd = originalMsg.hwnd; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1781 deadCharExpel.wParam = VK_SPACE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1782 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1783 MyTranslateMessage(&deadCharExpel); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1784 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1785 /* 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
|
1786 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
|
1787 originalMsg.lParam); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1788 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1789 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1790 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1791 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1792 * Process a single Windows message. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1793 * 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
|
1794 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1795 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1796 process_message(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1797 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1798 MSG msg; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1799 UINT vk = 0; /* Virtual key */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1800 char_u string[40]; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1801 int i; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1802 int modifiers = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1803 int key; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1804 #ifdef FEAT_MENU |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1805 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
|
1806 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1807 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1808 pGetMessage(&msg, NULL, 0, 0); |
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 #ifdef FEAT_OLE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1811 /* Look after OLE Automation commands */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1812 if (msg.message == WM_OLE) |
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 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
|
1815 if (str == NULL || *str == NUL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1816 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1817 /* 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
|
1818 * 3.0.4 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1819 pDispatchMessage(&msg); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1820 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1821 else |
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 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
|
1824 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
|
1825 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1826 return; |
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 #endif |
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 #ifdef MSWIN_FIND_REPLACE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1831 /* 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
|
1832 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
|
1833 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1834 HandleMouseHide(msg.message, msg.lParam); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1835 return; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1836 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1837 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1838 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1839 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1840 * 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
|
1841 * TranslateMessage(). |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1842 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1843 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
|
1844 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1845 vk = (int) msg.wParam; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1846 |
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 * 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
|
1849 * handle them and do not interfere. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1850 * |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1851 * 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
|
1852 * - 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
|
1853 * 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
|
1854 * dead character on its own) |
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 * - 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
|
1857 * 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
|
1858 * 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
|
1859 * immediately to _OnChar() (or _OnSysChar()). |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1860 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1861 if (dead_key) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1862 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1863 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1864 * 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
|
1865 * 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
|
1866 * 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
|
1867 * handle it. |
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 * 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
|
1870 * 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
|
1871 * 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
|
1872 * 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
|
1873 * user expects. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1874 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1875 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
|
1876 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1877 dead_key = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1878 MyTranslateMessage(&msg); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1879 return; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1880 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1881 /* 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
|
1882 * normally */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1883 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
|
1884 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1885 outputDeadKey_rePost(msg); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1886 return; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1887 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1888 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1889 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1890 /* Check for CTRL-BREAK */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1891 if (vk == VK_CANCEL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1892 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1893 trash_input_buf(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1894 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
|
1895 ctrl_break_was_pressed = TRUE; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1896 string[0] = Ctrl_C; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1897 add_to_input_buf(string, 1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1898 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1899 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1900 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
|
1901 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1902 /* 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
|
1903 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
|
1904 && (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
|
1905 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1906 /* |
9252
c25898cc99c1
commit https://github.com/vim/vim/commit/945ec093cd4ddefab930239990564b12eb232153
Christian Brabandt <cb@256bit.org>
parents:
9236
diff
changeset
|
1907 * 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
|
1908 * 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
|
1909 * 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
|
1910 * the TAB key, etc...). |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1911 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1912 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
|
1913 || vk == VK_TAB || vk == CAR)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1914 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1915 outputDeadKey_rePost(msg); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1916 return; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1917 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1918 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1919 #ifdef FEAT_MENU |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1920 /* 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
|
1921 * 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
|
1922 if (vk == VK_F10 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1923 && gui.menu_is_active |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1924 && 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
|
1925 NULL, NULL) == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1926 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1927 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1928 if (GetKeyState(VK_SHIFT) & 0x8000) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1929 modifiers |= MOD_MASK_SHIFT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1930 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1931 * 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
|
1932 * 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
|
1933 * shifted -- webb |
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 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1936 if (GetKeyState(VK_CAPITAL) & 0x0001) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1937 modifiers ^= MOD_MASK_SHIFT; |
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 if (GetKeyState(VK_CONTROL) & 0x8000) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1940 modifiers |= MOD_MASK_CTRL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1941 if (GetKeyState(VK_MENU) & 0x8000) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1942 modifiers |= MOD_MASK_ALT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1943 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1944 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
|
1945 key = special_keys[i].vim_code0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1946 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1947 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
|
1948 special_keys[i].vim_code1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1949 key = simplify_key(key, &modifiers); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1950 if (key == CSI) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1951 key = K_CSI; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1952 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1953 if (modifiers) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1954 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1955 string[0] = CSI; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1956 string[1] = KS_MODIFIER; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1957 string[2] = modifiers; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1958 add_to_input_buf(string, 3); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1959 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1960 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1961 if (IS_SPECIAL(key)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1962 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1963 string[0] = CSI; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1964 string[1] = K_SECOND(key); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1965 string[2] = K_THIRD(key); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1966 add_to_input_buf(string, 3); |
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 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1969 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1970 int len; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1971 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1972 /* Handle "key" as a Unicode character. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1973 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
|
1974 add_to_input_buf(string, len); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1975 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1976 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1977 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1978 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1979 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
|
1980 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1981 /* 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
|
1982 * 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
|
1983 * 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
|
1984 if (vk != 0xff |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1985 && (GetKeyState(VK_CONTROL) & 0x8000) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1986 && !(GetKeyState(VK_SHIFT) & 0x8000) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1987 && !(GetKeyState(VK_MENU) & 0x8000)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1988 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1989 /* 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
|
1990 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
|
1991 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1992 string[0] = Ctrl_HAT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1993 add_to_input_buf(string, 1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1994 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1995 /* 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
|
1996 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
|
1997 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1998 string[0] = Ctrl__; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1999 add_to_input_buf(string, 1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2000 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2001 /* 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
|
2002 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
|
2003 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2004 string[0] = Ctrl_AT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2005 add_to_input_buf(string, 1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2006 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2007 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2008 MyTranslateMessage(&msg); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2009 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2010 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2011 MyTranslateMessage(&msg); |
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 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2014 #ifdef FEAT_MBYTE_IME |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2015 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
|
2016 _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
|
2017 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
|
2018 /* 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
|
2019 MyTranslateMessage(&msg); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2020 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2021 #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
|
2022 /* GIME_TEST */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2023 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
|
2024 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2025 POINT point; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2026 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2027 global_ime_set_font(&norm_logfont); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2028 point.x = FILL_X(gui.col); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2029 point.y = FILL_Y(gui.row); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2030 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
|
2031 global_ime_set_position(&point); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2032 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2033 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2034 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2035 #ifdef FEAT_MENU |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2036 /* 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
|
2037 * 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
|
2038 * key-up event) */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2039 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
|
2040 NULL, NULL) == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2041 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2042 pDispatchMessage(&msg); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2043 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2044 |
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 * 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
|
2047 * 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
|
2048 * 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
|
2049 * immediately. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2050 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2051 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2052 gui_mch_update(void) |
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 MSG msg; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2055 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2056 if (!s_busy_processing) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2057 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
|
2058 && !vim_is_input_buf_full()) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2059 process_message(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2060 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2061 |
9179
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2062 static void |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2063 remove_any_timer(void) |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2064 { |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2065 MSG msg; |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2066 |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2067 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
|
2068 { |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2069 KillTimer(NULL, s_wait_timer); |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2070 |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2071 /* Eat spurious WM_TIMER messages */ |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2072 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
|
2073 ; |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2074 s_wait_timer = 0; |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2075 } |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2076 } |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2077 |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2078 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2079 * 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
|
2080 * from the keyboard. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2081 * wtime == -1 Wait forever. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2082 * wtime == 0 This should never happen. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2083 * 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
|
2084 * 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
|
2085 * or FAIL otherwise. |
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 int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2088 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
|
2089 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2090 int focus; |
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 s_timed_out = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2093 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2094 if (wtime > 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2095 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2096 /* Don't do anything while processing a (scroll) message. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2097 if (s_busy_processing) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2098 return FAIL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2099 s_wait_timer = (UINT)SetTimer(NULL, 0, (UINT)wtime, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2100 (TIMERPROC)_OnTimer); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2101 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2102 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2103 allow_scrollbar = TRUE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2104 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2105 focus = gui.in_focus; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2106 while (!s_timed_out) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2107 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2108 /* 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
|
2109 if (gui.in_focus != focus) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2110 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2111 if (gui.in_focus) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2112 gui_mch_start_blink(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2113 else |
13152
f4c3a7f410f4
patch 8.0.1450: GUI: endless loop when stopping cursor blinking
Christian Brabandt <cb@256bit.org>
parents:
13150
diff
changeset
|
2114 gui_mch_stop_blink(TRUE); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2115 focus = gui.in_focus; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2116 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2117 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2118 if (s_need_activate) |
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 (void)SetForegroundWindow(s_hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2121 s_need_activate = FALSE; |
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 |
9179
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2124 #ifdef FEAT_TIMERS |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2125 did_add_timer = FALSE; |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2126 #endif |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2127 #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
|
2128 /* 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
|
2129 for (;;) |
4f0677020a43
commit https://github.com/vim/vim/commit/9186a276222ea8a7c88f4092ac5b4201381f4e20
Christian Brabandt <cb@256bit.org>
parents:
8172
diff
changeset
|
2130 { |
4f0677020a43
commit https://github.com/vim/vim/commit/9186a276222ea8a7c88f4092ac5b4201381f4e20
Christian Brabandt <cb@256bit.org>
parents:
8172
diff
changeset
|
2131 MSG msg; |
4f0677020a43
commit https://github.com/vim/vim/commit/9186a276222ea8a7c88f4092ac5b4201381f4e20
Christian Brabandt <cb@256bit.org>
parents:
8172
diff
changeset
|
2132 |
4f0677020a43
commit https://github.com/vim/vim/commit/9186a276222ea8a7c88f4092ac5b4201381f4e20
Christian Brabandt <cb@256bit.org>
parents:
8172
diff
changeset
|
2133 parse_queued_messages(); |
4f0677020a43
commit https://github.com/vim/vim/commit/9186a276222ea8a7c88f4092ac5b4201381f4e20
Christian Brabandt <cb@256bit.org>
parents:
8172
diff
changeset
|
2134 |
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
|
2135 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
|
2136 { |
c4caf49c8bf4
patch 8.0.0925: MS-Windows GUI: channel I/O not handled right away
Christian Brabandt <cb@256bit.org>
parents:
12066
diff
changeset
|
2137 process_message(); |
8222
4f0677020a43
commit https://github.com/vim/vim/commit/9186a276222ea8a7c88f4092ac5b4201381f4e20
Christian Brabandt <cb@256bit.org>
parents:
8172
diff
changeset
|
2138 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
|
2139 } |
c4caf49c8bf4
patch 8.0.0925: MS-Windows GUI: channel I/O not handled right away
Christian Brabandt <cb@256bit.org>
parents:
12066
diff
changeset
|
2140 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
|
2141 != 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
|
2142 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
|
2143 } |
c4caf49c8bf4
patch 8.0.0925: MS-Windows GUI: channel I/O not handled right away
Christian Brabandt <cb@256bit.org>
parents:
12066
diff
changeset
|
2144 #else |
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 * 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
|
2147 * 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
|
2148 * 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
|
2149 * 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
|
2150 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2151 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
|
2152 #endif |
8140
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 if (input_available()) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2155 { |
9179
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2156 remove_any_timer(); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2157 allow_scrollbar = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2158 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2159 /* 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
|
2160 * 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
|
2161 * 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
|
2162 if (!s_getting_focus) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2163 s_button_pending = -1; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2164 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2165 return OK; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2166 } |
9179
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2167 |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2168 #ifdef FEAT_TIMERS |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2169 if (did_add_timer) |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2170 { |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2171 /* Need to recompute the waiting time. */ |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2172 remove_any_timer(); |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2173 break; |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2174 } |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2175 #endif |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2176 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2177 allow_scrollbar = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2178 return FAIL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2179 } |
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 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2182 * 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
|
2183 * (row2, col2) inclusive. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2184 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2185 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2186 gui_mch_clear_block( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2187 int row1, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2188 int col1, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2189 int row2, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2190 int col2) |
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 RECT rc; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2193 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2194 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2195 * 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
|
2196 * spilled over to the window border. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2197 * 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
|
2198 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2199 rc.left = FILL_X(col1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2200 rc.top = FILL_Y(row1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2201 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
|
2202 rc.bottom = FILL_Y(row2 + 1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2203 clear_rect(&rc); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2204 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2205 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2206 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2207 * Clear the whole text window. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2208 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2209 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2210 gui_mch_clear_all(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2211 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2212 RECT rc; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2213 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2214 rc.left = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2215 rc.top = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2216 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
|
2217 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
|
2218 clear_rect(&rc); |
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 * Menu stuff. |
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 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2225 gui_mch_enable_menu(int flag) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2226 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2227 #ifdef FEAT_MENU |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2228 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
|
2229 #endif |
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 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2233 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
|
2234 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
|
2235 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
|
2236 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
|
2237 int h UNUSED) |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2238 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2239 /* 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
|
2240 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2241 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2242 #if defined(FEAT_MENU) || defined(PROTO) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2243 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2244 * 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
|
2245 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2246 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2247 gui_mch_menu_hidden( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2248 vimmenu_T *menu, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2249 int hidden) |
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 * 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
|
2253 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2254 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2255 if (hidden) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2256 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
|
2257 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2258 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
|
2259 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2260 gui_mch_menu_grey(menu, hidden); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2261 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2262 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2263 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2264 * 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
|
2265 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2266 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2267 gui_mch_draw_menubar(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2268 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2269 DrawMenuBar(s_hwnd); |
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 #endif /*FEAT_MENU*/ |
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 #ifndef PROTO |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2274 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2275 #ifdef VIMDLL |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2276 _export |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2277 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2278 _cdecl |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2279 SaveInst(HINSTANCE hInst) |
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 s_hinst = hInst; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2282 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2283 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2284 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2285 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2286 * 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
|
2287 */ |
9939
ccb6461b82df
commit https://github.com/vim/vim/commit/1b58cdd160c2e0ada0f638679a2aa27e4665fc48
Christian Brabandt <cb@256bit.org>
parents:
9834
diff
changeset
|
2288 guicolor_T |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2289 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
|
2290 { |
9939
ccb6461b82df
commit https://github.com/vim/vim/commit/1b58cdd160c2e0ada0f638679a2aa27e4665fc48
Christian Brabandt <cb@256bit.org>
parents:
9834
diff
changeset
|
2291 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
|
2292 + GetBValue(pixel)); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2293 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2294 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2295 #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
|
2296 /* 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
|
2297 static WORD |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2298 PixelToDialogX(int numPixels) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2299 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2300 return (WORD)((numPixels * 4) / s_dlgfntwidth); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2301 } |
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 /* 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
|
2304 static WORD |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2305 PixelToDialogY(int numPixels) |
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 return (WORD)((numPixels * 8) / s_dlgfntheight); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2308 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2309 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2310 /* 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
|
2311 static int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2312 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
|
2313 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2314 SIZE size; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2315 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2316 GetTextExtentPoint(hdc, (LPCSTR)str, len, &size); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2317 return size.cx; |
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2320 #ifdef FEAT_MBYTE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2321 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2322 * Return 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
|
2323 * of 'encoding' to active codepage conversion. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2324 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2325 static int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2326 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
|
2327 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2328 SIZE size; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2329 WCHAR *wstr; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2330 int n; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2331 int wlen = len; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2332 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2333 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2334 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2335 /* 'encoding' differs from active codepage: convert text and use wide |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2336 * function */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2337 wstr = enc_to_utf16(str, &wlen); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2338 if (wstr != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2339 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2340 n = GetTextExtentPointW(hdc, wstr, wlen, &size); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2341 vim_free(wstr); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2342 if (n) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2343 return size.cx; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2344 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2345 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2346 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2347 return GetTextWidth(hdc, str, len); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2348 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2349 #else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2350 # define GetTextWidthEnc(h, s, l) GetTextWidth((h), (s), (l)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2351 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2352 |
10438
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2353 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
|
2354 |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2355 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2356 * 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
|
2357 * 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
|
2358 * monitors. |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2359 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2360 static BOOL |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2361 CenterWindow( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2362 HWND hwndChild, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2363 HWND hwndParent) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2364 { |
10438
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2365 HMONITOR mon; |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2366 MONITORINFO moninfo; |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2367 RECT rChild, rParent, rScreen; |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2368 int wChild, hChild, wParent, hParent; |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2369 int xNew, yNew; |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2370 HDC hdc; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2371 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2372 GetWindowRect(hwndChild, &rChild); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2373 wChild = rChild.right - rChild.left; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2374 hChild = rChild.bottom - rChild.top; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2375 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2376 /* 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
|
2377 if (hwndParent == NULL || IsMinimized(hwndParent)) |
10438
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2378 get_work_area(&rParent); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2379 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2380 GetWindowRect(hwndParent, &rParent); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2381 wParent = rParent.right - rParent.left; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2382 hParent = rParent.bottom - rParent.top; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2383 |
10438
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2384 moninfo.cbSize = sizeof(MONITORINFO); |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2385 mon = MonitorFromWindow(hwndChild, MONITOR_DEFAULTTOPRIMARY); |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2386 if (mon != NULL && GetMonitorInfo(mon, &moninfo)) |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2387 { |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2388 rScreen = moninfo.rcWork; |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2389 } |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2390 else |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2391 { |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2392 hdc = GetDC(hwndChild); |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2393 rScreen.left = 0; |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2394 rScreen.top = 0; |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2395 rScreen.right = GetDeviceCaps(hdc, HORZRES); |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2396 rScreen.bottom = GetDeviceCaps(hdc, VERTRES); |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2397 ReleaseDC(hwndChild, hdc); |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2398 } |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2399 |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2400 xNew = rParent.left + ((wParent - wChild) / 2); |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2401 if (xNew < rScreen.left) |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2402 xNew = rScreen.left; |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2403 else if ((xNew + wChild) > rScreen.right) |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2404 xNew = rScreen.right - wChild; |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2405 |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2406 yNew = rParent.top + ((hParent - hChild) / 2); |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2407 if (yNew < rScreen.top) |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2408 yNew = rScreen.top; |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2409 else if ((yNew + hChild) > rScreen.bottom) |
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
2410 yNew = rScreen.bottom - hChild; |
8140
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 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
|
2413 SWP_NOSIZE | SWP_NOZORDER); |
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 #endif /* FEAT_GUI_DIALOG */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2416 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2417 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2418 gui_mch_activate_window(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2419 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2420 (void)SetActiveWindow(s_hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2421 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2422 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2423 #if defined(FEAT_TOOLBAR) || defined(PROTO) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2424 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2425 gui_mch_show_toolbar(int showit) |
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 if (s_toolbarhwnd == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2428 return; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2429 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2430 if (showit) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2431 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2432 # ifdef FEAT_MBYTE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2433 # ifndef TB_SETUNICODEFORMAT |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2434 /* For older compilers. We assume this never changes. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2435 # define TB_SETUNICODEFORMAT 0x2005 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2436 # endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2437 /* Enable/disable unicode support */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2438 int uu = (enc_codepage >= 0 && (int)GetACP() != enc_codepage); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2439 SendMessage(s_toolbarhwnd, TB_SETUNICODEFORMAT, (WPARAM)uu, (LPARAM)0); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2440 # endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2441 ShowWindow(s_toolbarhwnd, SW_SHOW); |
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 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2444 ShowWindow(s_toolbarhwnd, SW_HIDE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2445 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2446 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2447 /* Then number of bitmaps is fixed. Exit is missing! */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2448 #define TOOLBAR_BITMAP_COUNT 31 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2449 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2450 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2451 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2452 #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
|
2453 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2454 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
|
2455 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2456 #ifdef FEAT_MBYTE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2457 WCHAR *wn = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2458 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2459 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2460 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2461 /* 'encoding' differs from active codepage: convert menu name |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2462 * and use wide function */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2463 wn = enc_to_utf16(item_text, NULL); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2464 if (wn != NULL) |
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 MENUITEMINFOW infow; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2467 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2468 infow.cbSize = sizeof(infow); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2469 infow.fMask = MIIM_TYPE | MIIM_ID; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2470 infow.wID = item_id; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2471 infow.fType = MFT_STRING; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2472 infow.dwTypeData = wn; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2473 infow.cch = (UINT)wcslen(wn); |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
2474 InsertMenuItemW(pmenu, item_id, FALSE, &infow); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2475 vim_free(wn); |
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 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2478 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2479 if (wn == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2480 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2481 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2482 MENUITEMINFO info; |
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 info.cbSize = sizeof(info); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2485 info.fMask = MIIM_TYPE | MIIM_ID; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2486 info.wID = item_id; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2487 info.fType = MFT_STRING; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2488 info.dwTypeData = (LPTSTR)item_text; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2489 info.cch = (UINT)STRLEN(item_text); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2490 InsertMenuItem(pmenu, item_id, FALSE, &info); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2491 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2492 } |
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 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2495 show_tabline_popup_menu(void) |
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 HMENU tab_pmenu; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2498 long rval; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2499 POINT pt; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2500 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2501 /* 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
|
2502 if (hold_gui_events |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2503 # ifdef FEAT_CMDWIN |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2504 || cmdwin_type != 0 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2505 # endif |
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 return; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2508 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2509 tab_pmenu = CreatePopupMenu(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2510 if (tab_pmenu == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2511 return; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2512 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2513 if (first_tabpage->tp_next != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2514 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
|
2515 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
|
2516 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
|
2517 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
|
2518 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
|
2519 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
|
2520 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2521 GetCursorPos(&pt); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2522 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
|
2523 NULL); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2524 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2525 DestroyMenu(tab_pmenu); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2526 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2527 /* 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
|
2528 if (rval > 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2529 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2530 TCHITTESTINFO htinfo; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2531 int idx; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2532 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2533 if (ScreenToClient(s_tabhwnd, &pt) == 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2534 return; |
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 htinfo.pt.x = pt.x; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2537 htinfo.pt.y = pt.y; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2538 idx = TabCtrl_HitTest(s_tabhwnd, &htinfo); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2539 if (idx == -1) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2540 idx = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2541 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2542 idx += 1; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2543 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2544 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
|
2545 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2546 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2547 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2548 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2549 * Show or hide the tabline. |
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 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2552 gui_mch_show_tabline(int showit) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2553 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2554 if (s_tabhwnd == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2555 return; |
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 (!showit != !showing_tabline) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2558 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2559 if (showit) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2560 ShowWindow(s_tabhwnd, SW_SHOW); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2561 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2562 ShowWindow(s_tabhwnd, SW_HIDE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2563 showing_tabline = showit; |
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 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2566 |
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 * Return TRUE when tabline is displayed. |
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 int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2571 gui_mch_showing_tabline(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2572 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2573 return s_tabhwnd != NULL && showing_tabline; |
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2576 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2577 * Update the labels of the tabline. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2578 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2579 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2580 gui_mch_update_tabline(void) |
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 tabpage_T *tp; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2583 TCITEM tie; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2584 int nr = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2585 int curtabidx = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2586 int tabadded = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2587 #ifdef FEAT_MBYTE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2588 static int use_unicode = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2589 int uu; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2590 WCHAR *wstr = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2591 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2592 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2593 if (s_tabhwnd == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2594 return; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2595 |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
2596 #ifdef FEAT_MBYTE |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2597 # ifndef CCM_SETUNICODEFORMAT |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2598 /* For older compilers. We assume this never changes. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2599 # define CCM_SETUNICODEFORMAT 0x2005 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2600 # endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2601 uu = (enc_codepage >= 0 && (int)GetACP() != enc_codepage); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2602 if (uu != use_unicode) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2603 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2604 /* Enable/disable unicode support */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2605 SendMessage(s_tabhwnd, CCM_SETUNICODEFORMAT, (WPARAM)uu, (LPARAM)0); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2606 use_unicode = uu; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2607 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2608 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2609 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2610 tie.mask = TCIF_TEXT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2611 tie.iImage = -1; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2612 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2613 /* 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
|
2614 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
|
2615 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2616 /* 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
|
2617 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
|
2618 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2619 if (tp == curtab) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2620 curtabidx = nr; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2621 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2622 if (nr >= TabCtrl_GetItemCount(s_tabhwnd)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2623 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2624 /* Add the tab */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2625 tie.pszText = "-Empty-"; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2626 TabCtrl_InsertItem(s_tabhwnd, nr, &tie); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2627 tabadded = 1; |
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2630 get_tabline_label(tp, FALSE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2631 tie.pszText = (LPSTR)NameBuff; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2632 #ifdef FEAT_MBYTE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2633 wstr = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2634 if (use_unicode) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2635 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2636 /* Need to go through Unicode. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2637 wstr = enc_to_utf16(NameBuff, NULL); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2638 if (wstr != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2639 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2640 TCITEMW tiw; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2641 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2642 tiw.mask = TCIF_TEXT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2643 tiw.iImage = -1; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2644 tiw.pszText = wstr; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2645 SendMessage(s_tabhwnd, TCM_SETITEMW, (WPARAM)nr, (LPARAM)&tiw); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2646 vim_free(wstr); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2647 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2648 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2649 if (wstr == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2650 #endif |
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 TabCtrl_SetItem(s_tabhwnd, nr, &tie); |
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 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2655 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2656 /* Remove any old labels. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2657 while (nr < TabCtrl_GetItemCount(s_tabhwnd)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2658 TabCtrl_DeleteItem(s_tabhwnd, nr); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2659 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2660 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
|
2661 TabCtrl_SetCurSel(s_tabhwnd, curtabidx); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2662 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2663 /* Re-enable redraw and redraw. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2664 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
|
2665 RedrawWindow(s_tabhwnd, NULL, NULL, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2666 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
|
2667 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2668 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
|
2669 TabCtrl_SetCurSel(s_tabhwnd, curtabidx); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2670 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2671 |
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 * 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
|
2674 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2675 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2676 gui_mch_set_curtab(int nr) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2677 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2678 if (s_tabhwnd == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2679 return; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2680 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2681 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
|
2682 TabCtrl_SetCurSel(s_tabhwnd, nr - 1); |
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2685 #endif |
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 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2688 * ":simalt" command. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2689 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2690 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2691 ex_simalt(exarg_T *eap) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2692 { |
11386
e2b34123c7dc
patch 8.0.0578: :simalt on MS-Windows does not work properly
Christian Brabandt <cb@256bit.org>
parents:
11129
diff
changeset
|
2693 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
|
2694 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
|
2695 char_u key_name[4]; |
8140
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 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
|
2698 while (*keys) |
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 if (*keys == '~') |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2701 *keys = ' '; /* for showing system menu */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2702 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
|
2703 keys++; |
11386
e2b34123c7dc
patch 8.0.0578: :simalt on MS-Windows does not work properly
Christian Brabandt <cb@256bit.org>
parents:
11129
diff
changeset
|
2704 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
|
2705 } |
e2b34123c7dc
patch 8.0.0578: :simalt on MS-Windows does not work properly
Christian Brabandt <cb@256bit.org>
parents:
11129
diff
changeset
|
2706 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
|
2707 { |
11410
db21cc7b40f0
patch 8.0.0589: :simalt still does not work
Christian Brabandt <cb@256bit.org>
parents:
11386
diff
changeset
|
2708 /* 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
|
2709 * processed. */ |
e2b34123c7dc
patch 8.0.0578: :simalt on MS-Windows does not work properly
Christian Brabandt <cb@256bit.org>
parents:
11129
diff
changeset
|
2710 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
|
2711 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
|
2712 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
|
2713 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
|
2714 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
|
2715 (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
|
2716 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2717 } |
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 * Create the find & replace dialogs. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2721 * 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
|
2722 * 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
|
2723 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2724 #ifdef MSWIN_FIND_REPLACE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2725 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2726 initialise_findrep(char_u *initial_string) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2727 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2728 int wword = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2729 int mcase = !p_ic; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2730 char_u *entry_text; |
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 /* Get the search string to use. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2733 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
|
2734 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2735 s_findrep_struct.hwndOwner = s_hwnd; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2736 s_findrep_struct.Flags = FR_DOWN; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2737 if (mcase) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2738 s_findrep_struct.Flags |= FR_MATCHCASE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2739 if (wword) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2740 s_findrep_struct.Flags |= FR_WHOLEWORD; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2741 if (entry_text != NULL && *entry_text != NUL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2742 vim_strncpy((char_u *)s_findrep_struct.lpstrFindWhat, entry_text, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2743 s_findrep_struct.wFindWhatLen - 1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2744 vim_free(entry_text); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2745 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2746 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2747 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2748 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2749 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
|
2750 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2751 #ifdef FEAT_MBYTE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2752 if (title != NULL && enc_codepage >= 0 && enc_codepage != (int)GetACP()) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2753 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2754 WCHAR *wbuf; |
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 /* 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
|
2757 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
|
2758 if (wbuf != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2759 { |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
2760 SetWindowTextW(hwnd, wbuf); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2761 vim_free(wbuf); |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
2762 } |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
2763 return; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2764 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2765 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2766 (void)SetWindowText(hwnd, (LPCSTR)title); |
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2769 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2770 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
|
2771 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2772 #ifdef MSWIN_FIND_REPLACE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2773 if (s_findrep_msg != 0) |
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 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
|
2776 DestroyWindow(s_findrep_hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2777 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2778 if (!IsWindow(s_findrep_hwnd)) |
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 initialise_findrep(eap->arg); |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
2781 # ifdef FEAT_MBYTE |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2782 /* If the OS is Windows NT, and 'encoding' differs from active |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2783 * codepage: convert text and use wide function. */ |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
2784 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2785 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2786 findrep_atow(&s_findrep_struct_w, &s_findrep_struct); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2787 s_findrep_hwnd = FindTextW( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2788 (LPFINDREPLACEW) &s_findrep_struct_w); |
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 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2791 # endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2792 s_findrep_hwnd = FindText((LPFINDREPLACE) &s_findrep_struct); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2793 } |
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 set_window_title(s_findrep_hwnd, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2796 _("Find string (use '\\\\' to find a '\\')")); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2797 (void)SetFocus(s_findrep_hwnd); |
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 s_findrep_is_find = TRUE; |
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 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2802 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2803 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2804 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2805 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2806 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
|
2807 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2808 #ifdef MSWIN_FIND_REPLACE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2809 if (s_findrep_msg != 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2810 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2811 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
|
2812 DestroyWindow(s_findrep_hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2813 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2814 if (!IsWindow(s_findrep_hwnd)) |
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 initialise_findrep(eap->arg); |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
2817 # ifdef FEAT_MBYTE |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
2818 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2819 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2820 findrep_atow(&s_findrep_struct_w, &s_findrep_struct); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2821 s_findrep_hwnd = ReplaceTextW( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2822 (LPFINDREPLACEW) &s_findrep_struct_w); |
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 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2825 # endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2826 s_findrep_hwnd = ReplaceText( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2827 (LPFINDREPLACE) &s_findrep_struct); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2828 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2829 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2830 set_window_title(s_findrep_hwnd, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2831 _("Find & Replace (use '\\\\' to find a '\\')")); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2832 (void)SetFocus(s_findrep_hwnd); |
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 s_findrep_is_find = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2835 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2836 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2837 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2838 |
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 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2841 * Set visibility of the pointer. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2842 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2843 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2844 gui_mch_mousehide(int hide) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2845 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2846 if (hide != gui.pointer_hidden) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2847 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2848 ShowCursor(!hide); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2849 gui.pointer_hidden = hide; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2850 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2851 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2852 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2853 #ifdef FEAT_MENU |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2854 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2855 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
|
2856 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2857 /* 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
|
2858 gui_mch_mousehide(FALSE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2859 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2860 (void)TrackPopupMenu( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2861 (HMENU)menu->submenu_id, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2862 TPM_LEFTALIGN | TPM_LEFTBUTTON, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2863 x, y, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2864 (int)0, /*reserved param*/ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2865 s_hwnd, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2866 NULL); |
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 * 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
|
2869 * 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
|
2870 */ |
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 #endif |
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 * 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
|
2876 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2877 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2878 _OnEndSession(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2879 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2880 getout_preserve_modified(1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2881 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2882 |
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 * 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
|
2885 * of a Windows95 window. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2886 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2887 static void |
10783
04eb70c77cf4
patch 8.0.0281: some files are still using ARGSUSED instead of UNUSED
Christian Brabandt <cb@256bit.org>
parents:
10440
diff
changeset
|
2888 _OnClose(HWND hwnd UNUSED) |
8140
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 gui_shell_closed(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2891 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2892 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2893 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2894 * 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
|
2895 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2896 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
|
2897 _OnDestroy(HWND hwnd) |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2898 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2899 if (!destroying) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2900 _OnClose(hwnd); |
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 _OnPaint( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2905 HWND hwnd) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2906 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2907 if (!IsMinimized(hwnd)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2908 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2909 PAINTSTRUCT ps; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2910 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2911 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
|
2912 (void)BeginPaint(hwnd, &ps); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2913 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2914 #ifdef FEAT_MBYTE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2915 /* 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
|
2916 * rectangle */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2917 if (has_mbyte) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2918 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2919 RECT rect; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2920 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2921 GetClientRect(hwnd, &rect); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2922 ps.rcPaint.left = rect.left; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2923 ps.rcPaint.right = rect.right; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2924 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2925 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2926 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2927 if (!IsRectEmpty(&ps.rcPaint)) |
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 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
|
2930 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
|
2931 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
|
2932 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2933 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2934 EndPaint(hwnd, &ps); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2935 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2936 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2937 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2938 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2939 _OnSize( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2940 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
|
2941 UINT state UNUSED, |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2942 int cx, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2943 int cy) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2944 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2945 if (!IsMinimized(hwnd)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2946 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2947 gui_resize_shell(cx, cy); |
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 #ifdef FEAT_MENU |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2950 /* Menu bar may wrap differently now */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2951 gui_mswin_get_menu_height(TRUE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2952 #endif |
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2956 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2957 _OnSetFocus( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2958 HWND hwnd, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2959 HWND hwndOldFocus) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2960 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2961 gui_focus_change(TRUE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2962 s_getting_focus = TRUE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2963 (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
|
2964 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2965 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2966 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2967 _OnKillFocus( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2968 HWND hwnd, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2969 HWND hwndNewFocus) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2970 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2971 gui_focus_change(FALSE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2972 s_getting_focus = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2973 (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
|
2974 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2975 |
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 * 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
|
2978 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2979 static LRESULT |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2980 _OnActivateApp( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2981 HWND hwnd, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2982 BOOL fActivate, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2983 DWORD dwThreadId) |
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 /* 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
|
2986 /* gui_focus_change((int)fActivate); */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2987 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
|
2988 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2989 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2990 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2991 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
|
2992 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2993 DestroyWindow(sb->id); |
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 |
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 * 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
|
2998 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2999 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3000 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
|
3001 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3002 RECT rct; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3003 POINT mp; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3004 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3005 (void)GetWindowRect(s_textArea, &rct); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3006 (void)GetCursorPos((LPPOINT)&mp); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3007 *x = (int)(mp.x - rct.left); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3008 *y = (int)(mp.y - rct.top); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3009 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3010 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3011 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3012 * 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
|
3013 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3014 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3015 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
|
3016 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3017 RECT rct; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3018 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3019 (void)GetWindowRect(s_textArea, &rct); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3020 (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
|
3021 y + gui.border_offset + rct.top); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3022 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3023 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3024 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3025 gui_mswin_get_valid_dimensions( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3026 int w, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3027 int h, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3028 int *valid_w, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3029 int *valid_h) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3030 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3031 int base_width, base_height; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3032 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3033 base_width = gui_get_base_width() |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3034 + (GetSystemMetrics(SM_CXFRAME) + |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3035 GetSystemMetrics(SM_CXPADDEDBORDER)) * 2; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3036 base_height = gui_get_base_height() |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3037 + (GetSystemMetrics(SM_CYFRAME) + |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3038 GetSystemMetrics(SM_CXPADDEDBORDER)) * 2 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3039 + GetSystemMetrics(SM_CYCAPTION) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3040 #ifdef FEAT_MENU |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3041 + gui_mswin_get_menu_height(FALSE) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3042 #endif |
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 *valid_w = base_width + |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3045 ((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
|
3046 *valid_h = base_height + |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3047 ((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
|
3048 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3049 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3050 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3051 gui_mch_flash(int msec) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3052 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3053 RECT rc; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3054 |
12934
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
3055 #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
|
3056 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
|
3057 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
|
3058 #endif |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
3059 |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3060 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3061 * 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
|
3062 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3063 rc.left = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3064 rc.top = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3065 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
|
3066 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
|
3067 InvertRect(s_hdc, &rc); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3068 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
|
3069 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3070 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
|
3071 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3072 InvertRect(s_hdc, &rc); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3073 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3074 |
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 * Return flags used for scrolling. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3077 * 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
|
3078 * 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
|
3079 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3080 static int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3081 get_scroll_flags(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3082 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3083 HWND hwnd; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3084 RECT rcVim, rcOther, rcDest; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3085 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3086 GetWindowRect(s_hwnd, &rcVim); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3087 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3088 /* 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
|
3089 * 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
|
3090 * scrolling up or down. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3091 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
|
3092 return SW_INVALIDATE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3093 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3094 /* 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
|
3095 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
|
3096 if (IsWindowVisible(hwnd)) |
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 GetWindowRect(hwnd, &rcOther); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3099 if (IntersectRect(&rcDest, &rcVim, &rcOther)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3100 return SW_INVALIDATE; |
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 return 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3103 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3104 |
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 * 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
|
3107 * may not be scrolled out properly. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3108 * 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
|
3109 * 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
|
3110 * 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
|
3111 * the region before ScrollWindowEx(). |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3112 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3113 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3114 intel_gpu_workaround(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3115 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3116 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
|
3117 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3118 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3119 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3120 * 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
|
3121 * 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
|
3122 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3123 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3124 gui_mch_delete_lines( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3125 int row, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3126 int num_lines) |
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 RECT rc; |
12934
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
3129 |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3130 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
|
3131 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
|
3132 rc.top = FILL_Y(row); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3133 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
|
3134 |
12986
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
3135 #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
|
3136 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
|
3137 { |
13150
808625d4b71b
patch 8.0.1449: slow redrawing with DirectX
Christian Brabandt <cb@256bit.org>
parents:
13028
diff
changeset
|
3138 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
|
3139 DWriteContext_Flush(s_dwc); |
808625d4b71b
patch 8.0.1449: slow redrawing with DirectX
Christian Brabandt <cb@256bit.org>
parents:
13028
diff
changeset
|
3140 } |
808625d4b71b
patch 8.0.1449: slow redrawing with DirectX
Christian Brabandt <cb@256bit.org>
parents:
13028
diff
changeset
|
3141 else |
12986
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
3142 #endif |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
3143 { |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
3144 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
|
3145 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
|
3146 &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
|
3147 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
|
3148 } |
cfce9ac1d1e8
patch 8.0.1390: DirectX scrolling can be slow, vertical positioning is off
Christian Brabandt <cb@256bit.org>
parents:
12994
diff
changeset
|
3149 |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3150 /* 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
|
3151 * 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
|
3152 * the screen... But why? (Webb) */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3153 /* 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
|
3154 /* gui.cursor_is_valid = FALSE; */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3155 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3156 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
|
3157 gui.scroll_region_left, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3158 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
|
3159 } |
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 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3162 * 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
|
3163 * following text within the scroll region. |
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 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3166 gui_mch_insert_lines( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3167 int row, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3168 int num_lines) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3169 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3170 RECT rc; |
12934
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
3171 |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3172 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
|
3173 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
|
3174 rc.top = FILL_Y(row); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3175 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
|
3176 |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
3177 #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
|
3178 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
|
3179 { |
13150
808625d4b71b
patch 8.0.1449: slow redrawing with DirectX
Christian Brabandt <cb@256bit.org>
parents:
13028
diff
changeset
|
3180 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
|
3181 DWriteContext_Flush(s_dwc); |
808625d4b71b
patch 8.0.1449: slow redrawing with DirectX
Christian Brabandt <cb@256bit.org>
parents:
13028
diff
changeset
|
3182 } |
808625d4b71b
patch 8.0.1449: slow redrawing with DirectX
Christian Brabandt <cb@256bit.org>
parents:
13028
diff
changeset
|
3183 else |
12986
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
3184 #endif |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
3185 { |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
3186 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
|
3187 /* 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
|
3188 * 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
|
3189 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
|
3190 &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
|
3191 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
|
3192 } |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3193 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3194 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
|
3195 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
|
3196 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3197 |
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 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
|
3200 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
|
3201 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3202 #if defined(FEAT_DIRECTX) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3203 DWriteContext_Close(s_dwc); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3204 DWrite_Final(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3205 s_dwc = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3206 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3207 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3208 ReleaseDC(s_textArea, s_hdc); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3209 DeleteObject(s_brush); |
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 #ifdef FEAT_TEAROFF |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3212 /* Unload the tearoff bitmap */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3213 (void)DeleteObject((HGDIOBJ)s_htearbitmap); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3214 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3215 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3216 /* 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
|
3217 if (s_hwnd != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3218 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3219 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
|
3220 DestroyWindow(s_hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3221 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3222 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3223 #ifdef GLOBAL_IME |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3224 global_ime_end(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3225 #endif |
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 static char_u * |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3229 logfont2name(LOGFONT lf) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3230 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3231 char *p; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3232 char *res; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3233 char *charset_name; |
8835
c1a5623cfc86
commit https://github.com/vim/vim/commit/7c1c6dbb6817640fd3956a0d5417da23fde336d8
Christian Brabandt <cb@256bit.org>
parents:
8813
diff
changeset
|
3234 char *quality_name; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3235 char *font_name = lf.lfFaceName; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3236 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3237 charset_name = charset_id2name((int)lf.lfCharSet); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3238 #ifdef FEAT_MBYTE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3239 /* Convert a font name from the current codepage to 'encoding'. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3240 * TODO: Use Wide APIs (including LOGFONTW) instead of ANSI APIs. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3241 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3242 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3243 int len; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3244 acp_to_enc((char_u *)lf.lfFaceName, (int)strlen(lf.lfFaceName), |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3245 (char_u **)&font_name, &len); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3246 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3247 #endif |
8835
c1a5623cfc86
commit https://github.com/vim/vim/commit/7c1c6dbb6817640fd3956a0d5417da23fde336d8
Christian Brabandt <cb@256bit.org>
parents:
8813
diff
changeset
|
3248 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
|
3249 |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3250 res = (char *)alloc((unsigned)(strlen(font_name) + 20 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3251 + (charset_name == NULL ? 0 : strlen(charset_name) + 2))); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3252 if (res != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3253 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3254 p = res; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3255 /* make a normal font string out of the lf thing:*/ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3256 sprintf((char *)p, "%s:h%d", font_name, pixels_to_points( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3257 lf.lfHeight < 0 ? -lf.lfHeight : lf.lfHeight, TRUE)); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3258 while (*p) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3259 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3260 if (*p == ' ') |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3261 *p = '_'; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3262 ++p; |
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 if (lf.lfItalic) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3265 STRCAT(p, ":i"); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3266 if (lf.lfWeight >= FW_BOLD) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3267 STRCAT(p, ":b"); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3268 if (lf.lfUnderline) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3269 STRCAT(p, ":u"); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3270 if (lf.lfStrikeOut) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3271 STRCAT(p, ":s"); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3272 if (charset_name != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3273 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3274 STRCAT(p, ":c"); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3275 STRCAT(p, charset_name); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3276 } |
8835
c1a5623cfc86
commit https://github.com/vim/vim/commit/7c1c6dbb6817640fd3956a0d5417da23fde336d8
Christian Brabandt <cb@256bit.org>
parents:
8813
diff
changeset
|
3277 if (quality_name != NULL) |
c1a5623cfc86
commit https://github.com/vim/vim/commit/7c1c6dbb6817640fd3956a0d5417da23fde336d8
Christian Brabandt <cb@256bit.org>
parents:
8813
diff
changeset
|
3278 { |
c1a5623cfc86
commit https://github.com/vim/vim/commit/7c1c6dbb6817640fd3956a0d5417da23fde336d8
Christian Brabandt <cb@256bit.org>
parents:
8813
diff
changeset
|
3279 STRCAT(p, ":q"); |
c1a5623cfc86
commit https://github.com/vim/vim/commit/7c1c6dbb6817640fd3956a0d5417da23fde336d8
Christian Brabandt <cb@256bit.org>
parents:
8813
diff
changeset
|
3280 STRCAT(p, quality_name); |
c1a5623cfc86
commit https://github.com/vim/vim/commit/7c1c6dbb6817640fd3956a0d5417da23fde336d8
Christian Brabandt <cb@256bit.org>
parents:
8813
diff
changeset
|
3281 } |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3282 } |
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 #ifdef FEAT_MBYTE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3285 if (font_name != lf.lfFaceName) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3286 vim_free(font_name); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3287 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3288 return (char_u *)res; |
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 |
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 #ifdef FEAT_MBYTE_IME |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3293 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3294 * Set correct LOGFONT to IME. Use 'guifontwide' if available, otherwise use |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3295 * 'guifont' |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3296 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3297 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3298 update_im_font(void) |
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 LOGFONT lf_wide; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3301 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3302 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
|
3303 && gui.wide_font != NOFONT |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3304 && GetObject((HFONT)gui.wide_font, sizeof(lf_wide), &lf_wide)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3305 norm_logfont = lf_wide; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3306 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3307 norm_logfont = sub_logfont; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3308 im_set_font(&norm_logfont); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3309 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3310 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3311 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3312 #ifdef FEAT_MBYTE |
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 * 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
|
3315 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3316 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3317 gui_mch_wide_font_changed(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3318 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3319 LOGFONT lf; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3320 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3321 # ifdef FEAT_MBYTE_IME |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3322 update_im_font(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3323 # endif |
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 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
|
3326 gui.wide_ital_font = NOFONT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3327 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
|
3328 gui.wide_bold_font = NOFONT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3329 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
|
3330 gui.wide_boldital_font = NOFONT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3331 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3332 if (gui.wide_font |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3333 && GetObject((HFONT)gui.wide_font, sizeof(lf), &lf)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3334 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3335 if (!lf.lfItalic) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3336 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3337 lf.lfItalic = TRUE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3338 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
|
3339 lf.lfItalic = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3340 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3341 if (lf.lfWeight < FW_BOLD) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3342 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3343 lf.lfWeight = FW_BOLD; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3344 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
|
3345 if (!lf.lfItalic) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3346 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3347 lf.lfItalic = TRUE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3348 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
|
3349 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3350 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3351 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3352 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3353 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3354 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3355 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3356 * 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
|
3357 * 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
|
3358 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3359 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
|
3360 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
|
3361 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3362 LOGFONT lf; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3363 GuiFont font = NOFONT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3364 char_u *p; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3365 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3366 /* Load the font */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3367 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
|
3368 font = get_font_handle(&lf); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3369 if (font == NOFONT) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3370 return FAIL; |
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 if (font_name == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3373 font_name = (char_u *)lf.lfFaceName; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3374 #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
|
3375 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
|
3376 #endif |
e60b2aa04903
patch 8.0.1351: warning for unused variables building with MinGW
Christian Brabandt <cb@256bit.org>
parents:
12934
diff
changeset
|
3377 #ifdef FEAT_MBYTE_IME |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3378 sub_logfont = lf; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3379 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3380 #ifdef FEAT_MBYTE_IME |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3381 update_im_font(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3382 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3383 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
|
3384 gui.norm_font = font; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3385 current_font_height = lf.lfHeight; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3386 GetFontSize(font); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3387 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3388 p = logfont2name(lf); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3389 if (p != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3390 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3391 hl_set_font_name(p); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3392 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3393 /* 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
|
3394 * */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3395 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
|
3396 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3397 vim_free(p_guifont); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3398 p_guifont = p; |
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 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3401 vim_free(p); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3402 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3403 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3404 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
|
3405 gui.ital_font = NOFONT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3406 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
|
3407 gui.bold_font = NOFONT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3408 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
|
3409 gui.boldital_font = NOFONT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3410 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3411 if (!lf.lfItalic) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3412 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3413 lf.lfItalic = TRUE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3414 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
|
3415 lf.lfItalic = FALSE; |
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 if (lf.lfWeight < FW_BOLD) |
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 lf.lfWeight = FW_BOLD; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3420 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
|
3421 if (!lf.lfItalic) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3422 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3423 lf.lfItalic = TRUE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3424 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
|
3425 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3426 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3427 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3428 return OK; |
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3431 #ifndef WPF_RESTORETOMAXIMIZED |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3432 # 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
|
3433 #endif |
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 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3436 * 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
|
3437 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3438 int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3439 gui_mch_maximized(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3440 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3441 WINDOWPLACEMENT wp; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3442 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3443 wp.length = sizeof(WINDOWPLACEMENT); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3444 if (GetWindowPlacement(s_hwnd, &wp)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3445 return wp.showCmd == SW_SHOWMAXIMIZED |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3446 || (wp.showCmd == SW_SHOWMINIMIZED |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3447 && wp.flags == WPF_RESTORETOMAXIMIZED); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3448 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3449 return 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3450 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3451 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3452 /* |
12802
29a728529f92
patch 8.0.1278: GUI window always resizes when adding scrollbar
Christian Brabandt <cb@256bit.org>
parents:
12712
diff
changeset
|
3453 * 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
|
3454 * 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
|
3455 * window. |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3456 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3457 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3458 gui_mch_newfont(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3459 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3460 RECT rect; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3461 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3462 GetWindowRect(s_hwnd, &rect); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3463 if (win_socket_id == 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3464 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3465 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
|
3466 - (GetSystemMetrics(SM_CXFRAME) + |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3467 GetSystemMetrics(SM_CXPADDEDBORDER)) * 2, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3468 rect.bottom - rect.top |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3469 - (GetSystemMetrics(SM_CYFRAME) + |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3470 GetSystemMetrics(SM_CXPADDEDBORDER)) * 2 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3471 - GetSystemMetrics(SM_CYCAPTION) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3472 #ifdef FEAT_MENU |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3473 - gui_mswin_get_menu_height(FALSE) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3474 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3475 ); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3476 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3477 else |
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 /* 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
|
3480 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
|
3481 rect.bottom - rect.top |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3482 #ifdef FEAT_MENU |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3483 - gui_mswin_get_menu_height(FALSE) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3484 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3485 ); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3486 } |
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3489 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3490 * Set the window title |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3491 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3492 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3493 gui_mch_settitle( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3494 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
|
3495 char_u *icon UNUSED) |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3496 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3497 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
|
3498 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3499 |
9834
80ace3687eec
commit https://github.com/vim/vim/commit/a6b7a08ae04a3cd4d9c45c906bb7a197e2135179
Christian Brabandt <cb@256bit.org>
parents:
9428
diff
changeset
|
3500 #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
|
3501 /* 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
|
3502 * misc2.c! */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3503 static LPCSTR mshape_idcs[] = |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3504 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3505 IDC_ARROW, /* arrow */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3506 MAKEINTRESOURCE(0), /* blank */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3507 IDC_IBEAM, /* beam */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3508 IDC_SIZENS, /* updown */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3509 IDC_SIZENS, /* udsizing */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3510 IDC_SIZEWE, /* leftright */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3511 IDC_SIZEWE, /* lrsizing */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3512 IDC_WAIT, /* busy */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3513 IDC_NO, /* no */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3514 IDC_ARROW, /* crosshair */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3515 IDC_ARROW, /* hand1 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3516 IDC_ARROW, /* hand2 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3517 IDC_ARROW, /* pencil */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3518 IDC_ARROW, /* question */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3519 IDC_ARROW, /* right-arrow */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3520 IDC_UPARROW, /* up-arrow */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3521 IDC_ARROW /* last one */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3522 }; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3523 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3524 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3525 mch_set_mouse_shape(int shape) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3526 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3527 LPCSTR idc; |
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 if (shape == MSHAPE_HIDE) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3530 ShowCursor(FALSE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3531 else |
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 if (shape >= MSHAPE_NUMBERED) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3534 idc = IDC_ARROW; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3535 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3536 idc = mshape_idcs[shape]; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3537 #ifdef SetClassLongPtr |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3538 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
|
3539 #else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3540 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
|
3541 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3542 if (!p_mh) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3543 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3544 POINT mp; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3545 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3546 /* 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
|
3547 (void)GetCursorPos((LPPOINT)&mp); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3548 (void)SetCursorPos(mp.x, mp.y); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3549 ShowCursor(TRUE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3550 } |
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 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3553 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3554 |
9834
80ace3687eec
commit https://github.com/vim/vim/commit/a6b7a08ae04a3cd4d9c45c906bb7a197e2135179
Christian Brabandt <cb@256bit.org>
parents:
9428
diff
changeset
|
3555 #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
|
3556 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3557 * The file browser exists in two versions: with "W" uses wide characters, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3558 * without "W" the current codepage. When FEAT_MBYTE is defined and on |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3559 * Windows NT/2000/XP the "W" functions are used. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3560 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3561 |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
3562 # ifdef FEAT_MBYTE |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3563 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3564 * Wide version of convert_filter(). |
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 static WCHAR * |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3567 convert_filterW(char_u *s) |
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 char_u *tmp; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3570 int len; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3571 WCHAR *res; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3572 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3573 tmp = convert_filter(s); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3574 if (tmp == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3575 return NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3576 len = (int)STRLEN(s) + 3; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3577 res = enc_to_utf16(tmp, &len); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3578 vim_free(tmp); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3579 return res; |
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 |
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 * Wide version of gui_mch_browse(). Keep in sync! |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3584 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3585 static char_u * |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3586 gui_mch_browseW( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3587 int saving, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3588 char_u *title, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3589 char_u *dflt, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3590 char_u *ext, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3591 char_u *initdir, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3592 char_u *filter) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3593 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3594 /* 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
|
3595 * otherwise it fails miserably! */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3596 OPENFILENAMEW fileStruct; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3597 WCHAR fileBuf[MAXPATHL]; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3598 WCHAR *wp; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3599 int i; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3600 WCHAR *titlep = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3601 WCHAR *extp = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3602 WCHAR *initdirp = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3603 WCHAR *filterp; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3604 char_u *p; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3605 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3606 if (dflt == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3607 fileBuf[0] = NUL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3608 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3609 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3610 wp = enc_to_utf16(dflt, NULL); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3611 if (wp == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3612 fileBuf[0] = NUL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3613 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3614 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3615 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
|
3616 fileBuf[i] = wp[i]; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3617 fileBuf[i] = NUL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3618 vim_free(wp); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3619 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3620 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3621 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3622 /* Convert the filter to Windows format. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3623 filterp = convert_filterW(filter); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3624 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3625 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
|
3626 # ifdef OPENFILENAME_SIZE_VERSION_400W |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3627 /* 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
|
3628 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
|
3629 # else |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3630 fileStruct.lStructSize = sizeof(fileStruct); |
10440
f54e4c691de4
commit https://github.com/vim/vim/commit/b04a98f6c3cca14bf055934b0a793f4dc376858b
Christian Brabandt <cb@256bit.org>
parents:
10438
diff
changeset
|
3631 # endif |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3632 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3633 if (title != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3634 titlep = enc_to_utf16(title, NULL); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3635 fileStruct.lpstrTitle = titlep; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3636 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3637 if (ext != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3638 extp = enc_to_utf16(ext, NULL); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3639 fileStruct.lpstrDefExt = extp; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3640 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3641 fileStruct.lpstrFile = fileBuf; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3642 fileStruct.nMaxFile = MAXPATHL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3643 fileStruct.lpstrFilter = filterp; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3644 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
|
3645 /* has an initial dir been specified? */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3646 if (initdir != NULL && *initdir != NUL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3647 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3648 /* 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
|
3649 initdirp = enc_to_utf16(initdir, NULL); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3650 if (initdirp != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3651 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3652 for (wp = initdirp; *wp != NUL; ++wp) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3653 if (*wp == '/') |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3654 *wp = '\\'; |
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 fileStruct.lpstrInitialDir = initdirp; |
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 |
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 * 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
|
3661 * 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
|
3662 * 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
|
3663 * 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
|
3664 * OFN_PATHMUSTEXIST? |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3665 * 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
|
3666 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3667 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
|
3668 # ifdef FEAT_SHORTCUT |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3669 if (curbuf->b_p_bin) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3670 fileStruct.Flags |= OFN_NODEREFERENCELINKS; |
10440
f54e4c691de4
commit https://github.com/vim/vim/commit/b04a98f6c3cca14bf055934b0a793f4dc376858b
Christian Brabandt <cb@256bit.org>
parents:
10438
diff
changeset
|
3671 # endif |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3672 if (saving) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3673 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3674 if (!GetSaveFileNameW(&fileStruct)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3675 return NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3676 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3677 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3678 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3679 if (!GetOpenFileNameW(&fileStruct)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3680 return NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3681 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3682 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3683 vim_free(filterp); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3684 vim_free(initdirp); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3685 vim_free(titlep); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3686 vim_free(extp); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3687 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3688 /* Convert from UCS2 to 'encoding'. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3689 p = utf16_to_enc(fileBuf, NULL); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3690 if (p != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3691 /* when out of memory we get garbage for non-ASCII chars */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3692 STRCPY(fileBuf, p); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3693 vim_free(p); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3694 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3695 /* 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
|
3696 SetFocus(s_hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3697 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3698 /* Shorten the file name if possible */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3699 return vim_strsave(shorten_fname1((char_u *)fileBuf)); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3700 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3701 # endif /* FEAT_MBYTE */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3702 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3703 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3704 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3705 * 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
|
3706 * 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
|
3707 * 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
|
3708 * |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3709 * 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
|
3710 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3711 static char_u * |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3712 convert_filter(char_u *s) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3713 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3714 char_u *res; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3715 unsigned s_len = (unsigned)STRLEN(s); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3716 unsigned i; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3717 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3718 res = alloc(s_len + 3); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3719 if (res != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3720 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3721 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
|
3722 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
|
3723 res[i] = '\0'; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3724 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3725 res[i] = s[i]; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3726 res[s_len] = NUL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3727 /* 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
|
3728 res[s_len + 1] = NUL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3729 res[s_len + 2] = NUL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3730 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3731 return res; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3732 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3733 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3734 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3735 * Select a directory. |
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 char_u * |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3738 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
|
3739 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3740 /* 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
|
3741 * 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
|
3742 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
|
3743 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
|
3744 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3745 |
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 * Pop open a file browser and return the file selected, in allocated memory, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3748 * or NULL if Cancel is hit. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3749 * saving - TRUE if the file will be saved to, FALSE if it will be opened. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3750 * title - Title message for the file browser dialog. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3751 * dflt - Default name of file. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3752 * ext - Default extension to be added to files without extensions. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3753 * initdir - directory in which to open the browser (NULL = current dir) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3754 * filter - Filter for matched files to choose from. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3755 * |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3756 * Keep in sync with gui_mch_browseW() above! |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3757 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3758 char_u * |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3759 gui_mch_browse( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3760 int saving, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3761 char_u *title, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3762 char_u *dflt, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3763 char_u *ext, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3764 char_u *initdir, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3765 char_u *filter) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3766 { |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
3767 # ifdef FEAT_MBYTE |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
3768 return gui_mch_browseW(saving, title, dflt, ext, initdir, filter); |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
3769 # else |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3770 OPENFILENAME fileStruct; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3771 char_u fileBuf[MAXPATHL]; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3772 char_u *initdirp = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3773 char_u *filterp; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3774 char_u *p; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3775 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3776 if (dflt == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3777 fileBuf[0] = NUL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3778 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3779 vim_strncpy(fileBuf, dflt, MAXPATHL - 1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3780 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3781 /* Convert the filter to Windows format. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3782 filterp = convert_filter(filter); |
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 vim_memset(&fileStruct, 0, sizeof(OPENFILENAME)); |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
3785 # ifdef OPENFILENAME_SIZE_VERSION_400 |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3786 /* be compatible with Windows NT 4.0 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3787 fileStruct.lStructSize = OPENFILENAME_SIZE_VERSION_400; |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
3788 # else |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3789 fileStruct.lStructSize = sizeof(fileStruct); |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
3790 # endif |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3791 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3792 fileStruct.lpstrTitle = (LPSTR)title; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3793 fileStruct.lpstrDefExt = (LPSTR)ext; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3794 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3795 fileStruct.lpstrFile = (LPSTR)fileBuf; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3796 fileStruct.nMaxFile = MAXPATHL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3797 fileStruct.lpstrFilter = (LPSTR)filterp; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3798 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
|
3799 /* has an initial dir been specified? */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3800 if (initdir != NULL && *initdir != NUL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3801 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3802 /* 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
|
3803 initdirp = vim_strsave(initdir); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3804 if (initdirp != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3805 for (p = initdirp; *p != NUL; ++p) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3806 if (*p == '/') |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3807 *p = '\\'; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3808 fileStruct.lpstrInitialDir = (LPSTR)initdirp; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3809 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3810 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3811 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3812 * 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
|
3813 * 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
|
3814 * 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
|
3815 * 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
|
3816 * OFN_PATHMUSTEXIST? |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3817 * 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
|
3818 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3819 fileStruct.Flags = (OFN_NOCHANGEDIR | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY); |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
3820 # ifdef FEAT_SHORTCUT |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3821 if (curbuf->b_p_bin) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3822 fileStruct.Flags |= OFN_NODEREFERENCELINKS; |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
3823 # endif |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3824 if (saving) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3825 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3826 if (!GetSaveFileName(&fileStruct)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3827 return NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3828 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3829 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3830 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3831 if (!GetOpenFileName(&fileStruct)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3832 return NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3833 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3834 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3835 vim_free(filterp); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3836 vim_free(initdirp); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3837 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3838 /* 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
|
3839 SetFocus(s_hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3840 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3841 /* Shorten the file name if possible */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3842 return vim_strsave(shorten_fname1((char_u *)fileBuf)); |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
3843 # endif |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3844 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3845 #endif /* FEAT_BROWSE */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3846 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3847 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3848 _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
|
3849 HWND hwnd UNUSED, |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3850 HDROP hDrop) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3851 { |
12477
68d7bc045dbe
patch 8.0.1118: FEAT_WINDOWS adds a lot of #ifdefs
Christian Brabandt <cb@256bit.org>
parents:
12317
diff
changeset
|
3852 #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
|
3853 #define DRAGQVAL 0xFFFFFFFF |
68d7bc045dbe
patch 8.0.1118: FEAT_WINDOWS adds a lot of #ifdefs
Christian Brabandt <cb@256bit.org>
parents:
12317
diff
changeset
|
3854 #ifdef FEAT_MBYTE |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3855 WCHAR wszFile[BUFPATHLEN]; |
12477
68d7bc045dbe
patch 8.0.1118: FEAT_WINDOWS adds a lot of #ifdefs
Christian Brabandt <cb@256bit.org>
parents:
12317
diff
changeset
|
3856 #endif |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3857 char szFile[BUFPATHLEN]; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3858 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
|
3859 UINT i; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3860 char_u **fnames; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3861 POINT pt; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3862 int_u modifiers = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3863 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3864 /* 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
|
3865 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3866 /* Obtain dropped position */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3867 DragQueryPoint(hDrop, &pt); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3868 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
|
3869 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3870 reset_VIsual(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3871 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3872 fnames = (char_u **)alloc(cFiles * sizeof(char_u *)); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3873 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3874 if (fnames != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3875 for (i = 0; i < cFiles; ++i) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3876 { |
12477
68d7bc045dbe
patch 8.0.1118: FEAT_WINDOWS adds a lot of #ifdefs
Christian Brabandt <cb@256bit.org>
parents:
12317
diff
changeset
|
3877 #ifdef FEAT_MBYTE |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3878 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
|
3879 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
|
3880 else |
12477
68d7bc045dbe
patch 8.0.1118: FEAT_WINDOWS adds a lot of #ifdefs
Christian Brabandt <cb@256bit.org>
parents:
12317
diff
changeset
|
3881 #endif |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3882 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3883 DragQueryFile(hDrop, i, szFile, BUFPATHLEN); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3884 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
|
3885 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3886 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3887 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3888 DragFinish(hDrop); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3889 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3890 if (fnames != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3891 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3892 if ((GetKeyState(VK_SHIFT) & 0x8000) != 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3893 modifiers |= MOUSE_SHIFT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3894 if ((GetKeyState(VK_CONTROL) & 0x8000) != 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3895 modifiers |= MOUSE_CTRL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3896 if ((GetKeyState(VK_MENU) & 0x8000) != 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3897 modifiers |= MOUSE_ALT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3898 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3899 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
|
3900 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3901 s_need_activate = TRUE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3902 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3903 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3904 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3905 static int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3906 _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
|
3907 HWND hwnd UNUSED, |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3908 HWND hwndCtl, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3909 UINT code, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3910 int pos) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3911 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3912 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
|
3913 scrollbar_T *sb, *sb_info; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3914 long val; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3915 int dragging = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3916 int dont_scroll_save = dont_scroll; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3917 SCROLLINFO si; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3918 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3919 si.cbSize = sizeof(si); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3920 si.fMask = SIF_POS; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3921 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3922 sb = gui_mswin_find_scrollbar(hwndCtl); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3923 if (sb == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3924 return 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3925 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3926 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
|
3927 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3928 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3929 * 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
|
3930 * 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
|
3931 * gui_drag_scrollbar(). |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3932 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3933 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
|
3934 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3935 else /* Bottom scrollbar */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3936 sb_info = sb; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3937 val = sb_info->value; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3938 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3939 switch (code) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3940 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3941 case SB_THUMBTRACK: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3942 val = pos; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3943 dragging = TRUE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3944 if (sb->scroll_shift > 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3945 val <<= sb->scroll_shift; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3946 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3947 case SB_LINEDOWN: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3948 val++; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3949 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3950 case SB_LINEUP: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3951 val--; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3952 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3953 case SB_PAGEDOWN: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3954 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
|
3955 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3956 case SB_PAGEUP: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3957 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
|
3958 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3959 case SB_TOP: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3960 val = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3961 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3962 case SB_BOTTOM: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3963 val = sb_info->max; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3964 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3965 case SB_ENDSCROLL: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3966 if (prev_code == SB_THUMBTRACK) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3967 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3968 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3969 * "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
|
3970 * 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
|
3971 * 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
|
3972 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3973 val = GetScrollPos(hwndCtl, SB_CTL); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3974 if (sb->scroll_shift > 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3975 val <<= sb->scroll_shift; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3976 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3977 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3978 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3979 default: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3980 /* 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
|
3981 return 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3982 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3983 prev_code = code; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3984 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3985 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
|
3986 SetScrollInfo(hwndCtl, SB_CTL, &si, TRUE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3987 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3988 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3989 * 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
|
3990 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3991 if (sb->wp != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3992 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3993 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
|
3994 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
|
3995 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3996 SetScrollInfo(id, SB_CTL, &si, TRUE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3997 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3998 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3999 /* 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
|
4000 s_busy_processing = TRUE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4001 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4002 /* 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
|
4003 * 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
|
4004 dont_scroll = !allow_scrollbar; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4005 |
13150
808625d4b71b
patch 8.0.1449: slow redrawing with DirectX
Christian Brabandt <cb@256bit.org>
parents:
13028
diff
changeset
|
4006 mch_disable_flush(); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4007 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
|
4008 mch_enable_flush(); |
808625d4b71b
patch 8.0.1449: slow redrawing with DirectX
Christian Brabandt <cb@256bit.org>
parents:
13028
diff
changeset
|
4009 gui_may_flush(); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4010 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4011 s_busy_processing = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4012 dont_scroll = dont_scroll_save; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4013 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4014 return 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4015 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4016 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4017 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4018 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4019 * Get command line arguments. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4020 * Use "prog" as the name of the program and "cmdline" as the arguments. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4021 * Copy the arguments to allocated memory. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4022 * Return the number of arguments (including program name). |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4023 * Return pointers to the arguments in "argvp". Memory is allocated with |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4024 * malloc(), use free() instead of vim_free(). |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4025 * Return pointer to buffer in "tofree". |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4026 * Returns zero when out of memory. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4027 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4028 int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4029 get_cmd_args(char *prog, char *cmdline, char ***argvp, char **tofree) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4030 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4031 int i; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4032 char *p; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4033 char *progp; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4034 char *pnew = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4035 char *newcmdline; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4036 int inquote; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4037 int argc; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4038 char **argv = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4039 int round; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4040 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4041 *tofree = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4042 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4043 #ifdef FEAT_MBYTE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4044 /* Try using the Unicode version first, it takes care of conversion when |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4045 * 'encoding' is changed. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4046 argc = get_cmd_argsW(&argv); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4047 if (argc != 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4048 goto done; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4049 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4050 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4051 /* Handle the program name. Remove the ".exe" extension, and find the 1st |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4052 * non-space. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4053 p = strrchr(prog, '.'); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4054 if (p != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4055 *p = NUL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4056 for (progp = prog; *progp == ' '; ++progp) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4057 ; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4058 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4059 /* The command line is copied to allocated memory, so that we can change |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4060 * it. Add the size of the string, the separating NUL and a terminating |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4061 * NUL. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4062 newcmdline = malloc(STRLEN(cmdline) + STRLEN(progp) + 2); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4063 if (newcmdline == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4064 return 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4065 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4066 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4067 * First round: count the number of arguments ("pnew" == NULL). |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4068 * Second round: produce the arguments. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4069 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4070 for (round = 1; round <= 2; ++round) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4071 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4072 /* First argument is the program name. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4073 if (pnew != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4074 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4075 argv[0] = pnew; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4076 strcpy(pnew, progp); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4077 pnew += strlen(pnew); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4078 *pnew++ = NUL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4079 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4080 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4081 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4082 * Isolate each argument and put it in argv[]. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4083 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4084 p = cmdline; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4085 argc = 1; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4086 while (*p != NUL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4087 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4088 inquote = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4089 if (pnew != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4090 argv[argc] = pnew; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4091 ++argc; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4092 while (*p != NUL && (inquote || (*p != ' ' && *p != '\t'))) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4093 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4094 /* Backslashes are only special when followed by a double |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4095 * quote. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4096 i = (int)strspn(p, "\\"); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4097 if (p[i] == '"') |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4098 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4099 /* Halve the number of backslashes. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4100 if (i > 1 && pnew != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4101 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4102 vim_memset(pnew, '\\', i / 2); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4103 pnew += i / 2; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4104 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4105 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4106 /* Even nr of backslashes toggles quoting, uneven copies |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4107 * the double quote. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4108 if ((i & 1) == 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4109 inquote = !inquote; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4110 else if (pnew != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4111 *pnew++ = '"'; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4112 p += i + 1; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4113 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4114 else if (i > 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4115 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4116 /* Copy span of backslashes unmodified. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4117 if (pnew != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4118 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4119 vim_memset(pnew, '\\', i); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4120 pnew += i; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4121 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4122 p += i; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4123 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4124 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4125 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4126 if (pnew != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4127 *pnew++ = *p; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4128 #ifdef FEAT_MBYTE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4129 /* Can't use mb_* functions, because 'encoding' is not |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4130 * initialized yet here. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4131 if (IsDBCSLeadByte(*p)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4132 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4133 ++p; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4134 if (pnew != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4135 *pnew++ = *p; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4136 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4137 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4138 ++p; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4139 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4140 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4141 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4142 if (pnew != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4143 *pnew++ = NUL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4144 while (*p == ' ' || *p == '\t') |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4145 ++p; /* advance until a non-space */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4146 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4147 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4148 if (round == 1) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4149 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4150 argv = (char **)malloc((argc + 1) * sizeof(char *)); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4151 if (argv == NULL ) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4152 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4153 free(newcmdline); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4154 return 0; /* malloc error */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4155 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4156 pnew = newcmdline; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4157 *tofree = newcmdline; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4158 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4159 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4160 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4161 #ifdef FEAT_MBYTE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4162 done: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4163 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4164 argv[argc] = NULL; /* NULL-terminated list */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4165 *argvp = argv; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4166 return argc; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4167 } |
7 | 4168 |
4169 #ifdef FEAT_XPM_W32 | |
4170 # include "xpm_w32.h" | |
4171 #endif | |
4172 | |
4173 #ifdef PROTO | |
4174 # define WINAPI | |
4175 #endif | |
4176 | |
4177 #ifdef __MINGW32__ | |
4178 /* | |
4179 * Add a lot of missing defines. | |
4180 * They are not always missing, we need the #ifndef's. | |
4181 */ | |
4182 # ifndef _cdecl | |
4183 # define _cdecl | |
4184 # endif | |
4185 # ifndef IsMinimized | |
4186 # define IsMinimized(hwnd) IsIconic(hwnd) | |
4187 # endif | |
4188 # ifndef IsMaximized | |
4189 # define IsMaximized(hwnd) IsZoomed(hwnd) | |
4190 # endif | |
4191 # ifndef SelectFont | |
4192 # define SelectFont(hdc, hfont) ((HFONT)SelectObject((hdc), (HGDIOBJ)(HFONT)(hfont))) | |
4193 # endif | |
4194 # ifndef GetStockBrush | |
4195 # define GetStockBrush(i) ((HBRUSH)GetStockObject(i)) | |
4196 # endif | |
4197 # ifndef DeleteBrush | |
4198 # define DeleteBrush(hbr) DeleteObject((HGDIOBJ)(HBRUSH)(hbr)) | |
4199 # endif | |
4200 | |
4201 # ifndef HANDLE_WM_RBUTTONDBLCLK | |
4202 # define HANDLE_WM_RBUTTONDBLCLK(hwnd, wParam, lParam, fn) \ | |
4203 ((fn)((hwnd), TRUE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) | |
4204 # endif | |
4205 # ifndef HANDLE_WM_MBUTTONUP | |
4206 # define HANDLE_WM_MBUTTONUP(hwnd, wParam, lParam, fn) \ | |
4207 ((fn)((hwnd), (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) | |
4208 # endif | |
4209 # ifndef HANDLE_WM_MBUTTONDBLCLK | |
4210 # define HANDLE_WM_MBUTTONDBLCLK(hwnd, wParam, lParam, fn) \ | |
4211 ((fn)((hwnd), TRUE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) | |
4212 # endif | |
4213 # ifndef HANDLE_WM_LBUTTONDBLCLK | |
4214 # define HANDLE_WM_LBUTTONDBLCLK(hwnd, wParam, lParam, fn) \ | |
4215 ((fn)((hwnd), TRUE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) | |
4216 # endif | |
4217 # ifndef HANDLE_WM_RBUTTONDOWN | |
4218 # define HANDLE_WM_RBUTTONDOWN(hwnd, wParam, lParam, fn) \ | |
4219 ((fn)((hwnd), FALSE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) | |
4220 # endif | |
4221 # ifndef HANDLE_WM_MOUSEMOVE | |
4222 # define HANDLE_WM_MOUSEMOVE(hwnd, wParam, lParam, fn) \ | |
4223 ((fn)((hwnd), (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) | |
4224 # endif | |
4225 # ifndef HANDLE_WM_RBUTTONUP | |
4226 # define HANDLE_WM_RBUTTONUP(hwnd, wParam, lParam, fn) \ | |
4227 ((fn)((hwnd), (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) | |
4228 # endif | |
4229 # ifndef HANDLE_WM_MBUTTONDOWN | |
4230 # define HANDLE_WM_MBUTTONDOWN(hwnd, wParam, lParam, fn) \ | |
4231 ((fn)((hwnd), FALSE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) | |
4232 # endif | |
4233 # ifndef HANDLE_WM_LBUTTONUP | |
4234 # define HANDLE_WM_LBUTTONUP(hwnd, wParam, lParam, fn) \ | |
4235 ((fn)((hwnd), (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) | |
4236 # endif | |
4237 # ifndef HANDLE_WM_LBUTTONDOWN | |
4238 # define HANDLE_WM_LBUTTONDOWN(hwnd, wParam, lParam, fn) \ | |
4239 ((fn)((hwnd), FALSE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) | |
4240 # endif | |
4241 # ifndef HANDLE_WM_SYSCHAR | |
4242 # define HANDLE_WM_SYSCHAR(hwnd, wParam, lParam, fn) \ | |
4243 ((fn)((hwnd), (TCHAR)(wParam), (int)(short)LOWORD(lParam)), 0L) | |
4244 # endif | |
4245 # ifndef HANDLE_WM_ACTIVATEAPP | |
4246 # define HANDLE_WM_ACTIVATEAPP(hwnd, wParam, lParam, fn) \ | |
4247 ((fn)((hwnd), (BOOL)(wParam), (DWORD)(lParam)), 0L) | |
4248 # endif | |
4249 # ifndef HANDLE_WM_WINDOWPOSCHANGING | |
4250 # define HANDLE_WM_WINDOWPOSCHANGING(hwnd, wParam, lParam, fn) \ | |
4251 (LRESULT)(DWORD)(BOOL)(fn)((hwnd), (LPWINDOWPOS)(lParam)) | |
4252 # endif | |
4253 # ifndef HANDLE_WM_VSCROLL | |
4254 # define HANDLE_WM_VSCROLL(hwnd, wParam, lParam, fn) \ | |
4255 ((fn)((hwnd), (HWND)(lParam), (UINT)(LOWORD(wParam)), (int)(short)HIWORD(wParam)), 0L) | |
4256 # endif | |
4257 # ifndef HANDLE_WM_SETFOCUS | |
4258 # define HANDLE_WM_SETFOCUS(hwnd, wParam, lParam, fn) \ | |
4259 ((fn)((hwnd), (HWND)(wParam)), 0L) | |
4260 # endif | |
4261 # ifndef HANDLE_WM_KILLFOCUS | |
4262 # define HANDLE_WM_KILLFOCUS(hwnd, wParam, lParam, fn) \ | |
4263 ((fn)((hwnd), (HWND)(wParam)), 0L) | |
4264 # endif | |
4265 # ifndef HANDLE_WM_HSCROLL | |
4266 # define HANDLE_WM_HSCROLL(hwnd, wParam, lParam, fn) \ | |
4267 ((fn)((hwnd), (HWND)(lParam), (UINT)(LOWORD(wParam)), (int)(short)HIWORD(wParam)), 0L) | |
4268 # endif | |
4269 # ifndef HANDLE_WM_DROPFILES | |
4270 # define HANDLE_WM_DROPFILES(hwnd, wParam, lParam, fn) \ | |
4271 ((fn)((hwnd), (HDROP)(wParam)), 0L) | |
4272 # endif | |
4273 # ifndef HANDLE_WM_CHAR | |
4274 # define HANDLE_WM_CHAR(hwnd, wParam, lParam, fn) \ | |
4275 ((fn)((hwnd), (TCHAR)(wParam), (int)(short)LOWORD(lParam)), 0L) | |
4276 # endif | |
4277 # ifndef HANDLE_WM_SYSDEADCHAR | |
4278 # define HANDLE_WM_SYSDEADCHAR(hwnd, wParam, lParam, fn) \ | |
4279 ((fn)((hwnd), (TCHAR)(wParam), (int)(short)LOWORD(lParam)), 0L) | |
4280 # endif | |
4281 # ifndef HANDLE_WM_DEADCHAR | |
4282 # define HANDLE_WM_DEADCHAR(hwnd, wParam, lParam, fn) \ | |
4283 ((fn)((hwnd), (TCHAR)(wParam), (int)(short)LOWORD(lParam)), 0L) | |
4284 # endif | |
4285 #endif /* __MINGW32__ */ | |
4286 | |
4287 | |
4288 /* Some parameters for tearoff menus. All in pixels. */ | |
4289 #define TEAROFF_PADDING_X 2 | |
4290 #define TEAROFF_BUTTON_PAD_X 8 | |
4291 #define TEAROFF_MIN_WIDTH 200 | |
4292 #define TEAROFF_SUBMENU_LABEL ">>" | |
4293 #define TEAROFF_COLUMN_PADDING 3 // # spaces to pad column with. | |
4294 | |
4295 | |
4296 /* For the Intellimouse: */ | |
4297 #ifndef WM_MOUSEWHEEL | |
4298 #define WM_MOUSEWHEEL 0x20a | |
4299 #endif | |
4300 | |
4301 | |
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
|
4302 #ifdef FEAT_BEVAL_GUI |
7 | 4303 # define ID_BEVAL_TOOLTIP 200 |
4304 # define BEVAL_TEXT_LEN MAXPATHL | |
4305 | |
2224
a0cce15dd2a9
Fix definition of UINT_PTR for 64 bit systems.
Bram Moolenaar <bram@vim.org>
parents:
2217
diff
changeset
|
4306 #if (defined(_MSC_VER) && _MSC_VER < 1300) || !defined(MAXULONG_PTR) |
1621 | 4307 /* Work around old versions of basetsd.h which wrongly declares |
4308 * 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
|
4309 # undef UINT_PTR |
837 | 4310 # define UINT_PTR UINT |
4311 #endif | |
840 | 4312 |
7801
a1e71a01dbd6
commit https://github.com/vim/vim/commit/d25c16e2f2776d50245bf31d6e4d5364f12d188e
Christian Brabandt <cb@256bit.org>
parents:
7797
diff
changeset
|
4313 static void make_tooltip(BalloonEval *beval, char *text, POINT pt); |
a1e71a01dbd6
commit https://github.com/vim/vim/commit/d25c16e2f2776d50245bf31d6e4d5364f12d188e
Christian Brabandt <cb@256bit.org>
parents:
7797
diff
changeset
|
4314 static void delete_tooltip(BalloonEval *beval); |
a1e71a01dbd6
commit https://github.com/vim/vim/commit/d25c16e2f2776d50245bf31d6e4d5364f12d188e
Christian Brabandt <cb@256bit.org>
parents:
7797
diff
changeset
|
4315 static VOID CALLBACK BevalTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime); |
840 | 4316 |
7 | 4317 static BalloonEval *cur_beval = NULL; |
835 | 4318 static UINT_PTR BevalTimerId = 0; |
7 | 4319 static DWORD LastActivity = 0; |
435 | 4320 |
3927 | 4321 |
4322 /* cproto fails on missing include files */ | |
4323 #ifndef PROTO | |
4324 | |
435 | 4325 /* |
4326 * excerpts from headers since this may not be presented | |
843 | 4327 * in the extremely old compilers |
435 | 4328 */ |
3927 | 4329 # include <pshpack1.h> |
4330 | |
4331 #endif | |
435 | 4332 |
4333 typedef struct _DllVersionInfo | |
4334 { | |
4335 DWORD cbSize; | |
4336 DWORD dwMajorVersion; | |
4337 DWORD dwMinorVersion; | |
4338 DWORD dwBuildNumber; | |
4339 DWORD dwPlatformID; | |
4340 } DLLVERSIONINFO; | |
4341 | |
3927 | 4342 #ifndef PROTO |
4343 # include <poppack.h> | |
4344 #endif | |
2026 | 4345 |
435 | 4346 typedef struct tagTOOLINFOA_NEW |
4347 { | |
4348 UINT cbSize; | |
4349 UINT uFlags; | |
4350 HWND hwnd; | |
2026 | 4351 UINT_PTR uId; |
435 | 4352 RECT rect; |
4353 HINSTANCE hinst; | |
4354 LPSTR lpszText; | |
4355 LPARAM lParam; | |
4356 } TOOLINFO_NEW; | |
4357 | |
4358 typedef struct tagNMTTDISPINFO_NEW | |
4359 { | |
4360 NMHDR hdr; | |
2026 | 4361 LPSTR lpszText; |
435 | 4362 char szText[80]; |
4363 HINSTANCE hinst; | |
4364 UINT uFlags; | |
4365 LPARAM lParam; | |
4366 } NMTTDISPINFO_NEW; | |
4367 | |
4368 typedef HRESULT (WINAPI* DLLGETVERSIONPROC)(DLLVERSIONINFO *); | |
4369 #ifndef TTM_SETMAXTIPWIDTH | |
842 | 4370 # define TTM_SETMAXTIPWIDTH (WM_USER+24) |
7 | 4371 #endif |
4372 | |
435 | 4373 #ifndef TTF_DI_SETITEM |
842 | 4374 # define TTF_DI_SETITEM 0x8000 |
435 | 4375 #endif |
4376 | |
4377 #ifndef TTN_GETDISPINFO | |
842 | 4378 # define TTN_GETDISPINFO (TTN_FIRST - 0) |
435 | 4379 #endif |
4380 | |
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
|
4381 #endif /* defined(FEAT_BEVAL_GUI) */ |
435 | 4382 |
1213 | 4383 #if defined(FEAT_TOOLBAR) || defined(FEAT_GUI_TABLINE) |
4384 /* Older MSVC compilers don't have LPNMTTDISPINFO[AW] thus we need to define | |
4385 * it here if LPNMTTDISPINFO isn't defined. | |
4386 * MingW doesn't define LPNMTTDISPINFO but typedefs it. Thus we need to check | |
4387 * _MSC_VER. */ | |
4388 # if !defined(LPNMTTDISPINFO) && defined(_MSC_VER) | |
4389 typedef struct tagNMTTDISPINFOA { | |
4390 NMHDR hdr; | |
4391 LPSTR lpszText; | |
4392 char szText[80]; | |
4393 HINSTANCE hinst; | |
4394 UINT uFlags; | |
4395 LPARAM lParam; | |
4396 } NMTTDISPINFOA, *LPNMTTDISPINFOA; | |
4397 # define LPNMTTDISPINFO LPNMTTDISPINFOA | |
4398 | |
4399 # ifdef FEAT_MBYTE | |
4400 typedef struct tagNMTTDISPINFOW { | |
4401 NMHDR hdr; | |
4402 LPWSTR lpszText; | |
4403 WCHAR szText[80]; | |
4404 HINSTANCE hinst; | |
4405 UINT uFlags; | |
4406 LPARAM lParam; | |
4407 } NMTTDISPINFOW, *LPNMTTDISPINFOW; | |
4408 # endif | |
4409 # endif | |
4410 #endif | |
4411 | |
842 | 4412 #ifndef TTN_GETDISPINFOW |
4413 # define TTN_GETDISPINFOW (TTN_FIRST - 10) | |
4414 #endif | |
4415 | |
7 | 4416 /* Local variables: */ |
4417 | |
4418 #ifdef FEAT_MENU | |
4419 static UINT s_menu_id = 100; | |
2614 | 4420 #endif |
7 | 4421 |
4422 /* | |
4423 * Use the system font for dialogs and tear-off menus. Remove this line to | |
4424 * use DLG_FONT_NAME. | |
4425 */ | |
2614 | 4426 #define USE_SYSMENU_FONT |
7 | 4427 |
4428 #define VIM_NAME "vim" | |
4429 #define VIM_CLASS "Vim" | |
4430 #define VIM_CLASSW L"Vim" | |
4431 | |
4432 /* Initial size for the dialog template. For gui_mch_dialog() it's fixed, | |
4433 * thus there should be room for every dialog. For tearoffs it's made bigger | |
4434 * when needed. */ | |
4435 #define DLG_ALLOC_SIZE 16 * 1024 | |
4436 | |
4437 /* | |
4438 * stuff for dialogs, menus, tearoffs etc. | |
4439 */ | |
4440 static LRESULT APIENTRY dialog_callback(HWND, UINT, WPARAM, LPARAM); | |
8138
f52504c10387
commit https://github.com/vim/vim/commit/065bbac8adfe29a09958570237d223457f235c6c
Christian Brabandt <cb@256bit.org>
parents:
8108
diff
changeset
|
4441 #ifdef FEAT_TEAROFF |
7 | 4442 static LRESULT APIENTRY tearoff_callback(HWND, UINT, WPARAM, LPARAM); |
8138
f52504c10387
commit https://github.com/vim/vim/commit/065bbac8adfe29a09958570237d223457f235c6c
Christian Brabandt <cb@256bit.org>
parents:
8108
diff
changeset
|
4443 #endif |
7 | 4444 static PWORD |
4445 add_dialog_element( | |
4446 PWORD p, | |
4447 DWORD lStyle, | |
4448 WORD x, | |
4449 WORD y, | |
4450 WORD w, | |
4451 WORD h, | |
4452 WORD Id, | |
4453 WORD clss, | |
4454 const char *caption); | |
4455 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
|
4456 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
|
4457 #if defined(FEAT_MENU) && defined(FEAT_TEAROFF) |
7 | 4458 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
|
4459 #endif |
7 | 4460 static void get_dialog_font_metrics(void); |
4461 | |
4462 static int dialog_default_button = -1; | |
4463 | |
4464 /* Intellimouse support */ | |
4465 static int mouse_scroll_lines = 0; | |
4466 | |
4467 static int s_usenewlook; /* emulate W95/NT4 non-bold dialogs */ | |
4468 #ifdef FEAT_TOOLBAR | |
4469 static void initialise_toolbar(void); | |
5223
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
4470 static LRESULT CALLBACK toolbar_wndproc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); |
7 | 4471 static int get_toolbar_bitmap(vimmenu_T *menu); |
4472 #endif | |
4473 | |
810 | 4474 #ifdef FEAT_GUI_TABLINE |
4475 static void initialise_tabline(void); | |
5223
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
4476 static LRESULT CALLBACK tabline_wndproc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); |
810 | 4477 #endif |
4478 | |
7 | 4479 #ifdef FEAT_MBYTE_IME |
4480 static LRESULT _OnImeComposition(HWND hwnd, WPARAM dbcs, LPARAM param); | |
4481 static char_u *GetResultStr(HWND hwnd, int GCS, int *lenp); | |
4482 #endif | |
4483 #if defined(FEAT_MBYTE_IME) && defined(DYNAMIC_IME) | |
4484 # ifdef NOIME | |
4485 typedef struct tagCOMPOSITIONFORM { | |
4486 DWORD dwStyle; | |
4487 POINT ptCurrentPos; | |
4488 RECT rcArea; | |
4489 } COMPOSITIONFORM, *PCOMPOSITIONFORM, NEAR *NPCOMPOSITIONFORM, FAR *LPCOMPOSITIONFORM; | |
4490 typedef HANDLE HIMC; | |
4491 # endif | |
4492 | |
344 | 4493 static HINSTANCE hLibImm = NULL; |
4494 static LONG (WINAPI *pImmGetCompositionStringA)(HIMC, DWORD, LPVOID, DWORD); | |
4495 static LONG (WINAPI *pImmGetCompositionStringW)(HIMC, DWORD, LPVOID, DWORD); | |
4496 static HIMC (WINAPI *pImmGetContext)(HWND); | |
4497 static HIMC (WINAPI *pImmAssociateContext)(HWND, HIMC); | |
4498 static BOOL (WINAPI *pImmReleaseContext)(HWND, HIMC); | |
4499 static BOOL (WINAPI *pImmGetOpenStatus)(HIMC); | |
4500 static BOOL (WINAPI *pImmSetOpenStatus)(HIMC, BOOL); | |
4501 static BOOL (WINAPI *pImmGetCompositionFont)(HIMC, LPLOGFONTA); | |
4502 static BOOL (WINAPI *pImmSetCompositionFont)(HIMC, LPLOGFONTA); | |
4503 static BOOL (WINAPI *pImmSetCompositionWindow)(HIMC, LPCOMPOSITIONFORM); | |
4504 static BOOL (WINAPI *pImmGetConversionStatus)(HIMC, LPDWORD, LPDWORD); | |
777 | 4505 static BOOL (WINAPI *pImmSetConversionStatus)(HIMC, DWORD, DWORD); |
7 | 4506 static void dyn_imm_load(void); |
4507 #else | |
4508 # define pImmGetCompositionStringA ImmGetCompositionStringA | |
4509 # define pImmGetCompositionStringW ImmGetCompositionStringW | |
4510 # define pImmGetContext ImmGetContext | |
4511 # define pImmAssociateContext ImmAssociateContext | |
4512 # define pImmReleaseContext ImmReleaseContext | |
4513 # define pImmGetOpenStatus ImmGetOpenStatus | |
4514 # define pImmSetOpenStatus ImmSetOpenStatus | |
4515 # define pImmGetCompositionFont ImmGetCompositionFontA | |
4516 # define pImmSetCompositionFont ImmSetCompositionFontA | |
4517 # define pImmSetCompositionWindow ImmSetCompositionWindow | |
4518 # define pImmGetConversionStatus ImmGetConversionStatus | |
777 | 4519 # define pImmSetConversionStatus ImmSetConversionStatus |
7 | 4520 #endif |
4521 | |
4522 #ifdef FEAT_MENU | |
4523 /* | |
4524 * Figure out how high the menu bar is at the moment. | |
4525 */ | |
4526 static int | |
4527 gui_mswin_get_menu_height( | |
4528 int fix_window) /* If TRUE, resize window if menu height changed */ | |
4529 { | |
4530 static int old_menu_height = -1; | |
4531 | |
4532 RECT rc1, rc2; | |
4533 int num; | |
4534 int menu_height; | |
4535 | |
4536 if (gui.menu_is_active) | |
4537 num = GetMenuItemCount(s_menuBar); | |
4538 else | |
4539 num = 0; | |
4540 | |
4541 if (num == 0) | |
4542 menu_height = 0; | |
6714 | 4543 else if (IsMinimized(s_hwnd)) |
4544 { | |
4545 /* The height of the menu cannot be determined while the window is | |
4546 * minimized. Take the previous height if the menu is changed in that | |
4547 * state, to avoid that Vim's vertical window size accidentally | |
4548 * increases due to the unaccounted-for menu height. */ | |
4549 menu_height = old_menu_height == -1 ? 0 : old_menu_height; | |
4550 } | |
7 | 4551 else |
4552 { | |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
4553 /* |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
4554 * 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
|
4555 * 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
|
4556 * 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
|
4557 * 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
|
4558 * 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
|
4559 */ |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
4560 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
|
4561 if (gui.starting) |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
4562 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
|
4563 else |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
4564 { |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
4565 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
|
4566 menu_height = rc2.bottom - rc1.top + 1; |
7 | 4567 } |
4568 } | |
4569 | |
4570 if (fix_window && menu_height != old_menu_height) | |
4571 { | |
812 | 4572 gui_set_shellsize(FALSE, FALSE, RESIZE_VERT); |
7 | 4573 } |
6714 | 4574 old_menu_height = menu_height; |
7 | 4575 |
4576 return menu_height; | |
4577 } | |
4578 #endif /*FEAT_MENU*/ | |
4579 | |
4580 | |
4581 /* | |
4582 * Setup for the Intellimouse | |
4583 */ | |
4584 static void | |
4585 init_mouse_wheel(void) | |
4586 { | |
4587 | |
4588 #ifndef SPI_GETWHEELSCROLLLINES | |
4589 # define SPI_GETWHEELSCROLLLINES 104 | |
4590 #endif | |
336 | 4591 #ifndef SPI_SETWHEELSCROLLLINES |
4592 # define SPI_SETWHEELSCROLLLINES 105 | |
4593 #endif | |
7 | 4594 |
4595 #define VMOUSEZ_CLASSNAME "MouseZ" /* hidden wheel window class */ | |
4596 #define VMOUSEZ_TITLE "Magellan MSWHEEL" /* hidden wheel window title */ | |
4597 #define VMSH_MOUSEWHEEL "MSWHEEL_ROLLMSG" | |
4598 #define VMSH_SCROLL_LINES "MSH_SCROLL_LINES_MSG" | |
4599 | |
4600 mouse_scroll_lines = 3; /* reasonable default */ | |
4601 | |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
4602 /* 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
|
4603 SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
4604 &mouse_scroll_lines, 0); |
7 | 4605 } |
4606 | |
4607 | |
4608 /* Intellimouse wheel handler */ | |
4609 static void | |
4610 _OnMouseWheel( | |
4611 HWND hwnd, | |
4612 short zDelta) | |
4613 { | |
4614 /* Treat a mouse wheel event as if it were a scroll request */ | |
4615 int i; | |
4616 int size; | |
4617 HWND hwndCtl; | |
4618 | |
4619 if (curwin->w_scrollbars[SBAR_RIGHT].id != 0) | |
4620 { | |
4621 hwndCtl = curwin->w_scrollbars[SBAR_RIGHT].id; | |
4622 size = curwin->w_scrollbars[SBAR_RIGHT].size; | |
4623 } | |
4624 else if (curwin->w_scrollbars[SBAR_LEFT].id != 0) | |
4625 { | |
4626 hwndCtl = curwin->w_scrollbars[SBAR_LEFT].id; | |
4627 size = curwin->w_scrollbars[SBAR_LEFT].size; | |
4628 } | |
4629 else | |
4630 return; | |
4631 | |
4632 size = curwin->w_height; | |
4633 if (mouse_scroll_lines == 0) | |
4634 init_mouse_wheel(); | |
4635 | |
13150
808625d4b71b
patch 8.0.1449: slow redrawing with DirectX
Christian Brabandt <cb@256bit.org>
parents:
13028
diff
changeset
|
4636 mch_disable_flush(); |
7 | 4637 if (mouse_scroll_lines > 0 |
4638 && mouse_scroll_lines < (size > 2 ? size - 2 : 1)) | |
4639 { | |
4640 for (i = mouse_scroll_lines; i > 0; --i) | |
4641 _OnScroll(hwnd, hwndCtl, zDelta >= 0 ? SB_LINEUP : SB_LINEDOWN, 0); | |
4642 } | |
4643 else | |
4644 _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
|
4645 mch_enable_flush(); |
808625d4b71b
patch 8.0.1449: slow redrawing with DirectX
Christian Brabandt <cb@256bit.org>
parents:
13028
diff
changeset
|
4646 gui_may_flush(); |
7 | 4647 } |
4648 | |
843 | 4649 #ifdef USE_SYSMENU_FONT |
4650 /* | |
4651 * Get Menu Font. | |
4652 * Return OK or FAIL. | |
4653 */ | |
4654 static int | |
4655 gui_w32_get_menu_font(LOGFONT *lf) | |
4656 { | |
4657 NONCLIENTMETRICS nm; | |
4658 | |
4659 nm.cbSize = sizeof(NONCLIENTMETRICS); | |
4660 if (!SystemParametersInfo( | |
4661 SPI_GETNONCLIENTMETRICS, | |
4662 sizeof(NONCLIENTMETRICS), | |
4663 &nm, | |
4664 0)) | |
4665 return FAIL; | |
4666 *lf = nm.lfMenuFont; | |
4667 return OK; | |
4668 } | |
4669 #endif | |
4670 | |
4671 | |
4672 #if defined(FEAT_GUI_TABLINE) && defined(USE_SYSMENU_FONT) | |
4673 /* | |
4674 * Set the GUI tabline font to the system menu font | |
4675 */ | |
4676 static void | |
4677 set_tabline_font(void) | |
4678 { | |
4679 LOGFONT lfSysmenu; | |
4680 HFONT font; | |
4681 HWND hwnd; | |
4682 HDC hdc; | |
4683 HFONT hfntOld; | |
4684 TEXTMETRIC tm; | |
4685 | |
4686 if (gui_w32_get_menu_font(&lfSysmenu) != OK) | |
4687 return; | |
4688 | |
4689 font = CreateFontIndirect(&lfSysmenu); | |
4690 | |
4691 SendMessage(s_tabhwnd, WM_SETFONT, (WPARAM)font, TRUE); | |
4692 | |
4693 /* | |
4694 * Compute the height of the font used for the tab text | |
4695 */ | |
4696 hwnd = GetDesktopWindow(); | |
4697 hdc = GetWindowDC(hwnd); | |
4698 hfntOld = SelectFont(hdc, font); | |
4699 | |
4700 GetTextMetrics(hdc, &tm); | |
4701 | |
4702 SelectFont(hdc, hfntOld); | |
4703 ReleaseDC(hwnd, hdc); | |
4704 | |
4705 /* | |
4706 * The space used by the tab border and the space between the tab label | |
4707 * and the tab border is included as 7. | |
4708 */ | |
4709 gui.tabline_height = tm.tmHeight + tm.tmInternalLeading + 7; | |
4710 } | |
4711 #endif | |
4712 | |
333 | 4713 /* |
4714 * Invoked when a setting was changed. | |
4715 */ | |
4716 static LRESULT CALLBACK | |
4717 _OnSettingChange(UINT n) | |
4718 { | |
4719 if (n == SPI_SETWHEELSCROLLLINES) | |
4720 SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, | |
4721 &mouse_scroll_lines, 0); | |
843 | 4722 #if defined(FEAT_GUI_TABLINE) && defined(USE_SYSMENU_FONT) |
4723 if (n == SPI_SETNONCLIENTMETRICS) | |
4724 set_tabline_font(); | |
4725 #endif | |
333 | 4726 return 0; |
4727 } | |
4728 | |
7 | 4729 #ifdef FEAT_NETBEANS_INTG |
4730 static void | |
4731 _OnWindowPosChanged( | |
4732 HWND hwnd, | |
4733 const LPWINDOWPOS lpwpos) | |
4734 { | |
4735 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
|
4736 extern int WSInitialized; |
7 | 4737 |
4738 if (WSInitialized && (lpwpos->x != x || lpwpos->y != y | |
4739 || lpwpos->cx != cx || lpwpos->cy != cy)) | |
4740 { | |
4741 x = lpwpos->x; | |
4742 y = lpwpos->y; | |
4743 cx = lpwpos->cx; | |
4744 cy = lpwpos->cy; | |
4745 netbeans_frame_moved(x, y); | |
4746 } | |
4747 /* Allow to send WM_SIZE and WM_MOVE */ | |
4748 FORWARD_WM_WINDOWPOSCHANGED(hwnd, lpwpos, MyWindowProc); | |
4749 } | |
4750 #endif | |
4751 | |
4752 static int | |
4753 _DuringSizing( | |
4754 UINT fwSide, | |
4755 LPRECT lprc) | |
4756 { | |
4757 int w, h; | |
4758 int valid_w, valid_h; | |
4759 int w_offset, h_offset; | |
4760 | |
4761 w = lprc->right - lprc->left; | |
4762 h = lprc->bottom - lprc->top; | |
4763 gui_mswin_get_valid_dimensions(w, h, &valid_w, &valid_h); | |
4764 w_offset = w - valid_w; | |
4765 h_offset = h - valid_h; | |
4766 | |
4767 if (fwSide == WMSZ_LEFT || fwSide == WMSZ_TOPLEFT | |
4768 || fwSide == WMSZ_BOTTOMLEFT) | |
4769 lprc->left += w_offset; | |
4770 else if (fwSide == WMSZ_RIGHT || fwSide == WMSZ_TOPRIGHT | |
4771 || fwSide == WMSZ_BOTTOMRIGHT) | |
4772 lprc->right -= w_offset; | |
4773 | |
4774 if (fwSide == WMSZ_TOP || fwSide == WMSZ_TOPLEFT | |
4775 || fwSide == WMSZ_TOPRIGHT) | |
4776 lprc->top += h_offset; | |
4777 else if (fwSide == WMSZ_BOTTOM || fwSide == WMSZ_BOTTOMLEFT | |
4778 || fwSide == WMSZ_BOTTOMRIGHT) | |
4779 lprc->bottom -= h_offset; | |
4780 return TRUE; | |
4781 } | |
4782 | |
4783 | |
4784 | |
4785 static LRESULT CALLBACK | |
4786 _WndProc( | |
4787 HWND hwnd, | |
4788 UINT uMsg, | |
4789 WPARAM wParam, | |
4790 LPARAM lParam) | |
4791 { | |
4792 /* | |
4793 TRACE("WndProc: hwnd = %08x, msg = %x, wParam = %x, lParam = %x\n", | |
4794 hwnd, uMsg, wParam, lParam); | |
4795 */ | |
4796 | |
4797 HandleMouseHide(uMsg, lParam); | |
4798 | |
4799 s_uMsg = uMsg; | |
4800 s_wParam = wParam; | |
4801 s_lParam = lParam; | |
4802 | |
4803 switch (uMsg) | |
4804 { | |
4805 HANDLE_MSG(hwnd, WM_DEADCHAR, _OnDeadChar); | |
4806 HANDLE_MSG(hwnd, WM_SYSDEADCHAR, _OnDeadChar); | |
4807 /* HANDLE_MSG(hwnd, WM_ACTIVATE, _OnActivate); */ | |
4808 HANDLE_MSG(hwnd, WM_CLOSE, _OnClose); | |
4809 /* HANDLE_MSG(hwnd, WM_COMMAND, _OnCommand); */ | |
4810 HANDLE_MSG(hwnd, WM_DESTROY, _OnDestroy); | |
4811 HANDLE_MSG(hwnd, WM_DROPFILES, _OnDropFiles); | |
4812 HANDLE_MSG(hwnd, WM_HSCROLL, _OnScroll); | |
4813 HANDLE_MSG(hwnd, WM_KILLFOCUS, _OnKillFocus); | |
4814 #ifdef FEAT_MENU | |
4815 HANDLE_MSG(hwnd, WM_COMMAND, _OnMenu); | |
4816 #endif | |
4817 /* HANDLE_MSG(hwnd, WM_MOVE, _OnMove); */ | |
4818 /* HANDLE_MSG(hwnd, WM_NCACTIVATE, _OnNCActivate); */ | |
4819 HANDLE_MSG(hwnd, WM_SETFOCUS, _OnSetFocus); | |
4820 HANDLE_MSG(hwnd, WM_SIZE, _OnSize); | |
4821 /* HANDLE_MSG(hwnd, WM_SYSCOMMAND, _OnSysCommand); */ | |
4822 /* HANDLE_MSG(hwnd, WM_SYSKEYDOWN, _OnAltKey); */ | |
4823 HANDLE_MSG(hwnd, WM_VSCROLL, _OnScroll); | |
4824 // HANDLE_MSG(hwnd, WM_WINDOWPOSCHANGING, _OnWindowPosChanging); | |
4825 HANDLE_MSG(hwnd, WM_ACTIVATEAPP, _OnActivateApp); | |
4826 #ifdef FEAT_NETBEANS_INTG | |
4827 HANDLE_MSG(hwnd, WM_WINDOWPOSCHANGED, _OnWindowPosChanged); | |
4828 #endif | |
4829 | |
812 | 4830 #ifdef FEAT_GUI_TABLINE |
4831 case WM_RBUTTONUP: | |
4832 { | |
4833 if (gui_mch_showing_tabline()) | |
4834 { | |
4835 POINT pt; | |
4836 RECT rect; | |
4837 | |
4838 /* | |
4839 * If the cursor is on the tabline, display the tab menu | |
4840 */ | |
4841 GetCursorPos((LPPOINT)&pt); | |
4842 GetWindowRect(s_textArea, &rect); | |
4843 if (pt.y < rect.top) | |
4844 { | |
4845 show_tabline_popup_menu(); | |
3225 | 4846 return 0L; |
812 | 4847 } |
4848 } | |
4849 return MyWindowProc(hwnd, uMsg, wParam, lParam); | |
4850 } | |
819 | 4851 case WM_LBUTTONDBLCLK: |
4852 { | |
4853 /* | |
4854 * If the user double clicked the tabline, create a new tab | |
4855 */ | |
4856 if (gui_mch_showing_tabline()) | |
4857 { | |
4858 POINT pt; | |
4859 RECT rect; | |
4860 | |
4861 GetCursorPos((LPPOINT)&pt); | |
4862 GetWindowRect(s_textArea, &rect); | |
4863 if (pt.y < rect.top) | |
824 | 4864 send_tabline_menu_event(0, TABLINE_MENU_NEW); |
819 | 4865 } |
4866 return MyWindowProc(hwnd, uMsg, wParam, lParam); | |
4867 } | |
812 | 4868 #endif |
4869 | |
7 | 4870 case WM_QUERYENDSESSION: /* System wants to go down. */ |
4871 gui_shell_closed(); /* Will exit when no changed buffers. */ | |
4872 return FALSE; /* Do NOT allow system to go down. */ | |
4873 | |
4874 case WM_ENDSESSION: | |
4875 if (wParam) /* system only really goes down when wParam is TRUE */ | |
3225 | 4876 { |
7 | 4877 _OnEndSession(); |
3225 | 4878 return 0L; |
4879 } | |
7 | 4880 break; |
4881 | |
4882 case WM_CHAR: | |
4883 /* Don't use HANDLE_MSG() for WM_CHAR, it truncates wParam to a single | |
4884 * byte while we want the UTF-16 character value. */ | |
835 | 4885 _OnChar(hwnd, (UINT)wParam, (int)(short)LOWORD(lParam)); |
7 | 4886 return 0L; |
4887 | |
4888 case WM_SYSCHAR: | |
4889 /* | |
4890 * if 'winaltkeys' is "no", or it's "menu" and it's not a menu | |
4891 * shortcut key, handle like a typed ALT key, otherwise call Windows | |
4892 * ALT key handling. | |
4893 */ | |
4894 #ifdef FEAT_MENU | |
4895 if ( !gui.menu_is_active | |
4896 || p_wak[0] == 'n' | |
4897 || (p_wak[0] == 'm' && !gui_is_menu_shortcut((int)wParam)) | |
4898 ) | |
4899 #endif | |
4900 { | |
835 | 4901 _OnSysChar(hwnd, (UINT)wParam, (int)(short)LOWORD(lParam)); |
7 | 4902 return 0L; |
4903 } | |
4904 #ifdef FEAT_MENU | |
4905 else | |
4906 return MyWindowProc(hwnd, uMsg, wParam, lParam); | |
4907 #endif | |
4908 | |
4909 case WM_SYSKEYUP: | |
4910 #ifdef FEAT_MENU | |
4911 /* This used to be done only when menu is active: ALT key is used for | |
4912 * that. But that caused problems when menu is disabled and using | |
4913 * Alt-Tab-Esc: get into a strange state where no mouse-moved events | |
4914 * are received, mouse pointer remains hidden. */ | |
4915 return MyWindowProc(hwnd, uMsg, wParam, lParam); | |
4916 #else | |
3225 | 4917 return 0L; |
7 | 4918 #endif |
4919 | |
4920 case WM_SIZING: /* HANDLE_MSG doesn't seem to handle this one */ | |
323 | 4921 return _DuringSizing((UINT)wParam, (LPRECT)lParam); |
7 | 4922 |
4923 case WM_MOUSEWHEEL: | |
4924 _OnMouseWheel(hwnd, HIWORD(wParam)); | |
3225 | 4925 return 0L; |
7 | 4926 |
333 | 4927 /* Notification for change in SystemParametersInfo() */ |
4928 case WM_SETTINGCHANGE: | |
4929 return _OnSettingChange((UINT)wParam); | |
4930 | |
810 | 4931 #if defined(FEAT_TOOLBAR) || defined(FEAT_GUI_TABLINE) |
7 | 4932 case WM_NOTIFY: |
4933 switch (((LPNMHDR) lParam)->code) | |
4934 { | |
840 | 4935 # ifdef FEAT_MBYTE |
4936 case TTN_GETDISPINFOW: | |
4937 # endif | |
948 | 4938 case TTN_GETDISPINFO: |
7 | 4939 { |
948 | 4940 LPNMHDR hdr = (LPNMHDR)lParam; |
4941 char_u *str = NULL; | |
4942 static void *tt_text = NULL; | |
4943 | |
13244
ac42c4b11dbc
patch 8.0.1496: clearing a pointer takes two lines
Christian Brabandt <cb@256bit.org>
parents:
13152
diff
changeset
|
4944 VIM_CLEAR(tt_text); |
948 | 4945 |
4946 # ifdef FEAT_GUI_TABLINE | |
4947 if (gui_mch_showing_tabline() | |
4948 && hdr->hwndFrom == TabCtrl_GetToolTips(s_tabhwnd)) | |
840 | 4949 { |
948 | 4950 POINT pt; |
840 | 4951 /* |
948 | 4952 * Mouse is over the GUI tabline. Display the |
4953 * tooltip for the tab under the cursor | |
4954 * | |
4955 * Get the cursor position within the tab control | |
840 | 4956 */ |
948 | 4957 GetCursorPos(&pt); |
4958 if (ScreenToClient(s_tabhwnd, &pt) != 0) | |
840 | 4959 { |
948 | 4960 TCHITTESTINFO htinfo; |
4961 int idx; | |
4962 | |
4963 /* | |
4964 * Get the tab under the cursor | |
4965 */ | |
4966 htinfo.pt.x = pt.x; | |
4967 htinfo.pt.y = pt.y; | |
4968 idx = TabCtrl_HitTest(s_tabhwnd, &htinfo); | |
4969 if (idx != -1) | |
840 | 4970 { |
948 | 4971 tabpage_T *tp; |
4972 | |
4973 tp = find_tabpage(idx + 1); | |
4974 if (tp != NULL) | |
840 | 4975 { |
948 | 4976 get_tabline_label(tp, TRUE); |
4977 str = NameBuff; | |
840 | 4978 } |
4979 } | |
4980 } | |
4981 } | |
4982 # endif | |
4983 # ifdef FEAT_TOOLBAR | |
948 | 4984 # ifdef FEAT_GUI_TABLINE |
4985 else | |
4986 # endif | |
4987 { | |
4988 UINT idButton; | |
4989 vimmenu_T *pMenu; | |
4990 | |
4991 idButton = (UINT) hdr->idFrom; | |
4992 pMenu = gui_mswin_find_menu(root_menu, idButton); | |
4993 if (pMenu) | |
4994 str = pMenu->strings[MENU_INDEX_TIP]; | |
4995 } | |
4996 # endif | |
4997 if (str != NULL) | |
7 | 4998 { |
948 | 4999 # ifdef FEAT_MBYTE |
5000 if (hdr->code == TTN_GETDISPINFOW) | |
7 | 5001 { |
948 | 5002 LPNMTTDISPINFOW lpdi = (LPNMTTDISPINFOW)lParam; |
5003 | |
1481 | 5004 /* Set the maximum width, this also enables using |
5005 * \n for line break. */ | |
5006 SendMessage(lpdi->hdr.hwndFrom, TTM_SETMAXTIPWIDTH, | |
5007 0, 500); | |
5008 | |
1752 | 5009 tt_text = enc_to_utf16(str, NULL); |
948 | 5010 lpdi->lpszText = tt_text; |
5011 /* can't show tooltip if failed */ | |
5012 } | |
5013 else | |
5014 # endif | |
5015 { | |
5016 LPNMTTDISPINFO lpdi = (LPNMTTDISPINFO)lParam; | |
5017 | |
1481 | 5018 /* Set the maximum width, this also enables using |
5019 * \n for line break. */ | |
5020 SendMessage(lpdi->hdr.hwndFrom, TTM_SETMAXTIPWIDTH, | |
5021 0, 500); | |
5022 | |
948 | 5023 if (STRLEN(str) < sizeof(lpdi->szText) |
5024 || ((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
|
5025 vim_strncpy((char_u *)lpdi->szText, str, |
948 | 5026 sizeof(lpdi->szText) - 1); |
5027 else | |
5028 lpdi->lpszText = tt_text; | |
7 | 5029 } |
5030 } | |
5031 } | |
5032 break; | |
810 | 5033 # ifdef FEAT_GUI_TABLINE |
5034 case TCN_SELCHANGE: | |
5035 if (gui_mch_showing_tabline() | |
5036 && ((LPNMHDR)lParam)->hwndFrom == s_tabhwnd) | |
3225 | 5037 { |
810 | 5038 send_tabline_event(TabCtrl_GetCurSel(s_tabhwnd) + 1); |
3225 | 5039 return 0L; |
5040 } | |
810 | 5041 break; |
812 | 5042 |
5043 case NM_RCLICK: | |
5044 if (gui_mch_showing_tabline() | |
5045 && ((LPNMHDR)lParam)->hwndFrom == s_tabhwnd) | |
3225 | 5046 { |
812 | 5047 show_tabline_popup_menu(); |
3225 | 5048 return 0L; |
5049 } | |
812 | 5050 break; |
810 | 5051 # endif |
7 | 5052 default: |
810 | 5053 # ifdef FEAT_GUI_TABLINE |
5054 if (gui_mch_showing_tabline() | |
5055 && ((LPNMHDR)lParam)->hwndFrom == s_tabhwnd) | |
5056 return MyWindowProc(hwnd, uMsg, wParam, lParam); | |
5057 # endif | |
7 | 5058 break; |
5059 } | |
5060 break; | |
5061 #endif | |
5062 #if defined(MENUHINTS) && defined(FEAT_MENU) | |
5063 case WM_MENUSELECT: | |
5064 if (((UINT) HIWORD(wParam) | |
5065 & (0xffff ^ (MF_MOUSESELECT + MF_BITMAP + MF_POPUP))) | |
5066 == MF_HILITE | |
5067 && (State & CMDLINE) == 0) | |
5068 { | |
5069 UINT idButton; | |
5070 vimmenu_T *pMenu; | |
5071 static int did_menu_tip = FALSE; | |
5072 | |
5073 if (did_menu_tip) | |
5074 { | |
5075 msg_clr_cmdline(); | |
5076 setcursor(); | |
5077 out_flush(); | |
5078 did_menu_tip = FALSE; | |
5079 } | |
5080 | |
5081 idButton = (UINT)LOWORD(wParam); | |
5082 pMenu = gui_mswin_find_menu(root_menu, idButton); | |
5083 if (pMenu != NULL && pMenu->strings[MENU_INDEX_TIP] != 0 | |
5084 && GetMenuState(s_menuBar, pMenu->id, MF_BYCOMMAND) != -1) | |
5085 { | |
1288 | 5086 ++msg_hist_off; |
7 | 5087 msg(pMenu->strings[MENU_INDEX_TIP]); |
1288 | 5088 --msg_hist_off; |
7 | 5089 setcursor(); |
5090 out_flush(); | |
5091 did_menu_tip = TRUE; | |
5092 } | |
3225 | 5093 return 0L; |
7 | 5094 } |
5095 break; | |
5096 #endif | |
5097 case WM_NCHITTEST: | |
5098 { | |
5099 LRESULT result; | |
5100 int x, y; | |
5101 int xPos = GET_X_LPARAM(lParam); | |
5102 | |
5103 result = MyWindowProc(hwnd, uMsg, wParam, lParam); | |
5104 if (result == HTCLIENT) | |
5105 { | |
810 | 5106 #ifdef FEAT_GUI_TABLINE |
5107 if (gui_mch_showing_tabline()) | |
5108 { | |
5109 int yPos = GET_Y_LPARAM(lParam); | |
5110 RECT rct; | |
5111 | |
5112 /* If the cursor is on the GUI tabline, don't process this | |
5113 * event */ | |
5114 GetWindowRect(s_textArea, &rct); | |
5115 if (yPos < rct.top) | |
5116 return result; | |
5117 } | |
5118 #endif | |
7009 | 5119 (void)gui_mch_get_winpos(&x, &y); |
7 | 5120 xPos -= x; |
5121 | |
5122 if (xPos < 48) /* <VN> TODO should use system metric? */ | |
5123 return HTBOTTOMLEFT; | |
5124 else | |
5125 return HTBOTTOMRIGHT; | |
5126 } | |
5127 else | |
5128 return result; | |
5129 } | |
5130 /* break; notreached */ | |
5131 | |
5132 #ifdef FEAT_MBYTE_IME | |
5133 case WM_IME_NOTIFY: | |
5134 if (!_OnImeNotify(hwnd, (DWORD)wParam, (DWORD)lParam)) | |
5135 return MyWindowProc(hwnd, uMsg, wParam, lParam); | |
3225 | 5136 return 1L; |
5137 | |
7 | 5138 case WM_IME_COMPOSITION: |
5139 if (!_OnImeComposition(hwnd, wParam, lParam)) | |
5140 return MyWindowProc(hwnd, uMsg, wParam, lParam); | |
3225 | 5141 return 1L; |
7 | 5142 #endif |
5143 | |
5144 default: | |
5145 #ifdef MSWIN_FIND_REPLACE | |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
5146 if (uMsg == s_findrep_msg && s_findrep_msg != 0) |
7 | 5147 { |
5148 _OnFindRepl(); | |
5149 } | |
5150 #endif | |
5151 return MyWindowProc(hwnd, uMsg, wParam, lParam); | |
5152 } | |
5153 | |
3212 | 5154 return DefWindowProc(hwnd, uMsg, wParam, lParam); |
7 | 5155 } |
5156 | |
5157 /* | |
5158 * End of call-back routines | |
5159 */ | |
5160 | |
5161 /* parent window, if specified with -P */ | |
5162 HWND vim_parent_hwnd = NULL; | |
5163 | |
5164 static BOOL CALLBACK | |
5165 FindWindowTitle(HWND hwnd, LPARAM lParam) | |
5166 { | |
5167 char buf[2048]; | |
5168 char *title = (char *)lParam; | |
5169 | |
5170 if (GetWindowText(hwnd, buf, sizeof(buf))) | |
5171 { | |
5172 if (strstr(buf, title) != NULL) | |
5173 { | |
9 | 5174 /* Found it. Store the window ref. and quit searching if MDI |
5175 * works. */ | |
7 | 5176 vim_parent_hwnd = FindWindowEx(hwnd, NULL, "MDIClient", NULL); |
9 | 5177 if (vim_parent_hwnd != NULL) |
5178 return FALSE; | |
7 | 5179 } |
5180 } | |
5181 return TRUE; /* continue searching */ | |
5182 } | |
5183 | |
5184 /* | |
5185 * Invoked for '-P "title"' argument: search for parent application to open | |
5186 * our window in. | |
5187 */ | |
5188 void | |
5189 gui_mch_set_parent(char *title) | |
5190 { | |
5191 EnumWindows(FindWindowTitle, (LPARAM)title); | |
5192 if (vim_parent_hwnd == NULL) | |
5193 { | |
5194 EMSG2(_("E671: Cannot find window title \"%s\""), title); | |
5195 mch_exit(2); | |
5196 } | |
5197 } | |
5198 | |
323 | 5199 #ifndef FEAT_OLE |
7 | 5200 static void |
5201 ole_error(char *arg) | |
5202 { | |
1116 | 5203 char buf[IOSIZE]; |
5204 | |
5205 /* Can't use EMSG() here, we have not finished initialisation yet. */ | |
5206 vim_snprintf(buf, IOSIZE, | |
5207 _("E243: Argument not supported: \"-%s\"; Use the OLE version."), | |
5208 arg); | |
5209 mch_errmsg(buf); | |
7 | 5210 } |
323 | 5211 #endif |
7 | 5212 |
5213 /* | |
5214 * Parse the GUI related command-line arguments. Any arguments used are | |
5215 * deleted from argv, and *argc is decremented accordingly. This is called | |
5216 * when vim is started, whether or not the GUI has been started. | |
5217 */ | |
5218 void | |
5219 gui_mch_prepare(int *argc, char **argv) | |
5220 { | |
5221 int silent = FALSE; | |
5222 int idx; | |
5223 | |
5224 /* Check for special OLE command line parameters */ | |
5225 if ((*argc == 2 || *argc == 3) && (argv[1][0] == '-' || argv[1][0] == '/')) | |
5226 { | |
5227 /* Check for a "-silent" argument first. */ | |
5228 if (*argc == 3 && STRICMP(argv[1] + 1, "silent") == 0 | |
5229 && (argv[2][0] == '-' || argv[2][0] == '/')) | |
5230 { | |
5231 silent = TRUE; | |
5232 idx = 2; | |
5233 } | |
5234 else | |
5235 idx = 1; | |
5236 | |
5237 /* Register Vim as an OLE Automation server */ | |
5238 if (STRICMP(argv[idx] + 1, "register") == 0) | |
5239 { | |
5240 #ifdef FEAT_OLE | |
5241 RegisterMe(silent); | |
5242 mch_exit(0); | |
5243 #else | |
5244 if (!silent) | |
5245 ole_error("register"); | |
5246 mch_exit(2); | |
5247 #endif | |
5248 } | |
5249 | |
5250 /* Unregister Vim as an OLE Automation server */ | |
5251 if (STRICMP(argv[idx] + 1, "unregister") == 0) | |
5252 { | |
5253 #ifdef FEAT_OLE | |
5254 UnregisterMe(!silent); | |
5255 mch_exit(0); | |
5256 #else | |
5257 if (!silent) | |
5258 ole_error("unregister"); | |
5259 mch_exit(2); | |
5260 #endif | |
5261 } | |
5262 | |
5263 /* Ignore an -embedding argument. It is only relevant if the | |
5264 * application wants to treat the case when it is started manually | |
5265 * differently from the case where it is started via automation (and | |
5266 * we don't). | |
5267 */ | |
5268 if (STRICMP(argv[idx] + 1, "embedding") == 0) | |
5269 { | |
5270 #ifdef FEAT_OLE | |
5271 *argc = 1; | |
5272 #else | |
5273 ole_error("embedding"); | |
5274 mch_exit(2); | |
5275 #endif | |
5276 } | |
5277 } | |
5278 | |
5279 #ifdef FEAT_OLE | |
5280 { | |
5281 int bDoRestart = FALSE; | |
5282 | |
5283 InitOLE(&bDoRestart); | |
5284 /* automatically exit after registering */ | |
5285 if (bDoRestart) | |
5286 mch_exit(0); | |
5287 } | |
5288 #endif | |
5289 | |
5290 #ifdef FEAT_NETBEANS_INTG | |
5291 { | |
4352 | 5292 /* stolen from gui_x11.c */ |
7 | 5293 int arg; |
5294 | |
5295 for (arg = 1; arg < *argc; arg++) | |
5296 if (strncmp("-nb", argv[arg], 3) == 0) | |
5297 { | |
5298 netbeansArg = argv[arg]; | |
5299 mch_memmove(&argv[arg], &argv[arg + 1], | |
5300 (--*argc - arg) * sizeof(char *)); | |
5301 argv[*argc] = NULL; | |
5302 break; /* enough? */ | |
5303 } | |
5304 } | |
5305 #endif | |
5306 } | |
5307 | |
5308 /* | |
5309 * Initialise the GUI. Create all the windows, set up all the call-backs | |
5310 * etc. | |
5311 */ | |
5312 int | |
5313 gui_mch_init(void) | |
5314 { | |
5315 const char szVimWndClass[] = VIM_CLASS; | |
5316 const char szTextAreaClass[] = "VimTextArea"; | |
5317 WNDCLASS wndclass; | |
5318 #ifdef FEAT_MBYTE | |
5319 const WCHAR szVimWndClassW[] = VIM_CLASSW; | |
2078
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5320 const WCHAR szTextAreaClassW[] = L"VimTextArea"; |
7 | 5321 WNDCLASSW wndclassw; |
5322 #endif | |
5323 #ifdef GLOBAL_IME | |
5324 ATOM atom; | |
5325 #endif | |
5326 | |
5327 /* Return here if the window was already opened (happens when | |
5328 * gui_mch_dialog() is called early). */ | |
5329 if (s_hwnd != NULL) | |
153 | 5330 goto theend; |
7 | 5331 |
5332 /* | |
5333 * Load the tearoff bitmap | |
5334 */ | |
5335 #ifdef FEAT_TEAROFF | |
5336 s_htearbitmap = LoadBitmap(s_hinst, "IDB_TEAROFF"); | |
5337 #endif | |
5338 | |
5339 gui.scrollbar_width = GetSystemMetrics(SM_CXVSCROLL); | |
5340 gui.scrollbar_height = GetSystemMetrics(SM_CYHSCROLL); | |
5341 #ifdef FEAT_MENU | |
5342 gui.menu_height = 0; /* Windows takes care of this */ | |
5343 #endif | |
5344 gui.border_width = 0; | |
5345 | |
5346 s_brush = CreateSolidBrush(GetSysColor(COLOR_BTNFACE)); | |
5347 | |
5348 #ifdef FEAT_MBYTE | |
5349 /* First try using the wide version, so that we can use any title. | |
5350 * Otherwise only characters in the active codepage will work. */ | |
5351 if (GetClassInfoW(s_hinst, szVimWndClassW, &wndclassw) == 0) | |
5352 { | |
819 | 5353 wndclassw.style = CS_DBLCLKS; |
7 | 5354 wndclassw.lpfnWndProc = _WndProc; |
5355 wndclassw.cbClsExtra = 0; | |
5356 wndclassw.cbWndExtra = 0; | |
5357 wndclassw.hInstance = s_hinst; | |
5358 wndclassw.hIcon = LoadIcon(wndclassw.hInstance, "IDR_VIM"); | |
5359 wndclassw.hCursor = LoadCursor(NULL, IDC_ARROW); | |
5360 wndclassw.hbrBackground = s_brush; | |
5361 wndclassw.lpszMenuName = NULL; | |
5362 wndclassw.lpszClassName = szVimWndClassW; | |
5363 | |
5364 if (( | |
5365 #ifdef GLOBAL_IME | |
5366 atom = | |
5367 #endif | |
5368 RegisterClassW(&wndclassw)) == 0) | |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
5369 return FAIL; |
7 | 5370 else |
5371 wide_WindowProc = TRUE; | |
5372 } | |
5373 | |
5374 if (!wide_WindowProc) | |
5375 #endif | |
5376 | |
5377 if (GetClassInfo(s_hinst, szVimWndClass, &wndclass) == 0) | |
5378 { | |
819 | 5379 wndclass.style = CS_DBLCLKS; |
7 | 5380 wndclass.lpfnWndProc = _WndProc; |
5381 wndclass.cbClsExtra = 0; | |
5382 wndclass.cbWndExtra = 0; | |
5383 wndclass.hInstance = s_hinst; | |
5384 wndclass.hIcon = LoadIcon(wndclass.hInstance, "IDR_VIM"); | |
5385 wndclass.hCursor = LoadCursor(NULL, IDC_ARROW); | |
5386 wndclass.hbrBackground = s_brush; | |
5387 wndclass.lpszMenuName = NULL; | |
5388 wndclass.lpszClassName = szVimWndClass; | |
5389 | |
5390 if (( | |
5391 #ifdef GLOBAL_IME | |
5392 atom = | |
5393 #endif | |
5394 RegisterClass(&wndclass)) == 0) | |
5395 return FAIL; | |
5396 } | |
5397 | |
5398 if (vim_parent_hwnd != NULL) | |
5399 { | |
5400 #ifdef HAVE_TRY_EXCEPT | |
5401 __try | |
5402 { | |
5403 #endif | |
5404 /* Open inside the specified parent window. | |
5405 * TODO: last argument should point to a CLIENTCREATESTRUCT | |
5406 * structure. */ | |
5407 s_hwnd = CreateWindowEx( | |
5408 WS_EX_MDICHILD, | |
5409 szVimWndClass, "Vim MSWindows GUI", | |
3006 | 5410 WS_OVERLAPPEDWINDOW | WS_CHILD |
5411 | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | 0xC000, | |
7 | 5412 gui_win_x == -1 ? CW_USEDEFAULT : gui_win_x, |
5413 gui_win_y == -1 ? CW_USEDEFAULT : gui_win_y, | |
5414 100, /* Any value will do */ | |
5415 100, /* Any value will do */ | |
5416 vim_parent_hwnd, NULL, | |
5417 s_hinst, NULL); | |
5418 #ifdef HAVE_TRY_EXCEPT | |
5419 } | |
5420 __except(EXCEPTION_EXECUTE_HANDLER) | |
5421 { | |
5422 /* NOP */ | |
5423 } | |
5424 #endif | |
5425 if (s_hwnd == NULL) | |
5426 { | |
5427 EMSG(_("E672: Unable to open window inside MDI application")); | |
5428 mch_exit(2); | |
5429 } | |
5430 } | |
5431 else | |
1376 | 5432 { |
5433 /* If the provided windowid is not valid reset it to zero, so that it | |
5434 * is ignored and we open our own window. */ | |
5435 if (IsWindow((HWND)win_socket_id) <= 0) | |
5436 win_socket_id = 0; | |
5437 | |
5438 /* Create a window. If win_socket_id is not zero without border and | |
5439 * titlebar, it will be reparented below. */ | |
7 | 5440 s_hwnd = CreateWindow( |
1376 | 5441 szVimWndClass, "Vim MSWindows GUI", |
3006 | 5442 (win_socket_id == 0 ? WS_OVERLAPPEDWINDOW : WS_POPUP) |
5443 | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, | |
1376 | 5444 gui_win_x == -1 ? CW_USEDEFAULT : gui_win_x, |
5445 gui_win_y == -1 ? CW_USEDEFAULT : gui_win_y, | |
5446 100, /* Any value will do */ | |
5447 100, /* Any value will do */ | |
5448 NULL, NULL, | |
5449 s_hinst, NULL); | |
5450 if (s_hwnd != NULL && win_socket_id != 0) | |
5451 { | |
5452 SetParent(s_hwnd, (HWND)win_socket_id); | |
5453 ShowWindow(s_hwnd, SW_SHOWMAXIMIZED); | |
5454 } | |
5455 } | |
7 | 5456 |
5457 if (s_hwnd == NULL) | |
5458 return FAIL; | |
5459 | |
5460 #ifdef GLOBAL_IME | |
5461 global_ime_init(atom, s_hwnd); | |
5462 #endif | |
5463 #if defined(FEAT_MBYTE_IME) && defined(DYNAMIC_IME) | |
5464 dyn_imm_load(); | |
5465 #endif | |
5466 | |
5467 /* Create the text area window */ | |
2078
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5468 #ifdef FEAT_MBYTE |
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5469 if (wide_WindowProc) |
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5470 { |
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5471 if (GetClassInfoW(s_hinst, szTextAreaClassW, &wndclassw) == 0) |
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5472 { |
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5473 wndclassw.style = CS_OWNDC; |
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5474 wndclassw.lpfnWndProc = _TextAreaWndProc; |
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5475 wndclassw.cbClsExtra = 0; |
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5476 wndclassw.cbWndExtra = 0; |
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5477 wndclassw.hInstance = s_hinst; |
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5478 wndclassw.hIcon = NULL; |
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5479 wndclassw.hCursor = LoadCursor(NULL, IDC_ARROW); |
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5480 wndclassw.hbrBackground = NULL; |
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5481 wndclassw.lpszMenuName = NULL; |
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5482 wndclassw.lpszClassName = szTextAreaClassW; |
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5483 |
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5484 if (RegisterClassW(&wndclassw) == 0) |
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5485 return FAIL; |
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5486 } |
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5487 } |
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5488 else |
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5489 #endif |
7 | 5490 if (GetClassInfo(s_hinst, szTextAreaClass, &wndclass) == 0) |
5491 { | |
5492 wndclass.style = CS_OWNDC; | |
5493 wndclass.lpfnWndProc = _TextAreaWndProc; | |
5494 wndclass.cbClsExtra = 0; | |
5495 wndclass.cbWndExtra = 0; | |
5496 wndclass.hInstance = s_hinst; | |
5497 wndclass.hIcon = NULL; | |
5498 wndclass.hCursor = LoadCursor(NULL, IDC_ARROW); | |
5499 wndclass.hbrBackground = NULL; | |
5500 wndclass.lpszMenuName = NULL; | |
5501 wndclass.lpszClassName = szTextAreaClass; | |
5502 | |
5503 if (RegisterClass(&wndclass) == 0) | |
5504 return FAIL; | |
5505 } | |
5506 s_textArea = CreateWindowEx( | |
7243
861a44fc5183
commit https://github.com/vim/vim/commit/97b0b0ec764d3a247ef600d809b965d5ab37155d
Christian Brabandt <cb@256bit.org>
parents:
7060
diff
changeset
|
5507 0, |
7 | 5508 szTextAreaClass, "Vim text area", |
5509 WS_CHILD | WS_VISIBLE, 0, 0, | |
5510 100, /* Any value will do for now */ | |
5511 100, /* Any value will do for now */ | |
5512 s_hwnd, NULL, | |
5513 s_hinst, NULL); | |
5514 | |
5515 if (s_textArea == NULL) | |
5516 return FAIL; | |
5517 | |
8100
ae50910ce279
commit https://github.com/vim/vim/commit/203219048fa007b5042d9b893fd647aef44722a0
Christian Brabandt <cb@256bit.org>
parents:
8090
diff
changeset
|
5518 #ifdef FEAT_LIBCALL |
6249 | 5519 /* Try loading an icon from $RUNTIMEPATH/bitmaps/vim.ico. */ |
5520 { | |
5521 HANDLE hIcon = NULL; | |
5522 | |
5523 if (mch_icon_load(&hIcon) == OK && hIcon != NULL) | |
6260 | 5524 SendMessage(s_hwnd, WM_SETICON, ICON_SMALL, (LPARAM)hIcon); |
6249 | 5525 } |
8100
ae50910ce279
commit https://github.com/vim/vim/commit/203219048fa007b5042d9b893fd647aef44722a0
Christian Brabandt <cb@256bit.org>
parents:
8090
diff
changeset
|
5526 #endif |
6249 | 5527 |
7 | 5528 #ifdef FEAT_MENU |
5529 s_menuBar = CreateMenu(); | |
5530 #endif | |
5531 s_hdc = GetDC(s_textArea); | |
5532 | |
5533 DragAcceptFiles(s_hwnd, TRUE); | |
5534 | |
5535 /* Do we need to bother with this? */ | |
5536 /* m_fMouseAvail = GetSystemMetrics(SM_MOUSEPRESENT); */ | |
5537 | |
5538 /* Get background/foreground colors from the system */ | |
5539 gui_mch_def_colors(); | |
5540 | |
5541 /* Get the colors from the "Normal" group (set in syntax.c or in a vimrc | |
5542 * file) */ | |
5543 set_normal_colors(); | |
5544 | |
5545 /* | |
5546 * Check that none of the colors are the same as the background color. | |
5547 * Then store the current values as the defaults. | |
5548 */ | |
5549 gui_check_colors(); | |
5550 gui.def_norm_pixel = gui.norm_pixel; | |
5551 gui.def_back_pixel = gui.back_pixel; | |
5552 | |
5553 /* Get the colors for the highlight groups (gui_check_colors() might have | |
5554 * changed them) */ | |
5555 highlight_gui_started(); | |
5556 | |
5557 /* | |
7243
861a44fc5183
commit https://github.com/vim/vim/commit/97b0b0ec764d3a247ef600d809b965d5ab37155d
Christian Brabandt <cb@256bit.org>
parents:
7060
diff
changeset
|
5558 * Start out by adding the configured border width into the border offset. |
7 | 5559 */ |
7243
861a44fc5183
commit https://github.com/vim/vim/commit/97b0b0ec764d3a247ef600d809b965d5ab37155d
Christian Brabandt <cb@256bit.org>
parents:
7060
diff
changeset
|
5560 gui.border_offset = gui.border_width; |
7 | 5561 |
5562 /* | |
5563 * Set up for Intellimouse processing | |
5564 */ | |
5565 init_mouse_wheel(); | |
5566 | |
5567 /* | |
5568 * compute a couple of metrics used for the dialogs | |
5569 */ | |
5570 get_dialog_font_metrics(); | |
5571 #ifdef FEAT_TOOLBAR | |
5572 /* | |
5573 * Create the toolbar | |
5574 */ | |
5575 initialise_toolbar(); | |
5576 #endif | |
810 | 5577 #ifdef FEAT_GUI_TABLINE |
5578 /* | |
5579 * Create the tabline | |
5580 */ | |
5581 initialise_tabline(); | |
5582 #endif | |
7 | 5583 #ifdef MSWIN_FIND_REPLACE |
5584 /* | |
5585 * Initialise the dialog box stuff | |
5586 */ | |
5587 s_findrep_msg = RegisterWindowMessage(FINDMSGSTRING); | |
5588 | |
5589 /* Initialise the struct */ | |
5590 s_findrep_struct.lStructSize = sizeof(s_findrep_struct); | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
5591 s_findrep_struct.lpstrFindWhat = (LPSTR)alloc(MSWIN_FR_BUFSIZE); |
7 | 5592 s_findrep_struct.lpstrFindWhat[0] = NUL; |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
5593 s_findrep_struct.lpstrReplaceWith = (LPSTR)alloc(MSWIN_FR_BUFSIZE); |
7 | 5594 s_findrep_struct.lpstrReplaceWith[0] = NUL; |
5595 s_findrep_struct.wFindWhatLen = MSWIN_FR_BUFSIZE; | |
5596 s_findrep_struct.wReplaceWithLen = MSWIN_FR_BUFSIZE; | |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
5597 # ifdef FEAT_MBYTE |
1795 | 5598 s_findrep_struct_w.lStructSize = sizeof(s_findrep_struct_w); |
5599 s_findrep_struct_w.lpstrFindWhat = | |
5600 (LPWSTR)alloc(MSWIN_FR_BUFSIZE * sizeof(WCHAR)); | |
5601 s_findrep_struct_w.lpstrFindWhat[0] = NUL; | |
5602 s_findrep_struct_w.lpstrReplaceWith = | |
5603 (LPWSTR)alloc(MSWIN_FR_BUFSIZE * sizeof(WCHAR)); | |
5604 s_findrep_struct_w.lpstrReplaceWith[0] = NUL; | |
5605 s_findrep_struct_w.wFindWhatLen = MSWIN_FR_BUFSIZE; | |
5606 s_findrep_struct_w.wReplaceWithLen = MSWIN_FR_BUFSIZE; | |
5607 # endif | |
7 | 5608 #endif |
5609 | |
2616 | 5610 #ifdef FEAT_EVAL |
7560
fb84355cd972
commit https://github.com/vim/vim/commit/f32c5cd6e0e6aa6d4aeacb6bf52e3d3ba21e5201
Christian Brabandt <cb@256bit.org>
parents:
7243
diff
changeset
|
5611 # 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
|
5612 /* 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
|
5613 # ifndef HandleToLong |
8102
441298d72f3c
commit https://github.com/vim/vim/commit/a87e2c277eabf0134925c340e9dc4fe9446f3636
Christian Brabandt <cb@256bit.org>
parents:
8100
diff
changeset
|
5614 # 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
|
5615 # endif |
2943 | 5616 # endif |
2616 | 5617 /* set the v:windowid variable */ |
2865 | 5618 set_vim_var_nr(VV_WINDOWID, HandleToLong(s_hwnd)); |
2616 | 5619 #endif |
5620 | |
6110 | 5621 #ifdef FEAT_RENDER_OPTIONS |
5622 if (p_rop) | |
5623 (void)gui_mch_set_rendering_options(p_rop); | |
5624 #endif | |
5625 | |
153 | 5626 theend: |
5627 /* Display any pending error messages */ | |
5628 display_errors(); | |
5629 | |
7 | 5630 return OK; |
5631 } | |
5632 | |
5633 /* | |
5634 * Get the size of the screen, taking position on multiple monitors into | |
5635 * account (if supported). | |
5636 */ | |
5637 static void | |
5638 get_work_area(RECT *spi_rect) | |
5639 { | |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
5640 HMONITOR mon; |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
5641 MONITORINFO moninfo; |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
5642 |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
5643 /* work out which monitor the window is on, and get *it's* work area */ |
10438
935bdb919a50
commit https://github.com/vim/vim/commit/87f3d202a90bd2d08a7afd55b3486b10bef858bb
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
5644 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
|
5645 if (mon != NULL) |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
5646 { |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
5647 moninfo.cbSize = sizeof(MONITORINFO); |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
5648 if (GetMonitorInfo(mon, &moninfo)) |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
5649 { |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
5650 *spi_rect = moninfo.rcWork; |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
5651 return; |
7 | 5652 } |
5653 } | |
5654 /* this is the old method... */ | |
5655 SystemParametersInfo(SPI_GETWORKAREA, 0, spi_rect, 0); | |
5656 } | |
5657 | |
5658 /* | |
5659 * Set the size of the window to the given width and height in pixels. | |
5660 */ | |
5661 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
|
5662 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
|
5663 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
|
5664 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
|
5665 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
|
5666 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
|
5667 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
|
5668 int base_height UNUSED, |
812 | 5669 int direction) |
7 | 5670 { |
5671 RECT workarea_rect; | |
5672 int win_width, win_height; | |
5673 WINDOWPLACEMENT wndpl; | |
5674 | |
819 | 5675 /* Try to keep window completely on screen. */ |
5676 /* Get position of the screen work area. This is the part that is not | |
5677 * used by the taskbar or appbars. */ | |
7 | 5678 get_work_area(&workarea_rect); |
5679 | |
4352 | 5680 /* Get current position of our window. Note that the .left and .top are |
819 | 5681 * relative to the work area. */ |
7 | 5682 wndpl.length = sizeof(WINDOWPLACEMENT); |
5683 GetWindowPlacement(s_hwnd, &wndpl); | |
5684 | |
5685 /* Resizing a maximized window looks very strange, unzoom it first. | |
5686 * But don't do it when still starting up, it may have been requested in | |
5687 * the shortcut. */ | |
5688 if (wndpl.showCmd == SW_SHOWMAXIMIZED && starting == 0) | |
5689 { | |
5690 ShowWindow(s_hwnd, SW_SHOWNORMAL); | |
5691 /* Need to get the settings of the normal window. */ | |
5692 GetWindowPlacement(s_hwnd, &wndpl); | |
5693 } | |
5694 | |
5695 /* 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
|
5696 win_width = width + (GetSystemMetrics(SM_CXFRAME) + |
6110 | 5697 GetSystemMetrics(SM_CXPADDEDBORDER)) * 2; |
5225
8f983df0299f
updated for version 7.4a.038
Bram Moolenaar <bram@vim.org>
parents:
5223
diff
changeset
|
5698 win_height = height + (GetSystemMetrics(SM_CYFRAME) + |
6110 | 5699 GetSystemMetrics(SM_CXPADDEDBORDER)) * 2 |
7 | 5700 + GetSystemMetrics(SM_CYCAPTION) |
5701 #ifdef FEAT_MENU | |
5702 + gui_mswin_get_menu_height(FALSE) | |
5703 #endif | |
5704 ; | |
5705 | |
3248 | 5706 /* The following should take care of keeping Vim on the same monitor, no |
5707 * matter if the secondary monitor is left or right of the primary | |
5708 * monitor. */ | |
5709 wndpl.rcNormalPosition.right = wndpl.rcNormalPosition.left + win_width; | |
5710 wndpl.rcNormalPosition.bottom = wndpl.rcNormalPosition.top + win_height; | |
5711 | |
5712 /* If the window is going off the screen, move it on to the screen. */ | |
819 | 5713 if ((direction & RESIZE_HOR) |
3248 | 5714 && wndpl.rcNormalPosition.right > workarea_rect.right) |
5715 OffsetRect(&wndpl.rcNormalPosition, | |
5716 workarea_rect.right - wndpl.rcNormalPosition.right, 0); | |
5717 | |
5718 if ((direction & RESIZE_HOR) | |
5719 && wndpl.rcNormalPosition.left < workarea_rect.left) | |
5720 OffsetRect(&wndpl.rcNormalPosition, | |
5721 workarea_rect.left - wndpl.rcNormalPosition.left, 0); | |
7 | 5722 |
812 | 5723 if ((direction & RESIZE_VERT) |
3248 | 5724 && wndpl.rcNormalPosition.bottom > workarea_rect.bottom) |
5725 OffsetRect(&wndpl.rcNormalPosition, | |
5726 0, workarea_rect.bottom - wndpl.rcNormalPosition.bottom); | |
5727 | |
5728 if ((direction & RESIZE_VERT) | |
5729 && wndpl.rcNormalPosition.top < workarea_rect.top) | |
5730 OffsetRect(&wndpl.rcNormalPosition, | |
5731 0, workarea_rect.top - wndpl.rcNormalPosition.top); | |
7 | 5732 |
5733 /* set window position - we should use SetWindowPlacement rather than | |
5734 * SetWindowPos as the MSDN docs say the coord systems returned by | |
5735 * these two are not compatible. */ | |
5736 SetWindowPlacement(s_hwnd, &wndpl); | |
5737 | |
5738 SetActiveWindow(s_hwnd); | |
5739 SetFocus(s_hwnd); | |
5740 | |
5741 #ifdef FEAT_MENU | |
5742 /* Menu may wrap differently now */ | |
5743 gui_mswin_get_menu_height(!gui.starting); | |
5744 #endif | |
5745 } | |
5746 | |
5747 | |
5748 void | |
5749 gui_mch_set_scrollbar_thumb( | |
5750 scrollbar_T *sb, | |
5751 long val, | |
5752 long size, | |
5753 long max) | |
5754 { | |
5755 SCROLLINFO info; | |
5756 | |
5757 sb->scroll_shift = 0; | |
5758 while (max > 32767) | |
5759 { | |
5760 max = (max + 1) >> 1; | |
5761 val >>= 1; | |
5762 size >>= 1; | |
5763 ++sb->scroll_shift; | |
5764 } | |
5765 | |
5766 if (sb->scroll_shift > 0) | |
5767 ++size; | |
5768 | |
5769 info.cbSize = sizeof(info); | |
5770 info.fMask = SIF_POS | SIF_RANGE | SIF_PAGE; | |
5771 info.nPos = val; | |
5772 info.nMin = 0; | |
5773 info.nMax = max; | |
5774 info.nPage = size; | |
5775 SetScrollInfo(sb->id, SB_CTL, &info, TRUE); | |
5776 } | |
5777 | |
5778 | |
5779 /* | |
5780 * Set the current text font. | |
5781 */ | |
5782 void | |
5783 gui_mch_set_font(GuiFont font) | |
5784 { | |
5785 gui.currFont = font; | |
5786 } | |
5787 | |
5788 | |
5789 /* | |
5790 * Set the current text foreground color. | |
5791 */ | |
5792 void | |
5793 gui_mch_set_fg_color(guicolor_T color) | |
5794 { | |
5795 gui.currFgColor = color; | |
5796 } | |
5797 | |
5798 /* | |
5799 * Set the current text background color. | |
5800 */ | |
5801 void | |
5802 gui_mch_set_bg_color(guicolor_T color) | |
5803 { | |
5804 gui.currBgColor = color; | |
5805 } | |
5806 | |
205 | 5807 /* |
5808 * Set the current text special color. | |
5809 */ | |
5810 void | |
5811 gui_mch_set_sp_color(guicolor_T color) | |
5812 { | |
5813 gui.currSpColor = color; | |
5814 } | |
5815 | |
12950
e60b2aa04903
patch 8.0.1351: warning for unused variables building with MinGW
Christian Brabandt <cb@256bit.org>
parents:
12934
diff
changeset
|
5816 #ifdef FEAT_MBYTE_IME |
7 | 5817 /* |
5818 * Multi-byte handling, originally by Sung-Hoon Baek. | |
5819 * First static functions (no prototypes generated). | |
5820 */ | |
12950
e60b2aa04903
patch 8.0.1351: warning for unused variables building with MinGW
Christian Brabandt <cb@256bit.org>
parents:
12934
diff
changeset
|
5821 # ifdef _MSC_VER |
e60b2aa04903
patch 8.0.1351: warning for unused variables building with MinGW
Christian Brabandt <cb@256bit.org>
parents:
12934
diff
changeset
|
5822 # include <ime.h> /* Apparently not needed for Cygwin, MingW or Borland. */ |
e60b2aa04903
patch 8.0.1351: warning for unused variables building with MinGW
Christian Brabandt <cb@256bit.org>
parents:
12934
diff
changeset
|
5823 # endif |
e60b2aa04903
patch 8.0.1351: warning for unused variables building with MinGW
Christian Brabandt <cb@256bit.org>
parents:
12934
diff
changeset
|
5824 # include <imm.h> |
7 | 5825 |
5826 /* | |
5827 * handle WM_IME_NOTIFY message | |
5828 */ | |
5829 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
|
5830 _OnImeNotify(HWND hWnd, DWORD dwCommand, DWORD dwData UNUSED) |
7 | 5831 { |
5832 LRESULT lResult = 0; | |
5833 HIMC hImc; | |
5834 | |
5835 if (!pImmGetContext || (hImc = pImmGetContext(hWnd)) == (HIMC)0) | |
5836 return lResult; | |
5837 switch (dwCommand) | |
5838 { | |
5839 case IMN_SETOPENSTATUS: | |
5840 if (pImmGetOpenStatus(hImc)) | |
5841 { | |
5842 pImmSetCompositionFont(hImc, &norm_logfont); | |
5843 im_set_position(gui.row, gui.col); | |
5844 | |
5845 /* Disable langmap */ | |
5846 State &= ~LANGMAP; | |
5847 if (State & INSERT) | |
5848 { | |
12477
68d7bc045dbe
patch 8.0.1118: FEAT_WINDOWS adds a lot of #ifdefs
Christian Brabandt <cb@256bit.org>
parents:
12317
diff
changeset
|
5849 #if defined(FEAT_KEYMAP) |
7 | 5850 /* Unshown 'keymap' in status lines */ |
5851 if (curbuf->b_p_iminsert == B_IMODE_LMAP) | |
5852 { | |
5853 /* Save cursor position */ | |
5854 int old_row = gui.row; | |
5855 int old_col = gui.col; | |
5856 | |
5857 // This must be called here before | |
5858 // status_redraw_curbuf(), otherwise the mode | |
5859 // message may appear in the wrong position. | |
5860 showmode(); | |
5861 status_redraw_curbuf(); | |
5862 update_screen(0); | |
5863 /* Restore cursor position */ | |
5864 gui.row = old_row; | |
5865 gui.col = old_col; | |
5866 } | |
5867 #endif | |
5868 } | |
5869 } | |
5870 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
|
5871 gui_mch_flush(); |
7 | 5872 lResult = 0; |
5873 break; | |
5874 } | |
5875 pImmReleaseContext(hWnd, hImc); | |
5876 return lResult; | |
5877 } | |
5878 | |
5879 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
|
5880 _OnImeComposition(HWND hwnd, WPARAM dbcs UNUSED, LPARAM param) |
7 | 5881 { |
5882 char_u *ret; | |
5883 int len; | |
5884 | |
5885 if ((param & GCS_RESULTSTR) == 0) /* Composition unfinished. */ | |
5886 return 0; | |
5887 | |
5888 ret = GetResultStr(hwnd, GCS_RESULTSTR, &len); | |
5889 if (ret != NULL) | |
5890 { | |
5891 add_to_input_buf_csi(ret, len); | |
5892 vim_free(ret); | |
5893 return 1; | |
5894 } | |
5895 return 0; | |
5896 } | |
5897 | |
5898 /* | |
5899 * get the current composition string, in UCS-2; *lenp is the number of | |
5900 * *lenp is the number of Unicode characters. | |
5901 */ | |
5902 static short_u * | |
5903 GetCompositionString_inUCS2(HIMC hIMC, DWORD GCS, int *lenp) | |
5904 { | |
5905 LONG ret; | |
5906 LPWSTR wbuf = NULL; | |
5907 char_u *buf; | |
5908 | |
5909 if (!pImmGetContext) | |
5910 return NULL; /* no imm32.dll */ | |
5911 | |
5912 /* Try Unicode; this'll always work on NT regardless of codepage. */ | |
5913 ret = pImmGetCompositionStringW(hIMC, GCS, NULL, 0); | |
5914 if (ret == 0) | |
5915 return NULL; /* empty */ | |
5916 | |
5917 if (ret > 0) | |
5918 { | |
5919 /* Allocate the requested buffer plus space for the NUL character. */ | |
5920 wbuf = (LPWSTR)alloc(ret + sizeof(WCHAR)); | |
5921 if (wbuf != NULL) | |
5922 { | |
5923 pImmGetCompositionStringW(hIMC, GCS, wbuf, ret); | |
5924 *lenp = ret / sizeof(WCHAR); | |
5925 } | |
5926 return (short_u *)wbuf; | |
5927 } | |
5928 | |
5929 /* ret < 0; we got an error, so try the ANSI version. This'll work | |
5930 * on 9x/ME, but only if the codepage happens to be set to whatever | |
5931 * we're inputting. */ | |
5932 ret = pImmGetCompositionStringA(hIMC, GCS, NULL, 0); | |
5933 if (ret <= 0) | |
5934 return NULL; /* empty or error */ | |
5935 | |
5936 buf = alloc(ret); | |
5937 if (buf == NULL) | |
5938 return NULL; | |
5939 pImmGetCompositionStringA(hIMC, GCS, buf, ret); | |
5940 | |
5941 /* 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
|
5942 MultiByteToWideChar_alloc(GetACP(), 0, (LPCSTR)buf, ret, &wbuf, lenp); |
7 | 5943 vim_free(buf); |
5944 | |
5945 return (short_u *)wbuf; | |
5946 } | |
5947 | |
5948 /* | |
5949 * void GetResultStr() | |
5950 * | |
5951 * This handles WM_IME_COMPOSITION with GCS_RESULTSTR flag on. | |
5952 * get complete composition string | |
5953 */ | |
5954 static char_u * | |
5955 GetResultStr(HWND hwnd, int GCS, int *lenp) | |
5956 { | |
5957 HIMC hIMC; /* Input context handle. */ | |
5958 short_u *buf = NULL; | |
5959 char_u *convbuf = NULL; | |
5960 | |
5961 if (!pImmGetContext || (hIMC = pImmGetContext(hwnd)) == (HIMC)0) | |
5962 return NULL; | |
5963 | |
5964 /* Reads in the composition string. */ | |
5965 buf = GetCompositionString_inUCS2(hIMC, GCS, lenp); | |
5966 if (buf == NULL) | |
5967 return NULL; | |
5968 | |
1752 | 5969 convbuf = utf16_to_enc(buf, lenp); |
7 | 5970 pImmReleaseContext(hwnd, hIMC); |
5971 vim_free(buf); | |
5972 return convbuf; | |
5973 } | |
5974 #endif | |
5975 | |
5976 /* 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
|
5977 #if defined(FEAT_MBYTE_IME) || defined(PROTO) |
7 | 5978 |
5979 /* | |
5980 * set font to IM. | |
5981 */ | |
5982 void | |
5983 im_set_font(LOGFONT *lf) | |
5984 { | |
5985 HIMC hImc; | |
5986 | |
5987 if (pImmGetContext && (hImc = pImmGetContext(s_hwnd)) != (HIMC)0) | |
5988 { | |
5989 pImmSetCompositionFont(hImc, lf); | |
5990 pImmReleaseContext(s_hwnd, hImc); | |
5991 } | |
5992 } | |
5993 | |
5994 /* | |
5995 * Notify cursor position to IM. | |
5996 */ | |
5997 void | |
5998 im_set_position(int row, int col) | |
5999 { | |
6000 HIMC hImc; | |
6001 | |
6002 if (pImmGetContext && (hImc = pImmGetContext(s_hwnd)) != (HIMC)0) | |
6003 { | |
6004 COMPOSITIONFORM cfs; | |
6005 | |
6006 cfs.dwStyle = CFS_POINT; | |
6007 cfs.ptCurrentPos.x = FILL_X(col); | |
6008 cfs.ptCurrentPos.y = FILL_Y(row); | |
6009 MapWindowPoints(s_textArea, s_hwnd, &cfs.ptCurrentPos, 1); | |
6010 pImmSetCompositionWindow(hImc, &cfs); | |
6011 | |
6012 pImmReleaseContext(s_hwnd, hImc); | |
6013 } | |
6014 } | |
6015 | |
6016 /* | |
6017 * Set IM status on ("active" is TRUE) or off ("active" is FALSE). | |
6018 */ | |
6019 void | |
6020 im_set_active(int active) | |
6021 { | |
6022 HIMC hImc; | |
6023 static HIMC hImcOld = (HIMC)0; | |
6024 | |
6025 if (pImmGetContext) /* if NULL imm32.dll wasn't loaded (yet) */ | |
6026 { | |
6027 if (p_imdisable) | |
6028 { | |
6029 if (hImcOld == (HIMC)0) | |
6030 { | |
6031 hImcOld = pImmGetContext(s_hwnd); | |
6032 if (hImcOld) | |
6033 pImmAssociateContext(s_hwnd, (HIMC)0); | |
6034 } | |
6035 active = FALSE; | |
6036 } | |
6037 else if (hImcOld != (HIMC)0) | |
6038 { | |
6039 pImmAssociateContext(s_hwnd, hImcOld); | |
6040 hImcOld = (HIMC)0; | |
6041 } | |
6042 | |
6043 hImc = pImmGetContext(s_hwnd); | |
6044 if (hImc) | |
6045 { | |
777 | 6046 /* |
6047 * for Korean ime | |
6048 */ | |
6049 HKL hKL = GetKeyboardLayout(0); | |
6050 | |
6051 if (LOWORD(hKL) == MAKELANGID(LANG_KOREAN, SUBLANG_KOREAN)) | |
6052 { | |
6053 static DWORD dwConversionSaved = 0, dwSentenceSaved = 0; | |
6054 static BOOL bSaved = FALSE; | |
6055 | |
6056 if (active) | |
6057 { | |
6058 /* if we have a saved conversion status, restore it */ | |
6059 if (bSaved) | |
6060 pImmSetConversionStatus(hImc, dwConversionSaved, | |
6061 dwSentenceSaved); | |
6062 bSaved = FALSE; | |
6063 } | |
6064 else | |
6065 { | |
6066 /* save conversion status and disable korean */ | |
6067 if (pImmGetConversionStatus(hImc, &dwConversionSaved, | |
6068 &dwSentenceSaved)) | |
6069 { | |
6070 bSaved = TRUE; | |
6071 pImmSetConversionStatus(hImc, | |
6072 dwConversionSaved & ~(IME_CMODE_NATIVE | |
6073 | IME_CMODE_FULLSHAPE), | |
6074 dwSentenceSaved); | |
6075 } | |
6076 } | |
6077 } | |
6078 | |
7 | 6079 pImmSetOpenStatus(hImc, active); |
6080 pImmReleaseContext(s_hwnd, hImc); | |
6081 } | |
6082 } | |
6083 } | |
6084 | |
6085 /* | |
6086 * Get IM status. When IM is on, return not 0. Else return 0. | |
6087 */ | |
6088 int | |
7823
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
6089 im_get_status(void) |
7 | 6090 { |
6091 int status = 0; | |
6092 HIMC hImc; | |
6093 | |
6094 if (pImmGetContext && (hImc = pImmGetContext(s_hwnd)) != (HIMC)0) | |
6095 { | |
6096 status = pImmGetOpenStatus(hImc) ? 1 : 0; | |
6097 pImmReleaseContext(s_hwnd, hImc); | |
6098 } | |
6099 return status; | |
6100 } | |
6101 | |
12950
e60b2aa04903
patch 8.0.1351: warning for unused variables building with MinGW
Christian Brabandt <cb@256bit.org>
parents:
12934
diff
changeset
|
6102 #endif /* FEAT_MBYTE_IME */ |
7 | 6103 |
6104 #if defined(FEAT_MBYTE) && !defined(FEAT_MBYTE_IME) && defined(GLOBAL_IME) | |
6105 /* Win32 with GLOBAL IME */ | |
6106 | |
6107 /* | |
6108 * Notify cursor position to IM. | |
6109 */ | |
6110 void | |
6111 im_set_position(int row, int col) | |
6112 { | |
6113 /* Win32 with GLOBAL IME */ | |
6114 POINT p; | |
6115 | |
6116 p.x = FILL_X(col); | |
6117 p.y = FILL_Y(row); | |
6118 MapWindowPoints(s_textArea, s_hwnd, &p, 1); | |
6119 global_ime_set_position(&p); | |
6120 } | |
6121 | |
6122 /* | |
6123 * Set IM status on ("active" is TRUE) or off ("active" is FALSE). | |
6124 */ | |
6125 void | |
6126 im_set_active(int active) | |
6127 { | |
6128 global_ime_set_status(active); | |
6129 } | |
6130 | |
6131 /* | |
6132 * Get IM status. When IM is on, return not 0. Else return 0. | |
6133 */ | |
6134 int | |
7856
226ed297307f
commit https://github.com/vim/vim/commit/d14e00ea67afbaa8cb4a7e6b1eb306da6a2d5adb
Christian Brabandt <cb@256bit.org>
parents:
7823
diff
changeset
|
6135 im_get_status(void) |
7 | 6136 { |
6137 return global_ime_get_status(); | |
6138 } | |
6139 #endif | |
6140 | |
26 | 6141 #ifdef FEAT_MBYTE |
6142 /* | |
786 | 6143 * Convert latin9 text "text[len]" to ucs-2 in "unicodebuf". |
26 | 6144 */ |
6145 static void | |
6146 latin9_to_ucs(char_u *text, int len, WCHAR *unicodebuf) | |
6147 { | |
6148 int c; | |
6149 | |
777 | 6150 while (--len >= 0) |
26 | 6151 { |
6152 c = *text++; | |
6153 switch (c) | |
6154 { | |
6155 case 0xa4: c = 0x20ac; break; /* euro */ | |
6156 case 0xa6: c = 0x0160; break; /* S hat */ | |
6157 case 0xa8: c = 0x0161; break; /* S -hat */ | |
6158 case 0xb4: c = 0x017d; break; /* Z hat */ | |
6159 case 0xb8: c = 0x017e; break; /* Z -hat */ | |
6160 case 0xbc: c = 0x0152; break; /* OE */ | |
6161 case 0xbd: c = 0x0153; break; /* oe */ | |
6162 case 0xbe: c = 0x0178; break; /* Y */ | |
6163 } | |
6164 *unicodebuf++ = c; | |
6165 } | |
6166 } | |
6167 #endif | |
7 | 6168 |
6169 #ifdef FEAT_RIGHTLEFT | |
6170 /* | |
6171 * What is this for? In the case where you are using Win98 or Win2K or later, | |
6172 * and you are using a Hebrew font (or Arabic!), Windows does you a favor and | |
6173 * reverses the string sent to the TextOut... family. This sucks, because we | |
6174 * go to a lot of effort to do the right thing, and there doesn't seem to be a | |
6175 * way to tell Windblows not to do this! | |
6176 * | |
6177 * The short of it is that this 'RevOut' only gets called if you are running | |
6178 * one of the new, "improved" MS OSes, and only if you are running in | |
6179 * 'rightleft' mode. It makes display take *slightly* longer, but not | |
6180 * noticeably so. | |
6181 */ | |
6182 static void | |
6183 RevOut( HDC s_hdc, | |
6184 int col, | |
6185 int row, | |
6186 UINT foptions, | |
6187 CONST RECT *pcliprect, | |
6188 LPCTSTR text, | |
6189 UINT len, | |
6190 CONST INT *padding) | |
6191 { | |
6192 int ix; | |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6193 |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6194 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
|
6195 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
|
6196 pcliprect, text + ix, 1, padding); |
7 | 6197 } |
6198 #endif | |
6199 | |
12986
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
6200 static void |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
6201 draw_line( |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
6202 int x1, |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
6203 int y1, |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
6204 int x2, |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
6205 int y2, |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
6206 COLORREF color) |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
6207 { |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
6208 #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
|
6209 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
|
6210 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
|
6211 else |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
6212 #endif |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
6213 { |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
6214 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
|
6215 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
|
6216 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
|
6217 /* 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
|
6218 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
|
6219 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
|
6220 } |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
6221 } |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
6222 |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
6223 static void |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
6224 set_pixel( |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
6225 int x, |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
6226 int y, |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
6227 COLORREF color) |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
6228 { |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
6229 #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
|
6230 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
|
6231 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
|
6232 else |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
6233 #endif |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
6234 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
|
6235 } |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
6236 |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
6237 static void |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
6238 fill_rect( |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
6239 const RECT *rcp, |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
6240 HBRUSH hbr, |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
6241 COLORREF color) |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
6242 { |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
6243 #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
|
6244 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
|
6245 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
|
6246 else |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
6247 #endif |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
6248 { |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
6249 HBRUSH hbr2; |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
6250 |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
6251 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
|
6252 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
|
6253 else |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
6254 hbr2 = hbr; |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
6255 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
|
6256 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
|
6257 DeleteBrush(hbr2); |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
6258 } |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
6259 } |
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
6260 |
7 | 6261 void |
6262 gui_mch_draw_string( | |
6263 int row, | |
6264 int col, | |
6265 char_u *text, | |
6266 int len, | |
6267 int flags) | |
6268 { | |
6269 static int *padding = NULL; | |
6270 static int pad_size = 0; | |
6271 int i; | |
6272 const RECT *pcliprect = NULL; | |
6273 UINT foptions = 0; | |
6274 #ifdef FEAT_MBYTE | |
6275 static WCHAR *unicodebuf = NULL; | |
6276 static int *unicodepdy = NULL; | |
236 | 6277 static int unibuflen = 0; |
7 | 6278 int n = 0; |
6279 #endif | |
6280 int y; | |
6281 | |
6282 /* | |
6283 * Italic and bold text seems to have an extra row of pixels at the bottom | |
6284 * (below where the bottom of the character should be). If we draw the | |
6285 * characters with a solid background, the top row of pixels in the | |
6286 * character below will be overwritten. We can fix this by filling in the | |
6287 * background ourselves, to the correct character proportions, and then | |
6288 * writing the character in transparent mode. Still have a problem when | |
6289 * the character is "_", which gets written on to the character below. | |
6290 * New fix: set gui.char_ascent to -1. This shifts all characters up one | |
6291 * pixel in their slots, which fixes the problem with the bottom row of | |
6292 * pixels. We still need this code because otherwise the top row of pixels | |
6293 * becomes a problem. - webb. | |
6294 */ | |
6295 static HBRUSH hbr_cache[2] = {NULL, NULL}; | |
6296 static guicolor_T brush_color[2] = {INVALCOLOR, INVALCOLOR}; | |
6297 static int brush_lru = 0; | |
6298 HBRUSH hbr; | |
6299 RECT rc; | |
6300 | |
6301 if (!(flags & DRAW_TRANSP)) | |
6302 { | |
6303 /* | |
6304 * Clear background first. | |
6305 * Note: FillRect() excludes right and bottom of rectangle. | |
6306 */ | |
6307 rc.left = FILL_X(col); | |
6308 rc.top = FILL_Y(row); | |
6309 #ifdef FEAT_MBYTE | |
6310 if (has_mbyte) | |
6311 { | |
6312 /* Compute the length in display cells. */ | |
2338
da6ec32d8d8f
Added strwidth() and strchars() functions.
Bram Moolenaar <bram@vim.org>
parents:
2311
diff
changeset
|
6313 rc.right = FILL_X(col + mb_string2cells(text, len)); |
7 | 6314 } |
6315 else | |
6316 #endif | |
6317 rc.right = FILL_X(col + len); | |
6318 rc.bottom = FILL_Y(row + 1); | |
6319 | |
6320 /* Cache the created brush, that saves a lot of time. We need two: | |
6321 * one for cursor background and one for the normal background. */ | |
6322 if (gui.currBgColor == brush_color[0]) | |
6323 { | |
6324 hbr = hbr_cache[0]; | |
6325 brush_lru = 1; | |
6326 } | |
6327 else if (gui.currBgColor == brush_color[1]) | |
6328 { | |
6329 hbr = hbr_cache[1]; | |
6330 brush_lru = 0; | |
6331 } | |
6332 else | |
6333 { | |
6334 if (hbr_cache[brush_lru] != NULL) | |
6335 DeleteBrush(hbr_cache[brush_lru]); | |
6336 hbr_cache[brush_lru] = CreateSolidBrush(gui.currBgColor); | |
6337 brush_color[brush_lru] = gui.currBgColor; | |
6338 hbr = hbr_cache[brush_lru]; | |
6339 brush_lru = !brush_lru; | |
6340 } | |
12934
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
6341 |
12986
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
6342 fill_rect(&rc, hbr, gui.currBgColor); |
7 | 6343 |
6344 SetBkMode(s_hdc, TRANSPARENT); | |
6345 | |
6346 /* | |
6347 * When drawing block cursor, prevent inverted character spilling | |
6348 * over character cell (can happen with bold/italic) | |
6349 */ | |
6350 if (flags & DRAW_CURSOR) | |
6351 { | |
6352 pcliprect = &rc; | |
6353 foptions = ETO_CLIPPED; | |
6354 } | |
6355 } | |
6356 SetTextColor(s_hdc, gui.currFgColor); | |
6357 SelectFont(s_hdc, gui.currFont); | |
6358 | |
6110 | 6359 #ifdef FEAT_DIRECTX |
6360 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
|
6361 DWriteContext_SetFont(s_dwc, (HFONT)gui.currFont); |
6110 | 6362 #endif |
6363 | |
7 | 6364 if (pad_size != Columns || padding == NULL || padding[0] != gui.char_width) |
6365 { | |
6366 vim_free(padding); | |
6367 pad_size = Columns; | |
6368 | |
537 | 6369 /* Don't give an out-of-memory message here, it would call us |
6370 * recursively. */ | |
6371 padding = (int *)lalloc(pad_size * sizeof(int), FALSE); | |
7 | 6372 if (padding != NULL) |
6373 for (i = 0; i < pad_size; i++) | |
6374 padding[i] = gui.char_width; | |
6375 } | |
6376 | |
6377 /* | |
6378 * We have to provide the padding argument because italic and bold versions | |
6379 * of fixed-width fonts are often one pixel or so wider than their normal | |
6380 * versions. | |
6381 * No check for DRAW_BOLD, Windows will have done it already. | |
6382 */ | |
6383 | |
6384 #ifdef FEAT_MBYTE | |
6385 /* Check if there are any UTF-8 characters. If not, use normal text | |
6386 * output to speed up output. */ | |
6387 if (enc_utf8) | |
6388 for (n = 0; n < len; ++n) | |
6389 if (text[n] >= 0x80) | |
6390 break; | |
6391 | |
13028
cfce9ac1d1e8
patch 8.0.1390: DirectX scrolling can be slow, vertical positioning is off
Christian Brabandt <cb@256bit.org>
parents:
12994
diff
changeset
|
6392 # if defined(FEAT_DIRECTX) |
6110 | 6393 /* Quick hack to enable DirectWrite. To use DirectWrite (antialias), it is |
6394 * required that unicode drawing routine, currently. So this forces it | |
6395 * 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
|
6396 if (IS_ENABLE_DIRECTX()) |
6110 | 6397 n = 0; /* Keep n < len, to enter block for unicode. */ |
13028
cfce9ac1d1e8
patch 8.0.1390: DirectX scrolling can be slow, vertical positioning is off
Christian Brabandt <cb@256bit.org>
parents:
12994
diff
changeset
|
6398 # endif |
6110 | 6399 |
7 | 6400 /* Check if the Unicode buffer exists and is big enough. Create it |
236 | 6401 * with the same length as the multi-byte string, the number of wide |
7 | 6402 * characters is always equal or smaller. */ |
26 | 6403 if ((enc_utf8 |
6404 || (enc_codepage > 0 && (int)GetACP() != enc_codepage) | |
6405 || enc_latin9) | |
7 | 6406 && (unicodebuf == NULL || len > unibuflen)) |
6407 { | |
6408 vim_free(unicodebuf); | |
537 | 6409 unicodebuf = (WCHAR *)lalloc(len * sizeof(WCHAR), FALSE); |
7 | 6410 |
6411 vim_free(unicodepdy); | |
537 | 6412 unicodepdy = (int *)lalloc(len * sizeof(int), FALSE); |
7 | 6413 |
6414 unibuflen = len; | |
6415 } | |
6416 | |
6417 if (enc_utf8 && n < len && unicodebuf != NULL) | |
6418 { | |
12712
25f7d8ee04c7
patch 8.0.1234: MS-Windows: composing chars are not shown properly
Christian Brabandt <cb@256bit.org>
parents:
12668
diff
changeset
|
6419 /* 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
|
6420 * handled here. */ |
777 | 6421 int i; |
6422 int wlen; /* string length in words */ | |
6423 int clen; /* string length in characters */ | |
7 | 6424 int cells; /* cell width of string up to composing char */ |
6425 int cw; /* width of current cell */ | |
714 | 6426 int c; |
777 | 6427 |
782 | 6428 wlen = 0; |
777 | 6429 clen = 0; |
7 | 6430 cells = 0; |
777 | 6431 for (i = 0; i < len; ) |
7 | 6432 { |
714 | 6433 c = utf_ptr2char(text + i); |
6434 if (c >= 0x10000) | |
6435 { | |
6436 /* Turn into UTF-16 encoding. */ | |
777 | 6437 unicodebuf[wlen++] = ((c - 0x10000) >> 10) + 0xD800; |
6438 unicodebuf[wlen++] = ((c - 0x10000) & 0x3ff) + 0xDC00; | |
714 | 6439 } |
6440 else | |
6441 { | |
777 | 6442 unicodebuf[wlen++] = c; |
714 | 6443 } |
12712
25f7d8ee04c7
patch 8.0.1234: MS-Windows: composing chars are not shown properly
Christian Brabandt <cb@256bit.org>
parents:
12668
diff
changeset
|
6444 |
25f7d8ee04c7
patch 8.0.1234: MS-Windows: composing chars are not shown properly
Christian Brabandt <cb@256bit.org>
parents:
12668
diff
changeset
|
6445 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
|
6446 cw = 0; |
25f7d8ee04c7
patch 8.0.1234: MS-Windows: composing chars are not shown properly
Christian Brabandt <cb@256bit.org>
parents:
12668
diff
changeset
|
6447 else |
25f7d8ee04c7
patch 8.0.1234: MS-Windows: composing chars are not shown properly
Christian Brabandt <cb@256bit.org>
parents:
12668
diff
changeset
|
6448 { |
25f7d8ee04c7
patch 8.0.1234: MS-Windows: composing chars are not shown properly
Christian Brabandt <cb@256bit.org>
parents:
12668
diff
changeset
|
6449 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
|
6450 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
|
6451 cw = 1; |
25f7d8ee04c7
patch 8.0.1234: MS-Windows: composing chars are not shown properly
Christian Brabandt <cb@256bit.org>
parents:
12668
diff
changeset
|
6452 } |
25f7d8ee04c7
patch 8.0.1234: MS-Windows: composing chars are not shown properly
Christian Brabandt <cb@256bit.org>
parents:
12668
diff
changeset
|
6453 |
7 | 6454 if (unicodepdy != NULL) |
6455 { | |
6456 /* Use unicodepdy to make characters fit as we expect, even | |
6457 * when the font uses different widths (e.g., bold character | |
6458 * is wider). */ | |
8273
0c3210caefa6
commit https://github.com/vim/vim/commit/d804fdf4c25435284333258856bc265f1ff10b09
Christian Brabandt <cb@256bit.org>
parents:
8222
diff
changeset
|
6459 if (c >= 0x10000) |
0c3210caefa6
commit https://github.com/vim/vim/commit/d804fdf4c25435284333258856bc265f1ff10b09
Christian Brabandt <cb@256bit.org>
parents:
8222
diff
changeset
|
6460 { |
0c3210caefa6
commit https://github.com/vim/vim/commit/d804fdf4c25435284333258856bc265f1ff10b09
Christian Brabandt <cb@256bit.org>
parents:
8222
diff
changeset
|
6461 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
|
6462 unicodepdy[wlen - 1] = 0; |
0c3210caefa6
commit https://github.com/vim/vim/commit/d804fdf4c25435284333258856bc265f1ff10b09
Christian Brabandt <cb@256bit.org>
parents:
8222
diff
changeset
|
6463 } |
0c3210caefa6
commit https://github.com/vim/vim/commit/d804fdf4c25435284333258856bc265f1ff10b09
Christian Brabandt <cb@256bit.org>
parents:
8222
diff
changeset
|
6464 else |
0c3210caefa6
commit https://github.com/vim/vim/commit/d804fdf4c25435284333258856bc265f1ff10b09
Christian Brabandt <cb@256bit.org>
parents:
8222
diff
changeset
|
6465 unicodepdy[wlen - 1] = cw * gui.char_width; |
7 | 6466 } |
6467 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
|
6468 i += utf_ptr2len_len(text + i, len - i); |
777 | 6469 ++clen; |
7 | 6470 } |
13028
cfce9ac1d1e8
patch 8.0.1390: DirectX scrolling can be slow, vertical positioning is off
Christian Brabandt <cb@256bit.org>
parents:
12994
diff
changeset
|
6471 # 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
|
6472 if (IS_ENABLE_DIRECTX()) |
6110 | 6473 { |
6112 | 6474 /* 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
|
6475 DWriteContext_DrawText(s_dwc, unicodebuf, wlen, |
6112 | 6476 TEXT_X(col), TEXT_Y(row), FILL_X(cells + 1), FILL_Y(1), |
12934
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
6477 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
|
6478 foptions, pcliprect, unicodepdy); |
6110 | 6479 } |
6480 else | |
13028
cfce9ac1d1e8
patch 8.0.1390: DirectX scrolling can be slow, vertical positioning is off
Christian Brabandt <cb@256bit.org>
parents:
12994
diff
changeset
|
6481 # endif |
6110 | 6482 ExtTextOutW(s_hdc, TEXT_X(col), TEXT_Y(row), |
6483 foptions, pcliprect, unicodebuf, wlen, unicodepdy); | |
7 | 6484 len = cells; /* used for underlining */ |
6485 } | |
26 | 6486 else if ((enc_codepage > 0 && (int)GetACP() != enc_codepage) || enc_latin9) |
7 | 6487 { |
6488 /* If we want to display codepage data, and the current CP is not the | |
6489 * ANSI one, we need to go via Unicode. */ | |
6490 if (unicodebuf != NULL) | |
6491 { | |
26 | 6492 if (enc_latin9) |
6493 latin9_to_ucs(text, len, unicodebuf); | |
6494 else | |
6495 len = MultiByteToWideChar(enc_codepage, | |
7 | 6496 MB_PRECOMPOSED, |
6497 (char *)text, len, | |
6498 (LPWSTR)unicodebuf, unibuflen); | |
6499 if (len != 0) | |
179 | 6500 { |
6501 /* Use unicodepdy to make characters fit as we expect, even | |
6502 * when the font uses different widths (e.g., bold character | |
6503 * is wider). */ | |
6504 if (unicodepdy != NULL) | |
6505 { | |
6506 int i; | |
6507 int cw; | |
6508 | |
6509 for (i = 0; i < len; ++i) | |
6510 { | |
6511 cw = utf_char2cells(unicodebuf[i]); | |
6512 if (cw > 2) | |
6513 cw = 1; | |
6514 unicodepdy[i] = cw * gui.char_width; | |
6515 } | |
6516 } | |
7 | 6517 ExtTextOutW(s_hdc, TEXT_X(col), TEXT_Y(row), |
179 | 6518 foptions, pcliprect, unicodebuf, len, unicodepdy); |
6519 } | |
7 | 6520 } |
6521 } | |
6522 else | |
6523 #endif | |
6524 { | |
6525 #ifdef FEAT_RIGHTLEFT | |
6226 | 6526 /* Windows will mess up RL text, so we have to draw it character by |
6527 * character. Only do this if RL is on, since it's slow. */ | |
6528 if (curwin->w_p_rl) | |
7 | 6529 RevOut(s_hdc, TEXT_X(col), TEXT_Y(row), |
6530 foptions, pcliprect, (char *)text, len, padding); | |
6531 else | |
6532 #endif | |
6533 ExtTextOut(s_hdc, TEXT_X(col), TEXT_Y(row), | |
6534 foptions, pcliprect, (char *)text, len, padding); | |
6535 } | |
6536 | |
205 | 6537 /* Underline */ |
7 | 6538 if (flags & DRAW_UNDERL) |
6539 { | |
6540 /* When p_linespace is 0, overwrite the bottom row of pixels. | |
6541 * Otherwise put the line just below the character. */ | |
6542 y = FILL_Y(row + 1) - 1; | |
6543 if (p_linespace > 1) | |
6544 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
|
6545 draw_line(FILL_X(col), y, FILL_X(col + len), y, gui.currFgColor); |
7 | 6546 } |
205 | 6547 |
12317
2a8890b80923
patch 8.0.1038: strike-through text not supported
Christian Brabandt <cb@256bit.org>
parents:
12090
diff
changeset
|
6548 /* Strikethrough */ |
2a8890b80923
patch 8.0.1038: strike-through text not supported
Christian Brabandt <cb@256bit.org>
parents:
12090
diff
changeset
|
6549 if (flags & DRAW_STRIKE) |
2a8890b80923
patch 8.0.1038: strike-through text not supported
Christian Brabandt <cb@256bit.org>
parents:
12090
diff
changeset
|
6550 { |
2a8890b80923
patch 8.0.1038: strike-through text not supported
Christian Brabandt <cb@256bit.org>
parents:
12090
diff
changeset
|
6551 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
|
6552 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
|
6553 } |
2a8890b80923
patch 8.0.1038: strike-through text not supported
Christian Brabandt <cb@256bit.org>
parents:
12090
diff
changeset
|
6554 |
205 | 6555 /* Undercurl */ |
6556 if (flags & DRAW_UNDERC) | |
6557 { | |
6558 int x; | |
6559 int offset; | |
323 | 6560 static const int val[8] = {1, 0, 0, 0, 1, 2, 2, 2 }; |
205 | 6561 |
6562 y = FILL_Y(row + 1) - 1; | |
6563 for (x = FILL_X(col); x < FILL_X(col + len); ++x) | |
6564 { | |
6565 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
|
6566 set_pixel(x, y - offset, gui.currSpColor); |
205 | 6567 } |
6568 } | |
7 | 6569 } |
6570 | |
6571 | |
6572 /* | |
6573 * Output routines. | |
6574 */ | |
6575 | |
6576 /* Flush any output to the screen */ | |
6577 void | |
6578 gui_mch_flush(void) | |
6579 { | |
6580 # if defined(__BORLANDC__) | |
6581 /* | |
6582 * The GdiFlush declaration (in Borland C 5.01 <wingdi.h>) is not a | |
6583 * prototype declaration. | |
6584 * The compiler complains if __stdcall is not used in both declarations. | |
6585 */ | |
6586 BOOL __stdcall GdiFlush(void); | |
6587 # endif | |
6588 | |
12934
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
6589 #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
|
6590 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
|
6591 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
|
6592 #endif |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
6593 |
7 | 6594 GdiFlush(); |
6595 } | |
6596 | |
6597 static void | |
6598 clear_rect(RECT *rcp) | |
6599 { | |
12986
18e6f4addce9
patch 8.0.1369: MS-Windows: drawing underline slow, mFallbackDC not updated
Christian Brabandt <cb@256bit.org>
parents:
12950
diff
changeset
|
6600 fill_rect(rcp, NULL, gui.back_pixel); |
7 | 6601 } |
6602 | |
6603 | |
636 | 6604 void |
6605 gui_mch_get_screen_dimensions(int *screen_w, int *screen_h) | |
6606 { | |
6607 RECT workarea_rect; | |
6608 | |
6609 get_work_area(&workarea_rect); | |
6610 | |
819 | 6611 *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
|
6612 - (GetSystemMetrics(SM_CXFRAME) + |
6110 | 6613 GetSystemMetrics(SM_CXPADDEDBORDER)) * 2; |
636 | 6614 |
6615 /* FIXME: dirty trick: Because the gui_get_base_height() doesn't include | |
6616 * the menubar for MSwin, we subtract it from the screen height, so that | |
6617 * the window size can be made to fit on the screen. */ | |
819 | 6618 *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
|
6619 - (GetSystemMetrics(SM_CYFRAME) + |
6110 | 6620 GetSystemMetrics(SM_CXPADDEDBORDER)) * 2 |
636 | 6621 - GetSystemMetrics(SM_CYCAPTION) |
6622 #ifdef FEAT_MENU | |
856 | 6623 - gui_mswin_get_menu_height(FALSE) |
636 | 6624 #endif |
856 | 6625 ; |
636 | 6626 } |
6627 | |
6628 | |
7 | 6629 #if defined(FEAT_MENU) || defined(PROTO) |
6630 /* | |
6631 * Add a sub menu to the menu bar. | |
6632 */ | |
6633 void | |
6634 gui_mch_add_menu( | |
6635 vimmenu_T *menu, | |
6636 int pos) | |
6637 { | |
6638 vimmenu_T *parent = menu->parent; | |
6639 | |
6640 menu->submenu_id = CreatePopupMenu(); | |
6641 menu->id = s_menu_id++; | |
6642 | |
6643 if (menu_is_menubar(menu->name)) | |
6644 { | |
6645 #ifdef FEAT_MBYTE | |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6646 WCHAR *wn = NULL; |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6647 |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6648 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6649 { |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6650 /* 'encoding' differs from active codepage: convert menu name |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6651 * and use wide function */ |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6652 wn = enc_to_utf16(menu->name, NULL); |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6653 if (wn != NULL) |
7 | 6654 { |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6655 MENUITEMINFOW infow; |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6656 |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6657 infow.cbSize = sizeof(infow); |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6658 infow.fMask = MIIM_DATA | MIIM_TYPE | MIIM_ID |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6659 | MIIM_SUBMENU; |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6660 infow.dwItemData = (long_u)menu; |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6661 infow.wID = menu->id; |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6662 infow.fType = MFT_STRING; |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6663 infow.dwTypeData = wn; |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6664 infow.cch = (UINT)wcslen(wn); |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6665 infow.hSubMenu = menu->submenu_id; |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6666 InsertMenuItemW((parent == NULL) |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6667 ? s_menuBar : parent->submenu_id, |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6668 (UINT)pos, TRUE, &infow); |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6669 vim_free(wn); |
7 | 6670 } |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6671 } |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6672 |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6673 if (wn == NULL) |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6674 #endif |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6675 { |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6676 MENUITEMINFO info; |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6677 |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6678 info.cbSize = sizeof(info); |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6679 info.fMask = MIIM_DATA | MIIM_TYPE | MIIM_ID | MIIM_SUBMENU; |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6680 info.dwItemData = (long_u)menu; |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6681 info.wID = menu->id; |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6682 info.fType = MFT_STRING; |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6683 info.dwTypeData = (LPTSTR)menu->name; |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6684 info.cch = (UINT)STRLEN(menu->name); |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6685 info.hSubMenu = menu->submenu_id; |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6686 InsertMenuItem((parent == NULL) |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6687 ? s_menuBar : parent->submenu_id, |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6688 (UINT)pos, TRUE, &info); |
7 | 6689 } |
6690 } | |
6691 | |
6692 /* Fix window size if menu may have wrapped */ | |
6693 if (parent == NULL) | |
6694 gui_mswin_get_menu_height(!gui.starting); | |
6695 #ifdef FEAT_TEAROFF | |
6696 else if (IsWindow(parent->tearoff_handle)) | |
6697 rebuild_tearoff(parent); | |
6698 #endif | |
6699 } | |
6700 | |
6701 void | |
6702 gui_mch_show_popupmenu(vimmenu_T *menu) | |
6703 { | |
6704 POINT mp; | |
6705 | |
6706 (void)GetCursorPos((LPPOINT)&mp); | |
6707 gui_mch_show_popupmenu_at(menu, (int)mp.x, (int)mp.y); | |
6708 } | |
6709 | |
6710 void | |
401 | 6711 gui_make_popup(char_u *path_name, int mouse_pos) |
7 | 6712 { |
6713 vimmenu_T *menu = gui_find_menu(path_name); | |
6714 | |
6715 if (menu != NULL) | |
6716 { | |
6717 POINT p; | |
6718 | |
6719 /* Find the position of the current cursor */ | |
6720 GetDCOrgEx(s_hdc, &p); | |
401 | 6721 if (mouse_pos) |
6722 { | |
6723 int mx, my; | |
6724 | |
6725 gui_mch_getmouse(&mx, &my); | |
6726 p.x += mx; | |
6727 p.y += my; | |
6728 } | |
6729 else if (curwin != NULL) | |
7 | 6730 { |
12513
3ca08bf99396
patch 8.0.1135: W_WINCOL() is always the same
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
6731 p.x += TEXT_X(curwin->w_wincol + curwin->w_wcol + 1); |
7 | 6732 p.y += TEXT_Y(W_WINROW(curwin) + curwin->w_wrow + 1); |
6733 } | |
6734 msg_scroll = FALSE; | |
6735 gui_mch_show_popupmenu_at(menu, (int)p.x, (int)p.y); | |
6736 } | |
6737 } | |
6738 | |
6739 #if defined(FEAT_TEAROFF) || defined(PROTO) | |
6740 /* | |
6741 * Given a menu descriptor, e.g. "File.New", find it in the menu hierarchy and | |
6742 * create it as a pseudo-"tearoff menu". | |
6743 */ | |
6744 void | |
6745 gui_make_tearoff(char_u *path_name) | |
6746 { | |
6747 vimmenu_T *menu = gui_find_menu(path_name); | |
6748 | |
6749 /* Found the menu, so tear it off. */ | |
6750 if (menu != NULL) | |
6751 gui_mch_tearoff(menu->dname, menu, 0xffffL, 0xffffL); | |
6752 } | |
6753 #endif | |
6754 | |
6755 /* | |
6756 * Add a menu item to a menu | |
6757 */ | |
6758 void | |
6759 gui_mch_add_menu_item( | |
6760 vimmenu_T *menu, | |
6761 int idx) | |
6762 { | |
6763 vimmenu_T *parent = menu->parent; | |
6764 | |
6765 menu->id = s_menu_id++; | |
6766 menu->submenu_id = NULL; | |
6767 | |
6768 #ifdef FEAT_TEAROFF | |
6769 if (STRNCMP(menu->name, TEAR_STRING, TEAR_LEN) == 0) | |
6770 { | |
6771 InsertMenu(parent->submenu_id, (UINT)idx, MF_BITMAP|MF_BYPOSITION, | |
6772 (UINT)menu->id, (LPCTSTR) s_htearbitmap); | |
6773 } | |
6774 else | |
6775 #endif | |
6776 #ifdef FEAT_TOOLBAR | |
6777 if (menu_is_toolbar(parent->name)) | |
6778 { | |
6779 TBBUTTON newtb; | |
6780 | |
6781 vim_memset(&newtb, 0, sizeof(newtb)); | |
6782 if (menu_is_separator(menu->name)) | |
6783 { | |
6784 newtb.iBitmap = 0; | |
6785 newtb.fsStyle = TBSTYLE_SEP; | |
6786 } | |
6787 else | |
6788 { | |
6789 newtb.iBitmap = get_toolbar_bitmap(menu); | |
6790 newtb.fsStyle = TBSTYLE_BUTTON; | |
6791 } | |
6792 newtb.idCommand = menu->id; | |
6793 newtb.fsState = TBSTATE_ENABLED; | |
6794 newtb.iString = 0; | |
6795 SendMessage(s_toolbarhwnd, TB_INSERTBUTTON, (WPARAM)idx, | |
6796 (LPARAM)&newtb); | |
6797 menu->submenu_id = (HMENU)-1; | |
6798 } | |
6799 else | |
6800 #endif | |
6801 { | |
6802 #ifdef FEAT_MBYTE | |
6803 WCHAR *wn = NULL; | |
6804 | |
6805 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) | |
6806 { | |
6807 /* 'encoding' differs from active codepage: convert menu item name | |
6808 * and use wide function */ | |
1752 | 6809 wn = enc_to_utf16(menu->name, NULL); |
7 | 6810 if (wn != NULL) |
6811 { | |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
6812 InsertMenuW(parent->submenu_id, (UINT)idx, |
7 | 6813 (menu_is_separator(menu->name) |
6814 ? MF_SEPARATOR : MF_STRING) | MF_BYPOSITION, | |
6815 (UINT)menu->id, wn); | |
6816 vim_free(wn); | |
6817 } | |
6818 } | |
6819 if (wn == NULL) | |
6820 #endif | |
6821 InsertMenu(parent->submenu_id, (UINT)idx, | |
6822 (menu_is_separator(menu->name) ? MF_SEPARATOR : MF_STRING) | |
6823 | MF_BYPOSITION, | |
6824 (UINT)menu->id, (LPCTSTR)menu->name); | |
6825 #ifdef FEAT_TEAROFF | |
6826 if (IsWindow(parent->tearoff_handle)) | |
6827 rebuild_tearoff(parent); | |
6828 #endif | |
6829 } | |
6830 } | |
6831 | |
6832 /* | |
6833 * Destroy the machine specific menu widget. | |
6834 */ | |
6835 void | |
6836 gui_mch_destroy_menu(vimmenu_T *menu) | |
6837 { | |
6838 #ifdef FEAT_TOOLBAR | |
6839 /* | |
6840 * is this a toolbar button? | |
6841 */ | |
6842 if (menu->submenu_id == (HMENU)-1) | |
6843 { | |
6844 int iButton; | |
6845 | |
6846 iButton = (int)SendMessage(s_toolbarhwnd, TB_COMMANDTOINDEX, | |
6847 (WPARAM)menu->id, 0); | |
6848 SendMessage(s_toolbarhwnd, TB_DELETEBUTTON, (WPARAM)iButton, 0); | |
6849 } | |
6850 else | |
6851 #endif | |
6852 { | |
6853 if (menu->parent != NULL | |
6854 && menu_is_popup(menu->parent->dname) | |
6855 && menu->parent->submenu_id != NULL) | |
6856 RemoveMenu(menu->parent->submenu_id, menu->id, MF_BYCOMMAND); | |
6857 else | |
6858 RemoveMenu(s_menuBar, menu->id, MF_BYCOMMAND); | |
6859 if (menu->submenu_id != NULL) | |
6860 DestroyMenu(menu->submenu_id); | |
6861 #ifdef FEAT_TEAROFF | |
6862 if (IsWindow(menu->tearoff_handle)) | |
6863 DestroyWindow(menu->tearoff_handle); | |
6864 if (menu->parent != NULL | |
6865 && menu->parent->children != NULL | |
6866 && IsWindow(menu->parent->tearoff_handle)) | |
6867 { | |
6868 /* This menu must not show up when rebuilding the tearoff window. */ | |
6869 menu->modes = 0; | |
6870 rebuild_tearoff(menu->parent); | |
6871 } | |
6872 #endif | |
6873 } | |
6874 } | |
6875 | |
6876 #ifdef FEAT_TEAROFF | |
6877 static void | |
6878 rebuild_tearoff(vimmenu_T *menu) | |
6879 { | |
6880 /*hackish*/ | |
6881 char_u tbuf[128]; | |
6882 RECT trect; | |
6883 RECT rct; | |
6884 RECT roct; | |
6885 int x, y; | |
6886 | |
6887 HWND thwnd = menu->tearoff_handle; | |
6888 | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
6889 GetWindowText(thwnd, (LPSTR)tbuf, 127); |
7 | 6890 if (GetWindowRect(thwnd, &trect) |
6891 && GetWindowRect(s_hwnd, &rct) | |
6892 && GetClientRect(s_hwnd, &roct)) | |
6893 { | |
6894 x = trect.left - rct.left; | |
6895 y = (trect.top - rct.bottom + roct.bottom); | |
6896 } | |
6897 else | |
6898 { | |
6899 x = y = 0xffffL; | |
6900 } | |
6901 DestroyWindow(thwnd); | |
6902 if (menu->children != NULL) | |
6903 { | |
6904 gui_mch_tearoff(tbuf, menu, x, y); | |
6905 if (IsWindow(menu->tearoff_handle)) | |
6906 (void) SetWindowPos(menu->tearoff_handle, | |
6907 NULL, | |
6908 (int)trect.left, | |
6909 (int)trect.top, | |
6910 0, 0, | |
6911 SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); | |
6912 } | |
6913 } | |
6914 #endif /* FEAT_TEAROFF */ | |
6915 | |
6916 /* | |
6917 * Make a menu either grey or not grey. | |
6918 */ | |
6919 void | |
6920 gui_mch_menu_grey( | |
6921 vimmenu_T *menu, | |
6922 int grey) | |
6923 { | |
6924 #ifdef FEAT_TOOLBAR | |
6925 /* | |
6926 * is this a toolbar button? | |
6927 */ | |
6928 if (menu->submenu_id == (HMENU)-1) | |
6929 { | |
6930 SendMessage(s_toolbarhwnd, TB_ENABLEBUTTON, | |
6931 (WPARAM)menu->id, (LPARAM) MAKELONG((grey ? FALSE : TRUE), 0) ); | |
6932 } | |
6933 else | |
6934 #endif | |
9236
9940e9b2a725
commit https://github.com/vim/vim/commit/762f1754370a1278167c8cba6c047ef319fc099c
Christian Brabandt <cb@256bit.org>
parents:
9213
diff
changeset
|
6935 (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
|
6936 menu->id, MF_BYCOMMAND | (grey ? MF_GRAYED : MF_ENABLED)); |
7 | 6937 |
6938 #ifdef FEAT_TEAROFF | |
6939 if ((menu->parent != NULL) && (IsWindow(menu->parent->tearoff_handle))) | |
6940 { | |
6941 WORD menuID; | |
6942 HWND menuHandle; | |
6943 | |
6944 /* | |
6945 * A tearoff button has changed state. | |
6946 */ | |
6947 if (menu->children == NULL) | |
6948 menuID = (WORD)(menu->id); | |
6949 else | |
840 | 6950 menuID = (WORD)((long_u)(menu->submenu_id) | (DWORD)0x8000); |
7 | 6951 menuHandle = GetDlgItem(menu->parent->tearoff_handle, menuID); |
6952 if (menuHandle) | |
6953 EnableWindow(menuHandle, !grey); | |
6954 | |
6955 } | |
6956 #endif | |
6957 } | |
6958 | |
6959 #endif /* FEAT_MENU */ | |
6960 | |
6961 | |
6962 /* define some macros used to make the dialogue creation more readable */ | |
6963 | |
6964 #define add_string(s) strcpy((LPSTR)p, s); (LPSTR)p += (strlen((LPSTR)p) + 1) | |
6965 #define add_word(x) *p++ = (x) | |
615 | 6966 #define add_long(x) dwp = (DWORD *)p; *dwp++ = (x); p = (WORD *)dwp |
7 | 6967 |
6968 #if defined(FEAT_GUI_DIALOG) || defined(PROTO) | |
6969 /* | |
6970 * stuff for dialogs | |
6971 */ | |
6972 | |
6973 /* | |
6974 * The callback routine used by all the dialogs. Very simple. First, | |
6975 * acknowledges the INITDIALOG message so that Windows knows to do standard | |
6976 * dialog stuff (Return = default, Esc = cancel....) Second, if a button is | |
6977 * pressed, return that button's ID - IDCANCEL (2), which is the button's | |
6978 * number. | |
6979 */ | |
6980 static LRESULT CALLBACK | |
6981 dialog_callback( | |
6982 HWND hwnd, | |
6983 UINT message, | |
6984 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
|
6985 LPARAM lParam UNUSED) |
7 | 6986 { |
6987 if (message == WM_INITDIALOG) | |
6988 { | |
6989 CenterWindow(hwnd, GetWindow(hwnd, GW_OWNER)); | |
6990 /* Set focus to the dialog. Set the default button, if specified. */ | |
6991 (void)SetFocus(hwnd); | |
6992 if (dialog_default_button > IDCANCEL) | |
6993 (void)SetFocus(GetDlgItem(hwnd, dialog_default_button)); | |
1356 | 6994 else |
6995 /* We don't have a default, set focus on another element of the | |
6996 * dialog window, probably the icon */ | |
6997 (void)SetFocus(GetDlgItem(hwnd, DLG_NONBUTTON_CONTROL)); | |
7 | 6998 return FALSE; |
6999 } | |
7000 | |
7001 if (message == WM_COMMAND) | |
7002 { | |
7003 int button = LOWORD(wParam); | |
7004 | |
7005 /* Don't end the dialog if something was selected that was | |
7006 * not a button. | |
7007 */ | |
7008 if (button >= DLG_NONBUTTON_CONTROL) | |
7009 return TRUE; | |
7010 | |
7011 /* If the edit box exists, copy the string. */ | |
7012 if (s_textfield != NULL) | |
1795 | 7013 { |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7014 # ifdef FEAT_MBYTE |
1795 | 7015 /* If the OS is Windows NT, and 'encoding' differs from active |
7016 * codepage: use wide function and convert text. */ | |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7017 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) |
2311
ccda151dde4e
Support completion for ":find". (Nazri Ramliy)
Bram Moolenaar <bram@vim.org>
parents:
2224
diff
changeset
|
7018 { |
1795 | 7019 WCHAR *wp = (WCHAR *)alloc(IOSIZE * sizeof(WCHAR)); |
7020 char_u *p; | |
7021 | |
7022 GetDlgItemTextW(hwnd, DLG_NONBUTTON_CONTROL + 2, wp, IOSIZE); | |
7023 p = utf16_to_enc(wp, NULL); | |
7024 vim_strncpy(s_textfield, p, IOSIZE); | |
7025 vim_free(p); | |
7026 vim_free(wp); | |
7027 } | |
7028 else | |
7029 # endif | |
7030 GetDlgItemText(hwnd, DLG_NONBUTTON_CONTROL + 2, | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
7031 (LPSTR)s_textfield, IOSIZE); |
1795 | 7032 } |
7 | 7033 |
7034 /* | |
7035 * Need to check for IDOK because if the user just hits Return to | |
7036 * accept the default value, some reason this is what we get. | |
7037 */ | |
7038 if (button == IDOK) | |
7039 { | |
7040 if (dialog_default_button > IDCANCEL) | |
7041 EndDialog(hwnd, dialog_default_button); | |
7042 } | |
7043 else | |
7044 EndDialog(hwnd, button - IDCANCEL); | |
7045 return TRUE; | |
7046 } | |
7047 | |
7048 if ((message == WM_SYSCOMMAND) && (wParam == SC_CLOSE)) | |
7049 { | |
7050 EndDialog(hwnd, 0); | |
7051 return TRUE; | |
7052 } | |
7053 return FALSE; | |
7054 } | |
7055 | |
7056 /* | |
7057 * Create a dialog dynamically from the parameter strings. | |
7058 * type = type of dialog (question, alert, etc.) | |
7059 * title = dialog title. may be NULL for default title. | |
7060 * message = text to display. Dialog sizes to accommodate it. | |
7061 * buttons = '\n' separated list of button captions, default first. | |
7062 * dfltbutton = number of default button. | |
7063 * | |
7064 * This routine returns 1 if the first button is pressed, | |
7065 * 2 for the second, etc. | |
7066 * | |
7067 * 0 indicates Esc was pressed. | |
7068 * -1 for unexpected error | |
7069 * | |
7070 * If stubbing out this fn, return 1. | |
7071 */ | |
7072 | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
7073 static const char *dlg_icons[] = /* must match names in resource file */ |
7 | 7074 { |
7075 "IDR_VIM", | |
7076 "IDR_VIM_ERROR", | |
7077 "IDR_VIM_ALERT", | |
7078 "IDR_VIM_INFO", | |
7079 "IDR_VIM_QUESTION" | |
7080 }; | |
7081 | |
7082 int | |
7083 gui_mch_dialog( | |
7084 int type, | |
7085 char_u *title, | |
7086 char_u *message, | |
7087 char_u *buttons, | |
7088 int dfltbutton, | |
2684 | 7089 char_u *textfield, |
7090 int ex_cmd) | |
7 | 7091 { |
7092 WORD *p, *pdlgtemplate, *pnumitems; | |
615 | 7093 DWORD *dwp; |
7 | 7094 int numButtons; |
7095 int *buttonWidths, *buttonPositions; | |
7096 int buttonYpos; | |
7097 int nchar, i; | |
7098 DWORD lStyle; | |
7099 int dlgwidth = 0; | |
7100 int dlgheight; | |
7101 int editboxheight; | |
7102 int horizWidth = 0; | |
7103 int msgheight; | |
7104 char_u *pstart; | |
7105 char_u *pend; | |
158 | 7106 char_u *last_white; |
7 | 7107 char_u *tbuffer; |
7108 RECT rect; | |
7109 HWND hwnd; | |
7110 HDC hdc; | |
7111 HFONT font, oldFont; | |
7112 TEXTMETRIC fontInfo; | |
7113 int fontHeight; | |
7114 int textWidth, minButtonWidth, messageWidth; | |
7115 int maxDialogWidth; | |
153 | 7116 int maxDialogHeight; |
7117 int scroll_flag = 0; | |
7 | 7118 int vertical; |
7119 int dlgPaddingX; | |
7120 int dlgPaddingY; | |
7121 #ifdef USE_SYSMENU_FONT | |
7122 LOGFONT lfSysmenu; | |
7123 int use_lfSysmenu = FALSE; | |
7124 #endif | |
158 | 7125 garray_T ga; |
7126 int l; | |
7 | 7127 |
7128 #ifndef NO_CONSOLE | |
7129 /* Don't output anything in silent mode ("ex -s") */ | |
7130 if (silent_mode) | |
7131 return dfltbutton; /* return default option */ | |
7132 #endif | |
7133 | |
153 | 7134 if (s_hwnd == NULL) |
7135 get_dialog_font_metrics(); | |
7 | 7136 |
7137 if ((type < 0) || (type > VIM_LAST_TYPE)) | |
7138 type = 0; | |
7139 | |
7140 /* allocate some memory for dialog template */ | |
39 | 7141 /* TODO should compute this really */ |
158 | 7142 pdlgtemplate = p = (PWORD)LocalAlloc(LPTR, |
840 | 7143 DLG_ALLOC_SIZE + STRLEN(message) * 2); |
7 | 7144 |
7145 if (p == NULL) | |
7146 return -1; | |
7147 | |
7148 /* | |
4352 | 7149 * make a copy of 'buttons' to fiddle with it. compiler grizzles because |
7 | 7150 * vim_strsave() doesn't take a const arg (why not?), so cast away the |
7151 * const. | |
7152 */ | |
7153 tbuffer = vim_strsave(buttons); | |
7154 if (tbuffer == NULL) | |
7155 return -1; | |
7156 | |
7157 --dfltbutton; /* Change from one-based to zero-based */ | |
7158 | |
7159 /* Count buttons */ | |
7160 numButtons = 1; | |
7161 for (i = 0; tbuffer[i] != '\0'; i++) | |
7162 { | |
7163 if (tbuffer[i] == DLG_BUTTON_SEP) | |
7164 numButtons++; | |
7165 } | |
7166 if (dfltbutton >= numButtons) | |
7167 dfltbutton = -1; | |
7168 | |
7169 /* Allocate array to hold the width of each button */ | |
537 | 7170 buttonWidths = (int *)lalloc(numButtons * sizeof(int), TRUE); |
7 | 7171 if (buttonWidths == NULL) |
7172 return -1; | |
7173 | |
7174 /* Allocate array to hold the X position of each button */ | |
537 | 7175 buttonPositions = (int *)lalloc(numButtons * sizeof(int), TRUE); |
7 | 7176 if (buttonPositions == NULL) |
7177 return -1; | |
7178 | |
7179 /* | |
7180 * Calculate how big the dialog must be. | |
7181 */ | |
7182 hwnd = GetDesktopWindow(); | |
7183 hdc = GetWindowDC(hwnd); | |
7184 #ifdef USE_SYSMENU_FONT | |
7185 if (gui_w32_get_menu_font(&lfSysmenu) == OK) | |
7186 { | |
7187 font = CreateFontIndirect(&lfSysmenu); | |
7188 use_lfSysmenu = TRUE; | |
7189 } | |
7190 else | |
7191 #endif | |
7192 font = CreateFont(-DLG_FONT_POINT_SIZE, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
7193 VARIABLE_PITCH , DLG_FONT_NAME); | |
7194 if (s_usenewlook) | |
7195 { | |
7196 oldFont = SelectFont(hdc, font); | |
7197 dlgPaddingX = DLG_PADDING_X; | |
7198 dlgPaddingY = DLG_PADDING_Y; | |
7199 } | |
7200 else | |
7201 { | |
7202 oldFont = SelectFont(hdc, GetStockObject(SYSTEM_FONT)); | |
7203 dlgPaddingX = DLG_OLD_STYLE_PADDING_X; | |
7204 dlgPaddingY = DLG_OLD_STYLE_PADDING_Y; | |
7205 } | |
7206 GetTextMetrics(hdc, &fontInfo); | |
7207 fontHeight = fontInfo.tmHeight; | |
7208 | |
7209 /* Minimum width for horizontal button */ | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
7210 minButtonWidth = GetTextWidth(hdc, (char_u *)"Cancel", 6); |
7 | 7211 |
7212 /* Maximum width of a dialog, if possible */ | |
158 | 7213 if (s_hwnd == NULL) |
7214 { | |
7215 RECT workarea_rect; | |
7216 | |
636 | 7217 /* We don't have a window, use the desktop area. */ |
158 | 7218 get_work_area(&workarea_rect); |
7219 maxDialogWidth = workarea_rect.right - workarea_rect.left - 100; | |
7220 if (maxDialogWidth > 600) | |
7221 maxDialogWidth = 600; | |
5249
47a09a572ea6
updated for version 7.4b.001
Bram Moolenaar <bram@vim.org>
parents:
5225
diff
changeset
|
7222 /* Leave some room for the taskbar. */ |
47a09a572ea6
updated for version 7.4b.001
Bram Moolenaar <bram@vim.org>
parents:
5225
diff
changeset
|
7223 maxDialogHeight = workarea_rect.bottom - workarea_rect.top - 150; |
158 | 7224 } |
7225 else | |
7226 { | |
5284
7ed1ec814daf
updated for version 7.4b.018
Bram Moolenaar <bram@vim.org>
parents:
5249
diff
changeset
|
7227 /* 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
|
7228 GetWindowRect(s_hwnd, &rect); |
158 | 7229 maxDialogWidth = rect.right - rect.left |
5225
8f983df0299f
updated for version 7.4a.038
Bram Moolenaar <bram@vim.org>
parents:
5223
diff
changeset
|
7230 - (GetSystemMetrics(SM_CXFRAME) + |
6110 | 7231 GetSystemMetrics(SM_CXPADDEDBORDER)) * 2; |
158 | 7232 if (maxDialogWidth < DLG_MIN_MAX_WIDTH) |
7233 maxDialogWidth = DLG_MIN_MAX_WIDTH; | |
7234 | |
7235 maxDialogHeight = rect.bottom - rect.top | |
5249
47a09a572ea6
updated for version 7.4b.001
Bram Moolenaar <bram@vim.org>
parents:
5225
diff
changeset
|
7236 - (GetSystemMetrics(SM_CYFRAME) + |
6110 | 7237 GetSystemMetrics(SM_CXPADDEDBORDER)) * 4 |
5284
7ed1ec814daf
updated for version 7.4b.018
Bram Moolenaar <bram@vim.org>
parents:
5249
diff
changeset
|
7238 - GetSystemMetrics(SM_CYCAPTION); |
158 | 7239 if (maxDialogHeight < DLG_MIN_MAX_HEIGHT) |
7240 maxDialogHeight = DLG_MIN_MAX_HEIGHT; | |
7241 } | |
7242 | |
7243 /* Set dlgwidth to width of message. | |
7244 * Copy the message into "ga", changing NL to CR-NL and inserting line | |
7245 * breaks where needed. */ | |
7 | 7246 pstart = message; |
7247 messageWidth = 0; | |
158 | 7248 msgheight = 0; |
7249 ga_init2(&ga, sizeof(char), 500); | |
7 | 7250 do |
7251 { | |
158 | 7252 msgheight += fontHeight; /* at least one line */ |
7253 | |
7254 /* Need to figure out where to break the string. The system does it | |
7255 * at a word boundary, which would mean we can't compute the number of | |
7256 * wrapped lines. */ | |
7257 textWidth = 0; | |
7258 last_white = NULL; | |
7259 for (pend = pstart; *pend != NUL && *pend != '\n'; ) | |
153 | 7260 { |
158 | 7261 #ifdef FEAT_MBYTE |
474 | 7262 l = (*mb_ptr2len)(pend); |
158 | 7263 #else |
7264 l = 1; | |
7265 #endif | |
11129
f4ea50924c6d
patch 8.0.0452: some macros are in lower case
Christian Brabandt <cb@256bit.org>
parents:
10783
diff
changeset
|
7266 if (l == 1 && VIM_ISWHITE(*pend) |
158 | 7267 && textWidth > maxDialogWidth * 3 / 4) |
7268 last_white = pend; | |
4999
b4a71dbdb787
updated for version 7.3.1244
Bram Moolenaar <bram@vim.org>
parents:
4352
diff
changeset
|
7269 textWidth += GetTextWidthEnc(hdc, pend, l); |
158 | 7270 if (textWidth >= maxDialogWidth) |
153 | 7271 { |
158 | 7272 /* Line will wrap. */ |
7273 messageWidth = maxDialogWidth; | |
153 | 7274 msgheight += fontHeight; |
158 | 7275 textWidth = 0; |
7276 | |
7277 if (last_white != NULL) | |
7278 { | |
7279 /* break the line just after a space */ | |
835 | 7280 ga.ga_len -= (int)(pend - (last_white + 1)); |
158 | 7281 pend = last_white + 1; |
7282 last_white = NULL; | |
7283 } | |
7284 ga_append(&ga, '\r'); | |
7285 ga_append(&ga, '\n'); | |
7286 continue; | |
153 | 7287 } |
158 | 7288 |
7289 while (--l >= 0) | |
7290 ga_append(&ga, *pend++); | |
153 | 7291 } |
158 | 7292 if (textWidth > messageWidth) |
7 | 7293 messageWidth = textWidth; |
158 | 7294 |
7295 ga_append(&ga, '\r'); | |
7296 ga_append(&ga, '\n'); | |
7 | 7297 pstart = pend + 1; |
7298 } while (*pend != NUL); | |
153 | 7299 |
158 | 7300 if (ga.ga_data != NULL) |
7301 message = ga.ga_data; | |
7302 | |
153 | 7303 messageWidth += 10; /* roundoff space */ |
7304 | |
7 | 7305 /* 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
|
7306 dlgwidth = messageWidth + DLG_ICON_WIDTH + 3 * dlgPaddingX |
7ed1ec814daf
updated for version 7.4b.018
Bram Moolenaar <bram@vim.org>
parents:
5249
diff
changeset
|
7307 + GetSystemMetrics(SM_CXVSCROLL); |
7 | 7308 |
7309 if (msgheight < DLG_ICON_HEIGHT) | |
7310 msgheight = DLG_ICON_HEIGHT; | |
7311 | |
7312 /* | |
7313 * Check button names. A long one will make the dialog wider. | |
1116 | 7314 * When called early (-register error message) p_go isn't initialized. |
7 | 7315 */ |
1116 | 7316 vertical = (p_go != NULL && vim_strchr(p_go, GO_VERTICAL) != NULL); |
7 | 7317 if (!vertical) |
7318 { | |
7319 // Place buttons horizontally if they fit. | |
7320 horizWidth = dlgPaddingX; | |
7321 pstart = tbuffer; | |
7322 i = 0; | |
7323 do | |
7324 { | |
7325 pend = vim_strchr(pstart, DLG_BUTTON_SEP); | |
7326 if (pend == NULL) | |
7327 pend = pstart + STRLEN(pstart); // Last button name. | |
5001
43329b2b5b79
updated for version 7.3.1245
Bram Moolenaar <bram@vim.org>
parents:
4999
diff
changeset
|
7328 textWidth = GetTextWidthEnc(hdc, pstart, (int)(pend - pstart)); |
7 | 7329 if (textWidth < minButtonWidth) |
7330 textWidth = minButtonWidth; | |
7331 textWidth += dlgPaddingX; /* Padding within button */ | |
7332 buttonWidths[i] = textWidth; | |
7333 buttonPositions[i++] = horizWidth; | |
7334 horizWidth += textWidth + dlgPaddingX; /* Pad between buttons */ | |
7335 pstart = pend + 1; | |
7336 } while (*pend != NUL); | |
7337 | |
7338 if (horizWidth > maxDialogWidth) | |
7339 vertical = TRUE; // Too wide to fit on the screen. | |
7340 else if (horizWidth > dlgwidth) | |
7341 dlgwidth = horizWidth; | |
7342 } | |
7343 | |
7344 if (vertical) | |
7345 { | |
7346 // Stack buttons vertically. | |
7347 pstart = tbuffer; | |
7348 do | |
7349 { | |
7350 pend = vim_strchr(pstart, DLG_BUTTON_SEP); | |
7351 if (pend == NULL) | |
7352 pend = pstart + STRLEN(pstart); // Last button name. | |
5001
43329b2b5b79
updated for version 7.3.1245
Bram Moolenaar <bram@vim.org>
parents:
4999
diff
changeset
|
7353 textWidth = GetTextWidthEnc(hdc, pstart, (int)(pend - pstart)); |
7 | 7354 textWidth += dlgPaddingX; /* Padding within button */ |
7355 textWidth += DLG_VERT_PADDING_X * 2; /* Padding around button */ | |
7356 if (textWidth > dlgwidth) | |
7357 dlgwidth = textWidth; | |
7358 pstart = pend + 1; | |
7359 } while (*pend != NUL); | |
7360 } | |
7361 | |
7362 if (dlgwidth < DLG_MIN_WIDTH) | |
7363 dlgwidth = DLG_MIN_WIDTH; /* Don't allow a really thin dialog!*/ | |
7364 | |
7365 /* start to fill in the dlgtemplate information. addressing by WORDs */ | |
7366 if (s_usenewlook) | |
7367 lStyle = DS_MODALFRAME | WS_CAPTION |DS_3DLOOK| WS_VISIBLE |DS_SETFONT; | |
7368 else | |
7369 lStyle = DS_MODALFRAME | WS_CAPTION |DS_3DLOOK| WS_VISIBLE; | |
7370 | |
7371 add_long(lStyle); | |
7372 add_long(0); // (lExtendedStyle) | |
7373 pnumitems = p; /*save where the number of items must be stored*/ | |
7374 add_word(0); // NumberOfItems(will change later) | |
7375 add_word(10); // x | |
7376 add_word(10); // y | |
7377 add_word(PixelToDialogX(dlgwidth)); // cx | |
7378 | |
7379 // Dialog height. | |
7380 if (vertical) | |
5284
7ed1ec814daf
updated for version 7.4b.018
Bram Moolenaar <bram@vim.org>
parents:
5249
diff
changeset
|
7381 dlgheight = msgheight + 2 * dlgPaddingY |
7ed1ec814daf
updated for version 7.4b.018
Bram Moolenaar <bram@vim.org>
parents:
5249
diff
changeset
|
7382 + DLG_VERT_PADDING_Y + 2 * fontHeight * numButtons; |
7 | 7383 else |
7384 dlgheight = msgheight + 3 * dlgPaddingY + 2 * fontHeight; | |
7385 | |
7386 // Dialog needs to be taller if contains an edit box. | |
7387 editboxheight = fontHeight + dlgPaddingY + 4 * DLG_VERT_PADDING_Y; | |
7388 if (textfield != NULL) | |
7389 dlgheight += editboxheight; | |
7390 | |
5284
7ed1ec814daf
updated for version 7.4b.018
Bram Moolenaar <bram@vim.org>
parents:
5249
diff
changeset
|
7391 /* 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
|
7392 if (dlgheight > maxDialogHeight) |
7ed1ec814daf
updated for version 7.4b.018
Bram Moolenaar <bram@vim.org>
parents:
5249
diff
changeset
|
7393 { |
6110 | 7394 msgheight = msgheight - (dlgheight - maxDialogHeight); |
7395 dlgheight = maxDialogHeight; | |
7396 scroll_flag = WS_VSCROLL; | |
7397 /* Make sure scrollbar doesn't appear in the middle of the dialog */ | |
7398 messageWidth = dlgwidth - DLG_ICON_WIDTH - 3 * dlgPaddingX; | |
5284
7ed1ec814daf
updated for version 7.4b.018
Bram Moolenaar <bram@vim.org>
parents:
5249
diff
changeset
|
7399 } |
7ed1ec814daf
updated for version 7.4b.018
Bram Moolenaar <bram@vim.org>
parents:
5249
diff
changeset
|
7400 |
7 | 7401 add_word(PixelToDialogY(dlgheight)); |
7402 | |
7403 add_word(0); // Menu | |
7404 add_word(0); // Class | |
7405 | |
7406 /* 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
|
7407 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
|
7408 : (LPSTR)("Vim "VIM_VERSION_MEDIUM)), TRUE); |
7 | 7409 p += nchar; |
7410 | |
7411 if (s_usenewlook) | |
7412 { | |
7413 /* do the font, since DS_3DLOOK doesn't work properly */ | |
7414 #ifdef USE_SYSMENU_FONT | |
7415 if (use_lfSysmenu) | |
7416 { | |
7417 /* point size */ | |
7418 *p++ = -MulDiv(lfSysmenu.lfHeight, 72, | |
7419 GetDeviceCaps(hdc, LOGPIXELSY)); | |
12543
e9028055f6d6
patch 8.0.1150: MS-Windows GUI: dialog font size is incorrect
Christian Brabandt <cb@256bit.org>
parents:
12513
diff
changeset
|
7420 nchar = nCopyAnsiToWideChar(p, lfSysmenu.lfFaceName, FALSE); |
7 | 7421 } |
7422 else | |
7423 #endif | |
7424 { | |
7425 *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
|
7426 nchar = nCopyAnsiToWideChar(p, DLG_FONT_NAME, FALSE); |
7 | 7427 } |
7428 p += nchar; | |
7429 } | |
7430 | |
7431 buttonYpos = msgheight + 2 * dlgPaddingY; | |
7432 | |
7433 if (textfield != NULL) | |
7434 buttonYpos += editboxheight; | |
7435 | |
7436 pstart = tbuffer; | |
7437 if (!vertical) | |
7438 horizWidth = (dlgwidth - horizWidth) / 2; /* Now it's X offset */ | |
7439 for (i = 0; i < numButtons; i++) | |
7440 { | |
7441 /* get end of this button. */ | |
7442 for ( pend = pstart; | |
7443 *pend && (*pend != DLG_BUTTON_SEP); | |
7444 pend++) | |
7445 ; | |
7446 | |
7447 if (*pend) | |
7448 *pend = '\0'; | |
7449 | |
7450 /* | |
7451 * old NOTE: | |
7452 * setting the BS_DEFPUSHBUTTON style doesn't work because Windows sets | |
7453 * the focus to the first tab-able button and in so doing makes that | |
7454 * the default!! Grrr. Workaround: Make the default button the only | |
7455 * one with WS_TABSTOP style. Means user can't tab between buttons, but | |
7456 * he/she can use arrow keys. | |
7457 * | |
7458 * new NOTE: BS_DEFPUSHBUTTON is required to be able to select the | |
1213 | 7459 * right button when hitting <Enter>. E.g., for the ":confirm quit" |
7 | 7460 * dialog. Also needed for when the textfield is the default control. |
7461 * It appears to work now (perhaps not on Win95?). | |
7462 */ | |
7463 if (vertical) | |
7464 { | |
7465 p = add_dialog_element(p, | |
7466 (i == dfltbutton | |
7467 ? BS_DEFPUSHBUTTON : BS_PUSHBUTTON) | WS_TABSTOP, | |
7468 PixelToDialogX(DLG_VERT_PADDING_X), | |
7469 PixelToDialogY(buttonYpos /* TBK */ | |
7470 + 2 * fontHeight * i), | |
7471 PixelToDialogX(dlgwidth - 2 * DLG_VERT_PADDING_X), | |
7472 (WORD)(PixelToDialogY(2 * fontHeight) - 1), | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
7473 (WORD)(IDCANCEL + 1 + i), (WORD)0x0080, (char *)pstart); |
7 | 7474 } |
7475 else | |
7476 { | |
7477 p = add_dialog_element(p, | |
7478 (i == dfltbutton | |
7479 ? BS_DEFPUSHBUTTON : BS_PUSHBUTTON) | WS_TABSTOP, | |
7480 PixelToDialogX(horizWidth + buttonPositions[i]), | |
7481 PixelToDialogY(buttonYpos), /* TBK */ | |
7482 PixelToDialogX(buttonWidths[i]), | |
7483 (WORD)(PixelToDialogY(2 * fontHeight) - 1), | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
7484 (WORD)(IDCANCEL + 1 + i), (WORD)0x0080, (char *)pstart); |
7 | 7485 } |
7486 pstart = pend + 1; /*next button*/ | |
7487 } | |
7488 *pnumitems += numButtons; | |
7489 | |
7490 /* Vim icon */ | |
7491 p = add_dialog_element(p, SS_ICON, | |
7492 PixelToDialogX(dlgPaddingX), | |
7493 PixelToDialogY(dlgPaddingY), | |
7494 PixelToDialogX(DLG_ICON_WIDTH), | |
7495 PixelToDialogY(DLG_ICON_HEIGHT), | |
7496 DLG_NONBUTTON_CONTROL + 0, (WORD)0x0082, | |
7497 dlg_icons[type]); | |
7498 | |
153 | 7499 /* Dialog message */ |
7500 p = add_dialog_element(p, ES_LEFT|scroll_flag|ES_MULTILINE|ES_READONLY, | |
7501 PixelToDialogX(2 * dlgPaddingX + DLG_ICON_WIDTH), | |
7502 PixelToDialogY(dlgPaddingY), | |
7503 (WORD)(PixelToDialogX(messageWidth) + 1), | |
7504 PixelToDialogY(msgheight), | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
7505 DLG_NONBUTTON_CONTROL + 1, (WORD)0x0081, (char *)message); |
7 | 7506 |
7507 /* Edit box */ | |
7508 if (textfield != NULL) | |
7509 { | |
7510 p = add_dialog_element(p, ES_LEFT|ES_AUTOHSCROLL|WS_TABSTOP|WS_BORDER, | |
7511 PixelToDialogX(2 * dlgPaddingX), | |
7512 PixelToDialogY(2 * dlgPaddingY + msgheight), | |
7513 PixelToDialogX(dlgwidth - 4 * dlgPaddingX), | |
7514 PixelToDialogY(fontHeight + dlgPaddingY), | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
7515 DLG_NONBUTTON_CONTROL + 2, (WORD)0x0081, (char *)textfield); |
7 | 7516 *pnumitems += 1; |
7517 } | |
7518 | |
7519 *pnumitems += 2; | |
7520 | |
7521 SelectFont(hdc, oldFont); | |
7522 DeleteObject(font); | |
7523 ReleaseDC(hwnd, hdc); | |
7524 | |
7525 /* Let the dialog_callback() function know which button to make default | |
7526 * If we have an edit box, make that the default. We also need to tell | |
7527 * dialog_callback() if this dialog contains an edit box or not. We do | |
7528 * this by setting s_textfield if it does. | |
7529 */ | |
7530 if (textfield != NULL) | |
7531 { | |
7532 dialog_default_button = DLG_NONBUTTON_CONTROL + 2; | |
7533 s_textfield = textfield; | |
7534 } | |
7535 else | |
7536 { | |
7537 dialog_default_button = IDCANCEL + 1 + dfltbutton; | |
7538 s_textfield = NULL; | |
7539 } | |
7540 | |
7541 /* show the dialog box modally and get a return value */ | |
7542 nchar = (int)DialogBoxIndirect( | |
7543 s_hinst, | |
7544 (LPDLGTEMPLATE)pdlgtemplate, | |
7545 s_hwnd, | |
7546 (DLGPROC)dialog_callback); | |
7547 | |
7548 LocalFree(LocalHandle(pdlgtemplate)); | |
7549 vim_free(tbuffer); | |
7550 vim_free(buttonWidths); | |
7551 vim_free(buttonPositions); | |
158 | 7552 vim_free(ga.ga_data); |
7 | 7553 |
7554 /* Focus back to our window (for when MDI is used). */ | |
7555 (void)SetFocus(s_hwnd); | |
7556 | |
7557 return nchar; | |
7558 } | |
7559 | |
7560 #endif /* FEAT_GUI_DIALOG */ | |
840 | 7561 |
7 | 7562 /* |
7563 * Put a simple element (basic class) onto a dialog template in memory. | |
7564 * return a pointer to where the next item should be added. | |
7565 * | |
7566 * parameters: | |
7567 * lStyle = additional style flags | |
7568 * (be careful, NT3.51 & Win32s will ignore the new ones) | |
7569 * x,y = x & y positions IN DIALOG UNITS | |
7570 * w,h = width and height IN DIALOG UNITS | |
7571 * Id = ID used in messages | |
7572 * clss = class ID, e.g 0x0080 for a button, 0x0082 for a static | |
7573 * caption = usually text or resource name | |
7574 * | |
7575 * TODO: use the length information noted here to enable the dialog creation | |
7576 * routines to work out more exactly how much memory they need to alloc. | |
7577 */ | |
7578 static PWORD | |
7579 add_dialog_element( | |
7580 PWORD p, | |
7581 DWORD lStyle, | |
7582 WORD x, | |
7583 WORD y, | |
7584 WORD w, | |
7585 WORD h, | |
7586 WORD Id, | |
7587 WORD clss, | |
7588 const char *caption) | |
7589 { | |
7590 int nchar; | |
7591 | |
7592 p = lpwAlign(p); /* Align to dword boundary*/ | |
7593 lStyle = lStyle | WS_VISIBLE | WS_CHILD; | |
7594 *p++ = LOWORD(lStyle); | |
7595 *p++ = HIWORD(lStyle); | |
7596 *p++ = 0; // LOWORD (lExtendedStyle) | |
7597 *p++ = 0; // HIWORD (lExtendedStyle) | |
7598 *p++ = x; | |
7599 *p++ = y; | |
7600 *p++ = w; | |
7601 *p++ = h; | |
7602 *p++ = Id; //9 or 10 words in all | |
7603 | |
7604 *p++ = (WORD)0xffff; | |
7605 *p++ = clss; //2 more here | |
7606 | |
12543
e9028055f6d6
patch 8.0.1150: MS-Windows GUI: dialog font size is incorrect
Christian Brabandt <cb@256bit.org>
parents:
12513
diff
changeset
|
7607 nchar = nCopyAnsiToWideChar(p, (LPSTR)caption, TRUE); //strlen(caption)+1 |
7 | 7608 p += nchar; |
7609 | |
7610 *p++ = 0; // advance pointer over nExtraStuff WORD - 2 more | |
7611 | |
7612 return p; //total = 15+ (strlen(caption)) words | |
7613 // = 30 + 2(strlen(caption) bytes reqd | |
7614 } | |
7615 | |
7616 | |
7617 /* | |
7618 * Helper routine. Take an input pointer, return closest pointer that is | |
7619 * aligned on a DWORD (4 byte) boundary. Taken from the Win32SDK samples. | |
7620 */ | |
7621 static LPWORD | |
7622 lpwAlign( | |
7623 LPWORD lpIn) | |
7624 { | |
840 | 7625 long_u ul; |
7626 | |
7627 ul = (long_u)lpIn; | |
7 | 7628 ul += 3; |
7629 ul >>= 2; | |
7630 ul <<= 2; | |
7631 return (LPWORD)ul; | |
7632 } | |
7633 | |
7634 /* | |
7635 * Helper routine. Takes second parameter as Ansi string, copies it to first | |
7636 * parameter as wide character (16-bits / char) string, and returns integer | |
7637 * number of wide characters (words) in string (including the trailing wide | |
7638 * 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
|
7639 * 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
|
7640 * ACP is used for "lpAnsiIn". */ |
7 | 7641 static int |
7642 nCopyAnsiToWideChar( | |
7643 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
|
7644 LPSTR lpAnsiIn, |
e9028055f6d6
patch 8.0.1150: MS-Windows GUI: dialog font size is incorrect
Christian Brabandt <cb@256bit.org>
parents:
12513
diff
changeset
|
7645 BOOL use_enc) |
7 | 7646 { |
7647 int nChar = 0; | |
7648 #ifdef FEAT_MBYTE | |
7649 int len = lstrlen(lpAnsiIn) + 1; /* include NUL character */ | |
7650 int i; | |
7651 WCHAR *wn; | |
7652 | |
12543
e9028055f6d6
patch 8.0.1150: MS-Windows GUI: dialog font size is incorrect
Christian Brabandt <cb@256bit.org>
parents:
12513
diff
changeset
|
7653 if (use_enc && enc_codepage >= 0 && (int)GetACP() != enc_codepage) |
7 | 7654 { |
7655 /* 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
|
7656 wn = enc_to_utf16((char_u *)lpAnsiIn, NULL); |
7 | 7657 if (wn != NULL) |
7658 { | |
7659 wcscpy(lpWCStr, wn); | |
835 | 7660 nChar = (int)wcslen(wn) + 1; |
7 | 7661 vim_free(wn); |
7662 } | |
7663 } | |
7664 if (nChar == 0) | |
7665 /* Use Win32 conversion function. */ | |
7666 nChar = MultiByteToWideChar( | |
7667 enc_codepage > 0 ? enc_codepage : CP_ACP, | |
7668 MB_PRECOMPOSED, | |
7669 lpAnsiIn, len, | |
7670 lpWCStr, len); | |
7671 for (i = 0; i < nChar; ++i) | |
7672 if (lpWCStr[i] == (WORD)'\t') /* replace tabs with spaces */ | |
7673 lpWCStr[i] = (WORD)' '; | |
7674 #else | |
7675 do | |
7676 { | |
7677 if (*lpAnsiIn == '\t') | |
7678 *lpWCStr++ = (WORD)' '; | |
7679 else | |
7680 *lpWCStr++ = (WORD)*lpAnsiIn; | |
7681 nChar++; | |
7682 } while (*lpAnsiIn++); | |
7683 #endif | |
7684 | |
7685 return nChar; | |
7686 } | |
7687 | |
7688 | |
7689 #ifdef FEAT_TEAROFF | |
7690 /* | |
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
|
7691 * 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
|
7692 */ |
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
|
7693 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
|
7694 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
|
7695 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
|
7696 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
|
7697 { |
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
|
7698 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
|
7699 { |
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
|
7700 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
|
7701 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
|
7702 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
|
7703 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
|
7704 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
|
7705 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
|
7706 } |
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
|
7707 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
|
7708 } |
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
|
7709 |
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
|
7710 /* |
7 | 7711 * The callback function for all the modeless dialogs that make up the |
7712 * "tearoff menus" Very simple - forward button presses (to fool Vim into | |
7713 * thinking its menus have been clicked), and go away when closed. | |
7714 */ | |
7715 static LRESULT CALLBACK | |
7716 tearoff_callback( | |
7717 HWND hwnd, | |
7718 UINT message, | |
7719 WPARAM wParam, | |
7720 LPARAM lParam) | |
7721 { | |
7722 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
|
7723 { |
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
|
7724 SetWindowLongPtr(hwnd, DWLP_USER, (LONG_PTR)lParam); |
7 | 7725 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
|
7726 } |
7 | 7727 |
7728 /* May show the mouse pointer again. */ | |
7729 HandleMouseHide(message, lParam); | |
7730 | |
7731 if (message == WM_COMMAND) | |
7732 { | |
7733 if ((WORD)(LOWORD(wParam)) & 0x8000) | |
7734 { | |
7735 POINT mp; | |
7736 RECT rect; | |
7737 | |
7738 if (GetCursorPos(&mp) && GetWindowRect(hwnd, &rect)) | |
7739 { | |
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
|
7740 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
|
7741 |
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
|
7742 menu = (vimmenu_T*)GetWindowLongPtr(hwnd, DWLP_USER); |
7 | 7743 (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
|
7744 tearoff_lookup_menuhandle(menu, LOWORD(wParam)), |
7 | 7745 TPM_LEFTALIGN | TPM_LEFTBUTTON, |
7746 (int)rect.right - 8, | |
7747 (int)mp.y, | |
7748 (int)0, /*reserved param*/ | |
7749 s_hwnd, | |
7750 NULL); | |
7751 /* | |
7752 * NOTE: The pop-up menu can eat the mouse up event. | |
7753 * We deal with this in normal.c. | |
7754 */ | |
7755 } | |
7756 } | |
7757 else | |
7758 /* Pass on messages to the main Vim window */ | |
7759 PostMessage(s_hwnd, WM_COMMAND, LOWORD(wParam), 0); | |
7760 /* | |
7761 * Give main window the focus back: this is so after | |
7762 * choosing a tearoff button you can start typing again | |
7763 * straight away. | |
7764 */ | |
7765 (void)SetFocus(s_hwnd); | |
7766 return TRUE; | |
7767 } | |
7768 if ((message == WM_SYSCOMMAND) && (wParam == SC_CLOSE)) | |
7769 { | |
7770 DestroyWindow(hwnd); | |
7771 return TRUE; | |
7772 } | |
7773 | |
7774 /* When moved around, give main window the focus back. */ | |
7775 if (message == WM_EXITSIZEMOVE) | |
7776 (void)SetActiveWindow(s_hwnd); | |
7777 | |
7778 return FALSE; | |
7779 } | |
7780 #endif | |
7781 | |
7782 | |
7783 /* | |
7784 * Decide whether to use the "new look" (small, non-bold font) or the "old | |
7785 * look" (big, clanky font) for dialogs, and work out a few values for use | |
7786 * later accordingly. | |
7787 */ | |
7788 static void | |
7789 get_dialog_font_metrics(void) | |
7790 { | |
7791 HDC hdc; | |
7792 HFONT hfontTools = 0; | |
7793 DWORD dlgFontSize; | |
7794 SIZE size; | |
7795 #ifdef USE_SYSMENU_FONT | |
7796 LOGFONT lfSysmenu; | |
7797 #endif | |
7798 | |
7799 s_usenewlook = FALSE; | |
7800 | |
7801 #ifdef USE_SYSMENU_FONT | |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7802 if (gui_w32_get_menu_font(&lfSysmenu) == OK) |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7803 hfontTools = CreateFontIndirect(&lfSysmenu); |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7804 else |
7 | 7805 #endif |
7806 hfontTools = CreateFont(-DLG_FONT_POINT_SIZE, 0, 0, 0, 0, 0, 0, 0, | |
7807 0, 0, 0, 0, VARIABLE_PITCH , DLG_FONT_NAME); | |
7808 | |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7809 if (hfontTools) |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7810 { |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7811 hdc = GetDC(s_hwnd); |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7812 SelectObject(hdc, hfontTools); |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7813 /* |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7814 * 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
|
7815 * 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
|
7816 * ourselves. |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7817 */ |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7818 GetTextExtentPoint(hdc, |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7819 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7820 52, &size); |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7821 ReleaseDC(s_hwnd, hdc); |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7822 |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7823 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
|
7824 s_dlgfntheight = (WORD)size.cy; |
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
7825 s_usenewlook = TRUE; |
7 | 7826 } |
7827 | |
7828 if (!s_usenewlook) | |
7829 { | |
7830 dlgFontSize = GetDialogBaseUnits(); /* fall back to big old system*/ | |
7831 s_dlgfntwidth = LOWORD(dlgFontSize); | |
7832 s_dlgfntheight = HIWORD(dlgFontSize); | |
7833 } | |
7834 } | |
7835 | |
7836 #if defined(FEAT_MENU) && defined(FEAT_TEAROFF) | |
7837 /* | |
7838 * Create a pseudo-"tearoff menu" based on the child | |
7839 * items of a given menu pointer. | |
7840 */ | |
7841 static void | |
7842 gui_mch_tearoff( | |
7843 char_u *title, | |
7844 vimmenu_T *menu, | |
7845 int initX, | |
7846 int initY) | |
7847 { | |
7848 WORD *p, *pdlgtemplate, *pnumitems, *ptrueheight; | |
7849 int template_len; | |
7850 int nchar, textWidth, submenuWidth; | |
7851 DWORD lStyle; | |
7852 DWORD lExtendedStyle; | |
7853 WORD dlgwidth; | |
7854 WORD menuID; | |
7855 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
|
7856 vimmenu_T *top_menu; |
7 | 7857 vimmenu_T *the_menu = menu; |
7858 HWND hwnd; | |
7859 HDC hdc; | |
7860 HFONT font, oldFont; | |
7861 int col, spaceWidth, len; | |
7862 int columnWidths[2]; | |
7863 char_u *label, *text; | |
7864 int acLen = 0; | |
7865 int nameLen; | |
7866 int padding0, padding1, padding2 = 0; | |
7867 int sepPadding=0; | |
87 | 7868 int x; |
7869 int y; | |
7 | 7870 #ifdef USE_SYSMENU_FONT |
7871 LOGFONT lfSysmenu; | |
7872 int use_lfSysmenu = FALSE; | |
7873 #endif | |
7874 | |
7875 /* | |
7876 * If this menu is already torn off, move it to the mouse position. | |
7877 */ | |
7878 if (IsWindow(menu->tearoff_handle)) | |
7879 { | |
7880 POINT mp; | |
7881 if (GetCursorPos((LPPOINT)&mp)) | |
7882 { | |
7883 SetWindowPos(menu->tearoff_handle, NULL, mp.x, mp.y, 0, 0, | |
7884 SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER); | |
7885 } | |
7886 return; | |
7887 } | |
7888 | |
7889 /* | |
7890 * Create a new tearoff. | |
7891 */ | |
7892 if (*title == MNU_HIDDEN_CHAR) | |
7893 title++; | |
7894 | |
7895 /* Allocate memory to store the dialog template. It's made bigger when | |
7896 * needed. */ | |
7897 template_len = DLG_ALLOC_SIZE; | |
7898 pdlgtemplate = p = (WORD *)LocalAlloc(LPTR, template_len); | |
7899 if (p == NULL) | |
7900 return; | |
7901 | |
7902 hwnd = GetDesktopWindow(); | |
7903 hdc = GetWindowDC(hwnd); | |
7904 #ifdef USE_SYSMENU_FONT | |
7905 if (gui_w32_get_menu_font(&lfSysmenu) == OK) | |
7906 { | |
7907 font = CreateFontIndirect(&lfSysmenu); | |
7908 use_lfSysmenu = TRUE; | |
7909 } | |
7910 else | |
7911 #endif | |
7912 font = CreateFont(-DLG_FONT_POINT_SIZE, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
7913 VARIABLE_PITCH , DLG_FONT_NAME); | |
7914 if (s_usenewlook) | |
7915 oldFont = SelectFont(hdc, font); | |
7916 else | |
7917 oldFont = SelectFont(hdc, GetStockObject(SYSTEM_FONT)); | |
7918 | |
7919 /* Calculate width of a single space. Used for padding columns to the | |
7920 * right width. */ | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
7921 spaceWidth = GetTextWidth(hdc, (char_u *)" ", 1); |
7 | 7922 |
7923 /* Figure out max width of the text column, the accelerator column and the | |
7924 * optional submenu column. */ | |
7925 submenuWidth = 0; | |
7926 for (col = 0; col < 2; col++) | |
7927 { | |
7928 columnWidths[col] = 0; | |
7929 for (pmenu = menu->children; pmenu != NULL; pmenu = pmenu->next) | |
7930 { | |
7931 /* Use "dname" here to compute the width of the visible text. */ | |
7932 text = (col == 0) ? pmenu->dname : pmenu->actext; | |
7933 if (text != NULL && *text != NUL) | |
7934 { | |
7935 textWidth = GetTextWidthEnc(hdc, text, (int)STRLEN(text)); | |
7936 if (textWidth > columnWidths[col]) | |
7937 columnWidths[col] = textWidth; | |
7938 } | |
7939 if (pmenu->children != NULL) | |
7940 submenuWidth = TEAROFF_COLUMN_PADDING * spaceWidth; | |
7941 } | |
7942 } | |
7943 if (columnWidths[1] == 0) | |
7944 { | |
7945 /* no accelerators */ | |
7946 if (submenuWidth != 0) | |
7947 columnWidths[0] += submenuWidth; | |
7948 else | |
7949 columnWidths[0] += spaceWidth; | |
7950 } | |
7951 else | |
7952 { | |
7953 /* there is an accelerator column */ | |
7954 columnWidths[0] += TEAROFF_COLUMN_PADDING * spaceWidth; | |
7955 columnWidths[1] += submenuWidth; | |
7956 } | |
7957 | |
7958 /* | |
7959 * Now find the total width of our 'menu'. | |
7960 */ | |
7961 textWidth = columnWidths[0] + columnWidths[1]; | |
7962 if (submenuWidth != 0) | |
7963 { | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
7964 submenuWidth = GetTextWidth(hdc, (char_u *)TEAROFF_SUBMENU_LABEL, |
7 | 7965 (int)STRLEN(TEAROFF_SUBMENU_LABEL)); |
7966 textWidth += submenuWidth; | |
7967 } | |
7968 dlgwidth = GetTextWidthEnc(hdc, title, (int)STRLEN(title)); | |
7969 if (textWidth > dlgwidth) | |
7970 dlgwidth = textWidth; | |
7971 dlgwidth += 2 * TEAROFF_PADDING_X + TEAROFF_BUTTON_PAD_X; | |
7972 | |
7973 /* start to fill in the dlgtemplate information. addressing by WORDs */ | |
7974 if (s_usenewlook) | |
7975 lStyle = DS_MODALFRAME | WS_CAPTION| WS_SYSMENU |DS_SETFONT| WS_VISIBLE; | |
7976 else | |
7977 lStyle = DS_MODALFRAME | WS_CAPTION| WS_SYSMENU | WS_VISIBLE; | |
7978 | |
7979 lExtendedStyle = WS_EX_TOOLWINDOW|WS_EX_STATICEDGE; | |
7980 *p++ = LOWORD(lStyle); | |
7981 *p++ = HIWORD(lStyle); | |
7982 *p++ = LOWORD(lExtendedStyle); | |
7983 *p++ = HIWORD(lExtendedStyle); | |
7984 pnumitems = p; /* save where the number of items must be stored */ | |
7985 *p++ = 0; // NumberOfItems(will change later) | |
87 | 7986 gui_mch_getmouse(&x, &y); |
7 | 7987 if (initX == 0xffffL) |
87 | 7988 *p++ = PixelToDialogX(x); // x |
7 | 7989 else |
7990 *p++ = PixelToDialogX(initX); // x | |
7991 if (initY == 0xffffL) | |
87 | 7992 *p++ = PixelToDialogY(y); // y |
7 | 7993 else |
7994 *p++ = PixelToDialogY(initY); // y | |
7995 *p++ = PixelToDialogX(dlgwidth); // cx | |
7996 ptrueheight = p; | |
7997 *p++ = 0; // dialog height: changed later anyway | |
7998 *p++ = 0; // Menu | |
7999 *p++ = 0; // Class | |
8000 | |
8001 /* copy the title of the dialog */ | |
8002 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
|
8003 ? (LPSTR)title |
e9028055f6d6
patch 8.0.1150: MS-Windows GUI: dialog font size is incorrect
Christian Brabandt <cb@256bit.org>
parents:
12513
diff
changeset
|
8004 : (LPSTR)("Vim "VIM_VERSION_MEDIUM)), TRUE); |
7 | 8005 p += nchar; |
8006 | |
8007 if (s_usenewlook) | |
8008 { | |
8009 /* do the font, since DS_3DLOOK doesn't work properly */ | |
8010 #ifdef USE_SYSMENU_FONT | |
8011 if (use_lfSysmenu) | |
8012 { | |
8013 /* point size */ | |
8014 *p++ = -MulDiv(lfSysmenu.lfHeight, 72, | |
8015 GetDeviceCaps(hdc, LOGPIXELSY)); | |
12543
e9028055f6d6
patch 8.0.1150: MS-Windows GUI: dialog font size is incorrect
Christian Brabandt <cb@256bit.org>
parents:
12513
diff
changeset
|
8016 nchar = nCopyAnsiToWideChar(p, lfSysmenu.lfFaceName, FALSE); |
7 | 8017 } |
8018 else | |
8019 #endif | |
8020 { | |
8021 *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
|
8022 nchar = nCopyAnsiToWideChar(p, DLG_FONT_NAME, FALSE); |
7 | 8023 } |
8024 p += nchar; | |
8025 } | |
8026 | |
8027 /* | |
8028 * Loop over all the items in the menu. | |
8029 * But skip over the tearbar. | |
8030 */ | |
8031 if (STRCMP(menu->children->name, TEAR_STRING) == 0) | |
8032 menu = menu->children->next; | |
8033 else | |
8034 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
|
8035 top_menu = menu; |
7 | 8036 for ( ; menu != NULL; menu = menu->next) |
8037 { | |
8038 if (menu->modes == 0) /* this menu has just been deleted */ | |
8039 continue; | |
8040 if (menu_is_separator(menu->dname)) | |
8041 { | |
8042 sepPadding += 3; | |
8043 continue; | |
8044 } | |
8045 | |
8046 /* Check if there still is plenty of room in the template. Make it | |
8047 * larger when needed. */ | |
8048 if (((char *)p - (char *)pdlgtemplate) + 1000 > template_len) | |
8049 { | |
8050 WORD *newp; | |
8051 | |
8052 newp = (WORD *)LocalAlloc(LPTR, template_len + 4096); | |
8053 if (newp != NULL) | |
8054 { | |
8055 template_len += 4096; | |
8056 mch_memmove(newp, pdlgtemplate, | |
8057 (char *)p - (char *)pdlgtemplate); | |
8058 p = newp + (p - pdlgtemplate); | |
8059 pnumitems = newp + (pnumitems - pdlgtemplate); | |
8060 ptrueheight = newp + (ptrueheight - pdlgtemplate); | |
8061 LocalFree(LocalHandle(pdlgtemplate)); | |
8062 pdlgtemplate = newp; | |
8063 } | |
8064 } | |
8065 | |
8066 /* Figure out minimal length of this menu label. Use "name" for the | |
8067 * actual text, "dname" for estimating the displayed size. "name" | |
8068 * has "&a" for mnemonic and includes the accelerator. */ | |
8069 len = nameLen = (int)STRLEN(menu->name); | |
8070 padding0 = (columnWidths[0] - GetTextWidthEnc(hdc, menu->dname, | |
8071 (int)STRLEN(menu->dname))) / spaceWidth; | |
8072 len += padding0; | |
8073 | |
8074 if (menu->actext != NULL) | |
8075 { | |
8076 acLen = (int)STRLEN(menu->actext); | |
8077 len += acLen; | |
8078 textWidth = GetTextWidthEnc(hdc, menu->actext, acLen); | |
8079 } | |
8080 else | |
8081 textWidth = 0; | |
8082 padding1 = (columnWidths[1] - textWidth) / spaceWidth; | |
8083 len += padding1; | |
8084 | |
8085 if (menu->children == NULL) | |
8086 { | |
8087 padding2 = submenuWidth / spaceWidth; | |
8088 len += padding2; | |
8089 menuID = (WORD)(menu->id); | |
8090 } | |
8091 else | |
8092 { | |
8093 len += (int)STRLEN(TEAROFF_SUBMENU_LABEL); | |
840 | 8094 menuID = (WORD)((long_u)(menu->submenu_id) | (DWORD)0x8000); |
7 | 8095 } |
8096 | |
8097 /* Allocate menu label and fill it in */ | |
8098 text = label = alloc((unsigned)len + 1); | |
8099 if (label == NULL) | |
8100 break; | |
8101 | |
419 | 8102 vim_strncpy(text, menu->name, nameLen); |
7 | 8103 text = vim_strchr(text, TAB); /* stop at TAB before actext */ |
8104 if (text == NULL) | |
8105 text = label + nameLen; /* no actext, use whole name */ | |
8106 while (padding0-- > 0) | |
8107 *text++ = ' '; | |
8108 if (menu->actext != NULL) | |
8109 { | |
8110 STRNCPY(text, menu->actext, acLen); | |
8111 text += acLen; | |
8112 } | |
8113 while (padding1-- > 0) | |
8114 *text++ = ' '; | |
8115 if (menu->children != NULL) | |
8116 { | |
8117 STRCPY(text, TEAROFF_SUBMENU_LABEL); | |
8118 text += STRLEN(TEAROFF_SUBMENU_LABEL); | |
8119 } | |
8120 else | |
8121 { | |
8122 while (padding2-- > 0) | |
8123 *text++ = ' '; | |
8124 } | |
8125 *text = NUL; | |
8126 | |
8127 /* | |
8128 * BS_LEFT will just be ignored on Win32s/NT3.5x - on | |
8129 * W95/NT4 it makes the tear-off look more like a menu. | |
8130 */ | |
8131 p = add_dialog_element(p, | |
8132 BS_PUSHBUTTON|BS_LEFT, | |
8133 (WORD)PixelToDialogX(TEAROFF_PADDING_X), | |
8134 (WORD)(sepPadding + 1 + 13 * (*pnumitems)), | |
8135 (WORD)PixelToDialogX(dlgwidth - 2 * TEAROFF_PADDING_X), | |
8136 (WORD)12, | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
8137 menuID, (WORD)0x0080, (char *)label); |
7 | 8138 vim_free(label); |
8139 (*pnumitems)++; | |
8140 } | |
8141 | |
8142 *ptrueheight = (WORD)(sepPadding + 1 + 13 * (*pnumitems)); | |
8143 | |
8144 | |
8145 /* 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
|
8146 the_menu->tearoff_handle = CreateDialogIndirectParam( |
7 | 8147 s_hinst, |
8148 (LPDLGTEMPLATE)pdlgtemplate, | |
8149 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
|
8150 (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
|
8151 (LPARAM)top_menu); |
7 | 8152 |
8153 LocalFree(LocalHandle(pdlgtemplate)); | |
8154 SelectFont(hdc, oldFont); | |
8155 DeleteObject(font); | |
8156 ReleaseDC(hwnd, hdc); | |
8157 | |
8158 /* | |
8159 * Reassert ourselves as the active window. This is so that after creating | |
8160 * a tearoff, the user doesn't have to click with the mouse just to start | |
8161 * typing again! | |
8162 */ | |
8163 (void)SetActiveWindow(s_hwnd); | |
8164 | |
8165 /* make sure the right buttons are enabled */ | |
8166 force_menu_update = TRUE; | |
8167 } | |
8168 #endif | |
8169 | |
8170 #if defined(FEAT_TOOLBAR) || defined(PROTO) | |
8171 #include "gui_w32_rc.h" | |
8172 | |
8173 /* This not defined in older SDKs */ | |
8174 # ifndef TBSTYLE_FLAT | |
8175 # define TBSTYLE_FLAT 0x0800 | |
8176 # endif | |
8177 | |
8178 /* | |
8179 * Create the toolbar, initially unpopulated. | |
8180 * (just like the menu, there are no defaults, it's all | |
8181 * set up through menu.vim) | |
8182 */ | |
8183 static void | |
8184 initialise_toolbar(void) | |
8185 { | |
8186 InitCommonControls(); | |
8187 s_toolbarhwnd = CreateToolbarEx( | |
8188 s_hwnd, | |
8189 WS_CHILD | TBSTYLE_TOOLTIPS | TBSTYLE_FLAT, | |
8190 4000, //any old big number | |
1213 | 8191 31, //number of images in initial bitmap |
7 | 8192 s_hinst, |
8193 IDR_TOOLBAR1, // id of initial bitmap | |
8194 NULL, | |
8195 0, // initial number of buttons | |
8196 TOOLBAR_BUTTON_WIDTH, //api guide is wrong! | |
8197 TOOLBAR_BUTTON_HEIGHT, | |
8198 TOOLBAR_BUTTON_WIDTH, | |
8199 TOOLBAR_BUTTON_HEIGHT, | |
8200 sizeof(TBBUTTON) | |
8201 ); | |
5223
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8202 s_toolbar_wndproc = SubclassWindow(s_toolbarhwnd, toolbar_wndproc); |
7 | 8203 |
8204 gui_mch_show_toolbar(vim_strchr(p_go, GO_TOOLBAR) != NULL); | |
8205 } | |
8206 | |
5223
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8207 static LRESULT CALLBACK |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8208 toolbar_wndproc( |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8209 HWND hwnd, |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8210 UINT uMsg, |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8211 WPARAM wParam, |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8212 LPARAM lParam) |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8213 { |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8214 HandleMouseHide(uMsg, lParam); |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8215 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
|
8216 } |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8217 |
7 | 8218 static int |
8219 get_toolbar_bitmap(vimmenu_T *menu) | |
8220 { | |
8221 int i = -1; | |
8222 | |
8223 /* | |
8224 * Check user bitmaps first, unless builtin is specified. | |
8225 */ | |
10264
c036c0f636d5
commit https://github.com/vim/vim/commit/cea912af725c54f4727a0565e31661f6b29c6bb1
Christian Brabandt <cb@256bit.org>
parents:
10042
diff
changeset
|
8226 if (!menu->icon_builtin) |
7 | 8227 { |
8228 char_u fname[MAXPATHL]; | |
8229 HANDLE hbitmap = NULL; | |
8230 | |
8231 if (menu->iconfile != NULL) | |
8232 { | |
8233 gui_find_iconfile(menu->iconfile, fname, "bmp"); | |
8234 hbitmap = LoadImage( | |
8235 NULL, | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
8236 (LPCSTR)fname, |
7 | 8237 IMAGE_BITMAP, |
8238 TOOLBAR_BUTTON_WIDTH, | |
8239 TOOLBAR_BUTTON_HEIGHT, | |
8240 LR_LOADFROMFILE | | |
8241 LR_LOADMAP3DCOLORS | |
8242 ); | |
8243 } | |
8244 | |
8245 /* | |
8246 * If the LoadImage call failed, or the "icon=" file | |
8247 * didn't exist or wasn't specified, try the menu name | |
8248 */ | |
8249 if (hbitmap == NULL | |
5020
5eff37e92f03
updated for version 7.3.1254
Bram Moolenaar <bram@vim.org>
parents:
5016
diff
changeset
|
8250 && (gui_find_bitmap( |
5eff37e92f03
updated for version 7.3.1254
Bram Moolenaar <bram@vim.org>
parents:
5016
diff
changeset
|
8251 #ifdef FEAT_MULTI_LANG |
5eff37e92f03
updated for version 7.3.1254
Bram Moolenaar <bram@vim.org>
parents:
5016
diff
changeset
|
8252 menu->en_dname != NULL ? menu->en_dname : |
5eff37e92f03
updated for version 7.3.1254
Bram Moolenaar <bram@vim.org>
parents:
5016
diff
changeset
|
8253 #endif |
5eff37e92f03
updated for version 7.3.1254
Bram Moolenaar <bram@vim.org>
parents:
5016
diff
changeset
|
8254 menu->dname, fname, "bmp") == OK)) |
7 | 8255 hbitmap = LoadImage( |
8256 NULL, | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
8257 (LPCSTR)fname, |
7 | 8258 IMAGE_BITMAP, |
8259 TOOLBAR_BUTTON_WIDTH, | |
8260 TOOLBAR_BUTTON_HEIGHT, | |
8261 LR_LOADFROMFILE | | |
8262 LR_LOADMAP3DCOLORS | |
8263 ); | |
8264 | |
8265 if (hbitmap != NULL) | |
8266 { | |
8267 TBADDBITMAP tbAddBitmap; | |
8268 | |
8269 tbAddBitmap.hInst = NULL; | |
840 | 8270 tbAddBitmap.nID = (long_u)hbitmap; |
7 | 8271 |
8272 i = (int)SendMessage(s_toolbarhwnd, TB_ADDBITMAP, | |
8273 (WPARAM)1, (LPARAM)&tbAddBitmap); | |
8274 /* i will be set to -1 if it fails */ | |
8275 } | |
8276 } | |
8277 if (i == -1 && menu->iconidx >= 0 && menu->iconidx < TOOLBAR_BITMAP_COUNT) | |
8278 i = menu->iconidx; | |
8279 | |
8280 return i; | |
8281 } | |
8282 #endif | |
8283 | |
810 | 8284 #if defined(FEAT_GUI_TABLINE) || defined(PROTO) |
8285 static void | |
8286 initialise_tabline(void) | |
8287 { | |
8288 InitCommonControls(); | |
8289 | |
819 | 8290 s_tabhwnd = CreateWindow(WC_TABCONTROL, "Vim tabline", |
840 | 8291 WS_CHILD|TCS_FOCUSNEVER|TCS_TOOLTIPS, |
810 | 8292 CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, |
8293 CW_USEDEFAULT, s_hwnd, NULL, s_hinst, NULL); | |
5223
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8294 s_tabline_wndproc = SubclassWindow(s_tabhwnd, tabline_wndproc); |
819 | 8295 |
843 | 8296 gui.tabline_height = TABLINE_HEIGHT; |
8297 | |
819 | 8298 # ifdef USE_SYSMENU_FONT |
843 | 8299 set_tabline_font(); |
819 | 8300 # endif |
810 | 8301 } |
5223
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8302 |
12666
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8303 /* |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8304 * 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
|
8305 */ |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8306 static tabpage_T * |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8307 GetTabFromPoint( |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8308 HWND hWnd, |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8309 POINT pt) |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8310 { |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8311 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
|
8312 |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8313 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
|
8314 { |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8315 TCHITTESTINFO htinfo; |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8316 htinfo.pt = pt; |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8317 /* 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
|
8318 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
|
8319 { |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8320 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
|
8321 if (idx != -1) |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8322 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
|
8323 } |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8324 } |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8325 return ptp; |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8326 } |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8327 |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8328 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
|
8329 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
|
8330 |
5223
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8331 static LRESULT CALLBACK |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8332 tabline_wndproc( |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8333 HWND hwnd, |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8334 UINT uMsg, |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8335 WPARAM wParam, |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8336 LPARAM lParam) |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8337 { |
12666
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8338 POINT pt; |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8339 tabpage_T *tp; |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8340 RECT rect; |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8341 int nCenter; |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8342 int idx0; |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8343 int idx1; |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8344 |
5223
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8345 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
|
8346 |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8347 switch (uMsg) |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8348 { |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8349 case WM_LBUTTONDOWN: |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8350 { |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8351 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
|
8352 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
|
8353 SetCapture(hwnd); |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8354 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
|
8355 break; |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8356 } |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8357 case WM_MOUSEMOVE: |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8358 if (GetCapture() == hwnd |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8359 && ((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
|
8360 { |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8361 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
|
8362 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
|
8363 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
|
8364 { |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8365 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
|
8366 |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8367 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
|
8368 if (tp != NULL) |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8369 { |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8370 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
|
8371 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
|
8372 |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8373 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
|
8374 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
|
8375 |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8376 /* 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
|
8377 * 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
|
8378 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
|
8379 { |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8380 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
|
8381 update_screen(0); |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8382 } |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8383 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
|
8384 { |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8385 tabpage_move(idx1); |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8386 update_screen(0); |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8387 } |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8388 } |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8389 } |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8390 } |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8391 break; |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8392 case WM_LBUTTONUP: |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8393 { |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8394 if (GetCapture() == hwnd) |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8395 { |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8396 SetCursor(s_hCursor); |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8397 ReleaseCapture(); |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8398 } |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8399 break; |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8400 } |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8401 default: |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8402 break; |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8403 } |
856a840679e3
patch 8.0.1211: cannot reorder tab pages with drag & drop
Christian Brabandt <cb@256bit.org>
parents:
12543
diff
changeset
|
8404 |
5223
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8405 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
|
8406 } |
810 | 8407 #endif |
8408 | |
7 | 8409 #if defined(FEAT_OLE) || defined(FEAT_EVAL) || defined(PROTO) |
8410 /* | |
8411 * Make the GUI window come to the foreground. | |
8412 */ | |
8413 void | |
8414 gui_mch_set_foreground(void) | |
8415 { | |
8416 if (IsIconic(s_hwnd)) | |
8417 SendMessage(s_hwnd, WM_SYSCOMMAND, SC_RESTORE, 0); | |
8418 SetForegroundWindow(s_hwnd); | |
8419 } | |
8420 #endif | |
8421 | |
8422 #if defined(FEAT_MBYTE_IME) && defined(DYNAMIC_IME) | |
8423 static void | |
8424 dyn_imm_load(void) | |
8425 { | |
2612 | 8426 hLibImm = vimLoadLib("imm32.dll"); |
7 | 8427 if (hLibImm == NULL) |
8428 return; | |
8429 | |
8430 pImmGetCompositionStringA | |
8431 = (void *)GetProcAddress(hLibImm, "ImmGetCompositionStringA"); | |
8432 pImmGetCompositionStringW | |
8433 = (void *)GetProcAddress(hLibImm, "ImmGetCompositionStringW"); | |
8434 pImmGetContext | |
8435 = (void *)GetProcAddress(hLibImm, "ImmGetContext"); | |
8436 pImmAssociateContext | |
8437 = (void *)GetProcAddress(hLibImm, "ImmAssociateContext"); | |
8438 pImmReleaseContext | |
8439 = (void *)GetProcAddress(hLibImm, "ImmReleaseContext"); | |
8440 pImmGetOpenStatus | |
8441 = (void *)GetProcAddress(hLibImm, "ImmGetOpenStatus"); | |
8442 pImmSetOpenStatus | |
8443 = (void *)GetProcAddress(hLibImm, "ImmSetOpenStatus"); | |
8444 pImmGetCompositionFont | |
8445 = (void *)GetProcAddress(hLibImm, "ImmGetCompositionFontA"); | |
8446 pImmSetCompositionFont | |
8447 = (void *)GetProcAddress(hLibImm, "ImmSetCompositionFontA"); | |
8448 pImmSetCompositionWindow | |
8449 = (void *)GetProcAddress(hLibImm, "ImmSetCompositionWindow"); | |
8450 pImmGetConversionStatus | |
8451 = (void *)GetProcAddress(hLibImm, "ImmGetConversionStatus"); | |
777 | 8452 pImmSetConversionStatus |
8453 = (void *)GetProcAddress(hLibImm, "ImmSetConversionStatus"); | |
7 | 8454 |
8455 if ( pImmGetCompositionStringA == NULL | |
8456 || pImmGetCompositionStringW == NULL | |
8457 || pImmGetContext == NULL | |
8458 || pImmAssociateContext == NULL | |
8459 || pImmReleaseContext == NULL | |
8460 || pImmGetOpenStatus == NULL | |
8461 || pImmSetOpenStatus == NULL | |
8462 || pImmGetCompositionFont == NULL | |
8463 || pImmSetCompositionFont == NULL | |
8464 || pImmSetCompositionWindow == NULL | |
777 | 8465 || pImmGetConversionStatus == NULL |
8466 || pImmSetConversionStatus == NULL) | |
7 | 8467 { |
8468 FreeLibrary(hLibImm); | |
8469 hLibImm = NULL; | |
8470 pImmGetContext = NULL; | |
8471 return; | |
8472 } | |
8473 | |
8474 return; | |
8475 } | |
8476 | |
8477 #endif | |
8478 | |
8479 #if defined(FEAT_SIGN_ICONS) || defined(PROTO) | |
8480 | |
8481 # ifdef FEAT_XPM_W32 | |
8482 # define IMAGE_XPM 100 | |
8483 # endif | |
8484 | |
8485 typedef struct _signicon_t | |
8486 { | |
8487 HANDLE hImage; | |
8488 UINT uType; | |
8489 #ifdef FEAT_XPM_W32 | |
8490 HANDLE hShape; /* Mask bitmap handle */ | |
8491 #endif | |
8492 } signicon_t; | |
8493 | |
8494 void | |
7823
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8495 gui_mch_drawsign(int row, int col, int typenr) |
7 | 8496 { |
8497 signicon_t *sign; | |
8498 int x, y, w, h; | |
8499 | |
8500 if (!gui.in_use || (sign = (signicon_t *)sign_get_image(typenr)) == NULL) | |
8501 return; | |
8502 | |
12934
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
8503 #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
|
8504 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
|
8505 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
|
8506 #endif |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
8507 |
7 | 8508 x = TEXT_X(col); |
8509 y = TEXT_Y(row); | |
8510 w = gui.char_width * 2; | |
8511 h = gui.char_height; | |
8512 switch (sign->uType) | |
8513 { | |
8514 case IMAGE_BITMAP: | |
8515 { | |
8516 HDC hdcMem; | |
8517 HBITMAP hbmpOld; | |
8518 | |
8519 hdcMem = CreateCompatibleDC(s_hdc); | |
8520 hbmpOld = (HBITMAP)SelectObject(hdcMem, sign->hImage); | |
8521 BitBlt(s_hdc, x, y, w, h, hdcMem, 0, 0, SRCCOPY); | |
8522 SelectObject(hdcMem, hbmpOld); | |
8523 DeleteDC(hdcMem); | |
8524 } | |
8525 break; | |
8526 case IMAGE_ICON: | |
8527 case IMAGE_CURSOR: | |
8528 DrawIconEx(s_hdc, x, y, (HICON)sign->hImage, w, h, 0, NULL, DI_NORMAL); | |
8529 break; | |
8530 #ifdef FEAT_XPM_W32 | |
8531 case IMAGE_XPM: | |
8532 { | |
8533 HDC hdcMem; | |
8534 HBITMAP hbmpOld; | |
8535 | |
8536 hdcMem = CreateCompatibleDC(s_hdc); | |
8537 hbmpOld = (HBITMAP)SelectObject(hdcMem, sign->hShape); | |
8538 /* Make hole */ | |
8539 BitBlt(s_hdc, x, y, w, h, hdcMem, 0, 0, SRCAND); | |
8540 | |
8541 SelectObject(hdcMem, sign->hImage); | |
8542 /* Paint sign */ | |
8543 BitBlt(s_hdc, x, y, w, h, hdcMem, 0, 0, SRCPAINT); | |
8544 SelectObject(hdcMem, hbmpOld); | |
8545 DeleteDC(hdcMem); | |
8546 } | |
8547 break; | |
8548 #endif | |
8549 } | |
8550 } | |
8551 | |
8552 static void | |
8553 close_signicon_image(signicon_t *sign) | |
8554 { | |
8555 if (sign) | |
8556 switch (sign->uType) | |
8557 { | |
8558 case IMAGE_BITMAP: | |
8559 DeleteObject((HGDIOBJ)sign->hImage); | |
8560 break; | |
8561 case IMAGE_CURSOR: | |
8562 DestroyCursor((HCURSOR)sign->hImage); | |
8563 break; | |
8564 case IMAGE_ICON: | |
8565 DestroyIcon((HICON)sign->hImage); | |
8566 break; | |
8567 #ifdef FEAT_XPM_W32 | |
8568 case IMAGE_XPM: | |
8569 DeleteObject((HBITMAP)sign->hImage); | |
8570 DeleteObject((HBITMAP)sign->hShape); | |
8571 break; | |
8572 #endif | |
8573 } | |
8574 } | |
8575 | |
8576 void * | |
7823
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8577 gui_mch_register_sign(char_u *signfile) |
7 | 8578 { |
8579 signicon_t sign, *psign; | |
8580 char_u *ext; | |
8581 | |
8582 sign.hImage = NULL; | |
4352 | 8583 ext = signfile + STRLEN(signfile) - 4; /* get extension */ |
7 | 8584 if (ext > signfile) |
8585 { | |
8586 int do_load = 1; | |
8587 | |
8588 if (!STRICMP(ext, ".bmp")) | |
8589 sign.uType = IMAGE_BITMAP; | |
8590 else if (!STRICMP(ext, ".ico")) | |
8591 sign.uType = IMAGE_ICON; | |
8592 else if (!STRICMP(ext, ".cur") || !STRICMP(ext, ".ani")) | |
8593 sign.uType = IMAGE_CURSOR; | |
8594 else | |
8595 do_load = 0; | |
8596 | |
8597 if (do_load) | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
8598 sign.hImage = (HANDLE)LoadImage(NULL, (LPCSTR)signfile, sign.uType, |
7 | 8599 gui.char_width * 2, gui.char_height, |
8600 LR_LOADFROMFILE | LR_CREATEDIBSECTION); | |
8601 #ifdef FEAT_XPM_W32 | |
8602 if (!STRICMP(ext, ".xpm")) | |
8603 { | |
8604 sign.uType = IMAGE_XPM; | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
8605 LoadXpmImage((char *)signfile, (HBITMAP *)&sign.hImage, |
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
8606 (HBITMAP *)&sign.hShape); |
7 | 8607 } |
8608 #endif | |
8609 } | |
8610 | |
8611 psign = NULL; | |
8612 if (sign.hImage && (psign = (signicon_t *)alloc(sizeof(signicon_t))) | |
8613 != NULL) | |
8614 *psign = sign; | |
8615 | |
8616 if (!psign) | |
8617 { | |
8618 if (sign.hImage) | |
8619 close_signicon_image(&sign); | |
8620 EMSG(_(e_signdata)); | |
8621 } | |
8622 return (void *)psign; | |
8623 | |
8624 } | |
8625 | |
8626 void | |
7823
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8627 gui_mch_destroy_sign(void *sign) |
7 | 8628 { |
8629 if (sign) | |
8630 { | |
8631 close_signicon_image((signicon_t *)sign); | |
8632 vim_free(sign); | |
8633 } | |
8634 } | |
293 | 8635 #endif |
7 | 8636 |
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
|
8637 #if defined(FEAT_BEVAL_GUI) || defined(PROTO) |
7 | 8638 |
8639 /* BALLOON-EVAL IMPLEMENTATION FOR WINDOWS. | |
148 | 8640 * Added by Sergey Khorev <sergey.khorev@gmail.com> |
7 | 8641 * |
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
|
8642 * The only reused thing is beval.h and get_beval_info() |
7 | 8643 * from gui_beval.c (note it uses x and y of the BalloonEval struct |
8644 * to get current mouse position). | |
8645 * | |
8646 * Trying to use as more Windows services as possible, and as less | |
8647 * IE version as possible :)). | |
8648 * | |
8649 * 1) Don't create ToolTip in gui_mch_create_beval_area, only initialize | |
8650 * BalloonEval struct. | |
8651 * 2) Enable/Disable simply create/kill BalloonEval Timer | |
8652 * 3) When there was enough inactivity, timer procedure posts | |
8653 * async request to debugger | |
8654 * 4) gui_mch_post_balloon (invoked from netbeans.c) creates tooltip control | |
8655 * and performs some actions to show it ASAP | |
1621 | 8656 * 5) WM_NOTIFY:TTN_POP destroys created tooltip |
7 | 8657 */ |
8658 | |
435 | 8659 /* |
8660 * determine whether installed Common Controls support multiline tooltips | |
8661 * (i.e. their version is >= 4.70 | |
8662 */ | |
8663 int | |
8664 multiline_balloon_available(void) | |
8665 { | |
8666 HINSTANCE hDll; | |
8667 static char comctl_dll[] = "comctl32.dll"; | |
8668 static int multiline_tip = MAYBE; | |
8669 | |
8670 if (multiline_tip != MAYBE) | |
8671 return multiline_tip; | |
8672 | |
8673 hDll = GetModuleHandle(comctl_dll); | |
8674 if (hDll != NULL) | |
8675 { | |
856 | 8676 DLLGETVERSIONPROC pGetVer; |
8677 pGetVer = (DLLGETVERSIONPROC)GetProcAddress(hDll, "DllGetVersion"); | |
8678 | |
8679 if (pGetVer != NULL) | |
8680 { | |
8681 DLLVERSIONINFO dvi; | |
8682 HRESULT hr; | |
8683 | |
8684 ZeroMemory(&dvi, sizeof(dvi)); | |
8685 dvi.cbSize = sizeof(dvi); | |
8686 | |
8687 hr = (*pGetVer)(&dvi); | |
8688 | |
8689 if (SUCCEEDED(hr) | |
435 | 8690 && (dvi.dwMajorVersion > 4 |
856 | 8691 || (dvi.dwMajorVersion == 4 |
8692 && dvi.dwMinorVersion >= 70))) | |
435 | 8693 { |
8694 multiline_tip = TRUE; | |
8695 return multiline_tip; | |
8696 } | |
856 | 8697 } |
435 | 8698 else |
8699 { | |
8700 /* there is chance we have ancient CommCtl 4.70 | |
8701 which doesn't export DllGetVersion */ | |
8702 DWORD dwHandle = 0; | |
8703 DWORD len = GetFileVersionInfoSize(comctl_dll, &dwHandle); | |
8704 if (len > 0) | |
8705 { | |
8706 VS_FIXEDFILEINFO *ver; | |
8707 UINT vlen = 0; | |
8708 void *data = alloc(len); | |
8709 | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
8710 if ((data != NULL |
435 | 8711 && GetFileVersionInfo(comctl_dll, 0, len, data) |
8712 && VerQueryValue(data, "\\", (void **)&ver, &vlen) | |
8713 && vlen | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
8714 && HIWORD(ver->dwFileVersionMS) > 4) |
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
8715 || ((HIWORD(ver->dwFileVersionMS) == 4 |
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
8716 && LOWORD(ver->dwFileVersionMS) >= 70))) |
435 | 8717 { |
8718 vim_free(data); | |
8719 multiline_tip = TRUE; | |
8720 return multiline_tip; | |
8721 } | |
8722 vim_free(data); | |
8723 } | |
8724 } | |
8725 } | |
8726 multiline_tip = FALSE; | |
8727 return multiline_tip; | |
8728 } | |
8729 | |
7 | 8730 static void |
7823
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8731 make_tooltip(BalloonEval *beval, char *text, POINT pt) |
7 | 8732 { |
435 | 8733 TOOLINFO *pti; |
8734 int ToolInfoSize; | |
8735 | |
8736 if (multiline_balloon_available() == TRUE) | |
8737 ToolInfoSize = sizeof(TOOLINFO_NEW); | |
8738 else | |
8739 ToolInfoSize = sizeof(TOOLINFO); | |
8740 | |
8741 pti = (TOOLINFO *)alloc(ToolInfoSize); | |
8742 if (pti == NULL) | |
8743 return; | |
7 | 8744 |
8745 beval->balloon = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, | |
8746 NULL, WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP, | |
8747 CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, | |
8748 beval->target, NULL, s_hinst, NULL); | |
8749 | |
8750 SetWindowPos(beval->balloon, HWND_TOPMOST, 0, 0, 0, 0, | |
8751 SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); | |
8752 | |
435 | 8753 pti->cbSize = ToolInfoSize; |
8754 pti->uFlags = TTF_SUBCLASS; | |
8755 pti->hwnd = beval->target; | |
8756 pti->hinst = 0; /* Don't use string resources */ | |
8757 pti->uId = ID_BEVAL_TOOLTIP; | |
8758 | |
8759 if (multiline_balloon_available() == TRUE) | |
8760 { | |
8761 RECT rect; | |
8762 TOOLINFO_NEW *ptin = (TOOLINFO_NEW *)pti; | |
8763 pti->lpszText = LPSTR_TEXTCALLBACK; | |
8764 ptin->lParam = (LPARAM)text; | |
8765 if (GetClientRect(s_textArea, &rect)) /* switch multiline tooltips on */ | |
8766 SendMessage(beval->balloon, TTM_SETMAXTIPWIDTH, 0, | |
8767 (LPARAM)rect.right); | |
8768 } | |
8769 else | |
8770 pti->lpszText = text; /* do this old way */ | |
7 | 8771 |
8772 /* Limit ballooneval bounding rect to CursorPos neighbourhood */ | |
435 | 8773 pti->rect.left = pt.x - 3; |
8774 pti->rect.top = pt.y - 3; | |
8775 pti->rect.right = pt.x + 3; | |
8776 pti->rect.bottom = pt.y + 3; | |
8777 | |
8778 SendMessage(beval->balloon, TTM_ADDTOOL, 0, (LPARAM)pti); | |
7 | 8779 /* Make tooltip appear sooner */ |
8780 SendMessage(beval->balloon, TTM_SETDELAYTIME, TTDT_INITIAL, 10); | |
1489 | 8781 /* I've performed some tests and it seems the longest possible life time |
8782 * of tooltip is 30 seconds */ | |
8783 SendMessage(beval->balloon, TTM_SETDELAYTIME, TTDT_AUTOPOP, 30000); | |
7 | 8784 /* |
8785 * HACK: force tooltip to appear, because it'll not appear until | |
8786 * first mouse move. D*mn M$ | |
1489 | 8787 * Amazingly moving (2, 2) and then (-1, -1) the mouse doesn't move. |
7 | 8788 */ |
1489 | 8789 mouse_event(MOUSEEVENTF_MOVE, 2, 2, 0, 0); |
7 | 8790 mouse_event(MOUSEEVENTF_MOVE, (DWORD)-1, (DWORD)-1, 0, 0); |
435 | 8791 vim_free(pti); |
7 | 8792 } |
8793 | |
8794 static void | |
7823
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8795 delete_tooltip(BalloonEval *beval) |
7 | 8796 { |
7056
1ebd7608cfd9
commit https://github.com/vim/vim/commit/8e5f5b47c2198ffa4161c21a4140eaa9bed46f37
Christian Brabandt <cb@256bit.org>
parents:
7032
diff
changeset
|
8797 PostMessage(beval->balloon, WM_CLOSE, 0, 0); |
7 | 8798 } |
8799 | |
8800 static VOID CALLBACK | |
7823
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8801 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
|
8802 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
|
8803 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
|
8804 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
|
8805 DWORD dwTime) |
7 | 8806 { |
8807 POINT pt; | |
8808 RECT rect; | |
8809 | |
8810 if (cur_beval == NULL || cur_beval->showState == ShS_SHOWING || !p_beval) | |
8811 return; | |
8812 | |
8813 GetCursorPos(&pt); | |
8814 if (WindowFromPoint(pt) != s_textArea) | |
8815 return; | |
8816 | |
8817 ScreenToClient(s_textArea, &pt); | |
8818 GetClientRect(s_textArea, &rect); | |
8819 if (!PtInRect(&rect, pt)) | |
8820 return; | |
8821 | |
8822 if (LastActivity > 0 | |
8823 && (dwTime - LastActivity) >= (DWORD)p_bdlay | |
8824 && (cur_beval->showState != ShS_PENDING | |
8825 || abs(cur_beval->x - pt.x) > 3 | |
8826 || abs(cur_beval->y - pt.y) > 3)) | |
8827 { | |
8828 /* Pointer resting in one place long enough, it's time to show | |
8829 * the tooltip. */ | |
8830 cur_beval->showState = ShS_PENDING; | |
8831 cur_beval->x = pt.x; | |
8832 cur_beval->y = pt.y; | |
8833 | |
205 | 8834 // TRACE0("BevalTimerProc: sending request"); |
7 | 8835 |
8836 if (cur_beval->msgCB != NULL) | |
8837 (*cur_beval->msgCB)(cur_beval, 0); | |
8838 } | |
8839 } | |
8840 | |
8841 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
|
8842 gui_mch_disable_beval_area(BalloonEval *beval UNUSED) |
7 | 8843 { |
205 | 8844 // TRACE0("gui_mch_disable_beval_area {{{"); |
7 | 8845 KillTimer(s_textArea, BevalTimerId); |
205 | 8846 // TRACE0("gui_mch_disable_beval_area }}}"); |
7 | 8847 } |
8848 | |
8849 void | |
7823
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8850 gui_mch_enable_beval_area(BalloonEval *beval) |
7 | 8851 { |
205 | 8852 // TRACE0("gui_mch_enable_beval_area |||"); |
7 | 8853 if (beval == NULL) |
8854 return; | |
205 | 8855 // 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
|
8856 BevalTimerId = SetTimer(s_textArea, 0, (UINT)(p_bdlay / 2), BevalTimerProc); |
205 | 8857 // TRACE0("gui_mch_enable_beval_area }}}"); |
7 | 8858 } |
8859 | |
8860 void | |
7823
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8861 gui_mch_post_balloon(BalloonEval *beval, char_u *mesg) |
7 | 8862 { |
8863 POINT pt; | |
11129
f4ea50924c6d
patch 8.0.0452: some macros are in lower case
Christian Brabandt <cb@256bit.org>
parents:
10783
diff
changeset
|
8864 |
205 | 8865 // TRACE0("gui_mch_post_balloon {{{"); |
7 | 8866 if (beval->showState == ShS_SHOWING) |
8867 return; | |
8868 GetCursorPos(&pt); | |
8869 ScreenToClient(s_textArea, &pt); | |
8870 | |
8871 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
|
8872 { |
7 | 8873 /* cursor is still here */ |
8874 gui_mch_disable_beval_area(cur_beval); | |
8875 beval->showState = ShS_SHOWING; | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
8876 make_tooltip(beval, (char *)mesg, pt); |
7 | 8877 } |
205 | 8878 // TRACE0("gui_mch_post_balloon }}}"); |
7 | 8879 } |
8880 | |
8881 BalloonEval * | |
7823
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8882 gui_mch_create_beval_area( |
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8883 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
|
8884 char_u *mesg, |
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8885 void (*mesgCB)(BalloonEval *, int), |
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8886 void *clientData) |
7 | 8887 { |
8888 /* partially stolen from gui_beval.c */ | |
8889 BalloonEval *beval; | |
8890 | |
8891 if (mesg != NULL && mesgCB != NULL) | |
8892 { | |
10359
66f1b5bf3fa6
commit https://github.com/vim/vim/commit/95f096030ed1a8afea028f2ea295d6f6a70f466f
Christian Brabandt <cb@256bit.org>
parents:
10264
diff
changeset
|
8893 IEMSG(_("E232: Cannot create BalloonEval with both message and callback")); |
7 | 8894 return NULL; |
8895 } | |
8896 | |
8897 beval = (BalloonEval *)alloc(sizeof(BalloonEval)); | |
8898 if (beval != NULL) | |
8899 { | |
8900 beval->target = s_textArea; | |
8901 beval->balloon = NULL; | |
8902 | |
8903 beval->showState = ShS_NEUTRAL; | |
8904 beval->x = 0; | |
8905 beval->y = 0; | |
8906 beval->msg = mesg; | |
8907 beval->msgCB = mesgCB; | |
8908 beval->clientData = clientData; | |
8909 | |
8910 InitCommonControls(); | |
8911 cur_beval = beval; | |
8912 | |
8913 if (p_beval) | |
8914 gui_mch_enable_beval_area(beval); | |
8915 | |
8916 } | |
8917 return beval; | |
8918 } | |
8919 | |
8920 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
|
8921 Handle_WM_Notify(HWND hwnd UNUSED, LPNMHDR pnmh) |
7 | 8922 { |
8923 if (pnmh->idFrom != ID_BEVAL_TOOLTIP) /* it is not our tooltip */ | |
8924 return; | |
8925 | |
8926 if (cur_beval != NULL) | |
8927 { | |
435 | 8928 switch (pnmh->code) |
7 | 8929 { |
435 | 8930 case TTN_SHOW: |
205 | 8931 // TRACE0("TTN_SHOW {{{"); |
8932 // TRACE0("TTN_SHOW }}}"); | |
435 | 8933 break; |
8934 case TTN_POP: /* Before tooltip disappear */ | |
205 | 8935 // TRACE0("TTN_POP {{{"); |
7 | 8936 delete_tooltip(cur_beval); |
8937 gui_mch_enable_beval_area(cur_beval); | |
205 | 8938 // TRACE0("TTN_POP }}}"); |
7 | 8939 |
8940 cur_beval->showState = ShS_NEUTRAL; | |
435 | 8941 break; |
8942 case TTN_GETDISPINFO: | |
1481 | 8943 { |
8944 /* if you get there then we have new common controls */ | |
8945 NMTTDISPINFO_NEW *info = (NMTTDISPINFO_NEW *)pnmh; | |
8946 info->lpszText = (LPSTR)info->lParam; | |
8947 info->uFlags |= TTF_DI_SETITEM; | |
8948 } | |
435 | 8949 break; |
7 | 8950 } |
8951 } | |
8952 } | |
8953 | |
8954 static void | |
8955 TrackUserActivity(UINT uMsg) | |
8956 { | |
8957 if ((uMsg >= WM_MOUSEFIRST && uMsg <= WM_MOUSELAST) | |
8958 || (uMsg >= WM_KEYFIRST && uMsg <= WM_KEYLAST)) | |
8959 LastActivity = GetTickCount(); | |
8960 } | |
8961 | |
8962 void | |
7823
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8963 gui_mch_destroy_beval_area(BalloonEval *beval) |
7 | 8964 { |
8965 vim_free(beval); | |
8966 } | |
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
|
8967 #endif /* FEAT_BEVAL_GUI */ |
7 | 8968 |
8969 #if defined(FEAT_NETBEANS_INTG) || defined(PROTO) | |
8970 /* | |
8971 * We have multiple signs to draw at the same location. Draw the | |
8972 * multi-sign indicator (down-arrow) instead. This is the Win32 version. | |
8973 */ | |
8974 void | |
8975 netbeans_draw_multisign_indicator(int row) | |
8976 { | |
8977 int i; | |
8978 int y; | |
8979 int x; | |
8980 | |
2210 | 8981 if (!netbeans_active()) |
2311
ccda151dde4e
Support completion for ":find". (Nazri Ramliy)
Bram Moolenaar <bram@vim.org>
parents:
2224
diff
changeset
|
8982 return; |
2210 | 8983 |
7 | 8984 x = 0; |
8985 y = TEXT_Y(row); | |
8986 | |
12934
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
8987 #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
|
8988 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
|
8989 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
|
8990 #endif |
2ebc3df65ca2
patch 8.0.1343: MS-Windows: does not show colored emojis
Christian Brabandt <cb@256bit.org>
parents:
12924
diff
changeset
|
8991 |
7 | 8992 for (i = 0; i < gui.char_height - 3; i++) |
8993 SetPixel(s_hdc, x+2, y++, gui.currFgColor); | |
8994 | |
8995 SetPixel(s_hdc, x+0, y, gui.currFgColor); | |
8996 SetPixel(s_hdc, x+2, y, gui.currFgColor); | |
8997 SetPixel(s_hdc, x+4, y++, gui.currFgColor); | |
8998 SetPixel(s_hdc, x+1, y, gui.currFgColor); | |
8999 SetPixel(s_hdc, x+2, y, gui.currFgColor); | |
9000 SetPixel(s_hdc, x+3, y++, gui.currFgColor); | |
9001 SetPixel(s_hdc, x+2, y, gui.currFgColor); | |
9002 } | |
7743
6069f43cea4e
commit https://github.com/vim/vim/commit/e0874f8cbcddfcf9965a85ba35199964efb1d01a
Christian Brabandt <cb@256bit.org>
parents:
7560
diff
changeset
|
9003 #endif |