Patch 8.2.4189
Problem:    MS-Windows: code for "old look" is obsolete.
Solution:   Delete obsolete code.  Use "MS Shell Dlg" font. (Ken Takata,
            closes #9596)
Files:      src/gui_w32.c


*** ../vim-8.2.4188/src/gui_w32.c       2022-01-22 10:24:43.643499627 +0000
--- src/gui_w32.c       2022-01-23 12:29:24.800771602 +0000
***************
*** 206,219 ****
  // 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_Y    4
  #define DLG_ICON_WIDTH                34
  #define DLG_ICON_HEIGHT               34
  #define DLG_MIN_WIDTH         150
! #define DLG_FONT_NAME         "MS Sans Serif"
  #define DLG_FONT_POINT_SIZE   8
  #define DLG_MIN_MAX_WIDTH     400
  #define DLG_MIN_MAX_HEIGHT    400
--- 206,217 ----
  // Some parameters for dialog boxes.  All in pixels.
  #define DLG_PADDING_X         10
  #define DLG_PADDING_Y         10
  #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
  #define DLG_MIN_WIDTH         150
! #define DLG_FONT_NAME         "MS Shell Dlg"
  #define DLG_FONT_POINT_SIZE   8
  #define DLG_MIN_MAX_WIDTH     400
  #define DLG_MIN_MAX_HEIGHT    400
***************
*** 4160,4166 ****
  // Intellimouse support
  static int mouse_scroll_lines = 0;
  
- static int    s_usenewlook;       // emulate W95/NT4 non-bold dialogs
  #ifdef FEAT_TOOLBAR
  static void initialise_toolbar(void);
  static void update_toolbar_size(void);
--- 4158,4163 ----
***************
*** 6974,6993 ****
      }
      else
  # 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)
!     {
!       oldFont = SelectFont(hdc, font);
!       dlgPaddingX = DLG_PADDING_X;
!       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);
      fontHeight = fontInfo.tmHeight;
  
--- 6971,6983 ----
      }
      else
  # endif
!       font = CreateFont(-DLG_FONT_POINT_SIZE, 0, 0, 0, 0, 0, 0, 0,
!                       0, 0, 0, 0, VARIABLE_PITCH, DLG_FONT_NAME);
! 
!     oldFont = SelectFont(hdc, font);
!     dlgPaddingX = DLG_PADDING_X;
!     dlgPaddingY = DLG_PADDING_Y;
! 
      GetTextMetrics(hdc, &fontInfo);
      fontHeight = fontInfo.tmHeight;
  
***************
*** 7148,7157 ****
        dlgwidth = DLG_MIN_WIDTH;       // Don't allow a really thin dialog!
  
      // 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
!       lStyle = DS_MODALFRAME | WS_CAPTION |DS_3DLOOK| WS_VISIBLE;
  
      add_long(lStyle);
      add_long(0);      // (lExtendedStyle)
--- 7138,7144 ----
        dlgwidth = DLG_MIN_WIDTH;       // Don't allow a really thin dialog!
  
      // start to fill in the dlgtemplate information.  addressing by WORDs
!     lStyle = DS_MODALFRAME | WS_CAPTION | DS_3DLOOK | WS_VISIBLE | DS_SETFONT;
  
      add_long(lStyle);
      add_long(0);      // (lExtendedStyle)
***************
*** 7193,7218 ****
                                   : (LPSTR)("Vim "VIM_VERSION_MEDIUM)), TRUE);
      p += nchar;
  
!     if (s_usenewlook)
!     {
!       // do the font, since DS_3DLOOK doesn't work properly
  # ifdef USE_SYSMENU_FONT
!       if (use_lfSysmenu)
!       {
!           // point size
!           *p++ = -MulDiv(lfSysmenu.lfHeight, 72,
!                   GetDeviceCaps(hdc, LOGPIXELSY));
!           wcscpy(p, lfSysmenu.lfFaceName);
!           nchar = (int)wcslen(lfSysmenu.lfFaceName) + 1;
!       }
!       else
  # endif
!       {
!           *p++ = DLG_FONT_POINT_SIZE;         // point size
!           nchar = nCopyAnsiToWideChar(p, DLG_FONT_NAME, FALSE);
!       }
!       p += nchar;
      }
  
      buttonYpos = msgheight + 2 * dlgPaddingY;
  
--- 7180,7202 ----
                                   : (LPSTR)("Vim "VIM_VERSION_MEDIUM)), TRUE);
      p += nchar;
  
!     // do the font, since DS_3DLOOK doesn't work properly
  # ifdef USE_SYSMENU_FONT
!     if (use_lfSysmenu)
!     {
!       // point size
!       *p++ = -MulDiv(lfSysmenu.lfHeight, 72,
!               GetDeviceCaps(hdc, LOGPIXELSY));
!       wcscpy(p, lfSysmenu.lfFaceName);
!       nchar = (int)wcslen(lfSysmenu.lfFaceName) + 1;
!     }
!     else
  # endif
!     {
!       *p++ = DLG_FONT_POINT_SIZE;             // point size
!       nchar = nCopyAnsiToWideChar(p, DLG_FONT_NAME, FALSE);
      }
+     p += nchar;
  
      buttonYpos = msgheight + 2 * dlgPaddingY;
  
***************
*** 7555,7577 ****
  
  
  /*
!  * Decide whether to use the "new look" (small, non-bold font) or the "old
!  * look" (big, clanky font) for dialogs, and work out a few values for use
!  * later accordingly.
   */
      static void
  get_dialog_font_metrics(void)
  {
      HDC                   hdc;
      HFONT         hfontTools = 0;
-     DWORD         dlgFontSize;
      SIZE          size;
  #ifdef USE_SYSMENU_FONT
      LOGFONTW      lfSysmenu;
  #endif
  
-     s_usenewlook = FALSE;
- 
  #ifdef USE_SYSMENU_FONT
      if (gui_w32_get_menu_font(&lfSysmenu) == OK)
        hfontTools = CreateFontIndirectW(&lfSysmenu);
--- 7539,7558 ----
  
  
  /*
!  * Computes the dialog base units based on the current dialog font.
!  * We don't use the GetDialogBaseUnits() API, because we don't use the
!  * (old-style) system font.
   */
      static void
  get_dialog_font_metrics(void)
  {
      HDC                   hdc;
      HFONT         hfontTools = 0;
      SIZE          size;
  #ifdef USE_SYSMENU_FONT
      LOGFONTW      lfSysmenu;
  #endif
  
  #ifdef USE_SYSMENU_FONT
      if (gui_w32_get_menu_font(&lfSysmenu) == OK)
        hfontTools = CreateFontIndirectW(&lfSysmenu);
***************
*** 7580,7610 ****
        hfontTools = CreateFont(-DLG_FONT_POINT_SIZE, 0, 0, 0, 0, 0, 0, 0,
                                0, 0, 0, 0, VARIABLE_PITCH, DLG_FONT_NAME);
  
!     if (hfontTools)
!     {
!       hdc = GetDC(s_hwnd);
!       SelectObject(hdc, hfontTools);
!       /*
!        * GetTextMetrics() doesn't return the right value in
!        * tmAveCharWidth, so we have to figure out the dialog base units
!        * ourselves.
!        */
!       GetTextExtentPoint(hdc,
!               "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
!               52, &size);
!       ReleaseDC(s_hwnd, hdc);
! 
!       s_dlgfntwidth = (WORD)((size.cx / 26 + 1) / 2);
!       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)
--- 7561,7580 ----
        hfontTools = CreateFont(-DLG_FONT_POINT_SIZE, 0, 0, 0, 0, 0, 0, 0,
                                0, 0, 0, 0, VARIABLE_PITCH, DLG_FONT_NAME);
  
!     hdc = GetDC(s_hwnd);
!     SelectObject(hdc, hfontTools);
!     /*
!      * GetTextMetrics() doesn't return the right value in
!      * tmAveCharWidth, so we have to figure out the dialog base units
!      * ourselves.
!      */
!     GetTextExtentPoint(hdc,
!           "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
!           52, &size);
!     ReleaseDC(s_hwnd, hdc);
  
!     s_dlgfntwidth = (WORD)((size.cx / 26 + 1) / 2);
!     s_dlgfntheight = (WORD)size.cy;
  }
  
  #if defined(FEAT_MENU) && defined(FEAT_TEAROFF)
***************
*** 7683,7694 ****
      }
      else
  # 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)
!       oldFont = SelectFont(hdc, font);
!     else
!       oldFont = SelectFont(hdc, GetStockObject(SYSTEM_FONT));
  
      // Calculate width of a single space.  Used for padding columns to the
      // right width.
--- 7653,7662 ----
      }
      else
  # endif
!       font = CreateFont(-DLG_FONT_POINT_SIZE, 0, 0, 0, 0, 0, 0, 0,
!                       0, 0, 0, 0, VARIABLE_PITCH, DLG_FONT_NAME);
! 
!     oldFont = SelectFont(hdc, font);
  
      // Calculate width of a single space.  Used for padding columns to the
      // right width.
***************
*** 7745,7754 ****
      dlgwidth += 2 * TEAROFF_PADDING_X + TEAROFF_BUTTON_PAD_X;
  
      // 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
!       lStyle = DS_MODALFRAME | WS_CAPTION| WS_SYSMENU | WS_VISIBLE;
  
      lExtendedStyle = WS_EX_TOOLWINDOW|WS_EX_STATICEDGE;
      *p++ = LOWORD(lStyle);
--- 7713,7719 ----
      dlgwidth += 2 * TEAROFF_PADDING_X + TEAROFF_BUTTON_PAD_X;
  
      // start to fill in the dlgtemplate information.  addressing by WORDs
!     lStyle = DS_MODALFRAME | WS_CAPTION | WS_SYSMENU | DS_SETFONT | 
WS_VISIBLE;
  
      lExtendedStyle = WS_EX_TOOLWINDOW|WS_EX_STATICEDGE;
      *p++ = LOWORD(lStyle);
***************
*** 7778,7803 ****
                            : (LPSTR)("Vim "VIM_VERSION_MEDIUM)), TRUE);
      p += nchar;
  
!     if (s_usenewlook)
!     {
!       // do the font, since DS_3DLOOK doesn't work properly
  # ifdef USE_SYSMENU_FONT
!       if (use_lfSysmenu)
!       {
!           // point size
!           *p++ = -MulDiv(lfSysmenu.lfHeight, 72,
!                   GetDeviceCaps(hdc, LOGPIXELSY));
!           wcscpy(p, lfSysmenu.lfFaceName);
!           nchar = (int)wcslen(lfSysmenu.lfFaceName) + 1;
!       }
!       else
  # endif
!       {
!           *p++ = DLG_FONT_POINT_SIZE;         // point size
!           nchar = nCopyAnsiToWideChar(p, DLG_FONT_NAME, FALSE);
!       }
!       p += nchar;
      }
  
      /*
       * Loop over all the items in the menu.
--- 7743,7765 ----
                            : (LPSTR)("Vim "VIM_VERSION_MEDIUM)), TRUE);
      p += nchar;
  
!     // do the font, since DS_3DLOOK doesn't work properly
  # ifdef USE_SYSMENU_FONT
!     if (use_lfSysmenu)
!     {
!       // point size
!       *p++ = -MulDiv(lfSysmenu.lfHeight, 72,
!               GetDeviceCaps(hdc, LOGPIXELSY));
!       wcscpy(p, lfSysmenu.lfFaceName);
!       nchar = (int)wcslen(lfSysmenu.lfFaceName) + 1;
!     }
!     else
  # endif
!     {
!       *p++ = DLG_FONT_POINT_SIZE;             // point size
!       nchar = nCopyAnsiToWideChar(p, DLG_FONT_NAME, FALSE);
      }
+     p += nchar;
  
      /*
       * Loop over all the items in the menu.
*** ../vim-8.2.4188/src/version.c       2022-01-23 11:28:13.379203426 +0000
--- src/version.c       2022-01-23 12:30:50.231152666 +0000
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     4189,
  /**/

-- 
BEDEVERE: Look!  It's the old man from scene 24 - what's he Doing here?
ARTHUR:   He is the keeper of the Bridge.  He asks each traveler five
          questions ...
GALAHAD:  Three questions.
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20220123123343.5D7BD1C3BC0%40moolenaar.net.

Raspunde prin e-mail lui