Mercurial > vim
annotate src/gui_w32.c @ 9305:4981cd0802c7 v7.4.1935
commit https://github.com/vim/vim/commit/bee666f239eada035d288b77269aebc42f644ea6
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Jun 14 20:39:42 2016 +0200
patch 7.4.1935
Problem: When using the GUI search/replace a second match right after the
replacement is skipped.
Solution: Add the SEARCH_START flag. (Mleddy)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 14 Jun 2016 20:45:06 +0200 |
parents | c25898cc99c1 |
children | 0c7f47088e55 |
rev | line source |
---|---|
1229 | 1 /* vi:set ts=8 sts=4 sw=4: |
7 | 2 * |
3 * VIM - Vi IMproved by Bram Moolenaar | |
4 * GUI support by Robert Webb | |
5 * | |
6 * Do ":help uganda" in Vim to read copying and usage conditions. | |
7 * Do ":help credits" in Vim to see a list of people who contributed. | |
8 * See README.txt for an overview of the Vim source code. | |
9 */ | |
10 /* | |
11 * Windows GUI. | |
12 * | |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
13 * GUI support for Microsoft Windows, aka Win32. Also for Win64. |
7 | 14 * |
15 * George V. Reilly <george@reilly.org> wrote the original Win32 GUI. | |
16 * Robert Webb reworked it to use the existing GUI stuff and added menu, | |
17 * scrollbars, etc. | |
18 * | |
19 * Note: Clipboard stuff, for cutting and pasting text to other windows, is in | |
7009 | 20 * winclip.c. (It can also be done from the terminal version). |
7 | 21 * |
22 * TODO: Some of the function signatures ought to be updated for Win64; | |
23 * e.g., replace LONG with LONG_PTR, etc. | |
24 */ | |
25 | |
1376 | 26 #include "vim.h" |
27 | |
6110 | 28 #if defined(FEAT_DIRECTX) |
29 # include "gui_dwrite.h" | |
30 #endif | |
31 | |
6359 | 32 #if defined(FEAT_DIRECTX) |
6110 | 33 static DWriteContext *s_dwc = NULL; |
34 static int s_directx_enabled = 0; | |
35 static int s_directx_load_attempted = 0; | |
36 # define IS_ENABLE_DIRECTX() (s_directx_enabled && s_dwc != NULL) | |
6359 | 37 #endif |
38 | |
8138
f52504c10387
commit https://github.com/vim/vim/commit/065bbac8adfe29a09958570237d223457f235c6c
Christian Brabandt <cb@256bit.org>
parents:
8108
diff
changeset
|
39 #ifdef FEAT_MENU |
f52504c10387
commit https://github.com/vim/vim/commit/065bbac8adfe29a09958570237d223457f235c6c
Christian Brabandt <cb@256bit.org>
parents:
8108
diff
changeset
|
40 static int gui_mswin_get_menu_height(int fix_window); |
f52504c10387
commit https://github.com/vim/vim/commit/065bbac8adfe29a09958570237d223457f235c6c
Christian Brabandt <cb@256bit.org>
parents:
8108
diff
changeset
|
41 #endif |
f52504c10387
commit https://github.com/vim/vim/commit/065bbac8adfe29a09958570237d223457f235c6c
Christian Brabandt <cb@256bit.org>
parents:
8108
diff
changeset
|
42 |
6359 | 43 #if defined(FEAT_DIRECTX) || defined(PROTO) |
6110 | 44 int |
45 directx_enabled(void) | |
46 { | |
47 if (s_dwc != NULL) | |
48 return 1; | |
49 else if (s_directx_load_attempted) | |
50 return 0; | |
51 /* load DirectX */ | |
52 DWrite_Init(); | |
53 s_directx_load_attempted = 1; | |
54 s_dwc = DWriteContext_Open(); | |
55 return s_dwc != NULL ? 1 : 0; | |
56 } | |
57 #endif | |
58 | |
59 #if defined(FEAT_RENDER_OPTIONS) || defined(PROTO) | |
60 int | |
61 gui_mch_set_rendering_options(char_u *s) | |
62 { | |
63 #ifdef FEAT_DIRECTX | |
64 char_u *p, *q; | |
65 | |
66 int dx_enable = 0; | |
67 int dx_flags = 0; | |
68 float dx_gamma = 0.0f; | |
69 float dx_contrast = 0.0f; | |
70 float dx_level = 0.0f; | |
71 int dx_geom = 0; | |
72 int dx_renmode = 0; | |
73 int dx_taamode = 0; | |
74 | |
75 /* parse string as rendering options. */ | |
76 for (p = s; p != NULL && *p != NUL; ) | |
77 { | |
78 char_u item[256]; | |
79 char_u name[128]; | |
80 char_u value[128]; | |
81 | |
7009 | 82 copy_option_part(&p, item, sizeof(item), ","); |
6110 | 83 if (p == NULL) |
84 break; | |
85 q = &item[0]; | |
86 copy_option_part(&q, name, sizeof(name), ":"); | |
87 if (q == NULL) | |
88 return FAIL; | |
89 copy_option_part(&q, value, sizeof(value), ":"); | |
90 | |
91 if (STRCMP(name, "type") == 0) | |
92 { | |
93 if (STRCMP(value, "directx") == 0) | |
94 dx_enable = 1; | |
95 else | |
96 return FAIL; | |
97 } | |
98 else if (STRCMP(name, "gamma") == 0) | |
99 { | |
100 dx_flags |= 1 << 0; | |
8108
50515f2e81d1
commit https://github.com/vim/vim/commit/7f0608fb5219645d776fadfe13efb867c2460698
Christian Brabandt <cb@256bit.org>
parents:
8102
diff
changeset
|
101 dx_gamma = (float)atof((char *)value); |
6110 | 102 } |
103 else if (STRCMP(name, "contrast") == 0) | |
104 { | |
105 dx_flags |= 1 << 1; | |
8108
50515f2e81d1
commit https://github.com/vim/vim/commit/7f0608fb5219645d776fadfe13efb867c2460698
Christian Brabandt <cb@256bit.org>
parents:
8102
diff
changeset
|
106 dx_contrast = (float)atof((char *)value); |
6110 | 107 } |
108 else if (STRCMP(name, "level") == 0) | |
109 { | |
110 dx_flags |= 1 << 2; | |
8108
50515f2e81d1
commit https://github.com/vim/vim/commit/7f0608fb5219645d776fadfe13efb867c2460698
Christian Brabandt <cb@256bit.org>
parents:
8102
diff
changeset
|
111 dx_level = (float)atof((char *)value); |
6110 | 112 } |
113 else if (STRCMP(name, "geom") == 0) | |
114 { | |
115 dx_flags |= 1 << 3; | |
8108
50515f2e81d1
commit https://github.com/vim/vim/commit/7f0608fb5219645d776fadfe13efb867c2460698
Christian Brabandt <cb@256bit.org>
parents:
8102
diff
changeset
|
116 dx_geom = atoi((char *)value); |
6110 | 117 if (dx_geom < 0 || dx_geom > 2) |
118 return FAIL; | |
119 } | |
120 else if (STRCMP(name, "renmode") == 0) | |
121 { | |
122 dx_flags |= 1 << 4; | |
8108
50515f2e81d1
commit https://github.com/vim/vim/commit/7f0608fb5219645d776fadfe13efb867c2460698
Christian Brabandt <cb@256bit.org>
parents:
8102
diff
changeset
|
123 dx_renmode = atoi((char *)value); |
6110 | 124 if (dx_renmode < 0 || dx_renmode > 6) |
125 return FAIL; | |
126 } | |
127 else if (STRCMP(name, "taamode") == 0) | |
128 { | |
129 dx_flags |= 1 << 5; | |
8108
50515f2e81d1
commit https://github.com/vim/vim/commit/7f0608fb5219645d776fadfe13efb867c2460698
Christian Brabandt <cb@256bit.org>
parents:
8102
diff
changeset
|
130 dx_taamode = atoi((char *)value); |
6110 | 131 if (dx_taamode < 0 || dx_taamode > 3) |
132 return FAIL; | |
133 } | |
134 else | |
135 return FAIL; | |
136 } | |
137 | |
138 /* Enable DirectX/DirectWrite */ | |
139 if (dx_enable) | |
140 { | |
141 if (!directx_enabled()) | |
142 return FAIL; | |
143 DWriteContext_SetRenderingParams(s_dwc, NULL); | |
144 if (dx_flags) | |
145 { | |
146 DWriteRenderingParams param; | |
147 DWriteContext_GetRenderingParams(s_dwc, ¶m); | |
148 if (dx_flags & (1 << 0)) | |
149 param.gamma = dx_gamma; | |
150 if (dx_flags & (1 << 1)) | |
151 param.enhancedContrast = dx_contrast; | |
152 if (dx_flags & (1 << 2)) | |
153 param.clearTypeLevel = dx_level; | |
154 if (dx_flags & (1 << 3)) | |
155 param.pixelGeometry = dx_geom; | |
156 if (dx_flags & (1 << 4)) | |
157 param.renderingMode = dx_renmode; | |
158 if (dx_flags & (1 << 5)) | |
159 param.textAntialiasMode = dx_taamode; | |
160 DWriteContext_SetRenderingParams(s_dwc, ¶m); | |
161 } | |
162 } | |
163 s_directx_enabled = dx_enable; | |
164 | |
165 return OK; | |
166 #else | |
167 return FAIL; | |
168 #endif | |
169 } | |
170 #endif | |
171 | |
7 | 172 /* |
173 * These are new in Windows ME/XP, only defined in recent compilers. | |
174 */ | |
175 #ifndef HANDLE_WM_XBUTTONUP | |
176 # define HANDLE_WM_XBUTTONUP(hwnd, wParam, lParam, fn) \ | |
177 ((fn)((hwnd), (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) | |
178 #endif | |
179 #ifndef HANDLE_WM_XBUTTONDOWN | |
180 # define HANDLE_WM_XBUTTONDOWN(hwnd, wParam, lParam, fn) \ | |
181 ((fn)((hwnd), FALSE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) | |
182 #endif | |
183 #ifndef HANDLE_WM_XBUTTONDBLCLK | |
184 # define HANDLE_WM_XBUTTONDBLCLK(hwnd, wParam, lParam, fn) \ | |
185 ((fn)((hwnd), TRUE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) | |
186 #endif | |
187 | |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
188 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
189 #include "version.h" /* used by dialog box routine for default title */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
190 #ifdef DEBUG |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
191 # include <tchar.h> |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
192 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
193 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
194 /* cproto fails on missing include files */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
195 #ifndef PROTO |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
196 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
197 #ifndef __MINGW32__ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
198 # include <shellapi.h> |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
199 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
200 #if defined(FEAT_TOOLBAR) || defined(FEAT_BEVAL) || defined(FEAT_GUI_TABLINE) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
201 # include <commctrl.h> |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
202 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
203 #include <windowsx.h> |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
204 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
205 #ifdef GLOBAL_IME |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
206 # include "glbl_ime.h" |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
207 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
208 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
209 #endif /* PROTO */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
210 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
211 #ifdef FEAT_MENU |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
212 # define MENUHINTS /* show menu hints in command line */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
213 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
214 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
215 /* Some parameters for dialog boxes. All in pixels. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
216 #define DLG_PADDING_X 10 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
217 #define DLG_PADDING_Y 10 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
218 #define DLG_OLD_STYLE_PADDING_X 5 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
219 #define DLG_OLD_STYLE_PADDING_Y 5 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
220 #define DLG_VERT_PADDING_X 4 /* For vertical buttons */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
221 #define DLG_VERT_PADDING_Y 4 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
222 #define DLG_ICON_WIDTH 34 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
223 #define DLG_ICON_HEIGHT 34 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
224 #define DLG_MIN_WIDTH 150 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
225 #define DLG_FONT_NAME "MS Sans Serif" |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
226 #define DLG_FONT_POINT_SIZE 8 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
227 #define DLG_MIN_MAX_WIDTH 400 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
228 #define DLG_MIN_MAX_HEIGHT 400 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
229 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
230 #define DLG_NONBUTTON_CONTROL 5000 /* First ID of non-button controls */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
231 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
232 #ifndef WM_XBUTTONDOWN /* For Win2K / winME ONLY */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
233 # define WM_XBUTTONDOWN 0x020B |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
234 # define WM_XBUTTONUP 0x020C |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
235 # define WM_XBUTTONDBLCLK 0x020D |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
236 # define MK_XBUTTON1 0x0020 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
237 # define MK_XBUTTON2 0x0040 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
238 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
239 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
240 #ifdef PROTO |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
241 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
242 * Define a few things for generating prototypes. This is just to avoid |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
243 * syntax errors, the defines do not need to be correct. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
244 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
245 # define APIENTRY |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
246 # define CALLBACK |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
247 # define CONST |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
248 # define FAR |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
249 # define NEAR |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
250 # define _cdecl |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
251 typedef int BOOL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
252 typedef int BYTE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
253 typedef int DWORD; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
254 typedef int WCHAR; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
255 typedef int ENUMLOGFONT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
256 typedef int FINDREPLACE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
257 typedef int HANDLE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
258 typedef int HBITMAP; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
259 typedef int HBRUSH; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
260 typedef int HDROP; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
261 typedef int INT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
262 typedef int LOGFONT[]; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
263 typedef int LPARAM; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
264 typedef int LPCREATESTRUCT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
265 typedef int LPCSTR; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
266 typedef int LPCTSTR; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
267 typedef int LPRECT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
268 typedef int LPSTR; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
269 typedef int LPWINDOWPOS; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
270 typedef int LPWORD; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
271 typedef int LRESULT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
272 typedef int HRESULT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
273 # undef MSG |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
274 typedef int MSG; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
275 typedef int NEWTEXTMETRIC; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
276 typedef int OSVERSIONINFO; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
277 typedef int PWORD; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
278 typedef int RECT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
279 typedef int UINT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
280 typedef int WORD; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
281 typedef int WPARAM; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
282 typedef int POINT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
283 typedef void *HINSTANCE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
284 typedef void *HMENU; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
285 typedef void *HWND; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
286 typedef void *HDC; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
287 typedef void VOID; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
288 typedef int LPNMHDR; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
289 typedef int LONG; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
290 typedef int WNDPROC; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
291 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
292 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
293 #ifndef GET_X_LPARAM |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
294 # 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
|
295 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
296 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
297 static void _OnPaint( HWND hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
298 static void clear_rect(RECT *rcp); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
299 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
300 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
|
301 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
|
302 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
303 #ifdef FEAT_MENU |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
304 static HMENU s_menuBar = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
305 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
306 #ifdef FEAT_TEAROFF |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
307 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
|
308 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
|
309 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
310 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
311 /* 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
|
312 * processing another message. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
313 static int s_busy_processing = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
314 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
315 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
|
316 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
317 #ifdef MSWIN_FIND_REPLACE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
318 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
|
319 static FINDREPLACE s_findrep_struct; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
320 # if defined(FEAT_MBYTE) && defined(WIN3264) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
321 static FINDREPLACEW s_findrep_struct_w; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
322 # endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
323 static HWND s_findrep_hwnd = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
324 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
|
325 for find/replace dialog */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
326 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
327 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
328 static HINSTANCE s_hinst = NULL; |
8281
74b15ed0a259
commit https://github.com/vim/vim/commit/85b11769ab507c7df93f319fd964fa579701b76b
Christian Brabandt <cb@256bit.org>
parents:
8273
diff
changeset
|
329 #if !defined(FEAT_GUI) |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
330 static |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
331 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
332 HWND s_hwnd = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
333 static HDC s_hdc = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
334 static HBRUSH s_brush = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
335 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
336 #ifdef FEAT_TOOLBAR |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
337 static HWND s_toolbarhwnd = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
338 static WNDPROC s_toolbar_wndproc = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
339 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
340 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
341 #ifdef FEAT_GUI_TABLINE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
342 static HWND s_tabhwnd = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
343 static WNDPROC s_tabline_wndproc = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
344 static int showing_tabline = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
345 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
346 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
347 static WPARAM s_wParam = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
348 static LPARAM s_lParam = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
349 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
350 static HWND s_textArea = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
351 static UINT s_uMsg = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
352 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
353 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
|
354 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
355 static int s_need_activate = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
356 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
357 /* 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
|
358 * 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
|
359 * 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
|
360 * 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
|
361 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
362 static int allow_scrollbar = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
363 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
364 #ifdef GLOBAL_IME |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
365 # 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
|
366 #else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
367 # define MyTranslateMessage(x) TranslateMessage(x) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
368 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
369 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
370 #if (defined(WIN3264) && defined(FEAT_MBYTE)) || defined(GLOBAL_IME) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
371 /* 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
|
372 # define MyWindowProc vim_WindowProc |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
373 #else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
374 /* use ordinary WindowProc */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
375 # define MyWindowProc DefWindowProc |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
376 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
377 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
378 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
|
379 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
380 static struct |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
381 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
382 UINT key_sym; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
383 char_u vim_code0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
384 char_u vim_code1; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
385 } special_keys[] = |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
386 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
387 {VK_UP, 'k', 'u'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
388 {VK_DOWN, 'k', 'd'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
389 {VK_LEFT, 'k', 'l'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
390 {VK_RIGHT, 'k', 'r'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
391 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
392 {VK_F1, 'k', '1'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
393 {VK_F2, 'k', '2'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
394 {VK_F3, 'k', '3'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
395 {VK_F4, 'k', '4'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
396 {VK_F5, 'k', '5'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
397 {VK_F6, 'k', '6'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
398 {VK_F7, 'k', '7'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
399 {VK_F8, 'k', '8'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
400 {VK_F9, 'k', '9'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
401 {VK_F10, 'k', ';'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
402 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
403 {VK_F11, 'F', '1'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
404 {VK_F12, 'F', '2'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
405 {VK_F13, 'F', '3'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
406 {VK_F14, 'F', '4'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
407 {VK_F15, 'F', '5'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
408 {VK_F16, 'F', '6'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
409 {VK_F17, 'F', '7'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
410 {VK_F18, 'F', '8'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
411 {VK_F19, 'F', '9'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
412 {VK_F20, 'F', 'A'}, |
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_F21, 'F', 'B'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
415 #ifdef FEAT_NETBEANS_INTG |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
416 {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
|
417 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
418 {VK_F22, 'F', 'C'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
419 {VK_F23, 'F', 'D'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
420 {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
|
421 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
422 {VK_HELP, '%', '1'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
423 {VK_BACK, 'k', 'b'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
424 {VK_INSERT, 'k', 'I'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
425 {VK_DELETE, 'k', 'D'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
426 {VK_HOME, 'k', 'h'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
427 {VK_END, '@', '7'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
428 {VK_PRIOR, 'k', 'P'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
429 {VK_NEXT, 'k', 'N'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
430 {VK_PRINT, '%', '9'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
431 {VK_ADD, 'K', '6'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
432 {VK_SUBTRACT, 'K', '7'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
433 {VK_DIVIDE, 'K', '8'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
434 {VK_MULTIPLY, 'K', '9'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
435 {VK_SEPARATOR, 'K', 'A'}, /* Keypad Enter */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
436 {VK_DECIMAL, 'K', 'B'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
437 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
438 {VK_NUMPAD0, 'K', 'C'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
439 {VK_NUMPAD1, 'K', 'D'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
440 {VK_NUMPAD2, 'K', 'E'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
441 {VK_NUMPAD3, 'K', 'F'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
442 {VK_NUMPAD4, 'K', 'G'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
443 {VK_NUMPAD5, 'K', 'H'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
444 {VK_NUMPAD6, 'K', 'I'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
445 {VK_NUMPAD7, 'K', 'J'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
446 {VK_NUMPAD8, 'K', 'K'}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
447 {VK_NUMPAD9, 'K', 'L'}, |
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 /* 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
|
450 {VK_SPACE, ' ', NUL}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
451 {VK_TAB, TAB, NUL}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
452 {VK_ESCAPE, ESC, NUL}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
453 {NL, NL, NUL}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
454 {CAR, CAR, NUL}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
455 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
456 /* End of list marker: */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
457 {0, 0, 0} |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
458 }; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
459 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
460 /* Local variables */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
461 static int s_button_pending = -1; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
462 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
463 /* 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
|
464 * 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
|
465 static int s_getting_focus = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
466 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
467 static int s_x_pending; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
468 static int s_y_pending; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
469 static UINT s_kFlags_pending; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
470 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
|
471 static int s_timed_out = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
472 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
|
473 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
474 #ifdef WIN3264 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
475 static OSVERSIONINFO os_version; /* like it says. Init in gui_mch_init() */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
476 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
477 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
478 #ifdef FEAT_BEVAL |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
479 /* balloon-eval WM_NOTIFY_HANDLER */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
480 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
|
481 static void TrackUserActivity(UINT uMsg); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
482 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
483 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
484 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
485 * For control IME. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
486 * |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
487 * These LOGFONT used for IME. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
488 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
489 #ifdef FEAT_MBYTE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
490 # ifdef USE_IM_CONTROL |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
491 /* 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
|
492 static LOGFONT norm_logfont; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
493 /* holds LOGFONT for 'guifont' always. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
494 static LOGFONT sub_logfont; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
495 # endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
496 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
497 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
498 #ifdef FEAT_MBYTE_IME |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
499 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
|
500 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
501 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
502 #if defined(FEAT_BROWSE) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
503 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
|
504 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
505 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
506 #ifdef DEBUG_PRINT_ERROR |
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 * 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
|
509 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
510 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
511 print_windows_error(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
512 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
513 LPVOID lpMsgBuf; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
514 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
515 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
|
516 NULL, GetLastError(), |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
517 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
518 (LPTSTR) &lpMsgBuf, 0, NULL); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
519 TRACE1("Error: %s\n", lpMsgBuf); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
520 LocalFree(lpMsgBuf); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
521 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
522 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
523 |
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 * Cursor blink functions. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
526 * |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
527 * This is a simple state machine: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
528 * BLINK_NONE not blinking at all |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
529 * 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
|
530 * BLINK_ON blinking, cursor is shown |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
531 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
532 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
533 #define BLINK_NONE 0 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
534 #define BLINK_OFF 1 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
535 #define BLINK_ON 2 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
536 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
537 static int blink_state = BLINK_NONE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
538 static long_u blink_waittime = 700; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
539 static long_u blink_ontime = 400; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
540 static long_u blink_offtime = 250; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
541 static UINT blink_timer = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
542 |
9213
bb86514cad15
commit https://github.com/vim/vim/commit/703a8044b5393d37d355b0b1054a9a5a13912a3f
Christian Brabandt <cb@256bit.org>
parents:
9181
diff
changeset
|
543 int |
bb86514cad15
commit https://github.com/vim/vim/commit/703a8044b5393d37d355b0b1054a9a5a13912a3f
Christian Brabandt <cb@256bit.org>
parents:
9181
diff
changeset
|
544 gui_mch_is_blinking(void) |
bb86514cad15
commit https://github.com/vim/vim/commit/703a8044b5393d37d355b0b1054a9a5a13912a3f
Christian Brabandt <cb@256bit.org>
parents:
9181
diff
changeset
|
545 { |
bb86514cad15
commit https://github.com/vim/vim/commit/703a8044b5393d37d355b0b1054a9a5a13912a3f
Christian Brabandt <cb@256bit.org>
parents:
9181
diff
changeset
|
546 return blink_state != BLINK_NONE; |
bb86514cad15
commit https://github.com/vim/vim/commit/703a8044b5393d37d355b0b1054a9a5a13912a3f
Christian Brabandt <cb@256bit.org>
parents:
9181
diff
changeset
|
547 } |
bb86514cad15
commit https://github.com/vim/vim/commit/703a8044b5393d37d355b0b1054a9a5a13912a3f
Christian Brabandt <cb@256bit.org>
parents:
9181
diff
changeset
|
548 |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
549 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
550 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
|
551 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
552 blink_waittime = wait; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
553 blink_ontime = on; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
554 blink_offtime = off; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
555 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
556 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
557 /* ARGSUSED */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
558 static VOID CALLBACK |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
559 _OnBlinkTimer( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
560 HWND hwnd, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
561 UINT uMsg, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
562 UINT idEvent, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
563 DWORD dwTime) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
564 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
565 MSG msg; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
566 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
567 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
568 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
|
569 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
570 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
571 KillTimer(NULL, idEvent); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
572 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
573 /* Eat spurious WM_TIMER messages */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
574 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
|
575 ; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
576 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
577 if (blink_state == BLINK_ON) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
578 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
579 gui_undraw_cursor(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
580 blink_state = BLINK_OFF; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
581 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
|
582 (TIMERPROC)_OnBlinkTimer); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
583 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
584 else |
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 gui_update_cursor(TRUE, FALSE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
587 blink_state = BLINK_ON; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
588 blink_timer = (UINT) SetTimer(NULL, 0, (UINT)blink_ontime, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
589 (TIMERPROC)_OnBlinkTimer); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
590 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
591 } |
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 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
594 gui_mswin_rm_blink_timer(void) |
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 MSG msg; |
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 if (blink_timer != 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
599 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
600 KillTimer(NULL, blink_timer); |
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, 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
|
603 ; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
604 blink_timer = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
605 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
606 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
607 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
608 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
609 * 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
|
610 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
611 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
612 gui_mch_stop_blink(void) |
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_mswin_rm_blink_timer(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
615 if (blink_state == BLINK_OFF) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
616 gui_update_cursor(TRUE, FALSE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
617 blink_state = BLINK_NONE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
618 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
619 |
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 * 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
|
622 * waiting time and shows the cursor. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
623 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
624 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
625 gui_mch_start_blink(void) |
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 gui_mswin_rm_blink_timer(); |
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 /* 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
|
630 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
|
631 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
632 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
|
633 (TIMERPROC)_OnBlinkTimer); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
634 blink_state = BLINK_ON; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
635 gui_update_cursor(TRUE, FALSE); |
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 |
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 * Call-back routines. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
641 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
642 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
643 /*ARGSUSED*/ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
644 static VOID CALLBACK |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
645 _OnTimer( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
646 HWND hwnd, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
647 UINT uMsg, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
648 UINT idEvent, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
649 DWORD dwTime) |
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 MSG msg; |
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 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
654 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
|
655 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
656 KillTimer(NULL, idEvent); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
657 s_timed_out = TRUE; |
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 /* Eat spurious WM_TIMER messages */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
660 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
|
661 ; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
662 if (idEvent == s_wait_timer) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
663 s_wait_timer = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
664 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
665 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
666 /*ARGSUSED*/ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
667 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
668 _OnDeadChar( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
669 HWND hwnd, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
670 UINT ch, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
671 int cRepeat) |
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 dead_key = 1; |
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 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
677 * 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
|
678 * 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
|
679 * Return the length. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
680 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
681 static int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
682 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
|
683 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
684 int len; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
685 int i; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
686 #ifdef FEAT_MBYTE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
687 WCHAR wstring[2]; |
9252
c25898cc99c1
commit https://github.com/vim/vim/commit/945ec093cd4ddefab930239990564b12eb232153
Christian Brabandt <cb@256bit.org>
parents:
9236
diff
changeset
|
688 char_u *ws = NULL; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
689 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
690 if (os_version.dwPlatformId != VER_PLATFORM_WIN32_NT) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
691 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
692 /* On Windows 95/98 we apparently get the character in the active |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
693 * codepage, not in UCS-2. If conversion is needed convert it to |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
694 * UCS-2 first. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
695 if ((int)GetACP() == enc_codepage) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
696 len = 0; /* no conversion required */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
697 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
698 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
699 string[0] = ch; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
700 len = MultiByteToWideChar(GetACP(), 0, (LPCSTR)string, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
701 1, wstring, 2); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
702 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
703 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
704 else |
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 wstring[0] = ch; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
707 len = 1; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
708 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
709 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
710 if (len > 0) |
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 /* "ch" is a UTF-16 character. Convert it to a string of bytes. When |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
713 * "enc_codepage" is non-zero use the standard Win32 function, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
714 * otherwise use our own conversion function (e.g., for UTF-8). */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
715 if (enc_codepage > 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
716 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
717 len = WideCharToMultiByte(enc_codepage, 0, wstring, len, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
718 (LPSTR)string, slen, 0, NULL); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
719 /* If we had included the ALT key into the character but now the |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
720 * upper bit is no longer set, that probably means the conversion |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
721 * failed. Convert the original character and set the upper bit |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
722 * afterwards. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
723 if (had_alt && len == 1 && ch >= 0x80 && string[0] < 0x80) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
724 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
725 wstring[0] = ch & 0x7f; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
726 len = WideCharToMultiByte(enc_codepage, 0, wstring, len, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
727 (LPSTR)string, slen, 0, NULL); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
728 if (len == 1) /* safety check */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
729 string[0] |= 0x80; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
730 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
731 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
732 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
733 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
734 len = 1; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
735 ws = utf16_to_enc(wstring, &len); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
736 if (ws == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
737 len = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
738 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
739 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
740 if (len > slen) /* just in case */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
741 len = slen; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
742 mch_memmove(string, ws, len); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
743 vim_free(ws); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
744 } |
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 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
747 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
748 if (len == 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
749 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
750 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
751 string[0] = ch; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
752 len = 1; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
753 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
754 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
755 for (i = 0; i < len; ++i) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
756 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
|
757 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
758 /* Insert CSI as K_CSI. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
759 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
|
760 string[++i] = KS_EXTRA; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
761 string[++i] = (int)KE_CSI; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
762 len += 2; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
763 } |
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 return len; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
766 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
767 |
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 * 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
|
770 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
771 /*ARGSUSED*/ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
772 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
773 _OnChar( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
774 HWND hwnd, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
775 UINT ch, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
776 int cRepeat) |
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 char_u string[40]; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
779 int len = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
780 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
781 dead_key = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
782 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
783 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
|
784 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
|
785 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
786 trash_input_buf(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
787 got_int = TRUE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
788 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
789 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
790 add_to_input_buf(string, len); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
791 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
792 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
793 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
794 * 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
|
795 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
796 /*ARGSUSED*/ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
797 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
798 _OnSysChar( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
799 HWND hwnd, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
800 UINT cch, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
801 int cRepeat) |
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 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
|
804 int len; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
805 int modifiers; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
806 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
|
807 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
808 dead_key = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
809 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
810 /* 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
|
811 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
812 /* 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
|
813 * 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
|
814 * 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
|
815 * CAPSLOCK is pressed) at this point. |
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 modifiers = MOD_MASK_ALT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
818 if (GetKeyState(VK_SHIFT) & 0x8000) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
819 modifiers |= MOD_MASK_SHIFT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
820 if (GetKeyState(VK_CONTROL) & 0x8000) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
821 modifiers |= MOD_MASK_CTRL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
822 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
823 ch = simplify_key(ch, &modifiers); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
824 /* 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
|
825 * '(' and '*' */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
826 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
|
827 modifiers &= ~MOD_MASK_SHIFT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
828 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
829 /* 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
|
830 ch = extract_modifiers(ch, &modifiers); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
831 if (ch == CSI) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
832 ch = K_CSI; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
833 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
834 len = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
835 if (modifiers) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
836 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
837 string[len++] = CSI; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
838 string[len++] = KS_MODIFIER; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
839 string[len++] = modifiers; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
840 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
841 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
842 if (IS_SPECIAL((int)ch)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
843 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
844 string[len++] = CSI; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
845 string[len++] = K_SECOND((int)ch); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
846 string[len++] = K_THIRD((int)ch); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
847 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
848 else |
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 /* 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
|
851 * a Unicode character. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
852 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
|
853 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
854 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
855 add_to_input_buf(string, len); |
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
858 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
859 _OnMouseEvent( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
860 int button, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
861 int x, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
862 int y, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
863 int repeated_click, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
864 UINT keyFlags) |
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 int vim_modifiers = 0x0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
867 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
868 s_getting_focus = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
869 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
870 if (keyFlags & MK_SHIFT) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
871 vim_modifiers |= MOUSE_SHIFT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
872 if (keyFlags & MK_CONTROL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
873 vim_modifiers |= MOUSE_CTRL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
874 if (GetKeyState(VK_MENU) & 0x8000) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
875 vim_modifiers |= MOUSE_ALT; |
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 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
|
878 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
879 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
880 /*ARGSUSED*/ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
881 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
882 _OnMouseButtonDown( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
883 HWND hwnd, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
884 BOOL fDoubleClick, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
885 int x, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
886 int y, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
887 UINT keyFlags) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
888 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
889 static LONG s_prevTime = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
890 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
891 LONG currentTime = GetMessageTime(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
892 int button = -1; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
893 int repeated_click; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
894 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
895 /* 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
|
896 (void)SetFocus(s_hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
897 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
898 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
|
899 button = MOUSE_LEFT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
900 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
|
901 button = MOUSE_MIDDLE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
902 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
|
903 button = MOUSE_RIGHT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
904 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
|
905 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
906 #ifndef GET_XBUTTON_WPARAM |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
907 # 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
|
908 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
909 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
|
910 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
911 else if (s_uMsg == WM_CAPTURECHANGED) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
912 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
913 /* 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
|
914 * 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
|
915 if (s_button_pending == MOUSE_LEFT) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
916 button = MOUSE_RIGHT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
917 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
918 button = MOUSE_LEFT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
919 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
920 if (button >= 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
921 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
922 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
|
923 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
924 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
925 * 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
|
926 * button. |
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 (repeated_click |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
929 && ((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
|
930 || (button == MOUSE_RIGHT |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
931 && s_button_pending == MOUSE_LEFT))) |
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 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
934 * 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
|
935 * 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
|
936 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
937 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
|
938 button = MOUSE_MIDDLE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
939 repeated_click = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
940 s_button_pending = -1; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
941 _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
|
942 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
943 else if ((repeated_click) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
944 || (mouse_model_popup() && (button == MOUSE_RIGHT))) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
945 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
946 if (s_button_pending > -1) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
947 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
948 _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
|
949 s_button_pending = -1; |
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 /* 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
|
952 _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
|
953 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
954 else |
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 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
957 * 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
|
958 * 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
|
959 * i) button-up |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
960 * ii) mouse move |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
961 * iii) another button press |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
962 * before using it. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
963 * 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
|
964 * 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
|
965 * 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
|
966 * 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
|
967 * this is hardly a problem. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
968 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
969 s_button_pending = button; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
970 s_x_pending = x; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
971 s_y_pending = y; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
972 s_kFlags_pending = keyFlags; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
973 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
974 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
975 s_prevTime = currentTime; |
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 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
978 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
979 /*ARGSUSED*/ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
980 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
981 _OnMouseMoveOrRelease( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
982 HWND hwnd, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
983 int x, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
984 int y, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
985 UINT keyFlags) |
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 int button; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
988 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
989 s_getting_focus = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
990 if (s_button_pending > -1) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
991 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
992 /* Delayed action for mouse down event */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
993 _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
|
994 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
|
995 s_button_pending = -1; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
996 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
997 if (s_uMsg == WM_MOUSEMOVE) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
998 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
999 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1000 * 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
|
1001 * down. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1002 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1003 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
|
1004 | MK_XBUTTON1 | MK_XBUTTON2))) |
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 gui_mouse_moved(x, y); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1007 return; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1008 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1009 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1010 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1011 * 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
|
1012 * the mouse goes outside the window |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1013 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1014 SetCapture(s_textArea); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1015 button = MOUSE_DRAG; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1016 /* 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
|
1017 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1018 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1019 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1020 ReleaseCapture(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1021 button = MOUSE_RELEASE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1022 /* 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
|
1023 } |
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 _OnMouseEvent(button, x, y, FALSE, keyFlags); |
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1028 #ifdef FEAT_MENU |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1029 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1030 * 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
|
1031 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1032 static vimmenu_T * |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1033 gui_mswin_find_menu( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1034 vimmenu_T *pMenu, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1035 int id) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1036 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1037 vimmenu_T *pChildMenu; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1038 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1039 while (pMenu) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1040 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1041 if (pMenu->id == (UINT)id) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1042 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1043 if (pMenu->children != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1044 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1045 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
|
1046 if (pChildMenu) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1047 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1048 pMenu = pChildMenu; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1049 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1050 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1051 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1052 pMenu = pMenu->next; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1053 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1054 return pMenu; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1055 } |
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 /*ARGSUSED*/ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1058 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1059 _OnMenu( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1060 HWND hwnd, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1061 int id, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1062 HWND hwndCtl, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1063 UINT codeNotify) |
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 vimmenu_T *pMenu; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1066 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1067 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
|
1068 if (pMenu) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1069 gui_menu_cb(pMenu); |
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 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1072 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1073 #ifdef MSWIN_FIND_REPLACE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1074 # if defined(FEAT_MBYTE) && defined(WIN3264) |
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 * 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
|
1077 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1078 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1079 findrep_atow(LPFINDREPLACEW lpfrw, LPFINDREPLACE lpfr) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1080 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1081 WCHAR *wp; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1082 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1083 lpfrw->hwndOwner = lpfr->hwndOwner; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1084 lpfrw->Flags = lpfr->Flags; |
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 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
|
1087 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
|
1088 vim_free(wp); |
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 /* 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
|
1091 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1092 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1093 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1094 * 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
|
1095 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1096 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1097 findrep_wtoa(LPFINDREPLACE lpfr, LPFINDREPLACEW lpfrw) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1098 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1099 char_u *p; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1100 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1101 lpfr->Flags = lpfrw->Flags; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1102 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1103 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
|
1104 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
|
1105 vim_free(p); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1106 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1107 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
|
1108 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
|
1109 vim_free(p); |
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 # endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1112 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1113 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1114 * Handle a Find/Replace window message. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1115 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1116 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1117 _OnFindRepl(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1118 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1119 int flags = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1120 int down; |
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 # if defined(FEAT_MBYTE) && defined(WIN3264) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1123 /* 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
|
1124 * convert text from wide string. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1125 if (os_version.dwPlatformId == VER_PLATFORM_WIN32_NT |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1126 && 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
|
1127 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1128 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
|
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 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
|
1133 /* Give main window the focus back. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1134 (void)SetFocus(s_hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1135 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1136 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
|
1137 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1138 flags = FRD_FINDNEXT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1139 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1140 /* 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
|
1141 * hollow. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1142 (void)SetFocus(s_hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1143 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1144 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
|
1145 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1146 flags = FRD_REPLACE; |
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 /* 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
|
1149 * hollow. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1150 (void)SetFocus(s_hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1151 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1152 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
|
1153 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1154 flags = FRD_REPLACEALL; |
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1157 if (flags != 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1158 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1159 /* 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
|
1160 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
|
1161 flags |= FRD_WHOLE_WORD; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1162 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
|
1163 flags |= FRD_MATCH_CASE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1164 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
|
1165 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
|
1166 (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
|
1167 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1168 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1169 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1170 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1171 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1172 HandleMouseHide(UINT uMsg, LPARAM lParam) |
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 static LPARAM last_lParam = 0L; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1175 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1176 /* 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
|
1177 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
|
1178 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1179 if (lParam == last_lParam) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1180 return; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1181 last_lParam = lParam; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1182 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1183 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1184 /* 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
|
1185 * 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
|
1186 * 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
|
1187 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1188 switch (uMsg) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1189 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1190 case WM_KEYUP: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1191 case WM_CHAR: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1192 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1193 * blank out the pointer if necessary |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1194 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1195 if (p_mh) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1196 gui_mch_mousehide(TRUE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1197 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1198 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1199 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
|
1200 case WM_SYSCHAR: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1201 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
|
1202 case WM_LBUTTONDOWN: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1203 case WM_LBUTTONUP: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1204 case WM_MBUTTONDOWN: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1205 case WM_MBUTTONUP: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1206 case WM_RBUTTONDOWN: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1207 case WM_RBUTTONUP: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1208 case WM_XBUTTONDOWN: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1209 case WM_XBUTTONUP: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1210 case WM_NCMOUSEMOVE: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1211 case WM_NCLBUTTONDOWN: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1212 case WM_NCLBUTTONUP: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1213 case WM_NCMBUTTONDOWN: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1214 case WM_NCMBUTTONUP: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1215 case WM_NCRBUTTONDOWN: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1216 case WM_NCRBUTTONUP: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1217 case WM_KILLFOCUS: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1218 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1219 * 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
|
1220 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1221 gui_mch_mousehide(FALSE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1222 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1223 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1224 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1225 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1226 static LRESULT CALLBACK |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1227 _TextAreaWndProc( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1228 HWND hwnd, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1229 UINT uMsg, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1230 WPARAM wParam, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1231 LPARAM lParam) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1232 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1233 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1234 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
|
1235 hwnd, uMsg, wParam, lParam); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1236 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1237 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1238 HandleMouseHide(uMsg, lParam); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1239 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1240 s_uMsg = uMsg; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1241 s_wParam = wParam; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1242 s_lParam = lParam; |
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 #ifdef FEAT_BEVAL |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1245 TrackUserActivity(uMsg); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1246 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1247 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1248 switch (uMsg) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1249 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1250 HANDLE_MSG(hwnd, WM_LBUTTONDBLCLK,_OnMouseButtonDown); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1251 HANDLE_MSG(hwnd, WM_LBUTTONDOWN,_OnMouseButtonDown); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1252 HANDLE_MSG(hwnd, WM_LBUTTONUP, _OnMouseMoveOrRelease); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1253 HANDLE_MSG(hwnd, WM_MBUTTONDBLCLK,_OnMouseButtonDown); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1254 HANDLE_MSG(hwnd, WM_MBUTTONDOWN,_OnMouseButtonDown); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1255 HANDLE_MSG(hwnd, WM_MBUTTONUP, _OnMouseMoveOrRelease); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1256 HANDLE_MSG(hwnd, WM_MOUSEMOVE, _OnMouseMoveOrRelease); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1257 HANDLE_MSG(hwnd, WM_PAINT, _OnPaint); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1258 HANDLE_MSG(hwnd, WM_RBUTTONDBLCLK,_OnMouseButtonDown); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1259 HANDLE_MSG(hwnd, WM_RBUTTONDOWN,_OnMouseButtonDown); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1260 HANDLE_MSG(hwnd, WM_RBUTTONUP, _OnMouseMoveOrRelease); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1261 HANDLE_MSG(hwnd, WM_XBUTTONDBLCLK,_OnMouseButtonDown); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1262 HANDLE_MSG(hwnd, WM_XBUTTONDOWN,_OnMouseButtonDown); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1263 HANDLE_MSG(hwnd, WM_XBUTTONUP, _OnMouseMoveOrRelease); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1264 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1265 #ifdef FEAT_BEVAL |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1266 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
|
1267 return TRUE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1268 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1269 default: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1270 return MyWindowProc(hwnd, uMsg, wParam, lParam); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1271 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1272 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1273 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1274 #if (defined(WIN3264) && defined(FEAT_MBYTE)) \ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1275 || defined(GLOBAL_IME) \ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1276 || defined(PROTO) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1277 # ifdef PROTO |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1278 typedef int WINAPI; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1279 # endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1280 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1281 LRESULT WINAPI |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1282 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
|
1283 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1284 # ifdef GLOBAL_IME |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1285 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
|
1286 # else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1287 if (wide_WindowProc) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1288 return DefWindowProcW(hwnd, message, wParam, lParam); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1289 return DefWindowProc(hwnd, message, wParam, lParam); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1290 #endif |
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 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1293 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1294 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1295 * 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
|
1296 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1297 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1298 gui_mch_new_colors(void) |
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 /* nothing to do? */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1301 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1302 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1303 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1304 * 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
|
1305 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1306 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1307 gui_mch_def_colors(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1308 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1309 gui.norm_pixel = GetSysColor(COLOR_WINDOWTEXT); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1310 gui.back_pixel = GetSysColor(COLOR_WINDOW); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1311 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
|
1312 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
|
1313 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1314 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1315 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1316 * 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
|
1317 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1318 int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1319 gui_mch_open(void) |
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 #ifndef SW_SHOWDEFAULT |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1322 # 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
|
1323 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1324 /* 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
|
1325 * (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
|
1326 if (!IsWindowVisible(s_hwnd)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1327 ShowWindow(s_hwnd, SW_SHOWDEFAULT); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1328 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1329 #ifdef MSWIN_FIND_REPLACE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1330 /* 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
|
1331 * dialog. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1332 s_findrep_struct.lpstrReplaceWith[0] = NUL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1333 #endif |
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 return OK; |
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1338 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1339 * 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
|
1340 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1341 int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1342 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
|
1343 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1344 RECT rect; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1345 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1346 GetWindowRect(s_hwnd, &rect); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1347 *x = rect.left; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1348 *y = rect.top; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1349 return OK; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1350 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1351 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1352 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1353 * 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
|
1354 * coordinates. |
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 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1357 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
|
1358 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1359 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
|
1360 SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1361 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1362 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1363 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
|
1364 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1365 static int oldx = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1366 static int oldy = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1367 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1368 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
|
1369 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1370 #ifdef FEAT_TOOLBAR |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1371 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
|
1372 SendMessage(s_toolbarhwnd, WM_SIZE, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1373 (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
|
1374 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1375 #if defined(FEAT_GUI_TABLINE) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1376 if (showing_tabline) |
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 int top = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1379 RECT rect; |
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 # ifdef FEAT_TOOLBAR |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1382 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
|
1383 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
|
1384 # endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1385 GetClientRect(s_hwnd, &rect); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1386 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
|
1387 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1388 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1389 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1390 /* 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
|
1391 * 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
|
1392 * forcedly redrawn. (Yasuhiro Matsumoto) */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1393 if (oldx != x || oldy != y) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1394 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1395 InvalidateRect(s_hwnd, NULL, FALSE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1396 oldx = x; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1397 oldy = y; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1398 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1399 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1400 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1401 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1402 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1403 * Scrollbar stuff: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1404 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1405 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1406 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1407 gui_mch_enable_scrollbar( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1408 scrollbar_T *sb, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1409 int flag) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1410 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1411 ShowScrollBar(sb->id, SB_CTL, flag); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1412 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1413 /* 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
|
1414 * 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
|
1415 * NT 4.0 it's not... */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1416 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1417 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1418 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1419 gui_mch_set_scrollbar_pos( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1420 scrollbar_T *sb, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1421 int x, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1422 int y, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1423 int w, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1424 int h) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1425 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1426 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
|
1427 SWP_NOZORDER | SWP_NOACTIVATE | SWP_SHOWWINDOW); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1428 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1429 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1430 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1431 gui_mch_create_scrollbar( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1432 scrollbar_T *sb, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1433 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
|
1434 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1435 sb->id = CreateWindow( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1436 "SCROLLBAR", "Scrollbar", |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1437 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
|
1438 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
|
1439 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
|
1440 s_hwnd, NULL, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1441 s_hinst, NULL); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1442 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1443 |
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 * 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
|
1446 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1447 static scrollbar_T * |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1448 gui_mswin_find_scrollbar(HWND hwnd) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1449 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1450 win_T *wp; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1451 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1452 if (gui.bottom_sbar.id == hwnd) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1453 return &gui.bottom_sbar; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1454 FOR_ALL_WINDOWS(wp) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1455 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1456 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
|
1457 return &wp->w_scrollbars[SBAR_LEFT]; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1458 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
|
1459 return &wp->w_scrollbars[SBAR_RIGHT]; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1460 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1461 return NULL; |
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 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1465 * 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
|
1466 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1467 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1468 GetFontSize(GuiFont font) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1469 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1470 HWND hwnd = GetDesktopWindow(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1471 HDC hdc = GetWindowDC(hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1472 HFONT hfntOld = SelectFont(hdc, (HFONT)font); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1473 TEXTMETRIC tm; |
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 GetTextMetrics(hdc, &tm); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1476 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
|
1477 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1478 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
|
1479 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1480 SelectFont(hdc, hfntOld); |
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 ReleaseDC(hwnd, hdc); |
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 |
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 * 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
|
1487 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1488 int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1489 gui_mch_adjust_charheight(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1490 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1491 GetFontSize(gui.norm_font); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1492 return OK; |
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1495 static GuiFont |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1496 get_font_handle(LOGFONT *lf) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1497 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1498 HFONT font = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1499 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1500 /* Load the font */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1501 font = CreateFontIndirect(lf); |
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 if (font == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1504 return NOFONT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1505 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1506 return (GuiFont)font; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1507 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1508 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1509 static int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1510 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
|
1511 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1512 int points; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1513 HWND hwnd; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1514 HDC hdc; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1515 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1516 hwnd = GetDesktopWindow(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1517 hdc = GetWindowDC(hwnd); |
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 points = MulDiv(pixels, 72, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1520 GetDeviceCaps(hdc, vertical ? LOGPIXELSY : LOGPIXELSX)); |
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 ReleaseDC(hwnd, hdc); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1523 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1524 return points; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1525 } |
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 GuiFont |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1528 gui_mch_get_font( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1529 char_u *name, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1530 int giveErrorIfMissing) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1531 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1532 LOGFONT lf; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1533 GuiFont font = NOFONT; |
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 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
|
1536 font = get_font_handle(&lf); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1537 if (font == NOFONT && giveErrorIfMissing) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1538 EMSG2(_(e_font), name); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1539 return font; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1540 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1541 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1542 #if defined(FEAT_EVAL) || defined(PROTO) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1543 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1544 * 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
|
1545 * 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
|
1546 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1547 /*ARGSUSED*/ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1548 char_u * |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1549 gui_mch_get_fontname(GuiFont font, char_u *name) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1550 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1551 if (name == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1552 return NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1553 return vim_strsave(name); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1554 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1555 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1556 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1557 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1558 gui_mch_free_font(GuiFont 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 if (font) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1561 DeleteObject((HFONT)font); |
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1564 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1565 * 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
|
1566 * Return INVALCOLOR for error. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1567 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1568 guicolor_T |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1569 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
|
1570 { |
9017
7b1200ea03a1
commit https://github.com/vim/vim/commit/c285fe7c3ffdb3ec4eff20a1d1d5accfc80f1a86
Christian Brabandt <cb@256bit.org>
parents:
9013
diff
changeset
|
1571 int i; |
8140
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 typedef struct SysColorTable |
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 char *name; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1576 int color; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1577 } SysColorTable; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1578 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1579 static SysColorTable sys_table[] = |
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 #ifdef WIN3264 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1582 {"SYS_3DDKSHADOW", COLOR_3DDKSHADOW}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1583 {"SYS_3DHILIGHT", COLOR_3DHILIGHT}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1584 #ifndef __MINGW32__ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1585 {"SYS_3DHIGHLIGHT", COLOR_3DHIGHLIGHT}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1586 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1587 {"SYS_BTNHILIGHT", COLOR_BTNHILIGHT}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1588 {"SYS_BTNHIGHLIGHT", COLOR_BTNHIGHLIGHT}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1589 {"SYS_3DLIGHT", COLOR_3DLIGHT}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1590 {"SYS_3DSHADOW", COLOR_3DSHADOW}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1591 {"SYS_DESKTOP", COLOR_DESKTOP}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1592 {"SYS_INFOBK", COLOR_INFOBK}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1593 {"SYS_INFOTEXT", COLOR_INFOTEXT}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1594 {"SYS_3DFACE", COLOR_3DFACE}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1595 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1596 {"SYS_BTNFACE", COLOR_BTNFACE}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1597 {"SYS_BTNSHADOW", COLOR_BTNSHADOW}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1598 {"SYS_ACTIVEBORDER", COLOR_ACTIVEBORDER}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1599 {"SYS_ACTIVECAPTION", COLOR_ACTIVECAPTION}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1600 {"SYS_APPWORKSPACE", COLOR_APPWORKSPACE}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1601 {"SYS_BACKGROUND", COLOR_BACKGROUND}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1602 {"SYS_BTNTEXT", COLOR_BTNTEXT}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1603 {"SYS_CAPTIONTEXT", COLOR_CAPTIONTEXT}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1604 {"SYS_GRAYTEXT", COLOR_GRAYTEXT}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1605 {"SYS_HIGHLIGHT", COLOR_HIGHLIGHT}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1606 {"SYS_HIGHLIGHTTEXT", COLOR_HIGHLIGHTTEXT}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1607 {"SYS_INACTIVEBORDER", COLOR_INACTIVEBORDER}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1608 {"SYS_INACTIVECAPTION", COLOR_INACTIVECAPTION}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1609 {"SYS_INACTIVECAPTIONTEXT", COLOR_INACTIVECAPTIONTEXT}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1610 {"SYS_MENU", COLOR_MENU}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1611 {"SYS_MENUTEXT", COLOR_MENUTEXT}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1612 {"SYS_SCROLLBAR", COLOR_SCROLLBAR}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1613 {"SYS_WINDOW", COLOR_WINDOW}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1614 {"SYS_WINDOWFRAME", COLOR_WINDOWFRAME}, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1615 {"SYS_WINDOWTEXT", COLOR_WINDOWTEXT} |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1616 }; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1617 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1618 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1619 * 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
|
1620 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1621 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
|
1622 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
|
1623 return GetSysColor(sys_table[i].color); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1624 |
9013
22c29a515b53
commit https://github.com/vim/vim/commit/ab3022196ea4f1496e79b8ee85996e31c45d02f1
Christian Brabandt <cb@256bit.org>
parents:
8835
diff
changeset
|
1625 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
|
1626 } |
9017
7b1200ea03a1
commit https://github.com/vim/vim/commit/c285fe7c3ffdb3ec4eff20a1d1d5accfc80f1a86
Christian Brabandt <cb@256bit.org>
parents:
9013
diff
changeset
|
1627 |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1628 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1629 * 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
|
1630 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1631 int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1632 gui_mch_haskey(char_u *name) |
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 int i; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1635 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1636 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
|
1637 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
|
1638 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
|
1639 return OK; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1640 return FAIL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1641 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1642 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1643 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1644 gui_mch_beep(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1645 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1646 MessageBeep(MB_OK); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1647 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1648 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1649 * 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
|
1650 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1651 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1652 gui_mch_invert_rectangle( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1653 int r, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1654 int c, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1655 int nr, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1656 int nc) |
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 RECT rc; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1659 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1660 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1661 * 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
|
1662 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1663 rc.left = FILL_X(c); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1664 rc.top = FILL_Y(r); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1665 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
|
1666 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
|
1667 InvertRect(s_hdc, &rc); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1668 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1669 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1670 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1671 * Iconify the GUI window. |
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_iconify(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1675 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1676 ShowWindow(s_hwnd, SW_MINIMIZE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1677 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1678 |
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 * Draw a cursor without focus. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1681 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1682 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1683 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
|
1684 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1685 HBRUSH hbr; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1686 RECT rc; |
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 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1689 * 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
|
1690 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1691 rc.left = FILL_X(gui.col); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1692 rc.top = FILL_Y(gui.row); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1693 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
|
1694 #ifdef FEAT_MBYTE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1695 if (mb_lefthalve(gui.row, gui.col)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1696 rc.right += gui.char_width; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1697 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1698 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
|
1699 hbr = CreateSolidBrush(color); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1700 FrameRect(s_hdc, &rc, hbr); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1701 DeleteBrush(hbr); |
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 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1704 * 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
|
1705 * color "color". |
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 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1708 gui_mch_draw_part_cursor( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1709 int w, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1710 int h, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1711 guicolor_T color) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1712 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1713 HBRUSH hbr; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1714 RECT rc; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1715 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1716 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1717 * 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
|
1718 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1719 rc.left = |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1720 #ifdef FEAT_RIGHTLEFT |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1721 /* 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
|
1722 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
|
1723 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1724 FILL_X(gui.col); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1725 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
|
1726 rc.right = rc.left + w; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1727 rc.bottom = rc.top + h; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1728 hbr = CreateSolidBrush(color); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1729 FillRect(s_hdc, &rc, hbr); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1730 DeleteBrush(hbr); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1731 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1732 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1733 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1734 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1735 * 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
|
1736 * 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
|
1737 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1738 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1739 outputDeadKey_rePost(MSG originalMsg) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1740 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1741 static MSG deadCharExpel; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1742 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1743 if (!dead_key) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1744 return; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1745 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1746 dead_key = 0; |
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 /* 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
|
1749 deadCharExpel.message = originalMsg.message; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1750 deadCharExpel.hwnd = originalMsg.hwnd; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1751 deadCharExpel.wParam = VK_SPACE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1752 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1753 MyTranslateMessage(&deadCharExpel); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1754 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1755 /* 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
|
1756 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
|
1757 originalMsg.lParam); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1758 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1759 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1760 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1761 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1762 * Process a single Windows message. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1763 * 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
|
1764 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1765 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1766 process_message(void) |
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 MSG msg; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1769 UINT vk = 0; /* Virtual key */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1770 char_u string[40]; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1771 int i; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1772 int modifiers = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1773 int key; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1774 #ifdef FEAT_MENU |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1775 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
|
1776 #endif |
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 pGetMessage(&msg, NULL, 0, 0); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1779 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1780 #ifdef FEAT_OLE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1781 /* Look after OLE Automation commands */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1782 if (msg.message == WM_OLE) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1783 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1784 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
|
1785 if (str == NULL || *str == NUL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1786 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1787 /* 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
|
1788 * 3.0.4 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1789 pDispatchMessage(&msg); |
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 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1792 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1793 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
|
1794 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
|
1795 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1796 return; |
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 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1799 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1800 #ifdef MSWIN_FIND_REPLACE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1801 /* 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
|
1802 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
|
1803 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1804 HandleMouseHide(msg.message, msg.lParam); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1805 return; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1806 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1807 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1808 |
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 * 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
|
1811 * TranslateMessage(). |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1812 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1813 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
|
1814 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1815 vk = (int) msg.wParam; |
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 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1818 * 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
|
1819 * handle them and do not interfere. |
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 * 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
|
1822 * - 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
|
1823 * 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
|
1824 * dead character on its own) |
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 * - 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
|
1827 * 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
|
1828 * 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
|
1829 * immediately to _OnChar() (or _OnSysChar()). |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1830 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1831 if (dead_key) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1832 { |
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 * 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
|
1835 * 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
|
1836 * 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
|
1837 * handle it. |
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 * 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
|
1840 * 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
|
1841 * 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
|
1842 * 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
|
1843 * user expects. |
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 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
|
1846 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1847 dead_key = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1848 MyTranslateMessage(&msg); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1849 return; |
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 /* 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
|
1852 * normally */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1853 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
|
1854 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1855 outputDeadKey_rePost(msg); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1856 return; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1857 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1858 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1859 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1860 /* Check for CTRL-BREAK */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1861 if (vk == VK_CANCEL) |
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 trash_input_buf(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1864 got_int = TRUE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1865 string[0] = Ctrl_C; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1866 add_to_input_buf(string, 1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1867 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1868 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1869 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
|
1870 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1871 /* 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
|
1872 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
|
1873 && (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
|
1874 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1875 /* |
9252
c25898cc99c1
commit https://github.com/vim/vim/commit/945ec093cd4ddefab930239990564b12eb232153
Christian Brabandt <cb@256bit.org>
parents:
9236
diff
changeset
|
1876 * 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
|
1877 * 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
|
1878 * 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
|
1879 * the TAB key, etc...). |
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 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
|
1882 || vk == VK_TAB || vk == CAR)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1883 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1884 outputDeadKey_rePost(msg); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1885 return; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1886 } |
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 #ifdef FEAT_MENU |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1889 /* 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
|
1890 * 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
|
1891 if (vk == VK_F10 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1892 && gui.menu_is_active |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1893 && 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
|
1894 NULL, NULL) == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1895 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1896 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1897 if (GetKeyState(VK_SHIFT) & 0x8000) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1898 modifiers |= MOD_MASK_SHIFT; |
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 * 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
|
1901 * 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
|
1902 * shifted -- webb |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1903 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1904 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1905 if (GetKeyState(VK_CAPITAL) & 0x0001) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1906 modifiers ^= MOD_MASK_SHIFT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1907 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1908 if (GetKeyState(VK_CONTROL) & 0x8000) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1909 modifiers |= MOD_MASK_CTRL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1910 if (GetKeyState(VK_MENU) & 0x8000) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1911 modifiers |= MOD_MASK_ALT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1912 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1913 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
|
1914 key = special_keys[i].vim_code0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1915 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1916 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
|
1917 special_keys[i].vim_code1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1918 key = simplify_key(key, &modifiers); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1919 if (key == CSI) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1920 key = K_CSI; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1921 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1922 if (modifiers) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1923 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1924 string[0] = CSI; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1925 string[1] = KS_MODIFIER; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1926 string[2] = modifiers; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1927 add_to_input_buf(string, 3); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1928 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1929 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1930 if (IS_SPECIAL(key)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1931 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1932 string[0] = CSI; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1933 string[1] = K_SECOND(key); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1934 string[2] = K_THIRD(key); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1935 add_to_input_buf(string, 3); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1936 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1937 else |
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 int len; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1940 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1941 /* Handle "key" as a Unicode character. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1942 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
|
1943 add_to_input_buf(string, len); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1944 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1945 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1946 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1947 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1948 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
|
1949 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1950 /* 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
|
1951 * 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
|
1952 * 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
|
1953 if (vk != 0xff |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1954 && (GetKeyState(VK_CONTROL) & 0x8000) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1955 && !(GetKeyState(VK_SHIFT) & 0x8000) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1956 && !(GetKeyState(VK_MENU) & 0x8000)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1957 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1958 /* 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
|
1959 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
|
1960 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1961 string[0] = Ctrl_HAT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1962 add_to_input_buf(string, 1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1963 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1964 /* 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
|
1965 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
|
1966 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1967 string[0] = Ctrl__; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1968 add_to_input_buf(string, 1); |
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 /* 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
|
1971 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
|
1972 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1973 string[0] = Ctrl_AT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1974 add_to_input_buf(string, 1); |
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 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1977 MyTranslateMessage(&msg); |
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 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1980 MyTranslateMessage(&msg); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1981 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1982 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1983 #ifdef FEAT_MBYTE_IME |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1984 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
|
1985 _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
|
1986 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
|
1987 /* 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
|
1988 MyTranslateMessage(&msg); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1989 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1990 #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
|
1991 /* GIME_TEST */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1992 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
|
1993 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1994 POINT point; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1995 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1996 global_ime_set_font(&norm_logfont); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1997 point.x = FILL_X(gui.col); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1998 point.y = FILL_Y(gui.row); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
1999 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
|
2000 global_ime_set_position(&point); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2001 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2002 #endif |
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 #ifdef FEAT_MENU |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2005 /* 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
|
2006 * 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
|
2007 * key-up event) */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2008 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
|
2009 NULL, NULL) == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2010 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2011 pDispatchMessage(&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 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2015 * 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
|
2016 * 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
|
2017 * 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
|
2018 * immediately. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2019 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2020 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2021 gui_mch_update(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2022 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2023 MSG msg; |
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 if (!s_busy_processing) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2026 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
|
2027 && !vim_is_input_buf_full()) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2028 process_message(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2029 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2030 |
9179
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2031 static void |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2032 remove_any_timer(void) |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2033 { |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2034 MSG msg; |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2035 |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2036 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
|
2037 { |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2038 KillTimer(NULL, s_wait_timer); |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2039 |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2040 /* Eat spurious WM_TIMER messages */ |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2041 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
|
2042 ; |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2043 s_wait_timer = 0; |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2044 } |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2045 } |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2046 |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2047 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2048 * 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
|
2049 * from the keyboard. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2050 * wtime == -1 Wait forever. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2051 * wtime == 0 This should never happen. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2052 * 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
|
2053 * 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
|
2054 * or FAIL otherwise. |
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 int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2057 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
|
2058 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2059 int focus; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2060 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2061 s_timed_out = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2062 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2063 if (wtime > 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2064 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2065 /* 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
|
2066 if (s_busy_processing) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2067 return FAIL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2068 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
|
2069 (TIMERPROC)_OnTimer); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2070 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2071 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2072 allow_scrollbar = TRUE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2073 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2074 focus = gui.in_focus; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2075 while (!s_timed_out) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2076 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2077 /* Stop or start blinking when focus changes */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2078 if (gui.in_focus != focus) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2079 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2080 if (gui.in_focus) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2081 gui_mch_start_blink(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2082 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2083 gui_mch_stop_blink(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2084 focus = gui.in_focus; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2085 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2086 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2087 if (s_need_activate) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2088 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2089 #ifdef WIN32 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2090 (void)SetForegroundWindow(s_hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2091 #else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2092 (void)SetActiveWindow(s_hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2093 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2094 s_need_activate = FALSE; |
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 |
9179
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2097 #ifdef FEAT_TIMERS |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2098 did_add_timer = FALSE; |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2099 #endif |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2100 #ifdef MESSAGE_QUEUE |
8222
4f0677020a43
commit https://github.com/vim/vim/commit/9186a276222ea8a7c88f4092ac5b4201381f4e20
Christian Brabandt <cb@256bit.org>
parents:
8172
diff
changeset
|
2101 /* Check channel while waiting message. */ |
4f0677020a43
commit https://github.com/vim/vim/commit/9186a276222ea8a7c88f4092ac5b4201381f4e20
Christian Brabandt <cb@256bit.org>
parents:
8172
diff
changeset
|
2102 for (;;) |
4f0677020a43
commit https://github.com/vim/vim/commit/9186a276222ea8a7c88f4092ac5b4201381f4e20
Christian Brabandt <cb@256bit.org>
parents:
8172
diff
changeset
|
2103 { |
4f0677020a43
commit https://github.com/vim/vim/commit/9186a276222ea8a7c88f4092ac5b4201381f4e20
Christian Brabandt <cb@256bit.org>
parents:
8172
diff
changeset
|
2104 MSG msg; |
4f0677020a43
commit https://github.com/vim/vim/commit/9186a276222ea8a7c88f4092ac5b4201381f4e20
Christian Brabandt <cb@256bit.org>
parents:
8172
diff
changeset
|
2105 |
4f0677020a43
commit https://github.com/vim/vim/commit/9186a276222ea8a7c88f4092ac5b4201381f4e20
Christian Brabandt <cb@256bit.org>
parents:
8172
diff
changeset
|
2106 parse_queued_messages(); |
4f0677020a43
commit https://github.com/vim/vim/commit/9186a276222ea8a7c88f4092ac5b4201381f4e20
Christian Brabandt <cb@256bit.org>
parents:
8172
diff
changeset
|
2107 |
4f0677020a43
commit https://github.com/vim/vim/commit/9186a276222ea8a7c88f4092ac5b4201381f4e20
Christian Brabandt <cb@256bit.org>
parents:
8172
diff
changeset
|
2108 if (pPeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE) |
8813
b92938076e40
commit https://github.com/vim/vim/commit/f28d87146544e3b5d70aaa6a2513019f6de043ad
Christian Brabandt <cb@256bit.org>
parents:
8571
diff
changeset
|
2109 || MsgWaitForMultipleObjects(0, NULL, FALSE, 100, QS_ALLINPUT) |
8222
4f0677020a43
commit https://github.com/vim/vim/commit/9186a276222ea8a7c88f4092ac5b4201381f4e20
Christian Brabandt <cb@256bit.org>
parents:
8172
diff
changeset
|
2110 != WAIT_TIMEOUT) |
4f0677020a43
commit https://github.com/vim/vim/commit/9186a276222ea8a7c88f4092ac5b4201381f4e20
Christian Brabandt <cb@256bit.org>
parents:
8172
diff
changeset
|
2111 break; |
4f0677020a43
commit https://github.com/vim/vim/commit/9186a276222ea8a7c88f4092ac5b4201381f4e20
Christian Brabandt <cb@256bit.org>
parents:
8172
diff
changeset
|
2112 } |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2113 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2114 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2115 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2116 * 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
|
2117 * 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
|
2118 * 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
|
2119 * 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
|
2120 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2121 process_message(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2122 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2123 if (input_available()) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2124 { |
9179
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2125 remove_any_timer(); |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2126 allow_scrollbar = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2127 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2128 /* Clear pending mouse button, the release event may have been |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2129 * taken by the dialog window. But don't do this when getting |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2130 * focus, we need the mouse-up event then. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2131 if (!s_getting_focus) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2132 s_button_pending = -1; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2133 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2134 return OK; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2135 } |
9179
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2136 |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2137 #ifdef FEAT_TIMERS |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2138 if (did_add_timer) |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2139 { |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2140 /* Need to recompute the waiting time. */ |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2141 remove_any_timer(); |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2142 break; |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2143 } |
5e18efdad322
commit https://github.com/vim/vim/commit/4231da403e3c879dd6ac261e51f4ca60813935e3
Christian Brabandt <cb@256bit.org>
parents:
9017
diff
changeset
|
2144 #endif |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2145 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2146 allow_scrollbar = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2147 return FAIL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2148 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2149 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2150 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2151 * Clear a rectangular region of the screen from text pos (row1, col1) to |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2152 * (row2, col2) inclusive. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2153 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2154 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2155 gui_mch_clear_block( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2156 int row1, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2157 int col1, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2158 int row2, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2159 int col2) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2160 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2161 RECT rc; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2162 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2163 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2164 * Clear one extra pixel at the far right, for when bold characters have |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2165 * spilled over to the window border. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2166 * Note: FillRect() excludes right and bottom of rectangle. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2167 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2168 rc.left = FILL_X(col1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2169 rc.top = FILL_Y(row1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2170 rc.right = FILL_X(col2 + 1) + (col2 == Columns - 1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2171 rc.bottom = FILL_Y(row2 + 1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2172 clear_rect(&rc); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2173 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2174 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2175 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2176 * Clear the whole text window. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2177 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2178 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2179 gui_mch_clear_all(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2180 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2181 RECT rc; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2182 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2183 rc.left = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2184 rc.top = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2185 rc.right = Columns * gui.char_width + 2 * gui.border_width; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2186 rc.bottom = Rows * gui.char_height + 2 * gui.border_width; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2187 clear_rect(&rc); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2188 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2189 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2190 * Menu stuff. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2191 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2192 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2193 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2194 gui_mch_enable_menu(int flag) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2195 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2196 #ifdef FEAT_MENU |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2197 SetMenu(s_hwnd, flag ? s_menuBar : NULL); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2198 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2199 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2200 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2201 /*ARGSUSED*/ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2202 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2203 gui_mch_set_menu_pos( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2204 int x, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2205 int y, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2206 int w, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2207 int h) |
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 /* 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
|
2210 } |
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 #if defined(FEAT_MENU) || defined(PROTO) |
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 * 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
|
2215 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2216 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2217 gui_mch_menu_hidden( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2218 vimmenu_T *menu, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2219 int hidden) |
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 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2222 * 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
|
2223 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2224 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2225 if (hidden) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2226 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
|
2227 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2228 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
|
2229 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2230 gui_mch_menu_grey(menu, hidden); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2231 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2232 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2233 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2234 * 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
|
2235 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2236 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2237 gui_mch_draw_menubar(void) |
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 DrawMenuBar(s_hwnd); |
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 #endif /*FEAT_MENU*/ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2242 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2243 #ifndef PROTO |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2244 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2245 #ifdef VIMDLL |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2246 _export |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2247 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2248 _cdecl |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2249 SaveInst(HINSTANCE hInst) |
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 s_hinst = hInst; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2252 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2253 #endif |
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 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2256 * 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
|
2257 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2258 long_u |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2259 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
|
2260 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2261 return (GetRValue(pixel) << 16) + (GetGValue(pixel) << 8) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2262 + GetBValue(pixel); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2263 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2264 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2265 #if defined(FEAT_GUI_DIALOG) || defined(PROTO) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2266 /* 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
|
2267 static WORD |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2268 PixelToDialogX(int numPixels) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2269 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2270 return (WORD)((numPixels * 4) / s_dlgfntwidth); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2271 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2272 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2273 /* 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
|
2274 static WORD |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2275 PixelToDialogY(int numPixels) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2276 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2277 return (WORD)((numPixels * 8) / s_dlgfntheight); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2278 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2279 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2280 /* 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
|
2281 static int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2282 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
|
2283 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2284 SIZE size; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2285 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2286 GetTextExtentPoint(hdc, (LPCSTR)str, len, &size); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2287 return size.cx; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2288 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2289 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2290 #ifdef FEAT_MBYTE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2291 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2292 * 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
|
2293 * of 'encoding' to active codepage conversion. |
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 static int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2296 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
|
2297 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2298 SIZE size; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2299 WCHAR *wstr; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2300 int n; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2301 int wlen = len; |
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 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
|
2304 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2305 /* '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
|
2306 * function */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2307 wstr = enc_to_utf16(str, &wlen); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2308 if (wstr != NULL) |
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 n = GetTextExtentPointW(hdc, wstr, wlen, &size); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2311 vim_free(wstr); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2312 if (n) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2313 return size.cx; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2314 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2315 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2316 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2317 return GetTextWidth(hdc, str, len); |
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 #else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2320 # 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
|
2321 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2322 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2323 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2324 * A quick little routine that will center one window over another, handy for |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2325 * dialog boxes. Taken from the Win32SDK samples. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2326 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2327 static BOOL |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2328 CenterWindow( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2329 HWND hwndChild, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2330 HWND hwndParent) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2331 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2332 RECT rChild, rParent; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2333 int wChild, hChild, wParent, hParent; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2334 int wScreen, hScreen, xNew, yNew; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2335 HDC hdc; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2336 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2337 GetWindowRect(hwndChild, &rChild); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2338 wChild = rChild.right - rChild.left; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2339 hChild = rChild.bottom - rChild.top; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2340 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2341 /* 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
|
2342 if (hwndParent == NULL || IsMinimized(hwndParent)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2343 SystemParametersInfo(SPI_GETWORKAREA, 0, &rParent, 0); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2344 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2345 GetWindowRect(hwndParent, &rParent); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2346 wParent = rParent.right - rParent.left; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2347 hParent = rParent.bottom - rParent.top; |
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 hdc = GetDC(hwndChild); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2350 wScreen = GetDeviceCaps (hdc, HORZRES); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2351 hScreen = GetDeviceCaps (hdc, VERTRES); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2352 ReleaseDC(hwndChild, hdc); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2353 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2354 xNew = rParent.left + ((wParent - wChild) /2); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2355 if (xNew < 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2356 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2357 xNew = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2358 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2359 else if ((xNew+wChild) > wScreen) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2360 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2361 xNew = wScreen - wChild; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2362 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2363 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2364 yNew = rParent.top + ((hParent - hChild) /2); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2365 if (yNew < 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2366 yNew = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2367 else if ((yNew+hChild) > hScreen) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2368 yNew = hScreen - hChild; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2369 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2370 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
|
2371 SWP_NOSIZE | SWP_NOZORDER); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2372 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2373 #endif /* FEAT_GUI_DIALOG */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2374 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2375 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2376 gui_mch_activate_window(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2377 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2378 (void)SetActiveWindow(s_hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2379 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2380 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2381 #if defined(FEAT_TOOLBAR) || defined(PROTO) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2382 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2383 gui_mch_show_toolbar(int showit) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2384 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2385 if (s_toolbarhwnd == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2386 return; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2387 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2388 if (showit) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2389 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2390 # ifdef FEAT_MBYTE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2391 # ifndef TB_SETUNICODEFORMAT |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2392 /* 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
|
2393 # define TB_SETUNICODEFORMAT 0x2005 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2394 # endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2395 /* Enable/disable unicode support */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2396 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
|
2397 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
|
2398 # endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2399 ShowWindow(s_toolbarhwnd, SW_SHOW); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2400 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2401 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2402 ShowWindow(s_toolbarhwnd, SW_HIDE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2403 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2404 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2405 /* 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
|
2406 #define TOOLBAR_BITMAP_COUNT 31 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2407 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2408 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2409 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2410 #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
|
2411 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2412 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
|
2413 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2414 #ifdef FEAT_MBYTE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2415 WCHAR *wn = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2416 int n; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2417 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2418 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
|
2419 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2420 /* '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
|
2421 * and use wide function */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2422 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
|
2423 if (wn != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2424 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2425 MENUITEMINFOW infow; |
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 infow.cbSize = sizeof(infow); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2428 infow.fMask = MIIM_TYPE | MIIM_ID; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2429 infow.wID = item_id; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2430 infow.fType = MFT_STRING; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2431 infow.dwTypeData = wn; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2432 infow.cch = (UINT)wcslen(wn); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2433 n = InsertMenuItemW(pmenu, item_id, FALSE, &infow); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2434 vim_free(wn); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2435 if (n == 0 && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2436 /* Failed, try using non-wide function. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2437 wn = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2438 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2439 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2440 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2441 if (wn == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2442 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2443 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2444 MENUITEMINFO info; |
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 info.cbSize = sizeof(info); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2447 info.fMask = MIIM_TYPE | MIIM_ID; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2448 info.wID = item_id; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2449 info.fType = MFT_STRING; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2450 info.dwTypeData = (LPTSTR)item_text; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2451 info.cch = (UINT)STRLEN(item_text); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2452 InsertMenuItem(pmenu, item_id, FALSE, &info); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2453 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2454 } |
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 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2457 show_tabline_popup_menu(void) |
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 HMENU tab_pmenu; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2460 long rval; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2461 POINT pt; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2462 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2463 /* 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
|
2464 if (hold_gui_events |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2465 # ifdef FEAT_CMDWIN |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2466 || cmdwin_type != 0 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2467 # endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2468 ) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2469 return; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2470 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2471 tab_pmenu = CreatePopupMenu(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2472 if (tab_pmenu == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2473 return; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2474 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2475 if (first_tabpage->tp_next != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2476 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
|
2477 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
|
2478 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
|
2479 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
|
2480 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
|
2481 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
|
2482 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2483 GetCursorPos(&pt); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2484 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
|
2485 NULL); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2486 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2487 DestroyMenu(tab_pmenu); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2488 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2489 /* 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
|
2490 if (rval > 0) |
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 TCHITTESTINFO htinfo; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2493 int idx; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2494 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2495 if (ScreenToClient(s_tabhwnd, &pt) == 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2496 return; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2497 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2498 htinfo.pt.x = pt.x; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2499 htinfo.pt.y = pt.y; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2500 idx = TabCtrl_HitTest(s_tabhwnd, &htinfo); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2501 if (idx == -1) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2502 idx = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2503 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2504 idx += 1; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2505 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2506 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
|
2507 } |
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2510 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2511 * Show or hide the tabline. |
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 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2514 gui_mch_show_tabline(int showit) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2515 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2516 if (s_tabhwnd == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2517 return; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2518 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2519 if (!showit != !showing_tabline) |
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 if (showit) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2522 ShowWindow(s_tabhwnd, SW_SHOW); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2523 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2524 ShowWindow(s_tabhwnd, SW_HIDE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2525 showing_tabline = showit; |
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 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2528 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2529 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2530 * Return TRUE when tabline is displayed. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2531 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2532 int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2533 gui_mch_showing_tabline(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2534 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2535 return s_tabhwnd != NULL && showing_tabline; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2536 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2537 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2538 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2539 * Update the labels of the tabline. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2540 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2541 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2542 gui_mch_update_tabline(void) |
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 tabpage_T *tp; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2545 TCITEM tie; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2546 int nr = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2547 int curtabidx = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2548 int tabadded = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2549 #ifdef FEAT_MBYTE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2550 static int use_unicode = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2551 int uu; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2552 WCHAR *wstr = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2553 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2554 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2555 if (s_tabhwnd == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2556 return; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2557 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2558 #if defined(FEAT_MBYTE) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2559 # ifndef CCM_SETUNICODEFORMAT |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2560 /* 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
|
2561 # define CCM_SETUNICODEFORMAT 0x2005 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2562 # endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2563 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
|
2564 if (uu != use_unicode) |
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 /* Enable/disable unicode support */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2567 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
|
2568 use_unicode = uu; |
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 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2571 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2572 tie.mask = TCIF_TEXT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2573 tie.iImage = -1; |
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 /* 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
|
2576 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
|
2577 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2578 /* 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
|
2579 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
|
2580 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2581 if (tp == curtab) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2582 curtabidx = nr; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2583 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2584 if (nr >= TabCtrl_GetItemCount(s_tabhwnd)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2585 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2586 /* Add the tab */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2587 tie.pszText = "-Empty-"; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2588 TabCtrl_InsertItem(s_tabhwnd, nr, &tie); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2589 tabadded = 1; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2590 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2591 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2592 get_tabline_label(tp, FALSE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2593 tie.pszText = (LPSTR)NameBuff; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2594 #ifdef FEAT_MBYTE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2595 wstr = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2596 if (use_unicode) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2597 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2598 /* Need to go through Unicode. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2599 wstr = enc_to_utf16(NameBuff, NULL); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2600 if (wstr != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2601 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2602 TCITEMW tiw; |
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 tiw.mask = TCIF_TEXT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2605 tiw.iImage = -1; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2606 tiw.pszText = wstr; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2607 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
|
2608 vim_free(wstr); |
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 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2611 if (wstr == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2612 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2613 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2614 TabCtrl_SetItem(s_tabhwnd, nr, &tie); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2615 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2616 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2617 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2618 /* Remove any old labels. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2619 while (nr < TabCtrl_GetItemCount(s_tabhwnd)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2620 TabCtrl_DeleteItem(s_tabhwnd, 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 (!tabadded && TabCtrl_GetCurSel(s_tabhwnd) != curtabidx) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2623 TabCtrl_SetCurSel(s_tabhwnd, curtabidx); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2624 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2625 /* Re-enable redraw and redraw. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2626 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
|
2627 RedrawWindow(s_tabhwnd, NULL, NULL, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2628 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
|
2629 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2630 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
|
2631 TabCtrl_SetCurSel(s_tabhwnd, curtabidx); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2632 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2633 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2634 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2635 * 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
|
2636 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2637 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2638 gui_mch_set_curtab(int nr) |
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 if (s_tabhwnd == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2641 return; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2642 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2643 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
|
2644 TabCtrl_SetCurSel(s_tabhwnd, nr - 1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2645 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2646 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2647 #endif |
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 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2650 * ":simalt" command. |
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 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2653 ex_simalt(exarg_T *eap) |
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 char_u *keys = eap->arg; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2656 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2657 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
|
2658 while (*keys) |
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 (*keys == '~') |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2661 *keys = ' '; /* for showing system menu */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2662 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
|
2663 keys++; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2664 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2665 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2666 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2667 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2668 * Create the find & replace dialogs. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2669 * 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
|
2670 * 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
|
2671 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2672 #ifdef MSWIN_FIND_REPLACE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2673 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2674 initialise_findrep(char_u *initial_string) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2675 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2676 int wword = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2677 int mcase = !p_ic; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2678 char_u *entry_text; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2679 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2680 /* Get the search string to use. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2681 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
|
2682 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2683 s_findrep_struct.hwndOwner = s_hwnd; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2684 s_findrep_struct.Flags = FR_DOWN; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2685 if (mcase) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2686 s_findrep_struct.Flags |= FR_MATCHCASE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2687 if (wword) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2688 s_findrep_struct.Flags |= FR_WHOLEWORD; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2689 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
|
2690 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
|
2691 s_findrep_struct.wFindWhatLen - 1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2692 vim_free(entry_text); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2693 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2694 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2695 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2696 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2697 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
|
2698 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2699 #ifdef FEAT_MBYTE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2700 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
|
2701 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2702 WCHAR *wbuf; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2703 int n; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2704 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2705 /* 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
|
2706 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
|
2707 if (wbuf != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2708 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2709 n = SetWindowTextW(hwnd, wbuf); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2710 vim_free(wbuf); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2711 if (n != 0 || GetLastError() != ERROR_CALL_NOT_IMPLEMENTED) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2712 return; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2713 /* Retry with non-wide function (for Windows 98). */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2714 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2715 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2716 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2717 (void)SetWindowText(hwnd, (LPCSTR)title); |
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 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2721 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
|
2722 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2723 #ifdef MSWIN_FIND_REPLACE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2724 if (s_findrep_msg != 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2725 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2726 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
|
2727 DestroyWindow(s_findrep_hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2728 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2729 if (!IsWindow(s_findrep_hwnd)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2730 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2731 initialise_findrep(eap->arg); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2732 # if defined(FEAT_MBYTE) && defined(WIN3264) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2733 /* 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
|
2734 * codepage: convert text and use wide function. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2735 if (os_version.dwPlatformId == VER_PLATFORM_WIN32_NT |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2736 && 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
|
2737 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2738 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
|
2739 s_findrep_hwnd = FindTextW( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2740 (LPFINDREPLACEW) &s_findrep_struct_w); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2741 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2742 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2743 # endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2744 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
|
2745 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2746 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2747 set_window_title(s_findrep_hwnd, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2748 _("Find string (use '\\\\' to find a '\\')")); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2749 (void)SetFocus(s_findrep_hwnd); |
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 s_findrep_is_find = TRUE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2752 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2753 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2754 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2755 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2756 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2757 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2758 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
|
2759 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2760 #ifdef MSWIN_FIND_REPLACE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2761 if (s_findrep_msg != 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2762 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2763 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
|
2764 DestroyWindow(s_findrep_hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2765 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2766 if (!IsWindow(s_findrep_hwnd)) |
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 initialise_findrep(eap->arg); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2769 # if defined(FEAT_MBYTE) && defined(WIN3264) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2770 if (os_version.dwPlatformId == VER_PLATFORM_WIN32_NT |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2771 && 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
|
2772 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2773 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
|
2774 s_findrep_hwnd = ReplaceTextW( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2775 (LPFINDREPLACEW) &s_findrep_struct_w); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2776 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2777 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2778 # endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2779 s_findrep_hwnd = ReplaceText( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2780 (LPFINDREPLACE) &s_findrep_struct); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2781 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2782 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2783 set_window_title(s_findrep_hwnd, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2784 _("Find & Replace (use '\\\\' to find a '\\')")); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2785 (void)SetFocus(s_findrep_hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2786 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2787 s_findrep_is_find = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2788 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2789 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2790 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2791 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2792 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2793 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2794 * Set visibility of the pointer. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2795 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2796 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2797 gui_mch_mousehide(int hide) |
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 if (hide != gui.pointer_hidden) |
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 ShowCursor(!hide); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2802 gui.pointer_hidden = hide; |
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2806 #ifdef FEAT_MENU |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2807 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2808 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
|
2809 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2810 /* 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
|
2811 gui_mch_mousehide(FALSE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2812 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2813 (void)TrackPopupMenu( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2814 (HMENU)menu->submenu_id, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2815 TPM_LEFTALIGN | TPM_LEFTBUTTON, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2816 x, y, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2817 (int)0, /*reserved param*/ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2818 s_hwnd, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2819 NULL); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2820 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2821 * 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
|
2822 * 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
|
2823 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2824 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2825 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2826 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2827 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2828 * 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
|
2829 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2830 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2831 _OnEndSession(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2832 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2833 getout_preserve_modified(1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2834 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2835 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2836 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2837 * 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
|
2838 * of a Windows95 window. |
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 /*ARGSUSED*/ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2841 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2842 _OnClose( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2843 HWND hwnd) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2844 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2845 gui_shell_closed(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2846 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2847 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2848 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2849 * 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
|
2850 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2851 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2852 _OnDestroy( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2853 HWND hwnd) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2854 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2855 if (!destroying) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2856 _OnClose(hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2857 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2858 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2859 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2860 _OnPaint( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2861 HWND hwnd) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2862 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2863 if (!IsMinimized(hwnd)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2864 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2865 PAINTSTRUCT ps; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2866 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2867 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
|
2868 (void)BeginPaint(hwnd, &ps); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2869 #if defined(FEAT_DIRECTX) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2870 if (IS_ENABLE_DIRECTX()) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2871 DWriteContext_BeginDraw(s_dwc); |
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 #ifdef FEAT_MBYTE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2875 /* 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
|
2876 * rectangle */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2877 if (has_mbyte) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2878 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2879 RECT rect; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2880 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2881 GetClientRect(hwnd, &rect); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2882 ps.rcPaint.left = rect.left; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2883 ps.rcPaint.right = rect.right; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2884 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2885 #endif |
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 if (!IsRectEmpty(&ps.rcPaint)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2888 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2889 #if defined(FEAT_DIRECTX) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2890 if (IS_ENABLE_DIRECTX()) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2891 DWriteContext_BindDC(s_dwc, s_hdc, &ps.rcPaint); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2892 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2893 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
|
2894 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
|
2895 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
|
2896 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2897 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2898 #if defined(FEAT_DIRECTX) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2899 if (IS_ENABLE_DIRECTX()) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2900 DWriteContext_EndDraw(s_dwc); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2901 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2902 EndPaint(hwnd, &ps); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2903 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2904 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2905 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2906 /*ARGSUSED*/ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2907 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2908 _OnSize( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2909 HWND hwnd, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2910 UINT state, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2911 int cx, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2912 int cy) |
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 if (!IsMinimized(hwnd)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2915 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2916 gui_resize_shell(cx, cy); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2917 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2918 #ifdef FEAT_MENU |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2919 /* Menu bar may wrap differently now */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2920 gui_mswin_get_menu_height(TRUE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2921 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2922 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2923 } |
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 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2926 _OnSetFocus( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2927 HWND hwnd, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2928 HWND hwndOldFocus) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2929 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2930 gui_focus_change(TRUE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2931 s_getting_focus = TRUE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2932 (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
|
2933 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2934 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2935 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2936 _OnKillFocus( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2937 HWND hwnd, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2938 HWND hwndNewFocus) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2939 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2940 gui_focus_change(FALSE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2941 s_getting_focus = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2942 (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
|
2943 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2944 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2945 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2946 * 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
|
2947 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2948 static LRESULT |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2949 _OnActivateApp( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2950 HWND hwnd, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2951 BOOL fActivate, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2952 DWORD dwThreadId) |
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 /* 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
|
2955 /* gui_focus_change((int)fActivate); */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2956 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
|
2957 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2958 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2959 #if defined(FEAT_WINDOWS) || defined(PROTO) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2960 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2961 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
|
2962 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2963 DestroyWindow(sb->id); |
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 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2966 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2967 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2968 * 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
|
2969 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2970 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2971 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
|
2972 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2973 RECT rct; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2974 POINT mp; |
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 (void)GetWindowRect(s_textArea, &rct); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2977 (void)GetCursorPos((LPPOINT)&mp); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2978 *x = (int)(mp.x - rct.left); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2979 *y = (int)(mp.y - rct.top); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2980 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2981 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2982 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2983 * 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
|
2984 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2985 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2986 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
|
2987 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2988 RECT rct; |
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)GetWindowRect(s_textArea, &rct); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2991 (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
|
2992 y + gui.border_offset + rct.top); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2993 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2994 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2995 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2996 gui_mswin_get_valid_dimensions( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2997 int w, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2998 int h, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
2999 int *valid_w, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3000 int *valid_h) |
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 int base_width, base_height; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3003 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3004 base_width = gui_get_base_width() |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3005 + (GetSystemMetrics(SM_CXFRAME) + |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3006 GetSystemMetrics(SM_CXPADDEDBORDER)) * 2; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3007 base_height = gui_get_base_height() |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3008 + (GetSystemMetrics(SM_CYFRAME) + |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3009 GetSystemMetrics(SM_CXPADDEDBORDER)) * 2 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3010 + GetSystemMetrics(SM_CYCAPTION) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3011 #ifdef FEAT_MENU |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3012 + gui_mswin_get_menu_height(FALSE) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3013 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3014 ; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3015 *valid_w = base_width + |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3016 ((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
|
3017 *valid_h = base_height + |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3018 ((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
|
3019 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3020 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3021 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3022 gui_mch_flash(int msec) |
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 RECT rc; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3025 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3026 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3027 * 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
|
3028 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3029 rc.left = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3030 rc.top = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3031 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
|
3032 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
|
3033 InvertRect(s_hdc, &rc); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3034 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
|
3035 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3036 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
|
3037 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3038 InvertRect(s_hdc, &rc); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3039 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3040 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3041 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3042 * Return flags used for scrolling. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3043 * 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
|
3044 * 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
|
3045 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3046 static int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3047 get_scroll_flags(void) |
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 HWND hwnd; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3050 RECT rcVim, rcOther, rcDest; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3051 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3052 GetWindowRect(s_hwnd, &rcVim); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3053 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3054 /* 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
|
3055 * 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
|
3056 * scrolling up or down. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3057 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
|
3058 return SW_INVALIDATE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3059 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3060 /* 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
|
3061 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
|
3062 if (IsWindowVisible(hwnd)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3063 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3064 GetWindowRect(hwnd, &rcOther); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3065 if (IntersectRect(&rcDest, &rcVim, &rcOther)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3066 return SW_INVALIDATE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3067 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3068 return 0; |
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 |
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 * 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
|
3073 * may not be scrolled out properly. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3074 * 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
|
3075 * 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
|
3076 * 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
|
3077 * the region before ScrollWindowEx(). |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3078 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3079 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3080 intel_gpu_workaround(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3081 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3082 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
|
3083 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3084 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3085 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3086 * 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
|
3087 * 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
|
3088 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3089 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3090 gui_mch_delete_lines( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3091 int row, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3092 int num_lines) |
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 RECT rc; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3095 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3096 intel_gpu_workaround(); |
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 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
|
3099 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
|
3100 rc.top = FILL_Y(row); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3101 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
|
3102 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3103 ScrollWindowEx(s_textArea, 0, -num_lines * gui.char_height, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3104 &rc, &rc, NULL, NULL, get_scroll_flags()); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3105 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3106 UpdateWindow(s_textArea); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3107 /* 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
|
3108 * 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
|
3109 * the screen... But why? (Webb) */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3110 /* 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
|
3111 /* gui.cursor_is_valid = FALSE; */ |
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 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
|
3114 gui.scroll_region_left, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3115 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
|
3116 } |
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 * 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
|
3120 * following text within the scroll region. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3121 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3122 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3123 gui_mch_insert_lines( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3124 int row, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3125 int num_lines) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3126 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3127 RECT rc; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3128 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3129 intel_gpu_workaround(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3130 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3131 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
|
3132 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
|
3133 rc.top = FILL_Y(row); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3134 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
|
3135 /* 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
|
3136 * off-screen. How do we avoid it when it's not needed? */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3137 ScrollWindowEx(s_textArea, 0, num_lines * gui.char_height, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3138 &rc, &rc, NULL, NULL, get_scroll_flags()); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3139 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3140 UpdateWindow(s_textArea); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3141 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3142 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
|
3143 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
|
3144 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3145 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3146 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3147 /*ARGSUSED*/ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3148 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3149 gui_mch_exit(int rc) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3150 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3151 #if defined(FEAT_DIRECTX) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3152 DWriteContext_Close(s_dwc); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3153 DWrite_Final(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3154 s_dwc = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3155 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3156 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3157 ReleaseDC(s_textArea, s_hdc); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3158 DeleteObject(s_brush); |
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 #ifdef FEAT_TEAROFF |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3161 /* Unload the tearoff bitmap */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3162 (void)DeleteObject((HGDIOBJ)s_htearbitmap); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3163 #endif |
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 /* 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
|
3166 if (s_hwnd != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3167 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3168 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
|
3169 DestroyWindow(s_hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3170 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3171 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3172 #ifdef GLOBAL_IME |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3173 global_ime_end(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3174 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3175 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3176 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3177 static char_u * |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3178 logfont2name(LOGFONT lf) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3179 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3180 char *p; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3181 char *res; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3182 char *charset_name; |
8835
c1a5623cfc86
commit https://github.com/vim/vim/commit/7c1c6dbb6817640fd3956a0d5417da23fde336d8
Christian Brabandt <cb@256bit.org>
parents:
8813
diff
changeset
|
3183 char *quality_name; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3184 char *font_name = lf.lfFaceName; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3185 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3186 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
|
3187 #ifdef FEAT_MBYTE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3188 /* 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
|
3189 * 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
|
3190 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
|
3191 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3192 int len; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3193 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
|
3194 (char_u **)&font_name, &len); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3195 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3196 #endif |
8835
c1a5623cfc86
commit https://github.com/vim/vim/commit/7c1c6dbb6817640fd3956a0d5417da23fde336d8
Christian Brabandt <cb@256bit.org>
parents:
8813
diff
changeset
|
3197 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
|
3198 |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3199 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
|
3200 + (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
|
3201 if (res != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3202 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3203 p = res; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3204 /* 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
|
3205 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
|
3206 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
|
3207 while (*p) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3208 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3209 if (*p == ' ') |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3210 *p = '_'; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3211 ++p; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3212 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3213 if (lf.lfItalic) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3214 STRCAT(p, ":i"); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3215 if (lf.lfWeight >= FW_BOLD) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3216 STRCAT(p, ":b"); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3217 if (lf.lfUnderline) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3218 STRCAT(p, ":u"); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3219 if (lf.lfStrikeOut) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3220 STRCAT(p, ":s"); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3221 if (charset_name != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3222 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3223 STRCAT(p, ":c"); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3224 STRCAT(p, charset_name); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3225 } |
8835
c1a5623cfc86
commit https://github.com/vim/vim/commit/7c1c6dbb6817640fd3956a0d5417da23fde336d8
Christian Brabandt <cb@256bit.org>
parents:
8813
diff
changeset
|
3226 if (quality_name != NULL) |
c1a5623cfc86
commit https://github.com/vim/vim/commit/7c1c6dbb6817640fd3956a0d5417da23fde336d8
Christian Brabandt <cb@256bit.org>
parents:
8813
diff
changeset
|
3227 { |
c1a5623cfc86
commit https://github.com/vim/vim/commit/7c1c6dbb6817640fd3956a0d5417da23fde336d8
Christian Brabandt <cb@256bit.org>
parents:
8813
diff
changeset
|
3228 STRCAT(p, ":q"); |
c1a5623cfc86
commit https://github.com/vim/vim/commit/7c1c6dbb6817640fd3956a0d5417da23fde336d8
Christian Brabandt <cb@256bit.org>
parents:
8813
diff
changeset
|
3229 STRCAT(p, quality_name); |
c1a5623cfc86
commit https://github.com/vim/vim/commit/7c1c6dbb6817640fd3956a0d5417da23fde336d8
Christian Brabandt <cb@256bit.org>
parents:
8813
diff
changeset
|
3230 } |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3231 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3232 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3233 #ifdef FEAT_MBYTE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3234 if (font_name != lf.lfFaceName) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3235 vim_free(font_name); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3236 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3237 return (char_u *)res; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3238 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3239 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3240 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3241 #ifdef FEAT_MBYTE_IME |
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 * 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
|
3244 * 'guifont' |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3245 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3246 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3247 update_im_font(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3248 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3249 LOGFONT lf_wide; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3250 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3251 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
|
3252 && gui.wide_font != NOFONT |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3253 && 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
|
3254 norm_logfont = lf_wide; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3255 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3256 norm_logfont = sub_logfont; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3257 im_set_font(&norm_logfont); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3258 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3259 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3260 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3261 #ifdef FEAT_MBYTE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3262 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3263 * 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
|
3264 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3265 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3266 gui_mch_wide_font_changed(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3267 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3268 LOGFONT lf; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3269 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3270 # ifdef FEAT_MBYTE_IME |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3271 update_im_font(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3272 # endif |
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 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
|
3275 gui.wide_ital_font = NOFONT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3276 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
|
3277 gui.wide_bold_font = NOFONT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3278 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
|
3279 gui.wide_boldital_font = NOFONT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3280 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3281 if (gui.wide_font |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3282 && 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
|
3283 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3284 if (!lf.lfItalic) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3285 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3286 lf.lfItalic = TRUE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3287 gui.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
|
3288 lf.lfItalic = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3289 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3290 if (lf.lfWeight < FW_BOLD) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3291 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3292 lf.lfWeight = FW_BOLD; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3293 gui.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
|
3294 if (!lf.lfItalic) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3295 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3296 lf.lfItalic = TRUE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3297 gui.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
|
3298 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3299 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3300 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3301 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3302 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3303 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3304 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3305 * 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
|
3306 * 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
|
3307 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3308 /*ARGSUSED*/ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3309 int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3310 gui_mch_init_font(char_u *font_name, int fontset) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3311 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3312 LOGFONT lf; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3313 GuiFont font = NOFONT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3314 char_u *p; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3315 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3316 /* Load the font */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3317 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
|
3318 font = get_font_handle(&lf); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3319 if (font == NOFONT) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3320 return FAIL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3321 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3322 if (font_name == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3323 font_name = (char_u *)lf.lfFaceName; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3324 #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
|
3325 norm_logfont = lf; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3326 sub_logfont = lf; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3327 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3328 #ifdef FEAT_MBYTE_IME |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3329 update_im_font(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3330 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3331 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
|
3332 gui.norm_font = font; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3333 current_font_height = lf.lfHeight; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3334 GetFontSize(font); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3335 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3336 p = logfont2name(lf); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3337 if (p != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3338 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3339 hl_set_font_name(p); |
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 /* 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
|
3342 * */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3343 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
|
3344 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3345 vim_free(p_guifont); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3346 p_guifont = p; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3347 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3348 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3349 vim_free(p); |
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 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
|
3353 gui.ital_font = NOFONT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3354 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
|
3355 gui.bold_font = NOFONT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3356 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
|
3357 gui.boldital_font = NOFONT; |
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 if (!lf.lfItalic) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3360 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3361 lf.lfItalic = TRUE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3362 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
|
3363 lf.lfItalic = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3364 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3365 if (lf.lfWeight < FW_BOLD) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3366 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3367 lf.lfWeight = FW_BOLD; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3368 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
|
3369 if (!lf.lfItalic) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3370 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3371 lf.lfItalic = TRUE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3372 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
|
3373 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3374 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3375 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3376 return OK; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3377 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3378 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3379 #ifndef WPF_RESTORETOMAXIMIZED |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3380 # 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
|
3381 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3382 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3383 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3384 * 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
|
3385 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3386 int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3387 gui_mch_maximized(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3388 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3389 WINDOWPLACEMENT wp; |
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 wp.length = sizeof(WINDOWPLACEMENT); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3392 if (GetWindowPlacement(s_hwnd, &wp)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3393 return wp.showCmd == SW_SHOWMAXIMIZED |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3394 || (wp.showCmd == SW_SHOWMINIMIZED |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3395 && wp.flags == WPF_RESTORETOMAXIMIZED); |
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 return 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3398 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3399 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3400 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3401 * Called when the font changed while the window is maximized. Compute the |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3402 * new Rows and Columns. This is like resizing the window. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3403 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3404 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3405 gui_mch_newfont(void) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3406 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3407 RECT rect; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3408 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3409 GetWindowRect(s_hwnd, &rect); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3410 if (win_socket_id == 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3411 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3412 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
|
3413 - (GetSystemMetrics(SM_CXFRAME) + |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3414 GetSystemMetrics(SM_CXPADDEDBORDER)) * 2, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3415 rect.bottom - rect.top |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3416 - (GetSystemMetrics(SM_CYFRAME) + |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3417 GetSystemMetrics(SM_CXPADDEDBORDER)) * 2 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3418 - GetSystemMetrics(SM_CYCAPTION) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3419 #ifdef FEAT_MENU |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3420 - gui_mswin_get_menu_height(FALSE) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3421 #endif |
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 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3424 else |
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 /* 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
|
3427 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
|
3428 rect.bottom - rect.top |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3429 #ifdef FEAT_MENU |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3430 - gui_mswin_get_menu_height(FALSE) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3431 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3432 ); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3433 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3434 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3435 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3436 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3437 * Set the window title |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3438 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3439 /*ARGSUSED*/ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3440 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3441 gui_mch_settitle( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3442 char_u *title, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3443 char_u *icon) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3444 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3445 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
|
3446 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3447 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3448 #ifdef FEAT_MOUSESHAPE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3449 /* 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
|
3450 * misc2.c! */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3451 static LPCSTR mshape_idcs[] = |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3452 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3453 IDC_ARROW, /* arrow */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3454 MAKEINTRESOURCE(0), /* blank */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3455 IDC_IBEAM, /* beam */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3456 IDC_SIZENS, /* updown */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3457 IDC_SIZENS, /* udsizing */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3458 IDC_SIZEWE, /* leftright */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3459 IDC_SIZEWE, /* lrsizing */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3460 IDC_WAIT, /* busy */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3461 #ifdef WIN3264 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3462 IDC_NO, /* no */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3463 #else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3464 IDC_ICON, /* no */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3465 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3466 IDC_ARROW, /* crosshair */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3467 IDC_ARROW, /* hand1 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3468 IDC_ARROW, /* hand2 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3469 IDC_ARROW, /* pencil */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3470 IDC_ARROW, /* question */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3471 IDC_ARROW, /* right-arrow */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3472 IDC_UPARROW, /* up-arrow */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3473 IDC_ARROW /* last one */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3474 }; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3475 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3476 void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3477 mch_set_mouse_shape(int shape) |
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 LPCSTR idc; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3480 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3481 if (shape == MSHAPE_HIDE) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3482 ShowCursor(FALSE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3483 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3484 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3485 if (shape >= MSHAPE_NUMBERED) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3486 idc = IDC_ARROW; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3487 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3488 idc = mshape_idcs[shape]; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3489 #ifdef SetClassLongPtr |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3490 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
|
3491 #else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3492 # ifdef WIN32 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3493 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
|
3494 # else /* Win16 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3495 SetClassWord(s_textArea, GCW_HCURSOR, (WORD)LoadCursor(NULL, idc)); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3496 # endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3497 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3498 if (!p_mh) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3499 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3500 POINT mp; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3501 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3502 /* 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
|
3503 (void)GetCursorPos((LPPOINT)&mp); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3504 (void)SetCursorPos(mp.x, mp.y); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3505 ShowCursor(TRUE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3506 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3507 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3508 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3509 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3510 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3511 #ifdef FEAT_BROWSE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3512 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3513 * 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
|
3514 * 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
|
3515 * 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
|
3516 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3517 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3518 # if defined(FEAT_MBYTE) && defined(WIN3264) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3519 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3520 * Wide version of convert_filter(). |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3521 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3522 static WCHAR * |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3523 convert_filterW(char_u *s) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3524 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3525 char_u *tmp; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3526 int len; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3527 WCHAR *res; |
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 tmp = convert_filter(s); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3530 if (tmp == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3531 return NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3532 len = (int)STRLEN(s) + 3; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3533 res = enc_to_utf16(tmp, &len); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3534 vim_free(tmp); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3535 return res; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3536 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3537 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3538 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3539 * 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
|
3540 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3541 static char_u * |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3542 gui_mch_browseW( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3543 int saving, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3544 char_u *title, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3545 char_u *dflt, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3546 char_u *ext, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3547 char_u *initdir, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3548 char_u *filter) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3549 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3550 /* 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
|
3551 * otherwise it fails miserably! */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3552 OPENFILENAMEW fileStruct; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3553 WCHAR fileBuf[MAXPATHL]; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3554 WCHAR *wp; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3555 int i; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3556 WCHAR *titlep = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3557 WCHAR *extp = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3558 WCHAR *initdirp = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3559 WCHAR *filterp; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3560 char_u *p; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3561 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3562 if (dflt == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3563 fileBuf[0] = NUL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3564 else |
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 wp = enc_to_utf16(dflt, NULL); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3567 if (wp == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3568 fileBuf[0] = NUL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3569 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3570 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3571 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
|
3572 fileBuf[i] = wp[i]; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3573 fileBuf[i] = NUL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3574 vim_free(wp); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3575 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3576 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3577 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3578 /* Convert the filter to Windows format. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3579 filterp = convert_filterW(filter); |
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 vim_memset(&fileStruct, 0, sizeof(OPENFILENAMEW)); |
8571
debe6347024d
commit https://github.com/vim/vim/commit/89e375a88f3eceb73bbd97e78aca1a1c4647c897
Christian Brabandt <cb@256bit.org>
parents:
8281
diff
changeset
|
3582 #ifdef OPENFILENAME_SIZE_VERSION_400W |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3583 /* 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
|
3584 fileStruct.lStructSize = OPENFILENAME_SIZE_VERSION_400W; |
8140
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3585 #else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3586 fileStruct.lStructSize = sizeof(fileStruct); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3587 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3588 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3589 if (title != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3590 titlep = enc_to_utf16(title, NULL); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3591 fileStruct.lpstrTitle = titlep; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3592 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3593 if (ext != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3594 extp = enc_to_utf16(ext, NULL); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3595 fileStruct.lpstrDefExt = extp; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3596 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3597 fileStruct.lpstrFile = fileBuf; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3598 fileStruct.nMaxFile = MAXPATHL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3599 fileStruct.lpstrFilter = filterp; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3600 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
|
3601 /* has an initial dir been specified? */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3602 if (initdir != NULL && *initdir != NUL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3603 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3604 /* 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
|
3605 initdirp = enc_to_utf16(initdir, NULL); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3606 if (initdirp != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3607 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3608 for (wp = initdirp; *wp != NUL; ++wp) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3609 if (*wp == '/') |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3610 *wp = '\\'; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3611 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3612 fileStruct.lpstrInitialDir = initdirp; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3613 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3614 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3615 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3616 * 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
|
3617 * 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
|
3618 * 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
|
3619 * 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
|
3620 * OFN_PATHMUSTEXIST? |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3621 * 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
|
3622 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3623 fileStruct.Flags = (OFN_NOCHANGEDIR | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3624 #ifdef FEAT_SHORTCUT |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3625 if (curbuf->b_p_bin) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3626 fileStruct.Flags |= OFN_NODEREFERENCELINKS; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3627 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3628 if (saving) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3629 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3630 if (!GetSaveFileNameW(&fileStruct)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3631 return NULL; |
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 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3634 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3635 if (!GetOpenFileNameW(&fileStruct)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3636 return NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3637 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3638 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3639 vim_free(filterp); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3640 vim_free(initdirp); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3641 vim_free(titlep); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3642 vim_free(extp); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3643 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3644 /* Convert from UCS2 to 'encoding'. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3645 p = utf16_to_enc(fileBuf, NULL); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3646 if (p != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3647 /* 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
|
3648 STRCPY(fileBuf, p); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3649 vim_free(p); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3650 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3651 /* 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
|
3652 SetFocus(s_hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3653 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3654 /* Shorten the file name if possible */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3655 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
|
3656 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3657 # endif /* FEAT_MBYTE */ |
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 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3661 * 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
|
3662 * 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
|
3663 * 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
|
3664 * |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3665 * 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
|
3666 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3667 static char_u * |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3668 convert_filter(char_u *s) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3669 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3670 char_u *res; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3671 unsigned s_len = (unsigned)STRLEN(s); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3672 unsigned i; |
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 res = alloc(s_len + 3); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3675 if (res != 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 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
|
3678 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
|
3679 res[i] = '\0'; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3680 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3681 res[i] = s[i]; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3682 res[s_len] = NUL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3683 /* 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
|
3684 res[s_len + 1] = NUL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3685 res[s_len + 2] = NUL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3686 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3687 return res; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3688 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3689 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3690 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3691 * Select a directory. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3692 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3693 char_u * |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3694 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
|
3695 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3696 /* 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
|
3697 * 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
|
3698 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
|
3699 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
|
3700 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3701 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3702 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3703 * 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
|
3704 * or NULL if Cancel is hit. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3705 * 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
|
3706 * 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
|
3707 * dflt - Default name of file. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3708 * 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
|
3709 * 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
|
3710 * 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
|
3711 * |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3712 * 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
|
3713 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3714 char_u * |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3715 gui_mch_browse( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3716 int saving, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3717 char_u *title, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3718 char_u *dflt, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3719 char_u *ext, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3720 char_u *initdir, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3721 char_u *filter) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3722 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3723 OPENFILENAME fileStruct; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3724 char_u fileBuf[MAXPATHL]; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3725 char_u *initdirp = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3726 char_u *filterp; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3727 char_u *p; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3728 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3729 # if defined(FEAT_MBYTE) && defined(WIN3264) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3730 if (os_version.dwPlatformId == VER_PLATFORM_WIN32_NT) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3731 return gui_mch_browseW(saving, title, dflt, ext, initdir, filter); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3732 # endif |
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 if (dflt == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3735 fileBuf[0] = NUL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3736 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3737 vim_strncpy(fileBuf, dflt, MAXPATHL - 1); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3738 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3739 /* Convert the filter to Windows format. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3740 filterp = convert_filter(filter); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3741 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3742 vim_memset(&fileStruct, 0, sizeof(OPENFILENAME)); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3743 #ifdef OPENFILENAME_SIZE_VERSION_400 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3744 /* 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
|
3745 fileStruct.lStructSize = OPENFILENAME_SIZE_VERSION_400; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3746 #else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3747 fileStruct.lStructSize = sizeof(fileStruct); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3748 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3749 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3750 fileStruct.lpstrTitle = (LPSTR)title; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3751 fileStruct.lpstrDefExt = (LPSTR)ext; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3752 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3753 fileStruct.lpstrFile = (LPSTR)fileBuf; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3754 fileStruct.nMaxFile = MAXPATHL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3755 fileStruct.lpstrFilter = (LPSTR)filterp; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3756 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
|
3757 /* has an initial dir been specified? */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3758 if (initdir != NULL && *initdir != NUL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3759 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3760 /* 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
|
3761 initdirp = vim_strsave(initdir); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3762 if (initdirp != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3763 for (p = initdirp; *p != NUL; ++p) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3764 if (*p == '/') |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3765 *p = '\\'; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3766 fileStruct.lpstrInitialDir = (LPSTR)initdirp; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3767 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3768 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3769 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3770 * 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
|
3771 * 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
|
3772 * 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
|
3773 * 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
|
3774 * OFN_PATHMUSTEXIST? |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3775 * 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
|
3776 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3777 fileStruct.Flags = (OFN_NOCHANGEDIR | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3778 #ifdef FEAT_SHORTCUT |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3779 if (curbuf->b_p_bin) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3780 fileStruct.Flags |= OFN_NODEREFERENCELINKS; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3781 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3782 if (saving) |
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 if (!GetSaveFileName(&fileStruct)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3785 return NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3786 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3787 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3788 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3789 if (!GetOpenFileName(&fileStruct)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3790 return NULL; |
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3793 vim_free(filterp); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3794 vim_free(initdirp); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3795 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3796 /* 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
|
3797 SetFocus(s_hwnd); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3798 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3799 /* Shorten the file name if possible */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3800 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
|
3801 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3802 #endif /* FEAT_BROWSE */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3803 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3804 /*ARGSUSED*/ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3805 static void |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3806 _OnDropFiles( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3807 HWND hwnd, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3808 HDROP hDrop) |
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 #ifdef FEAT_WINDOWS |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3811 #ifdef WIN3264 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3812 # define BUFPATHLEN _MAX_PATH |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3813 # define DRAGQVAL 0xFFFFFFFF |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3814 #else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3815 # define BUFPATHLEN MAXPATHL |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3816 # define DRAGQVAL 0xFFFF |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3817 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3818 #ifdef FEAT_MBYTE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3819 WCHAR wszFile[BUFPATHLEN]; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3820 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3821 char szFile[BUFPATHLEN]; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3822 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
|
3823 UINT i; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3824 char_u **fnames; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3825 POINT pt; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3826 int_u modifiers = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3827 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3828 /* 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
|
3829 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3830 /* Obtain dropped position */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3831 DragQueryPoint(hDrop, &pt); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3832 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
|
3833 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3834 reset_VIsual(); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3835 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3836 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
|
3837 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3838 if (fnames != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3839 for (i = 0; i < cFiles; ++i) |
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 #ifdef FEAT_MBYTE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3842 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
|
3843 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
|
3844 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3845 #endif |
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 DragQueryFile(hDrop, i, szFile, BUFPATHLEN); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3848 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
|
3849 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3850 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3851 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3852 DragFinish(hDrop); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3853 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3854 if (fnames != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3855 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3856 if ((GetKeyState(VK_SHIFT) & 0x8000) != 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3857 modifiers |= MOUSE_SHIFT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3858 if ((GetKeyState(VK_CONTROL) & 0x8000) != 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3859 modifiers |= MOUSE_CTRL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3860 if ((GetKeyState(VK_MENU) & 0x8000) != 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3861 modifiers |= MOUSE_ALT; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3862 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3863 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
|
3864 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3865 s_need_activate = TRUE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3866 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3867 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3868 } |
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 /*ARGSUSED*/ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3871 static int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3872 _OnScroll( |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3873 HWND hwnd, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3874 HWND hwndCtl, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3875 UINT code, |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3876 int pos) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3877 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3878 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
|
3879 scrollbar_T *sb, *sb_info; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3880 long val; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3881 int dragging = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3882 int dont_scroll_save = dont_scroll; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3883 #ifndef WIN3264 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3884 int nPos; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3885 #else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3886 SCROLLINFO si; |
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 si.cbSize = sizeof(si); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3889 si.fMask = SIF_POS; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3890 #endif |
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 sb = gui_mswin_find_scrollbar(hwndCtl); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3893 if (sb == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3894 return 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3895 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3896 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
|
3897 { |
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 * 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
|
3900 * 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
|
3901 * gui_drag_scrollbar(). |
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 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
|
3904 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3905 else /* Bottom scrollbar */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3906 sb_info = sb; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3907 val = sb_info->value; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3908 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3909 switch (code) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3910 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3911 case SB_THUMBTRACK: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3912 val = pos; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3913 dragging = TRUE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3914 if (sb->scroll_shift > 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3915 val <<= sb->scroll_shift; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3916 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3917 case SB_LINEDOWN: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3918 val++; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3919 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3920 case SB_LINEUP: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3921 val--; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3922 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3923 case SB_PAGEDOWN: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3924 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
|
3925 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3926 case SB_PAGEUP: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3927 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
|
3928 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3929 case SB_TOP: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3930 val = 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3931 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3932 case SB_BOTTOM: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3933 val = sb_info->max; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3934 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3935 case SB_ENDSCROLL: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3936 if (prev_code == SB_THUMBTRACK) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3937 { |
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 * "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
|
3940 * 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
|
3941 * 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
|
3942 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3943 val = GetScrollPos(hwndCtl, SB_CTL); |
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 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3947 break; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3948 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3949 default: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3950 /* 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
|
3951 return 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3952 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3953 prev_code = code; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3954 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3955 #ifdef WIN3264 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3956 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
|
3957 SetScrollInfo(hwndCtl, SB_CTL, &si, TRUE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3958 #else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3959 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
|
3960 SetScrollPos(hwndCtl, SB_CTL, nPos, TRUE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3961 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3962 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3963 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3964 * 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
|
3965 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3966 if (sb->wp != NULL) |
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 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
|
3969 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
|
3970 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3971 #ifdef WIN3264 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3972 SetScrollInfo(id, SB_CTL, &si, TRUE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3973 #else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3974 SetScrollPos(id, SB_CTL, nPos, TRUE); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3975 #endif |
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3978 /* 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
|
3979 s_busy_processing = TRUE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3980 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3981 /* 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
|
3982 * 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
|
3983 dont_scroll = !allow_scrollbar; |
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 gui_drag_scrollbar(sb, val, dragging); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3986 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3987 s_busy_processing = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3988 dont_scroll = dont_scroll_save; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3989 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3990 return 0; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3991 } |
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3994 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3995 * Get command line arguments. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3996 * 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
|
3997 * Copy the arguments to allocated memory. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
3998 * 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
|
3999 * 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
|
4000 * 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
|
4001 * Return pointer to buffer in "tofree". |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4002 * Returns zero when out of memory. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4003 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4004 /*ARGSUSED*/ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4005 int |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4006 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
|
4007 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4008 int i; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4009 char *p; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4010 char *progp; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4011 char *pnew = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4012 char *newcmdline; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4013 int inquote; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4014 int argc; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4015 char **argv = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4016 int round; |
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 *tofree = NULL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4019 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4020 #ifdef FEAT_MBYTE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4021 /* 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
|
4022 * 'encoding' is changed. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4023 argc = get_cmd_argsW(&argv); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4024 if (argc != 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4025 goto done; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4026 #endif |
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 /* 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
|
4029 * non-space. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4030 p = strrchr(prog, '.'); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4031 if (p != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4032 *p = NUL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4033 for (progp = prog; *progp == ' '; ++progp) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4034 ; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4035 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4036 /* 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
|
4037 * 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
|
4038 * NUL. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4039 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
|
4040 if (newcmdline == NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4041 return 0; |
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 /* |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4044 * 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
|
4045 * Second round: produce the arguments. |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4046 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4047 for (round = 1; round <= 2; ++round) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4048 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4049 /* First argument is the program name. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4050 if (pnew != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4051 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4052 argv[0] = pnew; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4053 strcpy(pnew, progp); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4054 pnew += strlen(pnew); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4055 *pnew++ = NUL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4056 } |
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 * 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
|
4060 */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4061 p = cmdline; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4062 argc = 1; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4063 while (*p != NUL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4064 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4065 inquote = FALSE; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4066 if (pnew != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4067 argv[argc] = pnew; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4068 ++argc; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4069 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
|
4070 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4071 /* 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
|
4072 * quote. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4073 i = (int)strspn(p, "\\"); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4074 if (p[i] == '"') |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4075 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4076 /* Halve the number of backslashes. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4077 if (i > 1 && pnew != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4078 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4079 vim_memset(pnew, '\\', i / 2); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4080 pnew += i / 2; |
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4083 /* 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
|
4084 * the double quote. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4085 if ((i & 1) == 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4086 inquote = !inquote; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4087 else if (pnew != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4088 *pnew++ = '"'; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4089 p += i + 1; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4090 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4091 else if (i > 0) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4092 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4093 /* Copy span of backslashes unmodified. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4094 if (pnew != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4095 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4096 vim_memset(pnew, '\\', i); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4097 pnew += 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 p += i; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4100 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4101 else |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4102 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4103 if (pnew != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4104 *pnew++ = *p; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4105 #ifdef FEAT_MBYTE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4106 /* 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
|
4107 * initialized yet here. */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4108 if (IsDBCSLeadByte(*p)) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4109 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4110 ++p; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4111 if (pnew != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4112 *pnew++ = *p; |
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 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4115 ++p; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4116 } |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4117 } |
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 if (pnew != NULL) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4120 *pnew++ = NUL; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4121 while (*p == ' ' || *p == '\t') |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4122 ++p; /* advance until a non-space */ |
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4125 if (round == 1) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4126 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4127 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
|
4128 if (argv == NULL ) |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4129 { |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4130 free(newcmdline); |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4131 return 0; /* malloc error */ |
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 pnew = newcmdline; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4134 *tofree = newcmdline; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4135 } |
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 |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4138 #ifdef FEAT_MBYTE |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4139 done: |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4140 #endif |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4141 argv[argc] = NULL; /* NULL-terminated list */ |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4142 *argvp = argv; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4143 return argc; |
563c923b1584
commit https://github.com/vim/vim/commit/cf7164a088664961e7d70dd100c5874dc5ceb293
Christian Brabandt <cb@256bit.org>
parents:
8138
diff
changeset
|
4144 } |
7 | 4145 |
4146 #ifdef FEAT_XPM_W32 | |
4147 # include "xpm_w32.h" | |
4148 #endif | |
4149 | |
4150 #ifdef PROTO | |
4151 # define WINAPI | |
4152 #endif | |
4153 | |
4154 #ifdef __MINGW32__ | |
4155 /* | |
4156 * Add a lot of missing defines. | |
4157 * They are not always missing, we need the #ifndef's. | |
4158 */ | |
4159 # ifndef _cdecl | |
4160 # define _cdecl | |
4161 # endif | |
4162 # ifndef IsMinimized | |
4163 # define IsMinimized(hwnd) IsIconic(hwnd) | |
4164 # endif | |
4165 # ifndef IsMaximized | |
4166 # define IsMaximized(hwnd) IsZoomed(hwnd) | |
4167 # endif | |
4168 # ifndef SelectFont | |
4169 # define SelectFont(hdc, hfont) ((HFONT)SelectObject((hdc), (HGDIOBJ)(HFONT)(hfont))) | |
4170 # endif | |
4171 # ifndef GetStockBrush | |
4172 # define GetStockBrush(i) ((HBRUSH)GetStockObject(i)) | |
4173 # endif | |
4174 # ifndef DeleteBrush | |
4175 # define DeleteBrush(hbr) DeleteObject((HGDIOBJ)(HBRUSH)(hbr)) | |
4176 # endif | |
4177 | |
4178 # ifndef HANDLE_WM_RBUTTONDBLCLK | |
4179 # define HANDLE_WM_RBUTTONDBLCLK(hwnd, wParam, lParam, fn) \ | |
4180 ((fn)((hwnd), TRUE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) | |
4181 # endif | |
4182 # ifndef HANDLE_WM_MBUTTONUP | |
4183 # define HANDLE_WM_MBUTTONUP(hwnd, wParam, lParam, fn) \ | |
4184 ((fn)((hwnd), (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) | |
4185 # endif | |
4186 # ifndef HANDLE_WM_MBUTTONDBLCLK | |
4187 # define HANDLE_WM_MBUTTONDBLCLK(hwnd, wParam, lParam, fn) \ | |
4188 ((fn)((hwnd), TRUE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) | |
4189 # endif | |
4190 # ifndef HANDLE_WM_LBUTTONDBLCLK | |
4191 # define HANDLE_WM_LBUTTONDBLCLK(hwnd, wParam, lParam, fn) \ | |
4192 ((fn)((hwnd), TRUE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) | |
4193 # endif | |
4194 # ifndef HANDLE_WM_RBUTTONDOWN | |
4195 # define HANDLE_WM_RBUTTONDOWN(hwnd, wParam, lParam, fn) \ | |
4196 ((fn)((hwnd), FALSE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) | |
4197 # endif | |
4198 # ifndef HANDLE_WM_MOUSEMOVE | |
4199 # define HANDLE_WM_MOUSEMOVE(hwnd, wParam, lParam, fn) \ | |
4200 ((fn)((hwnd), (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) | |
4201 # endif | |
4202 # ifndef HANDLE_WM_RBUTTONUP | |
4203 # define HANDLE_WM_RBUTTONUP(hwnd, wParam, lParam, fn) \ | |
4204 ((fn)((hwnd), (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) | |
4205 # endif | |
4206 # ifndef HANDLE_WM_MBUTTONDOWN | |
4207 # define HANDLE_WM_MBUTTONDOWN(hwnd, wParam, lParam, fn) \ | |
4208 ((fn)((hwnd), FALSE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) | |
4209 # endif | |
4210 # ifndef HANDLE_WM_LBUTTONUP | |
4211 # define HANDLE_WM_LBUTTONUP(hwnd, wParam, lParam, fn) \ | |
4212 ((fn)((hwnd), (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) | |
4213 # endif | |
4214 # ifndef HANDLE_WM_LBUTTONDOWN | |
4215 # define HANDLE_WM_LBUTTONDOWN(hwnd, wParam, lParam, fn) \ | |
4216 ((fn)((hwnd), FALSE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L) | |
4217 # endif | |
4218 # ifndef HANDLE_WM_SYSCHAR | |
4219 # define HANDLE_WM_SYSCHAR(hwnd, wParam, lParam, fn) \ | |
4220 ((fn)((hwnd), (TCHAR)(wParam), (int)(short)LOWORD(lParam)), 0L) | |
4221 # endif | |
4222 # ifndef HANDLE_WM_ACTIVATEAPP | |
4223 # define HANDLE_WM_ACTIVATEAPP(hwnd, wParam, lParam, fn) \ | |
4224 ((fn)((hwnd), (BOOL)(wParam), (DWORD)(lParam)), 0L) | |
4225 # endif | |
4226 # ifndef HANDLE_WM_WINDOWPOSCHANGING | |
4227 # define HANDLE_WM_WINDOWPOSCHANGING(hwnd, wParam, lParam, fn) \ | |
4228 (LRESULT)(DWORD)(BOOL)(fn)((hwnd), (LPWINDOWPOS)(lParam)) | |
4229 # endif | |
4230 # ifndef HANDLE_WM_VSCROLL | |
4231 # define HANDLE_WM_VSCROLL(hwnd, wParam, lParam, fn) \ | |
4232 ((fn)((hwnd), (HWND)(lParam), (UINT)(LOWORD(wParam)), (int)(short)HIWORD(wParam)), 0L) | |
4233 # endif | |
4234 # ifndef HANDLE_WM_SETFOCUS | |
4235 # define HANDLE_WM_SETFOCUS(hwnd, wParam, lParam, fn) \ | |
4236 ((fn)((hwnd), (HWND)(wParam)), 0L) | |
4237 # endif | |
4238 # ifndef HANDLE_WM_KILLFOCUS | |
4239 # define HANDLE_WM_KILLFOCUS(hwnd, wParam, lParam, fn) \ | |
4240 ((fn)((hwnd), (HWND)(wParam)), 0L) | |
4241 # endif | |
4242 # ifndef HANDLE_WM_HSCROLL | |
4243 # define HANDLE_WM_HSCROLL(hwnd, wParam, lParam, fn) \ | |
4244 ((fn)((hwnd), (HWND)(lParam), (UINT)(LOWORD(wParam)), (int)(short)HIWORD(wParam)), 0L) | |
4245 # endif | |
4246 # ifndef HANDLE_WM_DROPFILES | |
4247 # define HANDLE_WM_DROPFILES(hwnd, wParam, lParam, fn) \ | |
4248 ((fn)((hwnd), (HDROP)(wParam)), 0L) | |
4249 # endif | |
4250 # ifndef HANDLE_WM_CHAR | |
4251 # define HANDLE_WM_CHAR(hwnd, wParam, lParam, fn) \ | |
4252 ((fn)((hwnd), (TCHAR)(wParam), (int)(short)LOWORD(lParam)), 0L) | |
4253 # endif | |
4254 # ifndef HANDLE_WM_SYSDEADCHAR | |
4255 # define HANDLE_WM_SYSDEADCHAR(hwnd, wParam, lParam, fn) \ | |
4256 ((fn)((hwnd), (TCHAR)(wParam), (int)(short)LOWORD(lParam)), 0L) | |
4257 # endif | |
4258 # ifndef HANDLE_WM_DEADCHAR | |
4259 # define HANDLE_WM_DEADCHAR(hwnd, wParam, lParam, fn) \ | |
4260 ((fn)((hwnd), (TCHAR)(wParam), (int)(short)LOWORD(lParam)), 0L) | |
4261 # endif | |
4262 #endif /* __MINGW32__ */ | |
4263 | |
4264 | |
4265 /* Some parameters for tearoff menus. All in pixels. */ | |
4266 #define TEAROFF_PADDING_X 2 | |
4267 #define TEAROFF_BUTTON_PAD_X 8 | |
4268 #define TEAROFF_MIN_WIDTH 200 | |
4269 #define TEAROFF_SUBMENU_LABEL ">>" | |
4270 #define TEAROFF_COLUMN_PADDING 3 // # spaces to pad column with. | |
4271 | |
4272 | |
4273 /* For the Intellimouse: */ | |
4274 #ifndef WM_MOUSEWHEEL | |
4275 #define WM_MOUSEWHEEL 0x20a | |
4276 #endif | |
4277 | |
4278 | |
4279 #ifdef FEAT_BEVAL | |
4280 # define ID_BEVAL_TOOLTIP 200 | |
4281 # define BEVAL_TEXT_LEN MAXPATHL | |
4282 | |
2224
a0cce15dd2a9
Fix definition of UINT_PTR for 64 bit systems.
Bram Moolenaar <bram@vim.org>
parents:
2217
diff
changeset
|
4283 #if (defined(_MSC_VER) && _MSC_VER < 1300) || !defined(MAXULONG_PTR) |
1621 | 4284 /* Work around old versions of basetsd.h which wrongly declares |
4285 * 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
|
4286 # undef UINT_PTR |
837 | 4287 # define UINT_PTR UINT |
4288 #endif | |
840 | 4289 |
7801
a1e71a01dbd6
commit https://github.com/vim/vim/commit/d25c16e2f2776d50245bf31d6e4d5364f12d188e
Christian Brabandt <cb@256bit.org>
parents:
7797
diff
changeset
|
4290 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
|
4291 static void delete_tooltip(BalloonEval *beval); |
a1e71a01dbd6
commit https://github.com/vim/vim/commit/d25c16e2f2776d50245bf31d6e4d5364f12d188e
Christian Brabandt <cb@256bit.org>
parents:
7797
diff
changeset
|
4292 static VOID CALLBACK BevalTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime); |
840 | 4293 |
7 | 4294 static BalloonEval *cur_beval = NULL; |
835 | 4295 static UINT_PTR BevalTimerId = 0; |
7 | 4296 static DWORD LastActivity = 0; |
435 | 4297 |
3927 | 4298 |
4299 /* cproto fails on missing include files */ | |
4300 #ifndef PROTO | |
4301 | |
435 | 4302 /* |
4303 * excerpts from headers since this may not be presented | |
843 | 4304 * in the extremely old compilers |
435 | 4305 */ |
3927 | 4306 # include <pshpack1.h> |
4307 | |
4308 #endif | |
435 | 4309 |
4310 typedef struct _DllVersionInfo | |
4311 { | |
4312 DWORD cbSize; | |
4313 DWORD dwMajorVersion; | |
4314 DWORD dwMinorVersion; | |
4315 DWORD dwBuildNumber; | |
4316 DWORD dwPlatformID; | |
4317 } DLLVERSIONINFO; | |
4318 | |
3927 | 4319 #ifndef PROTO |
4320 # include <poppack.h> | |
4321 #endif | |
2026 | 4322 |
435 | 4323 typedef struct tagTOOLINFOA_NEW |
4324 { | |
4325 UINT cbSize; | |
4326 UINT uFlags; | |
4327 HWND hwnd; | |
2026 | 4328 UINT_PTR uId; |
435 | 4329 RECT rect; |
4330 HINSTANCE hinst; | |
4331 LPSTR lpszText; | |
4332 LPARAM lParam; | |
4333 } TOOLINFO_NEW; | |
4334 | |
4335 typedef struct tagNMTTDISPINFO_NEW | |
4336 { | |
4337 NMHDR hdr; | |
2026 | 4338 LPSTR lpszText; |
435 | 4339 char szText[80]; |
4340 HINSTANCE hinst; | |
4341 UINT uFlags; | |
4342 LPARAM lParam; | |
4343 } NMTTDISPINFO_NEW; | |
4344 | |
4345 typedef HRESULT (WINAPI* DLLGETVERSIONPROC)(DLLVERSIONINFO *); | |
4346 #ifndef TTM_SETMAXTIPWIDTH | |
842 | 4347 # define TTM_SETMAXTIPWIDTH (WM_USER+24) |
7 | 4348 #endif |
4349 | |
435 | 4350 #ifndef TTF_DI_SETITEM |
842 | 4351 # define TTF_DI_SETITEM 0x8000 |
435 | 4352 #endif |
4353 | |
4354 #ifndef TTN_GETDISPINFO | |
842 | 4355 # define TTN_GETDISPINFO (TTN_FIRST - 0) |
435 | 4356 #endif |
4357 | |
4358 #endif /* defined(FEAT_BEVAL) */ | |
4359 | |
1213 | 4360 #if defined(FEAT_TOOLBAR) || defined(FEAT_GUI_TABLINE) |
4361 /* Older MSVC compilers don't have LPNMTTDISPINFO[AW] thus we need to define | |
4362 * it here if LPNMTTDISPINFO isn't defined. | |
4363 * MingW doesn't define LPNMTTDISPINFO but typedefs it. Thus we need to check | |
4364 * _MSC_VER. */ | |
4365 # if !defined(LPNMTTDISPINFO) && defined(_MSC_VER) | |
4366 typedef struct tagNMTTDISPINFOA { | |
4367 NMHDR hdr; | |
4368 LPSTR lpszText; | |
4369 char szText[80]; | |
4370 HINSTANCE hinst; | |
4371 UINT uFlags; | |
4372 LPARAM lParam; | |
4373 } NMTTDISPINFOA, *LPNMTTDISPINFOA; | |
4374 # define LPNMTTDISPINFO LPNMTTDISPINFOA | |
4375 | |
4376 # ifdef FEAT_MBYTE | |
4377 typedef struct tagNMTTDISPINFOW { | |
4378 NMHDR hdr; | |
4379 LPWSTR lpszText; | |
4380 WCHAR szText[80]; | |
4381 HINSTANCE hinst; | |
4382 UINT uFlags; | |
4383 LPARAM lParam; | |
4384 } NMTTDISPINFOW, *LPNMTTDISPINFOW; | |
4385 # endif | |
4386 # endif | |
4387 #endif | |
4388 | |
842 | 4389 #ifndef TTN_GETDISPINFOW |
4390 # define TTN_GETDISPINFOW (TTN_FIRST - 10) | |
4391 #endif | |
4392 | |
7 | 4393 /* Local variables: */ |
4394 | |
4395 #ifdef FEAT_MENU | |
4396 static UINT s_menu_id = 100; | |
2614 | 4397 #endif |
7 | 4398 |
4399 /* | |
4400 * Use the system font for dialogs and tear-off menus. Remove this line to | |
4401 * use DLG_FONT_NAME. | |
4402 */ | |
2614 | 4403 #define USE_SYSMENU_FONT |
7 | 4404 |
4405 #define VIM_NAME "vim" | |
4406 #define VIM_CLASS "Vim" | |
4407 #define VIM_CLASSW L"Vim" | |
4408 | |
4409 /* Initial size for the dialog template. For gui_mch_dialog() it's fixed, | |
4410 * thus there should be room for every dialog. For tearoffs it's made bigger | |
4411 * when needed. */ | |
4412 #define DLG_ALLOC_SIZE 16 * 1024 | |
4413 | |
4414 /* | |
4415 * stuff for dialogs, menus, tearoffs etc. | |
4416 */ | |
4417 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
|
4418 #ifdef FEAT_TEAROFF |
7 | 4419 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
|
4420 #endif |
7 | 4421 static PWORD |
4422 add_dialog_element( | |
4423 PWORD p, | |
4424 DWORD lStyle, | |
4425 WORD x, | |
4426 WORD y, | |
4427 WORD w, | |
4428 WORD h, | |
4429 WORD Id, | |
4430 WORD clss, | |
4431 const char *caption); | |
4432 static LPWORD lpwAlign(LPWORD); | |
4433 static int nCopyAnsiToWideChar(LPWORD, LPSTR); | |
8138
f52504c10387
commit https://github.com/vim/vim/commit/065bbac8adfe29a09958570237d223457f235c6c
Christian Brabandt <cb@256bit.org>
parents:
8108
diff
changeset
|
4434 #if defined(FEAT_MENU) && defined(FEAT_TEAROFF) |
7 | 4435 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
|
4436 #endif |
7 | 4437 static void get_dialog_font_metrics(void); |
4438 | |
4439 static int dialog_default_button = -1; | |
4440 | |
4441 /* Intellimouse support */ | |
4442 static int mouse_scroll_lines = 0; | |
4443 static UINT msh_msgmousewheel = 0; | |
4444 | |
4445 static int s_usenewlook; /* emulate W95/NT4 non-bold dialogs */ | |
4446 #ifdef FEAT_TOOLBAR | |
4447 static void initialise_toolbar(void); | |
5223
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
4448 static LRESULT CALLBACK toolbar_wndproc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); |
7 | 4449 static int get_toolbar_bitmap(vimmenu_T *menu); |
4450 #endif | |
4451 | |
810 | 4452 #ifdef FEAT_GUI_TABLINE |
4453 static void initialise_tabline(void); | |
5223
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
4454 static LRESULT CALLBACK tabline_wndproc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); |
810 | 4455 #endif |
4456 | |
7 | 4457 #ifdef FEAT_MBYTE_IME |
4458 static LRESULT _OnImeComposition(HWND hwnd, WPARAM dbcs, LPARAM param); | |
4459 static char_u *GetResultStr(HWND hwnd, int GCS, int *lenp); | |
4460 #endif | |
4461 #if defined(FEAT_MBYTE_IME) && defined(DYNAMIC_IME) | |
4462 # ifdef NOIME | |
4463 typedef struct tagCOMPOSITIONFORM { | |
4464 DWORD dwStyle; | |
4465 POINT ptCurrentPos; | |
4466 RECT rcArea; | |
4467 } COMPOSITIONFORM, *PCOMPOSITIONFORM, NEAR *NPCOMPOSITIONFORM, FAR *LPCOMPOSITIONFORM; | |
4468 typedef HANDLE HIMC; | |
4469 # endif | |
4470 | |
344 | 4471 static HINSTANCE hLibImm = NULL; |
4472 static LONG (WINAPI *pImmGetCompositionStringA)(HIMC, DWORD, LPVOID, DWORD); | |
4473 static LONG (WINAPI *pImmGetCompositionStringW)(HIMC, DWORD, LPVOID, DWORD); | |
4474 static HIMC (WINAPI *pImmGetContext)(HWND); | |
4475 static HIMC (WINAPI *pImmAssociateContext)(HWND, HIMC); | |
4476 static BOOL (WINAPI *pImmReleaseContext)(HWND, HIMC); | |
4477 static BOOL (WINAPI *pImmGetOpenStatus)(HIMC); | |
4478 static BOOL (WINAPI *pImmSetOpenStatus)(HIMC, BOOL); | |
4479 static BOOL (WINAPI *pImmGetCompositionFont)(HIMC, LPLOGFONTA); | |
4480 static BOOL (WINAPI *pImmSetCompositionFont)(HIMC, LPLOGFONTA); | |
4481 static BOOL (WINAPI *pImmSetCompositionWindow)(HIMC, LPCOMPOSITIONFORM); | |
4482 static BOOL (WINAPI *pImmGetConversionStatus)(HIMC, LPDWORD, LPDWORD); | |
777 | 4483 static BOOL (WINAPI *pImmSetConversionStatus)(HIMC, DWORD, DWORD); |
7 | 4484 static void dyn_imm_load(void); |
4485 #else | |
4486 # define pImmGetCompositionStringA ImmGetCompositionStringA | |
4487 # define pImmGetCompositionStringW ImmGetCompositionStringW | |
4488 # define pImmGetContext ImmGetContext | |
4489 # define pImmAssociateContext ImmAssociateContext | |
4490 # define pImmReleaseContext ImmReleaseContext | |
4491 # define pImmGetOpenStatus ImmGetOpenStatus | |
4492 # define pImmSetOpenStatus ImmSetOpenStatus | |
4493 # define pImmGetCompositionFont ImmGetCompositionFontA | |
4494 # define pImmSetCompositionFont ImmSetCompositionFontA | |
4495 # define pImmSetCompositionWindow ImmSetCompositionWindow | |
4496 # define pImmGetConversionStatus ImmGetConversionStatus | |
777 | 4497 # define pImmSetConversionStatus ImmSetConversionStatus |
7 | 4498 #endif |
4499 | |
4500 /* multi monitor support */ | |
4501 typedef struct _MONITORINFOstruct | |
4502 { | |
4503 DWORD cbSize; | |
4504 RECT rcMonitor; | |
4505 RECT rcWork; | |
4506 DWORD dwFlags; | |
4507 } _MONITORINFO; | |
4508 | |
4509 typedef HANDLE _HMONITOR; | |
4510 typedef _HMONITOR (WINAPI *TMonitorFromWindow)(HWND, DWORD); | |
4511 typedef BOOL (WINAPI *TGetMonitorInfo)(_HMONITOR, _MONITORINFO *); | |
4512 | |
4513 static TMonitorFromWindow pMonitorFromWindow = NULL; | |
4514 static TGetMonitorInfo pGetMonitorInfo = NULL; | |
4515 static HANDLE user32_lib = NULL; | |
4516 /* | |
4517 * Return TRUE when running under Windows NT 3.x or Win32s, both of which have | |
4518 * less fancy GUI APIs. | |
4519 */ | |
4520 static int | |
4521 is_winnt_3(void) | |
4522 { | |
4523 return ((os_version.dwPlatformId == VER_PLATFORM_WIN32_NT | |
4524 && os_version.dwMajorVersion == 3) | |
4525 || (os_version.dwPlatformId == VER_PLATFORM_WIN32s)); | |
4526 } | |
4527 | |
4528 /* | |
4529 * Return TRUE when running under Win32s. | |
4530 */ | |
4531 int | |
4532 gui_is_win32s(void) | |
4533 { | |
4534 return (os_version.dwPlatformId == VER_PLATFORM_WIN32s); | |
4535 } | |
4536 | |
4537 #ifdef FEAT_MENU | |
4538 /* | |
4539 * Figure out how high the menu bar is at the moment. | |
4540 */ | |
4541 static int | |
4542 gui_mswin_get_menu_height( | |
4543 int fix_window) /* If TRUE, resize window if menu height changed */ | |
4544 { | |
4545 static int old_menu_height = -1; | |
4546 | |
4547 RECT rc1, rc2; | |
4548 int num; | |
4549 int menu_height; | |
4550 | |
4551 if (gui.menu_is_active) | |
4552 num = GetMenuItemCount(s_menuBar); | |
4553 else | |
4554 num = 0; | |
4555 | |
4556 if (num == 0) | |
4557 menu_height = 0; | |
6714 | 4558 else if (IsMinimized(s_hwnd)) |
4559 { | |
4560 /* The height of the menu cannot be determined while the window is | |
4561 * minimized. Take the previous height if the menu is changed in that | |
4562 * state, to avoid that Vim's vertical window size accidentally | |
4563 * increases due to the unaccounted-for menu height. */ | |
4564 menu_height = old_menu_height == -1 ? 0 : old_menu_height; | |
4565 } | |
7 | 4566 else |
4567 { | |
4568 if (is_winnt_3()) /* for NT 3.xx */ | |
4569 { | |
4570 if (gui.starting) | |
4571 menu_height = GetSystemMetrics(SM_CYMENU); | |
4572 else | |
4573 { | |
4574 RECT r1, r2; | |
4575 int frameht = GetSystemMetrics(SM_CYFRAME); | |
4576 int capht = GetSystemMetrics(SM_CYCAPTION); | |
4577 | |
4578 /* get window rect of s_hwnd | |
4579 * get client rect of s_hwnd | |
4580 * get cap height | |
4581 * subtract from window rect, the sum of client height, | |
4582 * (if not maximized)frame thickness, and caption height. | |
4583 */ | |
4584 GetWindowRect(s_hwnd, &r1); | |
4585 GetClientRect(s_hwnd, &r2); | |
4586 menu_height = r1.bottom - r1.top - (r2.bottom - r2.top | |
4587 + 2 * frameht * (!IsZoomed(s_hwnd)) + capht); | |
4588 } | |
4589 } | |
4590 else /* win95 and variants (NT 4.0, I guess) */ | |
4591 { | |
4592 /* | |
4593 * In case 'lines' is set in _vimrc/_gvimrc window width doesn't | |
4594 * seem to have been set yet, so menu wraps in default window | |
4595 * width which is very narrow. Instead just return height of a | |
4596 * single menu item. Will still be wrong when the menu really | |
4597 * should wrap over more than one line. | |
4598 */ | |
4599 GetMenuItemRect(s_hwnd, s_menuBar, 0, &rc1); | |
4600 if (gui.starting) | |
4601 menu_height = rc1.bottom - rc1.top + 1; | |
4602 else | |
4603 { | |
4604 GetMenuItemRect(s_hwnd, s_menuBar, num - 1, &rc2); | |
4605 menu_height = rc2.bottom - rc1.top + 1; | |
4606 } | |
4607 } | |
4608 } | |
4609 | |
4610 if (fix_window && menu_height != old_menu_height) | |
4611 { | |
812 | 4612 gui_set_shellsize(FALSE, FALSE, RESIZE_VERT); |
7 | 4613 } |
6714 | 4614 old_menu_height = menu_height; |
7 | 4615 |
4616 return menu_height; | |
4617 } | |
4618 #endif /*FEAT_MENU*/ | |
4619 | |
4620 | |
4621 /* | |
4622 * Setup for the Intellimouse | |
4623 */ | |
4624 static void | |
4625 init_mouse_wheel(void) | |
4626 { | |
4627 | |
4628 #ifndef SPI_GETWHEELSCROLLLINES | |
4629 # define SPI_GETWHEELSCROLLLINES 104 | |
4630 #endif | |
336 | 4631 #ifndef SPI_SETWHEELSCROLLLINES |
4632 # define SPI_SETWHEELSCROLLLINES 105 | |
4633 #endif | |
7 | 4634 |
4635 #define VMOUSEZ_CLASSNAME "MouseZ" /* hidden wheel window class */ | |
4636 #define VMOUSEZ_TITLE "Magellan MSWHEEL" /* hidden wheel window title */ | |
4637 #define VMSH_MOUSEWHEEL "MSWHEEL_ROLLMSG" | |
4638 #define VMSH_SCROLL_LINES "MSH_SCROLL_LINES_MSG" | |
4639 | |
4640 HWND hdl_mswheel; | |
4641 UINT msh_msgscrolllines; | |
4642 | |
4643 msh_msgmousewheel = 0; | |
4644 mouse_scroll_lines = 3; /* reasonable default */ | |
4645 | |
4646 if ((os_version.dwPlatformId == VER_PLATFORM_WIN32_NT | |
4647 && os_version.dwMajorVersion >= 4) | |
4648 || (os_version.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS | |
4649 && ((os_version.dwMajorVersion == 4 | |
4650 && os_version.dwMinorVersion >= 10) | |
4651 || os_version.dwMajorVersion >= 5))) | |
4652 { | |
4653 /* if NT 4.0+ (or Win98) get scroll lines directly from system */ | |
4654 SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, | |
4655 &mouse_scroll_lines, 0); | |
4656 } | |
4657 else if (os_version.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS | |
4658 || (os_version.dwPlatformId == VER_PLATFORM_WIN32_NT | |
4659 && os_version.dwMajorVersion < 4)) | |
4660 { /* | |
4661 * If Win95 or NT 3.51, | |
4662 * try to find the hidden point32 window. | |
4663 */ | |
4664 hdl_mswheel = FindWindow(VMOUSEZ_CLASSNAME, VMOUSEZ_TITLE); | |
4665 if (hdl_mswheel) | |
4666 { | |
4667 msh_msgscrolllines = RegisterWindowMessage(VMSH_SCROLL_LINES); | |
4668 if (msh_msgscrolllines) | |
4669 { | |
4670 mouse_scroll_lines = (int)SendMessage(hdl_mswheel, | |
4671 msh_msgscrolllines, 0, 0); | |
4672 msh_msgmousewheel = RegisterWindowMessage(VMSH_MOUSEWHEEL); | |
4673 } | |
4674 } | |
4675 } | |
4676 } | |
4677 | |
4678 | |
4679 /* Intellimouse wheel handler */ | |
4680 static void | |
4681 _OnMouseWheel( | |
4682 HWND hwnd, | |
4683 short zDelta) | |
4684 { | |
4685 /* Treat a mouse wheel event as if it were a scroll request */ | |
4686 int i; | |
4687 int size; | |
4688 HWND hwndCtl; | |
4689 | |
4690 if (curwin->w_scrollbars[SBAR_RIGHT].id != 0) | |
4691 { | |
4692 hwndCtl = curwin->w_scrollbars[SBAR_RIGHT].id; | |
4693 size = curwin->w_scrollbars[SBAR_RIGHT].size; | |
4694 } | |
4695 else if (curwin->w_scrollbars[SBAR_LEFT].id != 0) | |
4696 { | |
4697 hwndCtl = curwin->w_scrollbars[SBAR_LEFT].id; | |
4698 size = curwin->w_scrollbars[SBAR_LEFT].size; | |
4699 } | |
4700 else | |
4701 return; | |
4702 | |
4703 size = curwin->w_height; | |
4704 if (mouse_scroll_lines == 0) | |
4705 init_mouse_wheel(); | |
4706 | |
4707 if (mouse_scroll_lines > 0 | |
4708 && mouse_scroll_lines < (size > 2 ? size - 2 : 1)) | |
4709 { | |
4710 for (i = mouse_scroll_lines; i > 0; --i) | |
4711 _OnScroll(hwnd, hwndCtl, zDelta >= 0 ? SB_LINEUP : SB_LINEDOWN, 0); | |
4712 } | |
4713 else | |
4714 _OnScroll(hwnd, hwndCtl, zDelta >= 0 ? SB_PAGEUP : SB_PAGEDOWN, 0); | |
4715 } | |
4716 | |
843 | 4717 #ifdef USE_SYSMENU_FONT |
4718 /* | |
4719 * Get Menu Font. | |
4720 * Return OK or FAIL. | |
4721 */ | |
4722 static int | |
4723 gui_w32_get_menu_font(LOGFONT *lf) | |
4724 { | |
4725 NONCLIENTMETRICS nm; | |
4726 | |
4727 nm.cbSize = sizeof(NONCLIENTMETRICS); | |
4728 if (!SystemParametersInfo( | |
4729 SPI_GETNONCLIENTMETRICS, | |
4730 sizeof(NONCLIENTMETRICS), | |
4731 &nm, | |
4732 0)) | |
4733 return FAIL; | |
4734 *lf = nm.lfMenuFont; | |
4735 return OK; | |
4736 } | |
4737 #endif | |
4738 | |
4739 | |
4740 #if defined(FEAT_GUI_TABLINE) && defined(USE_SYSMENU_FONT) | |
4741 /* | |
4742 * Set the GUI tabline font to the system menu font | |
4743 */ | |
4744 static void | |
4745 set_tabline_font(void) | |
4746 { | |
4747 LOGFONT lfSysmenu; | |
4748 HFONT font; | |
4749 HWND hwnd; | |
4750 HDC hdc; | |
4751 HFONT hfntOld; | |
4752 TEXTMETRIC tm; | |
4753 | |
4754 if (gui_w32_get_menu_font(&lfSysmenu) != OK) | |
4755 return; | |
4756 | |
4757 font = CreateFontIndirect(&lfSysmenu); | |
4758 | |
4759 SendMessage(s_tabhwnd, WM_SETFONT, (WPARAM)font, TRUE); | |
4760 | |
4761 /* | |
4762 * Compute the height of the font used for the tab text | |
4763 */ | |
4764 hwnd = GetDesktopWindow(); | |
4765 hdc = GetWindowDC(hwnd); | |
4766 hfntOld = SelectFont(hdc, font); | |
4767 | |
4768 GetTextMetrics(hdc, &tm); | |
4769 | |
4770 SelectFont(hdc, hfntOld); | |
4771 ReleaseDC(hwnd, hdc); | |
4772 | |
4773 /* | |
4774 * The space used by the tab border and the space between the tab label | |
4775 * and the tab border is included as 7. | |
4776 */ | |
4777 gui.tabline_height = tm.tmHeight + tm.tmInternalLeading + 7; | |
4778 } | |
4779 #endif | |
4780 | |
333 | 4781 /* |
4782 * Invoked when a setting was changed. | |
4783 */ | |
4784 static LRESULT CALLBACK | |
4785 _OnSettingChange(UINT n) | |
4786 { | |
4787 if (n == SPI_SETWHEELSCROLLLINES) | |
4788 SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, | |
4789 &mouse_scroll_lines, 0); | |
843 | 4790 #if defined(FEAT_GUI_TABLINE) && defined(USE_SYSMENU_FONT) |
4791 if (n == SPI_SETNONCLIENTMETRICS) | |
4792 set_tabline_font(); | |
4793 #endif | |
333 | 4794 return 0; |
4795 } | |
4796 | |
7 | 4797 #ifdef FEAT_NETBEANS_INTG |
4798 static void | |
4799 _OnWindowPosChanged( | |
4800 HWND hwnd, | |
4801 const LPWINDOWPOS lpwpos) | |
4802 { | |
4803 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
|
4804 extern int WSInitialized; |
7 | 4805 |
4806 if (WSInitialized && (lpwpos->x != x || lpwpos->y != y | |
4807 || lpwpos->cx != cx || lpwpos->cy != cy)) | |
4808 { | |
4809 x = lpwpos->x; | |
4810 y = lpwpos->y; | |
4811 cx = lpwpos->cx; | |
4812 cy = lpwpos->cy; | |
4813 netbeans_frame_moved(x, y); | |
4814 } | |
4815 /* Allow to send WM_SIZE and WM_MOVE */ | |
4816 FORWARD_WM_WINDOWPOSCHANGED(hwnd, lpwpos, MyWindowProc); | |
4817 } | |
4818 #endif | |
4819 | |
4820 static int | |
4821 _DuringSizing( | |
4822 UINT fwSide, | |
4823 LPRECT lprc) | |
4824 { | |
4825 int w, h; | |
4826 int valid_w, valid_h; | |
4827 int w_offset, h_offset; | |
4828 | |
4829 w = lprc->right - lprc->left; | |
4830 h = lprc->bottom - lprc->top; | |
4831 gui_mswin_get_valid_dimensions(w, h, &valid_w, &valid_h); | |
4832 w_offset = w - valid_w; | |
4833 h_offset = h - valid_h; | |
4834 | |
4835 if (fwSide == WMSZ_LEFT || fwSide == WMSZ_TOPLEFT | |
4836 || fwSide == WMSZ_BOTTOMLEFT) | |
4837 lprc->left += w_offset; | |
4838 else if (fwSide == WMSZ_RIGHT || fwSide == WMSZ_TOPRIGHT | |
4839 || fwSide == WMSZ_BOTTOMRIGHT) | |
4840 lprc->right -= w_offset; | |
4841 | |
4842 if (fwSide == WMSZ_TOP || fwSide == WMSZ_TOPLEFT | |
4843 || fwSide == WMSZ_TOPRIGHT) | |
4844 lprc->top += h_offset; | |
4845 else if (fwSide == WMSZ_BOTTOM || fwSide == WMSZ_BOTTOMLEFT | |
4846 || fwSide == WMSZ_BOTTOMRIGHT) | |
4847 lprc->bottom -= h_offset; | |
4848 return TRUE; | |
4849 } | |
4850 | |
4851 | |
4852 | |
4853 static LRESULT CALLBACK | |
4854 _WndProc( | |
4855 HWND hwnd, | |
4856 UINT uMsg, | |
4857 WPARAM wParam, | |
4858 LPARAM lParam) | |
4859 { | |
4860 /* | |
4861 TRACE("WndProc: hwnd = %08x, msg = %x, wParam = %x, lParam = %x\n", | |
4862 hwnd, uMsg, wParam, lParam); | |
4863 */ | |
4864 | |
4865 HandleMouseHide(uMsg, lParam); | |
4866 | |
4867 s_uMsg = uMsg; | |
4868 s_wParam = wParam; | |
4869 s_lParam = lParam; | |
4870 | |
4871 switch (uMsg) | |
4872 { | |
4873 HANDLE_MSG(hwnd, WM_DEADCHAR, _OnDeadChar); | |
4874 HANDLE_MSG(hwnd, WM_SYSDEADCHAR, _OnDeadChar); | |
4875 /* HANDLE_MSG(hwnd, WM_ACTIVATE, _OnActivate); */ | |
4876 HANDLE_MSG(hwnd, WM_CLOSE, _OnClose); | |
4877 /* HANDLE_MSG(hwnd, WM_COMMAND, _OnCommand); */ | |
4878 HANDLE_MSG(hwnd, WM_DESTROY, _OnDestroy); | |
4879 HANDLE_MSG(hwnd, WM_DROPFILES, _OnDropFiles); | |
4880 HANDLE_MSG(hwnd, WM_HSCROLL, _OnScroll); | |
4881 HANDLE_MSG(hwnd, WM_KILLFOCUS, _OnKillFocus); | |
4882 #ifdef FEAT_MENU | |
4883 HANDLE_MSG(hwnd, WM_COMMAND, _OnMenu); | |
4884 #endif | |
4885 /* HANDLE_MSG(hwnd, WM_MOVE, _OnMove); */ | |
4886 /* HANDLE_MSG(hwnd, WM_NCACTIVATE, _OnNCActivate); */ | |
4887 HANDLE_MSG(hwnd, WM_SETFOCUS, _OnSetFocus); | |
4888 HANDLE_MSG(hwnd, WM_SIZE, _OnSize); | |
4889 /* HANDLE_MSG(hwnd, WM_SYSCOMMAND, _OnSysCommand); */ | |
4890 /* HANDLE_MSG(hwnd, WM_SYSKEYDOWN, _OnAltKey); */ | |
4891 HANDLE_MSG(hwnd, WM_VSCROLL, _OnScroll); | |
4892 // HANDLE_MSG(hwnd, WM_WINDOWPOSCHANGING, _OnWindowPosChanging); | |
4893 HANDLE_MSG(hwnd, WM_ACTIVATEAPP, _OnActivateApp); | |
4894 #ifdef FEAT_NETBEANS_INTG | |
4895 HANDLE_MSG(hwnd, WM_WINDOWPOSCHANGED, _OnWindowPosChanged); | |
4896 #endif | |
4897 | |
812 | 4898 #ifdef FEAT_GUI_TABLINE |
4899 case WM_RBUTTONUP: | |
4900 { | |
4901 if (gui_mch_showing_tabline()) | |
4902 { | |
4903 POINT pt; | |
4904 RECT rect; | |
4905 | |
4906 /* | |
4907 * If the cursor is on the tabline, display the tab menu | |
4908 */ | |
4909 GetCursorPos((LPPOINT)&pt); | |
4910 GetWindowRect(s_textArea, &rect); | |
4911 if (pt.y < rect.top) | |
4912 { | |
4913 show_tabline_popup_menu(); | |
3225 | 4914 return 0L; |
812 | 4915 } |
4916 } | |
4917 return MyWindowProc(hwnd, uMsg, wParam, lParam); | |
4918 } | |
819 | 4919 case WM_LBUTTONDBLCLK: |
4920 { | |
4921 /* | |
4922 * If the user double clicked the tabline, create a new tab | |
4923 */ | |
4924 if (gui_mch_showing_tabline()) | |
4925 { | |
4926 POINT pt; | |
4927 RECT rect; | |
4928 | |
4929 GetCursorPos((LPPOINT)&pt); | |
4930 GetWindowRect(s_textArea, &rect); | |
4931 if (pt.y < rect.top) | |
824 | 4932 send_tabline_menu_event(0, TABLINE_MENU_NEW); |
819 | 4933 } |
4934 return MyWindowProc(hwnd, uMsg, wParam, lParam); | |
4935 } | |
812 | 4936 #endif |
4937 | |
7 | 4938 case WM_QUERYENDSESSION: /* System wants to go down. */ |
4939 gui_shell_closed(); /* Will exit when no changed buffers. */ | |
4940 return FALSE; /* Do NOT allow system to go down. */ | |
4941 | |
4942 case WM_ENDSESSION: | |
4943 if (wParam) /* system only really goes down when wParam is TRUE */ | |
3225 | 4944 { |
7 | 4945 _OnEndSession(); |
3225 | 4946 return 0L; |
4947 } | |
7 | 4948 break; |
4949 | |
4950 case WM_CHAR: | |
4951 /* Don't use HANDLE_MSG() for WM_CHAR, it truncates wParam to a single | |
4952 * byte while we want the UTF-16 character value. */ | |
835 | 4953 _OnChar(hwnd, (UINT)wParam, (int)(short)LOWORD(lParam)); |
7 | 4954 return 0L; |
4955 | |
4956 case WM_SYSCHAR: | |
4957 /* | |
4958 * if 'winaltkeys' is "no", or it's "menu" and it's not a menu | |
4959 * shortcut key, handle like a typed ALT key, otherwise call Windows | |
4960 * ALT key handling. | |
4961 */ | |
4962 #ifdef FEAT_MENU | |
4963 if ( !gui.menu_is_active | |
4964 || p_wak[0] == 'n' | |
4965 || (p_wak[0] == 'm' && !gui_is_menu_shortcut((int)wParam)) | |
4966 ) | |
4967 #endif | |
4968 { | |
835 | 4969 _OnSysChar(hwnd, (UINT)wParam, (int)(short)LOWORD(lParam)); |
7 | 4970 return 0L; |
4971 } | |
4972 #ifdef FEAT_MENU | |
4973 else | |
4974 return MyWindowProc(hwnd, uMsg, wParam, lParam); | |
4975 #endif | |
4976 | |
4977 case WM_SYSKEYUP: | |
4978 #ifdef FEAT_MENU | |
4979 /* This used to be done only when menu is active: ALT key is used for | |
4980 * that. But that caused problems when menu is disabled and using | |
4981 * Alt-Tab-Esc: get into a strange state where no mouse-moved events | |
4982 * are received, mouse pointer remains hidden. */ | |
4983 return MyWindowProc(hwnd, uMsg, wParam, lParam); | |
4984 #else | |
3225 | 4985 return 0L; |
7 | 4986 #endif |
4987 | |
4988 case WM_SIZING: /* HANDLE_MSG doesn't seem to handle this one */ | |
323 | 4989 return _DuringSizing((UINT)wParam, (LPRECT)lParam); |
7 | 4990 |
4991 case WM_MOUSEWHEEL: | |
4992 _OnMouseWheel(hwnd, HIWORD(wParam)); | |
3225 | 4993 return 0L; |
7 | 4994 |
333 | 4995 /* Notification for change in SystemParametersInfo() */ |
4996 case WM_SETTINGCHANGE: | |
4997 return _OnSettingChange((UINT)wParam); | |
4998 | |
810 | 4999 #if defined(FEAT_TOOLBAR) || defined(FEAT_GUI_TABLINE) |
7 | 5000 case WM_NOTIFY: |
5001 switch (((LPNMHDR) lParam)->code) | |
5002 { | |
840 | 5003 # ifdef FEAT_MBYTE |
5004 case TTN_GETDISPINFOW: | |
5005 # endif | |
948 | 5006 case TTN_GETDISPINFO: |
7 | 5007 { |
948 | 5008 LPNMHDR hdr = (LPNMHDR)lParam; |
5009 char_u *str = NULL; | |
5010 static void *tt_text = NULL; | |
5011 | |
5012 vim_free(tt_text); | |
5013 tt_text = NULL; | |
5014 | |
5015 # ifdef FEAT_GUI_TABLINE | |
5016 if (gui_mch_showing_tabline() | |
5017 && hdr->hwndFrom == TabCtrl_GetToolTips(s_tabhwnd)) | |
840 | 5018 { |
948 | 5019 POINT pt; |
840 | 5020 /* |
948 | 5021 * Mouse is over the GUI tabline. Display the |
5022 * tooltip for the tab under the cursor | |
5023 * | |
5024 * Get the cursor position within the tab control | |
840 | 5025 */ |
948 | 5026 GetCursorPos(&pt); |
5027 if (ScreenToClient(s_tabhwnd, &pt) != 0) | |
840 | 5028 { |
948 | 5029 TCHITTESTINFO htinfo; |
5030 int idx; | |
5031 | |
5032 /* | |
5033 * Get the tab under the cursor | |
5034 */ | |
5035 htinfo.pt.x = pt.x; | |
5036 htinfo.pt.y = pt.y; | |
5037 idx = TabCtrl_HitTest(s_tabhwnd, &htinfo); | |
5038 if (idx != -1) | |
840 | 5039 { |
948 | 5040 tabpage_T *tp; |
5041 | |
5042 tp = find_tabpage(idx + 1); | |
5043 if (tp != NULL) | |
840 | 5044 { |
948 | 5045 get_tabline_label(tp, TRUE); |
5046 str = NameBuff; | |
840 | 5047 } |
5048 } | |
5049 } | |
5050 } | |
5051 # endif | |
5052 # ifdef FEAT_TOOLBAR | |
948 | 5053 # ifdef FEAT_GUI_TABLINE |
5054 else | |
5055 # endif | |
5056 { | |
5057 UINT idButton; | |
5058 vimmenu_T *pMenu; | |
5059 | |
5060 idButton = (UINT) hdr->idFrom; | |
5061 pMenu = gui_mswin_find_menu(root_menu, idButton); | |
5062 if (pMenu) | |
5063 str = pMenu->strings[MENU_INDEX_TIP]; | |
5064 } | |
5065 # endif | |
5066 if (str != NULL) | |
7 | 5067 { |
948 | 5068 # ifdef FEAT_MBYTE |
5069 if (hdr->code == TTN_GETDISPINFOW) | |
7 | 5070 { |
948 | 5071 LPNMTTDISPINFOW lpdi = (LPNMTTDISPINFOW)lParam; |
5072 | |
1481 | 5073 /* Set the maximum width, this also enables using |
5074 * \n for line break. */ | |
5075 SendMessage(lpdi->hdr.hwndFrom, TTM_SETMAXTIPWIDTH, | |
5076 0, 500); | |
5077 | |
1752 | 5078 tt_text = enc_to_utf16(str, NULL); |
948 | 5079 lpdi->lpszText = tt_text; |
5080 /* can't show tooltip if failed */ | |
5081 } | |
5082 else | |
5083 # endif | |
5084 { | |
5085 LPNMTTDISPINFO lpdi = (LPNMTTDISPINFO)lParam; | |
5086 | |
1481 | 5087 /* Set the maximum width, this also enables using |
5088 * \n for line break. */ | |
5089 SendMessage(lpdi->hdr.hwndFrom, TTM_SETMAXTIPWIDTH, | |
5090 0, 500); | |
5091 | |
948 | 5092 if (STRLEN(str) < sizeof(lpdi->szText) |
5093 || ((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
|
5094 vim_strncpy((char_u *)lpdi->szText, str, |
948 | 5095 sizeof(lpdi->szText) - 1); |
5096 else | |
5097 lpdi->lpszText = tt_text; | |
7 | 5098 } |
5099 } | |
5100 } | |
5101 break; | |
810 | 5102 # ifdef FEAT_GUI_TABLINE |
5103 case TCN_SELCHANGE: | |
5104 if (gui_mch_showing_tabline() | |
5105 && ((LPNMHDR)lParam)->hwndFrom == s_tabhwnd) | |
3225 | 5106 { |
810 | 5107 send_tabline_event(TabCtrl_GetCurSel(s_tabhwnd) + 1); |
3225 | 5108 return 0L; |
5109 } | |
810 | 5110 break; |
812 | 5111 |
5112 case NM_RCLICK: | |
5113 if (gui_mch_showing_tabline() | |
5114 && ((LPNMHDR)lParam)->hwndFrom == s_tabhwnd) | |
3225 | 5115 { |
812 | 5116 show_tabline_popup_menu(); |
3225 | 5117 return 0L; |
5118 } | |
812 | 5119 break; |
810 | 5120 # endif |
7 | 5121 default: |
810 | 5122 # ifdef FEAT_GUI_TABLINE |
5123 if (gui_mch_showing_tabline() | |
5124 && ((LPNMHDR)lParam)->hwndFrom == s_tabhwnd) | |
5125 return MyWindowProc(hwnd, uMsg, wParam, lParam); | |
5126 # endif | |
7 | 5127 break; |
5128 } | |
5129 break; | |
5130 #endif | |
5131 #if defined(MENUHINTS) && defined(FEAT_MENU) | |
5132 case WM_MENUSELECT: | |
5133 if (((UINT) HIWORD(wParam) | |
5134 & (0xffff ^ (MF_MOUSESELECT + MF_BITMAP + MF_POPUP))) | |
5135 == MF_HILITE | |
5136 && (State & CMDLINE) == 0) | |
5137 { | |
5138 UINT idButton; | |
5139 vimmenu_T *pMenu; | |
5140 static int did_menu_tip = FALSE; | |
5141 | |
5142 if (did_menu_tip) | |
5143 { | |
5144 msg_clr_cmdline(); | |
5145 setcursor(); | |
5146 out_flush(); | |
5147 did_menu_tip = FALSE; | |
5148 } | |
5149 | |
5150 idButton = (UINT)LOWORD(wParam); | |
5151 pMenu = gui_mswin_find_menu(root_menu, idButton); | |
5152 if (pMenu != NULL && pMenu->strings[MENU_INDEX_TIP] != 0 | |
5153 && GetMenuState(s_menuBar, pMenu->id, MF_BYCOMMAND) != -1) | |
5154 { | |
1288 | 5155 ++msg_hist_off; |
7 | 5156 msg(pMenu->strings[MENU_INDEX_TIP]); |
1288 | 5157 --msg_hist_off; |
7 | 5158 setcursor(); |
5159 out_flush(); | |
5160 did_menu_tip = TRUE; | |
5161 } | |
3225 | 5162 return 0L; |
7 | 5163 } |
5164 break; | |
5165 #endif | |
5166 case WM_NCHITTEST: | |
5167 { | |
5168 LRESULT result; | |
5169 int x, y; | |
5170 int xPos = GET_X_LPARAM(lParam); | |
5171 | |
5172 result = MyWindowProc(hwnd, uMsg, wParam, lParam); | |
5173 if (result == HTCLIENT) | |
5174 { | |
810 | 5175 #ifdef FEAT_GUI_TABLINE |
5176 if (gui_mch_showing_tabline()) | |
5177 { | |
5178 int yPos = GET_Y_LPARAM(lParam); | |
5179 RECT rct; | |
5180 | |
5181 /* If the cursor is on the GUI tabline, don't process this | |
5182 * event */ | |
5183 GetWindowRect(s_textArea, &rct); | |
5184 if (yPos < rct.top) | |
5185 return result; | |
5186 } | |
5187 #endif | |
7009 | 5188 (void)gui_mch_get_winpos(&x, &y); |
7 | 5189 xPos -= x; |
5190 | |
5191 if (xPos < 48) /* <VN> TODO should use system metric? */ | |
5192 return HTBOTTOMLEFT; | |
5193 else | |
5194 return HTBOTTOMRIGHT; | |
5195 } | |
5196 else | |
5197 return result; | |
5198 } | |
5199 /* break; notreached */ | |
5200 | |
5201 #ifdef FEAT_MBYTE_IME | |
5202 case WM_IME_NOTIFY: | |
5203 if (!_OnImeNotify(hwnd, (DWORD)wParam, (DWORD)lParam)) | |
5204 return MyWindowProc(hwnd, uMsg, wParam, lParam); | |
3225 | 5205 return 1L; |
5206 | |
7 | 5207 case WM_IME_COMPOSITION: |
5208 if (!_OnImeComposition(hwnd, wParam, lParam)) | |
5209 return MyWindowProc(hwnd, uMsg, wParam, lParam); | |
3225 | 5210 return 1L; |
7 | 5211 #endif |
5212 | |
5213 default: | |
5214 if (uMsg == msh_msgmousewheel && msh_msgmousewheel != 0) | |
5215 { /* handle MSH_MOUSEWHEEL messages for Intellimouse */ | |
5216 _OnMouseWheel(hwnd, HIWORD(wParam)); | |
3225 | 5217 return 0L; |
7 | 5218 } |
5219 #ifdef MSWIN_FIND_REPLACE | |
36 | 5220 else if (uMsg == s_findrep_msg && s_findrep_msg != 0) |
7 | 5221 { |
5222 _OnFindRepl(); | |
5223 } | |
5224 #endif | |
5225 return MyWindowProc(hwnd, uMsg, wParam, lParam); | |
5226 } | |
5227 | |
3212 | 5228 return DefWindowProc(hwnd, uMsg, wParam, lParam); |
7 | 5229 } |
5230 | |
5231 /* | |
5232 * End of call-back routines | |
5233 */ | |
5234 | |
5235 /* parent window, if specified with -P */ | |
5236 HWND vim_parent_hwnd = NULL; | |
5237 | |
5238 static BOOL CALLBACK | |
5239 FindWindowTitle(HWND hwnd, LPARAM lParam) | |
5240 { | |
5241 char buf[2048]; | |
5242 char *title = (char *)lParam; | |
5243 | |
5244 if (GetWindowText(hwnd, buf, sizeof(buf))) | |
5245 { | |
5246 if (strstr(buf, title) != NULL) | |
5247 { | |
9 | 5248 /* Found it. Store the window ref. and quit searching if MDI |
5249 * works. */ | |
7 | 5250 vim_parent_hwnd = FindWindowEx(hwnd, NULL, "MDIClient", NULL); |
9 | 5251 if (vim_parent_hwnd != NULL) |
5252 return FALSE; | |
7 | 5253 } |
5254 } | |
5255 return TRUE; /* continue searching */ | |
5256 } | |
5257 | |
5258 /* | |
5259 * Invoked for '-P "title"' argument: search for parent application to open | |
5260 * our window in. | |
5261 */ | |
5262 void | |
5263 gui_mch_set_parent(char *title) | |
5264 { | |
5265 EnumWindows(FindWindowTitle, (LPARAM)title); | |
5266 if (vim_parent_hwnd == NULL) | |
5267 { | |
5268 EMSG2(_("E671: Cannot find window title \"%s\""), title); | |
5269 mch_exit(2); | |
5270 } | |
5271 } | |
5272 | |
323 | 5273 #ifndef FEAT_OLE |
7 | 5274 static void |
5275 ole_error(char *arg) | |
5276 { | |
1116 | 5277 char buf[IOSIZE]; |
5278 | |
5279 /* Can't use EMSG() here, we have not finished initialisation yet. */ | |
5280 vim_snprintf(buf, IOSIZE, | |
5281 _("E243: Argument not supported: \"-%s\"; Use the OLE version."), | |
5282 arg); | |
5283 mch_errmsg(buf); | |
7 | 5284 } |
323 | 5285 #endif |
7 | 5286 |
5287 /* | |
5288 * Parse the GUI related command-line arguments. Any arguments used are | |
5289 * deleted from argv, and *argc is decremented accordingly. This is called | |
5290 * when vim is started, whether or not the GUI has been started. | |
5291 */ | |
5292 void | |
5293 gui_mch_prepare(int *argc, char **argv) | |
5294 { | |
5295 int silent = FALSE; | |
5296 int idx; | |
5297 | |
5298 /* Check for special OLE command line parameters */ | |
5299 if ((*argc == 2 || *argc == 3) && (argv[1][0] == '-' || argv[1][0] == '/')) | |
5300 { | |
5301 /* Check for a "-silent" argument first. */ | |
5302 if (*argc == 3 && STRICMP(argv[1] + 1, "silent") == 0 | |
5303 && (argv[2][0] == '-' || argv[2][0] == '/')) | |
5304 { | |
5305 silent = TRUE; | |
5306 idx = 2; | |
5307 } | |
5308 else | |
5309 idx = 1; | |
5310 | |
5311 /* Register Vim as an OLE Automation server */ | |
5312 if (STRICMP(argv[idx] + 1, "register") == 0) | |
5313 { | |
5314 #ifdef FEAT_OLE | |
5315 RegisterMe(silent); | |
5316 mch_exit(0); | |
5317 #else | |
5318 if (!silent) | |
5319 ole_error("register"); | |
5320 mch_exit(2); | |
5321 #endif | |
5322 } | |
5323 | |
5324 /* Unregister Vim as an OLE Automation server */ | |
5325 if (STRICMP(argv[idx] + 1, "unregister") == 0) | |
5326 { | |
5327 #ifdef FEAT_OLE | |
5328 UnregisterMe(!silent); | |
5329 mch_exit(0); | |
5330 #else | |
5331 if (!silent) | |
5332 ole_error("unregister"); | |
5333 mch_exit(2); | |
5334 #endif | |
5335 } | |
5336 | |
5337 /* Ignore an -embedding argument. It is only relevant if the | |
5338 * application wants to treat the case when it is started manually | |
5339 * differently from the case where it is started via automation (and | |
5340 * we don't). | |
5341 */ | |
5342 if (STRICMP(argv[idx] + 1, "embedding") == 0) | |
5343 { | |
5344 #ifdef FEAT_OLE | |
5345 *argc = 1; | |
5346 #else | |
5347 ole_error("embedding"); | |
5348 mch_exit(2); | |
5349 #endif | |
5350 } | |
5351 } | |
5352 | |
5353 #ifdef FEAT_OLE | |
5354 { | |
5355 int bDoRestart = FALSE; | |
5356 | |
5357 InitOLE(&bDoRestart); | |
5358 /* automatically exit after registering */ | |
5359 if (bDoRestart) | |
5360 mch_exit(0); | |
5361 } | |
5362 #endif | |
5363 | |
5364 #ifdef FEAT_NETBEANS_INTG | |
5365 { | |
4352 | 5366 /* stolen from gui_x11.c */ |
7 | 5367 int arg; |
5368 | |
5369 for (arg = 1; arg < *argc; arg++) | |
5370 if (strncmp("-nb", argv[arg], 3) == 0) | |
5371 { | |
5372 netbeansArg = argv[arg]; | |
5373 mch_memmove(&argv[arg], &argv[arg + 1], | |
5374 (--*argc - arg) * sizeof(char *)); | |
5375 argv[*argc] = NULL; | |
5376 break; /* enough? */ | |
5377 } | |
5378 } | |
5379 #endif | |
5380 | |
5381 /* get the OS version info */ | |
5382 os_version.dwOSVersionInfoSize = sizeof(os_version); | |
5383 GetVersionEx(&os_version); /* this call works on Win32s, Win95 and WinNT */ | |
5384 | |
5385 /* try and load the user32.dll library and get the entry points for | |
5386 * multi-monitor-support. */ | |
2612 | 5387 if ((user32_lib = vimLoadLib("User32.dll")) != NULL) |
7 | 5388 { |
5389 pMonitorFromWindow = (TMonitorFromWindow)GetProcAddress(user32_lib, | |
5390 "MonitorFromWindow"); | |
5391 | |
5392 /* there are ...A and ...W version of GetMonitorInfo - looking at | |
5393 * winuser.h, they have exactly the same declaration. */ | |
5394 pGetMonitorInfo = (TGetMonitorInfo)GetProcAddress(user32_lib, | |
5395 "GetMonitorInfoA"); | |
5396 } | |
3010 | 5397 |
5398 #ifdef FEAT_MBYTE | |
5399 /* If the OS is Windows NT, use wide functions; | |
5400 * this enables common dialogs input unicode from IME. */ | |
5401 if (os_version.dwPlatformId == VER_PLATFORM_WIN32_NT) | |
5402 { | |
5403 pDispatchMessage = DispatchMessageW; | |
5404 pGetMessage = GetMessageW; | |
5405 pIsDialogMessage = IsDialogMessageW; | |
5406 pPeekMessage = PeekMessageW; | |
5407 } | |
5408 else | |
5409 { | |
5410 pDispatchMessage = DispatchMessageA; | |
5411 pGetMessage = GetMessageA; | |
5412 pIsDialogMessage = IsDialogMessageA; | |
5413 pPeekMessage = PeekMessageA; | |
5414 } | |
5415 #endif | |
7 | 5416 } |
5417 | |
5418 /* | |
5419 * Initialise the GUI. Create all the windows, set up all the call-backs | |
5420 * etc. | |
5421 */ | |
5422 int | |
5423 gui_mch_init(void) | |
5424 { | |
5425 const char szVimWndClass[] = VIM_CLASS; | |
5426 const char szTextAreaClass[] = "VimTextArea"; | |
5427 WNDCLASS wndclass; | |
5428 #ifdef FEAT_MBYTE | |
5429 const WCHAR szVimWndClassW[] = VIM_CLASSW; | |
2078
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5430 const WCHAR szTextAreaClassW[] = L"VimTextArea"; |
7 | 5431 WNDCLASSW wndclassw; |
5432 #endif | |
5433 #ifdef GLOBAL_IME | |
5434 ATOM atom; | |
5435 #endif | |
5436 | |
5437 /* Return here if the window was already opened (happens when | |
5438 * gui_mch_dialog() is called early). */ | |
5439 if (s_hwnd != NULL) | |
153 | 5440 goto theend; |
7 | 5441 |
5442 /* | |
5443 * Load the tearoff bitmap | |
5444 */ | |
5445 #ifdef FEAT_TEAROFF | |
5446 s_htearbitmap = LoadBitmap(s_hinst, "IDB_TEAROFF"); | |
5447 #endif | |
5448 | |
5449 gui.scrollbar_width = GetSystemMetrics(SM_CXVSCROLL); | |
5450 gui.scrollbar_height = GetSystemMetrics(SM_CYHSCROLL); | |
5451 #ifdef FEAT_MENU | |
5452 gui.menu_height = 0; /* Windows takes care of this */ | |
5453 #endif | |
5454 gui.border_width = 0; | |
5455 | |
5456 s_brush = CreateSolidBrush(GetSysColor(COLOR_BTNFACE)); | |
5457 | |
5458 #ifdef FEAT_MBYTE | |
5459 /* First try using the wide version, so that we can use any title. | |
5460 * Otherwise only characters in the active codepage will work. */ | |
5461 if (GetClassInfoW(s_hinst, szVimWndClassW, &wndclassw) == 0) | |
5462 { | |
819 | 5463 wndclassw.style = CS_DBLCLKS; |
7 | 5464 wndclassw.lpfnWndProc = _WndProc; |
5465 wndclassw.cbClsExtra = 0; | |
5466 wndclassw.cbWndExtra = 0; | |
5467 wndclassw.hInstance = s_hinst; | |
5468 wndclassw.hIcon = LoadIcon(wndclassw.hInstance, "IDR_VIM"); | |
5469 wndclassw.hCursor = LoadCursor(NULL, IDC_ARROW); | |
5470 wndclassw.hbrBackground = s_brush; | |
5471 wndclassw.lpszMenuName = NULL; | |
5472 wndclassw.lpszClassName = szVimWndClassW; | |
5473 | |
5474 if (( | |
5475 #ifdef GLOBAL_IME | |
5476 atom = | |
5477 #endif | |
5478 RegisterClassW(&wndclassw)) == 0) | |
5479 { | |
5480 if (GetLastError() != ERROR_CALL_NOT_IMPLEMENTED) | |
5481 return FAIL; | |
5482 | |
5483 /* Must be Windows 98, fall back to non-wide function. */ | |
5484 } | |
5485 else | |
5486 wide_WindowProc = TRUE; | |
5487 } | |
5488 | |
5489 if (!wide_WindowProc) | |
5490 #endif | |
5491 | |
5492 if (GetClassInfo(s_hinst, szVimWndClass, &wndclass) == 0) | |
5493 { | |
819 | 5494 wndclass.style = CS_DBLCLKS; |
7 | 5495 wndclass.lpfnWndProc = _WndProc; |
5496 wndclass.cbClsExtra = 0; | |
5497 wndclass.cbWndExtra = 0; | |
5498 wndclass.hInstance = s_hinst; | |
5499 wndclass.hIcon = LoadIcon(wndclass.hInstance, "IDR_VIM"); | |
5500 wndclass.hCursor = LoadCursor(NULL, IDC_ARROW); | |
5501 wndclass.hbrBackground = s_brush; | |
5502 wndclass.lpszMenuName = NULL; | |
5503 wndclass.lpszClassName = szVimWndClass; | |
5504 | |
5505 if (( | |
5506 #ifdef GLOBAL_IME | |
5507 atom = | |
5508 #endif | |
5509 RegisterClass(&wndclass)) == 0) | |
5510 return FAIL; | |
5511 } | |
5512 | |
5513 if (vim_parent_hwnd != NULL) | |
5514 { | |
5515 #ifdef HAVE_TRY_EXCEPT | |
5516 __try | |
5517 { | |
5518 #endif | |
5519 /* Open inside the specified parent window. | |
5520 * TODO: last argument should point to a CLIENTCREATESTRUCT | |
5521 * structure. */ | |
5522 s_hwnd = CreateWindowEx( | |
5523 WS_EX_MDICHILD, | |
5524 szVimWndClass, "Vim MSWindows GUI", | |
3006 | 5525 WS_OVERLAPPEDWINDOW | WS_CHILD |
5526 | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | 0xC000, | |
7 | 5527 gui_win_x == -1 ? CW_USEDEFAULT : gui_win_x, |
5528 gui_win_y == -1 ? CW_USEDEFAULT : gui_win_y, | |
5529 100, /* Any value will do */ | |
5530 100, /* Any value will do */ | |
5531 vim_parent_hwnd, NULL, | |
5532 s_hinst, NULL); | |
5533 #ifdef HAVE_TRY_EXCEPT | |
5534 } | |
5535 __except(EXCEPTION_EXECUTE_HANDLER) | |
5536 { | |
5537 /* NOP */ | |
5538 } | |
5539 #endif | |
5540 if (s_hwnd == NULL) | |
5541 { | |
5542 EMSG(_("E672: Unable to open window inside MDI application")); | |
5543 mch_exit(2); | |
5544 } | |
5545 } | |
5546 else | |
1376 | 5547 { |
5548 /* If the provided windowid is not valid reset it to zero, so that it | |
5549 * is ignored and we open our own window. */ | |
5550 if (IsWindow((HWND)win_socket_id) <= 0) | |
5551 win_socket_id = 0; | |
5552 | |
5553 /* Create a window. If win_socket_id is not zero without border and | |
5554 * titlebar, it will be reparented below. */ | |
7 | 5555 s_hwnd = CreateWindow( |
1376 | 5556 szVimWndClass, "Vim MSWindows GUI", |
3006 | 5557 (win_socket_id == 0 ? WS_OVERLAPPEDWINDOW : WS_POPUP) |
5558 | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, | |
1376 | 5559 gui_win_x == -1 ? CW_USEDEFAULT : gui_win_x, |
5560 gui_win_y == -1 ? CW_USEDEFAULT : gui_win_y, | |
5561 100, /* Any value will do */ | |
5562 100, /* Any value will do */ | |
5563 NULL, NULL, | |
5564 s_hinst, NULL); | |
5565 if (s_hwnd != NULL && win_socket_id != 0) | |
5566 { | |
5567 SetParent(s_hwnd, (HWND)win_socket_id); | |
5568 ShowWindow(s_hwnd, SW_SHOWMAXIMIZED); | |
5569 } | |
5570 } | |
7 | 5571 |
5572 if (s_hwnd == NULL) | |
5573 return FAIL; | |
5574 | |
5575 #ifdef GLOBAL_IME | |
5576 global_ime_init(atom, s_hwnd); | |
5577 #endif | |
5578 #if defined(FEAT_MBYTE_IME) && defined(DYNAMIC_IME) | |
5579 dyn_imm_load(); | |
5580 #endif | |
5581 | |
5582 /* Create the text area window */ | |
2078
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5583 #ifdef FEAT_MBYTE |
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5584 if (wide_WindowProc) |
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5585 { |
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5586 if (GetClassInfoW(s_hinst, szTextAreaClassW, &wndclassw) == 0) |
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5587 { |
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5588 wndclassw.style = CS_OWNDC; |
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5589 wndclassw.lpfnWndProc = _TextAreaWndProc; |
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5590 wndclassw.cbClsExtra = 0; |
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5591 wndclassw.cbWndExtra = 0; |
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5592 wndclassw.hInstance = s_hinst; |
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5593 wndclassw.hIcon = NULL; |
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5594 wndclassw.hCursor = LoadCursor(NULL, IDC_ARROW); |
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5595 wndclassw.hbrBackground = NULL; |
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5596 wndclassw.lpszMenuName = NULL; |
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5597 wndclassw.lpszClassName = szTextAreaClassW; |
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5598 |
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5599 if (RegisterClassW(&wndclassw) == 0) |
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5600 return FAIL; |
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5601 } |
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5602 } |
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5603 else |
d7ce3adb8dda
updated for version 7.2.362
Bram Moolenaar <bram@zimbu.org>
parents:
2026
diff
changeset
|
5604 #endif |
7 | 5605 if (GetClassInfo(s_hinst, szTextAreaClass, &wndclass) == 0) |
5606 { | |
5607 wndclass.style = CS_OWNDC; | |
5608 wndclass.lpfnWndProc = _TextAreaWndProc; | |
5609 wndclass.cbClsExtra = 0; | |
5610 wndclass.cbWndExtra = 0; | |
5611 wndclass.hInstance = s_hinst; | |
5612 wndclass.hIcon = NULL; | |
5613 wndclass.hCursor = LoadCursor(NULL, IDC_ARROW); | |
5614 wndclass.hbrBackground = NULL; | |
5615 wndclass.lpszMenuName = NULL; | |
5616 wndclass.lpszClassName = szTextAreaClass; | |
5617 | |
5618 if (RegisterClass(&wndclass) == 0) | |
5619 return FAIL; | |
5620 } | |
5621 s_textArea = CreateWindowEx( | |
7243
861a44fc5183
commit https://github.com/vim/vim/commit/97b0b0ec764d3a247ef600d809b965d5ab37155d
Christian Brabandt <cb@256bit.org>
parents:
7060
diff
changeset
|
5622 0, |
7 | 5623 szTextAreaClass, "Vim text area", |
5624 WS_CHILD | WS_VISIBLE, 0, 0, | |
5625 100, /* Any value will do for now */ | |
5626 100, /* Any value will do for now */ | |
5627 s_hwnd, NULL, | |
5628 s_hinst, NULL); | |
5629 | |
5630 if (s_textArea == NULL) | |
5631 return FAIL; | |
5632 | |
8100
ae50910ce279
commit https://github.com/vim/vim/commit/203219048fa007b5042d9b893fd647aef44722a0
Christian Brabandt <cb@256bit.org>
parents:
8090
diff
changeset
|
5633 #ifdef FEAT_LIBCALL |
6249 | 5634 /* Try loading an icon from $RUNTIMEPATH/bitmaps/vim.ico. */ |
5635 { | |
5636 HANDLE hIcon = NULL; | |
5637 | |
5638 if (mch_icon_load(&hIcon) == OK && hIcon != NULL) | |
6260 | 5639 SendMessage(s_hwnd, WM_SETICON, ICON_SMALL, (LPARAM)hIcon); |
6249 | 5640 } |
8100
ae50910ce279
commit https://github.com/vim/vim/commit/203219048fa007b5042d9b893fd647aef44722a0
Christian Brabandt <cb@256bit.org>
parents:
8090
diff
changeset
|
5641 #endif |
6249 | 5642 |
7 | 5643 #ifdef FEAT_MENU |
5644 s_menuBar = CreateMenu(); | |
5645 #endif | |
5646 s_hdc = GetDC(s_textArea); | |
5647 | |
5648 #ifdef FEAT_WINDOWS | |
5649 DragAcceptFiles(s_hwnd, TRUE); | |
5650 #endif | |
5651 | |
5652 /* Do we need to bother with this? */ | |
5653 /* m_fMouseAvail = GetSystemMetrics(SM_MOUSEPRESENT); */ | |
5654 | |
5655 /* Get background/foreground colors from the system */ | |
5656 gui_mch_def_colors(); | |
5657 | |
5658 /* Get the colors from the "Normal" group (set in syntax.c or in a vimrc | |
5659 * file) */ | |
5660 set_normal_colors(); | |
5661 | |
5662 /* | |
5663 * Check that none of the colors are the same as the background color. | |
5664 * Then store the current values as the defaults. | |
5665 */ | |
5666 gui_check_colors(); | |
5667 gui.def_norm_pixel = gui.norm_pixel; | |
5668 gui.def_back_pixel = gui.back_pixel; | |
5669 | |
5670 /* Get the colors for the highlight groups (gui_check_colors() might have | |
5671 * changed them) */ | |
5672 highlight_gui_started(); | |
5673 | |
5674 /* | |
7243
861a44fc5183
commit https://github.com/vim/vim/commit/97b0b0ec764d3a247ef600d809b965d5ab37155d
Christian Brabandt <cb@256bit.org>
parents:
7060
diff
changeset
|
5675 * Start out by adding the configured border width into the border offset. |
7 | 5676 */ |
7243
861a44fc5183
commit https://github.com/vim/vim/commit/97b0b0ec764d3a247ef600d809b965d5ab37155d
Christian Brabandt <cb@256bit.org>
parents:
7060
diff
changeset
|
5677 gui.border_offset = gui.border_width; |
7 | 5678 |
5679 /* | |
5680 * Set up for Intellimouse processing | |
5681 */ | |
5682 init_mouse_wheel(); | |
5683 | |
5684 /* | |
5685 * compute a couple of metrics used for the dialogs | |
5686 */ | |
5687 get_dialog_font_metrics(); | |
5688 #ifdef FEAT_TOOLBAR | |
5689 /* | |
5690 * Create the toolbar | |
5691 */ | |
5692 initialise_toolbar(); | |
5693 #endif | |
810 | 5694 #ifdef FEAT_GUI_TABLINE |
5695 /* | |
5696 * Create the tabline | |
5697 */ | |
5698 initialise_tabline(); | |
5699 #endif | |
7 | 5700 #ifdef MSWIN_FIND_REPLACE |
5701 /* | |
5702 * Initialise the dialog box stuff | |
5703 */ | |
5704 s_findrep_msg = RegisterWindowMessage(FINDMSGSTRING); | |
5705 | |
5706 /* Initialise the struct */ | |
5707 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
|
5708 s_findrep_struct.lpstrFindWhat = (LPSTR)alloc(MSWIN_FR_BUFSIZE); |
7 | 5709 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
|
5710 s_findrep_struct.lpstrReplaceWith = (LPSTR)alloc(MSWIN_FR_BUFSIZE); |
7 | 5711 s_findrep_struct.lpstrReplaceWith[0] = NUL; |
5712 s_findrep_struct.wFindWhatLen = MSWIN_FR_BUFSIZE; | |
5713 s_findrep_struct.wReplaceWithLen = MSWIN_FR_BUFSIZE; | |
1795 | 5714 # if defined(FEAT_MBYTE) && defined(WIN3264) |
5715 s_findrep_struct_w.lStructSize = sizeof(s_findrep_struct_w); | |
5716 s_findrep_struct_w.lpstrFindWhat = | |
5717 (LPWSTR)alloc(MSWIN_FR_BUFSIZE * sizeof(WCHAR)); | |
5718 s_findrep_struct_w.lpstrFindWhat[0] = NUL; | |
5719 s_findrep_struct_w.lpstrReplaceWith = | |
5720 (LPWSTR)alloc(MSWIN_FR_BUFSIZE * sizeof(WCHAR)); | |
5721 s_findrep_struct_w.lpstrReplaceWith[0] = NUL; | |
5722 s_findrep_struct_w.wFindWhatLen = MSWIN_FR_BUFSIZE; | |
5723 s_findrep_struct_w.wReplaceWithLen = MSWIN_FR_BUFSIZE; | |
5724 # endif | |
7 | 5725 #endif |
5726 | |
2616 | 5727 #ifdef FEAT_EVAL |
7560
fb84355cd972
commit https://github.com/vim/vim/commit/f32c5cd6e0e6aa6d4aeacb6bf52e3d3ba21e5201
Christian Brabandt <cb@256bit.org>
parents:
7243
diff
changeset
|
5728 # 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
|
5729 /* 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
|
5730 # ifndef HandleToLong |
8102
441298d72f3c
commit https://github.com/vim/vim/commit/a87e2c277eabf0134925c340e9dc4fe9446f3636
Christian Brabandt <cb@256bit.org>
parents:
8100
diff
changeset
|
5731 # 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
|
5732 # endif |
2943 | 5733 # endif |
2616 | 5734 /* set the v:windowid variable */ |
2865 | 5735 set_vim_var_nr(VV_WINDOWID, HandleToLong(s_hwnd)); |
2616 | 5736 #endif |
5737 | |
6110 | 5738 #ifdef FEAT_RENDER_OPTIONS |
5739 if (p_rop) | |
5740 (void)gui_mch_set_rendering_options(p_rop); | |
5741 #endif | |
5742 | |
153 | 5743 theend: |
5744 /* Display any pending error messages */ | |
5745 display_errors(); | |
5746 | |
7 | 5747 return OK; |
5748 } | |
5749 | |
5750 /* | |
5751 * Get the size of the screen, taking position on multiple monitors into | |
5752 * account (if supported). | |
5753 */ | |
5754 static void | |
5755 get_work_area(RECT *spi_rect) | |
5756 { | |
5757 _HMONITOR mon; | |
5758 _MONITORINFO moninfo; | |
5759 | |
5760 /* use these functions only if available */ | |
5761 if (pMonitorFromWindow != NULL && pGetMonitorInfo != NULL) | |
5762 { | |
5763 /* work out which monitor the window is on, and get *it's* work area */ | |
5764 mon = pMonitorFromWindow(s_hwnd, 1 /*MONITOR_DEFAULTTOPRIMARY*/); | |
5765 if (mon != NULL) | |
5766 { | |
5767 moninfo.cbSize = sizeof(_MONITORINFO); | |
5768 if (pGetMonitorInfo(mon, &moninfo)) | |
5769 { | |
5770 *spi_rect = moninfo.rcWork; | |
5771 return; | |
5772 } | |
5773 } | |
5774 } | |
5775 /* this is the old method... */ | |
5776 SystemParametersInfo(SPI_GETWORKAREA, 0, spi_rect, 0); | |
5777 } | |
5778 | |
5779 /* | |
5780 * Set the size of the window to the given width and height in pixels. | |
5781 */ | |
323 | 5782 /*ARGSUSED*/ |
7 | 5783 void |
5784 gui_mch_set_shellsize(int width, int height, | |
812 | 5785 int min_width, int min_height, int base_width, int base_height, |
5786 int direction) | |
7 | 5787 { |
5788 RECT workarea_rect; | |
5789 int win_width, win_height; | |
5790 WINDOWPLACEMENT wndpl; | |
5791 | |
819 | 5792 /* Try to keep window completely on screen. */ |
5793 /* Get position of the screen work area. This is the part that is not | |
5794 * used by the taskbar or appbars. */ | |
7 | 5795 get_work_area(&workarea_rect); |
5796 | |
4352 | 5797 /* Get current position of our window. Note that the .left and .top are |
819 | 5798 * relative to the work area. */ |
7 | 5799 wndpl.length = sizeof(WINDOWPLACEMENT); |
5800 GetWindowPlacement(s_hwnd, &wndpl); | |
5801 | |
5802 /* Resizing a maximized window looks very strange, unzoom it first. | |
5803 * But don't do it when still starting up, it may have been requested in | |
5804 * the shortcut. */ | |
5805 if (wndpl.showCmd == SW_SHOWMAXIMIZED && starting == 0) | |
5806 { | |
5807 ShowWindow(s_hwnd, SW_SHOWNORMAL); | |
5808 /* Need to get the settings of the normal window. */ | |
5809 GetWindowPlacement(s_hwnd, &wndpl); | |
5810 } | |
5811 | |
5812 /* 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
|
5813 win_width = width + (GetSystemMetrics(SM_CXFRAME) + |
6110 | 5814 GetSystemMetrics(SM_CXPADDEDBORDER)) * 2; |
5225
8f983df0299f
updated for version 7.4a.038
Bram Moolenaar <bram@vim.org>
parents:
5223
diff
changeset
|
5815 win_height = height + (GetSystemMetrics(SM_CYFRAME) + |
6110 | 5816 GetSystemMetrics(SM_CXPADDEDBORDER)) * 2 |
7 | 5817 + GetSystemMetrics(SM_CYCAPTION) |
5818 #ifdef FEAT_MENU | |
5819 + gui_mswin_get_menu_height(FALSE) | |
5820 #endif | |
5821 ; | |
5822 | |
3248 | 5823 /* The following should take care of keeping Vim on the same monitor, no |
5824 * matter if the secondary monitor is left or right of the primary | |
5825 * monitor. */ | |
5826 wndpl.rcNormalPosition.right = wndpl.rcNormalPosition.left + win_width; | |
5827 wndpl.rcNormalPosition.bottom = wndpl.rcNormalPosition.top + win_height; | |
5828 | |
5829 /* If the window is going off the screen, move it on to the screen. */ | |
819 | 5830 if ((direction & RESIZE_HOR) |
3248 | 5831 && wndpl.rcNormalPosition.right > workarea_rect.right) |
5832 OffsetRect(&wndpl.rcNormalPosition, | |
5833 workarea_rect.right - wndpl.rcNormalPosition.right, 0); | |
5834 | |
5835 if ((direction & RESIZE_HOR) | |
5836 && wndpl.rcNormalPosition.left < workarea_rect.left) | |
5837 OffsetRect(&wndpl.rcNormalPosition, | |
5838 workarea_rect.left - wndpl.rcNormalPosition.left, 0); | |
7 | 5839 |
812 | 5840 if ((direction & RESIZE_VERT) |
3248 | 5841 && wndpl.rcNormalPosition.bottom > workarea_rect.bottom) |
5842 OffsetRect(&wndpl.rcNormalPosition, | |
5843 0, workarea_rect.bottom - wndpl.rcNormalPosition.bottom); | |
5844 | |
5845 if ((direction & RESIZE_VERT) | |
5846 && wndpl.rcNormalPosition.top < workarea_rect.top) | |
5847 OffsetRect(&wndpl.rcNormalPosition, | |
5848 0, workarea_rect.top - wndpl.rcNormalPosition.top); | |
7 | 5849 |
5850 /* set window position - we should use SetWindowPlacement rather than | |
5851 * SetWindowPos as the MSDN docs say the coord systems returned by | |
5852 * these two are not compatible. */ | |
5853 SetWindowPlacement(s_hwnd, &wndpl); | |
5854 | |
5855 SetActiveWindow(s_hwnd); | |
5856 SetFocus(s_hwnd); | |
5857 | |
5858 #ifdef FEAT_MENU | |
5859 /* Menu may wrap differently now */ | |
5860 gui_mswin_get_menu_height(!gui.starting); | |
5861 #endif | |
5862 } | |
5863 | |
5864 | |
5865 void | |
5866 gui_mch_set_scrollbar_thumb( | |
5867 scrollbar_T *sb, | |
5868 long val, | |
5869 long size, | |
5870 long max) | |
5871 { | |
5872 SCROLLINFO info; | |
5873 | |
5874 sb->scroll_shift = 0; | |
5875 while (max > 32767) | |
5876 { | |
5877 max = (max + 1) >> 1; | |
5878 val >>= 1; | |
5879 size >>= 1; | |
5880 ++sb->scroll_shift; | |
5881 } | |
5882 | |
5883 if (sb->scroll_shift > 0) | |
5884 ++size; | |
5885 | |
5886 info.cbSize = sizeof(info); | |
5887 info.fMask = SIF_POS | SIF_RANGE | SIF_PAGE; | |
5888 info.nPos = val; | |
5889 info.nMin = 0; | |
5890 info.nMax = max; | |
5891 info.nPage = size; | |
5892 SetScrollInfo(sb->id, SB_CTL, &info, TRUE); | |
5893 } | |
5894 | |
5895 | |
5896 /* | |
5897 * Set the current text font. | |
5898 */ | |
5899 void | |
5900 gui_mch_set_font(GuiFont font) | |
5901 { | |
5902 gui.currFont = font; | |
5903 } | |
5904 | |
5905 | |
5906 /* | |
5907 * Set the current text foreground color. | |
5908 */ | |
5909 void | |
5910 gui_mch_set_fg_color(guicolor_T color) | |
5911 { | |
5912 gui.currFgColor = color; | |
5913 } | |
5914 | |
5915 /* | |
5916 * Set the current text background color. | |
5917 */ | |
5918 void | |
5919 gui_mch_set_bg_color(guicolor_T color) | |
5920 { | |
5921 gui.currBgColor = color; | |
5922 } | |
5923 | |
205 | 5924 /* |
5925 * Set the current text special color. | |
5926 */ | |
5927 void | |
5928 gui_mch_set_sp_color(guicolor_T color) | |
5929 { | |
5930 gui.currSpColor = color; | |
5931 } | |
5932 | |
7 | 5933 #if defined(FEAT_MBYTE) && defined(FEAT_MBYTE_IME) |
5934 /* | |
5935 * Multi-byte handling, originally by Sung-Hoon Baek. | |
5936 * First static functions (no prototypes generated). | |
5937 */ | |
5938 #ifdef _MSC_VER | |
5939 # include <ime.h> /* Apparently not needed for Cygwin, MingW or Borland. */ | |
5940 #endif | |
5941 #include <imm.h> | |
5942 | |
5943 /* | |
5944 * handle WM_IME_NOTIFY message | |
5945 */ | |
344 | 5946 /*ARGSUSED*/ |
7 | 5947 static LRESULT |
5948 _OnImeNotify(HWND hWnd, DWORD dwCommand, DWORD dwData) | |
5949 { | |
5950 LRESULT lResult = 0; | |
5951 HIMC hImc; | |
5952 | |
5953 if (!pImmGetContext || (hImc = pImmGetContext(hWnd)) == (HIMC)0) | |
5954 return lResult; | |
5955 switch (dwCommand) | |
5956 { | |
5957 case IMN_SETOPENSTATUS: | |
5958 if (pImmGetOpenStatus(hImc)) | |
5959 { | |
5960 pImmSetCompositionFont(hImc, &norm_logfont); | |
5961 im_set_position(gui.row, gui.col); | |
5962 | |
5963 /* Disable langmap */ | |
5964 State &= ~LANGMAP; | |
5965 if (State & INSERT) | |
5966 { | |
5967 #if defined(FEAT_WINDOWS) && defined(FEAT_KEYMAP) | |
5968 /* Unshown 'keymap' in status lines */ | |
5969 if (curbuf->b_p_iminsert == B_IMODE_LMAP) | |
5970 { | |
5971 /* Save cursor position */ | |
5972 int old_row = gui.row; | |
5973 int old_col = gui.col; | |
5974 | |
5975 // This must be called here before | |
5976 // status_redraw_curbuf(), otherwise the mode | |
5977 // message may appear in the wrong position. | |
5978 showmode(); | |
5979 status_redraw_curbuf(); | |
5980 update_screen(0); | |
5981 /* Restore cursor position */ | |
5982 gui.row = old_row; | |
5983 gui.col = old_col; | |
5984 } | |
5985 #endif | |
5986 } | |
5987 } | |
5988 gui_update_cursor(TRUE, FALSE); | |
5989 lResult = 0; | |
5990 break; | |
5991 } | |
5992 pImmReleaseContext(hWnd, hImc); | |
5993 return lResult; | |
5994 } | |
5995 | |
344 | 5996 /*ARGSUSED*/ |
7 | 5997 static LRESULT |
5998 _OnImeComposition(HWND hwnd, WPARAM dbcs, LPARAM param) | |
5999 { | |
6000 char_u *ret; | |
6001 int len; | |
6002 | |
6003 if ((param & GCS_RESULTSTR) == 0) /* Composition unfinished. */ | |
6004 return 0; | |
6005 | |
6006 ret = GetResultStr(hwnd, GCS_RESULTSTR, &len); | |
6007 if (ret != NULL) | |
6008 { | |
6009 add_to_input_buf_csi(ret, len); | |
6010 vim_free(ret); | |
6011 return 1; | |
6012 } | |
6013 return 0; | |
6014 } | |
6015 | |
6016 /* | |
6017 * get the current composition string, in UCS-2; *lenp is the number of | |
6018 * *lenp is the number of Unicode characters. | |
6019 */ | |
6020 static short_u * | |
6021 GetCompositionString_inUCS2(HIMC hIMC, DWORD GCS, int *lenp) | |
6022 { | |
6023 LONG ret; | |
6024 LPWSTR wbuf = NULL; | |
6025 char_u *buf; | |
6026 | |
6027 if (!pImmGetContext) | |
6028 return NULL; /* no imm32.dll */ | |
6029 | |
6030 /* Try Unicode; this'll always work on NT regardless of codepage. */ | |
6031 ret = pImmGetCompositionStringW(hIMC, GCS, NULL, 0); | |
6032 if (ret == 0) | |
6033 return NULL; /* empty */ | |
6034 | |
6035 if (ret > 0) | |
6036 { | |
6037 /* Allocate the requested buffer plus space for the NUL character. */ | |
6038 wbuf = (LPWSTR)alloc(ret + sizeof(WCHAR)); | |
6039 if (wbuf != NULL) | |
6040 { | |
6041 pImmGetCompositionStringW(hIMC, GCS, wbuf, ret); | |
6042 *lenp = ret / sizeof(WCHAR); | |
6043 } | |
6044 return (short_u *)wbuf; | |
6045 } | |
6046 | |
6047 /* ret < 0; we got an error, so try the ANSI version. This'll work | |
6048 * on 9x/ME, but only if the codepage happens to be set to whatever | |
6049 * we're inputting. */ | |
6050 ret = pImmGetCompositionStringA(hIMC, GCS, NULL, 0); | |
6051 if (ret <= 0) | |
6052 return NULL; /* empty or error */ | |
6053 | |
6054 buf = alloc(ret); | |
6055 if (buf == NULL) | |
6056 return NULL; | |
6057 pImmGetCompositionStringA(hIMC, GCS, buf, ret); | |
6058 | |
6059 /* 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
|
6060 MultiByteToWideChar_alloc(GetACP(), 0, (LPCSTR)buf, ret, &wbuf, lenp); |
7 | 6061 vim_free(buf); |
6062 | |
6063 return (short_u *)wbuf; | |
6064 } | |
6065 | |
6066 /* | |
6067 * void GetResultStr() | |
6068 * | |
6069 * This handles WM_IME_COMPOSITION with GCS_RESULTSTR flag on. | |
6070 * get complete composition string | |
6071 */ | |
6072 static char_u * | |
6073 GetResultStr(HWND hwnd, int GCS, int *lenp) | |
6074 { | |
6075 HIMC hIMC; /* Input context handle. */ | |
6076 short_u *buf = NULL; | |
6077 char_u *convbuf = NULL; | |
6078 | |
6079 if (!pImmGetContext || (hIMC = pImmGetContext(hwnd)) == (HIMC)0) | |
6080 return NULL; | |
6081 | |
6082 /* Reads in the composition string. */ | |
6083 buf = GetCompositionString_inUCS2(hIMC, GCS, lenp); | |
6084 if (buf == NULL) | |
6085 return NULL; | |
6086 | |
1752 | 6087 convbuf = utf16_to_enc(buf, lenp); |
7 | 6088 pImmReleaseContext(hwnd, hIMC); |
6089 vim_free(buf); | |
6090 return convbuf; | |
6091 } | |
6092 #endif | |
6093 | |
6094 /* For global functions we need prototypes. */ | |
6095 #if (defined(FEAT_MBYTE) && defined(FEAT_MBYTE_IME)) || defined(PROTO) | |
6096 | |
6097 /* | |
6098 * set font to IM. | |
6099 */ | |
6100 void | |
6101 im_set_font(LOGFONT *lf) | |
6102 { | |
6103 HIMC hImc; | |
6104 | |
6105 if (pImmGetContext && (hImc = pImmGetContext(s_hwnd)) != (HIMC)0) | |
6106 { | |
6107 pImmSetCompositionFont(hImc, lf); | |
6108 pImmReleaseContext(s_hwnd, hImc); | |
6109 } | |
6110 } | |
6111 | |
6112 /* | |
6113 * Notify cursor position to IM. | |
6114 */ | |
6115 void | |
6116 im_set_position(int row, int col) | |
6117 { | |
6118 HIMC hImc; | |
6119 | |
6120 if (pImmGetContext && (hImc = pImmGetContext(s_hwnd)) != (HIMC)0) | |
6121 { | |
6122 COMPOSITIONFORM cfs; | |
6123 | |
6124 cfs.dwStyle = CFS_POINT; | |
6125 cfs.ptCurrentPos.x = FILL_X(col); | |
6126 cfs.ptCurrentPos.y = FILL_Y(row); | |
6127 MapWindowPoints(s_textArea, s_hwnd, &cfs.ptCurrentPos, 1); | |
6128 pImmSetCompositionWindow(hImc, &cfs); | |
6129 | |
6130 pImmReleaseContext(s_hwnd, hImc); | |
6131 } | |
6132 } | |
6133 | |
6134 /* | |
6135 * Set IM status on ("active" is TRUE) or off ("active" is FALSE). | |
6136 */ | |
6137 void | |
6138 im_set_active(int active) | |
6139 { | |
6140 HIMC hImc; | |
6141 static HIMC hImcOld = (HIMC)0; | |
6142 | |
6143 if (pImmGetContext) /* if NULL imm32.dll wasn't loaded (yet) */ | |
6144 { | |
6145 if (p_imdisable) | |
6146 { | |
6147 if (hImcOld == (HIMC)0) | |
6148 { | |
6149 hImcOld = pImmGetContext(s_hwnd); | |
6150 if (hImcOld) | |
6151 pImmAssociateContext(s_hwnd, (HIMC)0); | |
6152 } | |
6153 active = FALSE; | |
6154 } | |
6155 else if (hImcOld != (HIMC)0) | |
6156 { | |
6157 pImmAssociateContext(s_hwnd, hImcOld); | |
6158 hImcOld = (HIMC)0; | |
6159 } | |
6160 | |
6161 hImc = pImmGetContext(s_hwnd); | |
6162 if (hImc) | |
6163 { | |
777 | 6164 /* |
6165 * for Korean ime | |
6166 */ | |
6167 HKL hKL = GetKeyboardLayout(0); | |
6168 | |
6169 if (LOWORD(hKL) == MAKELANGID(LANG_KOREAN, SUBLANG_KOREAN)) | |
6170 { | |
6171 static DWORD dwConversionSaved = 0, dwSentenceSaved = 0; | |
6172 static BOOL bSaved = FALSE; | |
6173 | |
6174 if (active) | |
6175 { | |
6176 /* if we have a saved conversion status, restore it */ | |
6177 if (bSaved) | |
6178 pImmSetConversionStatus(hImc, dwConversionSaved, | |
6179 dwSentenceSaved); | |
6180 bSaved = FALSE; | |
6181 } | |
6182 else | |
6183 { | |
6184 /* save conversion status and disable korean */ | |
6185 if (pImmGetConversionStatus(hImc, &dwConversionSaved, | |
6186 &dwSentenceSaved)) | |
6187 { | |
6188 bSaved = TRUE; | |
6189 pImmSetConversionStatus(hImc, | |
6190 dwConversionSaved & ~(IME_CMODE_NATIVE | |
6191 | IME_CMODE_FULLSHAPE), | |
6192 dwSentenceSaved); | |
6193 } | |
6194 } | |
6195 } | |
6196 | |
7 | 6197 pImmSetOpenStatus(hImc, active); |
6198 pImmReleaseContext(s_hwnd, hImc); | |
6199 } | |
6200 } | |
6201 } | |
6202 | |
6203 /* | |
6204 * Get IM status. When IM is on, return not 0. Else return 0. | |
6205 */ | |
6206 int | |
7823
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
6207 im_get_status(void) |
7 | 6208 { |
6209 int status = 0; | |
6210 HIMC hImc; | |
6211 | |
6212 if (pImmGetContext && (hImc = pImmGetContext(s_hwnd)) != (HIMC)0) | |
6213 { | |
6214 status = pImmGetOpenStatus(hImc) ? 1 : 0; | |
6215 pImmReleaseContext(s_hwnd, hImc); | |
6216 } | |
6217 return status; | |
6218 } | |
6219 | |
6220 #endif /* FEAT_MBYTE && FEAT_MBYTE_IME */ | |
6221 | |
6222 #if defined(FEAT_MBYTE) && !defined(FEAT_MBYTE_IME) && defined(GLOBAL_IME) | |
6223 /* Win32 with GLOBAL IME */ | |
6224 | |
6225 /* | |
6226 * Notify cursor position to IM. | |
6227 */ | |
6228 void | |
6229 im_set_position(int row, int col) | |
6230 { | |
6231 /* Win32 with GLOBAL IME */ | |
6232 POINT p; | |
6233 | |
6234 p.x = FILL_X(col); | |
6235 p.y = FILL_Y(row); | |
6236 MapWindowPoints(s_textArea, s_hwnd, &p, 1); | |
6237 global_ime_set_position(&p); | |
6238 } | |
6239 | |
6240 /* | |
6241 * Set IM status on ("active" is TRUE) or off ("active" is FALSE). | |
6242 */ | |
6243 void | |
6244 im_set_active(int active) | |
6245 { | |
6246 global_ime_set_status(active); | |
6247 } | |
6248 | |
6249 /* | |
6250 * Get IM status. When IM is on, return not 0. Else return 0. | |
6251 */ | |
6252 int | |
7856
226ed297307f
commit https://github.com/vim/vim/commit/d14e00ea67afbaa8cb4a7e6b1eb306da6a2d5adb
Christian Brabandt <cb@256bit.org>
parents:
7823
diff
changeset
|
6253 im_get_status(void) |
7 | 6254 { |
6255 return global_ime_get_status(); | |
6256 } | |
6257 #endif | |
6258 | |
26 | 6259 #ifdef FEAT_MBYTE |
6260 /* | |
786 | 6261 * Convert latin9 text "text[len]" to ucs-2 in "unicodebuf". |
26 | 6262 */ |
6263 static void | |
6264 latin9_to_ucs(char_u *text, int len, WCHAR *unicodebuf) | |
6265 { | |
6266 int c; | |
6267 | |
777 | 6268 while (--len >= 0) |
26 | 6269 { |
6270 c = *text++; | |
6271 switch (c) | |
6272 { | |
6273 case 0xa4: c = 0x20ac; break; /* euro */ | |
6274 case 0xa6: c = 0x0160; break; /* S hat */ | |
6275 case 0xa8: c = 0x0161; break; /* S -hat */ | |
6276 case 0xb4: c = 0x017d; break; /* Z hat */ | |
6277 case 0xb8: c = 0x017e; break; /* Z -hat */ | |
6278 case 0xbc: c = 0x0152; break; /* OE */ | |
6279 case 0xbd: c = 0x0153; break; /* oe */ | |
6280 case 0xbe: c = 0x0178; break; /* Y */ | |
6281 } | |
6282 *unicodebuf++ = c; | |
6283 } | |
6284 } | |
6285 #endif | |
7 | 6286 |
6287 #ifdef FEAT_RIGHTLEFT | |
6288 /* | |
6289 * What is this for? In the case where you are using Win98 or Win2K or later, | |
6290 * and you are using a Hebrew font (or Arabic!), Windows does you a favor and | |
6291 * reverses the string sent to the TextOut... family. This sucks, because we | |
6292 * go to a lot of effort to do the right thing, and there doesn't seem to be a | |
6293 * way to tell Windblows not to do this! | |
6294 * | |
6295 * The short of it is that this 'RevOut' only gets called if you are running | |
6296 * one of the new, "improved" MS OSes, and only if you are running in | |
6297 * 'rightleft' mode. It makes display take *slightly* longer, but not | |
6298 * noticeably so. | |
6299 */ | |
6300 static void | |
6301 RevOut( HDC s_hdc, | |
6302 int col, | |
6303 int row, | |
6304 UINT foptions, | |
6305 CONST RECT *pcliprect, | |
6306 LPCTSTR text, | |
6307 UINT len, | |
6308 CONST INT *padding) | |
6309 { | |
6310 int ix; | |
6311 static int special = -1; | |
6312 | |
6313 if (special == -1) | |
6314 { | |
6315 /* Check windows version: special treatment is needed if it is NT 5 or | |
6316 * Win98 or higher. */ | |
6317 if ((os_version.dwPlatformId == VER_PLATFORM_WIN32_NT | |
6318 && os_version.dwMajorVersion >= 5) | |
6319 || (os_version.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS | |
6320 && (os_version.dwMajorVersion > 4 | |
6321 || (os_version.dwMajorVersion == 4 | |
6322 && os_version.dwMinorVersion > 0)))) | |
6323 special = 1; | |
6324 else | |
6325 special = 0; | |
6326 } | |
6327 | |
6328 if (special) | |
6329 for (ix = 0; ix < (int)len; ++ix) | |
6330 ExtTextOut(s_hdc, col + TEXT_X(ix), row, foptions, | |
6331 pcliprect, text + ix, 1, padding); | |
6332 else | |
6333 ExtTextOut(s_hdc, col, row, foptions, pcliprect, text, len, padding); | |
6334 } | |
6335 #endif | |
6336 | |
6337 void | |
6338 gui_mch_draw_string( | |
6339 int row, | |
6340 int col, | |
6341 char_u *text, | |
6342 int len, | |
6343 int flags) | |
6344 { | |
6345 static int *padding = NULL; | |
6346 static int pad_size = 0; | |
6347 int i; | |
6348 const RECT *pcliprect = NULL; | |
6349 UINT foptions = 0; | |
6350 #ifdef FEAT_MBYTE | |
6351 static WCHAR *unicodebuf = NULL; | |
6352 static int *unicodepdy = NULL; | |
236 | 6353 static int unibuflen = 0; |
7 | 6354 int n = 0; |
6355 #endif | |
6356 HPEN hpen, old_pen; | |
6357 int y; | |
6110 | 6358 #ifdef FEAT_DIRECTX |
6359 int font_is_ttf_or_vector = 0; | |
6360 #endif | |
7 | 6361 |
6362 /* | |
6363 * Italic and bold text seems to have an extra row of pixels at the bottom | |
6364 * (below where the bottom of the character should be). If we draw the | |
6365 * characters with a solid background, the top row of pixels in the | |
6366 * character below will be overwritten. We can fix this by filling in the | |
6367 * background ourselves, to the correct character proportions, and then | |
6368 * writing the character in transparent mode. Still have a problem when | |
6369 * the character is "_", which gets written on to the character below. | |
6370 * New fix: set gui.char_ascent to -1. This shifts all characters up one | |
6371 * pixel in their slots, which fixes the problem with the bottom row of | |
6372 * pixels. We still need this code because otherwise the top row of pixels | |
6373 * becomes a problem. - webb. | |
6374 */ | |
6375 static HBRUSH hbr_cache[2] = {NULL, NULL}; | |
6376 static guicolor_T brush_color[2] = {INVALCOLOR, INVALCOLOR}; | |
6377 static int brush_lru = 0; | |
6378 HBRUSH hbr; | |
6379 RECT rc; | |
6380 | |
6381 if (!(flags & DRAW_TRANSP)) | |
6382 { | |
6383 /* | |
6384 * Clear background first. | |
6385 * Note: FillRect() excludes right and bottom of rectangle. | |
6386 */ | |
6387 rc.left = FILL_X(col); | |
6388 rc.top = FILL_Y(row); | |
6389 #ifdef FEAT_MBYTE | |
6390 if (has_mbyte) | |
6391 { | |
6392 /* Compute the length in display cells. */ | |
2338
da6ec32d8d8f
Added strwidth() and strchars() functions.
Bram Moolenaar <bram@vim.org>
parents:
2311
diff
changeset
|
6393 rc.right = FILL_X(col + mb_string2cells(text, len)); |
7 | 6394 } |
6395 else | |
6396 #endif | |
6397 rc.right = FILL_X(col + len); | |
6398 rc.bottom = FILL_Y(row + 1); | |
6399 | |
6400 /* Cache the created brush, that saves a lot of time. We need two: | |
6401 * one for cursor background and one for the normal background. */ | |
6402 if (gui.currBgColor == brush_color[0]) | |
6403 { | |
6404 hbr = hbr_cache[0]; | |
6405 brush_lru = 1; | |
6406 } | |
6407 else if (gui.currBgColor == brush_color[1]) | |
6408 { | |
6409 hbr = hbr_cache[1]; | |
6410 brush_lru = 0; | |
6411 } | |
6412 else | |
6413 { | |
6414 if (hbr_cache[brush_lru] != NULL) | |
6415 DeleteBrush(hbr_cache[brush_lru]); | |
6416 hbr_cache[brush_lru] = CreateSolidBrush(gui.currBgColor); | |
6417 brush_color[brush_lru] = gui.currBgColor; | |
6418 hbr = hbr_cache[brush_lru]; | |
6419 brush_lru = !brush_lru; | |
6420 } | |
6421 FillRect(s_hdc, &rc, hbr); | |
6422 | |
6423 SetBkMode(s_hdc, TRANSPARENT); | |
6424 | |
6425 /* | |
6426 * When drawing block cursor, prevent inverted character spilling | |
6427 * over character cell (can happen with bold/italic) | |
6428 */ | |
6429 if (flags & DRAW_CURSOR) | |
6430 { | |
6431 pcliprect = &rc; | |
6432 foptions = ETO_CLIPPED; | |
6433 } | |
6434 } | |
6435 SetTextColor(s_hdc, gui.currFgColor); | |
6436 SelectFont(s_hdc, gui.currFont); | |
6437 | |
6110 | 6438 #ifdef FEAT_DIRECTX |
6439 if (IS_ENABLE_DIRECTX()) | |
6440 { | |
6441 TEXTMETRIC tm; | |
6442 | |
6443 GetTextMetrics(s_hdc, &tm); | |
6444 if (tm.tmPitchAndFamily & (TMPF_TRUETYPE | TMPF_VECTOR)) | |
6445 { | |
6446 font_is_ttf_or_vector = 1; | |
6447 DWriteContext_SetFont(s_dwc, (HFONT)gui.currFont); | |
6448 } | |
6449 } | |
6450 #endif | |
6451 | |
7 | 6452 if (pad_size != Columns || padding == NULL || padding[0] != gui.char_width) |
6453 { | |
6454 vim_free(padding); | |
6455 pad_size = Columns; | |
6456 | |
537 | 6457 /* Don't give an out-of-memory message here, it would call us |
6458 * recursively. */ | |
6459 padding = (int *)lalloc(pad_size * sizeof(int), FALSE); | |
7 | 6460 if (padding != NULL) |
6461 for (i = 0; i < pad_size; i++) | |
6462 padding[i] = gui.char_width; | |
6463 } | |
6464 | |
6465 /* | |
6466 * We have to provide the padding argument because italic and bold versions | |
6467 * of fixed-width fonts are often one pixel or so wider than their normal | |
6468 * versions. | |
6469 * No check for DRAW_BOLD, Windows will have done it already. | |
6470 */ | |
6471 | |
6472 #ifdef FEAT_MBYTE | |
6473 /* Check if there are any UTF-8 characters. If not, use normal text | |
6474 * output to speed up output. */ | |
6475 if (enc_utf8) | |
6476 for (n = 0; n < len; ++n) | |
6477 if (text[n] >= 0x80) | |
6478 break; | |
6479 | |
6110 | 6480 #if defined(FEAT_DIRECTX) |
6481 /* Quick hack to enable DirectWrite. To use DirectWrite (antialias), it is | |
6482 * required that unicode drawing routine, currently. So this forces it | |
6483 * enabled. */ | |
6484 if (enc_utf8 && IS_ENABLE_DIRECTX()) | |
6485 n = 0; /* Keep n < len, to enter block for unicode. */ | |
6486 #endif | |
6487 | |
7 | 6488 /* Check if the Unicode buffer exists and is big enough. Create it |
236 | 6489 * with the same length as the multi-byte string, the number of wide |
7 | 6490 * characters is always equal or smaller. */ |
26 | 6491 if ((enc_utf8 |
6492 || (enc_codepage > 0 && (int)GetACP() != enc_codepage) | |
6493 || enc_latin9) | |
7 | 6494 && (unicodebuf == NULL || len > unibuflen)) |
6495 { | |
6496 vim_free(unicodebuf); | |
537 | 6497 unicodebuf = (WCHAR *)lalloc(len * sizeof(WCHAR), FALSE); |
7 | 6498 |
6499 vim_free(unicodepdy); | |
537 | 6500 unicodepdy = (int *)lalloc(len * sizeof(int), FALSE); |
7 | 6501 |
6502 unibuflen = len; | |
6503 } | |
6504 | |
6505 if (enc_utf8 && n < len && unicodebuf != NULL) | |
6506 { | |
6507 /* Output UTF-8 characters. Caller has already separated | |
6508 * composing characters. */ | |
777 | 6509 int i; |
6510 int wlen; /* string length in words */ | |
6511 int clen; /* string length in characters */ | |
7 | 6512 int cells; /* cell width of string up to composing char */ |
6513 int cw; /* width of current cell */ | |
714 | 6514 int c; |
777 | 6515 |
782 | 6516 wlen = 0; |
777 | 6517 clen = 0; |
7 | 6518 cells = 0; |
777 | 6519 for (i = 0; i < len; ) |
7 | 6520 { |
714 | 6521 c = utf_ptr2char(text + i); |
6522 if (c >= 0x10000) | |
6523 { | |
6524 /* Turn into UTF-16 encoding. */ | |
777 | 6525 unicodebuf[wlen++] = ((c - 0x10000) >> 10) + 0xD800; |
6526 unicodebuf[wlen++] = ((c - 0x10000) & 0x3ff) + 0xDC00; | |
714 | 6527 } |
6528 else | |
6529 { | |
777 | 6530 unicodebuf[wlen++] = c; |
714 | 6531 } |
6532 cw = utf_char2cells(c); | |
7 | 6533 if (cw > 2) /* don't use 4 for unprintable char */ |
6534 cw = 1; | |
6535 if (unicodepdy != NULL) | |
6536 { | |
6537 /* Use unicodepdy to make characters fit as we expect, even | |
6538 * when the font uses different widths (e.g., bold character | |
6539 * is wider). */ | |
8273
0c3210caefa6
commit https://github.com/vim/vim/commit/d804fdf4c25435284333258856bc265f1ff10b09
Christian Brabandt <cb@256bit.org>
parents:
8222
diff
changeset
|
6540 if (c >= 0x10000) |
0c3210caefa6
commit https://github.com/vim/vim/commit/d804fdf4c25435284333258856bc265f1ff10b09
Christian Brabandt <cb@256bit.org>
parents:
8222
diff
changeset
|
6541 { |
0c3210caefa6
commit https://github.com/vim/vim/commit/d804fdf4c25435284333258856bc265f1ff10b09
Christian Brabandt <cb@256bit.org>
parents:
8222
diff
changeset
|
6542 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
|
6543 unicodepdy[wlen - 1] = 0; |
0c3210caefa6
commit https://github.com/vim/vim/commit/d804fdf4c25435284333258856bc265f1ff10b09
Christian Brabandt <cb@256bit.org>
parents:
8222
diff
changeset
|
6544 } |
0c3210caefa6
commit https://github.com/vim/vim/commit/d804fdf4c25435284333258856bc265f1ff10b09
Christian Brabandt <cb@256bit.org>
parents:
8222
diff
changeset
|
6545 else |
0c3210caefa6
commit https://github.com/vim/vim/commit/d804fdf4c25435284333258856bc265f1ff10b09
Christian Brabandt <cb@256bit.org>
parents:
8222
diff
changeset
|
6546 unicodepdy[wlen - 1] = cw * gui.char_width; |
7 | 6547 } |
6548 cells += cw; | |
474 | 6549 i += utfc_ptr2len_len(text + i, len - i); |
777 | 6550 ++clen; |
7 | 6551 } |
6110 | 6552 #if defined(FEAT_DIRECTX) |
6553 if (IS_ENABLE_DIRECTX() && font_is_ttf_or_vector) | |
6554 { | |
6112 | 6555 /* Add one to "cells" for italics. */ |
6110 | 6556 DWriteContext_DrawText(s_dwc, s_hdc, unicodebuf, wlen, |
6112 | 6557 TEXT_X(col), TEXT_Y(row), FILL_X(cells + 1), FILL_Y(1), |
6110 | 6558 gui.char_width, gui.currFgColor); |
6559 } | |
6560 else | |
6561 #endif | |
6562 ExtTextOutW(s_hdc, TEXT_X(col), TEXT_Y(row), | |
6563 foptions, pcliprect, unicodebuf, wlen, unicodepdy); | |
7 | 6564 len = cells; /* used for underlining */ |
6565 } | |
26 | 6566 else if ((enc_codepage > 0 && (int)GetACP() != enc_codepage) || enc_latin9) |
7 | 6567 { |
6568 /* If we want to display codepage data, and the current CP is not the | |
6569 * ANSI one, we need to go via Unicode. */ | |
6570 if (unicodebuf != NULL) | |
6571 { | |
26 | 6572 if (enc_latin9) |
6573 latin9_to_ucs(text, len, unicodebuf); | |
6574 else | |
6575 len = MultiByteToWideChar(enc_codepage, | |
7 | 6576 MB_PRECOMPOSED, |
6577 (char *)text, len, | |
6578 (LPWSTR)unicodebuf, unibuflen); | |
6579 if (len != 0) | |
179 | 6580 { |
6581 /* Use unicodepdy to make characters fit as we expect, even | |
6582 * when the font uses different widths (e.g., bold character | |
6583 * is wider). */ | |
6584 if (unicodepdy != NULL) | |
6585 { | |
6586 int i; | |
6587 int cw; | |
6588 | |
6589 for (i = 0; i < len; ++i) | |
6590 { | |
6591 cw = utf_char2cells(unicodebuf[i]); | |
6592 if (cw > 2) | |
6593 cw = 1; | |
6594 unicodepdy[i] = cw * gui.char_width; | |
6595 } | |
6596 } | |
7 | 6597 ExtTextOutW(s_hdc, TEXT_X(col), TEXT_Y(row), |
179 | 6598 foptions, pcliprect, unicodebuf, len, unicodepdy); |
6599 } | |
7 | 6600 } |
6601 } | |
6602 else | |
6603 #endif | |
6604 { | |
6605 #ifdef FEAT_RIGHTLEFT | |
6226 | 6606 /* Windows will mess up RL text, so we have to draw it character by |
6607 * character. Only do this if RL is on, since it's slow. */ | |
6608 if (curwin->w_p_rl) | |
7 | 6609 RevOut(s_hdc, TEXT_X(col), TEXT_Y(row), |
6610 foptions, pcliprect, (char *)text, len, padding); | |
6611 else | |
6612 #endif | |
6613 ExtTextOut(s_hdc, TEXT_X(col), TEXT_Y(row), | |
6614 foptions, pcliprect, (char *)text, len, padding); | |
6615 } | |
6616 | |
205 | 6617 /* Underline */ |
7 | 6618 if (flags & DRAW_UNDERL) |
6619 { | |
6620 hpen = CreatePen(PS_SOLID, 1, gui.currFgColor); | |
6621 old_pen = SelectObject(s_hdc, hpen); | |
6622 /* When p_linespace is 0, overwrite the bottom row of pixels. | |
6623 * Otherwise put the line just below the character. */ | |
6624 y = FILL_Y(row + 1) - 1; | |
6625 if (p_linespace > 1) | |
6626 y -= p_linespace - 1; | |
6627 MoveToEx(s_hdc, FILL_X(col), y, NULL); | |
6628 /* Note: LineTo() excludes the last pixel in the line. */ | |
6629 LineTo(s_hdc, FILL_X(col + len), y); | |
6630 DeleteObject(SelectObject(s_hdc, old_pen)); | |
6631 } | |
205 | 6632 |
6633 /* Undercurl */ | |
6634 if (flags & DRAW_UNDERC) | |
6635 { | |
6636 int x; | |
6637 int offset; | |
323 | 6638 static const int val[8] = {1, 0, 0, 0, 1, 2, 2, 2 }; |
205 | 6639 |
6640 y = FILL_Y(row + 1) - 1; | |
6641 for (x = FILL_X(col); x < FILL_X(col + len); ++x) | |
6642 { | |
6643 offset = val[x % 8]; | |
6644 SetPixel(s_hdc, x, y - offset, gui.currSpColor); | |
6645 } | |
6646 } | |
7 | 6647 } |
6648 | |
6649 | |
6650 /* | |
6651 * Output routines. | |
6652 */ | |
6653 | |
6654 /* Flush any output to the screen */ | |
6655 void | |
6656 gui_mch_flush(void) | |
6657 { | |
6658 # if defined(__BORLANDC__) | |
6659 /* | |
6660 * The GdiFlush declaration (in Borland C 5.01 <wingdi.h>) is not a | |
6661 * prototype declaration. | |
6662 * The compiler complains if __stdcall is not used in both declarations. | |
6663 */ | |
6664 BOOL __stdcall GdiFlush(void); | |
6665 # endif | |
6666 | |
6667 GdiFlush(); | |
6668 } | |
6669 | |
6670 static void | |
6671 clear_rect(RECT *rcp) | |
6672 { | |
6673 HBRUSH hbr; | |
6674 | |
6675 hbr = CreateSolidBrush(gui.back_pixel); | |
6676 FillRect(s_hdc, rcp, hbr); | |
6677 DeleteBrush(hbr); | |
6678 } | |
6679 | |
6680 | |
636 | 6681 void |
6682 gui_mch_get_screen_dimensions(int *screen_w, int *screen_h) | |
6683 { | |
6684 RECT workarea_rect; | |
6685 | |
6686 get_work_area(&workarea_rect); | |
6687 | |
819 | 6688 *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
|
6689 - (GetSystemMetrics(SM_CXFRAME) + |
6110 | 6690 GetSystemMetrics(SM_CXPADDEDBORDER)) * 2; |
636 | 6691 |
6692 /* FIXME: dirty trick: Because the gui_get_base_height() doesn't include | |
6693 * the menubar for MSwin, we subtract it from the screen height, so that | |
6694 * the window size can be made to fit on the screen. */ | |
819 | 6695 *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
|
6696 - (GetSystemMetrics(SM_CYFRAME) + |
6110 | 6697 GetSystemMetrics(SM_CXPADDEDBORDER)) * 2 |
636 | 6698 - GetSystemMetrics(SM_CYCAPTION) |
6699 #ifdef FEAT_MENU | |
856 | 6700 - gui_mswin_get_menu_height(FALSE) |
636 | 6701 #endif |
856 | 6702 ; |
636 | 6703 } |
6704 | |
6705 | |
7 | 6706 #if defined(FEAT_MENU) || defined(PROTO) |
6707 /* | |
6708 * Add a sub menu to the menu bar. | |
6709 */ | |
6710 void | |
6711 gui_mch_add_menu( | |
6712 vimmenu_T *menu, | |
6713 int pos) | |
6714 { | |
6715 vimmenu_T *parent = menu->parent; | |
6716 | |
6717 menu->submenu_id = CreatePopupMenu(); | |
6718 menu->id = s_menu_id++; | |
6719 | |
6720 if (menu_is_menubar(menu->name)) | |
6721 { | |
6722 if (is_winnt_3()) | |
6723 { | |
6724 InsertMenu((parent == NULL) ? s_menuBar : parent->submenu_id, | |
6725 (UINT)pos, MF_POPUP | MF_STRING | MF_BYPOSITION, | |
840 | 6726 (long_u)menu->submenu_id, (LPCTSTR) menu->name); |
7 | 6727 } |
6728 else | |
6729 { | |
6730 #ifdef FEAT_MBYTE | |
6731 WCHAR *wn = NULL; | |
6732 int n; | |
6733 | |
6734 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) | |
6735 { | |
6736 /* 'encoding' differs from active codepage: convert menu name | |
6737 * and use wide function */ | |
1752 | 6738 wn = enc_to_utf16(menu->name, NULL); |
7 | 6739 if (wn != NULL) |
6740 { | |
6741 MENUITEMINFOW infow; | |
6742 | |
6743 infow.cbSize = sizeof(infow); | |
6744 infow.fMask = MIIM_DATA | MIIM_TYPE | MIIM_ID | |
6745 | MIIM_SUBMENU; | |
840 | 6746 infow.dwItemData = (long_u)menu; |
7 | 6747 infow.wID = menu->id; |
6748 infow.fType = MFT_STRING; | |
6749 infow.dwTypeData = wn; | |
835 | 6750 infow.cch = (UINT)wcslen(wn); |
7 | 6751 infow.hSubMenu = menu->submenu_id; |
6752 n = InsertMenuItemW((parent == NULL) | |
6753 ? s_menuBar : parent->submenu_id, | |
6754 (UINT)pos, TRUE, &infow); | |
6755 vim_free(wn); | |
6756 if (n == 0 && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) | |
6757 /* Failed, try using non-wide function. */ | |
6758 wn = NULL; | |
6759 } | |
6760 } | |
6761 | |
6762 if (wn == NULL) | |
6763 #endif | |
6764 { | |
6765 MENUITEMINFO info; | |
6766 | |
6767 info.cbSize = sizeof(info); | |
6768 info.fMask = MIIM_DATA | MIIM_TYPE | MIIM_ID | MIIM_SUBMENU; | |
840 | 6769 info.dwItemData = (long_u)menu; |
7 | 6770 info.wID = menu->id; |
6771 info.fType = MFT_STRING; | |
6772 info.dwTypeData = (LPTSTR)menu->name; | |
6773 info.cch = (UINT)STRLEN(menu->name); | |
6774 info.hSubMenu = menu->submenu_id; | |
6775 InsertMenuItem((parent == NULL) | |
6776 ? s_menuBar : parent->submenu_id, | |
6777 (UINT)pos, TRUE, &info); | |
6778 } | |
6779 } | |
6780 } | |
6781 | |
6782 /* Fix window size if menu may have wrapped */ | |
6783 if (parent == NULL) | |
6784 gui_mswin_get_menu_height(!gui.starting); | |
6785 #ifdef FEAT_TEAROFF | |
6786 else if (IsWindow(parent->tearoff_handle)) | |
6787 rebuild_tearoff(parent); | |
6788 #endif | |
6789 } | |
6790 | |
6791 void | |
6792 gui_mch_show_popupmenu(vimmenu_T *menu) | |
6793 { | |
6794 POINT mp; | |
6795 | |
6796 (void)GetCursorPos((LPPOINT)&mp); | |
6797 gui_mch_show_popupmenu_at(menu, (int)mp.x, (int)mp.y); | |
6798 } | |
6799 | |
6800 void | |
401 | 6801 gui_make_popup(char_u *path_name, int mouse_pos) |
7 | 6802 { |
6803 vimmenu_T *menu = gui_find_menu(path_name); | |
6804 | |
6805 if (menu != NULL) | |
6806 { | |
6807 POINT p; | |
6808 | |
6809 /* Find the position of the current cursor */ | |
6810 GetDCOrgEx(s_hdc, &p); | |
401 | 6811 if (mouse_pos) |
6812 { | |
6813 int mx, my; | |
6814 | |
6815 gui_mch_getmouse(&mx, &my); | |
6816 p.x += mx; | |
6817 p.y += my; | |
6818 } | |
6819 else if (curwin != NULL) | |
7 | 6820 { |
6821 p.x += TEXT_X(W_WINCOL(curwin) + curwin->w_wcol + 1); | |
6822 p.y += TEXT_Y(W_WINROW(curwin) + curwin->w_wrow + 1); | |
6823 } | |
6824 msg_scroll = FALSE; | |
6825 gui_mch_show_popupmenu_at(menu, (int)p.x, (int)p.y); | |
6826 } | |
6827 } | |
6828 | |
6829 #if defined(FEAT_TEAROFF) || defined(PROTO) | |
6830 /* | |
6831 * Given a menu descriptor, e.g. "File.New", find it in the menu hierarchy and | |
6832 * create it as a pseudo-"tearoff menu". | |
6833 */ | |
6834 void | |
6835 gui_make_tearoff(char_u *path_name) | |
6836 { | |
6837 vimmenu_T *menu = gui_find_menu(path_name); | |
6838 | |
6839 /* Found the menu, so tear it off. */ | |
6840 if (menu != NULL) | |
6841 gui_mch_tearoff(menu->dname, menu, 0xffffL, 0xffffL); | |
6842 } | |
6843 #endif | |
6844 | |
6845 /* | |
6846 * Add a menu item to a menu | |
6847 */ | |
6848 void | |
6849 gui_mch_add_menu_item( | |
6850 vimmenu_T *menu, | |
6851 int idx) | |
6852 { | |
6853 vimmenu_T *parent = menu->parent; | |
6854 | |
6855 menu->id = s_menu_id++; | |
6856 menu->submenu_id = NULL; | |
6857 | |
6858 #ifdef FEAT_TEAROFF | |
6859 if (STRNCMP(menu->name, TEAR_STRING, TEAR_LEN) == 0) | |
6860 { | |
6861 InsertMenu(parent->submenu_id, (UINT)idx, MF_BITMAP|MF_BYPOSITION, | |
6862 (UINT)menu->id, (LPCTSTR) s_htearbitmap); | |
6863 } | |
6864 else | |
6865 #endif | |
6866 #ifdef FEAT_TOOLBAR | |
6867 if (menu_is_toolbar(parent->name)) | |
6868 { | |
6869 TBBUTTON newtb; | |
6870 | |
6871 vim_memset(&newtb, 0, sizeof(newtb)); | |
6872 if (menu_is_separator(menu->name)) | |
6873 { | |
6874 newtb.iBitmap = 0; | |
6875 newtb.fsStyle = TBSTYLE_SEP; | |
6876 } | |
6877 else | |
6878 { | |
6879 newtb.iBitmap = get_toolbar_bitmap(menu); | |
6880 newtb.fsStyle = TBSTYLE_BUTTON; | |
6881 } | |
6882 newtb.idCommand = menu->id; | |
6883 newtb.fsState = TBSTATE_ENABLED; | |
6884 newtb.iString = 0; | |
6885 SendMessage(s_toolbarhwnd, TB_INSERTBUTTON, (WPARAM)idx, | |
6886 (LPARAM)&newtb); | |
6887 menu->submenu_id = (HMENU)-1; | |
6888 } | |
6889 else | |
6890 #endif | |
6891 { | |
6892 #ifdef FEAT_MBYTE | |
6893 WCHAR *wn = NULL; | |
6894 int n; | |
6895 | |
6896 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) | |
6897 { | |
6898 /* 'encoding' differs from active codepage: convert menu item name | |
6899 * and use wide function */ | |
1752 | 6900 wn = enc_to_utf16(menu->name, NULL); |
7 | 6901 if (wn != NULL) |
6902 { | |
6903 n = InsertMenuW(parent->submenu_id, (UINT)idx, | |
6904 (menu_is_separator(menu->name) | |
6905 ? MF_SEPARATOR : MF_STRING) | MF_BYPOSITION, | |
6906 (UINT)menu->id, wn); | |
6907 vim_free(wn); | |
6908 if (n == 0 && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) | |
6909 /* Failed, try using non-wide function. */ | |
6910 wn = NULL; | |
6911 } | |
6912 } | |
6913 if (wn == NULL) | |
6914 #endif | |
6915 InsertMenu(parent->submenu_id, (UINT)idx, | |
6916 (menu_is_separator(menu->name) ? MF_SEPARATOR : MF_STRING) | |
6917 | MF_BYPOSITION, | |
6918 (UINT)menu->id, (LPCTSTR)menu->name); | |
6919 #ifdef FEAT_TEAROFF | |
6920 if (IsWindow(parent->tearoff_handle)) | |
6921 rebuild_tearoff(parent); | |
6922 #endif | |
6923 } | |
6924 } | |
6925 | |
6926 /* | |
6927 * Destroy the machine specific menu widget. | |
6928 */ | |
6929 void | |
6930 gui_mch_destroy_menu(vimmenu_T *menu) | |
6931 { | |
6932 #ifdef FEAT_TOOLBAR | |
6933 /* | |
6934 * is this a toolbar button? | |
6935 */ | |
6936 if (menu->submenu_id == (HMENU)-1) | |
6937 { | |
6938 int iButton; | |
6939 | |
6940 iButton = (int)SendMessage(s_toolbarhwnd, TB_COMMANDTOINDEX, | |
6941 (WPARAM)menu->id, 0); | |
6942 SendMessage(s_toolbarhwnd, TB_DELETEBUTTON, (WPARAM)iButton, 0); | |
6943 } | |
6944 else | |
6945 #endif | |
6946 { | |
6947 if (menu->parent != NULL | |
6948 && menu_is_popup(menu->parent->dname) | |
6949 && menu->parent->submenu_id != NULL) | |
6950 RemoveMenu(menu->parent->submenu_id, menu->id, MF_BYCOMMAND); | |
6951 else | |
6952 RemoveMenu(s_menuBar, menu->id, MF_BYCOMMAND); | |
6953 if (menu->submenu_id != NULL) | |
6954 DestroyMenu(menu->submenu_id); | |
6955 #ifdef FEAT_TEAROFF | |
6956 if (IsWindow(menu->tearoff_handle)) | |
6957 DestroyWindow(menu->tearoff_handle); | |
6958 if (menu->parent != NULL | |
6959 && menu->parent->children != NULL | |
6960 && IsWindow(menu->parent->tearoff_handle)) | |
6961 { | |
6962 /* This menu must not show up when rebuilding the tearoff window. */ | |
6963 menu->modes = 0; | |
6964 rebuild_tearoff(menu->parent); | |
6965 } | |
6966 #endif | |
6967 } | |
6968 } | |
6969 | |
6970 #ifdef FEAT_TEAROFF | |
6971 static void | |
6972 rebuild_tearoff(vimmenu_T *menu) | |
6973 { | |
6974 /*hackish*/ | |
6975 char_u tbuf[128]; | |
6976 RECT trect; | |
6977 RECT rct; | |
6978 RECT roct; | |
6979 int x, y; | |
6980 | |
6981 HWND thwnd = menu->tearoff_handle; | |
6982 | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
6983 GetWindowText(thwnd, (LPSTR)tbuf, 127); |
7 | 6984 if (GetWindowRect(thwnd, &trect) |
6985 && GetWindowRect(s_hwnd, &rct) | |
6986 && GetClientRect(s_hwnd, &roct)) | |
6987 { | |
6988 x = trect.left - rct.left; | |
6989 y = (trect.top - rct.bottom + roct.bottom); | |
6990 } | |
6991 else | |
6992 { | |
6993 x = y = 0xffffL; | |
6994 } | |
6995 DestroyWindow(thwnd); | |
6996 if (menu->children != NULL) | |
6997 { | |
6998 gui_mch_tearoff(tbuf, menu, x, y); | |
6999 if (IsWindow(menu->tearoff_handle)) | |
7000 (void) SetWindowPos(menu->tearoff_handle, | |
7001 NULL, | |
7002 (int)trect.left, | |
7003 (int)trect.top, | |
7004 0, 0, | |
7005 SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); | |
7006 } | |
7007 } | |
7008 #endif /* FEAT_TEAROFF */ | |
7009 | |
7010 /* | |
7011 * Make a menu either grey or not grey. | |
7012 */ | |
7013 void | |
7014 gui_mch_menu_grey( | |
7015 vimmenu_T *menu, | |
7016 int grey) | |
7017 { | |
7018 #ifdef FEAT_TOOLBAR | |
7019 /* | |
7020 * is this a toolbar button? | |
7021 */ | |
7022 if (menu->submenu_id == (HMENU)-1) | |
7023 { | |
7024 SendMessage(s_toolbarhwnd, TB_ENABLEBUTTON, | |
7025 (WPARAM)menu->id, (LPARAM) MAKELONG((grey ? FALSE : TRUE), 0) ); | |
7026 } | |
7027 else | |
7028 #endif | |
9236
9940e9b2a725
commit https://github.com/vim/vim/commit/762f1754370a1278167c8cba6c047ef319fc099c
Christian Brabandt <cb@256bit.org>
parents:
9213
diff
changeset
|
7029 (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
|
7030 menu->id, MF_BYCOMMAND | (grey ? MF_GRAYED : MF_ENABLED)); |
7 | 7031 |
7032 #ifdef FEAT_TEAROFF | |
7033 if ((menu->parent != NULL) && (IsWindow(menu->parent->tearoff_handle))) | |
7034 { | |
7035 WORD menuID; | |
7036 HWND menuHandle; | |
7037 | |
7038 /* | |
7039 * A tearoff button has changed state. | |
7040 */ | |
7041 if (menu->children == NULL) | |
7042 menuID = (WORD)(menu->id); | |
7043 else | |
840 | 7044 menuID = (WORD)((long_u)(menu->submenu_id) | (DWORD)0x8000); |
7 | 7045 menuHandle = GetDlgItem(menu->parent->tearoff_handle, menuID); |
7046 if (menuHandle) | |
7047 EnableWindow(menuHandle, !grey); | |
7048 | |
7049 } | |
7050 #endif | |
7051 } | |
7052 | |
7053 #endif /* FEAT_MENU */ | |
7054 | |
7055 | |
7056 /* define some macros used to make the dialogue creation more readable */ | |
7057 | |
7058 #define add_string(s) strcpy((LPSTR)p, s); (LPSTR)p += (strlen((LPSTR)p) + 1) | |
7059 #define add_word(x) *p++ = (x) | |
615 | 7060 #define add_long(x) dwp = (DWORD *)p; *dwp++ = (x); p = (WORD *)dwp |
7 | 7061 |
7062 #if defined(FEAT_GUI_DIALOG) || defined(PROTO) | |
7063 /* | |
7064 * stuff for dialogs | |
7065 */ | |
7066 | |
7067 /* | |
7068 * The callback routine used by all the dialogs. Very simple. First, | |
7069 * acknowledges the INITDIALOG message so that Windows knows to do standard | |
7070 * dialog stuff (Return = default, Esc = cancel....) Second, if a button is | |
7071 * pressed, return that button's ID - IDCANCEL (2), which is the button's | |
7072 * number. | |
7073 */ | |
323 | 7074 /*ARGSUSED*/ |
7 | 7075 static LRESULT CALLBACK |
7076 dialog_callback( | |
7077 HWND hwnd, | |
7078 UINT message, | |
7079 WPARAM wParam, | |
7080 LPARAM lParam) | |
7081 { | |
7082 if (message == WM_INITDIALOG) | |
7083 { | |
7084 CenterWindow(hwnd, GetWindow(hwnd, GW_OWNER)); | |
7085 /* Set focus to the dialog. Set the default button, if specified. */ | |
7086 (void)SetFocus(hwnd); | |
7087 if (dialog_default_button > IDCANCEL) | |
7088 (void)SetFocus(GetDlgItem(hwnd, dialog_default_button)); | |
1356 | 7089 else |
7090 /* We don't have a default, set focus on another element of the | |
7091 * dialog window, probably the icon */ | |
7092 (void)SetFocus(GetDlgItem(hwnd, DLG_NONBUTTON_CONTROL)); | |
7 | 7093 return FALSE; |
7094 } | |
7095 | |
7096 if (message == WM_COMMAND) | |
7097 { | |
7098 int button = LOWORD(wParam); | |
7099 | |
7100 /* Don't end the dialog if something was selected that was | |
7101 * not a button. | |
7102 */ | |
7103 if (button >= DLG_NONBUTTON_CONTROL) | |
7104 return TRUE; | |
7105 | |
7106 /* If the edit box exists, copy the string. */ | |
7107 if (s_textfield != NULL) | |
1795 | 7108 { |
7109 # if defined(FEAT_MBYTE) && defined(WIN3264) | |
7110 /* If the OS is Windows NT, and 'encoding' differs from active | |
7111 * codepage: use wide function and convert text. */ | |
7112 if (os_version.dwPlatformId == VER_PLATFORM_WIN32_NT | |
7113 && enc_codepage >= 0 && (int)GetACP() != enc_codepage) | |
2311
ccda151dde4e
Support completion for ":find". (Nazri Ramliy)
Bram Moolenaar <bram@vim.org>
parents:
2224
diff
changeset
|
7114 { |
1795 | 7115 WCHAR *wp = (WCHAR *)alloc(IOSIZE * sizeof(WCHAR)); |
7116 char_u *p; | |
7117 | |
7118 GetDlgItemTextW(hwnd, DLG_NONBUTTON_CONTROL + 2, wp, IOSIZE); | |
7119 p = utf16_to_enc(wp, NULL); | |
7120 vim_strncpy(s_textfield, p, IOSIZE); | |
7121 vim_free(p); | |
7122 vim_free(wp); | |
7123 } | |
7124 else | |
7125 # endif | |
7126 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
|
7127 (LPSTR)s_textfield, IOSIZE); |
1795 | 7128 } |
7 | 7129 |
7130 /* | |
7131 * Need to check for IDOK because if the user just hits Return to | |
7132 * accept the default value, some reason this is what we get. | |
7133 */ | |
7134 if (button == IDOK) | |
7135 { | |
7136 if (dialog_default_button > IDCANCEL) | |
7137 EndDialog(hwnd, dialog_default_button); | |
7138 } | |
7139 else | |
7140 EndDialog(hwnd, button - IDCANCEL); | |
7141 return TRUE; | |
7142 } | |
7143 | |
7144 if ((message == WM_SYSCOMMAND) && (wParam == SC_CLOSE)) | |
7145 { | |
7146 EndDialog(hwnd, 0); | |
7147 return TRUE; | |
7148 } | |
7149 return FALSE; | |
7150 } | |
7151 | |
7152 /* | |
7153 * Create a dialog dynamically from the parameter strings. | |
7154 * type = type of dialog (question, alert, etc.) | |
7155 * title = dialog title. may be NULL for default title. | |
7156 * message = text to display. Dialog sizes to accommodate it. | |
7157 * buttons = '\n' separated list of button captions, default first. | |
7158 * dfltbutton = number of default button. | |
7159 * | |
7160 * This routine returns 1 if the first button is pressed, | |
7161 * 2 for the second, etc. | |
7162 * | |
7163 * 0 indicates Esc was pressed. | |
7164 * -1 for unexpected error | |
7165 * | |
7166 * If stubbing out this fn, return 1. | |
7167 */ | |
7168 | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
7169 static const char *dlg_icons[] = /* must match names in resource file */ |
7 | 7170 { |
7171 "IDR_VIM", | |
7172 "IDR_VIM_ERROR", | |
7173 "IDR_VIM_ALERT", | |
7174 "IDR_VIM_INFO", | |
7175 "IDR_VIM_QUESTION" | |
7176 }; | |
7177 | |
7178 int | |
7179 gui_mch_dialog( | |
7180 int type, | |
7181 char_u *title, | |
7182 char_u *message, | |
7183 char_u *buttons, | |
7184 int dfltbutton, | |
2684 | 7185 char_u *textfield, |
7186 int ex_cmd) | |
7 | 7187 { |
7188 WORD *p, *pdlgtemplate, *pnumitems; | |
615 | 7189 DWORD *dwp; |
7 | 7190 int numButtons; |
7191 int *buttonWidths, *buttonPositions; | |
7192 int buttonYpos; | |
7193 int nchar, i; | |
7194 DWORD lStyle; | |
7195 int dlgwidth = 0; | |
7196 int dlgheight; | |
7197 int editboxheight; | |
7198 int horizWidth = 0; | |
7199 int msgheight; | |
7200 char_u *pstart; | |
7201 char_u *pend; | |
158 | 7202 char_u *last_white; |
7 | 7203 char_u *tbuffer; |
7204 RECT rect; | |
7205 HWND hwnd; | |
7206 HDC hdc; | |
7207 HFONT font, oldFont; | |
7208 TEXTMETRIC fontInfo; | |
7209 int fontHeight; | |
7210 int textWidth, minButtonWidth, messageWidth; | |
7211 int maxDialogWidth; | |
153 | 7212 int maxDialogHeight; |
7213 int scroll_flag = 0; | |
7 | 7214 int vertical; |
7215 int dlgPaddingX; | |
7216 int dlgPaddingY; | |
7217 #ifdef USE_SYSMENU_FONT | |
7218 LOGFONT lfSysmenu; | |
7219 int use_lfSysmenu = FALSE; | |
7220 #endif | |
158 | 7221 garray_T ga; |
7222 int l; | |
7 | 7223 |
7224 #ifndef NO_CONSOLE | |
7225 /* Don't output anything in silent mode ("ex -s") */ | |
7226 if (silent_mode) | |
7227 return dfltbutton; /* return default option */ | |
7228 #endif | |
7229 | |
153 | 7230 if (s_hwnd == NULL) |
7231 get_dialog_font_metrics(); | |
7 | 7232 |
7233 if ((type < 0) || (type > VIM_LAST_TYPE)) | |
7234 type = 0; | |
7235 | |
7236 /* allocate some memory for dialog template */ | |
39 | 7237 /* TODO should compute this really */ |
158 | 7238 pdlgtemplate = p = (PWORD)LocalAlloc(LPTR, |
840 | 7239 DLG_ALLOC_SIZE + STRLEN(message) * 2); |
7 | 7240 |
7241 if (p == NULL) | |
7242 return -1; | |
7243 | |
7244 /* | |
4352 | 7245 * make a copy of 'buttons' to fiddle with it. compiler grizzles because |
7 | 7246 * vim_strsave() doesn't take a const arg (why not?), so cast away the |
7247 * const. | |
7248 */ | |
7249 tbuffer = vim_strsave(buttons); | |
7250 if (tbuffer == NULL) | |
7251 return -1; | |
7252 | |
7253 --dfltbutton; /* Change from one-based to zero-based */ | |
7254 | |
7255 /* Count buttons */ | |
7256 numButtons = 1; | |
7257 for (i = 0; tbuffer[i] != '\0'; i++) | |
7258 { | |
7259 if (tbuffer[i] == DLG_BUTTON_SEP) | |
7260 numButtons++; | |
7261 } | |
7262 if (dfltbutton >= numButtons) | |
7263 dfltbutton = -1; | |
7264 | |
7265 /* Allocate array to hold the width of each button */ | |
537 | 7266 buttonWidths = (int *)lalloc(numButtons * sizeof(int), TRUE); |
7 | 7267 if (buttonWidths == NULL) |
7268 return -1; | |
7269 | |
7270 /* Allocate array to hold the X position of each button */ | |
537 | 7271 buttonPositions = (int *)lalloc(numButtons * sizeof(int), TRUE); |
7 | 7272 if (buttonPositions == NULL) |
7273 return -1; | |
7274 | |
7275 /* | |
7276 * Calculate how big the dialog must be. | |
7277 */ | |
7278 hwnd = GetDesktopWindow(); | |
7279 hdc = GetWindowDC(hwnd); | |
7280 #ifdef USE_SYSMENU_FONT | |
7281 if (gui_w32_get_menu_font(&lfSysmenu) == OK) | |
7282 { | |
7283 font = CreateFontIndirect(&lfSysmenu); | |
7284 use_lfSysmenu = TRUE; | |
7285 } | |
7286 else | |
7287 #endif | |
7288 font = CreateFont(-DLG_FONT_POINT_SIZE, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
7289 VARIABLE_PITCH , DLG_FONT_NAME); | |
7290 if (s_usenewlook) | |
7291 { | |
7292 oldFont = SelectFont(hdc, font); | |
7293 dlgPaddingX = DLG_PADDING_X; | |
7294 dlgPaddingY = DLG_PADDING_Y; | |
7295 } | |
7296 else | |
7297 { | |
7298 oldFont = SelectFont(hdc, GetStockObject(SYSTEM_FONT)); | |
7299 dlgPaddingX = DLG_OLD_STYLE_PADDING_X; | |
7300 dlgPaddingY = DLG_OLD_STYLE_PADDING_Y; | |
7301 } | |
7302 GetTextMetrics(hdc, &fontInfo); | |
7303 fontHeight = fontInfo.tmHeight; | |
7304 | |
7305 /* Minimum width for horizontal button */ | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
7306 minButtonWidth = GetTextWidth(hdc, (char_u *)"Cancel", 6); |
7 | 7307 |
7308 /* Maximum width of a dialog, if possible */ | |
158 | 7309 if (s_hwnd == NULL) |
7310 { | |
7311 RECT workarea_rect; | |
7312 | |
636 | 7313 /* We don't have a window, use the desktop area. */ |
158 | 7314 get_work_area(&workarea_rect); |
7315 maxDialogWidth = workarea_rect.right - workarea_rect.left - 100; | |
7316 if (maxDialogWidth > 600) | |
7317 maxDialogWidth = 600; | |
5249
47a09a572ea6
updated for version 7.4b.001
Bram Moolenaar <bram@vim.org>
parents:
5225
diff
changeset
|
7318 /* Leave some room for the taskbar. */ |
47a09a572ea6
updated for version 7.4b.001
Bram Moolenaar <bram@vim.org>
parents:
5225
diff
changeset
|
7319 maxDialogHeight = workarea_rect.bottom - workarea_rect.top - 150; |
158 | 7320 } |
7321 else | |
7322 { | |
5284
7ed1ec814daf
updated for version 7.4b.018
Bram Moolenaar <bram@vim.org>
parents:
5249
diff
changeset
|
7323 /* 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
|
7324 GetWindowRect(s_hwnd, &rect); |
158 | 7325 maxDialogWidth = rect.right - rect.left |
5225
8f983df0299f
updated for version 7.4a.038
Bram Moolenaar <bram@vim.org>
parents:
5223
diff
changeset
|
7326 - (GetSystemMetrics(SM_CXFRAME) + |
6110 | 7327 GetSystemMetrics(SM_CXPADDEDBORDER)) * 2; |
158 | 7328 if (maxDialogWidth < DLG_MIN_MAX_WIDTH) |
7329 maxDialogWidth = DLG_MIN_MAX_WIDTH; | |
7330 | |
7331 maxDialogHeight = rect.bottom - rect.top | |
5249
47a09a572ea6
updated for version 7.4b.001
Bram Moolenaar <bram@vim.org>
parents:
5225
diff
changeset
|
7332 - (GetSystemMetrics(SM_CYFRAME) + |
6110 | 7333 GetSystemMetrics(SM_CXPADDEDBORDER)) * 4 |
5284
7ed1ec814daf
updated for version 7.4b.018
Bram Moolenaar <bram@vim.org>
parents:
5249
diff
changeset
|
7334 - GetSystemMetrics(SM_CYCAPTION); |
158 | 7335 if (maxDialogHeight < DLG_MIN_MAX_HEIGHT) |
7336 maxDialogHeight = DLG_MIN_MAX_HEIGHT; | |
7337 } | |
7338 | |
7339 /* Set dlgwidth to width of message. | |
7340 * Copy the message into "ga", changing NL to CR-NL and inserting line | |
7341 * breaks where needed. */ | |
7 | 7342 pstart = message; |
7343 messageWidth = 0; | |
158 | 7344 msgheight = 0; |
7345 ga_init2(&ga, sizeof(char), 500); | |
7 | 7346 do |
7347 { | |
158 | 7348 msgheight += fontHeight; /* at least one line */ |
7349 | |
7350 /* Need to figure out where to break the string. The system does it | |
7351 * at a word boundary, which would mean we can't compute the number of | |
7352 * wrapped lines. */ | |
7353 textWidth = 0; | |
7354 last_white = NULL; | |
7355 for (pend = pstart; *pend != NUL && *pend != '\n'; ) | |
153 | 7356 { |
158 | 7357 #ifdef FEAT_MBYTE |
474 | 7358 l = (*mb_ptr2len)(pend); |
158 | 7359 #else |
7360 l = 1; | |
7361 #endif | |
7362 if (l == 1 && vim_iswhite(*pend) | |
7363 && textWidth > maxDialogWidth * 3 / 4) | |
7364 last_white = pend; | |
4999
b4a71dbdb787
updated for version 7.3.1244
Bram Moolenaar <bram@vim.org>
parents:
4352
diff
changeset
|
7365 textWidth += GetTextWidthEnc(hdc, pend, l); |
158 | 7366 if (textWidth >= maxDialogWidth) |
153 | 7367 { |
158 | 7368 /* Line will wrap. */ |
7369 messageWidth = maxDialogWidth; | |
153 | 7370 msgheight += fontHeight; |
158 | 7371 textWidth = 0; |
7372 | |
7373 if (last_white != NULL) | |
7374 { | |
7375 /* break the line just after a space */ | |
835 | 7376 ga.ga_len -= (int)(pend - (last_white + 1)); |
158 | 7377 pend = last_white + 1; |
7378 last_white = NULL; | |
7379 } | |
7380 ga_append(&ga, '\r'); | |
7381 ga_append(&ga, '\n'); | |
7382 continue; | |
153 | 7383 } |
158 | 7384 |
7385 while (--l >= 0) | |
7386 ga_append(&ga, *pend++); | |
153 | 7387 } |
158 | 7388 if (textWidth > messageWidth) |
7 | 7389 messageWidth = textWidth; |
158 | 7390 |
7391 ga_append(&ga, '\r'); | |
7392 ga_append(&ga, '\n'); | |
7 | 7393 pstart = pend + 1; |
7394 } while (*pend != NUL); | |
153 | 7395 |
158 | 7396 if (ga.ga_data != NULL) |
7397 message = ga.ga_data; | |
7398 | |
153 | 7399 messageWidth += 10; /* roundoff space */ |
7400 | |
7 | 7401 /* 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
|
7402 dlgwidth = messageWidth + DLG_ICON_WIDTH + 3 * dlgPaddingX |
7ed1ec814daf
updated for version 7.4b.018
Bram Moolenaar <bram@vim.org>
parents:
5249
diff
changeset
|
7403 + GetSystemMetrics(SM_CXVSCROLL); |
7 | 7404 |
7405 if (msgheight < DLG_ICON_HEIGHT) | |
7406 msgheight = DLG_ICON_HEIGHT; | |
7407 | |
7408 /* | |
7409 * Check button names. A long one will make the dialog wider. | |
1116 | 7410 * When called early (-register error message) p_go isn't initialized. |
7 | 7411 */ |
1116 | 7412 vertical = (p_go != NULL && vim_strchr(p_go, GO_VERTICAL) != NULL); |
7 | 7413 if (!vertical) |
7414 { | |
7415 // Place buttons horizontally if they fit. | |
7416 horizWidth = dlgPaddingX; | |
7417 pstart = tbuffer; | |
7418 i = 0; | |
7419 do | |
7420 { | |
7421 pend = vim_strchr(pstart, DLG_BUTTON_SEP); | |
7422 if (pend == NULL) | |
7423 pend = pstart + STRLEN(pstart); // Last button name. | |
5001
43329b2b5b79
updated for version 7.3.1245
Bram Moolenaar <bram@vim.org>
parents:
4999
diff
changeset
|
7424 textWidth = GetTextWidthEnc(hdc, pstart, (int)(pend - pstart)); |
7 | 7425 if (textWidth < minButtonWidth) |
7426 textWidth = minButtonWidth; | |
7427 textWidth += dlgPaddingX; /* Padding within button */ | |
7428 buttonWidths[i] = textWidth; | |
7429 buttonPositions[i++] = horizWidth; | |
7430 horizWidth += textWidth + dlgPaddingX; /* Pad between buttons */ | |
7431 pstart = pend + 1; | |
7432 } while (*pend != NUL); | |
7433 | |
7434 if (horizWidth > maxDialogWidth) | |
7435 vertical = TRUE; // Too wide to fit on the screen. | |
7436 else if (horizWidth > dlgwidth) | |
7437 dlgwidth = horizWidth; | |
7438 } | |
7439 | |
7440 if (vertical) | |
7441 { | |
7442 // Stack buttons vertically. | |
7443 pstart = tbuffer; | |
7444 do | |
7445 { | |
7446 pend = vim_strchr(pstart, DLG_BUTTON_SEP); | |
7447 if (pend == NULL) | |
7448 pend = pstart + STRLEN(pstart); // Last button name. | |
5001
43329b2b5b79
updated for version 7.3.1245
Bram Moolenaar <bram@vim.org>
parents:
4999
diff
changeset
|
7449 textWidth = GetTextWidthEnc(hdc, pstart, (int)(pend - pstart)); |
7 | 7450 textWidth += dlgPaddingX; /* Padding within button */ |
7451 textWidth += DLG_VERT_PADDING_X * 2; /* Padding around button */ | |
7452 if (textWidth > dlgwidth) | |
7453 dlgwidth = textWidth; | |
7454 pstart = pend + 1; | |
7455 } while (*pend != NUL); | |
7456 } | |
7457 | |
7458 if (dlgwidth < DLG_MIN_WIDTH) | |
7459 dlgwidth = DLG_MIN_WIDTH; /* Don't allow a really thin dialog!*/ | |
7460 | |
7461 /* start to fill in the dlgtemplate information. addressing by WORDs */ | |
7462 if (s_usenewlook) | |
7463 lStyle = DS_MODALFRAME | WS_CAPTION |DS_3DLOOK| WS_VISIBLE |DS_SETFONT; | |
7464 else | |
7465 lStyle = DS_MODALFRAME | WS_CAPTION |DS_3DLOOK| WS_VISIBLE; | |
7466 | |
7467 add_long(lStyle); | |
7468 add_long(0); // (lExtendedStyle) | |
7469 pnumitems = p; /*save where the number of items must be stored*/ | |
7470 add_word(0); // NumberOfItems(will change later) | |
7471 add_word(10); // x | |
7472 add_word(10); // y | |
7473 add_word(PixelToDialogX(dlgwidth)); // cx | |
7474 | |
7475 // Dialog height. | |
7476 if (vertical) | |
5284
7ed1ec814daf
updated for version 7.4b.018
Bram Moolenaar <bram@vim.org>
parents:
5249
diff
changeset
|
7477 dlgheight = msgheight + 2 * dlgPaddingY |
7ed1ec814daf
updated for version 7.4b.018
Bram Moolenaar <bram@vim.org>
parents:
5249
diff
changeset
|
7478 + DLG_VERT_PADDING_Y + 2 * fontHeight * numButtons; |
7 | 7479 else |
7480 dlgheight = msgheight + 3 * dlgPaddingY + 2 * fontHeight; | |
7481 | |
7482 // Dialog needs to be taller if contains an edit box. | |
7483 editboxheight = fontHeight + dlgPaddingY + 4 * DLG_VERT_PADDING_Y; | |
7484 if (textfield != NULL) | |
7485 dlgheight += editboxheight; | |
7486 | |
5284
7ed1ec814daf
updated for version 7.4b.018
Bram Moolenaar <bram@vim.org>
parents:
5249
diff
changeset
|
7487 /* 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
|
7488 if (dlgheight > maxDialogHeight) |
7ed1ec814daf
updated for version 7.4b.018
Bram Moolenaar <bram@vim.org>
parents:
5249
diff
changeset
|
7489 { |
6110 | 7490 msgheight = msgheight - (dlgheight - maxDialogHeight); |
7491 dlgheight = maxDialogHeight; | |
7492 scroll_flag = WS_VSCROLL; | |
7493 /* Make sure scrollbar doesn't appear in the middle of the dialog */ | |
7494 messageWidth = dlgwidth - DLG_ICON_WIDTH - 3 * dlgPaddingX; | |
5284
7ed1ec814daf
updated for version 7.4b.018
Bram Moolenaar <bram@vim.org>
parents:
5249
diff
changeset
|
7495 } |
7ed1ec814daf
updated for version 7.4b.018
Bram Moolenaar <bram@vim.org>
parents:
5249
diff
changeset
|
7496 |
7 | 7497 add_word(PixelToDialogY(dlgheight)); |
7498 | |
7499 add_word(0); // Menu | |
7500 add_word(0); // Class | |
7501 | |
7502 /* copy the title of the dialog */ | |
7503 nchar = nCopyAnsiToWideChar(p, (title ? | |
7504 (LPSTR)title : | |
7505 (LPSTR)("Vim "VIM_VERSION_MEDIUM))); | |
7506 p += nchar; | |
7507 | |
7508 if (s_usenewlook) | |
7509 { | |
7510 /* do the font, since DS_3DLOOK doesn't work properly */ | |
7511 #ifdef USE_SYSMENU_FONT | |
7512 if (use_lfSysmenu) | |
7513 { | |
7514 /* point size */ | |
7515 *p++ = -MulDiv(lfSysmenu.lfHeight, 72, | |
7516 GetDeviceCaps(hdc, LOGPIXELSY)); | |
7517 nchar = nCopyAnsiToWideChar(p, TEXT(lfSysmenu.lfFaceName)); | |
7518 } | |
7519 else | |
7520 #endif | |
7521 { | |
7522 *p++ = DLG_FONT_POINT_SIZE; // point size | |
7523 nchar = nCopyAnsiToWideChar(p, TEXT(DLG_FONT_NAME)); | |
7524 } | |
7525 p += nchar; | |
7526 } | |
7527 | |
7528 buttonYpos = msgheight + 2 * dlgPaddingY; | |
7529 | |
7530 if (textfield != NULL) | |
7531 buttonYpos += editboxheight; | |
7532 | |
7533 pstart = tbuffer; | |
7534 if (!vertical) | |
7535 horizWidth = (dlgwidth - horizWidth) / 2; /* Now it's X offset */ | |
7536 for (i = 0; i < numButtons; i++) | |
7537 { | |
7538 /* get end of this button. */ | |
7539 for ( pend = pstart; | |
7540 *pend && (*pend != DLG_BUTTON_SEP); | |
7541 pend++) | |
7542 ; | |
7543 | |
7544 if (*pend) | |
7545 *pend = '\0'; | |
7546 | |
7547 /* | |
7548 * old NOTE: | |
7549 * setting the BS_DEFPUSHBUTTON style doesn't work because Windows sets | |
7550 * the focus to the first tab-able button and in so doing makes that | |
7551 * the default!! Grrr. Workaround: Make the default button the only | |
7552 * one with WS_TABSTOP style. Means user can't tab between buttons, but | |
7553 * he/she can use arrow keys. | |
7554 * | |
7555 * new NOTE: BS_DEFPUSHBUTTON is required to be able to select the | |
1213 | 7556 * right button when hitting <Enter>. E.g., for the ":confirm quit" |
7 | 7557 * dialog. Also needed for when the textfield is the default control. |
7558 * It appears to work now (perhaps not on Win95?). | |
7559 */ | |
7560 if (vertical) | |
7561 { | |
7562 p = add_dialog_element(p, | |
7563 (i == dfltbutton | |
7564 ? BS_DEFPUSHBUTTON : BS_PUSHBUTTON) | WS_TABSTOP, | |
7565 PixelToDialogX(DLG_VERT_PADDING_X), | |
7566 PixelToDialogY(buttonYpos /* TBK */ | |
7567 + 2 * fontHeight * i), | |
7568 PixelToDialogX(dlgwidth - 2 * DLG_VERT_PADDING_X), | |
7569 (WORD)(PixelToDialogY(2 * fontHeight) - 1), | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
7570 (WORD)(IDCANCEL + 1 + i), (WORD)0x0080, (char *)pstart); |
7 | 7571 } |
7572 else | |
7573 { | |
7574 p = add_dialog_element(p, | |
7575 (i == dfltbutton | |
7576 ? BS_DEFPUSHBUTTON : BS_PUSHBUTTON) | WS_TABSTOP, | |
7577 PixelToDialogX(horizWidth + buttonPositions[i]), | |
7578 PixelToDialogY(buttonYpos), /* TBK */ | |
7579 PixelToDialogX(buttonWidths[i]), | |
7580 (WORD)(PixelToDialogY(2 * fontHeight) - 1), | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
7581 (WORD)(IDCANCEL + 1 + i), (WORD)0x0080, (char *)pstart); |
7 | 7582 } |
7583 pstart = pend + 1; /*next button*/ | |
7584 } | |
7585 *pnumitems += numButtons; | |
7586 | |
7587 /* Vim icon */ | |
7588 p = add_dialog_element(p, SS_ICON, | |
7589 PixelToDialogX(dlgPaddingX), | |
7590 PixelToDialogY(dlgPaddingY), | |
7591 PixelToDialogX(DLG_ICON_WIDTH), | |
7592 PixelToDialogY(DLG_ICON_HEIGHT), | |
7593 DLG_NONBUTTON_CONTROL + 0, (WORD)0x0082, | |
7594 dlg_icons[type]); | |
7595 | |
153 | 7596 /* Dialog message */ |
7597 p = add_dialog_element(p, ES_LEFT|scroll_flag|ES_MULTILINE|ES_READONLY, | |
7598 PixelToDialogX(2 * dlgPaddingX + DLG_ICON_WIDTH), | |
7599 PixelToDialogY(dlgPaddingY), | |
7600 (WORD)(PixelToDialogX(messageWidth) + 1), | |
7601 PixelToDialogY(msgheight), | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
7602 DLG_NONBUTTON_CONTROL + 1, (WORD)0x0081, (char *)message); |
7 | 7603 |
7604 /* Edit box */ | |
7605 if (textfield != NULL) | |
7606 { | |
7607 p = add_dialog_element(p, ES_LEFT|ES_AUTOHSCROLL|WS_TABSTOP|WS_BORDER, | |
7608 PixelToDialogX(2 * dlgPaddingX), | |
7609 PixelToDialogY(2 * dlgPaddingY + msgheight), | |
7610 PixelToDialogX(dlgwidth - 4 * dlgPaddingX), | |
7611 PixelToDialogY(fontHeight + dlgPaddingY), | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
7612 DLG_NONBUTTON_CONTROL + 2, (WORD)0x0081, (char *)textfield); |
7 | 7613 *pnumitems += 1; |
7614 } | |
7615 | |
7616 *pnumitems += 2; | |
7617 | |
7618 SelectFont(hdc, oldFont); | |
7619 DeleteObject(font); | |
7620 ReleaseDC(hwnd, hdc); | |
7621 | |
7622 /* Let the dialog_callback() function know which button to make default | |
7623 * If we have an edit box, make that the default. We also need to tell | |
7624 * dialog_callback() if this dialog contains an edit box or not. We do | |
7625 * this by setting s_textfield if it does. | |
7626 */ | |
7627 if (textfield != NULL) | |
7628 { | |
7629 dialog_default_button = DLG_NONBUTTON_CONTROL + 2; | |
7630 s_textfield = textfield; | |
7631 } | |
7632 else | |
7633 { | |
7634 dialog_default_button = IDCANCEL + 1 + dfltbutton; | |
7635 s_textfield = NULL; | |
7636 } | |
7637 | |
7638 /* show the dialog box modally and get a return value */ | |
7639 nchar = (int)DialogBoxIndirect( | |
7640 s_hinst, | |
7641 (LPDLGTEMPLATE)pdlgtemplate, | |
7642 s_hwnd, | |
7643 (DLGPROC)dialog_callback); | |
7644 | |
7645 LocalFree(LocalHandle(pdlgtemplate)); | |
7646 vim_free(tbuffer); | |
7647 vim_free(buttonWidths); | |
7648 vim_free(buttonPositions); | |
158 | 7649 vim_free(ga.ga_data); |
7 | 7650 |
7651 /* Focus back to our window (for when MDI is used). */ | |
7652 (void)SetFocus(s_hwnd); | |
7653 | |
7654 return nchar; | |
7655 } | |
7656 | |
7657 #endif /* FEAT_GUI_DIALOG */ | |
840 | 7658 |
7 | 7659 /* |
7660 * Put a simple element (basic class) onto a dialog template in memory. | |
7661 * return a pointer to where the next item should be added. | |
7662 * | |
7663 * parameters: | |
7664 * lStyle = additional style flags | |
7665 * (be careful, NT3.51 & Win32s will ignore the new ones) | |
7666 * x,y = x & y positions IN DIALOG UNITS | |
7667 * w,h = width and height IN DIALOG UNITS | |
7668 * Id = ID used in messages | |
7669 * clss = class ID, e.g 0x0080 for a button, 0x0082 for a static | |
7670 * caption = usually text or resource name | |
7671 * | |
7672 * TODO: use the length information noted here to enable the dialog creation | |
7673 * routines to work out more exactly how much memory they need to alloc. | |
7674 */ | |
7675 static PWORD | |
7676 add_dialog_element( | |
7677 PWORD p, | |
7678 DWORD lStyle, | |
7679 WORD x, | |
7680 WORD y, | |
7681 WORD w, | |
7682 WORD h, | |
7683 WORD Id, | |
7684 WORD clss, | |
7685 const char *caption) | |
7686 { | |
7687 int nchar; | |
7688 | |
7689 p = lpwAlign(p); /* Align to dword boundary*/ | |
7690 lStyle = lStyle | WS_VISIBLE | WS_CHILD; | |
7691 *p++ = LOWORD(lStyle); | |
7692 *p++ = HIWORD(lStyle); | |
7693 *p++ = 0; // LOWORD (lExtendedStyle) | |
7694 *p++ = 0; // HIWORD (lExtendedStyle) | |
7695 *p++ = x; | |
7696 *p++ = y; | |
7697 *p++ = w; | |
7698 *p++ = h; | |
7699 *p++ = Id; //9 or 10 words in all | |
7700 | |
7701 *p++ = (WORD)0xffff; | |
7702 *p++ = clss; //2 more here | |
7703 | |
7704 nchar = nCopyAnsiToWideChar(p, (LPSTR)caption); //strlen(caption)+1 | |
7705 p += nchar; | |
7706 | |
7707 *p++ = 0; // advance pointer over nExtraStuff WORD - 2 more | |
7708 | |
7709 return p; //total = 15+ (strlen(caption)) words | |
7710 // = 30 + 2(strlen(caption) bytes reqd | |
7711 } | |
7712 | |
7713 | |
7714 /* | |
7715 * Helper routine. Take an input pointer, return closest pointer that is | |
7716 * aligned on a DWORD (4 byte) boundary. Taken from the Win32SDK samples. | |
7717 */ | |
7718 static LPWORD | |
7719 lpwAlign( | |
7720 LPWORD lpIn) | |
7721 { | |
840 | 7722 long_u ul; |
7723 | |
7724 ul = (long_u)lpIn; | |
7 | 7725 ul += 3; |
7726 ul >>= 2; | |
7727 ul <<= 2; | |
7728 return (LPWORD)ul; | |
7729 } | |
7730 | |
7731 /* | |
7732 * Helper routine. Takes second parameter as Ansi string, copies it to first | |
7733 * parameter as wide character (16-bits / char) string, and returns integer | |
7734 * number of wide characters (words) in string (including the trailing wide | |
7735 * char NULL). Partly taken from the Win32SDK samples. | |
7736 */ | |
7737 static int | |
7738 nCopyAnsiToWideChar( | |
7739 LPWORD lpWCStr, | |
7740 LPSTR lpAnsiIn) | |
7741 { | |
7742 int nChar = 0; | |
7743 #ifdef FEAT_MBYTE | |
7744 int len = lstrlen(lpAnsiIn) + 1; /* include NUL character */ | |
7745 int i; | |
7746 WCHAR *wn; | |
7747 | |
7748 if (enc_codepage == 0 && (int)GetACP() != enc_codepage) | |
7749 { | |
7750 /* 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
|
7751 wn = enc_to_utf16((char_u *)lpAnsiIn, NULL); |
7 | 7752 if (wn != NULL) |
7753 { | |
7754 wcscpy(lpWCStr, wn); | |
835 | 7755 nChar = (int)wcslen(wn) + 1; |
7 | 7756 vim_free(wn); |
7757 } | |
7758 } | |
7759 if (nChar == 0) | |
7760 /* Use Win32 conversion function. */ | |
7761 nChar = MultiByteToWideChar( | |
7762 enc_codepage > 0 ? enc_codepage : CP_ACP, | |
7763 MB_PRECOMPOSED, | |
7764 lpAnsiIn, len, | |
7765 lpWCStr, len); | |
7766 for (i = 0; i < nChar; ++i) | |
7767 if (lpWCStr[i] == (WORD)'\t') /* replace tabs with spaces */ | |
7768 lpWCStr[i] = (WORD)' '; | |
7769 #else | |
7770 do | |
7771 { | |
7772 if (*lpAnsiIn == '\t') | |
7773 *lpWCStr++ = (WORD)' '; | |
7774 else | |
7775 *lpWCStr++ = (WORD)*lpAnsiIn; | |
7776 nChar++; | |
7777 } while (*lpAnsiIn++); | |
7778 #endif | |
7779 | |
7780 return nChar; | |
7781 } | |
7782 | |
7783 | |
7784 #ifdef FEAT_TEAROFF | |
7785 /* | |
7786 * The callback function for all the modeless dialogs that make up the | |
7787 * "tearoff menus" Very simple - forward button presses (to fool Vim into | |
7788 * thinking its menus have been clicked), and go away when closed. | |
7789 */ | |
7790 static LRESULT CALLBACK | |
7791 tearoff_callback( | |
7792 HWND hwnd, | |
7793 UINT message, | |
7794 WPARAM wParam, | |
7795 LPARAM lParam) | |
7796 { | |
7797 if (message == WM_INITDIALOG) | |
7798 return (TRUE); | |
7799 | |
7800 /* May show the mouse pointer again. */ | |
7801 HandleMouseHide(message, lParam); | |
7802 | |
7803 if (message == WM_COMMAND) | |
7804 { | |
7805 if ((WORD)(LOWORD(wParam)) & 0x8000) | |
7806 { | |
7807 POINT mp; | |
7808 RECT rect; | |
7809 | |
7810 if (GetCursorPos(&mp) && GetWindowRect(hwnd, &rect)) | |
7811 { | |
7812 (void)TrackPopupMenu( | |
840 | 7813 (HMENU)(long_u)(LOWORD(wParam) ^ 0x8000), |
7 | 7814 TPM_LEFTALIGN | TPM_LEFTBUTTON, |
7815 (int)rect.right - 8, | |
7816 (int)mp.y, | |
7817 (int)0, /*reserved param*/ | |
7818 s_hwnd, | |
7819 NULL); | |
7820 /* | |
7821 * NOTE: The pop-up menu can eat the mouse up event. | |
7822 * We deal with this in normal.c. | |
7823 */ | |
7824 } | |
7825 } | |
7826 else | |
7827 /* Pass on messages to the main Vim window */ | |
7828 PostMessage(s_hwnd, WM_COMMAND, LOWORD(wParam), 0); | |
7829 /* | |
7830 * Give main window the focus back: this is so after | |
7831 * choosing a tearoff button you can start typing again | |
7832 * straight away. | |
7833 */ | |
7834 (void)SetFocus(s_hwnd); | |
7835 return TRUE; | |
7836 } | |
7837 if ((message == WM_SYSCOMMAND) && (wParam == SC_CLOSE)) | |
7838 { | |
7839 DestroyWindow(hwnd); | |
7840 return TRUE; | |
7841 } | |
7842 | |
7843 /* When moved around, give main window the focus back. */ | |
7844 if (message == WM_EXITSIZEMOVE) | |
7845 (void)SetActiveWindow(s_hwnd); | |
7846 | |
7847 return FALSE; | |
7848 } | |
7849 #endif | |
7850 | |
7851 | |
7852 /* | |
7853 * Decide whether to use the "new look" (small, non-bold font) or the "old | |
7854 * look" (big, clanky font) for dialogs, and work out a few values for use | |
7855 * later accordingly. | |
7856 */ | |
7857 static void | |
7858 get_dialog_font_metrics(void) | |
7859 { | |
7860 HDC hdc; | |
7861 HFONT hfontTools = 0; | |
7862 DWORD dlgFontSize; | |
7863 SIZE size; | |
7864 #ifdef USE_SYSMENU_FONT | |
7865 LOGFONT lfSysmenu; | |
7866 #endif | |
7867 | |
7868 s_usenewlook = FALSE; | |
7869 | |
7870 /* | |
7871 * For NT3.51 and Win32s, we stick with the old look | |
7872 * because it matches everything else. | |
7873 */ | |
7874 if (!is_winnt_3()) | |
7875 { | |
7876 #ifdef USE_SYSMENU_FONT | |
7877 if (gui_w32_get_menu_font(&lfSysmenu) == OK) | |
7878 hfontTools = CreateFontIndirect(&lfSysmenu); | |
7879 else | |
7880 #endif | |
7881 hfontTools = CreateFont(-DLG_FONT_POINT_SIZE, 0, 0, 0, 0, 0, 0, 0, | |
7882 0, 0, 0, 0, VARIABLE_PITCH , DLG_FONT_NAME); | |
7883 | |
7884 if (hfontTools) | |
7885 { | |
7886 hdc = GetDC(s_hwnd); | |
7887 SelectObject(hdc, hfontTools); | |
7888 /* | |
7889 * GetTextMetrics() doesn't return the right value in | |
7890 * tmAveCharWidth, so we have to figure out the dialog base units | |
7891 * ourselves. | |
7892 */ | |
7893 GetTextExtentPoint(hdc, | |
7894 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", | |
7895 52, &size); | |
7896 ReleaseDC(s_hwnd, hdc); | |
7897 | |
7898 s_dlgfntwidth = (WORD)((size.cx / 26 + 1) / 2); | |
7899 s_dlgfntheight = (WORD)size.cy; | |
7900 s_usenewlook = TRUE; | |
7901 } | |
7902 } | |
7903 | |
7904 if (!s_usenewlook) | |
7905 { | |
7906 dlgFontSize = GetDialogBaseUnits(); /* fall back to big old system*/ | |
7907 s_dlgfntwidth = LOWORD(dlgFontSize); | |
7908 s_dlgfntheight = HIWORD(dlgFontSize); | |
7909 } | |
7910 } | |
7911 | |
7912 #if defined(FEAT_MENU) && defined(FEAT_TEAROFF) | |
7913 /* | |
7914 * Create a pseudo-"tearoff menu" based on the child | |
7915 * items of a given menu pointer. | |
7916 */ | |
7917 static void | |
7918 gui_mch_tearoff( | |
7919 char_u *title, | |
7920 vimmenu_T *menu, | |
7921 int initX, | |
7922 int initY) | |
7923 { | |
7924 WORD *p, *pdlgtemplate, *pnumitems, *ptrueheight; | |
7925 int template_len; | |
7926 int nchar, textWidth, submenuWidth; | |
7927 DWORD lStyle; | |
7928 DWORD lExtendedStyle; | |
7929 WORD dlgwidth; | |
7930 WORD menuID; | |
7931 vimmenu_T *pmenu; | |
7932 vimmenu_T *the_menu = menu; | |
7933 HWND hwnd; | |
7934 HDC hdc; | |
7935 HFONT font, oldFont; | |
7936 int col, spaceWidth, len; | |
7937 int columnWidths[2]; | |
7938 char_u *label, *text; | |
7939 int acLen = 0; | |
7940 int nameLen; | |
7941 int padding0, padding1, padding2 = 0; | |
7942 int sepPadding=0; | |
87 | 7943 int x; |
7944 int y; | |
7 | 7945 #ifdef USE_SYSMENU_FONT |
7946 LOGFONT lfSysmenu; | |
7947 int use_lfSysmenu = FALSE; | |
7948 #endif | |
7949 | |
7950 /* | |
7951 * If this menu is already torn off, move it to the mouse position. | |
7952 */ | |
7953 if (IsWindow(menu->tearoff_handle)) | |
7954 { | |
7955 POINT mp; | |
7956 if (GetCursorPos((LPPOINT)&mp)) | |
7957 { | |
7958 SetWindowPos(menu->tearoff_handle, NULL, mp.x, mp.y, 0, 0, | |
7959 SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER); | |
7960 } | |
7961 return; | |
7962 } | |
7963 | |
7964 /* | |
7965 * Create a new tearoff. | |
7966 */ | |
7967 if (*title == MNU_HIDDEN_CHAR) | |
7968 title++; | |
7969 | |
7970 /* Allocate memory to store the dialog template. It's made bigger when | |
7971 * needed. */ | |
7972 template_len = DLG_ALLOC_SIZE; | |
7973 pdlgtemplate = p = (WORD *)LocalAlloc(LPTR, template_len); | |
7974 if (p == NULL) | |
7975 return; | |
7976 | |
7977 hwnd = GetDesktopWindow(); | |
7978 hdc = GetWindowDC(hwnd); | |
7979 #ifdef USE_SYSMENU_FONT | |
7980 if (gui_w32_get_menu_font(&lfSysmenu) == OK) | |
7981 { | |
7982 font = CreateFontIndirect(&lfSysmenu); | |
7983 use_lfSysmenu = TRUE; | |
7984 } | |
7985 else | |
7986 #endif | |
7987 font = CreateFont(-DLG_FONT_POINT_SIZE, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
7988 VARIABLE_PITCH , DLG_FONT_NAME); | |
7989 if (s_usenewlook) | |
7990 oldFont = SelectFont(hdc, font); | |
7991 else | |
7992 oldFont = SelectFont(hdc, GetStockObject(SYSTEM_FONT)); | |
7993 | |
7994 /* Calculate width of a single space. Used for padding columns to the | |
7995 * right width. */ | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
7996 spaceWidth = GetTextWidth(hdc, (char_u *)" ", 1); |
7 | 7997 |
7998 /* Figure out max width of the text column, the accelerator column and the | |
7999 * optional submenu column. */ | |
8000 submenuWidth = 0; | |
8001 for (col = 0; col < 2; col++) | |
8002 { | |
8003 columnWidths[col] = 0; | |
8004 for (pmenu = menu->children; pmenu != NULL; pmenu = pmenu->next) | |
8005 { | |
8006 /* Use "dname" here to compute the width of the visible text. */ | |
8007 text = (col == 0) ? pmenu->dname : pmenu->actext; | |
8008 if (text != NULL && *text != NUL) | |
8009 { | |
8010 textWidth = GetTextWidthEnc(hdc, text, (int)STRLEN(text)); | |
8011 if (textWidth > columnWidths[col]) | |
8012 columnWidths[col] = textWidth; | |
8013 } | |
8014 if (pmenu->children != NULL) | |
8015 submenuWidth = TEAROFF_COLUMN_PADDING * spaceWidth; | |
8016 } | |
8017 } | |
8018 if (columnWidths[1] == 0) | |
8019 { | |
8020 /* no accelerators */ | |
8021 if (submenuWidth != 0) | |
8022 columnWidths[0] += submenuWidth; | |
8023 else | |
8024 columnWidths[0] += spaceWidth; | |
8025 } | |
8026 else | |
8027 { | |
8028 /* there is an accelerator column */ | |
8029 columnWidths[0] += TEAROFF_COLUMN_PADDING * spaceWidth; | |
8030 columnWidths[1] += submenuWidth; | |
8031 } | |
8032 | |
8033 /* | |
8034 * Now find the total width of our 'menu'. | |
8035 */ | |
8036 textWidth = columnWidths[0] + columnWidths[1]; | |
8037 if (submenuWidth != 0) | |
8038 { | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
8039 submenuWidth = GetTextWidth(hdc, (char_u *)TEAROFF_SUBMENU_LABEL, |
7 | 8040 (int)STRLEN(TEAROFF_SUBMENU_LABEL)); |
8041 textWidth += submenuWidth; | |
8042 } | |
8043 dlgwidth = GetTextWidthEnc(hdc, title, (int)STRLEN(title)); | |
8044 if (textWidth > dlgwidth) | |
8045 dlgwidth = textWidth; | |
8046 dlgwidth += 2 * TEAROFF_PADDING_X + TEAROFF_BUTTON_PAD_X; | |
8047 | |
8048 /* W95 can't do thin dialogs, they look v. weird! */ | |
8049 if (mch_windows95() && dlgwidth < TEAROFF_MIN_WIDTH) | |
8050 dlgwidth = TEAROFF_MIN_WIDTH; | |
8051 | |
8052 /* start to fill in the dlgtemplate information. addressing by WORDs */ | |
8053 if (s_usenewlook) | |
8054 lStyle = DS_MODALFRAME | WS_CAPTION| WS_SYSMENU |DS_SETFONT| WS_VISIBLE; | |
8055 else | |
8056 lStyle = DS_MODALFRAME | WS_CAPTION| WS_SYSMENU | WS_VISIBLE; | |
8057 | |
8058 lExtendedStyle = WS_EX_TOOLWINDOW|WS_EX_STATICEDGE; | |
8059 *p++ = LOWORD(lStyle); | |
8060 *p++ = HIWORD(lStyle); | |
8061 *p++ = LOWORD(lExtendedStyle); | |
8062 *p++ = HIWORD(lExtendedStyle); | |
8063 pnumitems = p; /* save where the number of items must be stored */ | |
8064 *p++ = 0; // NumberOfItems(will change later) | |
87 | 8065 gui_mch_getmouse(&x, &y); |
7 | 8066 if (initX == 0xffffL) |
87 | 8067 *p++ = PixelToDialogX(x); // x |
7 | 8068 else |
8069 *p++ = PixelToDialogX(initX); // x | |
8070 if (initY == 0xffffL) | |
87 | 8071 *p++ = PixelToDialogY(y); // y |
7 | 8072 else |
8073 *p++ = PixelToDialogY(initY); // y | |
8074 *p++ = PixelToDialogX(dlgwidth); // cx | |
8075 ptrueheight = p; | |
8076 *p++ = 0; // dialog height: changed later anyway | |
8077 *p++ = 0; // Menu | |
8078 *p++ = 0; // Class | |
8079 | |
8080 /* copy the title of the dialog */ | |
8081 nchar = nCopyAnsiToWideChar(p, ((*title) | |
8082 ? (LPSTR)title | |
8083 : (LPSTR)("Vim "VIM_VERSION_MEDIUM))); | |
8084 p += nchar; | |
8085 | |
8086 if (s_usenewlook) | |
8087 { | |
8088 /* do the font, since DS_3DLOOK doesn't work properly */ | |
8089 #ifdef USE_SYSMENU_FONT | |
8090 if (use_lfSysmenu) | |
8091 { | |
8092 /* point size */ | |
8093 *p++ = -MulDiv(lfSysmenu.lfHeight, 72, | |
8094 GetDeviceCaps(hdc, LOGPIXELSY)); | |
8095 nchar = nCopyAnsiToWideChar(p, TEXT(lfSysmenu.lfFaceName)); | |
8096 } | |
8097 else | |
8098 #endif | |
8099 { | |
8100 *p++ = DLG_FONT_POINT_SIZE; // point size | |
8101 nchar = nCopyAnsiToWideChar (p, TEXT(DLG_FONT_NAME)); | |
8102 } | |
8103 p += nchar; | |
8104 } | |
8105 | |
8106 /* | |
8107 * Loop over all the items in the menu. | |
8108 * But skip over the tearbar. | |
8109 */ | |
8110 if (STRCMP(menu->children->name, TEAR_STRING) == 0) | |
8111 menu = menu->children->next; | |
8112 else | |
8113 menu = menu->children; | |
8114 for ( ; menu != NULL; menu = menu->next) | |
8115 { | |
8116 if (menu->modes == 0) /* this menu has just been deleted */ | |
8117 continue; | |
8118 if (menu_is_separator(menu->dname)) | |
8119 { | |
8120 sepPadding += 3; | |
8121 continue; | |
8122 } | |
8123 | |
8124 /* Check if there still is plenty of room in the template. Make it | |
8125 * larger when needed. */ | |
8126 if (((char *)p - (char *)pdlgtemplate) + 1000 > template_len) | |
8127 { | |
8128 WORD *newp; | |
8129 | |
8130 newp = (WORD *)LocalAlloc(LPTR, template_len + 4096); | |
8131 if (newp != NULL) | |
8132 { | |
8133 template_len += 4096; | |
8134 mch_memmove(newp, pdlgtemplate, | |
8135 (char *)p - (char *)pdlgtemplate); | |
8136 p = newp + (p - pdlgtemplate); | |
8137 pnumitems = newp + (pnumitems - pdlgtemplate); | |
8138 ptrueheight = newp + (ptrueheight - pdlgtemplate); | |
8139 LocalFree(LocalHandle(pdlgtemplate)); | |
8140 pdlgtemplate = newp; | |
8141 } | |
8142 } | |
8143 | |
8144 /* Figure out minimal length of this menu label. Use "name" for the | |
8145 * actual text, "dname" for estimating the displayed size. "name" | |
8146 * has "&a" for mnemonic and includes the accelerator. */ | |
8147 len = nameLen = (int)STRLEN(menu->name); | |
8148 padding0 = (columnWidths[0] - GetTextWidthEnc(hdc, menu->dname, | |
8149 (int)STRLEN(menu->dname))) / spaceWidth; | |
8150 len += padding0; | |
8151 | |
8152 if (menu->actext != NULL) | |
8153 { | |
8154 acLen = (int)STRLEN(menu->actext); | |
8155 len += acLen; | |
8156 textWidth = GetTextWidthEnc(hdc, menu->actext, acLen); | |
8157 } | |
8158 else | |
8159 textWidth = 0; | |
8160 padding1 = (columnWidths[1] - textWidth) / spaceWidth; | |
8161 len += padding1; | |
8162 | |
8163 if (menu->children == NULL) | |
8164 { | |
8165 padding2 = submenuWidth / spaceWidth; | |
8166 len += padding2; | |
8167 menuID = (WORD)(menu->id); | |
8168 } | |
8169 else | |
8170 { | |
8171 len += (int)STRLEN(TEAROFF_SUBMENU_LABEL); | |
840 | 8172 menuID = (WORD)((long_u)(menu->submenu_id) | (DWORD)0x8000); |
7 | 8173 } |
8174 | |
8175 /* Allocate menu label and fill it in */ | |
8176 text = label = alloc((unsigned)len + 1); | |
8177 if (label == NULL) | |
8178 break; | |
8179 | |
419 | 8180 vim_strncpy(text, menu->name, nameLen); |
7 | 8181 text = vim_strchr(text, TAB); /* stop at TAB before actext */ |
8182 if (text == NULL) | |
8183 text = label + nameLen; /* no actext, use whole name */ | |
8184 while (padding0-- > 0) | |
8185 *text++ = ' '; | |
8186 if (menu->actext != NULL) | |
8187 { | |
8188 STRNCPY(text, menu->actext, acLen); | |
8189 text += acLen; | |
8190 } | |
8191 while (padding1-- > 0) | |
8192 *text++ = ' '; | |
8193 if (menu->children != NULL) | |
8194 { | |
8195 STRCPY(text, TEAROFF_SUBMENU_LABEL); | |
8196 text += STRLEN(TEAROFF_SUBMENU_LABEL); | |
8197 } | |
8198 else | |
8199 { | |
8200 while (padding2-- > 0) | |
8201 *text++ = ' '; | |
8202 } | |
8203 *text = NUL; | |
8204 | |
8205 /* | |
8206 * BS_LEFT will just be ignored on Win32s/NT3.5x - on | |
8207 * W95/NT4 it makes the tear-off look more like a menu. | |
8208 */ | |
8209 p = add_dialog_element(p, | |
8210 BS_PUSHBUTTON|BS_LEFT, | |
8211 (WORD)PixelToDialogX(TEAROFF_PADDING_X), | |
8212 (WORD)(sepPadding + 1 + 13 * (*pnumitems)), | |
8213 (WORD)PixelToDialogX(dlgwidth - 2 * TEAROFF_PADDING_X), | |
8214 (WORD)12, | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
8215 menuID, (WORD)0x0080, (char *)label); |
7 | 8216 vim_free(label); |
8217 (*pnumitems)++; | |
8218 } | |
8219 | |
8220 *ptrueheight = (WORD)(sepPadding + 1 + 13 * (*pnumitems)); | |
8221 | |
8222 | |
8223 /* show modelessly */ | |
8224 the_menu->tearoff_handle = CreateDialogIndirect( | |
8225 s_hinst, | |
8226 (LPDLGTEMPLATE)pdlgtemplate, | |
8227 s_hwnd, | |
8228 (DLGPROC)tearoff_callback); | |
8229 | |
8230 LocalFree(LocalHandle(pdlgtemplate)); | |
8231 SelectFont(hdc, oldFont); | |
8232 DeleteObject(font); | |
8233 ReleaseDC(hwnd, hdc); | |
8234 | |
8235 /* | |
8236 * Reassert ourselves as the active window. This is so that after creating | |
8237 * a tearoff, the user doesn't have to click with the mouse just to start | |
8238 * typing again! | |
8239 */ | |
8240 (void)SetActiveWindow(s_hwnd); | |
8241 | |
8242 /* make sure the right buttons are enabled */ | |
8243 force_menu_update = TRUE; | |
8244 } | |
8245 #endif | |
8246 | |
8247 #if defined(FEAT_TOOLBAR) || defined(PROTO) | |
8248 #include "gui_w32_rc.h" | |
8249 | |
8250 /* This not defined in older SDKs */ | |
8251 # ifndef TBSTYLE_FLAT | |
8252 # define TBSTYLE_FLAT 0x0800 | |
8253 # endif | |
8254 | |
8255 /* | |
8256 * Create the toolbar, initially unpopulated. | |
8257 * (just like the menu, there are no defaults, it's all | |
8258 * set up through menu.vim) | |
8259 */ | |
8260 static void | |
8261 initialise_toolbar(void) | |
8262 { | |
8263 InitCommonControls(); | |
8264 s_toolbarhwnd = CreateToolbarEx( | |
8265 s_hwnd, | |
8266 WS_CHILD | TBSTYLE_TOOLTIPS | TBSTYLE_FLAT, | |
8267 4000, //any old big number | |
1213 | 8268 31, //number of images in initial bitmap |
7 | 8269 s_hinst, |
8270 IDR_TOOLBAR1, // id of initial bitmap | |
8271 NULL, | |
8272 0, // initial number of buttons | |
8273 TOOLBAR_BUTTON_WIDTH, //api guide is wrong! | |
8274 TOOLBAR_BUTTON_HEIGHT, | |
8275 TOOLBAR_BUTTON_WIDTH, | |
8276 TOOLBAR_BUTTON_HEIGHT, | |
8277 sizeof(TBBUTTON) | |
8278 ); | |
5223
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8279 s_toolbar_wndproc = SubclassWindow(s_toolbarhwnd, toolbar_wndproc); |
7 | 8280 |
8281 gui_mch_show_toolbar(vim_strchr(p_go, GO_TOOLBAR) != NULL); | |
8282 } | |
8283 | |
5223
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8284 static LRESULT CALLBACK |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8285 toolbar_wndproc( |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8286 HWND hwnd, |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8287 UINT uMsg, |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8288 WPARAM wParam, |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8289 LPARAM lParam) |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8290 { |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8291 HandleMouseHide(uMsg, lParam); |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8292 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
|
8293 } |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8294 |
7 | 8295 static int |
8296 get_toolbar_bitmap(vimmenu_T *menu) | |
8297 { | |
8298 int i = -1; | |
8299 | |
8300 /* | |
8301 * Check user bitmaps first, unless builtin is specified. | |
8302 */ | |
8303 if (!is_winnt_3() && !menu->icon_builtin) | |
8304 { | |
8305 char_u fname[MAXPATHL]; | |
8306 HANDLE hbitmap = NULL; | |
8307 | |
8308 if (menu->iconfile != NULL) | |
8309 { | |
8310 gui_find_iconfile(menu->iconfile, fname, "bmp"); | |
8311 hbitmap = LoadImage( | |
8312 NULL, | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
8313 (LPCSTR)fname, |
7 | 8314 IMAGE_BITMAP, |
8315 TOOLBAR_BUTTON_WIDTH, | |
8316 TOOLBAR_BUTTON_HEIGHT, | |
8317 LR_LOADFROMFILE | | |
8318 LR_LOADMAP3DCOLORS | |
8319 ); | |
8320 } | |
8321 | |
8322 /* | |
8323 * If the LoadImage call failed, or the "icon=" file | |
8324 * didn't exist or wasn't specified, try the menu name | |
8325 */ | |
8326 if (hbitmap == NULL | |
5020
5eff37e92f03
updated for version 7.3.1254
Bram Moolenaar <bram@vim.org>
parents:
5016
diff
changeset
|
8327 && (gui_find_bitmap( |
5eff37e92f03
updated for version 7.3.1254
Bram Moolenaar <bram@vim.org>
parents:
5016
diff
changeset
|
8328 #ifdef FEAT_MULTI_LANG |
5eff37e92f03
updated for version 7.3.1254
Bram Moolenaar <bram@vim.org>
parents:
5016
diff
changeset
|
8329 menu->en_dname != NULL ? menu->en_dname : |
5eff37e92f03
updated for version 7.3.1254
Bram Moolenaar <bram@vim.org>
parents:
5016
diff
changeset
|
8330 #endif |
5eff37e92f03
updated for version 7.3.1254
Bram Moolenaar <bram@vim.org>
parents:
5016
diff
changeset
|
8331 menu->dname, fname, "bmp") == OK)) |
7 | 8332 hbitmap = LoadImage( |
8333 NULL, | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
8334 (LPCSTR)fname, |
7 | 8335 IMAGE_BITMAP, |
8336 TOOLBAR_BUTTON_WIDTH, | |
8337 TOOLBAR_BUTTON_HEIGHT, | |
8338 LR_LOADFROMFILE | | |
8339 LR_LOADMAP3DCOLORS | |
8340 ); | |
8341 | |
8342 if (hbitmap != NULL) | |
8343 { | |
8344 TBADDBITMAP tbAddBitmap; | |
8345 | |
8346 tbAddBitmap.hInst = NULL; | |
840 | 8347 tbAddBitmap.nID = (long_u)hbitmap; |
7 | 8348 |
8349 i = (int)SendMessage(s_toolbarhwnd, TB_ADDBITMAP, | |
8350 (WPARAM)1, (LPARAM)&tbAddBitmap); | |
8351 /* i will be set to -1 if it fails */ | |
8352 } | |
8353 } | |
8354 if (i == -1 && menu->iconidx >= 0 && menu->iconidx < TOOLBAR_BITMAP_COUNT) | |
8355 i = menu->iconidx; | |
8356 | |
8357 return i; | |
8358 } | |
8359 #endif | |
8360 | |
810 | 8361 #if defined(FEAT_GUI_TABLINE) || defined(PROTO) |
8362 static void | |
8363 initialise_tabline(void) | |
8364 { | |
8365 InitCommonControls(); | |
8366 | |
819 | 8367 s_tabhwnd = CreateWindow(WC_TABCONTROL, "Vim tabline", |
840 | 8368 WS_CHILD|TCS_FOCUSNEVER|TCS_TOOLTIPS, |
810 | 8369 CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, |
8370 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
|
8371 s_tabline_wndproc = SubclassWindow(s_tabhwnd, tabline_wndproc); |
819 | 8372 |
843 | 8373 gui.tabline_height = TABLINE_HEIGHT; |
8374 | |
819 | 8375 # ifdef USE_SYSMENU_FONT |
843 | 8376 set_tabline_font(); |
819 | 8377 # endif |
810 | 8378 } |
5223
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8379 |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8380 static LRESULT CALLBACK |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8381 tabline_wndproc( |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8382 HWND hwnd, |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8383 UINT uMsg, |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8384 WPARAM wParam, |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8385 LPARAM lParam) |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8386 { |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8387 HandleMouseHide(uMsg, lParam); |
91d478da863e
updated for version 7.4a.037
Bram Moolenaar <bram@vim.org>
parents:
5020
diff
changeset
|
8388 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
|
8389 } |
810 | 8390 #endif |
8391 | |
7 | 8392 #if defined(FEAT_OLE) || defined(FEAT_EVAL) || defined(PROTO) |
8393 /* | |
8394 * Make the GUI window come to the foreground. | |
8395 */ | |
8396 void | |
8397 gui_mch_set_foreground(void) | |
8398 { | |
8399 if (IsIconic(s_hwnd)) | |
8400 SendMessage(s_hwnd, WM_SYSCOMMAND, SC_RESTORE, 0); | |
8401 SetForegroundWindow(s_hwnd); | |
8402 } | |
8403 #endif | |
8404 | |
8405 #if defined(FEAT_MBYTE_IME) && defined(DYNAMIC_IME) | |
8406 static void | |
8407 dyn_imm_load(void) | |
8408 { | |
2612 | 8409 hLibImm = vimLoadLib("imm32.dll"); |
7 | 8410 if (hLibImm == NULL) |
8411 return; | |
8412 | |
8413 pImmGetCompositionStringA | |
8414 = (void *)GetProcAddress(hLibImm, "ImmGetCompositionStringA"); | |
8415 pImmGetCompositionStringW | |
8416 = (void *)GetProcAddress(hLibImm, "ImmGetCompositionStringW"); | |
8417 pImmGetContext | |
8418 = (void *)GetProcAddress(hLibImm, "ImmGetContext"); | |
8419 pImmAssociateContext | |
8420 = (void *)GetProcAddress(hLibImm, "ImmAssociateContext"); | |
8421 pImmReleaseContext | |
8422 = (void *)GetProcAddress(hLibImm, "ImmReleaseContext"); | |
8423 pImmGetOpenStatus | |
8424 = (void *)GetProcAddress(hLibImm, "ImmGetOpenStatus"); | |
8425 pImmSetOpenStatus | |
8426 = (void *)GetProcAddress(hLibImm, "ImmSetOpenStatus"); | |
8427 pImmGetCompositionFont | |
8428 = (void *)GetProcAddress(hLibImm, "ImmGetCompositionFontA"); | |
8429 pImmSetCompositionFont | |
8430 = (void *)GetProcAddress(hLibImm, "ImmSetCompositionFontA"); | |
8431 pImmSetCompositionWindow | |
8432 = (void *)GetProcAddress(hLibImm, "ImmSetCompositionWindow"); | |
8433 pImmGetConversionStatus | |
8434 = (void *)GetProcAddress(hLibImm, "ImmGetConversionStatus"); | |
777 | 8435 pImmSetConversionStatus |
8436 = (void *)GetProcAddress(hLibImm, "ImmSetConversionStatus"); | |
7 | 8437 |
8438 if ( pImmGetCompositionStringA == NULL | |
8439 || pImmGetCompositionStringW == NULL | |
8440 || pImmGetContext == NULL | |
8441 || pImmAssociateContext == NULL | |
8442 || pImmReleaseContext == NULL | |
8443 || pImmGetOpenStatus == NULL | |
8444 || pImmSetOpenStatus == NULL | |
8445 || pImmGetCompositionFont == NULL | |
8446 || pImmSetCompositionFont == NULL | |
8447 || pImmSetCompositionWindow == NULL | |
777 | 8448 || pImmGetConversionStatus == NULL |
8449 || pImmSetConversionStatus == NULL) | |
7 | 8450 { |
8451 FreeLibrary(hLibImm); | |
8452 hLibImm = NULL; | |
8453 pImmGetContext = NULL; | |
8454 return; | |
8455 } | |
8456 | |
8457 return; | |
8458 } | |
8459 | |
8460 #endif | |
8461 | |
8462 #if defined(FEAT_SIGN_ICONS) || defined(PROTO) | |
8463 | |
8464 # ifdef FEAT_XPM_W32 | |
8465 # define IMAGE_XPM 100 | |
8466 # endif | |
8467 | |
8468 typedef struct _signicon_t | |
8469 { | |
8470 HANDLE hImage; | |
8471 UINT uType; | |
8472 #ifdef FEAT_XPM_W32 | |
8473 HANDLE hShape; /* Mask bitmap handle */ | |
8474 #endif | |
8475 } signicon_t; | |
8476 | |
8477 void | |
7823
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8478 gui_mch_drawsign(int row, int col, int typenr) |
7 | 8479 { |
8480 signicon_t *sign; | |
8481 int x, y, w, h; | |
8482 | |
8483 if (!gui.in_use || (sign = (signicon_t *)sign_get_image(typenr)) == NULL) | |
8484 return; | |
8485 | |
8486 x = TEXT_X(col); | |
8487 y = TEXT_Y(row); | |
8488 w = gui.char_width * 2; | |
8489 h = gui.char_height; | |
8490 switch (sign->uType) | |
8491 { | |
8492 case IMAGE_BITMAP: | |
8493 { | |
8494 HDC hdcMem; | |
8495 HBITMAP hbmpOld; | |
8496 | |
8497 hdcMem = CreateCompatibleDC(s_hdc); | |
8498 hbmpOld = (HBITMAP)SelectObject(hdcMem, sign->hImage); | |
8499 BitBlt(s_hdc, x, y, w, h, hdcMem, 0, 0, SRCCOPY); | |
8500 SelectObject(hdcMem, hbmpOld); | |
8501 DeleteDC(hdcMem); | |
8502 } | |
8503 break; | |
8504 case IMAGE_ICON: | |
8505 case IMAGE_CURSOR: | |
8506 DrawIconEx(s_hdc, x, y, (HICON)sign->hImage, w, h, 0, NULL, DI_NORMAL); | |
8507 break; | |
8508 #ifdef FEAT_XPM_W32 | |
8509 case IMAGE_XPM: | |
8510 { | |
8511 HDC hdcMem; | |
8512 HBITMAP hbmpOld; | |
8513 | |
8514 hdcMem = CreateCompatibleDC(s_hdc); | |
8515 hbmpOld = (HBITMAP)SelectObject(hdcMem, sign->hShape); | |
8516 /* Make hole */ | |
8517 BitBlt(s_hdc, x, y, w, h, hdcMem, 0, 0, SRCAND); | |
8518 | |
8519 SelectObject(hdcMem, sign->hImage); | |
8520 /* Paint sign */ | |
8521 BitBlt(s_hdc, x, y, w, h, hdcMem, 0, 0, SRCPAINT); | |
8522 SelectObject(hdcMem, hbmpOld); | |
8523 DeleteDC(hdcMem); | |
8524 } | |
8525 break; | |
8526 #endif | |
8527 } | |
8528 } | |
8529 | |
8530 static void | |
8531 close_signicon_image(signicon_t *sign) | |
8532 { | |
8533 if (sign) | |
8534 switch (sign->uType) | |
8535 { | |
8536 case IMAGE_BITMAP: | |
8537 DeleteObject((HGDIOBJ)sign->hImage); | |
8538 break; | |
8539 case IMAGE_CURSOR: | |
8540 DestroyCursor((HCURSOR)sign->hImage); | |
8541 break; | |
8542 case IMAGE_ICON: | |
8543 DestroyIcon((HICON)sign->hImage); | |
8544 break; | |
8545 #ifdef FEAT_XPM_W32 | |
8546 case IMAGE_XPM: | |
8547 DeleteObject((HBITMAP)sign->hImage); | |
8548 DeleteObject((HBITMAP)sign->hShape); | |
8549 break; | |
8550 #endif | |
8551 } | |
8552 } | |
8553 | |
8554 void * | |
7823
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8555 gui_mch_register_sign(char_u *signfile) |
7 | 8556 { |
8557 signicon_t sign, *psign; | |
8558 char_u *ext; | |
8559 | |
8560 if (is_winnt_3()) | |
8561 { | |
8562 EMSG(_(e_signdata)); | |
8563 return NULL; | |
8564 } | |
8565 | |
8566 sign.hImage = NULL; | |
4352 | 8567 ext = signfile + STRLEN(signfile) - 4; /* get extension */ |
7 | 8568 if (ext > signfile) |
8569 { | |
8570 int do_load = 1; | |
8571 | |
8572 if (!STRICMP(ext, ".bmp")) | |
8573 sign.uType = IMAGE_BITMAP; | |
8574 else if (!STRICMP(ext, ".ico")) | |
8575 sign.uType = IMAGE_ICON; | |
8576 else if (!STRICMP(ext, ".cur") || !STRICMP(ext, ".ani")) | |
8577 sign.uType = IMAGE_CURSOR; | |
8578 else | |
8579 do_load = 0; | |
8580 | |
8581 if (do_load) | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
8582 sign.hImage = (HANDLE)LoadImage(NULL, (LPCSTR)signfile, sign.uType, |
7 | 8583 gui.char_width * 2, gui.char_height, |
8584 LR_LOADFROMFILE | LR_CREATEDIBSECTION); | |
8585 #ifdef FEAT_XPM_W32 | |
8586 if (!STRICMP(ext, ".xpm")) | |
8587 { | |
8588 sign.uType = IMAGE_XPM; | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
8589 LoadXpmImage((char *)signfile, (HBITMAP *)&sign.hImage, |
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
8590 (HBITMAP *)&sign.hShape); |
7 | 8591 } |
8592 #endif | |
8593 } | |
8594 | |
8595 psign = NULL; | |
8596 if (sign.hImage && (psign = (signicon_t *)alloc(sizeof(signicon_t))) | |
8597 != NULL) | |
8598 *psign = sign; | |
8599 | |
8600 if (!psign) | |
8601 { | |
8602 if (sign.hImage) | |
8603 close_signicon_image(&sign); | |
8604 EMSG(_(e_signdata)); | |
8605 } | |
8606 return (void *)psign; | |
8607 | |
8608 } | |
8609 | |
8610 void | |
7823
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8611 gui_mch_destroy_sign(void *sign) |
7 | 8612 { |
8613 if (sign) | |
8614 { | |
8615 close_signicon_image((signicon_t *)sign); | |
8616 vim_free(sign); | |
8617 } | |
8618 } | |
293 | 8619 #endif |
7 | 8620 |
8621 #if defined(FEAT_BEVAL) || defined(PROTO) | |
8622 | |
8623 /* BALLOON-EVAL IMPLEMENTATION FOR WINDOWS. | |
148 | 8624 * Added by Sergey Khorev <sergey.khorev@gmail.com> |
7 | 8625 * |
189 | 8626 * The only reused thing is gui_beval.h and get_beval_info() |
7 | 8627 * from gui_beval.c (note it uses x and y of the BalloonEval struct |
8628 * to get current mouse position). | |
8629 * | |
8630 * Trying to use as more Windows services as possible, and as less | |
8631 * IE version as possible :)). | |
8632 * | |
8633 * 1) Don't create ToolTip in gui_mch_create_beval_area, only initialize | |
8634 * BalloonEval struct. | |
8635 * 2) Enable/Disable simply create/kill BalloonEval Timer | |
8636 * 3) When there was enough inactivity, timer procedure posts | |
8637 * async request to debugger | |
8638 * 4) gui_mch_post_balloon (invoked from netbeans.c) creates tooltip control | |
8639 * and performs some actions to show it ASAP | |
1621 | 8640 * 5) WM_NOTIFY:TTN_POP destroys created tooltip |
7 | 8641 */ |
8642 | |
435 | 8643 /* |
8644 * determine whether installed Common Controls support multiline tooltips | |
8645 * (i.e. their version is >= 4.70 | |
8646 */ | |
8647 int | |
8648 multiline_balloon_available(void) | |
8649 { | |
8650 HINSTANCE hDll; | |
8651 static char comctl_dll[] = "comctl32.dll"; | |
8652 static int multiline_tip = MAYBE; | |
8653 | |
8654 if (multiline_tip != MAYBE) | |
8655 return multiline_tip; | |
8656 | |
8657 hDll = GetModuleHandle(comctl_dll); | |
8658 if (hDll != NULL) | |
8659 { | |
856 | 8660 DLLGETVERSIONPROC pGetVer; |
8661 pGetVer = (DLLGETVERSIONPROC)GetProcAddress(hDll, "DllGetVersion"); | |
8662 | |
8663 if (pGetVer != NULL) | |
8664 { | |
8665 DLLVERSIONINFO dvi; | |
8666 HRESULT hr; | |
8667 | |
8668 ZeroMemory(&dvi, sizeof(dvi)); | |
8669 dvi.cbSize = sizeof(dvi); | |
8670 | |
8671 hr = (*pGetVer)(&dvi); | |
8672 | |
8673 if (SUCCEEDED(hr) | |
435 | 8674 && (dvi.dwMajorVersion > 4 |
856 | 8675 || (dvi.dwMajorVersion == 4 |
8676 && dvi.dwMinorVersion >= 70))) | |
435 | 8677 { |
8678 multiline_tip = TRUE; | |
8679 return multiline_tip; | |
8680 } | |
856 | 8681 } |
435 | 8682 else |
8683 { | |
8684 /* there is chance we have ancient CommCtl 4.70 | |
8685 which doesn't export DllGetVersion */ | |
8686 DWORD dwHandle = 0; | |
8687 DWORD len = GetFileVersionInfoSize(comctl_dll, &dwHandle); | |
8688 if (len > 0) | |
8689 { | |
8690 VS_FIXEDFILEINFO *ver; | |
8691 UINT vlen = 0; | |
8692 void *data = alloc(len); | |
8693 | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
8694 if ((data != NULL |
435 | 8695 && GetFileVersionInfo(comctl_dll, 0, len, data) |
8696 && VerQueryValue(data, "\\", (void **)&ver, &vlen) | |
8697 && vlen | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
8698 && HIWORD(ver->dwFileVersionMS) > 4) |
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
8699 || ((HIWORD(ver->dwFileVersionMS) == 4 |
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
8700 && LOWORD(ver->dwFileVersionMS) >= 70))) |
435 | 8701 { |
8702 vim_free(data); | |
8703 multiline_tip = TRUE; | |
8704 return multiline_tip; | |
8705 } | |
8706 vim_free(data); | |
8707 } | |
8708 } | |
8709 } | |
8710 multiline_tip = FALSE; | |
8711 return multiline_tip; | |
8712 } | |
8713 | |
7 | 8714 static void |
7823
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8715 make_tooltip(BalloonEval *beval, char *text, POINT pt) |
7 | 8716 { |
435 | 8717 TOOLINFO *pti; |
8718 int ToolInfoSize; | |
8719 | |
8720 if (multiline_balloon_available() == TRUE) | |
8721 ToolInfoSize = sizeof(TOOLINFO_NEW); | |
8722 else | |
8723 ToolInfoSize = sizeof(TOOLINFO); | |
8724 | |
8725 pti = (TOOLINFO *)alloc(ToolInfoSize); | |
8726 if (pti == NULL) | |
8727 return; | |
7 | 8728 |
8729 beval->balloon = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, | |
8730 NULL, WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP, | |
8731 CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, | |
8732 beval->target, NULL, s_hinst, NULL); | |
8733 | |
8734 SetWindowPos(beval->balloon, HWND_TOPMOST, 0, 0, 0, 0, | |
8735 SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); | |
8736 | |
435 | 8737 pti->cbSize = ToolInfoSize; |
8738 pti->uFlags = TTF_SUBCLASS; | |
8739 pti->hwnd = beval->target; | |
8740 pti->hinst = 0; /* Don't use string resources */ | |
8741 pti->uId = ID_BEVAL_TOOLTIP; | |
8742 | |
8743 if (multiline_balloon_available() == TRUE) | |
8744 { | |
8745 RECT rect; | |
8746 TOOLINFO_NEW *ptin = (TOOLINFO_NEW *)pti; | |
8747 pti->lpszText = LPSTR_TEXTCALLBACK; | |
8748 ptin->lParam = (LPARAM)text; | |
8749 if (GetClientRect(s_textArea, &rect)) /* switch multiline tooltips on */ | |
8750 SendMessage(beval->balloon, TTM_SETMAXTIPWIDTH, 0, | |
8751 (LPARAM)rect.right); | |
8752 } | |
8753 else | |
8754 pti->lpszText = text; /* do this old way */ | |
7 | 8755 |
8756 /* Limit ballooneval bounding rect to CursorPos neighbourhood */ | |
435 | 8757 pti->rect.left = pt.x - 3; |
8758 pti->rect.top = pt.y - 3; | |
8759 pti->rect.right = pt.x + 3; | |
8760 pti->rect.bottom = pt.y + 3; | |
8761 | |
8762 SendMessage(beval->balloon, TTM_ADDTOOL, 0, (LPARAM)pti); | |
7 | 8763 /* Make tooltip appear sooner */ |
8764 SendMessage(beval->balloon, TTM_SETDELAYTIME, TTDT_INITIAL, 10); | |
1489 | 8765 /* I've performed some tests and it seems the longest possible life time |
8766 * of tooltip is 30 seconds */ | |
8767 SendMessage(beval->balloon, TTM_SETDELAYTIME, TTDT_AUTOPOP, 30000); | |
7 | 8768 /* |
8769 * HACK: force tooltip to appear, because it'll not appear until | |
8770 * first mouse move. D*mn M$ | |
1489 | 8771 * Amazingly moving (2, 2) and then (-1, -1) the mouse doesn't move. |
7 | 8772 */ |
1489 | 8773 mouse_event(MOUSEEVENTF_MOVE, 2, 2, 0, 0); |
7 | 8774 mouse_event(MOUSEEVENTF_MOVE, (DWORD)-1, (DWORD)-1, 0, 0); |
435 | 8775 vim_free(pti); |
7 | 8776 } |
8777 | |
8778 static void | |
7823
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8779 delete_tooltip(BalloonEval *beval) |
7 | 8780 { |
7056
1ebd7608cfd9
commit https://github.com/vim/vim/commit/8e5f5b47c2198ffa4161c21a4140eaa9bed46f37
Christian Brabandt <cb@256bit.org>
parents:
7032
diff
changeset
|
8781 PostMessage(beval->balloon, WM_CLOSE, 0, 0); |
7 | 8782 } |
8783 | |
323 | 8784 /*ARGSUSED*/ |
7 | 8785 static VOID CALLBACK |
7823
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8786 BevalTimerProc( |
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8787 HWND hwnd, |
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8788 UINT uMsg, |
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8789 UINT_PTR idEvent, |
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8790 DWORD dwTime) |
7 | 8791 { |
8792 POINT pt; | |
8793 RECT rect; | |
8794 | |
8795 if (cur_beval == NULL || cur_beval->showState == ShS_SHOWING || !p_beval) | |
8796 return; | |
8797 | |
8798 GetCursorPos(&pt); | |
8799 if (WindowFromPoint(pt) != s_textArea) | |
8800 return; | |
8801 | |
8802 ScreenToClient(s_textArea, &pt); | |
8803 GetClientRect(s_textArea, &rect); | |
8804 if (!PtInRect(&rect, pt)) | |
8805 return; | |
8806 | |
8807 if (LastActivity > 0 | |
8808 && (dwTime - LastActivity) >= (DWORD)p_bdlay | |
8809 && (cur_beval->showState != ShS_PENDING | |
8810 || abs(cur_beval->x - pt.x) > 3 | |
8811 || abs(cur_beval->y - pt.y) > 3)) | |
8812 { | |
8813 /* Pointer resting in one place long enough, it's time to show | |
8814 * the tooltip. */ | |
8815 cur_beval->showState = ShS_PENDING; | |
8816 cur_beval->x = pt.x; | |
8817 cur_beval->y = pt.y; | |
8818 | |
205 | 8819 // TRACE0("BevalTimerProc: sending request"); |
7 | 8820 |
8821 if (cur_beval->msgCB != NULL) | |
8822 (*cur_beval->msgCB)(cur_beval, 0); | |
8823 } | |
8824 } | |
8825 | |
323 | 8826 /*ARGSUSED*/ |
7 | 8827 void |
7823
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8828 gui_mch_disable_beval_area(BalloonEval *beval) |
7 | 8829 { |
205 | 8830 // TRACE0("gui_mch_disable_beval_area {{{"); |
7 | 8831 KillTimer(s_textArea, BevalTimerId); |
205 | 8832 // TRACE0("gui_mch_disable_beval_area }}}"); |
7 | 8833 } |
8834 | |
323 | 8835 /*ARGSUSED*/ |
7 | 8836 void |
7823
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8837 gui_mch_enable_beval_area(BalloonEval *beval) |
7 | 8838 { |
205 | 8839 // TRACE0("gui_mch_enable_beval_area |||"); |
7 | 8840 if (beval == NULL) |
8841 return; | |
205 | 8842 // 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
|
8843 BevalTimerId = SetTimer(s_textArea, 0, (UINT)(p_bdlay / 2), BevalTimerProc); |
205 | 8844 // TRACE0("gui_mch_enable_beval_area }}}"); |
7 | 8845 } |
8846 | |
8847 void | |
7823
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8848 gui_mch_post_balloon(BalloonEval *beval, char_u *mesg) |
7 | 8849 { |
8850 POINT pt; | |
205 | 8851 // TRACE0("gui_mch_post_balloon {{{"); |
7 | 8852 if (beval->showState == ShS_SHOWING) |
8853 return; | |
8854 GetCursorPos(&pt); | |
8855 ScreenToClient(s_textArea, &pt); | |
8856 | |
8857 if (abs(beval->x - pt.x) < 3 && abs(beval->y - pt.y) < 3) | |
8858 /* cursor is still here */ | |
8859 { | |
8860 gui_mch_disable_beval_area(cur_beval); | |
8861 beval->showState = ShS_SHOWING; | |
8090
54cfe888c627
commit https://github.com/vim/vim/commit/418f81b5fa400ed59793384f2f3d9df45390f080
Christian Brabandt <cb@256bit.org>
parents:
7856
diff
changeset
|
8862 make_tooltip(beval, (char *)mesg, pt); |
7 | 8863 } |
205 | 8864 // TRACE0("gui_mch_post_balloon }}}"); |
7 | 8865 } |
8866 | |
344 | 8867 /*ARGSUSED*/ |
7 | 8868 BalloonEval * |
7823
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8869 gui_mch_create_beval_area( |
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8870 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
|
8871 char_u *mesg, |
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8872 void (*mesgCB)(BalloonEval *, int), |
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8873 void *clientData) |
7 | 8874 { |
8875 /* partially stolen from gui_beval.c */ | |
8876 BalloonEval *beval; | |
8877 | |
8878 if (mesg != NULL && mesgCB != NULL) | |
8879 { | |
8880 EMSG(_("E232: Cannot create BalloonEval with both message and callback")); | |
8881 return NULL; | |
8882 } | |
8883 | |
8884 beval = (BalloonEval *)alloc(sizeof(BalloonEval)); | |
8885 if (beval != NULL) | |
8886 { | |
8887 beval->target = s_textArea; | |
8888 beval->balloon = NULL; | |
8889 | |
8890 beval->showState = ShS_NEUTRAL; | |
8891 beval->x = 0; | |
8892 beval->y = 0; | |
8893 beval->msg = mesg; | |
8894 beval->msgCB = mesgCB; | |
8895 beval->clientData = clientData; | |
8896 | |
8897 InitCommonControls(); | |
8898 cur_beval = beval; | |
8899 | |
8900 if (p_beval) | |
8901 gui_mch_enable_beval_area(beval); | |
8902 | |
8903 } | |
8904 return beval; | |
8905 } | |
8906 | |
323 | 8907 /*ARGSUSED*/ |
7 | 8908 static void |
2217
120502692d82
Improve the MS-Windows installer.
Bram Moolenaar <bram@vim.org>
parents:
2210
diff
changeset
|
8909 Handle_WM_Notify(HWND hwnd, LPNMHDR pnmh) |
7 | 8910 { |
8911 if (pnmh->idFrom != ID_BEVAL_TOOLTIP) /* it is not our tooltip */ | |
8912 return; | |
8913 | |
8914 if (cur_beval != NULL) | |
8915 { | |
435 | 8916 switch (pnmh->code) |
7 | 8917 { |
435 | 8918 case TTN_SHOW: |
205 | 8919 // TRACE0("TTN_SHOW {{{"); |
8920 // TRACE0("TTN_SHOW }}}"); | |
435 | 8921 break; |
8922 case TTN_POP: /* Before tooltip disappear */ | |
205 | 8923 // TRACE0("TTN_POP {{{"); |
7 | 8924 delete_tooltip(cur_beval); |
8925 gui_mch_enable_beval_area(cur_beval); | |
205 | 8926 // TRACE0("TTN_POP }}}"); |
7 | 8927 |
8928 cur_beval->showState = ShS_NEUTRAL; | |
435 | 8929 break; |
8930 case TTN_GETDISPINFO: | |
1481 | 8931 { |
8932 /* if you get there then we have new common controls */ | |
8933 NMTTDISPINFO_NEW *info = (NMTTDISPINFO_NEW *)pnmh; | |
8934 info->lpszText = (LPSTR)info->lParam; | |
8935 info->uFlags |= TTF_DI_SETITEM; | |
8936 } | |
435 | 8937 break; |
7 | 8938 } |
8939 } | |
8940 } | |
8941 | |
8942 static void | |
8943 TrackUserActivity(UINT uMsg) | |
8944 { | |
8945 if ((uMsg >= WM_MOUSEFIRST && uMsg <= WM_MOUSELAST) | |
8946 || (uMsg >= WM_KEYFIRST && uMsg <= WM_KEYLAST)) | |
8947 LastActivity = GetTickCount(); | |
8948 } | |
8949 | |
8950 void | |
7823
bcef391c101c
commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents:
7807
diff
changeset
|
8951 gui_mch_destroy_beval_area(BalloonEval *beval) |
7 | 8952 { |
8953 vim_free(beval); | |
8954 } | |
8955 #endif /* FEAT_BEVAL */ | |
8956 | |
8957 #if defined(FEAT_NETBEANS_INTG) || defined(PROTO) | |
8958 /* | |
8959 * We have multiple signs to draw at the same location. Draw the | |
8960 * multi-sign indicator (down-arrow) instead. This is the Win32 version. | |
8961 */ | |
8962 void | |
8963 netbeans_draw_multisign_indicator(int row) | |
8964 { | |
8965 int i; | |
8966 int y; | |
8967 int x; | |
8968 | |
2210 | 8969 if (!netbeans_active()) |
2311
ccda151dde4e
Support completion for ":find". (Nazri Ramliy)
Bram Moolenaar <bram@vim.org>
parents:
2224
diff
changeset
|
8970 return; |
2210 | 8971 |
7 | 8972 x = 0; |
8973 y = TEXT_Y(row); | |
8974 | |
8975 for (i = 0; i < gui.char_height - 3; i++) | |
8976 SetPixel(s_hdc, x+2, y++, gui.currFgColor); | |
8977 | |
8978 SetPixel(s_hdc, x+0, y, gui.currFgColor); | |
8979 SetPixel(s_hdc, x+2, y, gui.currFgColor); | |
8980 SetPixel(s_hdc, x+4, y++, gui.currFgColor); | |
8981 SetPixel(s_hdc, x+1, y, gui.currFgColor); | |
8982 SetPixel(s_hdc, x+2, y, gui.currFgColor); | |
8983 SetPixel(s_hdc, x+3, y++, gui.currFgColor); | |
8984 SetPixel(s_hdc, x+2, y, gui.currFgColor); | |
8985 } | |
7743
6069f43cea4e
commit https://github.com/vim/vim/commit/e0874f8cbcddfcf9965a85ba35199964efb1d01a
Christian Brabandt <cb@256bit.org>
parents:
7560
diff
changeset
|
8986 #endif |