summaryrefslogtreecommitdiffstats
path: root/src/gui_w32.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-12-02 22:49:38 +0100
committerBram Moolenaar <Bram@vim.org>2019-12-02 22:49:38 +0100
commit734a867ffe198886da7365b618be67ab8ed9d9f6 (patch)
treecc650a9ce0b59d7a141bf312b7a724f308d31cea /src/gui_w32.c
parenta050b9471c66b383ed674bfd57ac78016199d972 (diff)
patch 8.1.2383: using old C style commentsv8.1.2383
Problem: Using old C style comments. Solution: Use // comments where appropriate.
Diffstat (limited to 'src/gui_w32.c')
-rw-r--r--src/gui_w32.c1093
1 files changed, 548 insertions, 545 deletions
diff --git a/src/gui_w32.c b/src/gui_w32.c
index 1c17b110ea..e6b5dad54f 100644
--- a/src/gui_w32.c
+++ b/src/gui_w32.c
@@ -58,7 +58,7 @@ gui_mch_set_rendering_options(char_u *s)
int dx_renmode = 0;
int dx_taamode = 0;
- /* parse string as rendering options. */
+ // parse string as rendering options.
for (p = s; p != NULL && *p != NUL; )
{
char_u item[256];
@@ -119,16 +119,16 @@ gui_mch_set_rendering_options(char_u *s)
}
else if (STRCMP(name, "scrlines") == 0)
{
- /* Deprecated. Simply ignore it. */
+ // Deprecated. Simply ignore it.
}
else
return FAIL;
}
if (!gui.in_use)
- return OK; /* only checking the syntax of the value */
+ return OK; // only checking the syntax of the value
- /* Enable DirectX/DirectWrite */
+ // Enable DirectX/DirectWrite
if (dx_enable)
{
if (!directx_enabled())
@@ -179,12 +179,12 @@ gui_mch_set_rendering_options(char_u *s)
#endif
-#include "version.h" /* used by dialog box routine for default title */
+#include "version.h" // used by dialog box routine for default title
#ifdef DEBUG
# include <tchar.h>
#endif
-/* cproto fails on missing include files */
+// cproto fails on missing include files
#ifndef PROTO
# ifndef __MINGW32__
@@ -199,18 +199,18 @@ gui_mch_set_rendering_options(char_u *s)
# include "glbl_ime.h"
# endif
-#endif /* PROTO */
+#endif // PROTO
#ifdef FEAT_MENU
-# define MENUHINTS /* show menu hints in command line */
+# define MENUHINTS // show menu hints in command line
#endif
-/* Some parameters for dialog boxes. All in pixels. */
+// Some parameters for dialog boxes. All in pixels.
#define DLG_PADDING_X 10
#define DLG_PADDING_Y 10
#define DLG_OLD_STYLE_PADDING_X 5
#define DLG_OLD_STYLE_PADDING_Y 5
-#define DLG_VERT_PADDING_X 4 /* For vertical buttons */
+#define DLG_VERT_PADDING_X 4 // For vertical buttons
#define DLG_VERT_PADDING_Y 4
#define DLG_ICON_WIDTH 34
#define DLG_ICON_HEIGHT 34
@@ -220,9 +220,9 @@ gui_mch_set_rendering_options(char_u *s)
#define DLG_MIN_MAX_WIDTH 400
#define DLG_MIN_MAX_HEIGHT 400
-#define DLG_NONBUTTON_CONTROL 5000 /* First ID of non-button controls */
+#define DLG_NONBUTTON_CONTROL 5000 // First ID of non-button controls
-#ifndef WM_XBUTTONDOWN /* For Win2K / winME ONLY */
+#ifndef WM_XBUTTONDOWN // For Win2K / winME ONLY
# define WM_XBUTTONDOWN 0x020B
# define WM_XBUTTONUP 0x020C
# define WM_XBUTTONDBLCLK 0x020D
@@ -295,22 +295,22 @@ static void _OnPaint( HWND hwnd);
static void fill_rect(const RECT *rcp, HBRUSH hbr, COLORREF color);
static void clear_rect(RECT *rcp);
-static WORD s_dlgfntheight; /* height of the dialog font */
-static WORD s_dlgfntwidth; /* width of the dialog font */
+static WORD s_dlgfntheight; // height of the dialog font
+static WORD s_dlgfntwidth; // width of the dialog font
#ifdef FEAT_MENU
static HMENU s_menuBar = NULL;
#endif
#ifdef FEAT_TEAROFF
static void rebuild_tearoff(vimmenu_T *menu);
-static HBITMAP s_htearbitmap; /* bitmap used to indicate tearoff */
+static HBITMAP s_htearbitmap; // bitmap used to indicate tearoff
#endif
-/* Flag that is set while processing a message that must not be interrupted by
- * processing another message. */
+// Flag that is set while processing a message that must not be interrupted by
+// processing another message.
static int s_busy_processing = FALSE;
-static int destroying = FALSE; /* call DestroyWindow() ourselves */
+static int destroying = FALSE; // call DestroyWindow() ourselves
#ifdef MSWIN_FIND_REPLACE
static UINT s_findrep_msg = 0; // set in gui_w[16/32].c
@@ -344,15 +344,14 @@ static LPARAM s_lParam = 0;
static HWND s_textArea = NULL;
static UINT s_uMsg = 0;
-static char_u *s_textfield; /* Used by dialogs to pass back strings */
+static char_u *s_textfield; // Used by dialogs to pass back strings
static int s_need_activate = FALSE;
-/* This variable is set when waiting for an event, which is the only moment
- * scrollbar dragging can be done directly. It's not allowed while commands
- * are executed, because it may move the cursor and that may cause unexpected
- * problems (e.g., while ":s" is working).
- */
+// This variable is set when waiting for an event, which is the only moment
+// scrollbar dragging can be done directly. It's not allowed while commands
+// are executed, because it may move the cursor and that may cause unexpected
+// problems (e.g., while ":s" is working).
static int allow_scrollbar = FALSE;
#ifdef GLOBAL_IME
@@ -369,7 +368,7 @@ directx_enabled(void)
return 1;
else if (s_directx_load_attempted)
return 0;
- /* load DirectX */
+ // load DirectX
DWrite_Init();
s_directx_load_attempted = 1;
s_dwc = DWriteContext_Open();
@@ -389,10 +388,10 @@ directx_binddc(void)
}
#endif
-/* use of WindowProc depends on Global IME */
+// use of WindowProc depends on Global IME
#define MyWindowProc vim_WindowProc
-extern int current_font_height; /* this is in os_mswin.c */
+extern int current_font_height; // this is in os_mswin.c
static struct
{
@@ -430,11 +429,11 @@ static struct
{VK_F21, 'F', 'B'},
#ifdef FEAT_NETBEANS_INTG
- {VK_PAUSE, 'F', 'B'}, /* Pause == F21 (see gui_gtk_x11.c) */
+ {VK_PAUSE, 'F', 'B'}, // Pause == F21 (see gui_gtk_x11.c)
#endif
{VK_F22, 'F', 'C'},
{VK_F23, 'F', 'D'},
- {VK_F24, 'F', 'E'}, /* winuser.h defines up to F24 */
+ {VK_F24, 'F', 'E'}, // winuser.h defines up to F24
{VK_HELP, '%', '1'},
{VK_BACK, 'k', 'b'},
@@ -449,7 +448,7 @@ static struct
{VK_SUBTRACT, 'K', '7'},
{VK_DIVIDE, 'K', '8'},
{VK_MULTIPLY, 'K', '9'},
- {VK_SEPARATOR, 'K', 'A'}, /* Keypad Enter */
+ {VK_SEPARATOR, 'K', 'A'}, // Keypad Enter
{VK_DECIMAL, 'K', 'B'},
{VK_NUMPAD0, 'K', 'C'},
@@ -463,22 +462,22 @@ static struct
{VK_NUMPAD8, 'K', 'K'},
{VK_NUMPAD9, 'K', 'L'},
- /* Keys that we want to be able to use any modifier with: */
+ // Keys that we want to be able to use any modifier with:
{VK_SPACE, ' ', NUL},
{VK_TAB, TAB, NUL},
{VK_ESCAPE, ESC, NUL},
{NL, NL, NUL},
{CAR, CAR, NUL},
- /* End of list marker: */
+ // End of list marker:
{0, 0, 0}
};
-/* Local variables */
+// Local variables
static int s_button_pending = -1;
-/* s_getting_focus is set when we got focus but didn't see mouse-up event yet,
- * so don't reset s_button_pending. */
+// s_getting_focus is set when we got focus but didn't see mouse-up event yet,
+// so don't reset s_button_pending.
static int s_getting_focus = FALSE;
static int s_x_pending;
@@ -491,7 +490,7 @@ static UINT surrogate_pending_ch = 0; // 0: no surrogate pending,
// else a high surrogate
#ifdef FEAT_BEVAL_GUI
-/* balloon-eval WM_NOTIFY_HANDLER */
+// balloon-eval WM_NOTIFY_HANDLER
static void Handle_WM_Notify(HWND hwnd, LPNMHDR pnmh);
static void TrackUserActivity(UINT uMsg);
#endif
@@ -502,11 +501,11 @@ static void TrackUserActivity(UINT uMsg);
* These LOGFONTW used for IME.
*/
#if defined(FEAT_MBYTE_IME) || defined(GLOBAL_IME)
-/* holds LOGFONTW for 'guifontwide' if available, otherwise 'guifont' */
+// holds LOGFONTW for 'guifontwide' if available, otherwise 'guifont'
static LOGFONTW norm_logfont;
#endif
#ifdef FEAT_MBYTE_IME
-/* holds LOGFONTW for 'guifont' always. */
+// holds LOGFONTW for 'guifont' always.
static LOGFONTW sub_logfont;
#endif
@@ -590,7 +589,7 @@ _OnBlinkTimer(
KillTimer(NULL, idEvent);
- /* Eat spurious WM_TIMER messages */
+ // Eat spurious WM_TIMER messages
while (pPeekMessage(&msg, hwnd, WM_TIMER, WM_TIMER, PM_REMOVE))
;
@@ -619,7 +618,7 @@ gui_mswin_rm_blink_timer(void)
if (blink_timer != 0)
{
KillTimer(NULL, blink_timer);
- /* Eat spurious WM_TIMER messages */
+ // Eat spurious WM_TIMER messages
while (pPeekMessage(&msg, s_hwnd, WM_TIMER, WM_TIMER, PM_REMOVE))
;
blink_timer = 0;
@@ -650,7 +649,7 @@ gui_mch_start_blink(void)
{
gui_mswin_rm_blink_timer();
- /* Only switch blinking on if none of the times is zero */
+ // Only switch blinking on if none of the times is zero
if (blink_waittime && blink_ontime && blink_offtime && gui.in_focus)
{
blink_timer = (UINT)SetTimer(NULL, 0, (UINT)blink_waittime,
@@ -680,7 +679,7 @@ _OnTimer(
KillTimer(NULL, idEvent);
s_timed_out = TRUE;
- /* Eat spurious WM_TIMER messages */
+ // Eat spurious WM_TIMER messages
while (pPeekMessage(&msg, hwnd, WM_TIMER, WM_TIMER, PM_REMOVE))
;
if (idEvent == s_wait_timer)
@@ -717,17 +716,17 @@ char_to_string(int ch, char_u *string, int slen, int had_alt)
if (surrogate_pending_ch != 0)
{
- /* We don't guarantee ch is a low surrogate to match the high surrogate
- * we already have; it should be, but if it isn't, tough luck. */
+ // We don't guarantee ch is a low surrogate to match the high surrogate
+ // we already have; it should be, but if it isn't, tough luck.
wstring[0] = surrogate_pending_ch;
wstring[1] = ch;
surrogate_pending_ch = 0;
len = 2;
}
- else if (ch >= 0xD800 && ch <= 0xDBFF) /* high surrogate */
+ else if (ch >= 0xD800 && ch <= 0xDBFF) // high surrogate
{
- /* We don't have the entire code point yet, only the first UTF-16 code
- * unit; so just remember it and use it in the next call. */
+ // We don't have the entire code point yet, only the first UTF-16 code
+ // unit; so just remember it and use it in the next call.
surrogate_pending_ch = ch;
return 0;
}
@@ -737,23 +736,23 @@ char_to_string(int ch, char_u *string, int slen, int had_alt)
len = 1;
}
- /* "ch" is a UTF-16 character. Convert it to a string of bytes. When
- * "enc_codepage" is non-zero use the standard Win32 function,
- * otherwise use our own conversion function (e.g., for UTF-8). */
+ // "ch" is a UTF-16 character. Convert it to a string of bytes. When
+ // "enc_codepage" is non-zero use the standard Win32 function,
+ // otherwise use our own conversion function (e.g., for UTF-8).
if (enc_codepage > 0)
{
len = WideCharToMultiByte(enc_codepage, 0, wstring, len,
(LPSTR)string, slen, 0, NULL);
- /* If we had included the ALT key into the character but now the
- * upper bit is no longer set, that probably means the conversion
- * failed. Convert the original character and set the upper bit
- * afterwards. */
+ // If we had included the ALT key into the character but now the
+ // upper bit is no longer set, that probably means the conversion
+ // failed. Convert the original character and set the upper bit
+ // afterwards.
if (had_alt && len == 1 && ch >= 0x80 && string[0] < 0x80)
{
wstring[0] = ch & 0x7f;
len = WideCharToMultiByte(enc_codepage, 0, wstring, len,
(LPSTR)string, slen, 0, NULL);
- if (len == 1) /* safety check */
+ if (len == 1) // safety check
string[0] |= 0x80;
}
}
@@ -764,7 +763,7 @@ char_to_string(int ch, char_u *string, int slen, int had_alt)
len = 0;
else
{
- if (len > slen) /* just in case */
+ if (len > slen) // just in case
len = slen;
mch_memmove(string, ws, len);
vim_free(ws);
@@ -780,7 +779,7 @@ char_to_string(int ch, char_u *string, int slen, int had_alt)
for (i = 0; i < len; ++i)
if (string[i] == CSI && len <= slen - 2)
{
- /* Insert CSI as K_CSI. */
+ // Insert CSI as K_CSI.
mch_memmove(string + i + 3, string + i + 1, len - i - 1);
string[++i] = KS_EXTRA;
string[++i] = (int)KE_CSI;
@@ -823,20 +822,19 @@ _OnSysChar(
UINT cch,
int cRepeat UNUSED)
{
- char_u string[40]; /* Enough for multibyte character */
+ char_u string[40]; // Enough for multibyte character
int len;
int modifiers;
- int ch = cch; /* special keys are negative */
+ int ch = cch; // special keys are negative
dead_key = 0;
- /* TRACE("OnSysChar(%d, %c)\n", ch, ch); */
+ // TRACE("OnSysChar(%d, %c)\n", ch, ch);
- /* OK, we have a character key (given by ch) which was entered with the
- * ALT key pressed. Eg, if the user presses Alt-A, then ch == 'A'. Note
- * that the system distinguishes Alt-a and Alt-A (Alt-Shift-a unless
- * CAPSLOCK is pressed) at this point.
- */
+ // OK, we have a character key (given by ch) which was entered with the
+ // ALT key pressed. Eg, if the user presses Alt-A, then ch == 'A'. Note
+ // that the system distinguishes Alt-a and Alt-A (Alt-Shift-a unless
+ // CAPSLOCK is pressed) at this point.
modifiers = MOD_MASK_ALT;
if (GetKeyState(VK_SHIFT) & 0x8000)
modifiers |= MOD_MASK_SHIFT;
@@ -844,12 +842,12 @@ _OnSysChar(
modifiers |= MOD_MASK_CTRL;
ch = simplify_key(ch, &modifiers);
- /* remove the SHIFT modifier for keys where it's already included, e.g.,
- * '(' and '*' */
+ // remove the SHIFT modifier for keys where it's already included, e.g.,
+ // '(' and '*'
if (ch < 0x100 && !isalpha(ch) && isprint(ch))
modifiers &= ~MOD_MASK_SHIFT;
- /* Interpret the ALT key as making the key META, include SHIFT, etc. */
+ // Interpret the ALT key as making the key META, include SHIFT, etc.
ch = extract_modifiers(ch, &modifiers, TRUE, NULL);
if (ch == CSI)
ch = K_CSI;
@@ -870,8 +868,8 @@ _OnSysChar(
}
else
{
- /* Although the documentation isn't clear about it, we assume "ch" is
- * a Unicode character. */
+ // Although the documentation isn't clear about it, we assume "ch" is
+ // a Unicode character.
len += char_to_string(ch, string + len, 40 - len, TRUE);
}
@@ -914,7 +912,7 @@ _OnMouseButtonDown(
int button = -1;
int repeated_click;
- /* Give main window the focus: this is so the cursor isn't hollow. */
+ // Give main window the focus: this is so the cursor isn't hollow.
(void)SetFocus(s_hwnd);
if (s_uMsg == WM_LBUTTONDOWN || s_uMsg == WM_LBUTTONDBLCLK)
@@ -932,8 +930,8 @@ _OnMouseButtonDown(
}
else if (s_uMsg == WM_CAPTURECHANGED)
{
- /* on W95/NT4, somehow you get in here with an odd Msg
- * if you press one button while holding down the other..*/
+ // on W95/NT4, somehow you get in here with an odd Msg
+ // if you press one button while holding down the other..
if (s_button_pending == MOUSE_LEFT)
button = MOUSE_RIGHT;
else
@@ -970,7 +968,7 @@ _OnMouseButtonDown(
_OnMouseEvent(s_button_pending, x, y, FALSE, keyFlags);
s_button_pending = -1;
}
- /* TRACE("Button down at x %d, y %d\n", x, y); */
+ // TRACE("Button down at x %d, y %d\n", x, y);
_OnMouseEvent(button, x, y, repeated_click, keyFlags);
}
else
@@ -1010,7 +1008,7 @@ _OnMouseMoveOrRelease(
s_getting_focus = FALSE;
if (s_button_pending > -1)
{
- /* Delayed action for mouse down event */
+ // Delayed action for mouse down event
_OnMouseEvent(s_button_pending, s_x_pending,
s_y_pending, FALSE, s_kFlags_pending);
s_button_pending = -1;
@@ -1034,13 +1032,13 @@ _OnMouseMoveOrRelease(
*/
SetCapture(s_textArea);
button = MOUSE_DRAG;
- /* TRACE(" move at x %d, y %d\n", x, y); */
+ // TRACE(" move at x %d, y %d\n", x, y);
}
else
{
ReleaseCapture();
button = MOUSE_RELEASE;
- /* TRACE(" up at x %d, y %d\n", x, y); */
+ // TRACE(" up at x %d, y %d\n", x, y);
}
_OnMouseEvent(button, x, y, FALSE, keyFlags);
@@ -1114,23 +1112,23 @@ _OnFindRepl(void)
int down;
if (s_findrep_struct.Flags & FR_DIALOGTERM)
- /* Give main window the focus back. */
+ // Give main window the focus back.
(void)SetFocus(s_hwnd);
if (s_findrep_struct.Flags & FR_FINDNEXT)
{
flags = FRD_FINDNEXT;
- /* Give main window the focus back: this is so the cursor isn't
- * hollow. */
+ // Give main window the focus back: this is so the cursor isn't
+ // hollow.
(void)SetFocus(s_hwnd);
}
else if (s_findrep_struct.Flags & FR_REPLACE)
{
flags = FRD_REPLACE;
- /* Give main window the focus back: this is so the cursor isn't
- * hollow. */
+ // Give main window the focus back: this is so the cursor isn't
+ // hollow.
(void)SetFocus(s_hwnd);
}
else if (s_findrep_struct.Flags & FR_REPLACEALL)
@@ -1142,7 +1140,7 @@ _OnFindRepl(void)
{
char_u *p, *q;
- /* Call the generic GUI function to do the actual work. */
+ // Call the generic GUI function to do the actual work.
if (s_findrep_struct.Flags & FR_WHOLEWORD)
flags |= FRD_WHOLE_WORD;
if (s_findrep_struct.Flags & FR_MATCHCASE)
@@ -1163,7 +1161,7 @@ HandleMouseHide(UINT uMsg, LPARAM lParam)
{
static LPARAM last_lParam = 0L;
- /* We sometimes get a mousemove when the mouse didn't move... */
+ // We sometimes get a mousemove when the mouse didn't move...
if (uMsg == WM_MOUSEMOVE || uMsg == WM_NCMOUSEMOVE)
{
if (lParam == last_lParam)
@@ -1171,10 +1169,9 @@ HandleMouseHide(UINT uMsg, LPARAM lParam)
last_lParam = lParam;
}
- /* Handle specially, to centralise coding. We need to be sure we catch all
- * possible events which should cause us to restore the cursor (as it is a
- * shared resource, we take full responsibility for it).
- */
+ // Handle specially, to centralise coding. We need to be sure we catch all
+ // possible events which should cause us to restore the cursor (as it is a
+ // shared resource, we take full responsibility for it).
switch (uMsg)
{
case WM_KEYUP:
@@ -1186,9 +1183,9 @@ HandleMouseHide(UINT uMsg, LPARAM lParam)
gui_mch_mousehide(TRUE);
break;
- case WM_SYSKEYUP: /* show the pointer when a system-key is pressed */
+ case WM_SYSKEYUP: // show the pointer when a system-key is pressed
case WM_SYSCHAR:
- case WM_MOUSEMOVE: /* show the pointer on any mouse action */
+ case WM_MOUSEMOVE: // show the pointer on any mouse action
case WM_LBUTTONDOWN:
case WM_LBUTTONUP:
case WM_MBUTTONDOWN:
@@ -1309,14 +1306,14 @@ gui_mch_def_colors(void)
int
gui_mch_open(void)
{
- /* Actually open the window, if not already visible
- * (may be done already in gui_mch_set_shellsize) */
+ // Actually open the window, if not already visible
+ // (may be done already in gui_mch_set_shellsize)
if (!IsWindowVisible(s_hwnd))
ShowWindow(s_hwnd, SW_SHOWDEFAULT);
#ifdef MSWIN_FIND_REPLACE
- /* Init replace string here, so that we keep it when re-opening the
- * dialog. */
+ // Init replace string here, so that we keep it when re-opening the
+ // dialog.
s_findrep_struct.lpstrReplaceWith[0] = NUL;
#endif
@@ -1375,9 +1372,9 @@ gui_mch_set_text_area_pos(int x, int y, int w, int h)
}
#endif
- /* When side scroll bar is unshown, the size of window will change.
- * then, the text area move left or right. thus client rect should be
- * forcedly redrawn. (Yasuhiro Matsumoto) */
+ // When side scroll bar is unshown, the size of window will change.
+ // then, the text area move left or right. thus client rect should be
+ // forcedly redrawn. (Yasuhiro Matsumoto)
if (oldx != x || oldy != y)
{
InvalidateRect(s_hwnd, NULL, FALSE);
@@ -1398,9 +1395,9 @@ gui_mch_enable_scrollbar(
{
ShowScrollBar(sb->id, SB_CTL, flag);
- /* TODO: When the window is maximized, the size of the window stays the
- * same, thus the size of the text area changes. On Win98 it's OK, on Win
- * NT 4.0 it's not... */
+ // TODO: When the window is maximized, the size of the window stays the
+ // same, thus the size of the text area changes. On Win98 it's OK, on Win
+ // NT 4.0 it's not...
}
void
@@ -1418,13 +1415,13 @@ gui_mch_set_scrollbar_pos(
void
gui_mch_create_scrollbar(
scrollbar_T *sb,
- int orient) /* SBAR_VERT or SBAR_HORIZ */
+ int orient) // SBAR_VERT or SBAR_HORIZ
{
sb->id = CreateWindow(
"SCROLLBAR", "Scrollbar",
WS_CHILD | ((orient == SBAR_VERT) ? SBS_VERT : SBS_HORZ), 0, 0,
- 10, /* Any value will do for now */
- 10, /* Any value will do for now */
+ 10, // Any value will do for now
+ 10, // Any value will do for now
s_hwnd, NULL,
g_hinst, NULL);
}
@@ -1491,7 +1488,7 @@ get_font_handle(LOGFONTW *lf)
{
HFONT font = NULL;
- /* Load the font */
+ // Load the font
font = CreateFontIndirectW(lf);
if (font == NULL)
@@ -1722,7 +1719,7 @@ gui_mch_draw_part_cursor(
*/
rc.left =
#ifdef FEAT_RIGHTLEFT
- /* vertical line should be on the right of current point */
+ // vertical line should be on the right of current point
CURSOR_BAR_RIGHT ? FILL_X(gui.col + 1) - w :
#endif
FILL_X(gui.col);
@@ -1748,14 +1745,14 @@ outputDeadKey_rePost(MSG originalMsg)
dead_key = 0;
- /* Make Windows generate the dead key's character */
+ // Make Windows generate the dead key's character
deadCharExpel.message = originalMsg.message;
deadCharExpel.hwnd = originalMsg.hwnd;
deadCharExpel.wParam = VK_SPACE;
MyTranslateMessage(&deadCharExpel);
- /* re-generate the current character free of the dead char influence */
+ // re-generate the current character free of the dead char influence
PostMessage(originalMsg.hwnd, originalMsg.message, originalMsg.wParam,
originalMsg.lParam);
}
@@ -1769,7 +1766,7 @@ outputDeadKey_rePost(MSG originalMsg)
process_message(void)
{
MSG msg;
- UINT vk = 0; /* Virtual key */
+ UINT vk = 0; // Virtual key
char_u string[40];
int i;
int modifiers = 0;
@@ -1781,27 +1778,27 @@ process_message(void)
pGetMessage(&msg, NULL, 0, 0);
#ifdef FEAT_OLE
- /* Look after OLE Automation commands */
+ // Look after OLE Automation commands
if (msg.message == WM_OLE)
{
char_u *str = (char_u *)msg.lParam;
if (str == NULL || *str == NUL)
{
- /* Message can't be ours, forward it. Fixes problem with Ultramon
- * 3.0.4 */
+ // Message can't be ours, forward it. Fixes problem with Ultramon
+ // 3.0.4
pDispatchMessage(&msg);
}
else
{
add_to_input_buf(str, (int)STRLEN(str));
- vim_free(str); /* was allocated in CVim::SendKeys() */
+ vim_free(str); // was allocated in CVim::SendKeys()
}
return;
}
#endif
#ifdef MSWIN_FIND_REPLACE
- /* Don't process messages used by the dialog */
+ // Don't process messages used by the dialog
if (s_findrep_hwnd != NULL && pIsDialogMessage(s_findrep_hwnd, &msg))
{
HandleMouseHide(msg.message, msg.lParam);
@@ -1851,8 +1848,8 @@ process_message(void)
MyTranslateMessage(&msg);
return;
}
- /* In modes where we are not typing, dead keys should behave
- * normally */
+ // In modes where we are not typing, dead keys should behave
+ // normally
else if (!(get_real_state() & (INSERT | CMDLINE | SELECTMODE)))
{
outputDeadKey_rePost(msg);
@@ -1860,7 +1857,7 @@ process_message(void)
}
}
- /* Check for CTRL-BREAK */
+ // Check for CTRL-BREAK
if (vk == VK_CANCEL)
{
trash_input_buf();
@@ -1872,7 +1869,7 @@ process_message(void)
for (i = 0; special_keys[i].key_sym != 0; i++)
{
- /* ignore VK_SPACE when ALT key pressed: system menu */
+ // ignore VK_SPACE when ALT key pressed: system menu
if (special_keys[i].key_sym == vk
&& (vk != VK_SPACE || !(GetKeyState(VK_MENU) & 0x8000)))
{
@@ -1890,8 +1887,8 @@ process_message(void)
}
#ifdef FEAT_MENU
- /* Check for <F10>: Windows selects the menu. When <F10> is
- * mapped we want to use the mapping instead. */
+ // Check for <F10>: Windows selects the menu. When <F10> is
+ // mapped we want to use the mapping instead.
if (vk == VK_F10
&& gui.menu_is_active
&& check_map(k10, State, FALSE, TRUE, FALSE,
@@ -1942,7 +1939,7 @@ process_message(void)
{
int len;
- /* Handle "key" as a Unicode character. */
+ // Handle "key" as a Unicode character.
len = char_to_string(key, string, 40, FALSE);
add_to_input_buf(string, len);
}
@@ -1951,27 +1948,27 @@ process_message(void)
}
if (special_keys[i].key_sym == 0)
{
- /* Some keys need C-S- where they should only need C-.
- * Ignore 0xff, Windows XP sends it when NUMLOCK has changed since
- * system startup (Helmut Stiegler, 2003 Oct 3). */
+ // Some keys need C-S- where they should only need C-.
+ // Ignore 0xff, Windows XP sends it when NUMLOCK has changed since
+ // system startup (Helmut Stiegler, 2003 Oct 3).
if (vk != 0xff
&& (GetKeyState(VK_CONTROL) & 0x8000)
&& !(GetKeyState(VK_SHIFT) & 0x8000)
&& !(GetKeyState(VK_MENU) & 0x8000))
{
- /* CTRL-6 is '^'; Japanese keyboard maps '^' to vk == 0xDE */
+ // CTRL-6 is '^'; Japanese keyboard maps '^' to vk == 0xDE
if (vk == '6' || MapVirtualKey(vk, 2) == (UINT)'^')
{
string[0] = Ctrl_HAT;
add_to_input_buf(string, 1);
}
- /* vk == 0xBD AZERTY for CTRL-'-', but CTRL-[ for * QWERTY! */
- else if (vk == 0xBD) /* QWERTY for CTRL-'-' */
+ // vk == 0xBD AZERTY for CTRL-'-', but CTRL-[ for * QWERTY!
+ else if (vk == 0xBD) // QWERTY for CTRL-'-'
{
string[0] = Ctrl__;
add_to_input_buf(string, 1);
}
- /* CTRL-2 is '@'; Japanese keyboard maps '@' to vk == 0xC0 */
+ // CTRL-2 is '@'; Japanese keyboard maps '@' to vk == 0xC0
else if (vk == '2' || MapVirtualKey(vk, 2) == (UINT)'@')
{
string[0] = Ctrl_AT;
@@ -1988,11 +1985,11 @@ process_message(void)
else if (msg.message == WM_IME_NOTIFY)
_OnImeNotify(msg.hwnd, (DWORD)msg.wParam, (DWORD)msg.lParam);
else if (msg.message == WM_KEYUP && im_get_status())
- /* added for non-MS IME (Yasuhiro Matsumoto) */
+ // added for non-MS IME (Yasuhiro Matsumoto)
MyTranslateMessage(&msg);
#endif
#if !defined(FEAT_MBYTE_IME) && defined(GLOBAL_IME)
-/* GIME_TEST */
+// GIME_TEST
else if (msg.message == WM_IME_STARTCOMPOSITION)
{
POINT point;
@@ -2006,9 +2003,9 @@ process_message(void)
#endif
#ifdef FEAT_MENU
- /* Check for <F10>: Default effect is to select the menu. When <F10> is
- * mapped we need to stop it here to avoid strange effects (e.g., for the
- * key-up event) */
+ // Check for <F10>: Default effect is to select the menu. When <F10> is
+ // mapped we need to stop it here to avoid strange effects (e.g., for the
+ // key-up event)
if (vk != VK_F10 || check_map(k10, State, FALSE, TRUE, FALSE,
NULL, NULL) == NULL)
#endif
@@ -2041,7 +2038,7 @@ remove_any_timer(void)
{
KillTimer(NULL, s_wait_timer);
- /* Eat spurious WM_TIMER messages */
+ // Eat spurious WM_TIMER messages
while (pPeekMessage(&msg, s_hwnd, WM_TIMER, WM_TIMER, PM_REMOVE))
;
s_wait_timer = 0;
@@ -2213,7 +2210,7 @@ gui_mch_set_menu_pos(
int w UNUSED,
int h UNUSED)
{
- /* It will be in the right place anyway */
+ // It will be in the right place anyway
}
#if defined(FEAT_MENU) || defined(PROTO)
@@ -2245,7 +2242,7 @@ gui_mch_draw_menubar(void)
{
DrawMenuBar(s_hwnd);
}
-#endif /*FEAT_MENU*/
+#endif // FEAT_MENU
/*
* Return the RGB value of a pixel as a long.
@@ -2258,21 +2255,27 @@ gui_mch_get_rgb(guicolor_T pixel)
}
#if defined(FEAT_GUI_DIALOG) || defined(PROTO)
-/* Convert pixels in X to dialog units */
+/*
+ * Convert pixels in X to dialog units
+ */
static WORD
PixelToDialogX(int numPixels)
{
return (WORD)((numPixels * 4) / s_dlgfntwidth);
}
-/* Convert pixels in Y to dialog units */
+/*
+ * Convert pixels in Y to dialog units
+ */
static WORD
PixelToDialogY(int numPixels)
{
return (WORD)((numPixels * 8) / s_dlgfntheight);
}
-/* Return the width in pixels of the given text in the given DC. */
+/*
+ * Return the width in pixels of the given text in the given DC.
+ */
static int
GetTextWidth(HDC hdc, char_u *str, int len)
{
@@ -2328,7 +2331,7 @@ CenterWindow(
wChild = rChild.right - rChild.left;
hChild = rChild.bottom - rChild.top;
- /* If Vim is minimized put the window in the middle of the screen. */
+ // If Vim is minimized put the window in the middle of the screen.
if (hwndParent == NULL || IsMinimized(hwndParent))
get_work_area(&rParent);
else
@@ -2367,7 +2370,7 @@ CenterWindow(
return SetWindowPos(hwndChild, NULL, xNew, yNew, 0, 0,
SWP_NOSIZE | SWP_NOZORDER);
}
-#endif /* FEAT_GUI_DIALOG */
+#endif // FEAT_GUI_DIALOG
#if defined(FEAT_TOOLBAR) || defined(PROTO)
void
@@ -2391,7 +2394,7 @@ gui_mch_show_toolbar(int showit)
ShowWindow(s_toolbarhwnd, SW_HIDE);
}
-/* The number of bitmaps is fixed. Exit is missing! */
+// The number of bitmaps is fixed. Exit is missing!
# define TOOLBAR_BITMAP_COUNT 31
#endif
@@ -2424,7 +2427,7 @@ show_tabline_popup_menu(void)
long rval;
POINT pt;
- /* When ignoring events don't show the menu. */
+ // When ignoring events don't show the menu.
if (hold_gui_events
# ifdef FEAT_CMDWIN
|| cmdwin_type != 0
@@ -2450,7 +2453,7 @@ show_tabline_popup_menu(void)
DestroyMenu(tab_pmenu);
- /* Add the string cmd into input buffer */
+ // Add the string cmd into input buffer
if (rval > 0)
{
TCHITTESTINFO htinfo;
@@ -2516,7 +2519,7 @@ gui_mch_update_tabline(void)
return;
# ifndef CCM_SETUNICODEFORMAT
- /* For older compilers. We assume this never changes. */
+ // For older compilers. We assume this never changes.
# define CCM_SETUNICODEFORMAT 0x2005
# endif
// Enable unicode support
@@ -2525,10 +2528,10 @@ gui_mch_update_tabline(void)
tie.mask = TCIF_TEXT;
tie.iImage = -1;
- /* Disable redraw for tab updates to eliminate O(N^2) draws. */
+ // Disable redraw for tab updates to eliminate O(N^2) draws.
SendMessage(s_tabhwnd, WM_SETREDRAW, (WPARAM)FALSE, 0);
- /* Add a label for each tab page. They all contain the same text area. */
+ // Add a label for each tab page. They all contain the same text area.
for (tp = first_tabpage; tp != NULL; tp = tp->tp_next, ++nr)
{
if (tp == curtab)
@@ -2536,7 +2539,7 @@ gui_mch_update_tabline(void)
if (nr >= TabCtrl_GetItemCount(s_tabhwnd))
{
- /* Add the tab */
+ // Add the tab
tie.pszText = "-Empty-";
TabCtrl_InsertItem(s_tabhwnd, nr, &tie);
tabadded = 1;
@@ -2558,14 +2561,14 @@ gui_mch_update_tabline(void)
}
}
- /* Remove any old labels. */
+ // Remove any old labels.
while (nr < TabCtrl_GetItemCount(s_tabhwnd))
TabCtrl_DeleteItem(s_tabhwnd, nr);
if (!tabadded && TabCtrl_GetCurSel(s_tabhwnd) != curtabidx)
TabCtrl_SetCurSel(s_tabhwnd, curtabidx);
- /* Re-enable redraw and redraw. */
+ // Re-enable redraw and redraw.
SendMessage(s_tabhwnd, WM_SETREDRAW, (WPARAM)TRUE, 0);
RedrawWindow(s_tabhwnd, NULL, NULL,
RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN);
@@ -2603,15 +2606,15 @@ ex_simalt(exarg_T *eap)
while (*keys)
{
if (*keys == '~')
- *keys = ' '; /* for showing system menu */
+ *keys = ' '; // for showing system menu
PostMessage(s_hwnd, WM_CHAR, (WPARAM)*keys, (LPARAM)0);
keys++;
fill_typebuf = TRUE;
}
if (fill_typebuf)
{
- /* Put a NOP in the typeahead buffer so that the message will get
- * processed. */
+ // Put a NOP in the typeahead buffer so that the message will get
+ // processed.
key_name[0] = K_SPECIAL;
key_name[1] = KS_EXTRA;
key_name[2] = KE_NOP;
@@ -2636,7 +2639,7 @@ initialise_findrep(char_u *initial_string)
int mcase = !p_ic;
char_u *entry_text;
- /* Get the search string to use. */
+ // Get the search string to use.
entry_text = get_find_dialog_text(initial_string, &wword, &mcase);
s_findrep_struct.hwndOwner = s_hwnd;
@@ -2668,7 +2671,7 @@ set_window_title(HWND hwnd, char *title)
{
WCHAR *wbuf;
- /* Convert the title from 'encoding' to UTF-16. */
+ // Convert the title from 'encoding' to UTF-16.
wbuf = (WCHAR *)enc_to_utf16((char_u *)title, NULL);
if (wbuf != NULL)
{
@@ -2745,14 +2748,14 @@ gui_mch_mousehide(int hide)
static void
gui_mch_show_popupmenu_at(vimmenu_T *menu, int x, int y)
{
- /* Unhide the mouse, we don't get move events here. */
+ // Unhide the mouse, we don't get move events here.
gui_mch_mousehide(FALSE);
(void)TrackPopupMenu(
(HMENU)menu->submenu_id,
TPM_LEFTALIGN | TPM_LEFTBUTTON,
x, y,
- (int)0, /*reserved param*/
+ (int)0, //reserved param
s_hwnd,
NULL);
/*
@@ -2799,11 +2802,11 @@ _OnPaint(
{
PAINTSTRUCT ps;
- out_flush(); /* make sure all output has been processed */
+ out_flush(); // make sure all output has been processed
(void)BeginPaint(hwnd, &ps);
- /* prevent multi-byte characters from misprinting on an invalid
- * rectangle */
+ // prevent multi-byte characters from misprinting on an invalid
+ // rectangle
if (has_mbyte)
{
RECT rect;
@@ -2836,7 +2839,7 @@ _OnSize(
gui_resize_shell(cx, cy);
#ifdef FEAT_MENU
- /* Menu bar may wrap differently now */
+ // Menu bar may wrap differently now
gui_mswin_get_menu_height(TRUE);
#endif
}
@@ -2871,8 +2874,8 @@ _OnActivateApp(
BOOL fActivate,
DWORD dwThreadId)
{
- /* we call gui_focus_change() in _OnSetFocus() */
- /* gui_focus_change((int)fActivate); */
+ // we call gui_focus_change() in _OnSetFocus()
+ // gui_focus_change((int)fActivate);
return MyWindowProc(hwnd, WM_ACTIVATEAPP, fActivate, (DWORD)dwThreadId);
}
@@ -2954,9 +2957,9 @@ gui_mch_flash(int msec)
rc.right = gui.num_cols * gui.char_width;
rc.bottom = gui.num_rows * gui.char_height;
InvertRect(s_hdc, &rc);
- gui_mch_flush(); /* make sure it's displayed */
+ gui_mch_flush(); // make sure it's displayed
- ui_delay((long)msec, TRUE); /* wait for a few msec */
+ ui_delay((long)msec, TRUE); // wait for a few msec
InvertRect(s_hdc, &rc);
}
@@ -2974,13 +2977,13 @@ get_scroll_flags(void)
GetWindowRect(s_hwnd, &rcVim);
- /* Check if the window is partly above or below the screen. We don't care
- * about partly left or right of the screen, it is not relevant when
- * scrolling up or down. */
+ // Check if the window is partly above or below the screen. We don't care
+ // about partly left or right of the screen, it is not relevant when
+ // scrolling up or down.
if (rcVim.top < 0 || rcVim.bottom > GetSystemMetrics(SM_CYFULLSCREEN))
return SW_INVALIDATE;
- /* Check if there is an window (partly) on top of us. */
+ // Check if there is an window (partly) on top of us.
for (hwnd = s_hwnd; (hwnd = GetWindow(hwnd, GW_HWNDPREV)) != (HWND)0; )
if (IsWindowVisible(hwnd))
{
@@ -3036,11 +3039,11 @@ gui_mch_delete_lines(
UpdateWindow(s_textArea);
}
- /* This seems to be required to avoid the cursor disappearing when
- * scrolling such that the cursor ends up in the top-left character on
- * the screen... But why? (Webb) */
- /* It's pr