diff --git a/.gitignore b/.gitignore index 88c847579d6..d7005708487 100644 --- a/.gitignore +++ b/.gitignore @@ -899,8 +899,8 @@ programs/winhelp/macro.lex.yy.c programs/winhelp/rsrc.res programs/winhelp/winhelp programs/winver/winver +programs/wordpad/formatbar.bmp programs/wordpad/rsrc.res -programs/wordpad/toolbar.bmp programs/wordpad/wordpad programs/wordpad/wordpad.ico programs/xcopy/rsrc.res diff --git a/programs/wordpad/De.rc b/programs/wordpad/De.rc index dbaad477263..272dd5001b2 100644 --- a/programs/wordpad/De.rc +++ b/programs/wordpad/De.rc @@ -55,6 +55,7 @@ BEGIN POPUP "&View" BEGIN MENUITEM "&Toolbar", ID_TOGGLE_TOOLBAR + MENUITEM "&Formatbar", ID_TOGGLE_FORMATBAR MENUITEM "&Statusbar", ID_TOGGLE_STATUSBAR END POPUP "F&ormat" diff --git a/programs/wordpad/En.rc b/programs/wordpad/En.rc index d4099b2f499..f8878bdf585 100644 --- a/programs/wordpad/En.rc +++ b/programs/wordpad/En.rc @@ -55,6 +55,7 @@ BEGIN POPUP "&View" BEGIN MENUITEM "&Toolbar", ID_TOGGLE_TOOLBAR + MENUITEM "&Formatbar", ID_TOGGLE_FORMATBAR MENUITEM "&Statusbar", ID_TOGGLE_STATUSBAR END POPUP "F&ormat" diff --git a/programs/wordpad/Fr.rc b/programs/wordpad/Fr.rc index a840f98c1f4..096248359fd 100644 --- a/programs/wordpad/Fr.rc +++ b/programs/wordpad/Fr.rc @@ -55,7 +55,8 @@ BEGIN POPUP "&View" BEGIN MENUITEM "&Toolbar", ID_TOGGLE_TOOLBAR - MENUITEM "&Statusbar", ID_TOGGLE_STATUSBAR + MENUITEM "&Formatbar", ID_TOGGLE_FORMATBAR + MENUITEM "&Statusbar", ID_TOGGLE_STATUSBAR END POPUP "Forma&t" BEGIN diff --git a/programs/wordpad/Hu.rc b/programs/wordpad/Hu.rc index 3632029ec48..abd9f6d54a4 100644 --- a/programs/wordpad/Hu.rc +++ b/programs/wordpad/Hu.rc @@ -55,6 +55,7 @@ BEGIN POPUP "&View" BEGIN MENUITEM "&Toolbar", ID_TOGGLE_TOOLBAR + MENUITEM "&Formatbar", ID_TOGGLE_FORMATBAR MENUITEM "&Statusbar", ID_TOGGLE_STATUSBAR END POPUP "F&ormátum" diff --git a/programs/wordpad/Ko.rc b/programs/wordpad/Ko.rc index a45e8e5d6e7..9f89ed0c55e 100644 --- a/programs/wordpad/Ko.rc +++ b/programs/wordpad/Ko.rc @@ -56,6 +56,7 @@ BEGIN POPUP "&View" BEGIN MENUITEM "&Toolbar", ID_TOGGLE_TOOLBAR + MENUITEM "&Formatbar", ID_TOGGLE_FORMATBAR MENUITEM "&Statusbar", ID_TOGGLE_STATUSBAR END POPUP "Çü½Ä(&O)" diff --git a/programs/wordpad/Makefile.in b/programs/wordpad/Makefile.in index 166f14d2aad..2192db8b92a 100644 --- a/programs/wordpad/Makefile.in +++ b/programs/wordpad/Makefile.in @@ -15,7 +15,7 @@ C_SRCS = \ RC_SRCS = rsrc.rc RC_BINSRC = rsrc.rc RC_BINARIES = \ - toolbar.bmp \ + formatbar.bmp \ wordpad.ico @MAKE_PROG_RULES@ diff --git a/programs/wordpad/Nl.rc b/programs/wordpad/Nl.rc index 5c5bd14d274..0cdfef51e80 100644 --- a/programs/wordpad/Nl.rc +++ b/programs/wordpad/Nl.rc @@ -55,6 +55,7 @@ BEGIN POPUP "&View" BEGIN MENUITEM "&Toolbar", ID_TOGGLE_TOOLBAR + MENUITEM "&Formatbar", ID_TOGGLE_FORMATBAR MENUITEM "&Statusbar", ID_TOGGLE_STATUSBAR END POPUP "&Opmaak" diff --git a/programs/wordpad/No.rc b/programs/wordpad/No.rc index e339b3af15e..20621bf8a0a 100644 --- a/programs/wordpad/No.rc +++ b/programs/wordpad/No.rc @@ -54,7 +54,8 @@ BEGIN END POPUP "&Vis" 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 END POPUP "F&ormat" diff --git a/programs/wordpad/Pl.rc b/programs/wordpad/Pl.rc index 1d1362e10b7..67ea7c02591 100644 --- a/programs/wordpad/Pl.rc +++ b/programs/wordpad/Pl.rc @@ -56,6 +56,7 @@ BEGIN POPUP "&View" BEGIN MENUITEM "&Toolbar", ID_TOGGLE_TOOLBAR + MENUITEM "&Formatbar", ID_TOGGLE_FORMATBAR MENUITEM "&Statusbar", ID_TOGGLE_STATUSBAR END POPUP "F&ormat" diff --git a/programs/wordpad/Ru.rc b/programs/wordpad/Ru.rc index 8b0ea29573e..a0ad92261ea 100644 --- a/programs/wordpad/Ru.rc +++ b/programs/wordpad/Ru.rc @@ -53,6 +53,7 @@ BEGIN POPUP "&View" BEGIN MENUITEM "&Toolbar", ID_TOGGLE_TOOLBAR + MENUITEM "&Formatbar", ID_TOGGLE_FORMATBAR MENUITEM "&Statusbar", ID_TOGGLE_STATUSBAR END POPUP "Ôîð&ìàò" diff --git a/programs/wordpad/Tr.rc b/programs/wordpad/Tr.rc index d59856cfdca..cf4d9f69031 100644 --- a/programs/wordpad/Tr.rc +++ b/programs/wordpad/Tr.rc @@ -57,6 +57,7 @@ BEGIN POPUP "&View" BEGIN MENUITEM "&Toolbar", ID_TOGGLE_TOOLBAR + MENUITEM "&Formatbar", ID_TOGGLE_FORMATBAR MENUITEM "&Statusbar", ID_TOGGLE_STATUSBAR END POPUP "&Biçim" diff --git a/programs/wordpad/resource.h b/programs/wordpad/resource.h index 667b555f673..ecc035a1881 100644 --- a/programs/wordpad/resource.h +++ b/programs/wordpad/resource.h @@ -54,17 +54,20 @@ #define ID_FORMAT_UNDERLINE 1402 #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_FORMATBAR 1 #define IDC_STATUSBAR 2000 #define IDC_EDITOR 2001 #define IDC_TOOLBAR 2002 -#define IDC_REBAR 2003 -#define IDC_COMBO 2004 +#define IDC_FORMATBAR 2003 +#define IDC_REBAR 2004 +#define IDC_COMBO 2005 -#define IDB_TOOLBAR 100 +#define IDB_FORMATBAR 100 #define IDI_WORDPAD 101 diff --git a/programs/wordpad/rsrc.rc b/programs/wordpad/rsrc.rc index 94d46d953b9..3410d511d3a 100644 --- a/programs/wordpad/rsrc.rc +++ b/programs/wordpad/rsrc.rc @@ -39,8 +39,8 @@ BEGIN "S", ID_FILE_SAVE, VIRTKEY, CONTROL END -/* BINRES toolbar.bmp */ -IDB_TOOLBAR BITMAP "toolbar.bmp" +/* BINRES formatbar.bmp */ +IDB_FORMATBAR BITMAP "formatbar.bmp" /* { '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' diff --git a/programs/wordpad/wordpad.c b/programs/wordpad/wordpad.c index bc18d31b505..616ef23018d 100644 --- a/programs/wordpad/wordpad.c +++ b/programs/wordpad/wordpad.c @@ -339,39 +339,39 @@ static void toggle_toolbar(int bandId) { HWND hwndReBar = GetDlgItem(hMainWnd, IDC_REBAR); REBARBANDINFOW rbbinfo; + BOOL hide = TRUE; if(!hwndReBar) return; rbbinfo.cbSize = sizeof(rbbinfo); - rbbinfo.fMask = RBBIM_STYLE; + rbbinfo.fMask = RBBIM_STYLE | RBBIM_SIZE; 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) -{ - HWND hwndReBar = GetDlgItem(hMainWnd, IDC_REBAR); + if(bandId == BANDID_TOOLBAR) + { + rbbinfo.fMask ^= RBBIM_SIZE; - REBARBANDINFOW rbbinfo; + SendMessageW(hwndReBar, RB_GETBANDINFO, BANDID_FORMATBAR, (LPARAM)&rbbinfo); - if(!hwndReBar) - return 0; + if(hide) + rbbinfo.fStyle ^= RBBS_BREAK; + else + rbbinfo.fStyle |= RBBS_BREAK; - rbbinfo.cbSize = sizeof(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); + SendMessageW(hwndReBar, RB_SETBANDINFO, BANDID_FORMATBAR, (LPARAM)&rbbinfo); + } } static LRESULT OnCreate( HWND hWnd, WPARAM wParam, LPARAM lParam) { - HWND hToolBarWnd, hReBarWnd; + HWND hToolBarWnd, hFormatBarWnd, hReBarWnd; HINSTANCE hInstance = (HINSTANCE)GetWindowLongPtr(hWnd, GWLP_HINSTANCE); HANDLE hDLL; 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, IDC_TOOLBAR, - 6, hInstance, IDB_TOOLBAR, + 0, hInstance, 0, NULL, 0, 24, 24, 16, 16, sizeof(TBBUTTON)); ab.hInst = HINST_COMMCTRL; 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_FILEOPEN, ID_FILE_OPEN); 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_UNDO, ID_EDIT_UNDO); 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_AUTOSIZE, 0, 0); rbb.cbSize = sizeof(rbb); rbb.fMask = RBBIM_SIZE | RBBIM_CHILDSIZE | RBBIM_CHILD | RBBIM_STYLE; - rbb.fStyle = RBBS_CHILDEDGE; - rbb.cx = 500; + rbb.fStyle = RBBS_CHILDEDGE | RBBS_BREAK | RBBS_NOGRIPPER; + rbb.cx = 0; rbb.hwndChild = hToolBarWnd; rbb.cxMinChild = 0; rbb.cyChild = rbb.cyMinChild = HIWORD(SendMessage(hToolBarWnd, TB_GETBUTTONSIZE, 0, 0)); 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"); assert(hDLL); hEditorWnd = CreateWindowExW(WS_EX_CLIENTEDGE, wszRichEditClass, NULL, WS_CHILD|WS_VISIBLE|ES_MULTILINE|ES_AUTOVSCROLL|ES_WANTRETURN|WS_VSCROLL, 0, 0, 1000, 100, hWnd, (HMENU)IDC_EDITOR, hInstance, NULL); + if (!hEditorWnd) { 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 hwndReBar = GetDlgItem(hWnd, IDC_REBAR); HWND hwndToolBar = GetDlgItem(hwndReBar, IDC_TOOLBAR); + HWND hwndFormatBar = GetDlgItem(hwndReBar, IDC_FORMATBAR); int from, to; CHARFORMAT2W fmt; PARAFORMAT2 pf; @@ -483,17 +500,21 @@ static LRESULT OnUser( HWND hWnd, WPARAM wParam, LPARAM lParam) SendMessage(hwndEditor, EM_CANREDO, 0, 0)); 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_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); - 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)); + SendMessageW(hwndFormatBar, TB_CHECKBUTTON, ID_FORMAT_BOLD, (fmt.dwMask & CFM_BOLD) && + (fmt.dwEffects & CFE_BOLD)); + SendMessageW(hwndFormatBar, TB_INDETERMINATE, ID_FORMAT_BOLD, !(fmt.dwMask & CFM_BOLD)); + 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; } @@ -722,6 +743,12 @@ static LRESULT OnCommand( HWND hWnd, WPARAM wParam, LPARAM lParam) case ID_TOGGLE_TOOLBAR: toggle_toolbar(BANDID_TOOLBAR); + update_window(); + break; + + case ID_TOGGLE_FORMATBAR: + toggle_toolbar(BANDID_FORMATBAR); + update_window(); break; 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)); if (pf.dwMask & PFM_ALIGNMENT) nAlignment = pf.wAlignment; - CheckMenuItem(hMenu, ID_ALIGN_LEFT, MF_BYCOMMAND|(nAlignment == PFA_LEFT) ? MF_CHECKED : MF_UNCHECKED); - CheckMenuItem(hMenu, ID_ALIGN_CENTER, MF_BYCOMMAND|(nAlignment == PFA_CENTER) ? MF_CHECKED : MF_UNCHECKED); - CheckMenuItem(hMenu, ID_ALIGN_RIGHT, MF_BYCOMMAND|(nAlignment == PFA_RIGHT) ? MF_CHECKED : MF_UNCHECKED); - EnableMenuItem(hMenu, ID_EDIT_UNDO, MF_BYCOMMAND|(SendMessage(hwndEditor, EM_CANUNDO, 0, 0)) ? MF_ENABLED : MF_GRAYED); - EnableMenuItem(hMenu, ID_EDIT_REDO, MF_BYCOMMAND|(SendMessage(hwndEditor, EM_CANREDO, 0, 0)) ? MF_ENABLED : MF_GRAYED); + CheckMenuItem(hMenu, ID_ALIGN_LEFT, MF_BYCOMMAND|(nAlignment == PFA_LEFT) ? + MF_CHECKED : MF_UNCHECKED); + CheckMenuItem(hMenu, ID_ALIGN_CENTER, MF_BYCOMMAND|(nAlignment == PFA_CENTER) ? + MF_CHECKED : MF_UNCHECKED); + 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.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) ? 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) ? MF_CHECKED : MF_UNCHECKED); return 0; @@ -780,7 +817,10 @@ static LRESULT OnSize( HWND hWnd, WPARAM wParam, LPARAM lParam ) HWND hwndStatusBar = GetDlgItem(hWnd, IDC_STATUSBAR); HWND hwndReBar = GetDlgItem(hWnd, IDC_REBAR); HWND hwndToolBar = GetDlgItem(hwndReBar, IDC_TOOLBAR); - int rebarHeight; + HWND hwndFormatBar = GetDlgItem(hwndReBar, IDC_FORMATBAR); + int rebarHeight = 0; + REBARBANDINFOW rbbinfo; + int rebarRows = 2; if (hwndStatusBar) { @@ -804,9 +844,33 @@ static LRESULT OnSize( HWND hWnd, WPARAM wParam, LPARAM lParam ) GetClientRect(hwndReBar, &rc); 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) { - rebarHeight = rebar_height(); GetClientRect(hWnd, &rc); MoveWindow(hwndEditor, 0, rebarHeight, rc.right, rc.bottom-nStatusSize-rebarHeight, TRUE); }