comparison src/gui_w32.c @ 15597:536dd2bc5ac9 v8.1.0806

patch 8.1.0806: too many #ifdefs commit https://github.com/vim/vim/commit/fc3abf47fbe1e426f2b676c316c81ee9ff607075 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jan 24 15:54:21 2019 +0100 patch 8.1.0806: too many #ifdefs Problem: Too many #ifdefs. Solution: Graduate FEAT_MBYTE, part 2.
author Bram Moolenaar <Bram@vim.org>
date Thu, 24 Jan 2019 16:00:08 +0100
parents 9bd2372432cf
children 8ab9ad27fca4
comparison
equal deleted inserted replaced
15596:d614c94f60fd 15597:536dd2bc5ac9
28 #if defined(FEAT_DIRECTX) 28 #if defined(FEAT_DIRECTX)
29 # include "gui_dwrite.h" 29 # include "gui_dwrite.h"
30 #endif 30 #endif
31 31
32 #if defined(FEAT_DIRECTX) 32 #if defined(FEAT_DIRECTX)
33 # ifndef FEAT_MBYTE
34 # error FEAT_MBYTE is required for FEAT_DIRECTX.
35 # endif
36 static DWriteContext *s_dwc = NULL; 33 static DWriteContext *s_dwc = NULL;
37 static int s_directx_enabled = 0; 34 static int s_directx_enabled = 0;
38 static int s_directx_load_attempted = 0; 35 static int s_directx_load_attempted = 0;
39 # define IS_ENABLE_DIRECTX() (s_directx_enabled && s_dwc != NULL && enc_utf8) 36 # define IS_ENABLE_DIRECTX() (s_directx_enabled && s_dwc != NULL && enc_utf8)
40 static int directx_enabled(void); 37 static int directx_enabled(void);
316 static int destroying = FALSE; /* call DestroyWindow() ourselves */ 313 static int destroying = FALSE; /* call DestroyWindow() ourselves */
317 314
318 #ifdef MSWIN_FIND_REPLACE 315 #ifdef MSWIN_FIND_REPLACE
319 static UINT s_findrep_msg = 0; /* set in gui_w[16/32].c */ 316 static UINT s_findrep_msg = 0; /* set in gui_w[16/32].c */
320 static FINDREPLACE s_findrep_struct; 317 static FINDREPLACE s_findrep_struct;
321 # ifdef FEAT_MBYTE
322 static FINDREPLACEW s_findrep_struct_w; 318 static FINDREPLACEW s_findrep_struct_w;
323 # endif
324 static HWND s_findrep_hwnd = NULL; 319 static HWND s_findrep_hwnd = NULL;
325 static int s_findrep_is_find; /* TRUE for find dialog, FALSE 320 static int s_findrep_is_find; /* TRUE for find dialog, FALSE
326 for find/replace dialog */ 321 for find/replace dialog */
327 #endif 322 #endif
328 323
394 DWriteContext_BindDC(s_dwc, s_hdc, &rect); 389 DWriteContext_BindDC(s_dwc, s_hdc, &rect);
395 } 390 }
396 } 391 }
397 #endif 392 #endif
398 393
399 #if defined(FEAT_MBYTE) || defined(GLOBAL_IME) 394 /* use of WindowProc depends on wide_WindowProc */
400 /* use of WindowProc depends on wide_WindowProc */ 395 #define MyWindowProc vim_WindowProc
401 # define MyWindowProc vim_WindowProc
402 #else
403 /* use ordinary WindowProc */
404 # define MyWindowProc DefWindowProc
405 #endif
406 396
407 extern int current_font_height; /* this is in os_mswin.c */ 397 extern int current_font_height; /* this is in os_mswin.c */
408 398
409 static struct 399 static struct
410 { 400 {
722 static int 712 static int
723 char_to_string(int ch, char_u *string, int slen, int had_alt) 713 char_to_string(int ch, char_u *string, int slen, int had_alt)
724 { 714 {
725 int len; 715 int len;
726 int i; 716 int i;
727 #ifdef FEAT_MBYTE
728 WCHAR wstring[2]; 717 WCHAR wstring[2];
729 char_u *ws = NULL; 718 char_u *ws = NULL;
730 719
731 if (surrogate_pending_ch != 0) 720 if (surrogate_pending_ch != 0)
732 { 721 {
783 vim_free(ws); 772 vim_free(ws);
784 } 773 }
785 } 774 }
786 775
787 if (len == 0) 776 if (len == 0)
788 #endif
789 { 777 {
790 string[0] = ch; 778 string[0] = ch;
791 len = 1; 779 len = 1;
792 } 780 }
793 781
1116 gui_menu_cb(pMenu); 1104 gui_menu_cb(pMenu);
1117 } 1105 }
1118 #endif 1106 #endif
1119 1107
1120 #ifdef MSWIN_FIND_REPLACE 1108 #ifdef MSWIN_FIND_REPLACE
1121 # ifdef FEAT_MBYTE
1122 /* 1109 /*
1123 * copy useful data from structure LPFINDREPLACE to structure LPFINDREPLACEW 1110 * copy useful data from structure LPFINDREPLACE to structure LPFINDREPLACEW
1124 */ 1111 */
1125 static void 1112 static void
1126 findrep_atow(LPFINDREPLACEW lpfrw, LPFINDREPLACE lpfr) 1113 findrep_atow(LPFINDREPLACEW lpfrw, LPFINDREPLACE lpfr)
1153 1140
1154 p = utf16_to_enc((short_u*)lpfrw->lpstrReplaceWith, NULL); 1141 p = utf16_to_enc((short_u*)lpfrw->lpstrReplaceWith, NULL);
1155 vim_strncpy((char_u *)lpfr->lpstrReplaceWith, p, lpfr->wReplaceWithLen - 1); 1142 vim_strncpy((char_u *)lpfr->lpstrReplaceWith, p, lpfr->wReplaceWithLen - 1);
1156 vim_free(p); 1143 vim_free(p);
1157 } 1144 }
1158 # endif
1159 1145
1160 /* 1146 /*
1161 * Handle a Find/Replace window message. 1147 * Handle a Find/Replace window message.
1162 */ 1148 */
1163 static void 1149 static void
1164 _OnFindRepl(void) 1150 _OnFindRepl(void)
1165 { 1151 {
1166 int flags = 0; 1152 int flags = 0;
1167 int down; 1153 int down;
1168 1154
1169 # ifdef FEAT_MBYTE
1170 /* If the OS is Windows NT, and 'encoding' differs from active codepage: 1155 /* If the OS is Windows NT, and 'encoding' differs from active codepage:
1171 * convert text from wide string. */ 1156 * convert text from wide string. */
1172 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) 1157 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
1173 { 1158 {
1174 findrep_wtoa(&s_findrep_struct, &s_findrep_struct_w); 1159 findrep_wtoa(&s_findrep_struct, &s_findrep_struct_w);
1175 } 1160 }
1176 # endif
1177 1161
1178 if (s_findrep_struct.Flags & FR_DIALOGTERM) 1162 if (s_findrep_struct.Flags & FR_DIALOGTERM)
1179 /* Give main window the focus back. */ 1163 /* Give main window the focus back. */
1180 (void)SetFocus(s_hwnd); 1164 (void)SetFocus(s_hwnd);
1181 1165
1316 default: 1300 default:
1317 return MyWindowProc(hwnd, uMsg, wParam, lParam); 1301 return MyWindowProc(hwnd, uMsg, wParam, lParam);
1318 } 1302 }
1319 } 1303 }
1320 1304
1321 #if defined(FEAT_MBYTE) \ 1305 #ifdef PROTO
1322 || defined(GLOBAL_IME) \
1323 || defined(PROTO)
1324 # ifdef PROTO
1325 typedef int WINAPI; 1306 typedef int WINAPI;
1326 # endif 1307 #endif
1327 1308
1328 LRESULT WINAPI 1309 LRESULT WINAPI
1329 vim_WindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) 1310 vim_WindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
1330 { 1311 {
1331 # ifdef GLOBAL_IME 1312 #ifdef GLOBAL_IME
1332 return global_ime_DefWindowProc(hwnd, message, wParam, lParam); 1313 return global_ime_DefWindowProc(hwnd, message, wParam, lParam);
1333 # else 1314 #else
1334 if (wide_WindowProc) 1315 if (wide_WindowProc)
1335 return DefWindowProcW(hwnd, message, wParam, lParam); 1316 return DefWindowProcW(hwnd, message, wParam, lParam);
1336 return DefWindowProc(hwnd, message, wParam, lParam); 1317 return DefWindowProc(hwnd, message, wParam, lParam);
1337 #endif 1318 #endif
1338 } 1319 }
1339 #endif
1340 1320
1341 /* 1321 /*
1342 * Called when the foreground or background color has been changed. 1322 * Called when the foreground or background color has been changed.
1343 */ 1323 */
1344 void 1324 void
1749 * Note: FrameRect() excludes right and bottom of rectangle. 1729 * Note: FrameRect() excludes right and bottom of rectangle.
1750 */ 1730 */
1751 rc.left = FILL_X(gui.col); 1731 rc.left = FILL_X(gui.col);
1752 rc.top = FILL_Y(gui.row); 1732 rc.top = FILL_Y(gui.row);
1753 rc.right = rc.left + gui.char_width; 1733 rc.right = rc.left + gui.char_width;
1754 #ifdef FEAT_MBYTE
1755 if (mb_lefthalve(gui.row, gui.col)) 1734 if (mb_lefthalve(gui.row, gui.col))
1756 rc.right += gui.char_width; 1735 rc.right += gui.char_width;
1757 #endif
1758 rc.bottom = rc.top + gui.char_height; 1736 rc.bottom = rc.top + gui.char_height;
1759 hbr = CreateSolidBrush(color); 1737 hbr = CreateSolidBrush(color);
1760 FrameRect(s_hdc, &rc, hbr); 1738 FrameRect(s_hdc, &rc, hbr);
1761 DeleteBrush(hbr); 1739 DeleteBrush(hbr);
1762 } 1740 }
2343 2321
2344 GetTextExtentPoint(hdc, (LPCSTR)str, len, &size); 2322 GetTextExtentPoint(hdc, (LPCSTR)str, len, &size);
2345 return size.cx; 2323 return size.cx;
2346 } 2324 }
2347 2325
2348 #ifdef FEAT_MBYTE
2349 /* 2326 /*
2350 * Return the width in pixels of the given text in the given DC, taking care 2327 * Return the width in pixels of the given text in the given DC, taking care
2351 * of 'encoding' to active codepage conversion. 2328 * of 'encoding' to active codepage conversion.
2352 */ 2329 */
2353 static int 2330 static int
2372 } 2349 }
2373 } 2350 }
2374 2351
2375 return GetTextWidth(hdc, str, len); 2352 return GetTextWidth(hdc, str, len);
2376 } 2353 }
2377 #else
2378 # define GetTextWidthEnc(h, s, l) GetTextWidth((h), (s), (l))
2379 #endif
2380 2354
2381 static void get_work_area(RECT *spi_rect); 2355 static void get_work_area(RECT *spi_rect);
2382 2356
2383 /* 2357 /*
2384 * A quick little routine that will center one window over another, handy for 2358 * A quick little routine that will center one window over another, handy for
2449 if (s_toolbarhwnd == NULL) 2423 if (s_toolbarhwnd == NULL)
2450 return; 2424 return;
2451 2425
2452 if (showit) 2426 if (showit)
2453 { 2427 {
2454 # ifdef FEAT_MBYTE 2428 # ifndef TB_SETUNICODEFORMAT
2455 # ifndef TB_SETUNICODEFORMAT
2456 /* For older compilers. We assume this never changes. */ 2429 /* For older compilers. We assume this never changes. */
2457 # define TB_SETUNICODEFORMAT 0x2005 2430 # define TB_SETUNICODEFORMAT 0x2005
2458 # endif 2431 # endif
2459 /* Enable/disable unicode support */ 2432 /* Enable/disable unicode support */
2460 int uu = (enc_codepage >= 0 && (int)GetACP() != enc_codepage); 2433 int uu = (enc_codepage >= 0 && (int)GetACP() != enc_codepage);
2461 SendMessage(s_toolbarhwnd, TB_SETUNICODEFORMAT, (WPARAM)uu, (LPARAM)0); 2434 SendMessage(s_toolbarhwnd, TB_SETUNICODEFORMAT, (WPARAM)uu, (LPARAM)0);
2462 # endif
2463 ShowWindow(s_toolbarhwnd, SW_SHOW); 2435 ShowWindow(s_toolbarhwnd, SW_SHOW);
2464 } 2436 }
2465 else 2437 else
2466 ShowWindow(s_toolbarhwnd, SW_HIDE); 2438 ShowWindow(s_toolbarhwnd, SW_HIDE);
2467 } 2439 }
2473 2445
2474 #if defined(FEAT_GUI_TABLINE) || defined(PROTO) 2446 #if defined(FEAT_GUI_TABLINE) || defined(PROTO)
2475 static void 2447 static void
2476 add_tabline_popup_menu_entry(HMENU pmenu, UINT item_id, char_u *item_text) 2448 add_tabline_popup_menu_entry(HMENU pmenu, UINT item_id, char_u *item_text)
2477 { 2449 {
2478 #ifdef FEAT_MBYTE
2479 WCHAR *wn = NULL; 2450 WCHAR *wn = NULL;
2480 2451
2481 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) 2452 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
2482 { 2453 {
2483 /* 'encoding' differs from active codepage: convert menu name 2454 /* 'encoding' differs from active codepage: convert menu name
2497 vim_free(wn); 2468 vim_free(wn);
2498 } 2469 }
2499 } 2470 }
2500 2471
2501 if (wn == NULL) 2472 if (wn == NULL)
2502 #endif
2503 { 2473 {
2504 MENUITEMINFO info; 2474 MENUITEMINFO info;
2505 2475
2506 info.cbSize = sizeof(info); 2476 info.cbSize = sizeof(info);
2507 info.fMask = MIIM_TYPE | MIIM_ID; 2477 info.fMask = MIIM_TYPE | MIIM_ID;
2604 tabpage_T *tp; 2574 tabpage_T *tp;
2605 TCITEM tie; 2575 TCITEM tie;
2606 int nr = 0; 2576 int nr = 0;
2607 int curtabidx = 0; 2577 int curtabidx = 0;
2608 int tabadded = 0; 2578 int tabadded = 0;
2609 #ifdef FEAT_MBYTE
2610 static int use_unicode = FALSE; 2579 static int use_unicode = FALSE;
2611 int uu; 2580 int uu;
2612 WCHAR *wstr = NULL; 2581 WCHAR *wstr = NULL;
2613 #endif
2614 2582
2615 if (s_tabhwnd == NULL) 2583 if (s_tabhwnd == NULL)
2616 return; 2584 return;
2617 2585
2618 #ifdef FEAT_MBYTE 2586 #ifndef CCM_SETUNICODEFORMAT
2619 # ifndef CCM_SETUNICODEFORMAT
2620 /* For older compilers. We assume this never changes. */ 2587 /* For older compilers. We assume this never changes. */
2621 # define CCM_SETUNICODEFORMAT 0x2005 2588 # define CCM_SETUNICODEFORMAT 0x2005
2622 # endif 2589 #endif
2623 uu = (enc_codepage >= 0 && (int)GetACP() != enc_codepage); 2590 uu = (enc_codepage >= 0 && (int)GetACP() != enc_codepage);
2624 if (uu != use_unicode) 2591 if (uu != use_unicode)
2625 { 2592 {
2626 /* Enable/disable unicode support */ 2593 /* Enable/disable unicode support */
2627 SendMessage(s_tabhwnd, CCM_SETUNICODEFORMAT, (WPARAM)uu, (LPARAM)0); 2594 SendMessage(s_tabhwnd, CCM_SETUNICODEFORMAT, (WPARAM)uu, (LPARAM)0);
2628 use_unicode = uu; 2595 use_unicode = uu;
2629 } 2596 }
2630 #endif
2631 2597
2632 tie.mask = TCIF_TEXT; 2598 tie.mask = TCIF_TEXT;
2633 tie.iImage = -1; 2599 tie.iImage = -1;
2634 2600
2635 /* Disable redraw for tab updates to eliminate O(N^2) draws. */ 2601 /* Disable redraw for tab updates to eliminate O(N^2) draws. */
2649 tabadded = 1; 2615 tabadded = 1;
2650 } 2616 }
2651 2617
2652 get_tabline_label(tp, FALSE); 2618 get_tabline_label(tp, FALSE);
2653 tie.pszText = (LPSTR)NameBuff; 2619 tie.pszText = (LPSTR)NameBuff;
2654 #ifdef FEAT_MBYTE
2655 wstr = NULL; 2620 wstr = NULL;
2656 if (use_unicode) 2621 if (use_unicode)
2657 { 2622 {
2658 /* Need to go through Unicode. */ 2623 /* Need to go through Unicode. */
2659 wstr = enc_to_utf16(NameBuff, NULL); 2624 wstr = enc_to_utf16(NameBuff, NULL);
2667 SendMessage(s_tabhwnd, TCM_SETITEMW, (WPARAM)nr, (LPARAM)&tiw); 2632 SendMessage(s_tabhwnd, TCM_SETITEMW, (WPARAM)nr, (LPARAM)&tiw);
2668 vim_free(wstr); 2633 vim_free(wstr);
2669 } 2634 }
2670 } 2635 }
2671 if (wstr == NULL) 2636 if (wstr == NULL)
2672 #endif
2673 { 2637 {
2674 TabCtrl_SetItem(s_tabhwnd, nr, &tie); 2638 TabCtrl_SetItem(s_tabhwnd, nr, &tie);
2675 } 2639 }
2676 } 2640 }
2677 2641
2768 #endif 2732 #endif
2769 2733
2770 static void 2734 static void
2771 set_window_title(HWND hwnd, char *title) 2735 set_window_title(HWND hwnd, char *title)
2772 { 2736 {
2773 #ifdef FEAT_MBYTE
2774 if (title != NULL && enc_codepage >= 0 && enc_codepage != (int)GetACP()) 2737 if (title != NULL && enc_codepage >= 0 && enc_codepage != (int)GetACP())
2775 { 2738 {
2776 WCHAR *wbuf; 2739 WCHAR *wbuf;
2777 2740
2778 /* Convert the title from 'encoding' to UTF-16. */ 2741 /* Convert the title from 'encoding' to UTF-16. */
2782 SetWindowTextW(hwnd, wbuf); 2745 SetWindowTextW(hwnd, wbuf);
2783 vim_free(wbuf); 2746 vim_free(wbuf);
2784 } 2747 }
2785 return; 2748 return;
2786 } 2749 }
2787 #endif
2788 (void)SetWindowText(hwnd, (LPCSTR)title); 2750 (void)SetWindowText(hwnd, (LPCSTR)title);
2789 } 2751 }
2790 2752
2791 void 2753 void
2792 gui_mch_find_dialog(exarg_T *eap) 2754 gui_mch_find_dialog(exarg_T *eap)
2798 DestroyWindow(s_findrep_hwnd); 2760 DestroyWindow(s_findrep_hwnd);
2799 2761
2800 if (!IsWindow(s_findrep_hwnd)) 2762 if (!IsWindow(s_findrep_hwnd))
2801 { 2763 {
2802 initialise_findrep(eap->arg); 2764 initialise_findrep(eap->arg);
2803 # ifdef FEAT_MBYTE
2804 /* If the OS is Windows NT, and 'encoding' differs from active 2765 /* If the OS is Windows NT, and 'encoding' differs from active
2805 * codepage: convert text and use wide function. */ 2766 * codepage: convert text and use wide function. */
2806 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) 2767 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
2807 { 2768 {
2808 findrep_atow(&s_findrep_struct_w, &s_findrep_struct); 2769 findrep_atow(&s_findrep_struct_w, &s_findrep_struct);
2809 s_findrep_hwnd = FindTextW( 2770 s_findrep_hwnd = FindTextW(
2810 (LPFINDREPLACEW) &s_findrep_struct_w); 2771 (LPFINDREPLACEW) &s_findrep_struct_w);
2811 } 2772 }
2812 else 2773 else
2813 # endif
2814 s_findrep_hwnd = FindText((LPFINDREPLACE) &s_findrep_struct); 2774 s_findrep_hwnd = FindText((LPFINDREPLACE) &s_findrep_struct);
2815 } 2775 }
2816 2776
2817 set_window_title(s_findrep_hwnd, _("Find string")); 2777 set_window_title(s_findrep_hwnd, _("Find string"));
2818 (void)SetFocus(s_findrep_hwnd); 2778 (void)SetFocus(s_findrep_hwnd);
2833 DestroyWindow(s_findrep_hwnd); 2793 DestroyWindow(s_findrep_hwnd);
2834 2794
2835 if (!IsWindow(s_findrep_hwnd)) 2795 if (!IsWindow(s_findrep_hwnd))
2836 { 2796 {
2837 initialise_findrep(eap->arg); 2797 initialise_findrep(eap->arg);
2838 # ifdef FEAT_MBYTE
2839 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) 2798 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
2840 { 2799 {
2841 findrep_atow(&s_findrep_struct_w, &s_findrep_struct); 2800 findrep_atow(&s_findrep_struct_w, &s_findrep_struct);
2842 s_findrep_hwnd = ReplaceTextW( 2801 s_findrep_hwnd = ReplaceTextW(
2843 (LPFINDREPLACEW) &s_findrep_struct_w); 2802 (LPFINDREPLACEW) &s_findrep_struct_w);
2844 } 2803 }
2845 else 2804 else
2846 # endif
2847 s_findrep_hwnd = ReplaceText( 2805 s_findrep_hwnd = ReplaceText(
2848 (LPFINDREPLACE) &s_findrep_struct); 2806 (LPFINDREPLACE) &s_findrep_struct);
2849 } 2807 }
2850 2808
2851 set_window_title(s_findrep_hwnd, _("Find & Replace")); 2809 set_window_title(s_findrep_hwnd, _("Find & Replace"));
2929 PAINTSTRUCT ps; 2887 PAINTSTRUCT ps;
2930 2888
2931 out_flush(); /* make sure all output has been processed */ 2889 out_flush(); /* make sure all output has been processed */
2932 (void)BeginPaint(hwnd, &ps); 2890 (void)BeginPaint(hwnd, &ps);
2933 2891
2934 #ifdef FEAT_MBYTE
2935 /* prevent multi-byte characters from misprinting on an invalid 2892 /* prevent multi-byte characters from misprinting on an invalid
2936 * rectangle */ 2893 * rectangle */
2937 if (has_mbyte) 2894 if (has_mbyte)
2938 { 2895 {
2939 RECT rect; 2896 RECT rect;
2940 2897
2941 GetClientRect(hwnd, &rect); 2898 GetClientRect(hwnd, &rect);
2942 ps.rcPaint.left = rect.left; 2899 ps.rcPaint.left = rect.left;
2943 ps.rcPaint.right = rect.right; 2900 ps.rcPaint.right = rect.right;
2944 } 2901 }
2945 #endif
2946 2902
2947 if (!IsRectEmpty(&ps.rcPaint)) 2903 if (!IsRectEmpty(&ps.rcPaint))
2948 { 2904 {
2949 gui_redraw(ps.rcPaint.left, ps.rcPaint.top, 2905 gui_redraw(ps.rcPaint.left, ps.rcPaint.top,
2950 ps.rcPaint.right - ps.rcPaint.left + 1, 2906 ps.rcPaint.right - ps.rcPaint.left + 1,
3253 char *charset_name; 3209 char *charset_name;
3254 char *quality_name; 3210 char *quality_name;
3255 char *font_name = lf.lfFaceName; 3211 char *font_name = lf.lfFaceName;
3256 3212
3257 charset_name = charset_id2name((int)lf.lfCharSet); 3213 charset_name = charset_id2name((int)lf.lfCharSet);
3258 #ifdef FEAT_MBYTE
3259 /* Convert a font name from the current codepage to 'encoding'. 3214 /* Convert a font name from the current codepage to 'encoding'.
3260 * TODO: Use Wide APIs (including LOGFONTW) instead of ANSI APIs. */ 3215 * TODO: Use Wide APIs (including LOGFONTW) instead of ANSI APIs. */
3261 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) 3216 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
3262 { 3217 {
3263 int len; 3218 int len;
3264 acp_to_enc((char_u *)lf.lfFaceName, (int)strlen(lf.lfFaceName), 3219 acp_to_enc((char_u *)lf.lfFaceName, (int)strlen(lf.lfFaceName),
3265 (char_u **)&font_name, &len); 3220 (char_u **)&font_name, &len);
3266 } 3221 }
3267 #endif
3268 quality_name = quality_id2name((int)lf.lfQuality); 3222 quality_name = quality_id2name((int)lf.lfQuality);
3269 3223
3270 res = (char *)alloc((unsigned)(strlen(font_name) + 20 3224 res = (char *)alloc((unsigned)(strlen(font_name) + 20
3271 + (charset_name == NULL ? 0 : strlen(charset_name) + 2))); 3225 + (charset_name == NULL ? 0 : strlen(charset_name) + 2)));
3272 if (res != NULL) 3226 if (res != NULL)
3299 STRCAT(p, ":q"); 3253 STRCAT(p, ":q");
3300 STRCAT(p, quality_name); 3254 STRCAT(p, quality_name);
3301 } 3255 }
3302 } 3256 }
3303 3257
3304 #ifdef FEAT_MBYTE
3305 if (font_name != lf.lfFaceName) 3258 if (font_name != lf.lfFaceName)
3306 vim_free(font_name); 3259 vim_free(font_name);
3307 #endif
3308 return (char_u *)res; 3260 return (char_u *)res;
3309 } 3261 }
3310 3262
3311 3263
3312 #ifdef FEAT_MBYTE_IME 3264 #ifdef FEAT_MBYTE_IME
3327 norm_logfont = sub_logfont; 3279 norm_logfont = sub_logfont;
3328 im_set_font(&norm_logfont); 3280 im_set_font(&norm_logfont);
3329 } 3281 }
3330 #endif 3282 #endif
3331 3283
3332 #ifdef FEAT_MBYTE
3333 /* 3284 /*
3334 * Handler of gui.wide_font (p_guifontwide) changed notification. 3285 * Handler of gui.wide_font (p_guifontwide) changed notification.
3335 */ 3286 */
3336 void 3287 void
3337 gui_mch_wide_font_changed(void) 3288 gui_mch_wide_font_changed(void)
3338 { 3289 {
3339 LOGFONT lf; 3290 LOGFONT lf;
3340 3291
3341 # ifdef FEAT_MBYTE_IME 3292 #ifdef FEAT_MBYTE_IME
3342 update_im_font(); 3293 update_im_font();
3343 # endif 3294 #endif
3344 3295
3345 gui_mch_free_font(gui.wide_ital_font); 3296 gui_mch_free_font(gui.wide_ital_font);
3346 gui.wide_ital_font = NOFONT; 3297 gui.wide_ital_font = NOFONT;
3347 gui_mch_free_font(gui.wide_bold_font); 3298 gui_mch_free_font(gui.wide_bold_font);
3348 gui.wide_bold_font = NOFONT; 3299 gui.wide_bold_font = NOFONT;
3368 gui.wide_boldital_font = get_font_handle(&lf); 3319 gui.wide_boldital_font = get_font_handle(&lf);
3369 } 3320 }
3370 } 3321 }
3371 } 3322 }
3372 } 3323 }
3373 #endif
3374 3324
3375 /* 3325 /*
3376 * Initialise vim to use the font with the given name. 3326 * Initialise vim to use the font with the given name.
3377 * Return FAIL if the font could not be loaded, OK otherwise. 3327 * Return FAIL if the font could not be loaded, OK otherwise.
3378 */ 3328 */
3572 } 3522 }
3573 #endif 3523 #endif
3574 3524
3575 #if defined(FEAT_BROWSE) || defined(PROTO) 3525 #if defined(FEAT_BROWSE) || defined(PROTO)
3576 /* 3526 /*
3577 * The file browser exists in two versions: with "W" uses wide characters,
3578 * without "W" the current codepage. When FEAT_MBYTE is defined and on
3579 * Windows NT/2000/XP the "W" functions are used.
3580 */
3581
3582 # ifdef FEAT_MBYTE
3583 /*
3584 * Wide version of convert_filter(). 3527 * Wide version of convert_filter().
3585 */ 3528 */
3586 static WCHAR * 3529 static WCHAR *
3587 convert_filterW(char_u *s) 3530 convert_filterW(char_u *s)
3588 { 3531 {
3598 vim_free(tmp); 3541 vim_free(tmp);
3599 return res; 3542 return res;
3600 } 3543 }
3601 3544
3602 /* 3545 /*
3603 * Wide version of gui_mch_browse(). Keep in sync! 3546 * Pop open a file browser and return the file selected, in allocated memory,
3547 * or NULL if Cancel is hit.
3548 * saving - TRUE if the file will be saved to, FALSE if it will be opened.
3549 * title - Title message for the file browser dialog.
3550 * dflt - Default name of file.
3551 * ext - Default extension to be added to files without extensions.
3552 * initdir - directory in which to open the browser (NULL = current dir)
3553 * filter - Filter for matched files to choose from.
3604 */ 3554 */
3605 static char_u * 3555 static char_u *
3606 gui_mch_browseW( 3556 gui_mch_browse(
3607 int saving, 3557 int saving,
3608 char_u *title, 3558 char_u *title,
3609 char_u *dflt, 3559 char_u *dflt,
3610 char_u *ext, 3560 char_u *ext,
3611 char_u *initdir, 3561 char_u *initdir,
3716 /* Shorten the file name if possible */ 3666 /* Shorten the file name if possible */
3717 q = vim_strsave(shorten_fname1(p)); 3667 q = vim_strsave(shorten_fname1(p));
3718 vim_free(p); 3668 vim_free(p);
3719 return q; 3669 return q;
3720 } 3670 }
3721 # endif /* FEAT_MBYTE */
3722 3671
3723 3672
3724 /* 3673 /*
3725 * Convert the string s to the proper format for a filter string by replacing 3674 * Convert the string s to the proper format for a filter string by replacing
3726 * the \t and \n delimiters with \0. 3675 * the \t and \n delimiters with \0.
3760 /* We fake this: Use a filter that doesn't select anything and a default 3709 /* We fake this: Use a filter that doesn't select anything and a default
3761 * file name that won't be used. */ 3710 * file name that won't be used. */
3762 return gui_mch_browse(0, title, (char_u *)_("Not Used"), NULL, 3711 return gui_mch_browse(0, title, (char_u *)_("Not Used"), NULL,
3763 initdir, (char_u *)_("Directory\t*.nothing\n")); 3712 initdir, (char_u *)_("Directory\t*.nothing\n"));
3764 } 3713 }
3765
3766 /*
3767 * Pop open a file browser and return the file selected, in allocated memory,
3768 * or NULL if Cancel is hit.
3769 * saving - TRUE if the file will be saved to, FALSE if it will be opened.
3770 * title - Title message for the file browser dialog.
3771 * dflt - Default name of file.
3772 * ext - Default extension to be added to files without extensions.
3773 * initdir - directory in which to open the browser (NULL = current dir)
3774 * filter - Filter for matched files to choose from.
3775 *
3776 * Keep in sync with gui_mch_browseW() above!
3777 */
3778 char_u *
3779 gui_mch_browse(
3780 int saving,
3781 char_u *title,
3782 char_u *dflt,
3783 char_u *ext,
3784 char_u *initdir,
3785 char_u *filter)
3786 {
3787 # ifdef FEAT_MBYTE
3788 return gui_mch_browseW(saving, title, dflt, ext, initdir, filter);
3789 # else
3790 OPENFILENAME fileStruct;
3791 char_u fileBuf[MAXPATHL];
3792 char_u *initdirp = NULL;
3793 char_u *filterp;
3794 char_u *p;
3795
3796 if (dflt == NULL)
3797 fileBuf[0] = NUL;
3798 else
3799 vim_strncpy(fileBuf, dflt, MAXPATHL - 1);
3800
3801 /* Convert the filter to Windows format. */
3802 filterp = convert_filter(filter);
3803
3804 vim_memset(&fileStruct, 0, sizeof(OPENFILENAME));
3805 # ifdef OPENFILENAME_SIZE_VERSION_400
3806 /* be compatible with Windows NT 4.0 */
3807 fileStruct.lStructSize = OPENFILENAME_SIZE_VERSION_400;
3808 # else
3809 fileStruct.lStructSize = sizeof(fileStruct);
3810 # endif
3811
3812 fileStruct.lpstrTitle = (LPSTR)title;
3813 fileStruct.lpstrDefExt = (LPSTR)ext;
3814
3815 fileStruct.lpstrFile = (LPSTR)fileBuf;
3816 fileStruct.nMaxFile = MAXPATHL;
3817 fileStruct.lpstrFilter = (LPSTR)filterp;
3818 fileStruct.hwndOwner = s_hwnd; /* main Vim window is owner*/
3819 /* has an initial dir been specified? */
3820 if (initdir != NULL && *initdir != NUL)
3821 {
3822 /* Must have backslashes here, no matter what 'shellslash' says */
3823 initdirp = vim_strsave(initdir);
3824 if (initdirp != NULL)
3825 for (p = initdirp; *p != NUL; ++p)
3826 if (*p == '/')
3827 *p = '\\';
3828 fileStruct.lpstrInitialDir = (LPSTR)initdirp;
3829 }
3830
3831 /*
3832 * TODO: Allow selection of multiple files. Needs another arg to this
3833 * function to ask for it, and need to use OFN_ALLOWMULTISELECT below.
3834 * Also, should we use OFN_FILEMUSTEXIST when opening? Vim can edit on
3835 * files that don't exist yet, so I haven't put it in. What about
3836 * OFN_PATHMUSTEXIST?
3837 * Don't use OFN_OVERWRITEPROMPT, Vim has its own ":confirm" dialog.
3838 */
3839 fileStruct.Flags = (OFN_NOCHANGEDIR | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY);
3840 # ifdef FEAT_SHORTCUT
3841 if (curbuf->b_p_bin)
3842 fileStruct.Flags |= OFN_NODEREFERENCELINKS;
3843 # endif
3844 if (saving)
3845 {
3846 if (!GetSaveFileName(&fileStruct))
3847 return NULL;
3848 }
3849 else
3850 {
3851 if (!GetOpenFileName(&fileStruct))
3852 return NULL;
3853 }
3854
3855 vim_free(filterp);
3856 vim_free(initdirp);
3857
3858 /* Give focus back to main window (when using MDI). */
3859 SetFocus(s_hwnd);
3860
3861 /* Shorten the file name if possible */
3862 return vim_strsave(shorten_fname1((char_u *)fileBuf));
3863 # endif
3864 }
3865 #endif /* FEAT_BROWSE */ 3714 #endif /* FEAT_BROWSE */
3866 3715
3867 static void 3716 static void
3868 _OnDropFiles( 3717 _OnDropFiles(
3869 HWND hwnd UNUSED, 3718 HWND hwnd UNUSED,
3870 HDROP hDrop) 3719 HDROP hDrop)
3871 { 3720 {
3872 #define BUFPATHLEN _MAX_PATH 3721 #define BUFPATHLEN _MAX_PATH
3873 #define DRAGQVAL 0xFFFFFFFF 3722 #define DRAGQVAL 0xFFFFFFFF
3874 #ifdef FEAT_MBYTE
3875 WCHAR wszFile[BUFPATHLEN]; 3723 WCHAR wszFile[BUFPATHLEN];
3876 #endif
3877 char szFile[BUFPATHLEN]; 3724 char szFile[BUFPATHLEN];
3878 UINT cFiles = DragQueryFile(hDrop, DRAGQVAL, NULL, 0); 3725 UINT cFiles = DragQueryFile(hDrop, DRAGQVAL, NULL, 0);
3879 UINT i; 3726 UINT i;
3880 char_u **fnames; 3727 char_u **fnames;
3881 POINT pt; 3728 POINT pt;
3892 fnames = (char_u **)alloc(cFiles * sizeof(char_u *)); 3739 fnames = (char_u **)alloc(cFiles * sizeof(char_u *));
3893 3740
3894 if (fnames != NULL) 3741 if (fnames != NULL)
3895 for (i = 0; i < cFiles; ++i) 3742 for (i = 0; i < cFiles; ++i)
3896 { 3743 {
3897 #ifdef FEAT_MBYTE
3898 if (DragQueryFileW(hDrop, i, wszFile, BUFPATHLEN) > 0) 3744 if (DragQueryFileW(hDrop, i, wszFile, BUFPATHLEN) > 0)
3899 fnames[i] = utf16_to_enc(wszFile, NULL); 3745 fnames[i] = utf16_to_enc(wszFile, NULL);
3900 else 3746 else
3901 #endif
3902 { 3747 {
3903 DragQueryFile(hDrop, i, szFile, BUFPATHLEN); 3748 DragQueryFile(hDrop, i, szFile, BUFPATHLEN);
3904 fnames[i] = vim_strsave((char_u *)szFile); 3749 fnames[i] = vim_strsave((char_u *)szFile);
3905 } 3750 }
3906 } 3751 }
4058 char **argv = NULL; 3903 char **argv = NULL;
4059 int round; 3904 int round;
4060 3905
4061 *tofree = NULL; 3906 *tofree = NULL;
4062 3907
4063 #ifdef FEAT_MBYTE
4064 /* Try using the Unicode version first, it takes care of conversion when 3908 /* Try using the Unicode version first, it takes care of conversion when
4065 * 'encoding' is changed. */ 3909 * 'encoding' is changed. */
4066 argc = get_cmd_argsW(&argv); 3910 argc = get_cmd_argsW(&argv);
4067 if (argc != 0) 3911 if (argc != 0)
4068 goto done; 3912 goto done;
4069 #endif
4070 3913
4071 /* Handle the program name. Remove the ".exe" extension, and find the 1st 3914 /* Handle the program name. Remove the ".exe" extension, and find the 1st
4072 * non-space. */ 3915 * non-space. */
4073 p = strrchr(prog, '.'); 3916 p = strrchr(prog, '.');
4074 if (p != NULL) 3917 if (p != NULL)
4143 } 3986 }
4144 else 3987 else
4145 { 3988 {
4146 if (pnew != NULL) 3989 if (pnew != NULL)
4147 *pnew++ = *p; 3990 *pnew++ = *p;
4148 #ifdef FEAT_MBYTE
4149 /* Can't use mb_* functions, because 'encoding' is not 3991 /* Can't use mb_* functions, because 'encoding' is not
4150 * initialized yet here. */ 3992 * initialized yet here. */
4151 if (IsDBCSLeadByte(*p)) 3993 if (IsDBCSLeadByte(*p))
4152 { 3994 {
4153 ++p; 3995 ++p;
4154 if (pnew != NULL) 3996 if (pnew != NULL)
4155 *pnew++ = *p; 3997 *pnew++ = *p;
4156 } 3998 }
4157 #endif
4158 ++p; 3999 ++p;
4159 } 4000 }
4160 } 4001 }
4161 4002
4162 if (pnew != NULL) 4003 if (pnew != NULL)
4176 pnew = newcmdline; 4017 pnew = newcmdline;
4177 *tofree = newcmdline; 4018 *tofree = newcmdline;
4178 } 4019 }
4179 } 4020 }
4180 4021
4181 #ifdef FEAT_MBYTE
4182 done: 4022 done:
4183 #endif
4184 argv[argc] = NULL; /* NULL-terminated list */ 4023 argv[argc] = NULL; /* NULL-terminated list */
4185 *argvp = argv; 4024 *argvp = argv;
4186 return argc; 4025 return argc;
4187 } 4026 }
4188 4027
4379 HINSTANCE hinst; 4218 HINSTANCE hinst;
4380 UINT uFlags; 4219 UINT uFlags;
4381 LPARAM lParam; 4220 LPARAM lParam;
4382 } NMTTDISPINFO_NEW; 4221 } NMTTDISPINFO_NEW;
4383 4222
4384 #ifdef FEAT_MBYTE
4385 typedef struct tagTOOLINFOW_NEW 4223 typedef struct tagTOOLINFOW_NEW
4386 { 4224 {
4387 UINT cbSize; 4225 UINT cbSize;
4388 UINT uFlags; 4226 UINT uFlags;
4389 HWND hwnd; 4227 HWND hwnd;
4403 HINSTANCE hinst; 4241 HINSTANCE hinst;
4404 UINT uFlags; 4242 UINT uFlags;
4405 LPARAM lParam; 4243 LPARAM lParam;
4406 } NMTTDISPINFOW_NEW; 4244 } NMTTDISPINFOW_NEW;
4407 4245
4408 #endif
4409 4246
4410 typedef HRESULT (WINAPI* DLLGETVERSIONPROC)(DLLVERSIONINFO *); 4247 typedef HRESULT (WINAPI* DLLGETVERSIONPROC)(DLLVERSIONINFO *);
4411 #ifndef TTM_SETMAXTIPWIDTH 4248 #ifndef TTM_SETMAXTIPWIDTH
4412 # define TTM_SETMAXTIPWIDTH (WM_USER+24) 4249 # define TTM_SETMAXTIPWIDTH (WM_USER+24)
4413 #endif 4250 #endif
4436 UINT uFlags; 4273 UINT uFlags;
4437 LPARAM lParam; 4274 LPARAM lParam;
4438 } NMTTDISPINFOA, *LPNMTTDISPINFOA; 4275 } NMTTDISPINFOA, *LPNMTTDISPINFOA;
4439 # define LPNMTTDISPINFO LPNMTTDISPINFOA 4276 # define LPNMTTDISPINFO LPNMTTDISPINFOA
4440 4277
4441 # ifdef FEAT_MBYTE
4442 typedef struct tagNMTTDISPINFOW { 4278 typedef struct tagNMTTDISPINFOW {
4443 NMHDR hdr; 4279 NMHDR hdr;
4444 LPWSTR lpszText; 4280 LPWSTR lpszText;
4445 WCHAR szText[80]; 4281 WCHAR szText[80];
4446 HINSTANCE hinst; 4282 HINSTANCE hinst;
4447 UINT uFlags; 4283 UINT uFlags;
4448 LPARAM lParam; 4284 LPARAM lParam;
4449 } NMTTDISPINFOW, *LPNMTTDISPINFOW; 4285 } NMTTDISPINFOW, *LPNMTTDISPINFOW;
4450 # endif
4451 # endif 4286 # endif
4452 #endif 4287 #endif
4453 4288
4454 #ifndef TTN_GETDISPINFOW 4289 #ifndef TTN_GETDISPINFOW
4455 # define TTN_GETDISPINFOW (TTN_FIRST - 10) 4290 # define TTN_GETDISPINFOW (TTN_FIRST - 10)
4968 4803
4969 #if defined(FEAT_TOOLBAR) || defined(FEAT_GUI_TABLINE) 4804 #if defined(FEAT_TOOLBAR) || defined(FEAT_GUI_TABLINE)
4970 case WM_NOTIFY: 4805 case WM_NOTIFY:
4971 switch (((LPNMHDR) lParam)->code) 4806 switch (((LPNMHDR) lParam)->code)
4972 { 4807 {
4973 # ifdef FEAT_MBYTE
4974 case TTN_GETDISPINFOW: 4808 case TTN_GETDISPINFOW:
4975 # endif
4976 case TTN_GETDISPINFO: 4809 case TTN_GETDISPINFO:
4977 { 4810 {
4978 LPNMHDR hdr = (LPNMHDR)lParam; 4811 LPNMHDR hdr = (LPNMHDR)lParam;
4979 char_u *str = NULL; 4812 char_u *str = NULL;
4980 static void *tt_text = NULL; 4813 static void *tt_text = NULL;
5032 str = pMenu->strings[MENU_INDEX_TIP]; 4865 str = pMenu->strings[MENU_INDEX_TIP];
5033 } 4866 }
5034 # endif 4867 # endif
5035 if (str != NULL) 4868 if (str != NULL)
5036 { 4869 {
5037 # ifdef FEAT_MBYTE
5038 if (hdr->code == TTN_GETDISPINFOW) 4870 if (hdr->code == TTN_GETDISPINFOW)
5039 { 4871 {
5040 LPNMTTDISPINFOW lpdi = (LPNMTTDISPINFOW)lParam; 4872 LPNMTTDISPINFOW lpdi = (LPNMTTDISPINFOW)lParam;
5041 4873
5042 /* Set the maximum width, this also enables using 4874 /* Set the maximum width, this also enables using
5047 tt_text = enc_to_utf16(str, NULL); 4879 tt_text = enc_to_utf16(str, NULL);
5048 lpdi->lpszText = tt_text; 4880 lpdi->lpszText = tt_text;
5049 /* can't show tooltip if failed */ 4881 /* can't show tooltip if failed */
5050 } 4882 }
5051 else 4883 else
5052 # endif
5053 { 4884 {
5054 LPNMTTDISPINFO lpdi = (LPNMTTDISPINFO)lParam; 4885 LPNMTTDISPINFO lpdi = (LPNMTTDISPINFO)lParam;
5055 4886
5056 /* Set the maximum width, this also enables using 4887 /* Set the maximum width, this also enables using
5057 * \n for line break. */ 4888 * \n for line break. */
5351 gui_mch_init(void) 5182 gui_mch_init(void)
5352 { 5183 {
5353 const char szVimWndClass[] = VIM_CLASS; 5184 const char szVimWndClass[] = VIM_CLASS;
5354 const char szTextAreaClass[] = "VimTextArea"; 5185 const char szTextAreaClass[] = "VimTextArea";
5355 WNDCLASS wndclass; 5186 WNDCLASS wndclass;
5356 #ifdef FEAT_MBYTE
5357 const WCHAR szVimWndClassW[] = VIM_CLASSW; 5187 const WCHAR szVimWndClassW[] = VIM_CLASSW;
5358 const WCHAR szTextAreaClassW[] = L"VimTextArea"; 5188 const WCHAR szTextAreaClassW[] = L"VimTextArea";
5359 WNDCLASSW wndclassw; 5189 WNDCLASSW wndclassw;
5360 #endif
5361 #ifdef GLOBAL_IME 5190 #ifdef GLOBAL_IME
5362 ATOM atom; 5191 ATOM atom;
5363 #endif 5192 #endif
5364 5193
5365 /* Return here if the window was already opened (happens when 5194 /* Return here if the window was already opened (happens when
5381 #endif 5210 #endif
5382 gui.border_width = 0; 5211 gui.border_width = 0;
5383 5212
5384 s_brush = CreateSolidBrush(GetSysColor(COLOR_BTNFACE)); 5213 s_brush = CreateSolidBrush(GetSysColor(COLOR_BTNFACE));
5385 5214
5386 #ifdef FEAT_MBYTE
5387 /* First try using the wide version, so that we can use any title. 5215 /* First try using the wide version, so that we can use any title.
5388 * Otherwise only characters in the active codepage will work. */ 5216 * Otherwise only characters in the active codepage will work. */
5389 if (GetClassInfoW(s_hinst, szVimWndClassW, &wndclassw) == 0) 5217 if (GetClassInfoW(s_hinst, szVimWndClassW, &wndclassw) == 0)
5390 { 5218 {
5391 wndclassw.style = CS_DBLCLKS; 5219 wndclassw.style = CS_DBLCLKS;
5408 else 5236 else
5409 wide_WindowProc = TRUE; 5237 wide_WindowProc = TRUE;
5410 } 5238 }
5411 5239
5412 if (!wide_WindowProc) 5240 if (!wide_WindowProc)
5413 #endif 5241 if (GetClassInfo(s_hinst, szVimWndClass, &wndclass) == 0)
5414 5242 {
5415 if (GetClassInfo(s_hinst, szVimWndClass, &wndclass) == 0) 5243 wndclass.style = CS_DBLCLKS;
5416 { 5244 wndclass.lpfnWndProc = _WndProc;
5417 wndclass.style = CS_DBLCLKS; 5245 wndclass.cbClsExtra = 0;
5418 wndclass.lpfnWndProc = _WndProc; 5246 wndclass.cbWndExtra = 0;
5419 wndclass.cbClsExtra = 0; 5247 wndclass.hInstance = s_hinst;
5420 wndclass.cbWndExtra = 0; 5248 wndclass.hIcon = LoadIcon(wndclass.hInstance, "IDR_VIM");
5421 wndclass.hInstance = s_hinst; 5249 wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
5422 wndclass.hIcon = LoadIcon(wndclass.hInstance, "IDR_VIM"); 5250 wndclass.hbrBackground = s_brush;
5423 wndclass.hCursor = LoadCursor(NULL, IDC_ARROW); 5251 wndclass.lpszMenuName = NULL;
5424 wndclass.hbrBackground = s_brush; 5252 wndclass.lpszClassName = szVimWndClass;
5425 wndclass.lpszMenuName = NULL; 5253
5426 wndclass.lpszClassName = szVimWndClass; 5254 if ((
5427
5428 if ((
5429 #ifdef GLOBAL_IME 5255 #ifdef GLOBAL_IME
5430 atom = 5256 atom =
5431 #endif 5257 #endif
5432 RegisterClass(&wndclass)) == 0) 5258 RegisterClass(&wndclass)) == 0)
5433 return FAIL; 5259 return FAIL;
5434 } 5260 }
5435 5261
5436 if (vim_parent_hwnd != NULL) 5262 if (vim_parent_hwnd != NULL)
5437 { 5263 {
5438 #ifdef HAVE_TRY_EXCEPT 5264 #ifdef HAVE_TRY_EXCEPT
5439 __try 5265 __try
5501 #if defined(FEAT_MBYTE_IME) && defined(DYNAMIC_IME) 5327 #if defined(FEAT_MBYTE_IME) && defined(DYNAMIC_IME)
5502 dyn_imm_load(); 5328 dyn_imm_load();
5503 #endif 5329 #endif
5504 5330
5505 /* Create the text area window */ 5331 /* Create the text area window */
5506 #ifdef FEAT_MBYTE
5507 if (wide_WindowProc) 5332 if (wide_WindowProc)
5508 { 5333 {
5509 if (GetClassInfoW(s_hinst, szTextAreaClassW, &wndclassw) == 0) 5334 if (GetClassInfoW(s_hinst, szTextAreaClassW, &wndclassw) == 0)
5510 { 5335 {
5511 wndclassw.style = CS_OWNDC; 5336 wndclassw.style = CS_OWNDC;
5530 100, // Any value will do for now 5355 100, // Any value will do for now
5531 100, // Any value will do for now 5356 100, // Any value will do for now
5532 s_hwnd, NULL, 5357 s_hwnd, NULL,
5533 s_hinst, NULL); 5358 s_hinst, NULL);
5534 } 5359 }
5535 else 5360 else if (GetClassInfo(s_hinst, szTextAreaClass, &wndclass) == 0)
5536 #endif
5537 if (GetClassInfo(s_hinst, szTextAreaClass, &wndclass) == 0)
5538 { 5361 {
5539 wndclass.style = CS_OWNDC; 5362 wndclass.style = CS_OWNDC;
5540 wndclass.lpfnWndProc = _TextAreaWndProc; 5363 wndclass.lpfnWndProc = _TextAreaWndProc;
5541 wndclass.cbClsExtra = 0; 5364 wndclass.cbClsExtra = 0;
5542 wndclass.cbWndExtra = 0; 5365 wndclass.cbWndExtra = 0;
5640 s_findrep_struct.lpstrFindWhat[0] = NUL; 5463 s_findrep_struct.lpstrFindWhat[0] = NUL;
5641 s_findrep_struct.lpstrReplaceWith = (LPSTR)alloc(MSWIN_FR_BUFSIZE); 5464 s_findrep_struct.lpstrReplaceWith = (LPSTR)alloc(MSWIN_FR_BUFSIZE);
5642 s_findrep_struct.lpstrReplaceWith[0] = NUL; 5465 s_findrep_struct.lpstrReplaceWith[0] = NUL;
5643 s_findrep_struct.wFindWhatLen = MSWIN_FR_BUFSIZE; 5466 s_findrep_struct.wFindWhatLen = MSWIN_FR_BUFSIZE;
5644 s_findrep_struct.wReplaceWithLen = MSWIN_FR_BUFSIZE; 5467 s_findrep_struct.wReplaceWithLen = MSWIN_FR_BUFSIZE;
5645 # ifdef FEAT_MBYTE
5646 s_findrep_struct_w.lStructSize = sizeof(s_findrep_struct_w); 5468 s_findrep_struct_w.lStructSize = sizeof(s_findrep_struct_w);
5647 s_findrep_struct_w.lpstrFindWhat = 5469 s_findrep_struct_w.lpstrFindWhat =
5648 (LPWSTR)alloc(MSWIN_FR_BUFSIZE * sizeof(WCHAR)); 5470 (LPWSTR)alloc(MSWIN_FR_BUFSIZE * sizeof(WCHAR));
5649 s_findrep_struct_w.lpstrFindWhat[0] = NUL; 5471 s_findrep_struct_w.lpstrFindWhat[0] = NUL;
5650 s_findrep_struct_w.lpstrReplaceWith = 5472 s_findrep_struct_w.lpstrReplaceWith =
5651 (LPWSTR)alloc(MSWIN_FR_BUFSIZE * sizeof(WCHAR)); 5473 (LPWSTR)alloc(MSWIN_FR_BUFSIZE * sizeof(WCHAR));
5652 s_findrep_struct_w.lpstrReplaceWith[0] = NUL; 5474 s_findrep_struct_w.lpstrReplaceWith[0] = NUL;
5653 s_findrep_struct_w.wFindWhatLen = MSWIN_FR_BUFSIZE; 5475 s_findrep_struct_w.wFindWhatLen = MSWIN_FR_BUFSIZE;
5654 s_findrep_struct_w.wReplaceWithLen = MSWIN_FR_BUFSIZE; 5476 s_findrep_struct_w.wReplaceWithLen = MSWIN_FR_BUFSIZE;
5655 # endif
5656 #endif 5477 #endif
5657 5478
5658 #ifdef FEAT_EVAL 5479 #ifdef FEAT_EVAL
5659 # if !defined(_MSC_VER) || (_MSC_VER < 1400) 5480 # if !defined(_MSC_VER) || (_MSC_VER < 1400)
5660 /* Define HandleToLong for old MS and non-MS compilers if not defined. */ 5481 /* Define HandleToLong for old MS and non-MS compilers if not defined. */
6147 return status; 5968 return status;
6148 } 5969 }
6149 5970
6150 #endif /* FEAT_MBYTE_IME */ 5971 #endif /* FEAT_MBYTE_IME */
6151 5972
6152 #if defined(FEAT_MBYTE) && !defined(FEAT_MBYTE_IME) && defined(GLOBAL_IME) 5973 #if !defined(FEAT_MBYTE_IME) && defined(GLOBAL_IME)
6153 /* Win32 with GLOBAL IME */ 5974 /* Win32 with GLOBAL IME */
6154 5975
6155 /* 5976 /*
6156 * Notify cursor position to IM. 5977 * Notify cursor position to IM.
6157 */ 5978 */
6184 { 6005 {
6185 return global_ime_get_status(); 6006 return global_ime_get_status();
6186 } 6007 }
6187 #endif 6008 #endif
6188 6009
6189 #ifdef FEAT_MBYTE
6190 /* 6010 /*
6191 * Convert latin9 text "text[len]" to ucs-2 in "unicodebuf". 6011 * Convert latin9 text "text[len]" to ucs-2 in "unicodebuf".
6192 */ 6012 */
6193 static void 6013 static void
6194 latin9_to_ucs(char_u *text, int len, WCHAR *unicodebuf) 6014 latin9_to_ucs(char_u *text, int len, WCHAR *unicodebuf)
6210 case 0xbe: c = 0x0178; break; /* Y */ 6030 case 0xbe: c = 0x0178; break; /* Y */
6211 } 6031 }
6212 *unicodebuf++ = c; 6032 *unicodebuf++ = c;
6213 } 6033 }
6214 } 6034 }
6215 #endif
6216 6035
6217 #ifdef FEAT_RIGHTLEFT 6036 #ifdef FEAT_RIGHTLEFT
6218 /* 6037 /*
6219 * What is this for? In the case where you are using Win98 or Win2K or later, 6038 * What is this for? In the case where you are using Win98 or Win2K or later,
6220 * and you are using a Hebrew font (or Arabic!), Windows does you a favor and 6039 * and you are using a Hebrew font (or Arabic!), Windows does you a favor and
6317 static int *padding = NULL; 6136 static int *padding = NULL;
6318 static int pad_size = 0; 6137 static int pad_size = 0;
6319 int i; 6138 int i;
6320 const RECT *pcliprect = NULL; 6139 const RECT *pcliprect = NULL;
6321 UINT foptions = 0; 6140 UINT foptions = 0;
6322 #ifdef FEAT_MBYTE
6323 static WCHAR *unicodebuf = NULL; 6141 static WCHAR *unicodebuf = NULL;
6324 static int *unicodepdy = NULL; 6142 static int *unicodepdy = NULL;
6325 static int unibuflen = 0; 6143 static int unibuflen = 0;
6326 int n = 0; 6144 int n = 0;
6327 #endif
6328 int y; 6145 int y;
6329 6146
6330 /* 6147 /*
6331 * Italic and bold text seems to have an extra row of pixels at the bottom 6148 * Italic and bold text seems to have an extra row of pixels at the bottom
6332 * (below where the bottom of the character should be). If we draw the 6149 * (below where the bottom of the character should be). If we draw the
6352 * Clear background first. 6169 * Clear background first.
6353 * Note: FillRect() excludes right and bottom of rectangle. 6170 * Note: FillRect() excludes right and bottom of rectangle.
6354 */ 6171 */
6355 rc.left = FILL_X(col); 6172 rc.left = FILL_X(col);
6356 rc.top = FILL_Y(row); 6173 rc.top = FILL_Y(row);
6357 #ifdef FEAT_MBYTE
6358 if (has_mbyte) 6174 if (has_mbyte)
6359 { 6175 {
6360 /* Compute the length in display cells. */ 6176 /* Compute the length in display cells. */
6361 rc.right = FILL_X(col + mb_string2cells(text, len)); 6177 rc.right = FILL_X(col + mb_string2cells(text, len));
6362 } 6178 }
6363 else 6179 else
6364 #endif
6365 rc.right = FILL_X(col + len); 6180 rc.right = FILL_X(col + len);
6366 rc.bottom = FILL_Y(row + 1); 6181 rc.bottom = FILL_Y(row + 1);
6367 6182
6368 /* Cache the created brush, that saves a lot of time. We need two: 6183 /* Cache the created brush, that saves a lot of time. We need two:
6369 * one for cursor background and one for the normal background. */ 6184 * one for cursor background and one for the normal background. */
6427 * of fixed-width fonts are often one pixel or so wider than their normal 6242 * of fixed-width fonts are often one pixel or so wider than their normal
6428 * versions. 6243 * versions.
6429 * No check for DRAW_BOLD, Windows will have done it already. 6244 * No check for DRAW_BOLD, Windows will have done it already.
6430 */ 6245 */
6431 6246
6432 #ifdef FEAT_MBYTE
6433 /* Check if there are any UTF-8 characters. If not, use normal text 6247 /* Check if there are any UTF-8 characters. If not, use normal text
6434 * output to speed up output. */ 6248 * output to speed up output. */
6435 if (enc_utf8) 6249 if (enc_utf8)
6436 for (n = 0; n < len; ++n) 6250 for (n = 0; n < len; ++n)
6437 if (text[n] >= 0x80) 6251 if (text[n] >= 0x80)
6438 break; 6252 break;
6439 6253
6440 # if defined(FEAT_DIRECTX) 6254 #if defined(FEAT_DIRECTX)
6441 /* Quick hack to enable DirectWrite. To use DirectWrite (antialias), it is 6255 /* Quick hack to enable DirectWrite. To use DirectWrite (antialias), it is
6442 * required that unicode drawing routine, currently. So this forces it 6256 * required that unicode drawing routine, currently. So this forces it
6443 * enabled. */ 6257 * enabled. */
6444 if (IS_ENABLE_DIRECTX()) 6258 if (IS_ENABLE_DIRECTX())
6445 n = 0; /* Keep n < len, to enter block for unicode. */ 6259 n = 0; /* Keep n < len, to enter block for unicode. */
6446 # endif 6260 #endif
6447 6261
6448 /* Check if the Unicode buffer exists and is big enough. Create it 6262 /* Check if the Unicode buffer exists and is big enough. Create it
6449 * with the same length as the multi-byte string, the number of wide 6263 * with the same length as the multi-byte string, the number of wide
6450 * characters is always equal or smaller. */ 6264 * characters is always equal or smaller. */
6451 if ((enc_utf8 6265 if ((enc_utf8
6514 } 6328 }
6515 cells += cw; 6329 cells += cw;
6516 i += utf_ptr2len_len(text + i, len - i); 6330 i += utf_ptr2len_len(text + i, len - i);
6517 ++clen; 6331 ++clen;
6518 } 6332 }
6519 # if defined(FEAT_DIRECTX) 6333 #if defined(FEAT_DIRECTX)
6520 if (IS_ENABLE_DIRECTX()) 6334 if (IS_ENABLE_DIRECTX())
6521 { 6335 {
6522 /* Add one to "cells" for italics. */ 6336 /* Add one to "cells" for italics. */
6523 DWriteContext_DrawText(s_dwc, unicodebuf, wlen, 6337 DWriteContext_DrawText(s_dwc, unicodebuf, wlen,
6524 TEXT_X(col), TEXT_Y(row), FILL_X(cells + 1), FILL_Y(1), 6338 TEXT_X(col), TEXT_Y(row), FILL_X(cells + 1), FILL_Y(1),
6525 gui.char_width, gui.currFgColor, 6339 gui.char_width, gui.currFgColor,
6526 foptions, pcliprect, unicodepdy); 6340 foptions, pcliprect, unicodepdy);
6527 } 6341 }
6528 else 6342 else
6529 # endif 6343 #endif
6530 ExtTextOutW(s_hdc, TEXT_X(col), TEXT_Y(row), 6344 ExtTextOutW(s_hdc, TEXT_X(col), TEXT_Y(row),
6531 foptions, pcliprect, unicodebuf, wlen, unicodepdy); 6345 foptions, pcliprect, unicodebuf, wlen, unicodepdy);
6532 len = cells; /* used for underlining */ 6346 len = cells; /* used for underlining */
6533 } 6347 }
6534 else if ((enc_codepage > 0 && (int)GetACP() != enc_codepage) || enc_latin9) 6348 else if ((enc_codepage > 0 && (int)GetACP() != enc_codepage) || enc_latin9)
6566 foptions, pcliprect, unicodebuf, len, unicodepdy); 6380 foptions, pcliprect, unicodebuf, len, unicodepdy);
6567 } 6381 }
6568 } 6382 }
6569 } 6383 }
6570 else 6384 else
6571 #endif
6572 { 6385 {
6573 #ifdef FEAT_RIGHTLEFT 6386 #ifdef FEAT_RIGHTLEFT
6574 /* Windows will mess up RL text, so we have to draw it character by 6387 /* Windows will mess up RL text, so we have to draw it character by
6575 * character. Only do this if RL is on, since it's slow. */ 6388 * character. Only do this if RL is on, since it's slow. */
6576 if (curwin->w_p_rl) 6389 if (curwin->w_p_rl)
6688 menu->submenu_id = CreatePopupMenu(); 6501 menu->submenu_id = CreatePopupMenu();
6689 menu->id = s_menu_id++; 6502 menu->id = s_menu_id++;
6690 6503
6691 if (menu_is_menubar(menu->name)) 6504 if (menu_is_menubar(menu->name))
6692 { 6505 {
6693 #ifdef FEAT_MBYTE
6694 WCHAR *wn = NULL; 6506 WCHAR *wn = NULL;
6695 6507
6696 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) 6508 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
6697 { 6509 {
6698 /* 'encoding' differs from active codepage: convert menu name 6510 /* 'encoding' differs from active codepage: convert menu name
6717 vim_free(wn); 6529 vim_free(wn);
6718 } 6530 }
6719 } 6531 }
6720 6532
6721 if (wn == NULL) 6533 if (wn == NULL)
6722 #endif
6723 { 6534 {
6724 MENUITEMINFO info; 6535 MENUITEMINFO info;
6725 6536
6726 info.cbSize = sizeof(info); 6537 info.cbSize = sizeof(info);
6727 info.fMask = MIIM_DATA | MIIM_TYPE | MIIM_ID | MIIM_SUBMENU; 6538 info.fMask = MIIM_DATA | MIIM_TYPE | MIIM_ID | MIIM_SUBMENU;
6845 menu->submenu_id = (HMENU)-1; 6656 menu->submenu_id = (HMENU)-1;
6846 } 6657 }
6847 else 6658 else
6848 #endif 6659 #endif
6849 { 6660 {
6850 #ifdef FEAT_MBYTE
6851 WCHAR *wn = NULL; 6661 WCHAR *wn = NULL;
6852 6662
6853 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) 6663 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
6854 { 6664 {
6855 /* 'encoding' differs from active codepage: convert menu item name 6665 /* 'encoding' differs from active codepage: convert menu item name
6863 (UINT)menu->id, wn); 6673 (UINT)menu->id, wn);
6864 vim_free(wn); 6674 vim_free(wn);
6865 } 6675 }
6866 } 6676 }
6867 if (wn == NULL) 6677 if (wn == NULL)
6868 #endif
6869 InsertMenu(parent->submenu_id, (UINT)idx, 6678 InsertMenu(parent->submenu_id, (UINT)idx,
6870 (menu_is_separator(menu->name) ? MF_SEPARATOR : MF_STRING) 6679 (menu_is_separator(menu->name) ? MF_SEPARATOR : MF_STRING)
6871 | MF_BYPOSITION, 6680 | MF_BYPOSITION,
6872 (UINT)menu->id, (LPCTSTR)menu->name); 6681 (UINT)menu->id, (LPCTSTR)menu->name);
6873 #ifdef FEAT_TEAROFF 6682 #ifdef FEAT_TEAROFF
7057 return TRUE; 6866 return TRUE;
7058 6867
7059 /* If the edit box exists, copy the string. */ 6868 /* If the edit box exists, copy the string. */
7060 if (s_textfield != NULL) 6869 if (s_textfield != NULL)
7061 { 6870 {
7062 # ifdef FEAT_MBYTE
7063 /* If the OS is Windows NT, and 'encoding' differs from active 6871 /* If the OS is Windows NT, and 'encoding' differs from active
7064 * codepage: use wide function and convert text. */ 6872 * codepage: use wide function and convert text. */
7065 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) 6873 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
7066 { 6874 {
7067 WCHAR *wp = (WCHAR *)alloc(IOSIZE * sizeof(WCHAR)); 6875 WCHAR *wp = (WCHAR *)alloc(IOSIZE * sizeof(WCHAR));
7072 vim_strncpy(s_textfield, p, IOSIZE); 6880 vim_strncpy(s_textfield, p, IOSIZE);
7073 vim_free(p); 6881 vim_free(p);
7074 vim_free(wp); 6882 vim_free(wp);
7075 } 6883 }
7076 else 6884 else
7077 # endif
7078 GetDlgItemText(hwnd, DLG_NONBUTTON_CONTROL + 2, 6885 GetDlgItemText(hwnd, DLG_NONBUTTON_CONTROL + 2,
7079 (LPSTR)s_textfield, IOSIZE); 6886 (LPSTR)s_textfield, IOSIZE);
7080 } 6887 }
7081 6888
7082 /* 6889 /*
7304 * wrapped lines. */ 7111 * wrapped lines. */
7305 textWidth = 0; 7112 textWidth = 0;
7306 last_white = NULL; 7113 last_white = NULL;
7307 for (pend = pstart; *pend != NUL && *pend != '\n'; ) 7114 for (pend = pstart; *pend != NUL && *pend != '\n'; )
7308 { 7115 {
7309 #ifdef FEAT_MBYTE
7310 l = (*mb_ptr2len)(pend); 7116 l = (*mb_ptr2len)(pend);
7311 #else
7312 l = 1;
7313 #endif
7314 if (l == 1 && VIM_ISWHITE(*pend) 7117 if (l == 1 && VIM_ISWHITE(*pend)
7315 && textWidth > maxDialogWidth * 3 / 4) 7118 && textWidth > maxDialogWidth * 3 / 4)
7316 last_white = pend; 7119 last_white = pend;
7317 textWidth += GetTextWidthEnc(hdc, pend, l); 7120 textWidth += GetTextWidthEnc(hdc, pend, l);
7318 if (textWidth >= maxDialogWidth) 7121 if (textWidth >= maxDialogWidth)
7691 LPWORD lpWCStr, 7494 LPWORD lpWCStr,
7692 LPSTR lpAnsiIn, 7495 LPSTR lpAnsiIn,
7693 BOOL use_enc) 7496 BOOL use_enc)
7694 { 7497 {
7695 int nChar = 0; 7498 int nChar = 0;
7696 #ifdef FEAT_MBYTE
7697 int len = lstrlen(lpAnsiIn) + 1; /* include NUL character */ 7499 int len = lstrlen(lpAnsiIn) + 1; /* include NUL character */
7698 int i; 7500 int i;
7699 WCHAR *wn; 7501 WCHAR *wn;
7700 7502
7701 if (use_enc && enc_codepage >= 0 && (int)GetACP() != enc_codepage) 7503 if (use_enc && enc_codepage >= 0 && (int)GetACP() != enc_codepage)
7717 lpAnsiIn, len, 7519 lpAnsiIn, len,
7718 lpWCStr, len); 7520 lpWCStr, len);
7719 for (i = 0; i < nChar; ++i) 7521 for (i = 0; i < nChar; ++i)
7720 if (lpWCStr[i] == (WORD)'\t') /* replace tabs with spaces */ 7522 if (lpWCStr[i] == (WORD)'\t') /* replace tabs with spaces */
7721 lpWCStr[i] = (WORD)' '; 7523 lpWCStr[i] = (WORD)' ';
7722 #else
7723 do
7724 {
7725 if (*lpAnsiIn == '\t')
7726 *lpWCStr++ = (WORD)' ';
7727 else
7728 *lpWCStr++ = (WORD)*lpAnsiIn;
7729 nChar++;
7730 } while (*lpAnsiIn++);
7731 #endif
7732 7524
7733 return nChar; 7525 return nChar;
7734 } 7526 }
7735 7527
7736 7528
8773 } 8565 }
8774 multiline_tip = FALSE; 8566 multiline_tip = FALSE;
8775 return multiline_tip; 8567 return multiline_tip;
8776 } 8568 }
8777 8569
8778 #ifdef FEAT_MBYTE
8779 static void 8570 static void
8780 make_tooltipw(BalloonEval *beval, char *text, POINT pt) 8571 make_tooltipw(BalloonEval *beval, char *text, POINT pt)
8781 { 8572 {
8782 TOOLINFOW *pti; 8573 TOOLINFOW *pti;
8783 int ToolInfoSize; 8574 int ToolInfoSize;
8843 */ 8634 */
8844 mouse_event(MOUSEEVENTF_MOVE, 2, 2, 0, 0); 8635 mouse_event(MOUSEEVENTF_MOVE, 2, 2, 0, 0);
8845 mouse_event(MOUSEEVENTF_MOVE, (DWORD)-1, (DWORD)-1, 0, 0); 8636 mouse_event(MOUSEEVENTF_MOVE, (DWORD)-1, (DWORD)-1, 0, 0);
8846 vim_free(pti); 8637 vim_free(pti);
8847 } 8638 }
8848 #endif
8849 8639
8850 static void 8640 static void
8851 make_tooltip(BalloonEval *beval, char *text, POINT pt) 8641 make_tooltip(BalloonEval *beval, char *text, POINT pt)
8852 { 8642 {
8853 TOOLINFO *pti; 8643 TOOLINFO *pti;
8854 int ToolInfoSize; 8644 int ToolInfoSize;
8855 8645
8856 #ifdef FEAT_MBYTE
8857 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) 8646 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
8858 { 8647 {
8859 make_tooltipw(beval, text, pt); 8648 make_tooltipw(beval, text, pt);
8860 return; 8649 return;
8861 } 8650 }
8862 #endif
8863 8651
8864 if (multiline_balloon_available() == TRUE) 8652 if (multiline_balloon_available() == TRUE)
8865 ToolInfoSize = sizeof(TOOLINFO_NEW); 8653 ToolInfoSize = sizeof(TOOLINFO_NEW);
8866 else 8654 else
8867 ToolInfoSize = sizeof(TOOLINFO); 8655 ToolInfoSize = sizeof(TOOLINFO);
9070 NMTTDISPINFO_NEW *info = (NMTTDISPINFO_NEW *)pnmh; 8858 NMTTDISPINFO_NEW *info = (NMTTDISPINFO_NEW *)pnmh;
9071 info->lpszText = (LPSTR)info->lParam; 8859 info->lpszText = (LPSTR)info->lParam;
9072 info->uFlags |= TTF_DI_SETITEM; 8860 info->uFlags |= TTF_DI_SETITEM;
9073 } 8861 }
9074 break; 8862 break;
9075 #ifdef FEAT_MBYTE
9076 case TTN_GETDISPINFOW: 8863 case TTN_GETDISPINFOW:
9077 { 8864 {
9078 // if we get here then we have new common controls 8865 // if we get here then we have new common controls
9079 NMTTDISPINFOW_NEW *info = (NMTTDISPINFOW_NEW *)pnmh; 8866 NMTTDISPINFOW_NEW *info = (NMTTDISPINFOW_NEW *)pnmh;
9080 info->lpszText = (LPWSTR)info->lParam; 8867 info->lpszText = (LPWSTR)info->lParam;
9081 info->uFlags |= TTF_DI_SETITEM; 8868 info->uFlags |= TTF_DI_SETITEM;
9082 } 8869 }
9083 break; 8870 break;
9084 #endif
9085 } 8871 }
9086 } 8872 }
9087 } 8873 }
9088 8874
9089 static void 8875 static void