comparison src/gui_w48.c @ 1795:1fc8d918d9fc v7.2.093

updated for version 7.2-093
author vimboss
date Wed, 28 Jan 2009 20:23:17 +0000
parents 5e225f973b5d
children 8e2d14a3e7d2
comparison
equal deleted inserted replaced
1794:54d5eb36689f 1795:1fc8d918d9fc
151 static int destroying = FALSE; /* call DestroyWindow() ourselves */ 151 static int destroying = FALSE; /* call DestroyWindow() ourselves */
152 152
153 #ifdef MSWIN_FIND_REPLACE 153 #ifdef MSWIN_FIND_REPLACE
154 static UINT s_findrep_msg = 0; /* set in gui_w[16/32].c */ 154 static UINT s_findrep_msg = 0; /* set in gui_w[16/32].c */
155 static FINDREPLACE s_findrep_struct; 155 static FINDREPLACE s_findrep_struct;
156 # if defined(FEAT_MBYTE) && defined(WIN3264)
157 static FINDREPLACEW s_findrep_struct_w;
158 # endif
156 static HWND s_findrep_hwnd = NULL; 159 static HWND s_findrep_hwnd = NULL;
157 static int s_findrep_is_find; /* TRUE for find dialog, FALSE 160 static int s_findrep_is_find; /* TRUE for find dialog, FALSE
158 for find/replace dialog */ 161 for find/replace dialog */
159 #endif 162 #endif
160 163
882 gui_menu_cb(pMenu); 885 gui_menu_cb(pMenu);
883 } 886 }
884 #endif 887 #endif
885 888
886 #ifdef MSWIN_FIND_REPLACE 889 #ifdef MSWIN_FIND_REPLACE
890 # if defined(FEAT_MBYTE) && defined(WIN3264)
891 /*
892 * copy useful data from structure LPFINDREPLACE to structure LPFINDREPLACEW
893 */
894 static void
895 findrep_atow(LPFINDREPLACEW lpfrw, LPFINDREPLACE lpfr)
896 {
897 WCHAR *wp;
898
899 lpfrw->hwndOwner = lpfr->hwndOwner;
900 lpfrw->Flags = lpfr->Flags;
901
902 wp = enc_to_utf16(lpfr->lpstrFindWhat, NULL);
903 wcsncpy(lpfrw->lpstrFindWhat, wp, lpfrw->wFindWhatLen - 1);
904 vim_free(wp);
905
906 /* the field "lpstrReplaceWith" doesn't need to be copied */
907 }
908
909 /*
910 * copy useful data from structure LPFINDREPLACEW to structure LPFINDREPLACE
911 */
912 static void
913 findrep_wtoa(LPFINDREPLACE lpfr, LPFINDREPLACEW lpfrw)
914 {
915 char_u *p;
916
917 lpfr->Flags = lpfrw->Flags;
918
919 p = utf16_to_enc(lpfrw->lpstrFindWhat, NULL);
920 vim_strncpy(lpfr->lpstrFindWhat, p, lpfr->wFindWhatLen - 1);
921 vim_free(p);
922
923 p = utf16_to_enc(lpfrw->lpstrReplaceWith, NULL);
924 vim_strncpy(lpfr->lpstrReplaceWith, p, lpfr->wReplaceWithLen - 1);
925 vim_free(p);
926 }
927 # endif
928
887 /* 929 /*
888 * Handle a Find/Replace window message. 930 * Handle a Find/Replace window message.
889 */ 931 */
890 static void 932 static void
891 _OnFindRepl(void) 933 _OnFindRepl(void)
892 { 934 {
893 int flags = 0; 935 int flags = 0;
894 int down; 936 int down;
937
938 # if defined(FEAT_MBYTE) && defined(WIN3264)
939 /* If the OS is Windows NT, and 'encoding' differs from active codepage:
940 * convert text from wide string. */
941 if (os_version.dwPlatformId == VER_PLATFORM_WIN32_NT
942 && enc_codepage >= 0 && (int)GetACP() != enc_codepage)
943 {
944 findrep_wtoa(&s_findrep_struct, &s_findrep_struct_w);
945 }
946 # endif
895 947
896 if (s_findrep_struct.Flags & FR_DIALOGTERM) 948 if (s_findrep_struct.Flags & FR_DIALOGTERM)
897 /* Give main window the focus back. */ 949 /* Give main window the focus back. */
898 (void)SetFocus(s_hwnd); 950 (void)SetFocus(s_hwnd);
899 951
2560 DestroyWindow(s_findrep_hwnd); 2612 DestroyWindow(s_findrep_hwnd);
2561 2613
2562 if (!IsWindow(s_findrep_hwnd)) 2614 if (!IsWindow(s_findrep_hwnd))
2563 { 2615 {
2564 initialise_findrep(eap->arg); 2616 initialise_findrep(eap->arg);
2565 s_findrep_hwnd = FindText((LPFINDREPLACE) &s_findrep_struct); 2617 # if defined(FEAT_MBYTE) && defined(WIN3264)
2618 /* If the OS is Windows NT, and 'encoding' differs from active
2619 * codepage: convert text and use wide function. */
2620 if (os_version.dwPlatformId == VER_PLATFORM_WIN32_NT
2621 && enc_codepage >= 0 && (int)GetACP() != enc_codepage)
2622 {
2623 findrep_atow(&s_findrep_struct_w, &s_findrep_struct);
2624 s_findrep_hwnd = FindTextW(
2625 (LPFINDREPLACEW) &s_findrep_struct_w);
2626 }
2627 else
2628 # endif
2629 s_findrep_hwnd = FindText((LPFINDREPLACE) &s_findrep_struct);
2566 } 2630 }
2567 2631
2568 set_window_title(s_findrep_hwnd, 2632 set_window_title(s_findrep_hwnd,
2569 _("Find string (use '\\\\' to find a '\\')")); 2633 _("Find string (use '\\\\' to find a '\\')"));
2570 (void)SetFocus(s_findrep_hwnd); 2634 (void)SetFocus(s_findrep_hwnd);
2585 DestroyWindow(s_findrep_hwnd); 2649 DestroyWindow(s_findrep_hwnd);
2586 2650
2587 if (!IsWindow(s_findrep_hwnd)) 2651 if (!IsWindow(s_findrep_hwnd))
2588 { 2652 {
2589 initialise_findrep(eap->arg); 2653 initialise_findrep(eap->arg);
2590 s_findrep_hwnd = ReplaceText((LPFINDREPLACE) &s_findrep_struct); 2654 # if defined(FEAT_MBYTE) && defined(WIN3264)
2655 if (os_version.dwPlatformId == VER_PLATFORM_WIN32_NT
2656 && enc_codepage >= 0 && (int)GetACP() != enc_codepage)
2657 {
2658 findrep_atow(&s_findrep_struct_w, &s_findrep_struct);
2659 s_findrep_hwnd = ReplaceTextW(
2660 (LPFINDREPLACEW) &s_findrep_struct_w);
2661 }
2662 else
2663 # endif
2664 s_findrep_hwnd = ReplaceText(
2665 (LPFINDREPLACE) &s_findrep_struct);
2591 } 2666 }
2592 2667
2593 set_window_title(s_findrep_hwnd, 2668 set_window_title(s_findrep_hwnd,
2594 _("Find & Replace (use '\\\\' to find a '\\')")); 2669 _("Find & Replace (use '\\\\' to find a '\\')"));
2595 (void)SetFocus(s_findrep_hwnd); 2670 (void)SetFocus(s_findrep_hwnd);