mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -04:00
updated for version 7.3.1211
Problem: MS-Windows: When 'encoding' differs from the current codepage ":hardcopy" does not work properly. Solution: Use TextOutW() and SetDlgItemTextW(). (Ken Takata)
This commit is contained in:
@@ -1045,6 +1045,29 @@ static char_u *prt_name = NULL;
|
|||||||
#define IDC_PRINTTEXT2 402
|
#define IDC_PRINTTEXT2 402
|
||||||
#define IDC_PROGRESS 403
|
#define IDC_PROGRESS 403
|
||||||
|
|
||||||
|
#if !defined(FEAT_MBYTE) || defined(WIN16)
|
||||||
|
# define vimSetDlgItemText(h, i, s) SetDlgItemText(h, i, s)
|
||||||
|
#else
|
||||||
|
static BOOL
|
||||||
|
vimSetDlgItemText(HWND hDlg, int nIDDlgItem, char_u *s)
|
||||||
|
{
|
||||||
|
WCHAR *wp = NULL;
|
||||||
|
BOOL ret;
|
||||||
|
|
||||||
|
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
||||||
|
{
|
||||||
|
wp = enc_to_utf16(s, NULL);
|
||||||
|
}
|
||||||
|
if (wp != NULL)
|
||||||
|
{
|
||||||
|
ret = SetDlgItemTextW(hDlg, nIDDlgItem, wp);
|
||||||
|
vim_free(wp);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
return SetDlgItemText(hDlg, nIDDlgItem, s);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Convert BGR to RGB for Windows GDI calls
|
* Convert BGR to RGB for Windows GDI calls
|
||||||
*/
|
*/
|
||||||
@@ -1096,18 +1119,18 @@ PrintDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
{
|
{
|
||||||
SendDlgItemMessage(hDlg, i, WM_SETFONT, (WPARAM)hfont, 1);
|
SendDlgItemMessage(hDlg, i, WM_SETFONT, (WPARAM)hfont, 1);
|
||||||
if (GetDlgItemText(hDlg,i, buff, sizeof(buff)))
|
if (GetDlgItemText(hDlg,i, buff, sizeof(buff)))
|
||||||
SetDlgItemText(hDlg,i, _(buff));
|
vimSetDlgItemText(hDlg,i, _(buff));
|
||||||
}
|
}
|
||||||
SendDlgItemMessage(hDlg, IDCANCEL,
|
SendDlgItemMessage(hDlg, IDCANCEL,
|
||||||
WM_SETFONT, (WPARAM)hfont, 1);
|
WM_SETFONT, (WPARAM)hfont, 1);
|
||||||
if (GetDlgItemText(hDlg,IDCANCEL, buff, sizeof(buff)))
|
if (GetDlgItemText(hDlg,IDCANCEL, buff, sizeof(buff)))
|
||||||
SetDlgItemText(hDlg,IDCANCEL, _(buff));
|
vimSetDlgItemText(hDlg,IDCANCEL, _(buff));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
SetWindowText(hDlg, szAppName);
|
SetWindowText(hDlg, szAppName);
|
||||||
if (prt_name != NULL)
|
if (prt_name != NULL)
|
||||||
{
|
{
|
||||||
SetDlgItemText(hDlg, IDC_PRINTTEXT2, (LPSTR)prt_name);
|
vimSetDlgItemText(hDlg, IDC_PRINTTEXT2, (LPSTR)prt_name);
|
||||||
vim_free(prt_name);
|
vim_free(prt_name);
|
||||||
prt_name = NULL;
|
prt_name = NULL;
|
||||||
}
|
}
|
||||||
@@ -1565,7 +1588,7 @@ mch_print_begin(prt_settings_T *psettings)
|
|||||||
SetAbortProc(prt_dlg.hDC, AbortProc);
|
SetAbortProc(prt_dlg.hDC, AbortProc);
|
||||||
#endif
|
#endif
|
||||||
wsprintf(szBuffer, _("Printing '%s'"), gettail(psettings->jobname));
|
wsprintf(szBuffer, _("Printing '%s'"), gettail(psettings->jobname));
|
||||||
SetDlgItemText(hDlgPrint, IDC_PRINTTEXT1, (LPSTR)szBuffer);
|
vimSetDlgItemText(hDlgPrint, IDC_PRINTTEXT1, (LPSTR)szBuffer);
|
||||||
|
|
||||||
vim_memset(&di, 0, sizeof(DOCINFO));
|
vim_memset(&di, 0, sizeof(DOCINFO));
|
||||||
di.cbSize = sizeof(DOCINFO);
|
di.cbSize = sizeof(DOCINFO);
|
||||||
@@ -1599,7 +1622,7 @@ mch_print_end_page(void)
|
|||||||
mch_print_begin_page(char_u *msg)
|
mch_print_begin_page(char_u *msg)
|
||||||
{
|
{
|
||||||
if (msg != NULL)
|
if (msg != NULL)
|
||||||
SetDlgItemText(hDlgPrint, IDC_PROGRESS, (LPSTR)msg);
|
vimSetDlgItemText(hDlgPrint, IDC_PROGRESS, (LPSTR)msg);
|
||||||
return (StartPage(prt_dlg.hDC) > 0);
|
return (StartPage(prt_dlg.hDC) > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1628,10 +1651,41 @@ mch_print_start_line(margin, page_line)
|
|||||||
int
|
int
|
||||||
mch_print_text_out(char_u *p, int len)
|
mch_print_text_out(char_u *p, int len)
|
||||||
{
|
{
|
||||||
#ifdef FEAT_PROPORTIONAL_FONTS
|
#if defined(FEAT_PROPORTIONAL_FONTS) || (defined(FEAT_MBYTE) && !defined(WIN16))
|
||||||
SIZE sz;
|
SIZE sz;
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(FEAT_MBYTE) && !defined(WIN16)
|
||||||
|
WCHAR *wp = NULL;
|
||||||
|
int wlen = len;
|
||||||
|
|
||||||
|
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
||||||
|
{
|
||||||
|
wp = enc_to_utf16(p, &wlen);
|
||||||
|
}
|
||||||
|
if (wp != NULL)
|
||||||
|
{
|
||||||
|
int ret = FALSE;
|
||||||
|
|
||||||
|
TextOutW(prt_dlg.hDC, prt_pos_x + prt_left_margin,
|
||||||
|
prt_pos_y + prt_top_margin, wp, wlen);
|
||||||
|
GetTextExtentPoint32W(prt_dlg.hDC, wp, wlen, &sz);
|
||||||
|
vim_free(wp);
|
||||||
|
prt_pos_x += (sz.cx - prt_tm.tmOverhang);
|
||||||
|
/* This is wrong when printing spaces for a TAB. */
|
||||||
|
if (p[len] != NUL)
|
||||||
|
{
|
||||||
|
wlen = MB_PTR2LEN(p + len);
|
||||||
|
wp = enc_to_utf16(p + len, &wlen);
|
||||||
|
if (wp != NULL)
|
||||||
|
{
|
||||||
|
GetTextExtentPoint32W(prt_dlg.hDC, wp, 1, &sz);
|
||||||
|
ret = (prt_pos_x + prt_left_margin + sz.cx > prt_right_margin);
|
||||||
|
vim_free(wp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
TextOut(prt_dlg.hDC, prt_pos_x + prt_left_margin,
|
TextOut(prt_dlg.hDC, prt_pos_x + prt_left_margin,
|
||||||
prt_pos_y + prt_top_margin, p, len);
|
prt_pos_y + prt_top_margin, p, len);
|
||||||
#ifndef FEAT_PROPORTIONAL_FONTS
|
#ifndef FEAT_PROPORTIONAL_FONTS
|
||||||
@@ -1947,8 +2001,8 @@ Messaging_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||||||
reply.cbData = (DWORD)STRLEN(res) + 1;
|
reply.cbData = (DWORD)STRLEN(res) + 1;
|
||||||
|
|
||||||
serverSendEnc(sender);
|
serverSendEnc(sender);
|
||||||
retval = (int)SendMessage(sender, WM_COPYDATA, (WPARAM)message_window,
|
retval = (int)SendMessage(sender, WM_COPYDATA,
|
||||||
(LPARAM)(&reply));
|
(WPARAM)message_window, (LPARAM)(&reply));
|
||||||
vim_free(res);
|
vim_free(res);
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
|
@@ -728,6 +728,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1211,
|
||||||
/**/
|
/**/
|
||||||
1210,
|
1210,
|
||||||
/**/
|
/**/
|
||||||
|
@@ -116,8 +116,8 @@ STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
|
|||||||
FONT 8, "Helv"
|
FONT 8, "Helv"
|
||||||
BEGIN
|
BEGIN
|
||||||
DEFPUSHBUTTON "Cancel", IDCANCEL, 85, 60, 40, 14
|
DEFPUSHBUTTON "Cancel", IDCANCEL, 85, 60, 40, 14
|
||||||
CTEXT "Printing",IDC_PRINTTEXT1,23,15,157,8
|
CTEXT "Printing",IDC_PRINTTEXT1,23,15,157,9
|
||||||
CTEXT " ",IDC_PRINTTEXT2,23,25,157,8
|
CTEXT " ",IDC_PRINTTEXT2,23,25,157,9
|
||||||
CTEXT "Initializing...",IDC_PROGRESS,24,38,157,8
|
CTEXT "Initializing...",IDC_PROGRESS,24,38,157,9
|
||||||
GROUPBOX "",IDC_BOX1,19,9,170,47
|
GROUPBOX "",IDC_BOX1,19,9,170,47
|
||||||
END
|
END
|
||||||
|
Reference in New Issue
Block a user