diff src/gui_w32.c @ 18773:38a3bef525e6 v8.1.2376

patch 8.1.2376: preprocessor indents are incorrect Commit: https://github.com/vim/vim/commit/912bc4a51af0ad947cb39deba2a6fa4ee27af906 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Dec 1 18:58:11 2019 +0100 patch 8.1.2376: preprocessor indents are incorrect Problem: Preprocessor indents are incorrect. Solution: Fix the indents. (Ken Takata, closes https://github.com/vim/vim/issues/5298)
author Bram Moolenaar <Bram@vim.org>
date Sun, 01 Dec 2019 19:00:04 +0100
parents 49b78d6465e5
children e1f4e9d78a6a
line wrap: on
line diff
--- a/src/gui_w32.c
+++ b/src/gui_w32.c
@@ -187,17 +187,17 @@ gui_mch_set_rendering_options(char_u *s)
 /* cproto fails on missing include files */
 #ifndef PROTO
 
-#ifndef __MINGW32__
-# include <shellapi.h>
-#endif
-#if defined(FEAT_TOOLBAR) || defined(FEAT_BEVAL_GUI) || defined(FEAT_GUI_TABLINE)
-# include <commctrl.h>
-#endif
-#include <windowsx.h>
-
-#ifdef GLOBAL_IME
-# include "glbl_ime.h"
-#endif
+# ifndef __MINGW32__
+#  include <shellapi.h>
+# endif
+# if defined(FEAT_TOOLBAR) || defined(FEAT_BEVAL_GUI) || defined(FEAT_GUI_TABLINE)
+#  include <commctrl.h>
+# endif
+# include <windowsx.h>
+
+# ifdef GLOBAL_IME
+#  include "glbl_ime.h"
+# endif
 
 #endif /* PROTO */
 
@@ -2106,10 +2106,10 @@ gui_mch_wait_for_chars(int wtime)
 	    MSG msg;
 
 	    parse_queued_messages();
-#ifdef FEAT_TIMERS
+# ifdef FEAT_TIMERS
 	    if (did_add_timer)
 		break;
-#endif
+# endif
 	    if (pPeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE))
 	    {
 		process_message();
@@ -2392,7 +2392,7 @@ gui_mch_show_toolbar(int showit)
 }
 
 /* The number of bitmaps is fixed.  Exit is missing! */
-#define TOOLBAR_BITMAP_COUNT 31
+# define TOOLBAR_BITMAP_COUNT 31
 
 #endif
 
@@ -2515,10 +2515,10 @@ gui_mch_update_tabline(void)
     if (s_tabhwnd == NULL)
 	return;
 
-#ifndef CCM_SETUNICODEFORMAT
+# ifndef CCM_SETUNICODEFORMAT
     /* For older compilers.  We assume this never changes. */
-# define CCM_SETUNICODEFORMAT 0x2005
-#endif
+#  define CCM_SETUNICODEFORMAT 0x2005
+# endif
     // Enable unicode support
     SendMessage(s_tabhwnd, CCM_SETUNICODEFORMAT, (WPARAM)TRUE, (LPARAM)0);
 
@@ -3502,12 +3502,12 @@ gui_mch_browse(
     filterp = convert_filterW(filter);
 
     vim_memset(&fileStruct, 0, sizeof(OPENFILENAMEW));
-#  ifdef OPENFILENAME_SIZE_VERSION_400W
+# ifdef OPENFILENAME_SIZE_VERSION_400W
     /* be compatible with Windows NT 4.0 */
     fileStruct.lStructSize = OPENFILENAME_SIZE_VERSION_400W;
-#  else
+# else
     fileStruct.lStructSize = sizeof(fileStruct);
-#  endif
+# endif
 
     if (title != NULL)
 	titlep = enc_to_utf16(title, NULL);
@@ -3544,10 +3544,10 @@ gui_mch_browse(
      * Don't use OFN_OVERWRITEPROMPT, Vim has its own ":confirm" dialog.
      */
     fileStruct.Flags = (OFN_NOCHANGEDIR | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY);
-#  ifdef FEAT_SHORTCUT
+# ifdef FEAT_SHORTCUT
     if (curbuf->b_p_bin)
 	fileStruct.Flags |= OFN_NODEREFERENCELINKS;
-#  endif
+# endif
     if (saving)
     {
 	if (!GetSaveFileNameW(&fileStruct))
@@ -3915,7 +3915,7 @@ gui_mch_browsedir(char_u *title, char_u 
 
 /* For the Intellimouse: */
 #ifndef WM_MOUSEWHEEL
-#define WM_MOUSEWHEEL	0x20a
+# define WM_MOUSEWHEEL	0x20a
 #endif
 
 
@@ -3923,12 +3923,12 @@ gui_mch_browsedir(char_u *title, char_u 
 # define ID_BEVAL_TOOLTIP   200
 # define BEVAL_TEXT_LEN	    MAXPATHL
 
-#if (defined(_MSC_VER) && _MSC_VER < 1300) || !defined(MAXULONG_PTR)
+# 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. */
-# undef  UINT_PTR
-# define UINT_PTR UINT
-#endif
+#  undef  UINT_PTR
+#  define UINT_PTR UINT
+# endif
 
 static BalloonEval  *cur_beval = NULL;
 static UINT_PTR	    BevalTimerId = 0;
@@ -3936,15 +3936,15 @@ static DWORD	    LastActivity = 0;
 
 
 /* cproto fails on missing include files */
-#ifndef PROTO
+# ifndef PROTO
 
 /*
  * excerpts from headers since this may not be presented
  * in the extremely old compilers
  */
-# include <pshpack1.h>
-
-#endif
+#  include <pshpack1.h>
+
+# endif
 
 typedef struct _DllVersionInfo
 {
@@ -3955,9 +3955,9 @@ typedef struct _DllVersionInfo
     DWORD dwPlatformID;
 } DLLVERSIONINFO;
 
-#ifndef PROTO
-# include <poppack.h>
-#endif
+# ifndef PROTO
+#  include <poppack.h>
+# endif
 
 typedef struct tagTOOLINFOA_NEW
 {
@@ -4006,17 +4006,17 @@ typedef struct tagNMTTDISPINFOW_NEW
 
 
 typedef HRESULT (WINAPI* DLLGETVERSIONPROC)(DLLVERSIONINFO *);
-#ifndef TTM_SETMAXTIPWIDTH
-# define TTM_SETMAXTIPWIDTH	(WM_USER+24)
-#endif
-
-#ifndef TTF_DI_SETITEM
-# define TTF_DI_SETITEM		0x8000
-#endif
-
-#ifndef TTN_GETDISPINFO
-# define TTN_GETDISPINFO	(TTN_FIRST - 0)
-#endif
+# ifndef TTM_SETMAXTIPWIDTH
+#  define TTM_SETMAXTIPWIDTH	(WM_USER+24)
+# endif
+
+# ifndef TTF_DI_SETITEM
+#  define TTF_DI_SETITEM		0x8000
+# endif
+
+# ifndef TTN_GETDISPINFO
+#  define TTN_GETDISPINFO	(TTN_FIRST - 0)
+# endif
 
 #endif /* defined(FEAT_BEVAL_GUI) */
 
@@ -5570,7 +5570,7 @@ gui_mch_set_sp_color(guicolor_T color)
 		State &= ~LANGMAP;
 		if (State & INSERT)
 		{
-#if defined(FEAT_KEYMAP)
+# if defined(FEAT_KEYMAP)
 		    /* Unshown 'keymap' in status lines */
 		    if (curbuf->b_p_iminsert == B_IMODE_LMAP)
 		    {
@@ -5588,7 +5588,7 @@ gui_mch_set_sp_color(guicolor_T color)
 			gui.row = old_row;
 			gui.col = old_col;
 		    }
-#endif
+# endif
 		}
 	    }
 	    gui_update_cursor(TRUE, FALSE);
@@ -6388,10 +6388,10 @@ gui_mch_add_menu(
     /* Fix window size if menu may have wrapped */
     if (parent == NULL)
 	gui_mswin_get_menu_height(!gui.starting);
-#ifdef FEAT_TEAROFF
+# ifdef FEAT_TEAROFF
     else if (IsWindow(parent->tearoff_handle))
 	rebuild_tearoff(parent);
-#endif
+# endif
 }
 
     void
@@ -6432,7 +6432,7 @@ gui_make_popup(char_u *path_name, int mo
     }
 }
 
-#if defined(FEAT_TEAROFF) || defined(PROTO)
+# if defined(FEAT_TEAROFF) || defined(PROTO)
 /*
  * Given a menu descriptor, e.g. "File.New", find it in the menu hierarchy and
  * create it as a pseudo-"tearoff menu".
@@ -6446,7 +6446,7 @@ gui_make_tearoff(char_u *path_name)
     if (menu != NULL)
 	gui_mch_tearoff(menu->dname, menu, 0xffffL, 0xffffL);
 }
-#endif
+# endif
 
 /*
  * Add a menu item to a menu
@@ -6461,15 +6461,15 @@ gui_mch_add_menu_item(
     menu->id = s_menu_id++;
     menu->submenu_id = NULL;
 
-#ifdef FEAT_TEAROFF
+# ifdef FEAT_TEAROFF
     if (STRNCMP(menu->name, TEAR_STRING, TEAR_LEN) == 0)
     {
 	InsertMenu(parent->submenu_id, (UINT)idx, MF_BITMAP|MF_BYPOSITION,
 		(UINT)menu->id, (LPCTSTR) s_htearbitmap);
     }
     else
-#endif
-#ifdef FEAT_TOOLBAR
+# endif
+# ifdef FEAT_TOOLBAR
     if (menu_is_toolbar(parent->name))
     {
 	TBBUTTON newtb;
@@ -6493,7 +6493,7 @@ gui_mch_add_menu_item(
 	menu->submenu_id = (HMENU)-1;
     }
     else
-#endif
+# endif
     {
 	WCHAR	*wn;
 
@@ -6506,10 +6506,10 @@ gui_mch_add_menu_item(
 		    (UINT)menu->id, wn);
 	    vim_free(wn);
 	}
-#ifdef FEAT_TEAROFF
+# ifdef FEAT_TEAROFF
 	if (IsWindow(parent->tearoff_handle))
 	    rebuild_tearoff(parent);
-#endif
+# endif
     }
 }
 
@@ -6519,7 +6519,7 @@ gui_mch_add_menu_item(
     void
 gui_mch_destroy_menu(vimmenu_T *menu)
 {
-#ifdef FEAT_TOOLBAR
+# ifdef FEAT_TOOLBAR
     /*
      * is this a toolbar button?
      */
@@ -6532,7 +6532,7 @@ gui_mch_destroy_menu(vimmenu_T *menu)
 	SendMessage(s_toolbarhwnd, TB_DELETEBUTTON, (WPARAM)iButton, 0);
     }
     else
-#endif
+# endif
     {
 	if (menu->parent != NULL
 		&& menu_is_popup(menu->parent->dname)
@@ -6542,7 +6542,7 @@ gui_mch_destroy_menu(vimmenu_T *menu)
 	    RemoveMenu(s_menuBar, menu->id, MF_BYCOMMAND);
 	if (menu->submenu_id != NULL)
 	    DestroyMenu(menu->submenu_id);
-#ifdef FEAT_TEAROFF
+# ifdef FEAT_TEAROFF
 	if (IsWindow(menu->tearoff_handle))
 	    DestroyWindow(menu->tearoff_handle);
 	if (menu->parent != NULL
@@ -6553,11 +6553,11 @@ gui_mch_destroy_menu(vimmenu_T *menu)
 	    menu->modes = 0;
 	    rebuild_tearoff(menu->parent);
 	}
-#endif
-    }
-}
-
-#ifdef FEAT_TEAROFF
+# endif
+    }
+}
+
+# ifdef FEAT_TEAROFF
     static void
 rebuild_tearoff(vimmenu_T *menu)
 {
@@ -6595,7 +6595,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.
@@ -6605,7 +6605,7 @@ gui_mch_menu_grey(
     vimmenu_T	*menu,
     int	    grey)
 {
-#ifdef FEAT_TOOLBAR
+# ifdef FEAT_TOOLBAR
     /*
      * is this a toolbar button?
      */
@@ -6615,11 +6615,11 @@ gui_mch_menu_grey(
 	    (WPARAM)menu->id, (LPARAM) MAKELONG((grey ? FALSE : TRUE), 0) );
     }
     else
-#endif
+# endif
     (void)EnableMenuItem(menu->parent ? menu->parent->submenu_id : s_menuBar,
 		    menu->id, MF_BYCOMMAND | (grey ? MF_GRAYED : MF_ENABLED));
 
-#ifdef FEAT_TEAROFF
+# ifdef FEAT_TEAROFF
     if ((menu->parent != NULL) && (IsWindow(menu->parent->tearoff_handle)))
     {
 	WORD menuID;
@@ -6637,7 +6637,7 @@ gui_mch_menu_grey(
 	    EnableWindow(menuHandle, !grey);
 
     }
-#endif
+# endif
 }
 
 #endif /* FEAT_MENU */
@@ -6792,21 +6792,21 @@ gui_mch_dialog(
     int		vertical;
     int		dlgPaddingX;
     int		dlgPaddingY;
-#ifdef USE_SYSMENU_FONT
+# ifdef USE_SYSMENU_FONT
     LOGFONTW	lfSysmenu;
     int		use_lfSysmenu = FALSE;
-#endif
+# endif
     garray_T	ga;
     int		l;
 
-#ifndef NO_CONSOLE
+# ifndef NO_CONSOLE
     /* Don't output anything in silent mode ("ex -s") */
-# ifdef VIMDLL
+#  ifdef VIMDLL
     if (!(gui.in_use || gui.starting))
-# endif
+#  endif
 	if (silent_mode)
 	    return dfltbutton;   /* return default option */
-#endif
+# endif
 
     if (s_hwnd == NULL)
 	get_dialog_font_metrics();
@@ -6858,14 +6858,14 @@ gui_mch_dialog(
      */
     hwnd = GetDesktopWindow();
     hdc = GetWindowDC(hwnd);
-#ifdef USE_SYSMENU_FONT
+# ifdef USE_SYSMENU_FONT
     if (gui_w32_get_menu_font(&lfSysmenu) == OK)
     {
 	font = CreateFontIndirectW(&lfSysmenu);
 	use_lfSysmenu = TRUE;
     }
     else
-#endif
+# endif
     font = CreateFont(-DLG_FONT_POINT_SIZE, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 		      VARIABLE_PITCH , DLG_FONT_NAME);
     if (s_usenewlook)
@@ -7084,7 +7084,7 @@ gui_mch_dialog(
     if (s_usenewlook)
     {
 	/* do the font, since DS_3DLOOK doesn't work properly */
-#ifdef USE_SYSMENU_FONT
+# ifdef USE_SYSMENU_FONT
 	if (use_lfSysmenu)
 	{
 	    /* point size */
@@ -7094,7 +7094,7 @@ gui_mch_dialog(
 	    nchar = (int)wcslen(lfSysmenu.lfFaceName) + 1;
 	}
 	else
-#endif
+# endif
 	{
 	    *p++ = DLG_FONT_POINT_SIZE;		// point size
 	    nchar = nCopyAnsiToWideChar(p, DLG_FONT_NAME, FALSE);
@@ -7530,10 +7530,10 @@ gui_mch_tearoff(
     int		sepPadding=0;
     int		x;
     int		y;
-#ifdef USE_SYSMENU_FONT
+# ifdef USE_SYSMENU_FONT
     LOGFONTW	lfSysmenu;
     int		use_lfSysmenu = FALSE;
-#endif
+# endif
 
     /*
      * If this menu is already torn off, move it to the mouse position.
@@ -7564,14 +7564,14 @@ gui_mch_tearoff(
 
     hwnd = GetDesktopWindow();
     hdc = GetWindowDC(hwnd);
-#ifdef USE_SYSMENU_FONT
+# ifdef USE_SYSMENU_FONT
     if (gui_w32_get_menu_font(&lfSysmenu) == OK)
     {
 	font = CreateFontIndirectW(&lfSysmenu);
 	use_lfSysmenu = TRUE;
     }
     else
-#endif
+# endif
     font = CreateFont(-DLG_FONT_POINT_SIZE, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 		      VARIABLE_PITCH , DLG_FONT_NAME);
     if (s_usenewlook)
@@ -7670,7 +7670,7 @@ gui_mch_tearoff(
     if (s_usenewlook)
     {
 	/* do the font, since DS_3DLOOK doesn't work properly */
-#ifdef USE_SYSMENU_FONT
+# ifdef USE_SYSMENU_FONT
 	if (use_lfSysmenu)
 	{
 	    /* point size */
@@ -7680,7 +7680,7 @@ gui_mch_tearoff(
 	    nchar = (int)wcslen(lfSysmenu.lfFaceName) + 1;
 	}
 	else
-#endif
+# endif
 	{
 	    *p++ = DLG_FONT_POINT_SIZE;		// point size
 	    nchar = nCopyAnsiToWideChar(p, DLG_FONT_NAME, FALSE);
@@ -7832,7 +7832,7 @@ gui_mch_tearoff(
 #endif
 
 #if defined(FEAT_TOOLBAR) || defined(PROTO)
-#include "gui_w32_rc.h"
+# include "gui_w32_rc.h"
 
 /* This not defined in older SDKs */
 # ifndef TBSTYLE_FLAT
@@ -7918,9 +7918,9 @@ get_toolbar_bitmap(vimmenu_T *menu)
 	 */
 	if (hbitmap == NULL
 		&& (gui_find_bitmap(
-#ifdef FEAT_MULTI_LANG
+# ifdef FEAT_MULTI_LANG
 			    menu->en_dname != NULL ? menu->en_dname :
-#endif
+# endif
 					menu->dname, fname, "bmp") == OK))
 	    hbitmap = LoadImage(
 		    NULL,
@@ -8156,9 +8156,9 @@ typedef struct _signicon_t
 {
     HANDLE	hImage;
     UINT	uType;
-#ifdef FEAT_XPM_W32
+# ifdef FEAT_XPM_W32
     HANDLE	hShape;	/* Mask bitmap handle */
-#endif
+# endif
 } signicon_t;
 
     void
@@ -8170,10 +8170,10 @@ gui_mch_drawsign(int row, int col, int t
     if (!gui.in_use || (sign = (signicon_t *)sign_get_image(typenr)) == NULL)
 	return;
 
-#if defined(FEAT_DIRECTX)
+# if defined(FEAT_DIRECTX)
     if (IS_ENABLE_DIRECTX())
 	DWriteContext_Flush(s_dwc);
-#endif
+# endif
 
     x = TEXT_X(col);
     y = TEXT_Y(row);
@@ -8197,7 +8197,7 @@ gui_mch_drawsign(int row, int col, int t
 	case IMAGE_CURSOR:
 	    DrawIconEx(s_hdc, x, y, (HICON)sign->hImage, w, h, 0, NULL, DI_NORMAL);
 	    break;
-#ifdef FEAT_XPM_W32
+# ifdef FEAT_XPM_W32
 	case IMAGE_XPM:
 	    {
 		HDC hdcMem;
@@ -8215,7 +8215,7 @@ gui_mch_drawsign(int row, int col, int t
 		DeleteDC(hdcMem);
 	    }
 	    break;
-#endif
+# endif
     }
 }
 
@@ -8234,12 +8234,12 @@ close_signicon_image(signicon_t *sign)
 	    case IMAGE_ICON:
 		DestroyIcon((HICON)sign->hImage);
 		break;
-#ifdef FEAT_XPM_W32
+# ifdef FEAT_XPM_W32
 	    case IMAGE_XPM:
 		DeleteObject((HBITMAP)sign->hImage);
 		DeleteObject((HBITMAP)sign->hShape);
 		break;
-#endif
+# endif
 	}
 }
 
@@ -8268,14 +8268,14 @@ gui_mch_register_sign(char_u *signfile)
 	    sign.hImage = (HANDLE)LoadImage(NULL, (LPCSTR)signfile, sign.uType,
 		    gui.char_width * 2, gui.char_height,
 		    LR_LOADFROMFILE | LR_CREATEDIBSECTION);
-#ifdef FEAT_XPM_W32
+# ifdef FEAT_XPM_W32
 	if (!STRICMP(ext, ".xpm"))
 	{
 	    sign.uType = IMAGE_XPM;
 	    LoadXpmImage((char *)signfile, (HBITMAP *)&sign.hImage,
 		    (HBITMAP *)&sign.hShape);
 	}
-#endif
+# endif
     }
 
     psign = NULL;
@@ -8650,9 +8650,9 @@ TrackUserActivity(UINT uMsg)
     void
 gui_mch_destroy_beval_area(BalloonEval *beval)
 {
-#ifdef FEAT_VARTABS
+# ifdef FEAT_VARTABS
     vim_free(beval->vts);
-#endif
+# endif
     vim_free(beval->tofree);
     vim_free(beval);
 }
@@ -8676,10 +8676,10 @@ netbeans_draw_multisign_indicator(int ro
     x = 0;
     y = TEXT_Y(row);
 
-#if defined(FEAT_DIRECTX)
+# if defined(FEAT_DIRECTX)
     if (IS_ENABLE_DIRECTX())
 	DWriteContext_Flush(s_dwc);
-#endif
+# endif
 
     for (i = 0; i < gui.char_height - 3; i++)
 	SetPixel(s_hdc, x+2, y++, gui.currFgColor);