# HG changeset patch # User vimboss # Date 1156879610 0 # Node ID c1b61096e3d0e4383db1ef01a5dc2f3ebd5eb0fc # Parent a157c4786b79ae94758574d5ecb4a8f4959de5e6 updated for version 7.0-074 diff --git a/src/gui_w32.c b/src/gui_w32.c --- a/src/gui_w32.c +++ b/src/gui_w32.c @@ -889,117 +889,90 @@ set_tabline_font(void) # ifdef FEAT_MBYTE case TTN_GETDISPINFOW: # endif - case TTN_NEEDTEXT: -# ifdef FEAT_GUI_TABLINE - if (gui_mch_showing_tabline() - && ((LPNMHDR)lParam)->hwndFrom == - TabCtrl_GetToolTips(s_tabhwnd)) + case TTN_GETDISPINFO: { - LPNMTTDISPINFO lpdi; - POINT pt; - static char *tt_text = NULL; - static int tt_text_len = 0; - - /* - * Mouse is over the GUI tabline. Display the tooltip - * for the tab under the cursor - */ - lpdi = (LPNMTTDISPINFO)lParam; - lpdi->hinst = NULL; - lpdi->szText[0] = '\0'; - - /* - * Get the cursor position within the tab control - */ - GetCursorPos(&pt); - if (ScreenToClient(s_tabhwnd, &pt) != 0) + LPNMHDR hdr = (LPNMHDR)lParam; + char_u *str = NULL; + static void *tt_text = NULL; + + vim_free(tt_text); + tt_text = NULL; + +# ifdef FEAT_GUI_TABLINE + if (gui_mch_showing_tabline() + && hdr->hwndFrom == TabCtrl_GetToolTips(s_tabhwnd)) { - TCHITTESTINFO htinfo; - int idx; - + POINT pt; /* - * Get the tab under the cursor + * Mouse is over the GUI tabline. Display the + * tooltip for the tab under the cursor + * + * Get the cursor position within the tab control */ - htinfo.pt.x = pt.x; - htinfo.pt.y = pt.y; - idx = TabCtrl_HitTest(s_tabhwnd, &htinfo); - if (idx != -1) + GetCursorPos(&pt); + if (ScreenToClient(s_tabhwnd, &pt) != 0) { - tabpage_T *tp; - - tp = find_tabpage(idx + 1); - if (tp != NULL) + TCHITTESTINFO htinfo; + int idx; + + /* + * Get the tab under the cursor + */ + htinfo.pt.x = pt.x; + htinfo.pt.y = pt.y; + idx = TabCtrl_HitTest(s_tabhwnd, &htinfo); + if (idx != -1) { -# ifdef FEAT_MBYTE - WCHAR *wstr = NULL; -# endif - get_tabline_label(tp, TRUE); -# ifdef FEAT_MBYTE - if (enc_codepage >= 0 - && (int)GetACP() != enc_codepage) + tabpage_T *tp; + + tp = find_tabpage(idx + 1); + if (tp != NULL) { - wstr = enc_to_ucs2(NameBuff, NULL); - if (wstr != NULL) - { - int wlen; - - wlen = ((int)wcslen(wstr) + 1) - * sizeof(WCHAR); - if (tt_text_len < wlen) - { - tt_text = vim_realloc(tt_text, - wlen); - if (tt_text != NULL) - tt_text_len = wlen; - } - if (tt_text != NULL) - wcscpy((WCHAR *)tt_text, wstr); - lpdi->lpszText = tt_text; - vim_free(wstr); - } - } - if (wstr == NULL) -# endif - { - int len; - - len = (int)STRLEN(NameBuff) + 1; - if (tt_text_len < len) - { - tt_text = vim_realloc(tt_text, len); - if (tt_text != NULL) - tt_text_len = len; - } - if (tt_text != NULL) - STRCPY(tt_text, NameBuff); - lpdi->lpszText = tt_text; + get_tabline_label(tp, TRUE); + str = NameBuff; } } } } - } - else # endif - { # ifdef FEAT_TOOLBAR - LPTOOLTIPTEXT lpttt; - UINT idButton; - int idx; - vimmenu_T *pMenu; - - lpttt = (LPTOOLTIPTEXT)lParam; - idButton = (UINT) lpttt->hdr.idFrom; - pMenu = gui_mswin_find_menu(root_menu, idButton); - if (pMenu) +# ifdef FEAT_GUI_TABLINE + else +# endif + { + UINT idButton; + vimmenu_T *pMenu; + + idButton = (UINT) hdr->idFrom; + pMenu = gui_mswin_find_menu(root_menu, idButton); + if (pMenu) + str = pMenu->strings[MENU_INDEX_TIP]; + } +# endif + if (str != NULL) { - idx = MENU_INDEX_TIP; - if (pMenu->strings[idx]) +# ifdef FEAT_MBYTE + if (hdr->code == TTN_GETDISPINFOW) { - lpttt->hinst = NULL; /* string, not resource */ - lpttt->lpszText = pMenu->strings[idx]; + LPNMTTDISPINFOW lpdi = (LPNMTTDISPINFOW)lParam; + + tt_text = enc_to_ucs2(str, NULL); + lpdi->lpszText = tt_text; + /* can't show tooltip if failed */ + } + else +# endif + { + LPNMTTDISPINFO lpdi = (LPNMTTDISPINFO)lParam; + + if (STRLEN(str) < sizeof(lpdi->szText) + || ((tt_text = vim_strsave(str)) == NULL)) + vim_strncpy(lpdi->szText, str, + sizeof(lpdi->szText) - 1); + else + lpdi->lpszText = tt_text; } } -# endif } break; # ifdef FEAT_GUI_TABLINE diff --git a/src/gui_w48.c b/src/gui_w48.c --- a/src/gui_w48.c +++ b/src/gui_w48.c @@ -2194,7 +2194,18 @@ gui_mch_show_toolbar(int showit) return; if (showit) + { +# ifdef FEAT_MBYTE +# ifndef TB_SETUNICODEFORMAT + /* For older compilers. We assume this never changes. */ +# define TB_SETUNICODEFORMAT 0x2005 +# endif + /* Enable/disable unicode support */ + int uu = (enc_codepage >= 0 && (int)GetACP() != enc_codepage); + SendMessage(s_toolbarhwnd, TB_SETUNICODEFORMAT, (WPARAM)uu, (LPARAM)0); +# endif ShowWindow(s_toolbarhwnd, SW_SHOW); + } else ShowWindow(s_toolbarhwnd, SW_HIDE); } diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -667,6 +667,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 74, +/**/ 73, /**/ 72,