diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-12-02 22:49:38 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-12-02 22:49:38 +0100 |
commit | 734a867ffe198886da7365b618be67ab8ed9d9f6 (patch) | |
tree | cc650a9ce0b59d7a141bf312b7a724f308d31cea /src/gui_w32.c | |
parent | a050b9471c66b383ed674bfd57ac78016199d972 (diff) | |
download | vim-git-734a867ffe198886da7365b618be67ab8ed9d9f6.tar.gz |
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.c | 1093 |
1 files changed, 548 insertions, 545 deletions
diff --git a/src/gui_w32.c b/src/gui_w32.c index 1c17b110e..e6b5dad54 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 probably fixed by disabling drawing the cursor while scrolling. */ - /* gui.cursor_is_valid = FALSE; */ + // 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 probably fixed by disabling drawing the cursor while scrolling. + // gui.cursor_is_valid = FALSE; gui_clear_block(gui.scroll_region_bot - num_lines + 1, gui.scroll_region_left, @@ -3073,8 +3076,8 @@ gui_mch_insert_lines( #endif { intel_gpu_workaround(); - /* The SW_INVALIDATE is required when part of the window is covered or - * off-screen. How do we avoid it when it's not needed? */ + // The SW_INVALIDATE is required when part of the window is covered or + // off-screen. How do we avoid it when it's not needed? ScrollWindowEx(s_textArea, 0, num_lines * gui.char_height, &rc, &rc, NULL, NULL, get_scroll_flags()); UpdateWindow(s_textArea); @@ -3098,14 +3101,14 @@ gui_mch_exit(int rc UNUSED) DeleteObject(s_brush); #ifdef FEAT_TEAROFF - /* Unload the tearoff bitmap */ + // Unload the tearoff bitmap (void)DeleteObject((HGDIOBJ)s_htearbitmap); #endif - /* Destroy our window (if we have one). */ + // Destroy our window (if we have one). if (s_hwnd != NULL) { - destroying = TRUE; /* ignore WM_DESTROY message now */ + destroying = TRUE; // ignore WM_DESTROY message now DestroyWindow(s_hwnd); } @@ -3246,7 +3249,7 @@ gui_mch_init_font(char_u *font_name, int fontset UNUSED) GuiFont font = NOFONT; char_u *p; - /* Load the font */ + // Load the font if (get_logfont(&lf, font_name, NULL, TRUE) == OK) font = get_font_handle(&lf); if (font == NOFONT) @@ -3273,8 +3276,8 @@ gui_mch_init_font(char_u *font_name, int fontset UNUSED) { hl_set_font_name(p); - /* When setting 'guifont' to "*" replace it with the actual font name. - * */ + // When setting 'guifont' to "*" replace it with the actual font name. + // if (STRCMP(font_name, "*") == 0 && STRCMP(p_guifont, "*") == 0) { vim_free(p_guifont); @@ -3312,7 +3315,7 @@ gui_mch_init_font(char_u *font_name, int fontset UNUSED) } #ifndef WPF_RESTORETOMAXIMIZED -# define WPF_RESTORETOMAXIMIZED 2 /* just in case someone doesn't have it */ +# define WPF_RESTORETOMAXIMIZED 2 // just in case someone doesn't have it #endif /* @@ -3359,7 +3362,7 @@ gui_mch_newfont(void) } else { - /* Inside another window, don't use the frame and border. */ + // Inside another window, don't use the frame and border. gui_resize_shell(rect.right - rect.left, rect.bottom - rect.top #ifdef FEAT_MENU @@ -3381,27 +3384,27 @@ gui_mch_settitle( } #if defined(FEAT_MOUSESHAPE) || defined(PROTO) -/* Table for shape IDCs. Keep in sync with the mshape_names[] table in - * misc2.c! */ +// Table for shape IDCs. Keep in sync with the mshape_names[] table in +// misc2.c! static LPCSTR mshape_idcs[] = { - IDC_ARROW, /* arrow */ - MAKEINTRESOURCE(0), /* blank */ - IDC_IBEAM, /* beam */ - IDC_SIZENS, /* updown */ - IDC_SIZENS, /* udsizing */ - IDC_SIZEWE, /* leftright */ - IDC_SIZEWE, /* lrsizing */ - IDC_WAIT, /* busy */ - IDC_NO, /* no */ - IDC_ARROW, /* crosshair */ - IDC_ARROW, /* hand1 */ - IDC_ARROW, /* hand2 */ - IDC_ARROW, /* pencil */ - IDC_ARROW, /* question */ - IDC_ARROW, /* right-arrow */ - IDC_UPARROW, /* up-arrow */ - IDC_ARROW /* last one */ + IDC_ARROW, // arrow + MAKEINTRESOURCE(0), // blank + IDC_IBEAM, // beam + IDC_SIZENS, // updown + IDC_SIZENS, // udsizing + IDC_SIZEWE, // leftright + IDC_SIZEWE, // lrsizing + IDC_WAIT, // busy + IDC_NO, // no + IDC_ARROW, // crosshair + IDC_ARROW, // hand1 + IDC_ARROW, // hand2 + IDC_ARROW, // pencil + IDC_ARROW, // question + IDC_ARROW, // right-arrow + IDC_UPARROW, // up-arrow + IDC_ARROW // last one }; void @@ -3422,7 +3425,7 @@ mch_set_mouse_shape(int shape) { POINT mp; - /* Set the position to make it redrawn with the new shape. */ + // Set the position to make it redrawn with the new shape. (void)GetCursorPos((LPPOINT)&mp); (void)SetCursorPos(mp.x, mp.y); ShowCursor(TRUE); @@ -3470,8 +3473,8 @@ gui_mch_browse( char_u *initdir, char_u *filter) { - /* We always use the wide function. This means enc_to_utf16() must work, - * otherwise it fails miserably! */ + // We always use the wide function. This means enc_to_utf16() must work, + // otherwise it fails miserably! OPENFILENAMEW fileStruct; WCHAR fileBuf[MAXPATHL]; WCHAR *wp; @@ -3498,12 +3501,12 @@ gui_mch_browse( } } - /* Convert the filter to Windows format. */ + // Convert the filter to Windows format. filterp = convert_filterW(filter); vim_memset(&fileStruct, 0, sizeof(OPENFILENAMEW)); # ifdef OPENFILENAME_SIZE_VERSION_400W - /* be compatible with Windows NT 4.0 */ + // be compatible with Windows NT 4.0 fileStruct.lStructSize = OPENFILENAME_SIZE_VERSION_400W; # else fileStruct.lStructSize = sizeof(fileStruct); @@ -3520,11 +3523,11 @@ gui_mch_browse( fileStruct.lpstrFile = fileBuf; fileStruct.nMaxFile = MAXPATHL; fileStruct.lpstrFilter = filterp; - fileStruct.hwndOwner = s_hwnd; /* main Vim window is owner*/ - /* has an initial dir been specified? */ + fileStruct.hwndOwner = s_hwnd; // main Vim window is owner + // has an initial dir been specified? if (initdir != NULL && *initdir != NUL) { - /* Must have backslashes here, no matter what 'shellslash' says */ + // Must have backslashes here, no matter what 'shellslash' says initdirp = enc_to_utf16(initdir, NULL); if (initdirp != NULL) { @@ -3564,15 +3567,15 @@ gui_mch_browse( vim_free(titlep); vim_free(extp); - /* Convert from UCS2 to 'encoding'. */ + // Convert from UCS2 to 'encoding'. p = utf16_to_enc(fileBuf, NULL); if (p == NULL) return NULL; - /* Give focus back to main window (when using MDI). */ + // Give focus back to main window (when using MDI). SetFocus(s_hwnd); - /* Shorten the file name if possible */ + // Shorten the file name if possible q = vim_strsave(shorten_fname1(p)); vim_free(p); return q; @@ -3602,7 +3605,7 @@ convert_filter(char_u *s) else res[i] = s[i]; res[s_len] = NUL; - /* Add two extra NULs to make sure it's properly terminated. */ + // Add two extra NULs to make sure it's properly terminated. res[s_len + 1] = NUL; res[s_len + 2] = NUL; } @@ -3615,12 +3618,12 @@ convert_filter(char_u *s) char_u * gui_mch_browsedir(char_u *title, char_u *initdir) { - /* We fake this: Use a filter that doesn't select anything and a default - * file name that won't be used. */ + // We fake this: Use a filter that doesn't select anything and a default + // file name that won't be used. return gui_mch_browse(0, title, (char_u *)_("Not Used"), NULL, initdir, (char_u *)_("Directory\t*.nothing\n")); } -#endif /* FEAT_BROWSE */ +#endif // FEAT_BROWSE static void _OnDropFiles( @@ -3637,9 +3640,9 @@ _OnDropFiles( POINT pt; int_u modifiers = 0; - /* TRACE("_OnDropFiles: %d files dropped\n", cFiles); */ + // TRACE("_OnDropFiles: %d files dropped\n", cFiles); - /* Obtain dropped position */ + // Obtain dropped position DragQueryPoint(hDrop, &pt); MapWindowPoints(s_hwnd, s_textArea, &pt, 1); @@ -3683,7 +3686,7 @@ _OnScroll( UINT code, int pos) { - static UINT prev_code = 0; /* code of previous call */ + static UINT prev_code = 0; // code of previous call scrollbar_T *sb, *sb_info; long val; int dragging = FALSE; @@ -3697,7 +3700,7 @@ _OnScroll( if (sb == NULL) return 0; - if (sb->wp != NULL) /* Left or right scrollbar */ + if (sb->wp != NULL) // Left or right scrollbar { /* * Careful: need to get scrollbar info out of first (left) scrollbar @@ -3706,7 +3709,7 @@ _OnScroll( */ sb_info = &sb->wp->w_scrollbars[0]; } - else /* Bottom scrollbar */ + else // Bottom scrollbar sb_info = sb; val = sb_info->value; @@ -3751,7 +3754,7 @@ _OnScroll( break; default: - /* TRACE("Unknown scrollbar event %d\n", code); */ + // TRACE("Unknown scrollbar event %d\n", code); return 0; } prev_code = code; @@ -3770,11 +3773,11 @@ _OnScroll( SetScrollInfo(id, SB_CTL, &si, TRUE); } - /* Don't let us be interrupted here by another message. */ + // Don't let us be interrupted here by another message. s_busy_processing = TRUE; - /* When "allow_scrollbar" is FALSE still need to remember the new - * position, but don't actually scroll by setting "dont_scroll". */ + // When "allow_scrollbar" is FALSE still need to remember the new + // position, but don't actually scroll by setting "dont_scroll". dont_scroll = !allow_scrollbar; mch_disable_flush(); @@ -3902,10 +3905,10 @@ _OnScroll( # define HANDLE_WM_DEADCHAR(hwnd, wParam, lParam, fn) \ ((fn)((hwnd), (TCHAR)(wParam), (int)(short)LOWORD(lParam)), 0L) # endif -#endif /* __MINGW32__ */ +#endif // __MINGW32__ -/* Some parameters for tearoff menus. All in pixels. */ +// Some parameters for tearoff menus. All in pixels. #define TEAROFF_PADDING_X 2 #define TEAROFF_BUTTON_PAD_X 8 #define TEAROFF_MIN_WIDTH 200 @@ -3913,7 +3916,7 @@ _OnScroll( #define TEAROFF_COLUMN_PADDING 3 // # spaces to pad column with. -/* For the Intellimouse: */ +// For the Intellimouse: #ifndef WM_MOUSEWHEEL # define WM_MOUSEWHEEL 0x20a #endif @@ -3924,8 +3927,8 @@ _OnScroll( # define BEVAL_TEXT_LEN MAXPATHL # if (defined(_MSC_VER) && _MSC_VER < 1300) || !defined(MAXULONG_PTR) -/* Work around old versions of basetsd.h which wrongly declares - * UINT_PTR as unsigned long. */ +// Work around old versions of basetsd.h which wrongly declares +// UINT_PTR as unsigned long. # undef UINT_PTR # define UINT_PTR UINT # endif @@ -3935,7 +3938,7 @@ static UINT_PTR BevalTimerId = 0; static DWORD LastActivity = 0; -/* cproto fails on missing include files */ +// cproto fails on missing include files # ifndef PROTO /* @@ -4018,13 +4021,13 @@ typedef HRESULT (WINAPI* DLLGETVERSIONPROC)(DLLVERSIONINFO *); # define TTN_GETDISPINFO (TTN_FIRST - 0) # endif -#endif /* defined(FEAT_BEVAL_GUI) */ +#endif // defined(FEAT_BEVAL_GUI) #if defined(FEAT_TOOLBAR) || defined(FEAT_GUI_TABLINE) -/* Older MSVC compilers don't have LPNMTTDISPINFO[AW] thus we need to define - * it here if LPNMTTDISPINFO isn't defined. - * MingW doesn't define LPNMTTDISPINFO but typedefs it. Thus we need to check - * _MSC_VER. */ +// Older MSVC compilers don't have LPNMTTDISPINFO[AW] thus we need to define +// it here if LPNMTTDISPINFO isn't defined. +// MingW doesn't define LPNMTTDISPINFO but typedefs it. Thus we need to check +// _MSC_VER. # if !defined(LPNMTTDISPINFO) && defined(_MSC_VER) typedef struct tagNMTTDISPINFOA { NMHDR hdr; @@ -4051,7 +4054,7 @@ typedef struct tagNMTTDISPINFOW { # define TTN_GETDISPINFOW (TTN_FIRST - 10) #endif -/* Local variables: */ +// Local variables: #ifdef FEAT_MENU static UINT s_menu_id = 100; @@ -4066,9 +4069,9 @@ static UINT s_menu_id = 100; #define VIM_NAME "vim" #define VIM_CLASSW L"Vim" -/* Initial size for the dialog template. For gui_mch_dialog() it's fixed, - * thus there should be room for every dialog. For tearoffs it's made bigger - * when needed. */ +// Initial size for the dialog template. For gui_mch_dialog() it's fixed, +// thus there should be room for every dialog. For tearoffs it's made bigger +// when needed. #define DLG_ALLOC_SIZE 16 * 1024 /* @@ -4094,10 +4097,10 @@ static void get_dialog_font_metrics(void); static int dialog_default_button = -1; -/* Intellimouse support */ +// Intellimouse support static int mouse_scroll_lines = 0; -static int s_usenewlook; /* emulate W95/NT4 non-bold dialogs */ +static int s_usenewlook; // emulate W95/NT4 non-bold dialogs #ifdef FEAT_TOOLBAR static void initialise_toolbar(void); static LRESULT CALLBACK toolbar_wndproc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); @@ -4158,7 +4161,7 @@ static void dyn_imm_load(void); */ static int gui_mswin_get_menu_height( - int fix_window) /* If TRUE, resize window if menu height changed */ + int fix_window) // If TRUE, resize window if menu height changed { static int old_menu_height = -1; @@ -4175,10 +4178,10 @@ gui_mswin_get_menu_height( menu_height = 0; else if (IsMinimized(s_hwnd)) { - /* The height of the menu cannot be determined while the window is - * minimized. Take the previous height if the menu is changed in that - * state, to avoid that Vim's vertical window size accidentally - * increases due to the unaccounted-for menu height. */ + // The height of the menu cannot be determined while the window is + // minimized. Take the previous height if the menu is changed in that + // state, to avoid that Vim's vertical window size accidentally + // increases due to the unaccounted-for menu height. menu_height = old_menu_height == -1 ? 0 : old_menu_height; } else @@ -4206,7 +4209,7 @@ gui_mswin_get_menu_height( return menu_height; } -#endif /*FEAT_MENU*/ +#endif // FEAT_MENU /* @@ -4223,14 +4226,14 @@ init_mouse_wheel(void) # define SPI_SETWHEELSCROLLLINES 105 #endif -#define VMOUSEZ_CLASSNAME "MouseZ" /* hidden wheel window class */ -#define VMOUSEZ_TITLE "Magellan MSWHEEL" /* hidden wheel window title */ +#define VMOUSEZ_CLASSNAME "MouseZ" // hidden wheel window class +#define VMOUSEZ_TITLE "Magellan MSWHEEL" // hidden wheel window title #define VMSH_MOUSEWHEEL "MSWHEEL_ROLLMSG" #define VMSH_SCROLL_LINES "MSH_SCROLL_LINES_MSG" - mouse_scroll_lines = 3; /* reasonable default */ + mouse_scroll_lines = 3; // reasonable default - /* if NT 4.0+ (or Win98) get scroll lines directly from system */ + // if NT 4.0+ (or Win98) get scroll lines directly from system SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, &mouse_scroll_lines, 0); } @@ -4399,7 +4402,7 @@ _OnWindowPosChanged( cy = lpwpos->cy; netbeans_frame_moved(x, y); } - /* Allow to send WM_SIZE and WM_MOVE */ + // Allow to send WM_SIZE and WM_MOVE FORWARD_WM_WINDOWPOSCHANGED(hwnd, lpwpos, MyWindowProc); } #endif @@ -4459,9 +4462,9 @@ _WndProc( { HANDLE_MSG(hwnd, WM_DEADCHAR, _OnDeadChar); HANDLE_MSG(hwnd, WM_SYSDEADCHAR, _OnDeadChar); - /* HANDLE_MSG(hwnd, WM_ACTIVATE, _OnActivate); */ + // HANDLE_MSG(hwnd, WM_ACTIVATE, _OnActivate); HANDLE_MSG(hwnd, WM_CLOSE, _OnClose); - /* HANDLE_MSG(hwnd, WM_COMMAND, _OnCommand); */ + // HANDLE_MSG(hwnd, WM_COMMAND, _OnCommand); HANDLE_MSG(hwnd, WM_DESTROY, _OnDestroy); HANDLE_MSG(hwnd, WM_DROPFILES, _OnDropFiles); HANDLE_MSG(hwnd, WM_HSCROLL, _OnScroll); @@ -4469,12 +4472,12 @@ _WndProc( #ifdef FEAT_MENU HANDLE_MSG(hwnd, WM_COMMAND, _OnMenu); #endif - /* HANDLE_MSG(hwnd, WM_MOVE, _OnMove); */ - /* HANDLE_MSG(hwnd, WM_NCACTIVATE, _OnNCActivate); */ + // HANDLE_MSG(hwnd, WM_MOVE, _OnMove); + // HANDLE_MSG(hwnd, WM_NCACTIVATE, _OnNCActivate); HANDLE_MSG(hwnd, WM_SETFOCUS, _OnSetFocus); HANDLE_MSG(hwnd, WM_SIZE, _OnSize); - /* HANDLE_MSG(hwnd, WM_SYSCOMMAND, _OnSysCommand); */ - /* HANDLE_MSG(hwnd, WM_SYSKEYDOWN, _OnAltKey); */ + // HANDLE_MSG(hwnd, WM_SYSCOMMAND, _OnSysCommand); + // HANDLE_MSG(hwnd, WM_SYSKEYDOWN, _OnAltKey); HANDLE_MSG(hwnd, WM_VSCROLL, _OnScroll); // HANDLE_MSG(hwnd, WM_WINDOWPOSCHANGING, _OnWindowPosChanging); HANDLE_MSG(hwnd, WM_ACTIVATEAPP, _OnActivateApp); @@ -4522,12 +4525,12 @@ _WndProc( } #endif - case WM_QUERYENDSESSION: /* System wants to go down. */ - gui_shell_closed(); /* Will exit when no changed buffers. */ - return FALSE; /* Do NOT allow system to go down. */ + case WM_QUERYENDSESSION: // System wants to go down. + gui_shell_closed(); // Will exit when no changed buffers. + return FALSE; // Do NOT allow system to go down. case WM_ENDSESSION: - if (wParam) /* system only really goes down when wParam is TRUE */ + if (wParam) // system only really goes down when wParam is TRUE { _OnEndSession(); return 0L; @@ -4535,8 +4538,8 @@ _WndProc( break; case WM_CHAR: - /* Don't use HANDLE_MSG() for WM_CHAR, it truncates wParam to a single - * byte while we want the UTF-16 character value. */ + // Don't use HANDLE_MSG() for WM_CHAR, it truncates wParam to a single + // byte while we want the UTF-16 character value. _OnChar(hwnd, (UINT)wParam, (int)(short)LOWORD(lParam)); return 0L; @@ -4563,23 +4566,23 @@ _WndProc( case WM_SYSKEYUP: #ifdef FEAT_MENU - /* This used to be done only when menu is active: ALT key is used for - * that. But that caused problems when menu is disabled and using - * Alt-Tab-Esc: get into a strange state where no mouse-moved events - * are received, mouse pointer remains hidden. */ + // This used to be done only when menu is active: ALT key is used for + // that. But that caused problems when menu is disabled and using + // Alt-Tab-Esc: get into a strange state where no mouse-moved events + // are received, mouse pointer remains hidden. return MyWindowProc(hwnd, uMsg, wParam, lParam); #else return 0L; #endif - case WM_SIZING: /* HANDLE_MSG doesn't seem to handle this one */ + case WM_SIZING: // HANDLE_MSG doesn't seem to handle this one return _DuringSizing((UINT)wParam, (LPRECT)lParam); case WM_MOUSEWHEEL: _OnMouseWheel(hwnd, HIWORD(wParam)); return 0L; - /* Notification for change in SystemParametersInfo() */ + // Notification for change in SystemParametersInfo() case WM_SETTINGCHANGE: return _OnSettingChange((UINT)wParam); @@ -4653,21 +4656,21 @@ _WndProc( { LPNMTTDISPINFOW lpdi = (LPNMTTDISPINFOW)lParam; - /* Set the maximum width, this also enables using - * \n for line break. */ + // Set the maximum width, this also enables using + // \n for line break. SendMessage(lpdi->hdr.hwndFrom, TTM_SETMAXTIPWIDTH, 0, 500); tt_text = enc_to_utf16(str, NULL); lpdi->lpszText = tt_text; - /* can't show tooltip if failed */ + // can't show tooltip if failed } else { LPNMTTDISPINFO lpdi = (LPNMTTDISPINFO)lParam; - /* Set the maximum width, this also enables using - * \n for line break. */ + // Set the maximum width, this also enables using + // \n for line break. SendMessage(lpdi->hdr.hwndFrom, TTM_SETMAXTIPWIDTH, 0, 500); @@ -4760,8 +4763,8 @@ _WndProc( int yPos = GET_Y_LPARAM(lParam); RECT rct; - /* If the cursor is on the GUI tabline, don't process this - * event */ + // If the cursor is on the GUI tabline, don't process this + // event GetWindowRect(s_textArea, &rct); if (yPos < rct.top) return result; @@ -4770,7 +4773,7 @@ _WndProc( (void)gui_mch_get_winpos(&x, &y); xPos -= x; - if (xPos < 48) /* <VN> TODO should use system metric? */ + if (xPos < 48) // <VN> TODO should use system metric? return HTBOTTOMLEFT; else return HTBOTTOMRIGHT; @@ -4778,7 +4781,7 @@ _WndProc( else return result; } - /* break; notreached */ + // break; notreached #ifdef FEAT_MBYTE_IME case WM_IME_NOTIFY: @@ -4807,7 +4810,7 @@ _WndProc( * End of call-back routines */ -/* parent window, if specified with -P */ +// parent window, if specified with -P HWND vim_parent_hwnd = NULL; static BOOL CALLBACK @@ -4820,14 +4823,14 @@ FindWindowTitle(HWND hwnd, LPARAM lParam) { if (strstr(buf, title) != NULL) { - /* Found it. Store the window ref. and quit searching if MDI - * works. */ + // Found it. Store the window ref. and quit searching if MDI + // works. vim_parent_hwnd = FindWindowEx(hwnd, NULL, "MDIClient", NULL); if (vim_parent_hwnd != NULL) return FALSE; } } - return TRUE; /* continue searching */ + return TRUE; // continue searching } /* @@ -4855,7 +4858,7 @@ ole_error(char *arg) gui.in_use = mch_is_gui_executable(); # endif - /* Can't use emsg() here, we have not finished initialisation yet. */ + // Can't use emsg() here, we have not finished initialisation yet. vim_snprintf(buf, IOSIZE, _("E243: Argument not supported: \"-%s\"; Use the OLE version."), arg); @@ -5009,10 +5012,10 @@ gui_mch_prepare(int *argc, char **argv) int silent = FALSE; int idx; - /* Check for special OLE command line parameters */ + // Check for special OLE command line parameters if ((*argc == 2 || *argc == 3) && (argv[1][0] == '-' || argv[1][0] == '/')) { - /* Check for a "-silent" argument first. */ + // Check for a "-silent" argument first. if (*argc == 3 && STRICMP(argv[1] + 1, "silent") == 0 && (argv[2][0] == '-' || argv[2][0] == '/')) { @@ -5022,7 +5025,7 @@ gui_mch_prepare(int *argc, char **argv) else idx = 1; - /* Register Vim as an OLE Automation server */ + // Register Vim as an OLE Automation server if (STRICMP(argv[idx] + 1, "register") == 0) { #ifdef FEAT_OLE @@ -5035,7 +5038,7 @@ gui_mch_prepare(int *argc, char **argv) #endif } - /* Unregister Vim as an OLE Automation server */ + // Unregister Vim as an OLE Automation server if (STRICMP(argv[idx] + 1, "unregister") == 0) { #ifdef FEAT_OLE @@ -5048,11 +5051,10 @@ gui_mch_prepare(int *argc, char **argv) #endif } - /* Ignore an -embedding argument. It is only relevant if the - * application wants to treat the case when it is started manually - * differently from the case where it is started via automation (and - * we don't). - */ + // Ignore an -embedding argument. It is only relevant if the + // application wants to treat the case when it is started manually + // differently from the case where it is started via automation (and + // we don't). if (STRICMP(argv[idx] + 1, "embedding") == 0) { #ifdef FEAT_OLE @@ -5069,7 +5071,7 @@ gui_mch_prepare(int *argc, char **argv) int bDoRestart = FALSE; InitOLE(&bDoRestart); - /* automatically exit after registering */ + // automatically exit after registering if (bDoRestart) mch_exit(0); } @@ -5077,7 +5079,7 @@ gui_mch_prepare(int *argc, char **argv) #ifdef FEAT_NETBEANS_INTG { - /* stolen from gui_x11.c */ + // stolen from gui_x11.c int arg; for (arg = 1; arg < *argc; arg++) @@ -5087,7 +5089,7 @@ gui_mch_prepare(int *argc, char **argv) mch_memmove(&argv[arg], &argv[arg + 1], (--*argc - arg) * sizeof(char *)); argv[*argc] = NULL; - break; /* enough? */ + break; // enough? } } #endif @@ -5107,8 +5109,8 @@ gui_mch_init(void) ATOM atom; #endif - /* Return here if the window was already opened (happens when - * gui_mch_dialog() is called early). */ + // Return here if the window was already opened (happens when + // gui_mch_dialog() is called early). if (s_hwnd != NULL) goto theend; @@ -5122,14 +5124,14 @@ gui_mch_init(void) gui.scrollbar_width = GetSystemMetrics(SM_CXVSCROLL); gui.scrollbar_height = GetSystemMetrics(SM_CYHSCROLL); #ifdef FEAT_MENU - gui.menu_height = 0; /* Windows takes care of this */ + gui.menu_height = 0; // Windows takes care of this #endif gui.border_width = 0; s_brush = CreateSolidBrush(GetSysColor(COLOR_BTNFACE)); - /* First try using the wide version, so that we can use any title. - * Otherwise only characters in the active codepage will work. */ + // First try using the wide version, so that we can use any title. + // Otherwise only characters in the active codepage will work. if (GetClassInfoW(g_hinst, szVimWndClassW, &wndclassw) == 0) { wndclassw.style = CS_DBLCLKS; @@ -5175,7 +5177,7 @@ gui_mch_init(void) } __except(EXCEPTION_EXECUTE_HANDLER) { - /* NOP */ + // NOP } #endif if (s_hwnd == NULL) @@ -5186,21 +5188,21 @@ gui_mch_init(void) } else { - /* If the provided windowid is not valid reset it to zero, so that it - * is ignored and we open our own window. */ + // If the provided windowid is not valid reset it to zero, so that it + // is ignored and we open our own window. if (IsWindow((HWND)win_socket_id) <= 0) win_socket_id = 0; - /* Create a window. If win_socket_id is not zero without border and - * titlebar, it will be reparented below. */ + // Create a window. If win_socket_id is not zero without border and + // titlebar, it will be reparented below. s_hwnd = CreateWindowW( szVimWndClassW, L"Vim MSWindows GUI", (win_socket_id == 0 ? WS_OVERLAPPEDWINDOW : WS_POPUP) | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, gui_win_x == -1 ? CW_USEDEFAULT : gui_win_x, gui_win_y == -1 ? CW_USEDEFAULT : gui_win_y, - 100, /* Any value will do */ - 100, /* Any value will do */ + 100, // Any value will do + 100, // Any value will do NULL, NULL, g_hinst, NULL); if (s_hwnd != NULL && win_socket_id != 0) @@ -5220,7 +5222,7 @@ gui_mch_init(void) dyn_imm_load(); #endif - /* Create the text area window */ + // Create the text area window if (GetClassInfoW(g_hinst, szTextAreaClassW, &wndclassw) == 0) { wndclassw.style = CS_OWNDC; @@ -5251,7 +5253,7 @@ gui_mch_init(void) return FAIL; #ifdef FEAT_LIBCALL - /* Try loading an icon from $RUNTIMEPATH/bitmaps/vim.ico. */ + // Try loading an icon from $RUNTIMEPATH/bitmaps/vim.ico. { HANDLE hIcon = NULL; @@ -5267,14 +5269,14 @@ gui_mch_init(void) DragAcceptFiles(s_hwnd, TRUE); - /* Do we need to bother with this? */ - /* m_fMouseAvail = GetSystemMetrics(SM_MOUSEPRESENT); */ + // Do we need to bother with this? + // m_fMouseAvail = GetSystemMetrics(SM_MOUSEPRESENT); - /* Get background/foreground colors from the system */ + // Get background/foreground colors from the system gui_mch_def_colors(); - /* Get the colors from the "Normal" group (set in syntax.c or in a vimrc - * file) */ + // Get the colors from the "Normal" group (set in syntax.c or in a vimrc + // file) set_normal_colors(); /* @@ -5285,8 +5287,8 @@ gui_mch_init(void) gui.def_norm_pixel = gui.norm_pixel; gui.def_back_pixel = gui.back_pixel; - /* Get the colors for the highlight groups (gui_check_colors() might have - * changed them) */ + // Get the colors for the highlight groups (gui_check_colors() might have + // changed them) highlight_gui_started(); /* @@ -5321,7 +5323,7 @@ gui_mch_init(void) */ s_findrep_msg = RegisterWindowMessage(FINDMSGSTRING); - /* Initialise the struct */ + // Initialise the struct s_findrep_struct.lStructSize = sizeof(s_findrep_struct); s_findrep_struct.lpstrFindWhat = ALLOC_MULT(WCHAR, MSWIN_FR_BUFSIZE); s_findrep_struct.lpstrFindWhat[0] = NUL; @@ -5333,12 +5335,12 @@ gui_mch_init(void) #ifdef FEAT_EVAL # if !defined(_MSC_VER) || (_MSC_VER < 1400) -/* Define HandleToLong for old MS and non-MS compilers if not defined. */ +// Define HandleToLong for old MS and non-MS compilers if not defined. # ifndef HandleToLong # define HandleToLong(h) ((long)(intptr_t)(h)) # endif # endif - /* set the v:windowid variable */ + // set the v:windowid variable set_vim_var_nr(VV_WINDOWID, HandleToLong(s_hwnd)); #endif @@ -5348,7 +5350,7 @@ gui_mch_init(void) #endif theend: - /* Display any pending error messages */ + // Display any pending error messages display_errors(); return OK; @@ -5364,7 +5366,7 @@ get_work_area(RECT *spi_rect) HMONITOR mon; MONITORINFO moninfo; - /* work out which monitor the window is on, and get *its* work area */ + // work out which monitor the window is on, and get *its* work area mon = MonitorFromWindow(s_hwnd, MONITOR_DEFAULTTOPRIMARY); if (mon != NULL) { @@ -5375,7 +5377,7 @@ get_work_area(RECT *spi_rect) return; } } - /* this is the old method... */ + // this is the old method... SystemParametersInfo(SPI_GETWORKAREA, 0, spi_rect, 0); } @@ -5396,27 +5398,27 @@ gui_mch_set_shellsize( int win_width, win_height; WINDOWPLACEMENT wndpl; - /* Try to keep window completely on screen. */ - /* Get position of the screen work area. This is the part that is not - * used by the taskbar or appbars. */ + // Try to keep window completely on screen. + // Get position of the screen work area. This is the part that is not + // used by the taskbar or appbars. get_work_area(&workarea_rect); - /* Get current position of our window. Note that the .left and .top are - * relative to the work area. */ + // Get current position of our window. Note that the .left and .top are + // relative to the work area. wndpl.length = sizeof(WINDOWPLACEMENT); GetWindowPlacement(s_hwnd, &wndpl); - /* Resizing a maximized window looks very strange, unzoom it first. - * But don't do it when still starting up, it may have been requested in - * the shortcut. */ + // Resizing a maximized window looks very strange, unzoom it first. + // But don't do it when still starting up, it may have been requested in + // the shortcut. if (wndpl.showCmd == SW_SHOWMAXIMIZED && starting == 0) { ShowWindow(s_hwnd, SW_SHOWNORMAL); - /* Need to get the settings of the normal window. */ + // Need to get the settings of the normal window. GetWindowPlacement(s_hwnd, &wndpl); } - /* compute the size of the outside of the window */ + // compute the size of the outside of the window win_width = width + (GetSystemMetrics(SM_CXFRAME) + GetSystemMetrics(SM_CXPADDEDBORDER)) * 2; win_height = height + (GetSystemMetrics(SM_CYFRAME) + @@ -5427,13 +5429,13 @@ gui_mch_set_shellsize( #endif ; - /* The following should take care of keeping Vim on the same monitor, no - * matter if the secondary monitor is left or right of the primary - * monitor. */ + // The following should take care of keeping Vim on the same monitor, no + // matter if the secondary monitor is left or right of the primary + // monitor. wndpl.rcNormalPosition.right = wndpl.rcNormalPosition.left + win_width; wndpl.rcNormalPosition.bottom = wndpl.rcNormalPosition.top + win_height; - /* If the window is going off the screen, move it on to the screen. */ + // If the window is going off the screen, move it on to the screen. if ((direction & RESIZE_HOR) && wndpl.rcNormalPosition.right > workarea_rect.right) OffsetRect(&wndpl.rcNormalPosition, @@ -5454,16 +5456,16 @@ gui_mch_set_shellsize( OffsetRect(&wndpl.rcNormalPosition, 0, workarea_rect.top - wndpl.rcNormalPosition.top); - /* set window position - we should use SetWindowPlacement rather than - * SetWindowPos as the MSDN docs say the coord systems returned by - * these two are not compatible. */ + // set window position - we should use SetWindowPlacement rather than + // SetWindowPos as the MSDN docs say the coord systems returned by + // these two are not compatible. SetWindowPlacement(s_hwnd, &wndpl); SetActiveWindow(s_hwnd); SetFocus(s_hwnd); #ifdef FEAT_MENU - /* Menu may wrap differently now */ + // Menu may wrap differently now gui_mswin_get_menu_height(!gui.starting); #endif } @@ -5543,7 +5545,7 @@ gui_mch_set_sp_color(guicolor_T color) * First static functions (no prototypes generated). */ # ifdef _MSC_VER -# include <ime.h> /* Apparently not needed for Cygwin or MinGW. */ +# include <ime.h> // Apparently not needed for Cygwin or MinGW. # endif # include <imm.h> @@ -5566,15 +5568,15 @@ _OnImeNotify(HWND hWnd, DWORD dwCommand, DWORD dwData UNUSED) pImmSetCompositionFontW(hImc, &norm_logfont); im_set_position(gui.row, gui.col); - /* Disable langmap */ + // Disable langmap State &= ~LANGMAP; if (State & INSERT) { # if defined(FEAT_KEYMAP) - /* Unshown 'keymap' in status lines */ + // Unshown 'keymap' in status lines if (curbuf->b_p_iminsert == B_IMODE_LMAP) { - /* Save cursor position */ + // Save cursor position int old_row = gui.row; int old_col = gui.col; @@ -5584,7 +5586,7 @@ _OnImeNotify(HWND hWnd, DWORD dwCommand, DWORD dwData UNUSED) showmode(); status_redraw_curbuf(); update_screen(0); - /* Restore cursor position */ + // Restore cursor position gui.row = old_row; gui.col = old_col; } @@ -5606,7 +5608,7 @@ _OnImeComposition(HWND hwnd, WPARAM dbcs UNUSED, LPARAM param) char_u *ret; int len; - if ((param & GCS_RESULTSTR) == 0) /* Composition unfinished. */ + if ((param & GCS_RESULTSTR) == 0) // Composition unfinished. return 0; ret = GetResultStr(hwnd, GCS_RESULTSTR, &len); @@ -5631,16 +5633,16 @@ GetCompositionString_inUCS2(HIMC hIMC, DWORD GCS, int *lenp) char_u *buf; if (!pImmGetContext) - return NULL; /* no imm32.dll */ + return NULL; // no imm32.dll - /* Try Unicode; this'll always work on NT regardless of codepage. */ + // Try Unicode; this'll always work on NT regardless of codepage. ret = pImmGetCompositionStringW(hIMC, GCS, NULL, 0); if (ret == 0) - return NULL; /* empty */ + return NULL; // empty if (ret > 0) { - /* Allocate the requested buffer plus space for the NUL character. */ + // Allocate the requested buffer plus space for the NUL character. wbuf = alloc(ret + sizeof(WCHAR)); if (wbuf != NULL) { @@ -5650,19 +5652,19 @@ GetCompositionString_inUCS2(HIMC hIMC, DWORD GCS, int *lenp) return (short_u *)wbuf; } - /* ret < 0; we got an error, so try the ANSI version. This'll work - * on 9x/ME, but only if the codepage happens to be set to whatever - * we're inputting. */ + // ret < 0; we got an error, so try the ANSI version. This'll work + // on 9x/ME, but only if the codepage happens to be set to whatever + // we're inputting. ret = pImmGetCompositionStringA(hIMC, GCS, NULL, 0); if (ret <= 0) - return NULL; /* empty or error */ + return NULL; // empty or error buf = alloc(ret); if (buf == NULL) return NULL; pImmGetCompositionStringA(hIMC, GCS, buf, ret); - /* convert from codepage to UCS-2 */ + // convert from codepage to UCS-2 MultiByteToWideChar_alloc(GetACP(), 0, (LPCSTR)buf, ret, &wbuf, lenp); vim_free(buf); @@ -5678,14 +5680,14 @@ GetCompositionString_inUCS2(HIMC hIMC, DWORD GCS, int *lenp) static char_u * GetResultStr(HWND hwnd, int GCS, int *lenp) { - HIMC hIMC; /* Input context handle. */ + HIMC hIMC; // Input context handle. short_u *buf = NULL; char_u *convbuf = NULL; if (!pImmGetContext || (hIMC = pImmGetContext(hwnd)) == (HIMC)0) return NULL; - /* Reads in the composition string. */ + // Reads in the composition string. buf = GetCompositionString_inUCS2(hIMC, GCS, lenp); if (buf == NULL) return NULL; @@ -5697,7 +5699,7 @@ GetResultStr(HWND hwnd, int GCS, int *lenp) } #endif -/* For global functions we need prototypes. */ +// For global functions we need prototypes. #if defined(FEAT_MBYTE_IME) || defined(PROTO) /* @@ -5754,7 +5756,7 @@ im_set_active(int active) } # endif - if (pImmGetContext) /* if NULL imm32.dll wasn't loaded (yet) */ + if (pImmGetContext) // if NULL imm32.dll wasn't loaded (yet) { if (p_imdisable) { @@ -5787,7 +5789,7 @@ im_set_active(int active) if (active) { - /* if we have a saved conversion status, restore it */ + // if we have a saved conversion status, restore it if (bSaved) pImmSetConversionStatus(hImc, dwConversionSaved, dwSentenceSaved); @@ -5795,7 +5797,7 @@ im_set_active(int active) } else { - /* save conversion status and disable korean */ + // save conversion status and disable korean if (pImmGetConversionStatus(hImc, &dwConversionSaved, &dwSentenceSaved)) { @@ -5836,10 +5838,10 @@ im_get_status(void) return status; } -#endif /* FEAT_MBYTE_IME */ +#endif // FEAT_MBYTE_IME #if !defined(FEAT_MBYTE_IME) && defined(GLOBAL_IME) -/* Win32 with GLOBAL IME */ +// Win32 with GLOBAL IME /* * Notify cursor position to IM. @@ -5847,7 +5849,7 @@ im_get_status(void) void im_set_position(int row, int col) { - /* Win32 with GLOBAL IME */ + // Win32 with GLOBAL IME POINT p; p.x = FILL_X(col); @@ -5888,14 +5890,14 @@ latin9_to_ucs(char_u *text, int len, WCHAR *unicodebuf) c = *text++; switch (c) { - case 0xa4: c = 0x20ac; break; /* euro */ - case 0xa6: c = 0x0160; break; /* S hat */ - case 0xa8: c = 0x0161; break; /* S -hat */ - case 0xb4: c = 0x017d; break; /* Z hat */ - case 0xb8: c = 0x017e; break; /* Z -hat */ - case 0xbc: c = 0x0152; break; /* OE */ - case 0xbd: c = 0x0153; break; /* oe */ - case 0xbe: c = 0x0178; break; /* Y */ + case 0xa4: c = 0x20ac; break; // euro + case 0xa6: c = 0x0160; break; // S hat + case 0xa8: c = 0x0161; break; // S -hat + case 0xb4: c = 0x017d; break; // Z hat + case 0xb8: c = 0x017e; break; // Z -hat + case 0xbc: c = 0x0152; break; // OE + case 0xbd: c = 0x0153; break; // oe + case 0xbe: c = 0x0178; break; // Y } *unicodebuf++ = c; } @@ -5949,7 +5951,7 @@ draw_line( HPEN hpen = CreatePen(PS_SOLID, 1, color); HPEN old_pen = SelectObject(s_hdc, hpen); MoveToEx(s_hdc, x1, y1, NULL); - /* Note: LineTo() excludes the last pixel in the line. */ + // Note: LineTo() excludes the last pixel in the line. LineTo(s_hdc, x2, y2); DeleteObject(SelectObject(s_hdc, old_pen)); } @@ -6041,15 +6043,15 @@ gui_mch_draw_string( rc.top = FILL_Y(row); if (has_mbyte) { - /* Compute the length in display cells. */ + // Compute the length in display cells. rc.right = FILL_X(col + mb_string2cells(text, len)); } else rc.right = FILL_X(col + len); rc.bottom = FILL_Y(row + 1); - /* Cache the created brush, that saves a lot of time. We need two: - * one for cursor background and one for the normal background. */ + // Cache the created brush, that saves a lot of time. We need two: + // one for cursor background and one for the normal background. if (gui.currBgColor == brush_color[0]) { hbr = hbr_cache[0]; @@ -6097,8 +6099,8 @@ gui_mch_draw_string( vim_free(padding); pad_size = Columns; - /* Don't give an out-of-memory message here, it would call us - * recursively. */ + // Don't give an out-of-memory message here, it would call us + // recursively. padding = LALLOC_MULT(int, pad_size); if (padding != NULL) for (i = 0; i < pad_size; i++) @@ -6112,24 +6114,24 @@ gui_mch_draw_string( * No check for DRAW_BOLD, Windows will have done it already. */ - /* Check if there are any UTF-8 characters. If not, use normal text - * output to speed up output. */ + // Check if there are any UTF-8 characters. If not, use normal text + // output to speed up output. if (enc_utf8) for (n = 0; n < len; ++n) if (text[n] >= 0x80) break; #if defined(FEAT_DIRECTX) - /* Quick hack to enable DirectWrite. To use DirectWrite (antialias), it is - * required that unicode drawing routine, currently. So this forces it - * enabled. */ + // Quick hack to enable DirectWrite. To use DirectWrite (antialias), it is + // required that unicode drawing routine, currently. So this forces it + // enabled. if (IS_ENABLE_DIRECTX()) - n = 0; /* Keep n < len, to enter block for unicode. */ + n = 0; // Keep n < len, to enter block for unicode. #endif - /* Check if the Unicode buffer exists and is big enough. Create it - * with the same length as the multi-byte string, the number of wide - * characters is always equal or smaller. */ + // Check if the Unicode buffer exists and is big enough. Create it + // with the same length as the multi-byte string, the number of wide + // characters is always equal or smaller. if ((enc_utf8 || (enc_codepage > 0 && (int)GetACP() != enc_codepage) || enc_latin9) @@ -6146,13 +6148,13 @@ gui_mch_draw_string( if (enc_utf8 && n < len && unicodebuf != NULL) { - /* Output UTF-8 characters. Composing characters should be - * handled here. */ + // Output UTF-8 characters. Composing characters should be + // handled here. int i; - int wlen; /* string length in words */ - int clen; /* string length in characters */ - int cells; /* cell width of string up to composing char */ - int cw; /* width of current cell */ + int wlen; // string length in words + int clen; // string length in characters + int cells; // cell width of string up to composing char + int cw; // width of current cell int c; wlen = 0; @@ -6163,7 +6165,7 @@ gui_mch_draw_string( c = utf_ptr2char(text + i); if (c >= 0x10000) { - /* Turn into UTF-16 encoding. */ + // Turn into UTF-16 encoding. unicodebuf[wlen++] = ((c - 0x10000) >> 10) + 0xD800; unicodebuf[wlen++] = ((c - 0x10000) & 0x3ff) + 0xDC00; } @@ -6177,15 +6179,15 @@ gui_mch_draw_string( else { cw = utf_char2cells(c); - if (cw > 2) /* don't use 4 for unprintable char */ + if (cw > 2) // don't use 4 for unprintable char cw = 1; } if (unicodepdy != NULL) { - /* Use unicodepdy to make characters fit as we expect, even - * when the font uses different widths (e.g., bold character - * is wider). */ + // Use unicodepdy to make characters fit as we expect, even + // when the font uses different widths (e.g., bold character + // is wider). if (c >= 0x10000) { unicodepdy[wlen - 2] = cw * gui.char_width; @@ -6201,7 +6203,7 @@ gui_mch_draw_string( #if defined(FEAT_DIRECTX) if (IS_ENABLE_DIRECTX()) { - /* Add one to "cells" for italics. */ + // Add one to "cells" for italics. DWriteContext_DrawText(s_dwc, unicodebuf, wlen, TEXT_X(col), TEXT_Y(row), FILL_X(cells + 1), FILL_Y(1) - p_linespace, @@ -6212,12 +6214,12 @@ gui_mch_draw_string( #endif ExtTextOutW(s_hdc, TEXT_X(col), TEXT_Y(row), foptions, pcliprect, unicodebuf, wlen, unicodepdy); - len = cells; /* used for underlining */ + len = cells; // used for underlining } else if ((enc_codepage > 0 && (int)GetACP() != enc_codepage) || enc_latin9) { - /* If we want to display codepage data, and the current CP is not the - * ANSI one, we need to go via Unicode. */ + // If we want to display codepage data, and the current CP is not the + // ANSI one, we need to go via Unicode. if (unicodebuf != NULL) { if (enc_latin9) @@ -6229,9 +6231,9 @@ gui_mch_draw_string( (LPWSTR)unicodebuf, unibuflen); if (len != 0) { - /* Use unicodepdy to make characters fit as we expect, even - * when the font uses different widths (e.g., bold character - * is wider). */ + // Use unicodepdy to make characters fit as we expect, even + // when the font uses different widths (e.g., bold character + // is wider). if (unicodepdy != NULL) { int i; @@ -6253,8 +6255,8 @@ gui_mch_draw_string( else { #ifdef FEAT_RIGHTLEFT - /* Windows will mess up RL text, so we have to draw it character by - * character. Only do this if RL is on, since it's slow. */ + // Windows will mess up RL text, so we have to draw it character by + // character. Only do this if RL is on, since it's slow. if (curwin->w_p_rl) RevOut(s_hdc, TEXT_X(col), TEXT_Y(row), foptions, pcliprect, (char *)text, len, padding); @@ -6264,25 +6266,25 @@ gui_mch_draw_string( foptions, pcliprect, (char *)text, len, padding); } - /* Underline */ + // Underline if (flags & DRAW_UNDERL) { - /* When p_linespace is 0, overwrite the bottom row of pixels. - * Otherwise put the line just below the character. */ + // When p_linespace is 0, overwrite the bottom row of pixels. + // Otherwise put the line just below the character. y = FILL_Y(row + 1) - 1; if (p_linespace > 1) y -= p_linespace - 1; draw_line(FILL_X(col), y, FILL_X(col + len), y, gui.currFgColor); } - /* Strikethrough */ + // Strikethrough if (flags & DRAW_STRIKE) { y = FILL_Y(row + 1) - gui.char_height/2; draw_line(FILL_X(col), y, FILL_X(col + len), y, gui.currSpColor); } - /* Undercurl */ + // Undercurl if (flags & DRAW_UNDERC) { int x; @@ -6303,7 +6305,9 @@ gui_mch_draw_string( * Output routines. */ -/* Flush any output to the screen */ +/* + * Flush any output to the screen + */ void gui_mch_flush(void) { @@ -6333,9 +6337,9 @@ gui_mch_get_screen_dimensions(int *screen_w, int *screen_h) - (GetSystemMetrics(SM_CXFRAME) + GetSystemMetrics(SM_CXPADDEDBORDER)) * 2; - /* FIXME: dirty trick: Because the gui_get_base_height() doesn't include - * the menubar for MSwin, we subtract it from the screen height, so that - * the window size can be made to fit on the screen. */ + // FIXME: dirty trick: Because the gui_get_base_height() doesn't include + // the menubar for MSwin, we subtract it from the screen height, so that + // the window size can be made to fit on the screen. *screen_h = workarea_rect.bottom - workarea_rect.top - (GetSystemMetrics(SM_CYFRAME) + GetSystemMetrics(SM_CXPADDEDBORDER)) * 2 @@ -6385,7 +6389,7 @@ gui_mch_add_menu( vim_free(wn); } - /* Fix window size if menu may have wrapped */ + // Fix window size if menu may have wrapped if (parent == NULL) gui_mswin_get_menu_height(!gui.starting); # ifdef FEAT_TEAROFF @@ -6412,7 +6416,7 @@ gui_make_popup(char_u *path_name, int mouse_pos) { POINT p; - /* Find the position of the current cursor */ + // Find the position of the current cursor GetDCOrgEx(s_hdc, &p); if (mouse_pos) { @@ -6442,7 +6446,7 @@ gui_make_tearoff(char_u *path_name) { vimmenu_T *menu = gui_find_menu(path_name); - /* Found the menu, so tear it off. */ + // Found the menu, so tear it off. if (menu != NULL) gui_mch_tearoff(menu->dname, menu, 0xffffL, 0xffffL); } @@ -6549,7 +6553,7 @@ gui_mch_destroy_menu(vimmenu_T *menu) && menu->parent->children != NULL && IsWindow(menu->parent->tearoff_handle)) { - /* This menu must not show up when rebuilding the tearoff window. */ + // This menu must not show up when rebuilding the tearoff window. menu->modes = 0; rebuild_tearoff(menu->parent); } @@ -6561,7 +6565,7 @@ gui_mch_destroy_menu(vimmenu_T *menu) static void rebuild_tearoff(vimmenu_T *menu) { - /*hackish*/ + //hackish char_u tbuf[128]; RECT trect; RECT rct; @@ -6595,7 +6599,7 @@ rebuild_tearoff(vimmenu_T *menu) SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); } } -# endif /* FEAT_TEAROFF */ +# endif // FEAT_TEAROFF /* * Make a menu either grey or not grey. @@ -6640,10 +6644,10 @@ gui_mch_menu_grey( # endif } -#endif /* FEAT_MENU */ +#endif // FEAT_MENU -/* define some macros used to make the dialogue creation more readable */ +// define some macros used to make the dialogue creation more readable #define add_string(s) strcpy((LPSTR)p, s); (LPSTR)p += (strlen((LPSTR)p) + 1) #define add_word(x) *p++ = (x) @@ -6671,13 +6675,13 @@ dialog_callback( if (message == WM_INITDIALOG) { CenterWindow(hwnd, GetWindow(hwnd, GW_OWNER)); - /* Set focus to the dialog. Set the default button, if specified. */ + // Set focus to the dialog. Set the default button, if specified. (void)SetFocus(hwnd); if (dialog_default_button > IDCANCEL) (void)SetFocus(GetDlgItem(hwnd, dialog_default_button)); else - /* We don't have a default, set focus on another element of the - * dialog window, probably the icon */ + // We don't have a default, set focus on another element of the + // dialog window, probably the icon (void)SetFocus(GetDlgItem(hwnd, DLG_NONBUTTON_CONTROL)); return FALSE; } @@ -6686,13 +6690,12 @@ dialog_callback( { int button = LOWORD(wParam); - /* Don't end the dialog if something was selected that was - * not a button. - */ + // Don't end the dialog if something was selected that was + // not a button. if (button >= DLG_NONBUTTON_CONTROL) return TRUE; - /* If the edit box exists, copy the string. */ + // If the edit box exists, copy the string. if (s_textfield != NULL) { WCHAR *wp = ALLOC_MULT(WCHAR, IOSIZE); @@ -6744,7 +6747,7 @@ dialog_callback( * If stubbing out this fn, return 1. */ -static const char *dlg_icons[] = /* must match names in resource file */ +static const char *dlg_icons[] = // must match names in resource file { "IDR_VIM", "IDR_VIM_ERROR", @@ -6800,12 +6803,12 @@ gui_mch_dialog( int l; # ifndef NO_CONSOLE - /* Don't output anything in silent mode ("ex -s") */ + // Don't output anything in silent mode ("ex -s") # ifdef VIMDLL if (!(gui.in_use || gui.starting)) # endif if (silent_mode) - return dfltbutton; /* return default option */ + return dfltbutton; // return default option # endif if (s_hwnd == NULL) @@ -6814,8 +6817,8 @@ gui_mch_dialog( if ((type < 0) || (type > VIM_LAST_TYPE)) type = 0; - /* allocate some memory for dialog template */ - /* TODO should compute this really */ + // allocate some memory for dialog template + // TODO should compute this really pdlgtemplate = p = (PWORD)LocalAlloc(LPTR, DLG_ALLOC_SIZE + STRLEN(message) * 2); @@ -6831,9 +6834,9 @@ gui_mch_dialog( if (tbuffer == NULL) return -1; - --dfltbutton; /* Change from one-based to zero-based */ + --dfltbutton; // Change from one-based to zero-based - /* Count buttons */ + // Count buttons numButtons = 1; for (i = 0; tbuffer[i] != '\0'; i++) { @@ -6843,12 +6846,12 @@ gui_mch_dialog( if (dfltbutton >= numButtons) dfltbutton = -1; - /* Allocate array to hold the width of each button */ + // Allocate array to hold the width of each button buttonWidths = ALLOC_MULT(int, numButtons); if (buttonWidths == NULL) return -1; - /* Allocate array to hold the X position of each button */ + // Allocate array to hold the X position of each button buttonPositions = ALLOC_MULT(int, numButtons); if (buttonPositions == NULL) return -1; @@ -6883,25 +6886,25 @@ gui_mch_dialog( GetTextMetrics(hdc, &fontInfo); fontHeight = fontInfo.tmHeight; - /* Minimum width for horizontal button */ + // Minimum width for horizontal button minButtonWidth = GetTextWidth(hdc, (char_u *)"Cancel", 6); - /* Maximum width of a dialog, if possible */ + // Maximum width of a dialog, if possible if (s_hwnd == NULL) { RECT workarea_rect; - /* We don't have a window, use the desktop area. */ + // We don't have a window, use the desktop area. get_work_area(&workarea_rect); maxDialogWidth = workarea_rect.right - workarea_rect.left - 100; if (maxDialogWidth > 600) maxDialogWidth = 600; - /* Leave some room for the taskbar. */ + // Leave some room for the taskbar. maxDialogHeight = workarea_rect.bottom - workarea_rect.top - 150; } else { - /* Use our own window for the size, unless it's very small. */ + // Use our own window for the size, unless it's very small. GetWindowRect(s_hwnd, &rect); maxDialogWidth = rect.right - rect.left - (GetSystemMetrics(SM_CXFRAME) + @@ -6917,20 +6920,20 @@ gui_mch_dialog( maxDialogHeight = DLG_MIN_MAX_HEIGHT; } - /* Set dlgwidth to width of message. - * Copy the message into "ga", changing NL to CR-NL and inserting line - * breaks where needed. */ + // Set dlgwidth to width of message. + // Copy the message into "ga", changing NL to CR-NL and inserting line + // breaks where needed. pstart = message; messageWidth = 0; msgheight = 0; ga_init2(&ga, sizeof(char), 500); do { - msgheight += fontHeight; /* at least one line */ + msgheight += fontHeight; // at least one line - /* Need to figure out where to break the string. The system does it - * at a word boundary, which would mean we can't compute the number of - * wrapped lines. */ + // Need to figure out where to break the string. The system does it + // at a word boundary, which would mean we can't compute the number of + // wrapped lines. textWidth = 0; last_white = NULL; for (pend = pstart; *pend != NUL && *pend != '\n'; ) @@ -6942,14 +6945,14 @@ gui_mch_dialog( textWidth += GetTextWidthEnc(hdc, pend, l); if (textWidth >= maxDialogWidth) { - /* Line will wrap. */ + // Line will wrap. messageWidth = maxDialogWidth; msgheight += fontHeight; textWidth = 0; if (last_white != NULL) { - /* break the line just after a space */ + // break the line just after a space ga.ga_len -= (int)(pend - (last_white + 1)); pend = last_white + 1; last_white = NULL; @@ -6973,9 +6976,9 @@ gui_mch_dialog( if (ga.ga_data != NULL) message = ga.ga_data; - messageWidth += 10; /* roundoff space */ + messageWidth += 10; // roundoff space - /* Add width of icon to dlgwidth, and some space */ + // Add width of icon to dlgwidth, and some space dlgwidth = messageWidth + DLG_ICON_WIDTH + 3 * dlgPaddingX + GetSystemMetrics(SM_CXVSCROLL); @@ -7001,10 +7004,10 @@ gui_mch_dialog( textWidth = GetTextWidthEnc(hdc, pstart, (int)(pend - pstart)); if (textWidth < minButtonWidth) textWidth = minButtonWidth; - textWidth += dlgPaddingX; /* Padding within button */ + textWidth += dlgPaddingX; // Padding within button buttonWidths[i] = textWidth; buttonPositions[i++] = horizWidth; - horizWidth += textWidth + dlgPaddingX; /* Pad between buttons */ + horizWidth += textWidth + dlgPaddingX; // Pad between buttons pstart = pend + 1; } while (*pend != NUL); @@ -7024,8 +7027,8 @@ gui_mch_dialog( if (pend == NULL) pend = pstart + STRLEN(pstart); // Last button name. textWidth = GetTextWidthEnc(hdc, pstart, (int)(pend - pstart)); - textWidth += dlgPaddingX; /* Padding within button */ - textWidth += DLG_VERT_PADDING_X * 2; /* Padding around button */ + textWidth += dlgPaddingX; // Padding within button + textWidth += DLG_VERT_PADDING_X * 2; // Padding around button if (textWidth > dlgwidth) dlgwidth = textWidth; pstart = pend + 1; @@ -7033,9 +7036,9 @@ gui_mch_dialog( } if (dlgwidth < DLG_MIN_WIDTH) - dlgwidth = DLG_MIN_WIDTH; /* Don't allow a really thin dialog!*/ + dlgwidth = DLG_MIN_WIDTH; // Don't allow a really thin dialog! - /* start to fill in the dlgtemplate information. addressing by WORDs */ + // start to fill in the dlgtemplate information. addressing by WORDs if (s_usenewlook) lStyle = DS_MODALFRAME | WS_CAPTION |DS_3DLOOK| WS_VISIBLE |DS_SETFONT; else @@ -7043,7 +7046,7 @@ gui_mch_dialog( add_long(lStyle); add_long(0); // (lExtendedStyle) - pnumitems = p; /*save where the number of items must be stored*/ + pnumitems = p; //save where the number of items must be stored add_word(0); // NumberOfItems(will change later) add_word(10); // x add_word(10); // y @@ -7061,13 +7064,13 @@ gui_mch_dialog( if (textfield != NULL) dlgheight += editboxheight; - /* Restrict the size to a maximum. Causes a scrollbar to show up. */ + // Restrict the size to a maximum. Causes a scrollbar to show up. if (dlgheight > maxDialogHeight) { msgheight = msgheight - (dlgheight - maxDialogHeight); dlgheight = maxDialogHeight; scroll_flag = WS_VSCROLL; - /* Make sure scrollbar doesn't appear in the middle of the dialog */ + // Make sure scrollbar doesn't appear in the middle of the dialog messageWidth = dlgwidth - DLG_ICON_WIDTH - 3 * dlgPaddingX; } @@ -7076,18 +7079,18 @@ gui_mch_dialog( add_word(0); // Menu add_word(0); // Class - /* copy the title of the dialog */ + // copy the title of the dialog nchar = nCopyAnsiToWideChar(p, (title ? (LPSTR)title : (LPSTR)("Vim "VIM_VERSION_MEDIUM)), TRUE); p += nchar; if (s_usenewlook) { - /* do the font, since DS_3DLOOK doesn't work properly */ + // do the font, since DS_3DLOOK doesn't work properly # ifdef USE_SYSMENU_FONT if (use_lfSysmenu) { - /* point size */ + // point size *p++ = -MulDiv(lfSysmenu.lfHeight, 72, GetDeviceCaps(hdc, LOGPIXELSY)); wcscpy(p, lfSysmenu.lfFaceName); @@ -7109,10 +7112,10 @@ gui_mch_dialog( pstart = tbuffer; if (!vertical) - horizWidth = (dlgwidth - horizWidth) / 2; /* Now it's X offset */ + horizWidth = (dlgwidth - horizWidth) / 2; // Now it's X offset for (i = 0; i < numButtons; i++) { - /* get end of this button. */ + // get end of this button. for ( pend = pstart; *pend && (*pend != DLG_BUTTON_SEP); pend++) @@ -7140,7 +7143,7 @@ gui_mch_dialog( (i == dfltbutton ? BS_DEFPUSHBUTTON : BS_PUSHBUTTON) | WS_TABSTOP, PixelToDialogX(DLG_VERT_PADDING_X), - PixelToDialogY(buttonYpos /* TBK */ + PixelToDialogY(buttonYpos // TBK + 2 * fontHeight * i), PixelToDialogX(dlgwidth - 2 * DLG_VERT_PADDING_X), (WORD)(PixelToDialogY(2 * fontHeight) - 1), @@ -7152,16 +7155,16 @@ gui_mch_dialog( (i == dfltbutton ? BS_DEFPUSHBUTTON : BS_PUSHBUTTON) | WS_TABSTOP, PixelToDialogX(horizWidth + buttonPositions[i]), - PixelToDialogY(buttonYpos), /* TBK */ + PixelToDialogY(buttonYpos), // TBK PixelToDialogX(buttonWidths[i]), (WORD)(PixelToDialogY(2 * fontHeight) - 1), (WORD)(IDCANCEL + 1 + i), (WORD)0x0080, (char *)pstart); } - pstart = pend + 1; /*next button*/ + pstart = pend + 1; //next button } *pnumitems += numButtons; - /* Vim icon */ + // Vim icon p = add_dialog_element(p, SS_ICON, PixelToDialogX(dlgPaddingX), PixelToDialogY(dlgPaddingY), @@ -7170,7 +7173,7 @@ gui_mch_dialog( DLG_NONBUTTON_CONTROL + 0, (WORD)0x0082, dlg_icons[type]); - /* Dialog message */ + // Dialog message p = add_dialog_element(p, ES_LEFT|scroll_flag|ES_MULTILINE|ES_READONLY, PixelToDialogX(2 * dlgPaddingX + DLG_ICON_WIDTH), PixelToDialogY(dlgPaddingY), @@ -7178,7 +7181,7 @@ gui_mch_dialog( PixelToDialogY(msgheight), DLG_NONBUTTON_CONTROL + 1, (WORD)0x0081, (char *)message); - /* Edit box */ + // Edit box if (textfield != NULL) { p = add_dialog_element(p, ES_LEFT|ES_AUTOHSCROLL|WS_TABSTOP|WS_BORDER, @@ -7196,11 +7199,10 @@ gui_mch_dialog( DeleteObject(font); ReleaseDC(hwnd, hdc); - /* Let the dialog_callback() function know which button to make default - * If we have an edit box, make that the default. We also need to tell - * dialog_callback() if this dialog contains an edit box or not. We do - * this by setting s_textfield if it does. - */ + // Let the dialog_callback() function know which button to make default + // If we have an edit box, make that the default. We also need to tell + // dialog_callback() if this dialog contains an edit box or not. We do + // this by setting s_textfield if it does. if (textfield != NULL) { dialog_default_button = DLG_NONBUTTON_CONTROL + 2; @@ -7212,7 +7214,7 @@ gui_mch_dialog( s_textfield = NULL; } - /* show the dialog box modally and get a return value */ + // show the dialog box modally and get a return value nchar = (int)DialogBoxIndirect( g_hinst, (LPDLGTEMPLATE)pdlgtemplate, @@ -7225,13 +7227,13 @@ gui_mch_dialog( vim_free(buttonPositions); vim_free(ga.ga_data); - /* Focus back to our window (for when MDI is used). */ + // Focus back to our window (for when MDI is used). (void)SetFocus(s_hwnd); return nchar; } -#endif /* FEAT_GUI_DIALOG */ +#endif // FEAT_GUI_DIALOG /* * Put a simple element (basic class) onto a dialog template in memory. @@ -7263,7 +7265,7 @@ add_dialog_element( { int nchar; - p = lpwAlign(p); /* Align to dword boundary*/ + p = lpwAlign(p); // Align to dword boundary lStyle = lStyle | WS_VISIBLE | WS_CHILD; *p++ = LOWORD(lStyle); *p++ = HIWORD(lStyle); @@ -7319,13 +7321,13 @@ nCopyAnsiToWideChar( BOOL use_enc) { int nChar = 0; - int len = lstrlen(lpAnsiIn) + 1; /* include NUL character */ + int len = lstrlen(lpAnsiIn) + 1; // include NUL character int i; WCHAR *wn; if (use_enc && enc_codepage >= 0 && (int)GetACP() != enc_codepage) { - /* Not a codepage, use our own conversion function. */ + // Not a codepage, use our own conversion function. wn = enc_to_utf16((char_u *)lpAnsiIn, NULL); if (wn != NULL) { @@ -7335,14 +7337,14 @@ nCopyAnsiToWideChar( } } if (nChar == 0) - /* Use Win32 conversion function. */ + // Use Win32 conversion function. nChar = MultiByteToWideChar( enc_codepage > 0 ? enc_codepage : CP_ACP, MB_PRECOMPOSED, lpAnsiIn, len, lpWCStr, len); for (i = 0; i < nChar; ++i) - if (lpWCStr[i] == (WORD)'\t') /* replace tabs with spaces */ + if (lpWCStr[i] == (WORD)'\t') // replace tabs with spaces lpWCStr[i] = (WORD)' '; return nChar; @@ -7360,7 +7362,7 @@ tearoff_lookup_menuhandle( { for ( ; menu != NULL; menu = menu->next) { - if (menu->modes == 0) /* this menu has just been deleted */ + if (menu->modes == 0) // this menu has just been deleted continue; if (menu_is_separator(menu->dname)) continue; @@ -7388,7 +7390,7 @@ tearoff_callback( return (TRUE); } - /* May show the mouse pointer again. */ + // May show the mouse pointer again. HandleMouseHide(message, lParam); if (message == WM_COMMAND) @@ -7408,7 +7410,7 @@ tearoff_callback( TPM_LEFTALIGN | TPM_LEFTBUTTON, (int)rect.right - 8, (int)mp.y, - (int)0, /*reserved param*/ + (int)0, // reserved param s_hwnd, NULL); /* @@ -7418,7 +7420,7 @@ tearoff_callback( } } else - /* Pass on messages to the main Vim window */ + // Pass on messages to the main Vim window PostMessage(s_hwnd, WM_COMMAND, LOWORD(wParam), 0); /* * Give main window the focus back: this is so after @@ -7434,7 +7436,7 @@ tearoff_callback( return TRUE; } - /* When moved around, give main window the focus back. */ + // When moved around, give main window the focus back. if (message == WM_EXITSIZEMOVE) (void)SetActiveWindow(s_hwnd); @@ -7490,7 +7492,7 @@ get_dialog_font_metrics(void) if (!s_usenewlook) { - dlgFontSize = GetDialogBaseUnits(); /* fall back to big old system*/ + dlgFontSize = GetDialogBaseUnits(); // fall back to big old system s_dlgfntwidth = LOWORD(dlgFontSize); s_dlgfntheight = HIWORD(dlgFontSize); } @@ -7555,8 +7557,8 @@ gui_mch_tearoff( if (*title == MNU_HIDDEN_CHAR) title++; - /* Allocate memory to store the dialog template. It's made bigger when - * needed. */ + // Allocate memory to store the dialog template. It's made bigger when + // needed. template_len = DLG_ALLOC_SIZE; pdlgtemplate = p = (WORD *)LocalAlloc(LPTR, template_len); if (p == NULL) @@ -7579,19 +7581,19 @@ gui_mch_tearoff( else oldFont = SelectFont(hdc, GetStockObject(SYSTEM_FONT)); - /* Calculate width of a single space. Used for padding columns to the - * right width. */ + // Calculate width of a single space. Used for padding columns to the + // right width. spaceWidth = GetTextWidth(hdc, (char_u *)" ", 1); - /* Figure out max width of the text column, the accelerator column and the - * optional submenu column. */ + // Figure out max width of the text column, the accelerator column and the + // optional submenu column. submenuWidth = 0; for (col = 0; col < 2; col++) { columnWidths[col] = 0; for (pmenu = menu->children; pmenu != NULL; pmenu = pmenu->next) { - /* Use "dname" here to compute the width of the visible text. */ + // Use "dname" here to compute the width of the visible text. text = (col == 0) ? pmenu->dname : pmenu->actext; if (text != NULL && *text != NUL) { @@ -7605,7 +7607,7 @@ gui_mch_tearoff( } if (columnWidths[1] == 0) { - /* no accelerators */ + // no accelerators if (submenuWidth != 0) columnWidths[0] += submenuWidth; else @@ -7613,7 +7615,7 @@ gui_mch_tearoff( } else { - /* there is an accelerator column */ + // there is an accelerator column columnWidths[0] += TEAROFF_COLUMN_PADDING * spaceWidth; columnWidths[1] += submenuWidth; } @@ -7633,7 +7635,7 @@ gui_mch_tearoff( dlgwidth = textWidth; dlgwidth += 2 * TEAROFF_PADDING_X + TEAROFF_BUTTON_PAD_X; - /* start to fill in the dlgtemplate information. addressing by WORDs */ + // start to fill in the dlgtemplate information. addressing by WORDs if (s_usenewlook) lStyle = DS_MODALFRAME | WS_CAPTION| WS_SYSMENU |DS_SETFONT| WS_VISIBLE; else @@ -7644,7 +7646,7 @@ gui_mch_tearoff( *p++ = HIWORD(lStyle); *p++ = LOWORD(lExtendedStyle); *p++ = HIWORD(lExtendedStyle); - pnumitems = p; /* save where the number of items must be stored */ + pnumitems = p; // save where the number of items must be stored *p++ = 0; // NumberOfItems(will change later) gui_mch_getmouse(&x, &y); if (initX == 0xffffL) @@ -7661,7 +7663,7 @@ gui_mch_tearoff( *p++ = 0; // Menu *p++ = 0; // Class - /* copy the title of the dialog */ + // copy the title of the dialog nchar = nCopyAnsiToWideChar(p, ((*title) ? (LPSTR)title : (LPSTR)("Vim "VIM_VERSION_MEDIUM)), TRUE); @@ -7669,11 +7671,11 @@ gui_mch_tearoff( if (s_usenewlook) { - /* do the font, since DS_3DLOOK doesn't work properly */ + // do the font, since DS_3DLOOK doesn't work properly # ifdef USE_SYSMENU_FONT if (use_lfSysmenu) { - /* point size */ + // point size *p++ = -MulDiv(lfSysmenu.lfHeight, 72, GetDeviceCaps(hdc, LOGPIXELSY)); wcscpy(p, lfSysmenu.lfFaceName); @@ -7699,7 +7701,7 @@ gui_mch_tearoff( top_menu = menu; for ( ; menu != NULL; menu = menu->next) { - if (menu->modes == 0) /* this menu has just been deleted */ + if (menu->modes == 0) // this menu has just been deleted continue; if (menu_is_separator(menu->dname)) { @@ -7707,8 +7709,8 @@ gui_mch_tearoff( continue; } - /* Check if there still is plenty of room in the template. Make it - * larger when needed. */ + // Check if there still is plenty of room in the template. Make it + // larger when needed. if (((char *)p - (char *)pdlgtemplate) + 1000 > template_len) { WORD *newp; @@ -7727,9 +7729,9 @@ gui_mch_tearoff( } } - /* Figure out minimal length of this menu label. Use "name" for the - * actual text, "dname" for estimating the displayed size. "name" - * has "&a" for mnemonic and includes the accelerator. */ + // Figure out minimal length of this menu label. Use "name" for the + // actual text, "dname" for estimating the displayed size. "name" + // has "&a" for mnemonic and includes the accelerator. len = nameLen = (int)STRLEN(menu->name); padding0 = (columnWidths[0] - GetTextWidthEnc(hdc, menu->dname, (int)STRLEN(menu->dname))) / spaceWidth; @@ -7758,15 +7760,15 @@ gui_mch_tearoff( menuID = (WORD)((long_u)(menu->submenu_id) | (DWORD)0x8000); } - /* Allocate menu label and fill it in */ + // Allocate menu label and fill it in text = label = alloc(len + 1); if (label == NULL) break; vim_strncpy(text, menu->name, nameLen); - text = vim_strchr(text, TAB); /* stop at TAB before actext */ + text = vim_strchr(text, TAB); // stop at TAB before actext if (text == NULL) - text = label + nameLen; /* no actext, use whole name */ + text = label + nameLen; // no actext, use whole name while (padding0-- > 0) *text++ = ' '; if (menu->actext != NULL) @@ -7806,7 +7808,7 @@ gui_mch_tearoff( *ptrueheight = (WORD)(sepPadding + 1 + 13 * (*pnumitems)); - /* show modelessly */ + // show modelessly the_menu->tearoff_handle = CreateDialogIndirectParam( g_hinst, (LPDLGTEMPLATE)pdlgtemplate, @@ -7826,7 +7828,7 @@ gui_mch_tearoff( */ (void)SetActiveWindow(s_hwnd); - /* make sure the right buttons are enabled */ + // make sure the right buttons are enabled force_menu_update = TRUE; } #endif @@ -7834,7 +7836,7 @@ gui_mch_tearoff( #if defined(FEAT_TOOLBAR) || defined(PROTO) # include "gui_w32_rc.h" -/* This not defined in older SDKs */ +// This not defined in older SDKs # ifndef TBSTYLE_FLAT # define TBSTYLE_FLAT 0x0800 # endif @@ -7941,7 +7943,7 @@ get_toolbar_bitmap(vimmenu_T *menu) i = (int)SendMessage(s_toolbarhwnd, TB_ADDBITMAP, (WPARAM)1, (LPARAM)&tbAddBitmap); - /* i will be set to -1 if it fails */ + // i will be set to -1 if it fails } } if (i == -1 && menu->iconidx >= 0 && menu->iconidx < TOOLBAR_BITMAP_COUNT) @@ -7984,7 +7986,7 @@ GetTabFromPoint( { TCHITTESTINFO htinfo; htinfo.pt = pt; - /* ignore if a window under cusor is not tabcontrol. */ + // ignore if a window under cusor is not tabcontrol. if (s_tabhwnd == hWnd) { int idx = TabCtrl_HitTest(s_tabhwnd, &htinfo); @@ -8021,7 +8023,7 @@ tabline_wndproc( s_pt.x = GET_X_LPARAM(lParam); s_pt.y = GET_Y_LPARAM(lParam); SetCapture(hwnd); - s_hCursor = GetCursor(); /* backup default cursor */ + s_hCursor = GetCursor(); // backup default cursor break; } case WM_MOUSEMOVE: @@ -8043,8 +8045,8 @@ tabline_wndproc( TabCtrl_GetItemRect(hwnd, idx1, &rect); nCenter = rect.left + (rect.right - rect.left) / 2; - /* Check if the mouse cursor goes over the center of - * the next tab to prevent "flickering". */ + // Check if the mouse cursor goes over the center of + // the next tab to prevent "flickering". if ((idx0 < idx1) && (nCenter < pt.x)) { tabpage_move(idx1 + 1); @@ -8157,7 +8159,7 @@ typedef struct _signicon_t HANDLE hImage; UINT uType; # ifdef FEAT_XPM_W32 - HANDLE hShape; /* Mask bitmap handle */ + HANDLE hShape; // Mask bitmap handle # endif } signicon_t; @@ -8205,11 +8207,11 @@ gui_mch_drawsign(int row, int col, int typenr) hdcMem = CreateCompatibleDC(s_hdc); hbmpOld = (HBITMAP)SelectObject(hdcMem, sign->hShape); - /* Make hole */ + // Make hole BitBlt(s_hdc, x, y, w, h, hdcMem, 0, 0, SRCAND); SelectObject(hdcMem, sign->hImage); - /* Paint sign */ + // Paint sign BitBlt(s_hdc, x, y, w, h, hdcMem, 0, 0, SRCPAINT); SelectObject(hdcMem, hbmpOld); DeleteDC(hdcMem); @@ -8250,7 +8252,7 @@ gui_mch_register_sign(char_u *signfile) char_u *ext; sign.hImage = NULL; - ext = signfile + STRLEN(signfile) - 4; /* get extension */ + ext = signfile + STRLEN(signfile) - 4; // get extension if (ext > signfile) { int do_load = 1; @@ -8305,7 +8307,8 @@ gui_mch_destroy_sign(void *sign) #if defined(FEAT_BEVAL_GUI) || defined(PROTO) -/* BALLOON-EVAL IMPLEMENTATION FOR WINDOWS. +/* + * BALLOON-EVAL IMPLEMENTATION FOR WINDOWS. * Added by Sergey Khorev <sergey.khorev@gmail.com> * * The only reused thing is beval.h and get_beval_info() @@ -8366,8 +8369,8 @@ multiline_balloon_available(void) } else { - /* there is chance we have ancient CommCtl 4.70 - which doesn't export DllGetVersion */ + // there is chance we have ancient CommCtl 4.70 + // which doesn't export DllGetVersion DWORD dwHandle = 0; DWORD len = GetFileVersionInfoSize(comctl_dll, &dwHandle); if (len > 0) @@ -8500,8 +8503,8 @@ BevalTimerProc( || abs(cur_beval->x - pt.x) > 3 || abs(cur_beval->y - pt.y) > 3)) { - /* Pointer resting in one place long enough, it's time to show - * the tooltip. */ + // Pointer resting in one place long enough, it's time to show + // the tooltip. cur_beval->showState = ShS_PENDING; cur_beval->x = pt.x; cur_beval->y = pt.y; @@ -8554,7 +8557,7 @@ gui_mch_post_balloon(BalloonEval *beval, char_u *mesg) if (abs(beval->x - pt.x) < 3 && abs(beval->y - pt.y) < 3) { - /* cursor is still here */ + // cursor is still here gui_mch_disable_beval_area(cur_beval); beval->showState = ShS_SHOWING; make_tooltip(beval, (char *)mesg, pt); @@ -8564,12 +8567,12 @@ gui_mch_post_balloon(BalloonEval *beval, char_u *mesg) BalloonEval * gui_mch_create_beval_area( - void *target UNUSED, /* ignored, always use s_textArea */ + void *target UNUSED, // ignored, always use s_textArea char_u *mesg, void (*mesgCB)(BalloonEval *, int), void *clientData) { - /* partially stolen from gui_beval.c */ + // partially stolen from gui_beval.c BalloonEval *beval; if (mesg != NULL && mesgCB != NULL) @@ -8600,7 +8603,7 @@ gui_mch_create_beval_area( static void Handle_WM_Notify(HWND hwnd UNUSED, LPNMHDR pnmh) { - if (pnmh->idFrom != ID_BEVAL_TOOLTIP) /* it is not our tooltip */ + if (pnmh->idFrom != ID_BEVAL_TOOLTIP) // it is not our tooltip return; if (cur_beval != NULL) @@ -8611,7 +8614,7 @@ Handle_WM_Notify(HWND hwnd UNUSED, LPNMHDR pnmh) // TRACE0("TTN_SHOW {{{"); // TRACE0("TTN_SHOW }}}"); break; - case TTN_POP: /* Before tooltip disappear */ + case TTN_POP: // Before tooltip disappear // TRACE0("TTN_POP {{{"); delete_tooltip(cur_beval); gui_mch_enable_beval_area(cur_beval); @@ -8621,7 +8624,7 @@ Handle_WM_Notify(HWND hwnd UNUSED, LPNMHDR pnmh) break; case TTN_GETDISPINFO: { - /* if you get there then we have new common controls */ + // if you get there then we have new common controls NMTTDISPINFO_NEW *info = (NMTTDISPINFO_NEW *)pnmh; info->lpszText = (LPSTR)info->lParam; info->uFlags |= TTF_DI_SETITEM; @@ -8656,7 +8659,7 @@ gui_mch_destroy_beval_area(BalloonEval *beval) vim_free(beval->tofree); vim_free(beval); } -#endif /* FEAT_BEVAL_GUI */ +#endif // FEAT_BEVAL_GUI #if defined(FEAT_NETBEANS_INTG) || defined(PROTO) /* |