diff --git a/programs/wordpad/De.rc b/programs/wordpad/De.rc index 6478c64ebc9..809864ed336 100644 --- a/programs/wordpad/De.rc +++ b/programs/wordpad/De.rc @@ -73,6 +73,7 @@ BEGIN END POPUP "F&ormat" BEGIN + MENUITEM "&Font . . .", ID_FONTSETTINGS MENUITEM "&Bullet points" ID_BULLET MENUITEM "&Paragraph . . ." ID_PARAFORMAT MENUITEM "&Tabs . . ." ID_TABSTOPS diff --git a/programs/wordpad/En.rc b/programs/wordpad/En.rc index 4eaa2da42a8..3c06dda0ec6 100644 --- a/programs/wordpad/En.rc +++ b/programs/wordpad/En.rc @@ -73,6 +73,7 @@ BEGIN END POPUP "F&ormat" BEGIN + MENUITEM "&Font . . .", ID_FONTSETTINGS MENUITEM "&Bullet points" ID_BULLET MENUITEM "&Paragraph . . ." ID_PARAFORMAT MENUITEM "&Tabs . . ." ID_TABSTOPS diff --git a/programs/wordpad/Fr.rc b/programs/wordpad/Fr.rc index d69ce867168..bde211d7649 100644 --- a/programs/wordpad/Fr.rc +++ b/programs/wordpad/Fr.rc @@ -73,6 +73,7 @@ BEGIN END POPUP "Forma&t" BEGIN + MENUITEM "&Font . . .", ID_FONTSETTINGS MENUITEM "&Bullet points" ID_BULLET MENUITEM "&Paragraph . . ." ID_PARAFORMAT MENUITEM "&Tabs . . ." ID_TABSTOPS diff --git a/programs/wordpad/Hu.rc b/programs/wordpad/Hu.rc index a6bdcccaa0b..2840495971d 100644 --- a/programs/wordpad/Hu.rc +++ b/programs/wordpad/Hu.rc @@ -73,6 +73,7 @@ BEGIN END POPUP "F&ormátum" BEGIN + MENUITEM "&Font . . .", ID_FONTSETTINGS MENUITEM "&Bullet points" ID_BULLET MENUITEM "&Paragraph . . ." ID_PARAFORMAT MENUITEM "&Tabs . . ." ID_TABSTOPS diff --git a/programs/wordpad/Ko.rc b/programs/wordpad/Ko.rc index 6ee98fd13b3..fac4733f7d3 100644 --- a/programs/wordpad/Ko.rc +++ b/programs/wordpad/Ko.rc @@ -75,6 +75,7 @@ BEGIN POPUP "Çü½Ä(&O)" BEGIN MENUITEM " °­Á¶ Á¡(&U)" ID_BULLET + MENUITEM "&Font . . .", ID_FONTSETTINGS MENUITEM "&Paragraph . . ." ID_PARAFORMAT MENUITEM "&Tabs . . ." ID_TABSTOPS POPUP "¹è°æ(&B)" diff --git a/programs/wordpad/Nl.rc b/programs/wordpad/Nl.rc index bc34cf3982b..73dc641621a 100644 --- a/programs/wordpad/Nl.rc +++ b/programs/wordpad/Nl.rc @@ -73,6 +73,7 @@ BEGIN END POPUP "&Opmaak" BEGIN + MENUITEM "&Font . . .", ID_FONTSETTINGS MENUITEM "&Bullet points" ID_BULLET MENUITEM "&Paragraph . . ." ID_PARAFORMAT MENUITEM "&Tabs . . ." ID_TABSTOPS diff --git a/programs/wordpad/No.rc b/programs/wordpad/No.rc index ad16960bc93..3bf663d2852 100644 --- a/programs/wordpad/No.rc +++ b/programs/wordpad/No.rc @@ -73,6 +73,7 @@ BEGIN END POPUP "F&ormat" BEGIN + MENUITEM "&Skrift . . .", ID_FONTSETTINGS MENUITEM "&Punktmerking" ID_BULLET MENUITEM "&Avsnitt . . ." ID_PARAFORMAT MENUITEM "&Tabulatorer . . ." ID_TABSTOPS diff --git a/programs/wordpad/Pl.rc b/programs/wordpad/Pl.rc index 54e1d3aa0c8..f212fc32c7b 100644 --- a/programs/wordpad/Pl.rc +++ b/programs/wordpad/Pl.rc @@ -74,6 +74,7 @@ BEGIN END POPUP "F&ormat" BEGIN + MENUITEM "&Font . . .", ID_FONTSETTINGS MENUITEM "&Bullet points" ID_BULLET MENUITEM "&Paragraph . . ." ID_PARAFORMAT MENUITEM "Tab&s . . ." ID_TABSTOPS diff --git a/programs/wordpad/Ru.rc b/programs/wordpad/Ru.rc index e6d6ae948aa..daceaf8880f 100644 --- a/programs/wordpad/Ru.rc +++ b/programs/wordpad/Ru.rc @@ -72,6 +72,7 @@ BEGIN END POPUP "Ôîð&ìàò" BEGIN + MENUITEM "&Font . . .", ID_FONTSETTINGS MENUITEM "B&ullet points" ID_BULLET MENUITEM "&Paragraph . . ." ID_PARAFORMAT MENUITEM "&Tabs . . ." ID_TABSTOPS diff --git a/programs/wordpad/Tr.rc b/programs/wordpad/Tr.rc index 9a3013dd98a..b748666dd9c 100644 --- a/programs/wordpad/Tr.rc +++ b/programs/wordpad/Tr.rc @@ -76,6 +76,7 @@ BEGIN END POPUP "&Biçim" BEGIN + MENUITEM "&Font . . .", ID_FONTSETTINGS MENUITEM "&Bullet points" ID_BULLET MENUITEM "&Paragraph . . ." ID_PARAFORMAT MENUITEM "&Tabs . . ." ID_TABSTOPS diff --git a/programs/wordpad/resource.h b/programs/wordpad/resource.h index c1a9935d31e..8c33d38a1b5 100644 --- a/programs/wordpad/resource.h +++ b/programs/wordpad/resource.h @@ -63,6 +63,8 @@ #define ID_EDIT_CLEAR 1313 #define ID_BULLET 1314 +#define ID_FONTSETTINGS 1315 + #define ID_FORMAT_BOLD 1400 #define ID_FORMAT_ITALIC 1401 #define ID_FORMAT_UNDERLINE 1402 diff --git a/programs/wordpad/wordpad.c b/programs/wordpad/wordpad.c index 82dd40a1520..99bf12012be 100644 --- a/programs/wordpad/wordpad.c +++ b/programs/wordpad/wordpad.c @@ -719,6 +719,8 @@ static void set_font(LPCWSTR wszFaceName) { HWND hReBarWnd = GetDlgItem(hMainWnd, IDC_REBAR); HWND hSizeListWnd = GetDlgItem(hReBarWnd, IDC_SIZELIST); + HWND hFontListWnd = GetDlgItem(hReBarWnd, IDC_FONTLIST); + HWND hFontListEditWnd = (HWND)SendMessageW(hFontListWnd, CBEM_GETEDITCONTROL, 0, 0); CHARFORMAT2W fmt; ZeroMemory(&fmt, sizeof(fmt)); @@ -731,6 +733,8 @@ static void set_font(LPCWSTR wszFaceName) SendMessageW(hEditorWnd, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&fmt); populate_size_list(hSizeListWnd); + + SendMessageW(hFontListEditWnd, WM_SETTEXT, 0, (LPARAM)(LPWSTR)wszFaceName); } static void set_default_font(void) @@ -785,8 +789,48 @@ static void add_font(LPWSTR fontName, DWORD fontType, HWND hListWnd, NEWTEXTMETR SendMessageW(hListWnd, CBEM_INSERTITEMW, 0, (LPARAM)&cbItem); } +static void dialog_choose_font(void) +{ + CHOOSEFONTW cf; + LOGFONTW lf; + CHARFORMAT2W fmt; + HDC hDC = GetDC(hMainWnd); + + ZeroMemory(&cf, sizeof(cf)); + cf.lStructSize = sizeof(cf); + cf.hwndOwner = hMainWnd; + cf.lpLogFont = &lf; + cf.Flags = CF_SCREENFONTS | CF_NOSCRIPTSEL | CF_INITTOLOGFONTSTRUCT; + + ZeroMemory(&fmt, sizeof(fmt)); + fmt.cbSize = sizeof(fmt); + + SendMessageW(hEditorWnd, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&fmt); + lstrcpyW(cf.lpLogFont->lfFaceName, fmt.szFaceName); + cf.lpLogFont->lfItalic = (fmt.dwEffects & CFE_ITALIC) ? TRUE : FALSE; + cf.lpLogFont->lfWeight = (fmt.dwEffects & CFE_BOLD) ? FW_BOLD : FW_NORMAL; + cf.lpLogFont->lfHeight = -MulDiv(fmt.yHeight / 20, GetDeviceCaps(hDC, LOGPIXELSY), 72); + + if(ChooseFontW(&cf)) + { + ZeroMemory(&fmt, sizeof(fmt)); + fmt.cbSize = sizeof(fmt); + fmt.dwMask = CFM_BOLD | CFM_ITALIC | CFM_SIZE; + fmt.yHeight = cf.iPointSize * 2; + + if(cf.nFontType & BOLD_FONTTYPE) + fmt.dwEffects |= CFE_BOLD; + if(cf.nFontType & ITALIC_FONTTYPE) + fmt.dwEffects |= CFE_ITALIC; + + SendMessageW(hEditorWnd, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&fmt); + set_font(cf.lpLogFont->lfFaceName); + } +} + + int CALLBACK enum_font_proc(const LOGFONTW *lpelfe, const TEXTMETRICW *lpntme, - DWORD FontType, LPARAM lParam) + DWORD FontType, LPARAM lParam) { HWND hListWnd = (HWND) lParam; @@ -2670,6 +2714,10 @@ static LRESULT OnCommand( HWND hWnd, WPARAM wParam, LPARAM lParam) handle_findmsg(&findreplace); break; + case ID_FONTSETTINGS: + dialog_choose_font(); + break; + case ID_PRINT: dialog_print(); break;