comparison 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
comparison
equal deleted inserted replaced
18772:cddcc348bc5a 18773:38a3bef525e6
185 #endif 185 #endif
186 186
187 /* cproto fails on missing include files */ 187 /* cproto fails on missing include files */
188 #ifndef PROTO 188 #ifndef PROTO
189 189
190 #ifndef __MINGW32__ 190 # ifndef __MINGW32__
191 # include <shellapi.h> 191 # include <shellapi.h>
192 #endif 192 # endif
193 #if defined(FEAT_TOOLBAR) || defined(FEAT_BEVAL_GUI) || defined(FEAT_GUI_TABLINE) 193 # if defined(FEAT_TOOLBAR) || defined(FEAT_BEVAL_GUI) || defined(FEAT_GUI_TABLINE)
194 # include <commctrl.h> 194 # include <commctrl.h>
195 #endif 195 # endif
196 #include <windowsx.h> 196 # include <windowsx.h>
197 197
198 #ifdef GLOBAL_IME 198 # ifdef GLOBAL_IME
199 # include "glbl_ime.h" 199 # include "glbl_ime.h"
200 #endif 200 # endif
201 201
202 #endif /* PROTO */ 202 #endif /* PROTO */
203 203
204 #ifdef FEAT_MENU 204 #ifdef FEAT_MENU
205 # define MENUHINTS /* show menu hints in command line */ 205 # define MENUHINTS /* show menu hints in command line */
2104 for (;;) 2104 for (;;)
2105 { 2105 {
2106 MSG msg; 2106 MSG msg;
2107 2107
2108 parse_queued_messages(); 2108 parse_queued_messages();
2109 #ifdef FEAT_TIMERS 2109 # ifdef FEAT_TIMERS
2110 if (did_add_timer) 2110 if (did_add_timer)
2111 break; 2111 break;
2112 #endif 2112 # endif
2113 if (pPeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) 2113 if (pPeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE))
2114 { 2114 {
2115 process_message(); 2115 process_message();
2116 break; 2116 break;
2117 } 2117 }
2390 else 2390 else
2391 ShowWindow(s_toolbarhwnd, SW_HIDE); 2391 ShowWindow(s_toolbarhwnd, SW_HIDE);
2392 } 2392 }
2393 2393
2394 /* The number of bitmaps is fixed. Exit is missing! */ 2394 /* The number of bitmaps is fixed. Exit is missing! */
2395 #define TOOLBAR_BITMAP_COUNT 31 2395 # define TOOLBAR_BITMAP_COUNT 31
2396 2396
2397 #endif 2397 #endif
2398 2398
2399 #if defined(FEAT_GUI_TABLINE) || defined(PROTO) 2399 #if defined(FEAT_GUI_TABLINE) || defined(PROTO)
2400 static void 2400 static void
2513 WCHAR *wstr = NULL; 2513 WCHAR *wstr = NULL;
2514 2514
2515 if (s_tabhwnd == NULL) 2515 if (s_tabhwnd == NULL)
2516 return; 2516 return;
2517 2517
2518 #ifndef CCM_SETUNICODEFORMAT 2518 # ifndef CCM_SETUNICODEFORMAT
2519 /* For older compilers. We assume this never changes. */ 2519 /* For older compilers. We assume this never changes. */
2520 # define CCM_SETUNICODEFORMAT 0x2005 2520 # define CCM_SETUNICODEFORMAT 0x2005
2521 #endif 2521 # endif
2522 // Enable unicode support 2522 // Enable unicode support
2523 SendMessage(s_tabhwnd, CCM_SETUNICODEFORMAT, (WPARAM)TRUE, (LPARAM)0); 2523 SendMessage(s_tabhwnd, CCM_SETUNICODEFORMAT, (WPARAM)TRUE, (LPARAM)0);
2524 2524
2525 tie.mask = TCIF_TEXT; 2525 tie.mask = TCIF_TEXT;
2526 tie.iImage = -1; 2526 tie.iImage = -1;
3500 3500
3501 /* Convert the filter to Windows format. */ 3501 /* Convert the filter to Windows format. */
3502 filterp = convert_filterW(filter); 3502 filterp = convert_filterW(filter);
3503 3503
3504 vim_memset(&fileStruct, 0, sizeof(OPENFILENAMEW)); 3504 vim_memset(&fileStruct, 0, sizeof(OPENFILENAMEW));
3505 # ifdef OPENFILENAME_SIZE_VERSION_400W 3505 # ifdef OPENFILENAME_SIZE_VERSION_400W
3506 /* be compatible with Windows NT 4.0 */ 3506 /* be compatible with Windows NT 4.0 */
3507 fileStruct.lStructSize = OPENFILENAME_SIZE_VERSION_400W; 3507 fileStruct.lStructSize = OPENFILENAME_SIZE_VERSION_400W;
3508 # else 3508 # else
3509 fileStruct.lStructSize = sizeof(fileStruct); 3509 fileStruct.lStructSize = sizeof(fileStruct);
3510 # endif 3510 # endif
3511 3511
3512 if (title != NULL) 3512 if (title != NULL)
3513 titlep = enc_to_utf16(title, NULL); 3513 titlep = enc_to_utf16(title, NULL);
3514 fileStruct.lpstrTitle = titlep; 3514 fileStruct.lpstrTitle = titlep;
3515 3515
3542 * files that don't exist yet, so I haven't put it in. What about 3542 * files that don't exist yet, so I haven't put it in. What about
3543 * OFN_PATHMUSTEXIST? 3543 * OFN_PATHMUSTEXIST?
3544 * Don't use OFN_OVERWRITEPROMPT, Vim has its own ":confirm" dialog. 3544 * Don't use OFN_OVERWRITEPROMPT, Vim has its own ":confirm" dialog.
3545 */ 3545 */
3546 fileStruct.Flags = (OFN_NOCHANGEDIR | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY); 3546 fileStruct.Flags = (OFN_NOCHANGEDIR | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY);
3547 # ifdef FEAT_SHORTCUT 3547 # ifdef FEAT_SHORTCUT
3548 if (curbuf->b_p_bin) 3548 if (curbuf->b_p_bin)
3549 fileStruct.Flags |= OFN_NODEREFERENCELINKS; 3549 fileStruct.Flags |= OFN_NODEREFERENCELINKS;
3550 # endif 3550 # endif
3551 if (saving) 3551 if (saving)
3552 { 3552 {
3553 if (!GetSaveFileNameW(&fileStruct)) 3553 if (!GetSaveFileNameW(&fileStruct))
3554 return NULL; 3554 return NULL;
3555 } 3555 }
3913 #define TEAROFF_COLUMN_PADDING 3 // # spaces to pad column with. 3913 #define TEAROFF_COLUMN_PADDING 3 // # spaces to pad column with.
3914 3914
3915 3915
3916 /* For the Intellimouse: */ 3916 /* For the Intellimouse: */
3917 #ifndef WM_MOUSEWHEEL 3917 #ifndef WM_MOUSEWHEEL
3918 #define WM_MOUSEWHEEL 0x20a 3918 # define WM_MOUSEWHEEL 0x20a
3919 #endif 3919 #endif
3920 3920
3921 3921
3922 #ifdef FEAT_BEVAL_GUI 3922 #ifdef FEAT_BEVAL_GUI
3923 # define ID_BEVAL_TOOLTIP 200 3923 # define ID_BEVAL_TOOLTIP 200
3924 # define BEVAL_TEXT_LEN MAXPATHL 3924 # define BEVAL_TEXT_LEN MAXPATHL
3925 3925
3926 #if (defined(_MSC_VER) && _MSC_VER < 1300) || !defined(MAXULONG_PTR) 3926 # if (defined(_MSC_VER) && _MSC_VER < 1300) || !defined(MAXULONG_PTR)
3927 /* Work around old versions of basetsd.h which wrongly declares 3927 /* Work around old versions of basetsd.h which wrongly declares
3928 * UINT_PTR as unsigned long. */ 3928 * UINT_PTR as unsigned long. */
3929 # undef UINT_PTR 3929 # undef UINT_PTR
3930 # define UINT_PTR UINT 3930 # define UINT_PTR UINT
3931 #endif 3931 # endif
3932 3932
3933 static BalloonEval *cur_beval = NULL; 3933 static BalloonEval *cur_beval = NULL;
3934 static UINT_PTR BevalTimerId = 0; 3934 static UINT_PTR BevalTimerId = 0;
3935 static DWORD LastActivity = 0; 3935 static DWORD LastActivity = 0;
3936 3936
3937 3937
3938 /* cproto fails on missing include files */ 3938 /* cproto fails on missing include files */
3939 #ifndef PROTO 3939 # ifndef PROTO
3940 3940
3941 /* 3941 /*
3942 * excerpts from headers since this may not be presented 3942 * excerpts from headers since this may not be presented
3943 * in the extremely old compilers 3943 * in the extremely old compilers
3944 */ 3944 */
3945 # include <pshpack1.h> 3945 # include <pshpack1.h>
3946 3946
3947 #endif 3947 # endif
3948 3948
3949 typedef struct _DllVersionInfo 3949 typedef struct _DllVersionInfo
3950 { 3950 {
3951 DWORD cbSize; 3951 DWORD cbSize;
3952 DWORD dwMajorVersion; 3952 DWORD dwMajorVersion;
3953 DWORD dwMinorVersion; 3953 DWORD dwMinorVersion;
3954 DWORD dwBuildNumber; 3954 DWORD dwBuildNumber;
3955 DWORD dwPlatformID; 3955 DWORD dwPlatformID;
3956 } DLLVERSIONINFO; 3956 } DLLVERSIONINFO;
3957 3957
3958 #ifndef PROTO 3958 # ifndef PROTO
3959 # include <poppack.h> 3959 # include <poppack.h>
3960 #endif 3960 # endif
3961 3961
3962 typedef struct tagTOOLINFOA_NEW 3962 typedef struct tagTOOLINFOA_NEW
3963 { 3963 {
3964 UINT cbSize; 3964 UINT cbSize;
3965 UINT uFlags; 3965 UINT uFlags;
4004 LPARAM lParam; 4004 LPARAM lParam;
4005 } NMTTDISPINFOW_NEW; 4005 } NMTTDISPINFOW_NEW;
4006 4006
4007 4007
4008 typedef HRESULT (WINAPI* DLLGETVERSIONPROC)(DLLVERSIONINFO *); 4008 typedef HRESULT (WINAPI* DLLGETVERSIONPROC)(DLLVERSIONINFO *);
4009 #ifndef TTM_SETMAXTIPWIDTH 4009 # ifndef TTM_SETMAXTIPWIDTH
4010 # define TTM_SETMAXTIPWIDTH (WM_USER+24) 4010 # define TTM_SETMAXTIPWIDTH (WM_USER+24)
4011 #endif 4011 # endif
4012 4012
4013 #ifndef TTF_DI_SETITEM 4013 # ifndef TTF_DI_SETITEM
4014 # define TTF_DI_SETITEM 0x8000 4014 # define TTF_DI_SETITEM 0x8000
4015 #endif 4015 # endif
4016 4016
4017 #ifndef TTN_GETDISPINFO 4017 # ifndef TTN_GETDISPINFO
4018 # define TTN_GETDISPINFO (TTN_FIRST - 0) 4018 # define TTN_GETDISPINFO (TTN_FIRST - 0)
4019 #endif 4019 # endif
4020 4020
4021 #endif /* defined(FEAT_BEVAL_GUI) */ 4021 #endif /* defined(FEAT_BEVAL_GUI) */
4022 4022
4023 #if defined(FEAT_TOOLBAR) || defined(FEAT_GUI_TABLINE) 4023 #if defined(FEAT_TOOLBAR) || defined(FEAT_GUI_TABLINE)
4024 /* Older MSVC compilers don't have LPNMTTDISPINFO[AW] thus we need to define 4024 /* Older MSVC compilers don't have LPNMTTDISPINFO[AW] thus we need to define
5568 5568
5569 /* Disable langmap */ 5569 /* Disable langmap */
5570 State &= ~LANGMAP; 5570 State &= ~LANGMAP;
5571 if (State & INSERT) 5571 if (State & INSERT)
5572 { 5572 {
5573 #if defined(FEAT_KEYMAP) 5573 # if defined(FEAT_KEYMAP)
5574 /* Unshown 'keymap' in status lines */ 5574 /* Unshown 'keymap' in status lines */
5575 if (curbuf->b_p_iminsert == B_IMODE_LMAP) 5575 if (curbuf->b_p_iminsert == B_IMODE_LMAP)
5576 { 5576 {
5577 /* Save cursor position */ 5577 /* Save cursor position */
5578 int old_row = gui.row; 5578 int old_row = gui.row;
5586 update_screen(0); 5586 update_screen(0);
5587 /* Restore cursor position */ 5587 /* Restore cursor position */
5588 gui.row = old_row; 5588 gui.row = old_row;
5589 gui.col = old_col; 5589 gui.col = old_col;
5590 } 5590 }
5591 #endif 5591 # endif
5592 } 5592 }
5593 } 5593 }
5594 gui_update_cursor(TRUE, FALSE); 5594 gui_update_cursor(TRUE, FALSE);
5595 gui_mch_flush(); 5595 gui_mch_flush();
5596 lResult = 0; 5596 lResult = 0;
6386 } 6386 }
6387 6387
6388 /* Fix window size if menu may have wrapped */ 6388 /* Fix window size if menu may have wrapped */
6389 if (parent == NULL) 6389 if (parent == NULL)
6390 gui_mswin_get_menu_height(!gui.starting); 6390 gui_mswin_get_menu_height(!gui.starting);
6391 #ifdef FEAT_TEAROFF 6391 # ifdef FEAT_TEAROFF
6392 else if (IsWindow(parent->tearoff_handle)) 6392 else if (IsWindow(parent->tearoff_handle))
6393 rebuild_tearoff(parent); 6393 rebuild_tearoff(parent);
6394 #endif 6394 # endif
6395 } 6395 }
6396 6396
6397 void 6397 void
6398 gui_mch_show_popupmenu(vimmenu_T *menu) 6398 gui_mch_show_popupmenu(vimmenu_T *menu)
6399 { 6399 {
6430 msg_scroll = FALSE; 6430 msg_scroll = FALSE;
6431 gui_mch_show_popupmenu_at(menu, (int)p.x, (int)p.y); 6431 gui_mch_show_popupmenu_at(menu, (int)p.x, (int)p.y);
6432 } 6432 }
6433 } 6433 }
6434 6434
6435 #if defined(FEAT_TEAROFF) || defined(PROTO) 6435 # if defined(FEAT_TEAROFF) || defined(PROTO)
6436 /* 6436 /*
6437 * Given a menu descriptor, e.g. "File.New", find it in the menu hierarchy and 6437 * Given a menu descriptor, e.g. "File.New", find it in the menu hierarchy and
6438 * create it as a pseudo-"tearoff menu". 6438 * create it as a pseudo-"tearoff menu".
6439 */ 6439 */
6440 void 6440 void
6444 6444
6445 /* Found the menu, so tear it off. */ 6445 /* Found the menu, so tear it off. */
6446 if (menu != NULL) 6446 if (menu != NULL)
6447 gui_mch_tearoff(menu->dname, menu, 0xffffL, 0xffffL); 6447 gui_mch_tearoff(menu->dname, menu, 0xffffL, 0xffffL);
6448 } 6448 }
6449 #endif 6449 # endif
6450 6450
6451 /* 6451 /*
6452 * Add a menu item to a menu 6452 * Add a menu item to a menu
6453 */ 6453 */
6454 void 6454 void
6459 vimmenu_T *parent = menu->parent; 6459 vimmenu_T *parent = menu->parent;
6460 6460
6461 menu->id = s_menu_id++; 6461 menu->id = s_menu_id++;
6462 menu->submenu_id = NULL; 6462 menu->submenu_id = NULL;
6463 6463
6464 #ifdef FEAT_TEAROFF 6464 # ifdef FEAT_TEAROFF
6465 if (STRNCMP(menu->name, TEAR_STRING, TEAR_LEN) == 0) 6465 if (STRNCMP(menu->name, TEAR_STRING, TEAR_LEN) == 0)
6466 { 6466 {
6467 InsertMenu(parent->submenu_id, (UINT)idx, MF_BITMAP|MF_BYPOSITION, 6467 InsertMenu(parent->submenu_id, (UINT)idx, MF_BITMAP|MF_BYPOSITION,
6468 (UINT)menu->id, (LPCTSTR) s_htearbitmap); 6468 (UINT)menu->id, (LPCTSTR) s_htearbitmap);
6469 } 6469 }
6470 else 6470 else
6471 #endif 6471 # endif
6472 #ifdef FEAT_TOOLBAR 6472 # ifdef FEAT_TOOLBAR
6473 if (menu_is_toolbar(parent->name)) 6473 if (menu_is_toolbar(parent->name))
6474 { 6474 {
6475 TBBUTTON newtb; 6475 TBBUTTON newtb;
6476 6476
6477 vim_memset(&newtb, 0, sizeof(newtb)); 6477 vim_memset(&newtb, 0, sizeof(newtb));
6491 SendMessage(s_toolbarhwnd, TB_INSERTBUTTON, (WPARAM)idx, 6491 SendMessage(s_toolbarhwnd, TB_INSERTBUTTON, (WPARAM)idx,
6492 (LPARAM)&newtb); 6492 (LPARAM)&newtb);
6493 menu->submenu_id = (HMENU)-1; 6493 menu->submenu_id = (HMENU)-1;
6494 } 6494 }
6495 else 6495 else
6496 #endif 6496 # endif
6497 { 6497 {
6498 WCHAR *wn; 6498 WCHAR *wn;
6499 6499
6500 wn = enc_to_utf16(menu->name, NULL); 6500 wn = enc_to_utf16(menu->name, NULL);
6501 if (wn != NULL) 6501 if (wn != NULL)
6504 (menu_is_separator(menu->name) 6504 (menu_is_separator(menu->name)
6505 ? MF_SEPARATOR : MF_STRING) | MF_BYPOSITION, 6505 ? MF_SEPARATOR : MF_STRING) | MF_BYPOSITION,
6506 (UINT)menu->id, wn); 6506 (UINT)menu->id, wn);
6507 vim_free(wn); 6507 vim_free(wn);
6508 } 6508 }
6509 #ifdef FEAT_TEAROFF 6509 # ifdef FEAT_TEAROFF
6510 if (IsWindow(parent->tearoff_handle)) 6510 if (IsWindow(parent->tearoff_handle))
6511 rebuild_tearoff(parent); 6511 rebuild_tearoff(parent);
6512 #endif 6512 # endif
6513 } 6513 }
6514 } 6514 }
6515 6515
6516 /* 6516 /*
6517 * Destroy the machine specific menu widget. 6517 * Destroy the machine specific menu widget.
6518 */ 6518 */
6519 void 6519 void
6520 gui_mch_destroy_menu(vimmenu_T *menu) 6520 gui_mch_destroy_menu(vimmenu_T *menu)
6521 { 6521 {
6522 #ifdef FEAT_TOOLBAR 6522 # ifdef FEAT_TOOLBAR
6523 /* 6523 /*
6524 * is this a toolbar button? 6524 * is this a toolbar button?
6525 */ 6525 */
6526 if (menu->submenu_id == (HMENU)-1) 6526 if (menu->submenu_id == (HMENU)-1)
6527 { 6527 {
6530 iButton = (int)SendMessage(s_toolbarhwnd, TB_COMMANDTOINDEX, 6530 iButton = (int)SendMessage(s_toolbarhwnd, TB_COMMANDTOINDEX,
6531 (WPARAM)menu->id, 0); 6531 (WPARAM)menu->id, 0);
6532 SendMessage(s_toolbarhwnd, TB_DELETEBUTTON, (WPARAM)iButton, 0); 6532 SendMessage(s_toolbarhwnd, TB_DELETEBUTTON, (WPARAM)iButton, 0);
6533 } 6533 }
6534 else 6534 else
6535 #endif 6535 # endif
6536 { 6536 {
6537 if (menu->parent != NULL 6537 if (menu->parent != NULL
6538 && menu_is_popup(menu->parent->dname) 6538 && menu_is_popup(menu->parent->dname)
6539 && menu->parent->submenu_id != NULL) 6539 && menu->parent->submenu_id != NULL)
6540 RemoveMenu(menu->parent->submenu_id, menu->id, MF_BYCOMMAND); 6540 RemoveMenu(menu->parent->submenu_id, menu->id, MF_BYCOMMAND);
6541 else 6541 else
6542 RemoveMenu(s_menuBar, menu->id, MF_BYCOMMAND); 6542 RemoveMenu(s_menuBar, menu->id, MF_BYCOMMAND);
6543 if (menu->submenu_id != NULL) 6543 if (menu->submenu_id != NULL)
6544 DestroyMenu(menu->submenu_id); 6544 DestroyMenu(menu->submenu_id);
6545 #ifdef FEAT_TEAROFF 6545 # ifdef FEAT_TEAROFF
6546 if (IsWindow(menu->tearoff_handle)) 6546 if (IsWindow(menu->tearoff_handle))
6547 DestroyWindow(menu->tearoff_handle); 6547 DestroyWindow(menu->tearoff_handle);
6548 if (menu->parent != NULL 6548 if (menu->parent != NULL
6549 && menu->parent->children != NULL 6549 && menu->parent->children != NULL
6550 && IsWindow(menu->parent->tearoff_handle)) 6550 && IsWindow(menu->parent->tearoff_handle))
6551 { 6551 {
6552 /* This menu must not show up when rebuilding the tearoff window. */ 6552 /* This menu must not show up when rebuilding the tearoff window. */
6553 menu->modes = 0; 6553 menu->modes = 0;
6554 rebuild_tearoff(menu->parent); 6554 rebuild_tearoff(menu->parent);
6555 } 6555 }
6556 #endif 6556 # endif
6557 } 6557 }
6558 } 6558 }
6559 6559
6560 #ifdef FEAT_TEAROFF 6560 # ifdef FEAT_TEAROFF
6561 static void 6561 static void
6562 rebuild_tearoff(vimmenu_T *menu) 6562 rebuild_tearoff(vimmenu_T *menu)
6563 { 6563 {
6564 /*hackish*/ 6564 /*hackish*/
6565 char_u tbuf[128]; 6565 char_u tbuf[128];
6593 (int)trect.top, 6593 (int)trect.top,
6594 0, 0, 6594 0, 0,
6595 SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); 6595 SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
6596 } 6596 }
6597 } 6597 }
6598 #endif /* FEAT_TEAROFF */ 6598 # endif /* FEAT_TEAROFF */
6599 6599
6600 /* 6600 /*
6601 * Make a menu either grey or not grey. 6601 * Make a menu either grey or not grey.
6602 */ 6602 */
6603 void 6603 void
6604 gui_mch_menu_grey( 6604 gui_mch_menu_grey(
6605 vimmenu_T *menu, 6605 vimmenu_T *menu,
6606 int grey) 6606 int grey)
6607 { 6607 {
6608 #ifdef FEAT_TOOLBAR 6608 # ifdef FEAT_TOOLBAR
6609 /* 6609 /*
6610 * is this a toolbar button? 6610 * is this a toolbar button?
6611 */ 6611 */
6612 if (menu->submenu_id == (HMENU)-1) 6612 if (menu->submenu_id == (HMENU)-1)
6613 { 6613 {
6614 SendMessage(s_toolbarhwnd, TB_ENABLEBUTTON, 6614 SendMessage(s_toolbarhwnd, TB_ENABLEBUTTON,
6615 (WPARAM)menu->id, (LPARAM) MAKELONG((grey ? FALSE : TRUE), 0) ); 6615 (WPARAM)menu->id, (LPARAM) MAKELONG((grey ? FALSE : TRUE), 0) );
6616 } 6616 }
6617 else 6617 else
6618 #endif 6618 # endif
6619 (void)EnableMenuItem(menu->parent ? menu->parent->submenu_id : s_menuBar, 6619 (void)EnableMenuItem(menu->parent ? menu->parent->submenu_id : s_menuBar,
6620 menu->id, MF_BYCOMMAND | (grey ? MF_GRAYED : MF_ENABLED)); 6620 menu->id, MF_BYCOMMAND | (grey ? MF_GRAYED : MF_ENABLED));
6621 6621
6622 #ifdef FEAT_TEAROFF 6622 # ifdef FEAT_TEAROFF
6623 if ((menu->parent != NULL) && (IsWindow(menu->parent->tearoff_handle))) 6623 if ((menu->parent != NULL) && (IsWindow(menu->parent->tearoff_handle)))
6624 { 6624 {
6625 WORD menuID; 6625 WORD menuID;
6626 HWND menuHandle; 6626 HWND menuHandle;
6627 6627
6635 menuHandle = GetDlgItem(menu->parent->tearoff_handle, menuID); 6635 menuHandle = GetDlgItem(menu->parent->tearoff_handle, menuID);
6636 if (menuHandle) 6636 if (menuHandle)
6637 EnableWindow(menuHandle, !grey); 6637 EnableWindow(menuHandle, !grey);
6638 6638
6639 } 6639 }
6640 #endif 6640 # endif
6641 } 6641 }
6642 6642
6643 #endif /* FEAT_MENU */ 6643 #endif /* FEAT_MENU */
6644 6644
6645 6645
6790 int maxDialogHeight; 6790 int maxDialogHeight;
6791 int scroll_flag = 0; 6791 int scroll_flag = 0;
6792 int vertical; 6792 int vertical;
6793 int dlgPaddingX; 6793 int dlgPaddingX;
6794 int dlgPaddingY; 6794 int dlgPaddingY;
6795 #ifdef USE_SYSMENU_FONT 6795 # ifdef USE_SYSMENU_FONT
6796 LOGFONTW lfSysmenu; 6796 LOGFONTW lfSysmenu;
6797 int use_lfSysmenu = FALSE; 6797 int use_lfSysmenu = FALSE;
6798 #endif 6798 # endif
6799 garray_T ga; 6799 garray_T ga;
6800 int l; 6800 int l;
6801 6801
6802 #ifndef NO_CONSOLE 6802 # ifndef NO_CONSOLE
6803 /* Don't output anything in silent mode ("ex -s") */ 6803 /* Don't output anything in silent mode ("ex -s") */
6804 # ifdef VIMDLL 6804 # ifdef VIMDLL
6805 if (!(gui.in_use || gui.starting)) 6805 if (!(gui.in_use || gui.starting))
6806 # endif 6806 # endif
6807 if (silent_mode) 6807 if (silent_mode)
6808 return dfltbutton; /* return default option */ 6808 return dfltbutton; /* return default option */
6809 #endif 6809 # endif
6810 6810
6811 if (s_hwnd == NULL) 6811 if (s_hwnd == NULL)
6812 get_dialog_font_metrics(); 6812 get_dialog_font_metrics();
6813 6813
6814 if ((type < 0) || (type > VIM_LAST_TYPE)) 6814 if ((type < 0) || (type > VIM_LAST_TYPE))
6856 /* 6856 /*
6857 * Calculate how big the dialog must be. 6857 * Calculate how big the dialog must be.
6858 */ 6858 */
6859 hwnd = GetDesktopWindow(); 6859 hwnd = GetDesktopWindow();
6860 hdc = GetWindowDC(hwnd); 6860 hdc = GetWindowDC(hwnd);
6861 #ifdef USE_SYSMENU_FONT 6861 # ifdef USE_SYSMENU_FONT
6862 if (gui_w32_get_menu_font(&lfSysmenu) == OK) 6862 if (gui_w32_get_menu_font(&lfSysmenu) == OK)
6863 { 6863 {
6864 font = CreateFontIndirectW(&lfSysmenu); 6864 font = CreateFontIndirectW(&lfSysmenu);
6865 use_lfSysmenu = TRUE; 6865 use_lfSysmenu = TRUE;
6866 } 6866 }
6867 else 6867 else
6868 #endif 6868 # endif
6869 font = CreateFont(-DLG_FONT_POINT_SIZE, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6869 font = CreateFont(-DLG_FONT_POINT_SIZE, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
6870 VARIABLE_PITCH , DLG_FONT_NAME); 6870 VARIABLE_PITCH , DLG_FONT_NAME);
6871 if (s_usenewlook) 6871 if (s_usenewlook)
6872 { 6872 {
6873 oldFont = SelectFont(hdc, font); 6873 oldFont = SelectFont(hdc, font);
7082 p += nchar; 7082 p += nchar;
7083 7083
7084 if (s_usenewlook) 7084 if (s_usenewlook)
7085 { 7085 {
7086 /* do the font, since DS_3DLOOK doesn't work properly */ 7086 /* do the font, since DS_3DLOOK doesn't work properly */
7087 #ifdef USE_SYSMENU_FONT 7087 # ifdef USE_SYSMENU_FONT
7088 if (use_lfSysmenu) 7088 if (use_lfSysmenu)
7089 { 7089 {
7090 /* point size */ 7090 /* point size */
7091 *p++ = -MulDiv(lfSysmenu.lfHeight, 72, 7091 *p++ = -MulDiv(lfSysmenu.lfHeight, 72,
7092 GetDeviceCaps(hdc, LOGPIXELSY)); 7092 GetDeviceCaps(hdc, LOGPIXELSY));
7093 wcscpy(p, lfSysmenu.lfFaceName); 7093 wcscpy(p, lfSysmenu.lfFaceName);
7094 nchar = (int)wcslen(lfSysmenu.lfFaceName) + 1; 7094 nchar = (int)wcslen(lfSysmenu.lfFaceName) + 1;
7095 } 7095 }
7096 else 7096 else
7097 #endif 7097 # endif
7098 { 7098 {
7099 *p++ = DLG_FONT_POINT_SIZE; // point size 7099 *p++ = DLG_FONT_POINT_SIZE; // point size
7100 nchar = nCopyAnsiToWideChar(p, DLG_FONT_NAME, FALSE); 7100 nchar = nCopyAnsiToWideChar(p, DLG_FONT_NAME, FALSE);
7101 } 7101 }
7102 p += nchar; 7102 p += nchar;
7528 int nameLen; 7528 int nameLen;
7529 int padding0, padding1, padding2 = 0; 7529 int padding0, padding1, padding2 = 0;
7530 int sepPadding=0; 7530 int sepPadding=0;
7531 int x; 7531 int x;
7532 int y; 7532 int y;
7533 #ifdef USE_SYSMENU_FONT 7533 # ifdef USE_SYSMENU_FONT
7534 LOGFONTW lfSysmenu; 7534 LOGFONTW lfSysmenu;
7535 int use_lfSysmenu = FALSE; 7535 int use_lfSysmenu = FALSE;
7536 #endif 7536 # endif
7537 7537
7538 /* 7538 /*
7539 * If this menu is already torn off, move it to the mouse position. 7539 * If this menu is already torn off, move it to the mouse position.
7540 */ 7540 */
7541 if (IsWindow(menu->tearoff_handle)) 7541 if (IsWindow(menu->tearoff_handle))
7562 if (p == NULL) 7562 if (p == NULL)
7563 return; 7563 return;
7564 7564
7565 hwnd = GetDesktopWindow(); 7565 hwnd = GetDesktopWindow();
7566 hdc = GetWindowDC(hwnd); 7566 hdc = GetWindowDC(hwnd);
7567 #ifdef USE_SYSMENU_FONT 7567 # ifdef USE_SYSMENU_FONT
7568 if (gui_w32_get_menu_font(&lfSysmenu) == OK) 7568 if (gui_w32_get_menu_font(&lfSysmenu) == OK)
7569 { 7569 {
7570 font = CreateFontIndirectW(&lfSysmenu); 7570 font = CreateFontIndirectW(&lfSysmenu);
7571 use_lfSysmenu = TRUE; 7571 use_lfSysmenu = TRUE;
7572 } 7572 }
7573 else 7573 else
7574 #endif 7574 # endif
7575 font = CreateFont(-DLG_FONT_POINT_SIZE, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7575 font = CreateFont(-DLG_FONT_POINT_SIZE, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
7576 VARIABLE_PITCH , DLG_FONT_NAME); 7576 VARIABLE_PITCH , DLG_FONT_NAME);
7577 if (s_usenewlook) 7577 if (s_usenewlook)
7578 oldFont = SelectFont(hdc, font); 7578 oldFont = SelectFont(hdc, font);
7579 else 7579 else
7668 p += nchar; 7668 p += nchar;
7669 7669
7670 if (s_usenewlook) 7670 if (s_usenewlook)
7671 { 7671 {
7672 /* do the font, since DS_3DLOOK doesn't work properly */ 7672 /* do the font, since DS_3DLOOK doesn't work properly */
7673 #ifdef USE_SYSMENU_FONT 7673 # ifdef USE_SYSMENU_FONT
7674 if (use_lfSysmenu) 7674 if (use_lfSysmenu)
7675 { 7675 {
7676 /* point size */ 7676 /* point size */
7677 *p++ = -MulDiv(lfSysmenu.lfHeight, 72, 7677 *p++ = -MulDiv(lfSysmenu.lfHeight, 72,
7678 GetDeviceCaps(hdc, LOGPIXELSY)); 7678 GetDeviceCaps(hdc, LOGPIXELSY));
7679 wcscpy(p, lfSysmenu.lfFaceName); 7679 wcscpy(p, lfSysmenu.lfFaceName);
7680 nchar = (int)wcslen(lfSysmenu.lfFaceName) + 1; 7680 nchar = (int)wcslen(lfSysmenu.lfFaceName) + 1;
7681 } 7681 }
7682 else 7682 else
7683 #endif 7683 # endif
7684 { 7684 {
7685 *p++ = DLG_FONT_POINT_SIZE; // point size 7685 *p++ = DLG_FONT_POINT_SIZE; // point size
7686 nchar = nCopyAnsiToWideChar(p, DLG_FONT_NAME, FALSE); 7686 nchar = nCopyAnsiToWideChar(p, DLG_FONT_NAME, FALSE);
7687 } 7687 }
7688 p += nchar; 7688 p += nchar;
7830 force_menu_update = TRUE; 7830 force_menu_update = TRUE;
7831 } 7831 }
7832 #endif 7832 #endif
7833 7833
7834 #if defined(FEAT_TOOLBAR) || defined(PROTO) 7834 #if defined(FEAT_TOOLBAR) || defined(PROTO)
7835 #include "gui_w32_rc.h" 7835 # include "gui_w32_rc.h"
7836 7836
7837 /* This not defined in older SDKs */ 7837 /* This not defined in older SDKs */
7838 # ifndef TBSTYLE_FLAT 7838 # ifndef TBSTYLE_FLAT
7839 # define TBSTYLE_FLAT 0x0800 7839 # define TBSTYLE_FLAT 0x0800
7840 # endif 7840 # endif
7916 * If the LoadImage call failed, or the "icon=" file 7916 * If the LoadImage call failed, or the "icon=" file
7917 * didn't exist or wasn't specified, try the menu name 7917 * didn't exist or wasn't specified, try the menu name
7918 */ 7918 */
7919 if (hbitmap == NULL 7919 if (hbitmap == NULL
7920 && (gui_find_bitmap( 7920 && (gui_find_bitmap(
7921 #ifdef FEAT_MULTI_LANG 7921 # ifdef FEAT_MULTI_LANG
7922 menu->en_dname != NULL ? menu->en_dname : 7922 menu->en_dname != NULL ? menu->en_dname :
7923 #endif 7923 # endif
7924 menu->dname, fname, "bmp") == OK)) 7924 menu->dname, fname, "bmp") == OK))
7925 hbitmap = LoadImage( 7925 hbitmap = LoadImage(
7926 NULL, 7926 NULL,
7927 (LPCSTR)fname, 7927 (LPCSTR)fname,
7928 IMAGE_BITMAP, 7928 IMAGE_BITMAP,
8154 8154
8155 typedef struct _signicon_t 8155 typedef struct _signicon_t
8156 { 8156 {
8157 HANDLE hImage; 8157 HANDLE hImage;
8158 UINT uType; 8158 UINT uType;
8159 #ifdef FEAT_XPM_W32 8159 # ifdef FEAT_XPM_W32
8160 HANDLE hShape; /* Mask bitmap handle */ 8160 HANDLE hShape; /* Mask bitmap handle */
8161 #endif 8161 # endif
8162 } signicon_t; 8162 } signicon_t;
8163 8163
8164 void 8164 void
8165 gui_mch_drawsign(int row, int col, int typenr) 8165 gui_mch_drawsign(int row, int col, int typenr)
8166 { 8166 {
8168 int x, y, w, h; 8168 int x, y, w, h;
8169 8169
8170 if (!gui.in_use || (sign = (signicon_t *)sign_get_image(typenr)) == NULL) 8170 if (!gui.in_use || (sign = (signicon_t *)sign_get_image(typenr)) == NULL)
8171 return; 8171 return;
8172 8172
8173 #if defined(FEAT_DIRECTX) 8173 # if defined(FEAT_DIRECTX)
8174 if (IS_ENABLE_DIRECTX()) 8174 if (IS_ENABLE_DIRECTX())
8175 DWriteContext_Flush(s_dwc); 8175 DWriteContext_Flush(s_dwc);
8176 #endif 8176 # endif
8177 8177
8178 x = TEXT_X(col); 8178 x = TEXT_X(col);
8179 y = TEXT_Y(row); 8179 y = TEXT_Y(row);
8180 w = gui.char_width * 2; 8180 w = gui.char_width * 2;
8181 h = gui.char_height; 8181 h = gui.char_height;
8195 break; 8195 break;
8196 case IMAGE_ICON: 8196 case IMAGE_ICON:
8197 case IMAGE_CURSOR: 8197 case IMAGE_CURSOR:
8198 DrawIconEx(s_hdc, x, y, (HICON)sign->hImage, w, h, 0, NULL, DI_NORMAL); 8198 DrawIconEx(s_hdc, x, y, (HICON)sign->hImage, w, h, 0, NULL, DI_NORMAL);
8199 break; 8199 break;
8200 #ifdef FEAT_XPM_W32 8200 # ifdef FEAT_XPM_W32
8201 case IMAGE_XPM: 8201 case IMAGE_XPM:
8202 { 8202 {
8203 HDC hdcMem; 8203 HDC hdcMem;
8204 HBITMAP hbmpOld; 8204 HBITMAP hbmpOld;
8205 8205
8213 BitBlt(s_hdc, x, y, w, h, hdcMem, 0, 0, SRCPAINT); 8213 BitBlt(s_hdc, x, y, w, h, hdcMem, 0, 0, SRCPAINT);
8214 SelectObject(hdcMem, hbmpOld); 8214 SelectObject(hdcMem, hbmpOld);
8215 DeleteDC(hdcMem); 8215 DeleteDC(hdcMem);
8216 } 8216 }
8217 break; 8217 break;
8218 #endif 8218 # endif
8219 } 8219 }
8220 } 8220 }
8221 8221
8222 static void 8222 static void
8223 close_signicon_image(signicon_t *sign) 8223 close_signicon_image(signicon_t *sign)
8232 DestroyCursor((HCURSOR)sign->hImage); 8232 DestroyCursor((HCURSOR)sign->hImage);
8233 break; 8233 break;
8234 case IMAGE_ICON: 8234 case IMAGE_ICON:
8235 DestroyIcon((HICON)sign->hImage); 8235 DestroyIcon((HICON)sign->hImage);
8236 break; 8236 break;
8237 #ifdef FEAT_XPM_W32 8237 # ifdef FEAT_XPM_W32
8238 case IMAGE_XPM: 8238 case IMAGE_XPM:
8239 DeleteObject((HBITMAP)sign->hImage); 8239 DeleteObject((HBITMAP)sign->hImage);
8240 DeleteObject((HBITMAP)sign->hShape); 8240 DeleteObject((HBITMAP)sign->hShape);
8241 break; 8241 break;
8242 #endif 8242 # endif
8243 } 8243 }
8244 } 8244 }
8245 8245
8246 void * 8246 void *
8247 gui_mch_register_sign(char_u *signfile) 8247 gui_mch_register_sign(char_u *signfile)
8266 8266
8267 if (do_load) 8267 if (do_load)
8268 sign.hImage = (HANDLE)LoadImage(NULL, (LPCSTR)signfile, sign.uType, 8268 sign.hImage = (HANDLE)LoadImage(NULL, (LPCSTR)signfile, sign.uType,
8269 gui.char_width * 2, gui.char_height, 8269 gui.char_width * 2, gui.char_height,
8270 LR_LOADFROMFILE | LR_CREATEDIBSECTION); 8270 LR_LOADFROMFILE | LR_CREATEDIBSECTION);
8271 #ifdef FEAT_XPM_W32 8271 # ifdef FEAT_XPM_W32
8272 if (!STRICMP(ext, ".xpm")) 8272 if (!STRICMP(ext, ".xpm"))
8273 { 8273 {
8274 sign.uType = IMAGE_XPM; 8274 sign.uType = IMAGE_XPM;
8275 LoadXpmImage((char *)signfile, (HBITMAP *)&sign.hImage, 8275 LoadXpmImage((char *)signfile, (HBITMAP *)&sign.hImage,
8276 (HBITMAP *)&sign.hShape); 8276 (HBITMAP *)&sign.hShape);
8277 } 8277 }
8278 #endif 8278 # endif
8279 } 8279 }
8280 8280
8281 psign = NULL; 8281 psign = NULL;
8282 if (sign.hImage && (psign = ALLOC_ONE(signicon_t)) != NULL) 8282 if (sign.hImage && (psign = ALLOC_ONE(signicon_t)) != NULL)
8283 *psign = sign; 8283 *psign = sign;
8648 } 8648 }
8649 8649
8650 void 8650 void
8651 gui_mch_destroy_beval_area(BalloonEval *beval) 8651 gui_mch_destroy_beval_area(BalloonEval *beval)
8652 { 8652 {
8653 #ifdef FEAT_VARTABS 8653 # ifdef FEAT_VARTABS
8654 vim_free(beval->vts); 8654 vim_free(beval->vts);
8655 #endif 8655 # endif
8656 vim_free(beval->tofree); 8656 vim_free(beval->tofree);
8657 vim_free(beval); 8657 vim_free(beval);
8658 } 8658 }
8659 #endif /* FEAT_BEVAL_GUI */ 8659 #endif /* FEAT_BEVAL_GUI */
8660 8660
8674 return; 8674 return;
8675 8675
8676 x = 0; 8676 x = 0;
8677 y = TEXT_Y(row); 8677 y = TEXT_Y(row);
8678 8678
8679 #if defined(FEAT_DIRECTX) 8679 # if defined(FEAT_DIRECTX)
8680 if (IS_ENABLE_DIRECTX()) 8680 if (IS_ENABLE_DIRECTX())
8681 DWriteContext_Flush(s_dwc); 8681 DWriteContext_Flush(s_dwc);
8682 #endif 8682 # endif
8683 8683
8684 for (i = 0; i < gui.char_height - 3; i++) 8684 for (i = 0; i < gui.char_height - 3; i++)
8685 SetPixel(s_hdc, x+2, y++, gui.currFgColor); 8685 SetPixel(s_hdc, x+2, y++, gui.currFgColor);
8686 8686
8687 SetPixel(s_hdc, x+0, y, gui.currFgColor); 8687 SetPixel(s_hdc, x+0, y, gui.currFgColor);