wordpad: Add text alignment buttons.

This commit is contained in:
Alexander Nicolaysen Sørnes 2007-02-27 15:09:24 +01:00 committed by Alexandre Julliard
parent 3386459a37
commit 5c9edfd4be
2 changed files with 69 additions and 34 deletions

View File

@ -42,38 +42,59 @@ END
/* BINRES toolbar.bmp */ /* BINRES toolbar.bmp */
IDB_TOOLBAR BITMAP "toolbar.bmp" IDB_TOOLBAR BITMAP "toolbar.bmp"
/* { /* {
'42 4D F6 01 00 00 00 00 00 00 76 00 00 00 28 00' '42 4d 3e 03 00 00 00 00 00 00 3e 00 00 00 28 00'
'00 00 30 00 00 00 10 00 00 00 01 00 04 00 00 00' '00 00 60 00 00 00 10 00 00 00 01 00 04 00 00 00'
'00 00 80 01 00 00 00 00 00 00 00 00 00 00 00 00' '00 00 00 03 00 00 12 0b 00 00 12 0b 00 00 02 00'
'00 00 00 00 00 00 00 00 00 00 00 00 80 00 00 80' '00 00 02 00 00 00 c0 c0 c0 00 00 00 00 00 00 00'
'00 00 00 80 80 00 80 00 00 00 80 00 80 00 80 80' '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
'00 00 80 80 80 00 C0 C0 C0 00 00 00 FF 00 00 FF' '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
'00 00 00 FF FF 00 FF 00 00 00 FF 00 FF 00 FF FF' '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
'00 00 FF FF FF 00 88 88 88 88 88 88 88 88 88 88' '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
'88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88' '11 11 11 11 00 00 00 00 00 00 00 00 00 00 00 00'
'88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88' '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
'00 00 00 00 88 88 88 88 88 88 88 88 88 88 88 88' '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
'88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 80' '00 00 00 00 00 00 00 11 11 11 11 11 10 00 00 11'
'00 00 00 88 88 88 88 88 00 00 08 88 88 88 88 88' '11 11 11 11 11 00 00 00 01 11 11 11 11 00 00 01'
'80 00 00 08 88 88 88 80 08 88 80 08 88 88 88 88' '11 11 11 00 00 00 00 00 11 11 10 00 00 00 00 00'
'88 08 88 88 88 88 88 88 08 88 88 80 88 88 88 80' '01 11 11 10 00 00 00 00 00 00 00 00 00 00 00 00'
'08 88 80 08 88 88 88 88 88 08 88 88 88 88 88 88' '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01'
'08 88 88 80 88 88 88 80 08 88 80 08 88 88 88 88' '10 00 01 10 00 00 00 00 00 10 00 00 00 00 00 00'
'88 08 88 88 88 88 88 88 08 88 88 80 88 88 88 80' '10 00 00 01 00 00 00 11 11 11 10 00 00 00 00 00'
'08 88 80 08 88 88 88 88 88 80 88 88 88 88 88 88' '01 11 11 10 00 00 00 11 11 11 11 11 11 00 00 01'
'08 88 88 80 88 88 88 80 00 00 00 88 88 88 88 88' '10 00 01 10 00 00 00 00 00 10 00 00 00 00 00 00'
'88 80 88 88 88 88 88 88 08 88 88 80 88 88 88 80' '10 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00'
'08 88 80 08 88 88 88 88 88 80 88 88 88 88 88 88' '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01'
'08 88 88 80 88 88 88 80 08 88 80 08 88 88 88 88' '10 00 01 10 00 00 00 00 00 10 00 00 00 00 00 00'
'88 88 08 88 88 88 88 88 08 88 88 80 88 88 88 80' '10 00 00 01 00 00 00 11 11 11 11 11 11 00 00 00'
'08 88 80 08 88 88 88 88 88 88 08 88 88 88 88 88' '11 11 11 11 00 00 00 00 00 11 11 11 11 00 00 01'
'08 88 88 80 88 88 88 80 00 00 00 88 88 88 88 88' '10 00 01 10 00 00 00 00 00 01 00 00 00 00 00 00'
'88 00 00 08 88 88 88 88 08 88 88 80 88 88 88 88' '10 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00'
'88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88' '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01'
'88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88' '11 11 11 00 00 00 00 00 00 01 00 00 00 00 00 00'
'88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88' '10 00 00 01 00 00 00 11 11 11 11 10 00 00 00 11'
'88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88' '11 11 11 11 11 00 00 00 00 00 01 11 11 00 00 01'
'88 88 88 88 88 88' '10 00 01 10 00 00 00 00 00 01 00 00 00 00 00 00'
'10 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00'
'00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01'
'10 00 01 10 00 00 00 00 00 00 10 00 00 00 00 00'
'10 00 00 01 00 00 00 11 11 11 11 11 11 00 00 00'
'11 11 11 11 00 00 00 01 11 11 11 11 11 00 00 01'
'10 00 01 10 00 00 00 00 00 00 10 00 00 00 00 00'
'10 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00'
'00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01'
'11 11 11 00 00 00 00 00 00 11 11 10 00 00 00 00'
'10 00 00 01 00 00 00 11 11 11 11 00 00 00 00 00'
'01 11 11 10 00 00 00 00 00 11 11 11 11 00 00 00'
'00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
'00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
'00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
'00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
'00 00 00 00 00 00 00 11 11 11 11 11 11 00 00 11'
'11 11 11 11 11 00 00 11 11 11 11 11 11 00 00 00'
'00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
'00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
'00 00 00 00 00 00 00 00 00 00 00 00 00 00'
} */ } */
#include "De.rc" #include "De.rc"

View File

@ -292,13 +292,13 @@ static LRESULT OnCreate( HWND hWnd, WPARAM wParam, LPARAM lParam)
hToolBarWnd = CreateToolbarEx(hReBarWnd, CCS_NOPARENTALIGN|CCS_NOMOVEY|WS_VISIBLE|WS_CHILD|TBSTYLE_TOOLTIPS|TBSTYLE_BUTTON, hToolBarWnd = CreateToolbarEx(hReBarWnd, CCS_NOPARENTALIGN|CCS_NOMOVEY|WS_VISIBLE|WS_CHILD|TBSTYLE_TOOLTIPS|TBSTYLE_BUTTON,
IDC_TOOLBAR, IDC_TOOLBAR,
3, hInstance, IDB_TOOLBAR, 6, hInstance, IDB_TOOLBAR,
NULL, 0, NULL, 0,
24, 24, 16, 16, sizeof(TBBUTTON)); 24, 24, 16, 16, sizeof(TBBUTTON));
ab.hInst = HINST_COMMCTRL; ab.hInst = HINST_COMMCTRL;
ab.nID = IDB_STD_SMALL_COLOR; ab.nID = IDB_STD_SMALL_COLOR;
nStdBitmaps = SendMessage(hToolBarWnd, TB_ADDBITMAP, 3, (LPARAM)&ab); nStdBitmaps = SendMessage(hToolBarWnd, TB_ADDBITMAP, 6, (LPARAM)&ab);
AddButton(hToolBarWnd, nStdBitmaps+STD_FILENEW, ID_FILE_NEW); AddButton(hToolBarWnd, nStdBitmaps+STD_FILENEW, ID_FILE_NEW);
AddButton(hToolBarWnd, nStdBitmaps+STD_FILEOPEN, ID_FILE_OPEN); AddButton(hToolBarWnd, nStdBitmaps+STD_FILEOPEN, ID_FILE_OPEN);
AddButton(hToolBarWnd, nStdBitmaps+STD_FILESAVE, ID_FILE_SAVE); AddButton(hToolBarWnd, nStdBitmaps+STD_FILESAVE, ID_FILE_SAVE);
@ -317,6 +317,10 @@ static LRESULT OnCreate( HWND hWnd, WPARAM wParam, LPARAM lParam)
AddButton(hToolBarWnd, 0, ID_FORMAT_BOLD); AddButton(hToolBarWnd, 0, ID_FORMAT_BOLD);
AddButton(hToolBarWnd, 1, ID_FORMAT_ITALIC); AddButton(hToolBarWnd, 1, ID_FORMAT_ITALIC);
AddButton(hToolBarWnd, 2, ID_FORMAT_UNDERLINE); AddButton(hToolBarWnd, 2, ID_FORMAT_UNDERLINE);
AddSeparator(hToolBarWnd);
AddButton(hToolBarWnd, 3, ID_ALIGN_LEFT);
AddButton(hToolBarWnd, 4, ID_ALIGN_CENTER);
AddButton(hToolBarWnd, 5, ID_ALIGN_RIGHT);
SendMessage(hToolBarWnd, TB_ADDSTRING, 0, (LPARAM)"Exit\0"); SendMessage(hToolBarWnd, TB_ADDSTRING, 0, (LPARAM)"Exit\0");
SendMessage(hToolBarWnd, TB_AUTOSIZE, 0, 0); SendMessage(hToolBarWnd, TB_AUTOSIZE, 0, 0);
@ -361,10 +365,14 @@ static LRESULT OnUser( HWND hWnd, WPARAM wParam, LPARAM lParam)
HWND hwndToolBar = GetDlgItem(hwndReBar, IDC_TOOLBAR); HWND hwndToolBar = GetDlgItem(hwndReBar, IDC_TOOLBAR);
int from, to; int from, to;
CHARFORMAT2W fmt; CHARFORMAT2W fmt;
PARAFORMAT2 pf;
ZeroMemory(&fmt, sizeof(fmt)); ZeroMemory(&fmt, sizeof(fmt));
fmt.cbSize = sizeof(fmt); fmt.cbSize = sizeof(fmt);
ZeroMemory(&pf, sizeof(pf));
pf.cbSize = sizeof(pf);
SendMessage(hwndEditor, EM_GETCHARFORMAT, TRUE, (LPARAM)&fmt); SendMessage(hwndEditor, EM_GETCHARFORMAT, TRUE, (LPARAM)&fmt);
SendMessage(hwndEditor, EM_GETSEL, (WPARAM)&from, (LPARAM)&to); SendMessage(hwndEditor, EM_GETSEL, (WPARAM)&from, (LPARAM)&to);
@ -380,6 +388,12 @@ static LRESULT OnUser( HWND hWnd, WPARAM wParam, LPARAM lParam)
SendMessage(hwndToolBar, TB_INDETERMINATE, ID_FORMAT_ITALIC, !(fmt.dwMask & CFM_ITALIC)); SendMessage(hwndToolBar, TB_INDETERMINATE, ID_FORMAT_ITALIC, !(fmt.dwMask & CFM_ITALIC));
SendMessage(hwndToolBar, TB_CHECKBUTTON, ID_FORMAT_UNDERLINE, (fmt.dwMask & CFM_UNDERLINE) && (fmt.dwEffects & CFE_UNDERLINE)); SendMessage(hwndToolBar, TB_CHECKBUTTON, ID_FORMAT_UNDERLINE, (fmt.dwMask & CFM_UNDERLINE) && (fmt.dwEffects & CFE_UNDERLINE));
SendMessage(hwndToolBar, TB_INDETERMINATE, ID_FORMAT_UNDERLINE, !(fmt.dwMask & CFM_UNDERLINE)); SendMessage(hwndToolBar, TB_INDETERMINATE, ID_FORMAT_UNDERLINE, !(fmt.dwMask & CFM_UNDERLINE));
SendMessage(hwndEditor, EM_GETPARAFORMAT, 0, (LPARAM)&pf);
SendMessage(hwndToolBar, TB_CHECKBUTTON, ID_ALIGN_LEFT, (pf.wAlignment == PFA_LEFT));
SendMessage(hwndToolBar, TB_CHECKBUTTON, ID_ALIGN_CENTER, (pf.wAlignment == PFA_CENTER));
SendMessage(hwndToolBar, TB_CHECKBUTTON, ID_ALIGN_RIGHT, (pf.wAlignment == PFA_RIGHT));
return 0; return 0;
} }