mirror of
https://github.com/vim/vim.git
synced 2025-09-30 04:44:14 -04:00
patch 8.2.4189: MS-Windows: code for "old look" is obsolete
Problem: MS-Windows: code for "old look" is obsolete. Solution: Delete obsolete code. Use "MS Shell Dlg" font. (Ken Takata, closes #9596)
This commit is contained in:
@@ -206,14 +206,12 @@ gui_mch_set_rendering_options(char_u *s)
|
|||||||
// Some parameters for dialog boxes. All in pixels.
|
// Some parameters for dialog boxes. All in pixels.
|
||||||
#define DLG_PADDING_X 10
|
#define DLG_PADDING_X 10
|
||||||
#define DLG_PADDING_Y 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_VERT_PADDING_Y 4
|
||||||
#define DLG_ICON_WIDTH 34
|
#define DLG_ICON_WIDTH 34
|
||||||
#define DLG_ICON_HEIGHT 34
|
#define DLG_ICON_HEIGHT 34
|
||||||
#define DLG_MIN_WIDTH 150
|
#define DLG_MIN_WIDTH 150
|
||||||
#define DLG_FONT_NAME "MS Sans Serif"
|
#define DLG_FONT_NAME "MS Shell Dlg"
|
||||||
#define DLG_FONT_POINT_SIZE 8
|
#define DLG_FONT_POINT_SIZE 8
|
||||||
#define DLG_MIN_MAX_WIDTH 400
|
#define DLG_MIN_MAX_WIDTH 400
|
||||||
#define DLG_MIN_MAX_HEIGHT 400
|
#define DLG_MIN_MAX_HEIGHT 400
|
||||||
@@ -4160,7 +4158,6 @@ static int dialog_default_button = -1;
|
|||||||
// Intellimouse support
|
// Intellimouse support
|
||||||
static int mouse_scroll_lines = 0;
|
static int mouse_scroll_lines = 0;
|
||||||
|
|
||||||
static int s_usenewlook; // emulate W95/NT4 non-bold dialogs
|
|
||||||
#ifdef FEAT_TOOLBAR
|
#ifdef FEAT_TOOLBAR
|
||||||
static void initialise_toolbar(void);
|
static void initialise_toolbar(void);
|
||||||
static void update_toolbar_size(void);
|
static void update_toolbar_size(void);
|
||||||
@@ -6974,20 +6971,13 @@ gui_mch_dialog(
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
# endif
|
# endif
|
||||||
font = CreateFont(-DLG_FONT_POINT_SIZE, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
font = CreateFont(-DLG_FONT_POINT_SIZE, 0, 0, 0, 0, 0, 0, 0,
|
||||||
VARIABLE_PITCH, DLG_FONT_NAME);
|
0, 0, 0, 0, VARIABLE_PITCH, DLG_FONT_NAME);
|
||||||
if (s_usenewlook)
|
|
||||||
{
|
|
||||||
oldFont = SelectFont(hdc, font);
|
oldFont = SelectFont(hdc, font);
|
||||||
dlgPaddingX = DLG_PADDING_X;
|
dlgPaddingX = DLG_PADDING_X;
|
||||||
dlgPaddingY = DLG_PADDING_Y;
|
dlgPaddingY = DLG_PADDING_Y;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
oldFont = SelectFont(hdc, GetStockObject(SYSTEM_FONT));
|
|
||||||
dlgPaddingX = DLG_OLD_STYLE_PADDING_X;
|
|
||||||
dlgPaddingY = DLG_OLD_STYLE_PADDING_Y;
|
|
||||||
}
|
|
||||||
GetTextMetrics(hdc, &fontInfo);
|
GetTextMetrics(hdc, &fontInfo);
|
||||||
fontHeight = fontInfo.tmHeight;
|
fontHeight = fontInfo.tmHeight;
|
||||||
|
|
||||||
@@ -7148,10 +7138,7 @@ gui_mch_dialog(
|
|||||||
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;
|
lStyle = DS_MODALFRAME | WS_CAPTION | DS_3DLOOK | WS_VISIBLE | DS_SETFONT;
|
||||||
else
|
|
||||||
lStyle = DS_MODALFRAME | WS_CAPTION |DS_3DLOOK| WS_VISIBLE;
|
|
||||||
|
|
||||||
add_long(lStyle);
|
add_long(lStyle);
|
||||||
add_long(0); // (lExtendedStyle)
|
add_long(0); // (lExtendedStyle)
|
||||||
@@ -7193,8 +7180,6 @@ gui_mch_dialog(
|
|||||||
: (LPSTR)("Vim "VIM_VERSION_MEDIUM)), TRUE);
|
: (LPSTR)("Vim "VIM_VERSION_MEDIUM)), TRUE);
|
||||||
p += nchar;
|
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
|
# ifdef USE_SYSMENU_FONT
|
||||||
if (use_lfSysmenu)
|
if (use_lfSysmenu)
|
||||||
@@ -7212,7 +7197,6 @@ gui_mch_dialog(
|
|||||||
nchar = nCopyAnsiToWideChar(p, DLG_FONT_NAME, FALSE);
|
nchar = nCopyAnsiToWideChar(p, DLG_FONT_NAME, FALSE);
|
||||||
}
|
}
|
||||||
p += nchar;
|
p += nchar;
|
||||||
}
|
|
||||||
|
|
||||||
buttonYpos = msgheight + 2 * dlgPaddingY;
|
buttonYpos = msgheight + 2 * dlgPaddingY;
|
||||||
|
|
||||||
@@ -7555,23 +7539,20 @@ tearoff_callback(
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Decide whether to use the "new look" (small, non-bold font) or the "old
|
* Computes the dialog base units based on the current dialog font.
|
||||||
* look" (big, clanky font) for dialogs, and work out a few values for use
|
* We don't use the GetDialogBaseUnits() API, because we don't use the
|
||||||
* later accordingly.
|
* (old-style) system font.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
get_dialog_font_metrics(void)
|
get_dialog_font_metrics(void)
|
||||||
{
|
{
|
||||||
HDC hdc;
|
HDC hdc;
|
||||||
HFONT hfontTools = 0;
|
HFONT hfontTools = 0;
|
||||||
DWORD dlgFontSize;
|
|
||||||
SIZE size;
|
SIZE size;
|
||||||
#ifdef USE_SYSMENU_FONT
|
#ifdef USE_SYSMENU_FONT
|
||||||
LOGFONTW lfSysmenu;
|
LOGFONTW lfSysmenu;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
s_usenewlook = FALSE;
|
|
||||||
|
|
||||||
#ifdef USE_SYSMENU_FONT
|
#ifdef USE_SYSMENU_FONT
|
||||||
if (gui_w32_get_menu_font(&lfSysmenu) == OK)
|
if (gui_w32_get_menu_font(&lfSysmenu) == OK)
|
||||||
hfontTools = CreateFontIndirectW(&lfSysmenu);
|
hfontTools = CreateFontIndirectW(&lfSysmenu);
|
||||||
@@ -7580,8 +7561,6 @@ get_dialog_font_metrics(void)
|
|||||||
hfontTools = CreateFont(-DLG_FONT_POINT_SIZE, 0, 0, 0, 0, 0, 0, 0,
|
hfontTools = CreateFont(-DLG_FONT_POINT_SIZE, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, VARIABLE_PITCH, DLG_FONT_NAME);
|
0, 0, 0, 0, VARIABLE_PITCH, DLG_FONT_NAME);
|
||||||
|
|
||||||
if (hfontTools)
|
|
||||||
{
|
|
||||||
hdc = GetDC(s_hwnd);
|
hdc = GetDC(s_hwnd);
|
||||||
SelectObject(hdc, hfontTools);
|
SelectObject(hdc, hfontTools);
|
||||||
/*
|
/*
|
||||||
@@ -7596,15 +7575,6 @@ get_dialog_font_metrics(void)
|
|||||||
|
|
||||||
s_dlgfntwidth = (WORD)((size.cx / 26 + 1) / 2);
|
s_dlgfntwidth = (WORD)((size.cx / 26 + 1) / 2);
|
||||||
s_dlgfntheight = (WORD)size.cy;
|
s_dlgfntheight = (WORD)size.cy;
|
||||||
s_usenewlook = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!s_usenewlook)
|
|
||||||
{
|
|
||||||
dlgFontSize = GetDialogBaseUnits(); // fall back to big old system
|
|
||||||
s_dlgfntwidth = LOWORD(dlgFontSize);
|
|
||||||
s_dlgfntheight = HIWORD(dlgFontSize);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(FEAT_MENU) && defined(FEAT_TEAROFF)
|
#if defined(FEAT_MENU) && defined(FEAT_TEAROFF)
|
||||||
@@ -7683,12 +7653,10 @@ gui_mch_tearoff(
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
# endif
|
# endif
|
||||||
font = CreateFont(-DLG_FONT_POINT_SIZE, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
font = CreateFont(-DLG_FONT_POINT_SIZE, 0, 0, 0, 0, 0, 0, 0,
|
||||||
VARIABLE_PITCH, DLG_FONT_NAME);
|
0, 0, 0, 0, VARIABLE_PITCH, DLG_FONT_NAME);
|
||||||
if (s_usenewlook)
|
|
||||||
oldFont = SelectFont(hdc, font);
|
oldFont = SelectFont(hdc, font);
|
||||||
else
|
|
||||||
oldFont = SelectFont(hdc, GetStockObject(SYSTEM_FONT));
|
|
||||||
|
|
||||||
// Calculate width of a single space. Used for padding columns to the
|
// Calculate width of a single space. Used for padding columns to the
|
||||||
// right width.
|
// right width.
|
||||||
@@ -7745,10 +7713,7 @@ gui_mch_tearoff(
|
|||||||
dlgwidth += 2 * TEAROFF_PADDING_X + TEAROFF_BUTTON_PAD_X;
|
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;
|
lStyle = DS_MODALFRAME | WS_CAPTION | WS_SYSMENU | DS_SETFONT | WS_VISIBLE;
|
||||||
else
|
|
||||||
lStyle = DS_MODALFRAME | WS_CAPTION| WS_SYSMENU | WS_VISIBLE;
|
|
||||||
|
|
||||||
lExtendedStyle = WS_EX_TOOLWINDOW|WS_EX_STATICEDGE;
|
lExtendedStyle = WS_EX_TOOLWINDOW|WS_EX_STATICEDGE;
|
||||||
*p++ = LOWORD(lStyle);
|
*p++ = LOWORD(lStyle);
|
||||||
@@ -7778,8 +7743,6 @@ gui_mch_tearoff(
|
|||||||
: (LPSTR)("Vim "VIM_VERSION_MEDIUM)), TRUE);
|
: (LPSTR)("Vim "VIM_VERSION_MEDIUM)), TRUE);
|
||||||
p += nchar;
|
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
|
# ifdef USE_SYSMENU_FONT
|
||||||
if (use_lfSysmenu)
|
if (use_lfSysmenu)
|
||||||
@@ -7797,7 +7760,6 @@ gui_mch_tearoff(
|
|||||||
nchar = nCopyAnsiToWideChar(p, DLG_FONT_NAME, FALSE);
|
nchar = nCopyAnsiToWideChar(p, DLG_FONT_NAME, FALSE);
|
||||||
}
|
}
|
||||||
p += nchar;
|
p += nchar;
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Loop over all the items in the menu.
|
* Loop over all the items in the menu.
|
||||||
|
@@ -750,6 +750,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
4189,
|
||||||
/**/
|
/**/
|
||||||
4188,
|
4188,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user