Loading ...
Sorry, an error occurred while loading the content.
 

[vim-multibyte] Win32 GUI: Patch to try out

Expand Messages
  • Bram Moolenaar
    Not too long ago, Matsumoto made a patch to fix a multi-byte problem with the tear-off menu and dialog fonts. This was then enhanced by Muraoka. I now added
    Message 1 of 1 , Mar 30, 2000
      Not too long ago, Matsumoto made a patch to fix a multi-byte problem with the
      tear-off menu and dialog fonts. This was then enhanced by Muraoka. I now
      added some error checking.

      Please check out this patch if you can compile gvim for Win32. Look at the
      fonts for the tear-off menu and dialogs. Let me know if this causes any
      problems.

      Perhaps the error checking can be removed (would Windows ever run without a
      system menu font?).

      *** src/gui_w32.c.orig Thu Jan 27 10:34:50 2000
      --- src/gui_w32.c Thu Mar 30 17:42:36 2000
      ***************
      *** 161,166 ****
      --- 161,172 ----
      #define DLG_FONT_POINT_SIZE 8
      #define DLG_MIN_MAX_WIDTH 400

      + /*
      + * Use the system font for dialogs and tear-off menus. Remove this line to
      + * use DLG_FONT_NAME.
      + */
      + #define USE_SYSMENU_FONT
      +
      /* Some parameters for tearoff menus. All in pixels. */
      #define TEAROFF_PADDING_X 2
      #define TEAROFF_BUTTON_PAD_X 8
      ***************
      *** 4690,4695 ****
      --- 4696,4723 ----
      "IDR_VIM_QUESTION"
      };

      + #ifdef USE_SYSMENU_FONT
      + /*
      + * Get Menu Font.
      + * Return OK or FAIL.
      + */
      + static int
      + gui_w32_get_menu_font(LOGFONT *lf)
      + {
      + NONCLIENTMETRICS nm;
      +
      + nm.cbSize = sizeof(NONCLIENTMETRICS);
      + if (!SystemParametersInfo(
      + SPI_GETNONCLIENTMETRICS,
      + sizeof(NONCLIENTMETRICS),
      + &nm,
      + 0))
      + return FAIL;
      + *lf = nm.lfMenuFont;
      + return OK;
      + }
      + #endif
      +
      int
      gui_mch_dialog(
      int type,
      ***************
      *** 4720,4725 ****
      --- 4748,4757 ----
      int vertical;
      int dlgPaddingX;
      int dlgPaddingY;
      + #ifdef USE_SYSMENU_FONT
      + LOGFONT lfSysmenu;
      + int use_lfSysmenu = FALSE;
      + #endif

      #ifndef NO_CONSOLE
      /* Don't output anything in silent mode ("ex -s") */
      ***************
      *** 4777,4782 ****
      --- 4809,4822 ----
      */
      hwnd = GetDesktopWindow();
      hdc = GetWindowDC(hwnd);
      + #ifdef USE_SYSMENU_FONT
      + if (gui_w32_get_menu_font(&lfSysmenu) == OK)
      + {
      + font = CreateFontIndirect(&lfSysmenu);
      + use_lfSysmenu = TRUE;
      + }
      + 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)
      ***************
      *** 4914,4921 ****
      if (s_usenewlook)
      {
      /* do the font, since DS_3DLOOK doesn't work properly */
      ! *p++ = DLG_FONT_POINT_SIZE; //point size
      ! nchar = nCopyAnsiToWideChar (p, TEXT(DLG_FONT_NAME));
      p += nchar;
      }

      --- 4954,4973 ----
      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));
      ! nchar = nCopyAnsiToWideChar(p, TEXT(lfSysmenu.lfFaceName));
      ! }
      ! else
      ! #endif
      ! {
      ! *p++ = DLG_FONT_POINT_SIZE; // point size
      ! nchar = nCopyAnsiToWideChar (p, TEXT(DLG_FONT_NAME));
      ! }
      p += nchar;
      }

      ***************
      *** 5259,5264 ****
      --- 5311,5320 ----
      char_u *label, *text, *end, *acEnd = NULL;
      int padding0, padding1, padding2 = 0;
      int sepPadding=0;
      + #ifdef USE_SYSMENU_FONT
      + LOGFONT lfSysmenu;
      + int use_lfSysmenu = FALSE;
      + #endif

      /*
      * If this menu is already torn off, then don't
      ***************
      *** 5292,5297 ****
      --- 5348,5361 ----

      hwnd = GetDesktopWindow();
      hdc = GetWindowDC(hwnd);
      + #ifdef USE_SYSMENU_FONT
      + if (gui_w32_get_menu_font(&lfSysmenu) == OK)
      + {
      + font = CreateFontIndirect(&lfSysmenu);
      + use_lfSysmenu = TRUE;
      + }
      + 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)
      ***************
      *** 5392,5399 ****
      if (s_usenewlook)
      {
      /* do the font, since DS_3DLOOK doesn't work properly */
      ! *p++ = DLG_FONT_POINT_SIZE; //point size
      ! nchar = nCopyAnsiToWideChar (p, TEXT(DLG_FONT_NAME));
      p += nchar;
      }

      --- 5456,5475 ----
      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));
      ! nchar = nCopyAnsiToWideChar(p, TEXT(lfSysmenu.lfFaceName));
      ! }
      ! else
      ! #endif
      ! {
      ! *p++ = DLG_FONT_POINT_SIZE; // point size
      ! nchar = nCopyAnsiToWideChar (p, TEXT(DLG_FONT_NAME));
      ! }
      p += nchar;
      }

      ***************
      *** 5522,5527 ****
      --- 5598,5606 ----
      HFONT hfontTools = 0;
      DWORD dlgFontSize;
      SIZE size;
      + #ifdef USE_SYSMENU_FONT
      + LOGFONT lfSysmenu;
      + #endif

      s_usenewlook = FALSE;

      ***************
      *** 5531,5536 ****
      --- 5610,5620 ----
      */
      if (!is_winnt_3())
      {
      + #ifdef USE_SYSMENU_FONT
      + if (gui_w32_get_menu_font(&lfSysmenu) == OK)
      + hfontTools = CreateFontIndirect(&lfSysmenu);
      + else
      + #endif
      hfontTools = CreateFont(-DLG_FONT_POINT_SIZE, 0, 0, 0, 0, 0, 0, 0,
      0, 0, 0, 0, VARIABLE_PITCH , DLG_FONT_NAME);

      --
      MESKIMEN'S LAW
      There's never time to do it right, but always time to do it over.

      /-/-- Bram Moolenaar --- Bram@... --- http://www.moolenaar.net --\-\
      \-\-- Vim: http://www.vim.org ---- ICCF Holland: http://www.vim.org/iccf --/-/
    Your message has been successfully submitted and would be delivered to recipients shortly.