wordpad: Add font dialog.

This commit is contained in:
Alexander Nicolaysen Sørnes 2007-08-25 16:54:02 +02:00 committed by Alexandre Julliard
parent 58b09f0227
commit 4c3980da73
12 changed files with 61 additions and 1 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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)"

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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;