wordpad: Split toolbar into tool- and formatbar.
This commit is contained in:
parent
2de3d95ea5
commit
ffa7e0e25d
|
@ -899,8 +899,8 @@ programs/winhelp/macro.lex.yy.c
|
||||||
programs/winhelp/rsrc.res
|
programs/winhelp/rsrc.res
|
||||||
programs/winhelp/winhelp
|
programs/winhelp/winhelp
|
||||||
programs/winver/winver
|
programs/winver/winver
|
||||||
|
programs/wordpad/formatbar.bmp
|
||||||
programs/wordpad/rsrc.res
|
programs/wordpad/rsrc.res
|
||||||
programs/wordpad/toolbar.bmp
|
|
||||||
programs/wordpad/wordpad
|
programs/wordpad/wordpad
|
||||||
programs/wordpad/wordpad.ico
|
programs/wordpad/wordpad.ico
|
||||||
programs/xcopy/rsrc.res
|
programs/xcopy/rsrc.res
|
||||||
|
|
|
@ -55,6 +55,7 @@ BEGIN
|
||||||
POPUP "&View"
|
POPUP "&View"
|
||||||
BEGIN
|
BEGIN
|
||||||
MENUITEM "&Toolbar", ID_TOGGLE_TOOLBAR
|
MENUITEM "&Toolbar", ID_TOGGLE_TOOLBAR
|
||||||
|
MENUITEM "&Formatbar", ID_TOGGLE_FORMATBAR
|
||||||
MENUITEM "&Statusbar", ID_TOGGLE_STATUSBAR
|
MENUITEM "&Statusbar", ID_TOGGLE_STATUSBAR
|
||||||
END
|
END
|
||||||
POPUP "F&ormat"
|
POPUP "F&ormat"
|
||||||
|
|
|
@ -55,6 +55,7 @@ BEGIN
|
||||||
POPUP "&View"
|
POPUP "&View"
|
||||||
BEGIN
|
BEGIN
|
||||||
MENUITEM "&Toolbar", ID_TOGGLE_TOOLBAR
|
MENUITEM "&Toolbar", ID_TOGGLE_TOOLBAR
|
||||||
|
MENUITEM "&Formatbar", ID_TOGGLE_FORMATBAR
|
||||||
MENUITEM "&Statusbar", ID_TOGGLE_STATUSBAR
|
MENUITEM "&Statusbar", ID_TOGGLE_STATUSBAR
|
||||||
END
|
END
|
||||||
POPUP "F&ormat"
|
POPUP "F&ormat"
|
||||||
|
|
|
@ -55,7 +55,8 @@ BEGIN
|
||||||
POPUP "&View"
|
POPUP "&View"
|
||||||
BEGIN
|
BEGIN
|
||||||
MENUITEM "&Toolbar", ID_TOGGLE_TOOLBAR
|
MENUITEM "&Toolbar", ID_TOGGLE_TOOLBAR
|
||||||
MENUITEM "&Statusbar", ID_TOGGLE_STATUSBAR
|
MENUITEM "&Formatbar", ID_TOGGLE_FORMATBAR
|
||||||
|
MENUITEM "&Statusbar", ID_TOGGLE_STATUSBAR
|
||||||
END
|
END
|
||||||
POPUP "Forma&t"
|
POPUP "Forma&t"
|
||||||
BEGIN
|
BEGIN
|
||||||
|
|
|
@ -55,6 +55,7 @@ BEGIN
|
||||||
POPUP "&View"
|
POPUP "&View"
|
||||||
BEGIN
|
BEGIN
|
||||||
MENUITEM "&Toolbar", ID_TOGGLE_TOOLBAR
|
MENUITEM "&Toolbar", ID_TOGGLE_TOOLBAR
|
||||||
|
MENUITEM "&Formatbar", ID_TOGGLE_FORMATBAR
|
||||||
MENUITEM "&Statusbar", ID_TOGGLE_STATUSBAR
|
MENUITEM "&Statusbar", ID_TOGGLE_STATUSBAR
|
||||||
END
|
END
|
||||||
POPUP "F&ormátum"
|
POPUP "F&ormátum"
|
||||||
|
|
|
@ -56,6 +56,7 @@ BEGIN
|
||||||
POPUP "&View"
|
POPUP "&View"
|
||||||
BEGIN
|
BEGIN
|
||||||
MENUITEM "&Toolbar", ID_TOGGLE_TOOLBAR
|
MENUITEM "&Toolbar", ID_TOGGLE_TOOLBAR
|
||||||
|
MENUITEM "&Formatbar", ID_TOGGLE_FORMATBAR
|
||||||
MENUITEM "&Statusbar", ID_TOGGLE_STATUSBAR
|
MENUITEM "&Statusbar", ID_TOGGLE_STATUSBAR
|
||||||
END
|
END
|
||||||
POPUP "Çü˝Ä(&O)"
|
POPUP "Çü˝Ä(&O)"
|
||||||
|
|
|
@ -15,7 +15,7 @@ C_SRCS = \
|
||||||
RC_SRCS = rsrc.rc
|
RC_SRCS = rsrc.rc
|
||||||
RC_BINSRC = rsrc.rc
|
RC_BINSRC = rsrc.rc
|
||||||
RC_BINARIES = \
|
RC_BINARIES = \
|
||||||
toolbar.bmp \
|
formatbar.bmp \
|
||||||
wordpad.ico
|
wordpad.ico
|
||||||
|
|
||||||
@MAKE_PROG_RULES@
|
@MAKE_PROG_RULES@
|
||||||
|
|
|
@ -55,6 +55,7 @@ BEGIN
|
||||||
POPUP "&View"
|
POPUP "&View"
|
||||||
BEGIN
|
BEGIN
|
||||||
MENUITEM "&Toolbar", ID_TOGGLE_TOOLBAR
|
MENUITEM "&Toolbar", ID_TOGGLE_TOOLBAR
|
||||||
|
MENUITEM "&Formatbar", ID_TOGGLE_FORMATBAR
|
||||||
MENUITEM "&Statusbar", ID_TOGGLE_STATUSBAR
|
MENUITEM "&Statusbar", ID_TOGGLE_STATUSBAR
|
||||||
END
|
END
|
||||||
POPUP "&Opmaak"
|
POPUP "&Opmaak"
|
||||||
|
|
|
@ -54,7 +54,8 @@ BEGIN
|
||||||
END
|
END
|
||||||
POPUP "&Vis"
|
POPUP "&Vis"
|
||||||
BEGIN
|
BEGIN
|
||||||
MENUITEM "Verk&tøylinje", ID_TOGGLE_TOOLBAR
|
MENUITEM "Verk&tøylinje", ID_TOGGLE_TOOLBAR
|
||||||
|
MENUITEM "&Formatlinje", ID_TOGGLE_FORMATBAR
|
||||||
MENUITEM "&Statuslinje", ID_TOGGLE_STATUSBAR
|
MENUITEM "&Statuslinje", ID_TOGGLE_STATUSBAR
|
||||||
END
|
END
|
||||||
POPUP "F&ormat"
|
POPUP "F&ormat"
|
||||||
|
|
|
@ -56,6 +56,7 @@ BEGIN
|
||||||
POPUP "&View"
|
POPUP "&View"
|
||||||
BEGIN
|
BEGIN
|
||||||
MENUITEM "&Toolbar", ID_TOGGLE_TOOLBAR
|
MENUITEM "&Toolbar", ID_TOGGLE_TOOLBAR
|
||||||
|
MENUITEM "&Formatbar", ID_TOGGLE_FORMATBAR
|
||||||
MENUITEM "&Statusbar", ID_TOGGLE_STATUSBAR
|
MENUITEM "&Statusbar", ID_TOGGLE_STATUSBAR
|
||||||
END
|
END
|
||||||
POPUP "F&ormat"
|
POPUP "F&ormat"
|
||||||
|
|
|
@ -53,6 +53,7 @@ BEGIN
|
||||||
POPUP "&View"
|
POPUP "&View"
|
||||||
BEGIN
|
BEGIN
|
||||||
MENUITEM "&Toolbar", ID_TOGGLE_TOOLBAR
|
MENUITEM "&Toolbar", ID_TOGGLE_TOOLBAR
|
||||||
|
MENUITEM "&Formatbar", ID_TOGGLE_FORMATBAR
|
||||||
MENUITEM "&Statusbar", ID_TOGGLE_STATUSBAR
|
MENUITEM "&Statusbar", ID_TOGGLE_STATUSBAR
|
||||||
END
|
END
|
||||||
POPUP "Ôîð&ìàò"
|
POPUP "Ôîð&ìàò"
|
||||||
|
|
|
@ -57,6 +57,7 @@ BEGIN
|
||||||
POPUP "&View"
|
POPUP "&View"
|
||||||
BEGIN
|
BEGIN
|
||||||
MENUITEM "&Toolbar", ID_TOGGLE_TOOLBAR
|
MENUITEM "&Toolbar", ID_TOGGLE_TOOLBAR
|
||||||
|
MENUITEM "&Formatbar", ID_TOGGLE_FORMATBAR
|
||||||
MENUITEM "&Statusbar", ID_TOGGLE_STATUSBAR
|
MENUITEM "&Statusbar", ID_TOGGLE_STATUSBAR
|
||||||
END
|
END
|
||||||
POPUP "&Biçim"
|
POPUP "&Biçim"
|
||||||
|
|
|
@ -54,17 +54,20 @@
|
||||||
#define ID_FORMAT_UNDERLINE 1402
|
#define ID_FORMAT_UNDERLINE 1402
|
||||||
|
|
||||||
#define ID_TOGGLE_TOOLBAR 1500
|
#define ID_TOGGLE_TOOLBAR 1500
|
||||||
#define ID_TOGGLE_STATUSBAR 1501
|
#define ID_TOGGLE_FORMATBAR 1501
|
||||||
|
#define ID_TOGGLE_STATUSBAR 1502
|
||||||
|
|
||||||
#define BANDID_TOOLBAR 0
|
#define BANDID_TOOLBAR 0
|
||||||
|
#define BANDID_FORMATBAR 1
|
||||||
|
|
||||||
#define IDC_STATUSBAR 2000
|
#define IDC_STATUSBAR 2000
|
||||||
#define IDC_EDITOR 2001
|
#define IDC_EDITOR 2001
|
||||||
#define IDC_TOOLBAR 2002
|
#define IDC_TOOLBAR 2002
|
||||||
#define IDC_REBAR 2003
|
#define IDC_FORMATBAR 2003
|
||||||
#define IDC_COMBO 2004
|
#define IDC_REBAR 2004
|
||||||
|
#define IDC_COMBO 2005
|
||||||
|
|
||||||
#define IDB_TOOLBAR 100
|
#define IDB_FORMATBAR 100
|
||||||
|
|
||||||
#define IDI_WORDPAD 101
|
#define IDI_WORDPAD 101
|
||||||
|
|
||||||
|
|
|
@ -39,8 +39,8 @@ BEGIN
|
||||||
"S", ID_FILE_SAVE, VIRTKEY, CONTROL
|
"S", ID_FILE_SAVE, VIRTKEY, CONTROL
|
||||||
END
|
END
|
||||||
|
|
||||||
/* BINRES toolbar.bmp */
|
/* BINRES formatbar.bmp */
|
||||||
IDB_TOOLBAR BITMAP "toolbar.bmp"
|
IDB_FORMATBAR BITMAP "formatbar.bmp"
|
||||||
/* {
|
/* {
|
||||||
'42 4d 3e 03 00 00 00 00 00 00 3e 00 00 00 28 00'
|
'42 4d 3e 03 00 00 00 00 00 00 3e 00 00 00 28 00'
|
||||||
'00 00 60 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'
|
||||||
|
|
|
@ -339,39 +339,39 @@ static void toggle_toolbar(int bandId)
|
||||||
{
|
{
|
||||||
HWND hwndReBar = GetDlgItem(hMainWnd, IDC_REBAR);
|
HWND hwndReBar = GetDlgItem(hMainWnd, IDC_REBAR);
|
||||||
REBARBANDINFOW rbbinfo;
|
REBARBANDINFOW rbbinfo;
|
||||||
|
BOOL hide = TRUE;
|
||||||
|
|
||||||
if(!hwndReBar)
|
if(!hwndReBar)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
rbbinfo.cbSize = sizeof(rbbinfo);
|
rbbinfo.cbSize = sizeof(rbbinfo);
|
||||||
rbbinfo.fMask = RBBIM_STYLE;
|
rbbinfo.fMask = RBBIM_STYLE | RBBIM_SIZE;
|
||||||
|
|
||||||
SendMessageW(hwndReBar, RB_GETBANDINFO, bandId, (LPARAM)&rbbinfo);
|
SendMessageW(hwndReBar, RB_GETBANDINFO, bandId, (LPARAM)&rbbinfo);
|
||||||
|
|
||||||
SendMessageW(hwndReBar, RB_SHOWBAND, bandId, (rbbinfo.fStyle & RBBS_HIDDEN));
|
if(rbbinfo.fStyle & RBBS_HIDDEN)
|
||||||
|
hide = FALSE;
|
||||||
|
|
||||||
update_window();
|
SendMessageW(hwndReBar, RB_SHOWBAND, bandId, hide ? 0 : 1);
|
||||||
}
|
|
||||||
|
|
||||||
static int rebar_height(void)
|
if(bandId == BANDID_TOOLBAR)
|
||||||
{
|
{
|
||||||
HWND hwndReBar = GetDlgItem(hMainWnd, IDC_REBAR);
|
rbbinfo.fMask ^= RBBIM_SIZE;
|
||||||
|
|
||||||
REBARBANDINFOW rbbinfo;
|
SendMessageW(hwndReBar, RB_GETBANDINFO, BANDID_FORMATBAR, (LPARAM)&rbbinfo);
|
||||||
|
|
||||||
if(!hwndReBar)
|
if(hide)
|
||||||
return 0;
|
rbbinfo.fStyle ^= RBBS_BREAK;
|
||||||
|
else
|
||||||
|
rbbinfo.fStyle |= RBBS_BREAK;
|
||||||
|
|
||||||
rbbinfo.cbSize = sizeof(rbbinfo);
|
SendMessageW(hwndReBar, RB_SETBANDINFO, BANDID_FORMATBAR, (LPARAM)&rbbinfo);
|
||||||
rbbinfo.fMask = RBBIM_STYLE;
|
}
|
||||||
SendMessageW(hwndReBar, RB_GETBANDINFO, BANDID_TOOLBAR, (LPARAM)&rbbinfo);
|
|
||||||
|
|
||||||
return (rbbinfo.fStyle & RBBS_HIDDEN) ? 0 : SendMessage(hwndReBar, RB_GETBARHEIGHT, 0, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static LRESULT OnCreate( HWND hWnd, WPARAM wParam, LPARAM lParam)
|
static LRESULT OnCreate( HWND hWnd, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
HWND hToolBarWnd, hReBarWnd;
|
HWND hToolBarWnd, hFormatBarWnd, hReBarWnd;
|
||||||
HINSTANCE hInstance = (HINSTANCE)GetWindowLongPtr(hWnd, GWLP_HINSTANCE);
|
HINSTANCE hInstance = (HINSTANCE)GetWindowLongPtr(hWnd, GWLP_HINSTANCE);
|
||||||
HANDLE hDLL;
|
HANDLE hDLL;
|
||||||
TBADDBITMAP ab;
|
TBADDBITMAP ab;
|
||||||
|
@ -393,13 +393,14 @@ 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,
|
||||||
6, hInstance, IDB_TOOLBAR,
|
0, hInstance, 0,
|
||||||
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, 6, (LPARAM)&ab);
|
nStdBitmaps = SendMessageW(hToolBarWnd, TB_ADDBITMAP, 0, (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);
|
||||||
|
@ -414,34 +415,49 @@ static LRESULT OnCreate( HWND hWnd, WPARAM wParam, LPARAM lParam)
|
||||||
AddButton(hToolBarWnd, nStdBitmaps+STD_PASTE, ID_EDIT_PASTE);
|
AddButton(hToolBarWnd, nStdBitmaps+STD_PASTE, ID_EDIT_PASTE);
|
||||||
AddButton(hToolBarWnd, nStdBitmaps+STD_UNDO, ID_EDIT_UNDO);
|
AddButton(hToolBarWnd, nStdBitmaps+STD_UNDO, ID_EDIT_UNDO);
|
||||||
AddButton(hToolBarWnd, nStdBitmaps+STD_REDOW, ID_EDIT_REDO);
|
AddButton(hToolBarWnd, nStdBitmaps+STD_REDOW, ID_EDIT_REDO);
|
||||||
AddSeparator(hToolBarWnd);
|
|
||||||
AddButton(hToolBarWnd, 0, ID_FORMAT_BOLD);
|
|
||||||
AddButton(hToolBarWnd, 1, ID_FORMAT_ITALIC);
|
|
||||||
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);
|
||||||
|
|
||||||
rbb.cbSize = sizeof(rbb);
|
rbb.cbSize = sizeof(rbb);
|
||||||
rbb.fMask = RBBIM_SIZE | RBBIM_CHILDSIZE | RBBIM_CHILD | RBBIM_STYLE;
|
rbb.fMask = RBBIM_SIZE | RBBIM_CHILDSIZE | RBBIM_CHILD | RBBIM_STYLE;
|
||||||
rbb.fStyle = RBBS_CHILDEDGE;
|
rbb.fStyle = RBBS_CHILDEDGE | RBBS_BREAK | RBBS_NOGRIPPER;
|
||||||
rbb.cx = 500;
|
rbb.cx = 0;
|
||||||
rbb.hwndChild = hToolBarWnd;
|
rbb.hwndChild = hToolBarWnd;
|
||||||
rbb.cxMinChild = 0;
|
rbb.cxMinChild = 0;
|
||||||
rbb.cyChild = rbb.cyMinChild = HIWORD(SendMessage(hToolBarWnd, TB_GETBUTTONSIZE, 0, 0));
|
rbb.cyChild = rbb.cyMinChild = HIWORD(SendMessage(hToolBarWnd, TB_GETBUTTONSIZE, 0, 0));
|
||||||
|
|
||||||
SendMessageW(hReBarWnd, RB_INSERTBAND, BANDID_TOOLBAR, (LPARAM)&rbb);
|
SendMessageW(hReBarWnd, RB_INSERTBAND, BANDID_TOOLBAR, (LPARAM)&rbb);
|
||||||
|
|
||||||
|
hFormatBarWnd = CreateToolbarEx(hReBarWnd,
|
||||||
|
CCS_NOPARENTALIGN | CCS_NOMOVEY | WS_VISIBLE | TBSTYLE_TOOLTIPS | TBSTYLE_BUTTON,
|
||||||
|
IDC_FORMATBAR, 6, hInstance, IDB_FORMATBAR, NULL, 0, 24, 24, 16, 16, sizeof(TBBUTTON));
|
||||||
|
|
||||||
|
ab.hInst = HINST_COMMCTRL;
|
||||||
|
ab.nID = IDB_STD_SMALL_COLOR;
|
||||||
|
nStdBitmaps = SendMessageW(hFormatBarWnd, TB_ADDBITMAP, 6, (LPARAM)&ab);
|
||||||
|
|
||||||
|
AddButton(hFormatBarWnd, 0, ID_FORMAT_BOLD);
|
||||||
|
AddButton(hFormatBarWnd, 1, ID_FORMAT_ITALIC);
|
||||||
|
AddButton(hFormatBarWnd, 2, ID_FORMAT_UNDERLINE);
|
||||||
|
AddSeparator(hFormatBarWnd);
|
||||||
|
AddButton(hFormatBarWnd, 3, ID_ALIGN_LEFT);
|
||||||
|
AddButton(hFormatBarWnd, 4, ID_ALIGN_CENTER);
|
||||||
|
AddButton(hFormatBarWnd, 5, ID_ALIGN_RIGHT);
|
||||||
|
|
||||||
|
SendMessageW(hFormatBarWnd, TB_AUTOSIZE, 0, 0);
|
||||||
|
|
||||||
|
rbb.hwndChild = hFormatBarWnd;
|
||||||
|
|
||||||
|
SendMessageW(hReBarWnd, RB_INSERTBAND, BANDID_FORMATBAR, (LPARAM)&rbb);
|
||||||
|
|
||||||
hDLL = LoadLibrary("RICHED20.DLL");
|
hDLL = LoadLibrary("RICHED20.DLL");
|
||||||
assert(hDLL);
|
assert(hDLL);
|
||||||
|
|
||||||
hEditorWnd = CreateWindowExW(WS_EX_CLIENTEDGE, wszRichEditClass, NULL,
|
hEditorWnd = CreateWindowExW(WS_EX_CLIENTEDGE, wszRichEditClass, NULL,
|
||||||
WS_CHILD|WS_VISIBLE|ES_MULTILINE|ES_AUTOVSCROLL|ES_WANTRETURN|WS_VSCROLL,
|
WS_CHILD|WS_VISIBLE|ES_MULTILINE|ES_AUTOVSCROLL|ES_WANTRETURN|WS_VSCROLL,
|
||||||
0, 0, 1000, 100, hWnd, (HMENU)IDC_EDITOR, hInstance, NULL);
|
0, 0, 1000, 100, hWnd, (HMENU)IDC_EDITOR, hInstance, NULL);
|
||||||
|
|
||||||
if (!hEditorWnd)
|
if (!hEditorWnd)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Error code %u\n", GetLastError());
|
fprintf(stderr, "Error code %u\n", GetLastError());
|
||||||
|
@ -464,6 +480,7 @@ static LRESULT OnUser( HWND hWnd, WPARAM wParam, LPARAM lParam)
|
||||||
HWND hwndEditor = GetDlgItem(hWnd, IDC_EDITOR);
|
HWND hwndEditor = GetDlgItem(hWnd, IDC_EDITOR);
|
||||||
HWND hwndReBar = GetDlgItem(hWnd, IDC_REBAR);
|
HWND hwndReBar = GetDlgItem(hWnd, IDC_REBAR);
|
||||||
HWND hwndToolBar = GetDlgItem(hwndReBar, IDC_TOOLBAR);
|
HWND hwndToolBar = GetDlgItem(hwndReBar, IDC_TOOLBAR);
|
||||||
|
HWND hwndFormatBar = GetDlgItem(hwndReBar, IDC_FORMATBAR);
|
||||||
int from, to;
|
int from, to;
|
||||||
CHARFORMAT2W fmt;
|
CHARFORMAT2W fmt;
|
||||||
PARAFORMAT2 pf;
|
PARAFORMAT2 pf;
|
||||||
|
@ -483,17 +500,21 @@ static LRESULT OnUser( HWND hWnd, WPARAM wParam, LPARAM lParam)
|
||||||
SendMessage(hwndEditor, EM_CANREDO, 0, 0));
|
SendMessage(hwndEditor, EM_CANREDO, 0, 0));
|
||||||
SendMessage(hwndToolBar, TB_ENABLEBUTTON, ID_EDIT_CUT, from == to ? 0 : 1);
|
SendMessage(hwndToolBar, TB_ENABLEBUTTON, ID_EDIT_CUT, from == to ? 0 : 1);
|
||||||
SendMessage(hwndToolBar, TB_ENABLEBUTTON, ID_EDIT_COPY, from == to ? 0 : 1);
|
SendMessage(hwndToolBar, TB_ENABLEBUTTON, ID_EDIT_COPY, from == to ? 0 : 1);
|
||||||
SendMessage(hwndToolBar, TB_CHECKBUTTON, ID_FORMAT_BOLD, (fmt.dwMask & CFM_BOLD) && (fmt.dwEffects & CFE_BOLD));
|
|
||||||
SendMessage(hwndToolBar, TB_INDETERMINATE, ID_FORMAT_BOLD, !(fmt.dwMask & CFM_BOLD));
|
|
||||||
SendMessage(hwndToolBar, TB_CHECKBUTTON, ID_FORMAT_ITALIC, (fmt.dwMask & CFM_ITALIC) && (fmt.dwEffects & CFE_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_INDETERMINATE, ID_FORMAT_UNDERLINE, !(fmt.dwMask & CFM_UNDERLINE));
|
|
||||||
|
|
||||||
SendMessage(hwndEditor, EM_GETPARAFORMAT, 0, (LPARAM)&pf);
|
SendMessageW(hwndFormatBar, TB_CHECKBUTTON, ID_FORMAT_BOLD, (fmt.dwMask & CFM_BOLD) &&
|
||||||
SendMessage(hwndToolBar, TB_CHECKBUTTON, ID_ALIGN_LEFT, (pf.wAlignment == PFA_LEFT));
|
(fmt.dwEffects & CFE_BOLD));
|
||||||
SendMessage(hwndToolBar, TB_CHECKBUTTON, ID_ALIGN_CENTER, (pf.wAlignment == PFA_CENTER));
|
SendMessageW(hwndFormatBar, TB_INDETERMINATE, ID_FORMAT_BOLD, !(fmt.dwMask & CFM_BOLD));
|
||||||
SendMessage(hwndToolBar, TB_CHECKBUTTON, ID_ALIGN_RIGHT, (pf.wAlignment == PFA_RIGHT));
|
SendMessageW(hwndFormatBar, TB_CHECKBUTTON, ID_FORMAT_ITALIC, (fmt.dwMask & CFM_ITALIC) &&
|
||||||
|
(fmt.dwEffects & CFE_ITALIC));
|
||||||
|
SendMessageW(hwndFormatBar, TB_INDETERMINATE, ID_FORMAT_ITALIC, !(fmt.dwMask & CFM_ITALIC));
|
||||||
|
SendMessageW(hwndFormatBar, TB_CHECKBUTTON, ID_FORMAT_UNDERLINE, (fmt.dwMask & CFM_UNDERLINE) &&
|
||||||
|
(fmt.dwEffects & CFE_UNDERLINE));
|
||||||
|
SendMessageW(hwndFormatBar, TB_INDETERMINATE, ID_FORMAT_UNDERLINE, !(fmt.dwMask & CFM_UNDERLINE));
|
||||||
|
|
||||||
|
SendMessageW(hwndEditor, EM_GETPARAFORMAT, 0, (LPARAM)&pf);
|
||||||
|
SendMessageW(hwndFormatBar, TB_CHECKBUTTON, ID_ALIGN_LEFT, (pf.wAlignment == PFA_LEFT));
|
||||||
|
SendMessageW(hwndFormatBar, TB_CHECKBUTTON, ID_ALIGN_CENTER, (pf.wAlignment == PFA_CENTER));
|
||||||
|
SendMessageW(hwndFormatBar, TB_CHECKBUTTON, ID_ALIGN_RIGHT, (pf.wAlignment == PFA_RIGHT));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -722,6 +743,12 @@ static LRESULT OnCommand( HWND hWnd, WPARAM wParam, LPARAM lParam)
|
||||||
|
|
||||||
case ID_TOGGLE_TOOLBAR:
|
case ID_TOGGLE_TOOLBAR:
|
||||||
toggle_toolbar(BANDID_TOOLBAR);
|
toggle_toolbar(BANDID_TOOLBAR);
|
||||||
|
update_window();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ID_TOGGLE_FORMATBAR:
|
||||||
|
toggle_toolbar(BANDID_FORMATBAR);
|
||||||
|
update_window();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_TOGGLE_STATUSBAR:
|
case ID_TOGGLE_STATUSBAR:
|
||||||
|
@ -754,19 +781,29 @@ static LRESULT OnInitPopupMenu( HWND hWnd, WPARAM wParam, LPARAM lParam )
|
||||||
MF_BYCOMMAND|(SendMessage(hwndEditor, EM_GETMODIFY, 0, 0) ? MF_CHECKED : MF_UNCHECKED));
|
MF_BYCOMMAND|(SendMessage(hwndEditor, EM_GETMODIFY, 0, 0) ? MF_CHECKED : MF_UNCHECKED));
|
||||||
if (pf.dwMask & PFM_ALIGNMENT)
|
if (pf.dwMask & PFM_ALIGNMENT)
|
||||||
nAlignment = pf.wAlignment;
|
nAlignment = pf.wAlignment;
|
||||||
CheckMenuItem(hMenu, ID_ALIGN_LEFT, MF_BYCOMMAND|(nAlignment == PFA_LEFT) ? MF_CHECKED : MF_UNCHECKED);
|
CheckMenuItem(hMenu, ID_ALIGN_LEFT, MF_BYCOMMAND|(nAlignment == PFA_LEFT) ?
|
||||||
CheckMenuItem(hMenu, ID_ALIGN_CENTER, MF_BYCOMMAND|(nAlignment == PFA_CENTER) ? MF_CHECKED : MF_UNCHECKED);
|
MF_CHECKED : MF_UNCHECKED);
|
||||||
CheckMenuItem(hMenu, ID_ALIGN_RIGHT, MF_BYCOMMAND|(nAlignment == PFA_RIGHT) ? MF_CHECKED : MF_UNCHECKED);
|
CheckMenuItem(hMenu, ID_ALIGN_CENTER, MF_BYCOMMAND|(nAlignment == PFA_CENTER) ?
|
||||||
EnableMenuItem(hMenu, ID_EDIT_UNDO, MF_BYCOMMAND|(SendMessage(hwndEditor, EM_CANUNDO, 0, 0)) ? MF_ENABLED : MF_GRAYED);
|
MF_CHECKED : MF_UNCHECKED);
|
||||||
EnableMenuItem(hMenu, ID_EDIT_REDO, MF_BYCOMMAND|(SendMessage(hwndEditor, EM_CANREDO, 0, 0)) ? MF_ENABLED : MF_GRAYED);
|
CheckMenuItem(hMenu, ID_ALIGN_RIGHT, MF_BYCOMMAND|(nAlignment == PFA_RIGHT) ?
|
||||||
|
MF_CHECKED : MF_UNCHECKED);
|
||||||
|
EnableMenuItem(hMenu, ID_EDIT_UNDO, MF_BYCOMMAND|(SendMessageW(hwndEditor, EM_CANUNDO, 0, 0)) ?
|
||||||
|
MF_ENABLED : MF_GRAYED);
|
||||||
|
EnableMenuItem(hMenu, ID_EDIT_REDO, MF_BYCOMMAND|(SendMessageW(hwndEditor, EM_CANREDO, 0, 0)) ?
|
||||||
|
MF_ENABLED : MF_GRAYED);
|
||||||
|
|
||||||
rbbinfo.cbSize = sizeof(rbbinfo);
|
rbbinfo.cbSize = sizeof(rbbinfo);
|
||||||
rbbinfo.fMask = RBBIM_STYLE;
|
rbbinfo.fMask = RBBIM_STYLE;
|
||||||
SendMessageW(hwndReBar, RB_GETBANDINFO, 0, (LPARAM)&rbbinfo);
|
SendMessageW(hwndReBar, RB_GETBANDINFO, BANDID_TOOLBAR, (LPARAM)&rbbinfo);
|
||||||
|
|
||||||
CheckMenuItem(hMenu, ID_TOGGLE_TOOLBAR, MF_BYCOMMAND|(rbbinfo.fStyle & RBBS_HIDDEN) ?
|
CheckMenuItem(hMenu, ID_TOGGLE_TOOLBAR, MF_BYCOMMAND|(rbbinfo.fStyle & RBBS_HIDDEN) ?
|
||||||
MF_UNCHECKED : MF_CHECKED);
|
MF_UNCHECKED : MF_CHECKED);
|
||||||
|
|
||||||
|
SendMessageW(hwndReBar, RB_GETBANDINFO, BANDID_FORMATBAR, (LPARAM)&rbbinfo);
|
||||||
|
|
||||||
|
CheckMenuItem(hMenu, ID_TOGGLE_FORMATBAR, MF_BYCOMMAND|(rbbinfo.fStyle & RBBS_HIDDEN) ?
|
||||||
|
MF_UNCHECKED : MF_CHECKED);
|
||||||
|
|
||||||
CheckMenuItem(hMenu, ID_TOGGLE_STATUSBAR, MF_BYCOMMAND|IsWindowVisible(hwndStatus) ?
|
CheckMenuItem(hMenu, ID_TOGGLE_STATUSBAR, MF_BYCOMMAND|IsWindowVisible(hwndStatus) ?
|
||||||
MF_CHECKED : MF_UNCHECKED);
|
MF_CHECKED : MF_UNCHECKED);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -780,7 +817,10 @@ static LRESULT OnSize( HWND hWnd, WPARAM wParam, LPARAM lParam )
|
||||||
HWND hwndStatusBar = GetDlgItem(hWnd, IDC_STATUSBAR);
|
HWND hwndStatusBar = GetDlgItem(hWnd, IDC_STATUSBAR);
|
||||||
HWND hwndReBar = GetDlgItem(hWnd, IDC_REBAR);
|
HWND hwndReBar = GetDlgItem(hWnd, IDC_REBAR);
|
||||||
HWND hwndToolBar = GetDlgItem(hwndReBar, IDC_TOOLBAR);
|
HWND hwndToolBar = GetDlgItem(hwndReBar, IDC_TOOLBAR);
|
||||||
int rebarHeight;
|
HWND hwndFormatBar = GetDlgItem(hwndReBar, IDC_FORMATBAR);
|
||||||
|
int rebarHeight = 0;
|
||||||
|
REBARBANDINFOW rbbinfo;
|
||||||
|
int rebarRows = 2;
|
||||||
|
|
||||||
if (hwndStatusBar)
|
if (hwndStatusBar)
|
||||||
{
|
{
|
||||||
|
@ -804,9 +844,33 @@ static LRESULT OnSize( HWND hWnd, WPARAM wParam, LPARAM lParam )
|
||||||
GetClientRect(hwndReBar, &rc);
|
GetClientRect(hwndReBar, &rc);
|
||||||
MoveWindow(hwndReBar, 0, 0, LOWORD(lParam), rc.right, FALSE);
|
MoveWindow(hwndReBar, 0, 0, LOWORD(lParam), rc.right, FALSE);
|
||||||
}
|
}
|
||||||
|
if (hwndFormatBar)
|
||||||
|
{
|
||||||
|
rc.left = rc.top = 0;
|
||||||
|
rc.right = LOWORD(lParam);
|
||||||
|
rc.bottom = HIWORD(lParam);
|
||||||
|
SendMessageW(hwndFormatBar, TB_AUTOSIZE, 0, 0);
|
||||||
|
SendMessageW(hwndReBar, RB_SIZETORECT, 0, (LPARAM)&rc);
|
||||||
|
GetClientRect(hwndReBar, &rc);
|
||||||
|
MoveWindow(hwndReBar, 0, 0, LOWORD(lParam), rc.right, FALSE);
|
||||||
|
}
|
||||||
|
if (hwndReBar)
|
||||||
|
{
|
||||||
|
rbbinfo.cbSize = sizeof(rbbinfo);
|
||||||
|
rbbinfo.fMask = RBBIM_STYLE;
|
||||||
|
|
||||||
|
SendMessageW(hwndReBar, RB_GETBANDINFO, BANDID_TOOLBAR, (LPARAM)&rbbinfo);
|
||||||
|
if(rbbinfo.fStyle & RBBS_HIDDEN)
|
||||||
|
rebarRows--;
|
||||||
|
|
||||||
|
SendMessageW(hwndReBar, RB_GETBANDINFO, BANDID_FORMATBAR, (LPARAM)&rbbinfo);
|
||||||
|
if(rbbinfo.fStyle & RBBS_HIDDEN)
|
||||||
|
rebarRows--;
|
||||||
|
|
||||||
|
rebarHeight = rebarRows ? SendMessageW(hwndReBar, RB_GETBARHEIGHT, 0, 0) : 0;
|
||||||
|
}
|
||||||
if (hwndEditor)
|
if (hwndEditor)
|
||||||
{
|
{
|
||||||
rebarHeight = rebar_height();
|
|
||||||
GetClientRect(hWnd, &rc);
|
GetClientRect(hWnd, &rc);
|
||||||
MoveWindow(hwndEditor, 0, rebarHeight, rc.right, rc.bottom-nStatusSize-rebarHeight, TRUE);
|
MoveWindow(hwndEditor, 0, rebarHeight, rc.right, rc.bottom-nStatusSize-rebarHeight, TRUE);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue