wordpad: Allow toggling of statusbar.

This commit is contained in:
Alexander Nicolaysen Sørnes 2007-06-06 11:21:08 +02:00 committed by Alexandre Julliard
parent 10b348399a
commit 2de3d95ea5
12 changed files with 38 additions and 6 deletions

View File

@ -55,6 +55,7 @@ BEGIN
POPUP "&View"
BEGIN
MENUITEM "&Toolbar", ID_TOGGLE_TOOLBAR
MENUITEM "&Statusbar", ID_TOGGLE_STATUSBAR
END
POPUP "F&ormat"
BEGIN

View File

@ -55,6 +55,7 @@ BEGIN
POPUP "&View"
BEGIN
MENUITEM "&Toolbar", ID_TOGGLE_TOOLBAR
MENUITEM "&Statusbar", ID_TOGGLE_STATUSBAR
END
POPUP "F&ormat"
BEGIN

View File

@ -55,6 +55,7 @@ BEGIN
POPUP "&View"
BEGIN
MENUITEM "&Toolbar", ID_TOGGLE_TOOLBAR
MENUITEM "&Statusbar", ID_TOGGLE_STATUSBAR
END
POPUP "Forma&t"
BEGIN

View File

@ -55,6 +55,7 @@ BEGIN
POPUP "&View"
BEGIN
MENUITEM "&Toolbar", ID_TOGGLE_TOOLBAR
MENUITEM "&Statusbar", ID_TOGGLE_STATUSBAR
END
POPUP "F&ormátum"
BEGIN

View File

@ -56,6 +56,7 @@ BEGIN
POPUP "&View"
BEGIN
MENUITEM "&Toolbar", ID_TOGGLE_TOOLBAR
MENUITEM "&Statusbar", ID_TOGGLE_STATUSBAR
END
POPUP "Çü½Ä(&O)"
BEGIN

View File

@ -55,6 +55,7 @@ BEGIN
POPUP "&View"
BEGIN
MENUITEM "&Toolbar", ID_TOGGLE_TOOLBAR
MENUITEM "&Statusbar", ID_TOGGLE_STATUSBAR
END
POPUP "&Opmaak"
BEGIN

View File

@ -55,6 +55,7 @@ BEGIN
POPUP "&Vis"
BEGIN
MENUITEM "Verk&tøylinje", ID_TOGGLE_TOOLBAR
MENUITEM "&Statuslinje", ID_TOGGLE_STATUSBAR
END
POPUP "F&ormat"
BEGIN

View File

@ -56,6 +56,7 @@ BEGIN
POPUP "&View"
BEGIN
MENUITEM "&Toolbar", ID_TOGGLE_TOOLBAR
MENUITEM "&Statusbar", ID_TOGGLE_STATUSBAR
END
POPUP "F&ormat"
BEGIN

View File

@ -53,6 +53,7 @@ BEGIN
POPUP "&View"
BEGIN
MENUITEM "&Toolbar", ID_TOGGLE_TOOLBAR
MENUITEM "&Statusbar", ID_TOGGLE_STATUSBAR
END
POPUP "Ôîð&ìàò"
BEGIN

View File

@ -57,6 +57,7 @@ BEGIN
POPUP "&View"
BEGIN
MENUITEM "&Toolbar", ID_TOGGLE_TOOLBAR
MENUITEM "&Statusbar", ID_TOGGLE_STATUSBAR
END
POPUP "&Biçim"
BEGIN

View File

@ -54,6 +54,7 @@
#define ID_FORMAT_UNDERLINE 1402
#define ID_TOGGLE_TOOLBAR 1500
#define ID_TOGGLE_STATUSBAR 1501
#define BANDID_TOOLBAR 0

View File

@ -326,11 +326,19 @@ static void DoDefaultFont(void)
SendMessage(hEditorWnd, EM_SETCHARFORMAT, SCF_DEFAULT, (LPARAM)&fmt);
}
static void update_window(void)
{
RECT rect;
GetWindowRect(hMainWnd, &rect);
(void) OnSize(hMainWnd, SIZE_RESTORED, MAKELONG(rect.bottom, rect.right));
}
static void toggle_toolbar(int bandId)
{
HWND hwndReBar = GetDlgItem(hMainWnd, IDC_REBAR);
REBARBANDINFOW rbbinfo;
RECT rect;
if(!hwndReBar)
return;
@ -342,9 +350,7 @@ static void toggle_toolbar(int bandId)
SendMessageW(hwndReBar, RB_SHOWBAND, bandId, (rbbinfo.fStyle & RBBS_HIDDEN));
GetWindowRect(hMainWnd, &rect);
(void) OnSize(hMainWnd, SIZE_RESTORED, MAKELONG(rect.bottom, rect.right));
update_window();
}
static int rebar_height(void)
@ -518,6 +524,7 @@ static LRESULT OnNotify( HWND hWnd, WPARAM wParam, LPARAM lParam)
static LRESULT OnCommand( HWND hWnd, WPARAM wParam, LPARAM lParam)
{
HWND hwndEditor = GetDlgItem(hWnd, IDC_EDITOR);
HWND hwndStatus = GetDlgItem(hWnd, IDC_STATUSBAR);
if ((HWND)lParam == hwndEditor)
return 0;
@ -717,6 +724,11 @@ static LRESULT OnCommand( HWND hWnd, WPARAM wParam, LPARAM lParam)
toggle_toolbar(BANDID_TOOLBAR);
break;
case ID_TOGGLE_STATUSBAR:
ShowWindow(hwndStatus, IsWindowVisible(hwndStatus) ? SW_HIDE : SW_SHOW);
update_window();
break;
default:
SendMessage(hwndEditor, WM_COMMAND, wParam, lParam);
break;
@ -729,6 +741,7 @@ static LRESULT OnInitPopupMenu( HWND hWnd, WPARAM wParam, LPARAM lParam )
HMENU hMenu = (HMENU)wParam;
HWND hwndEditor = GetDlgItem(hWnd, IDC_EDITOR);
HWND hwndReBar = GetDlgItem(hWnd, IDC_REBAR);
HWND hwndStatus = GetDlgItem(hWnd, IDC_STATUSBAR);
PARAFORMAT pf;
int nAlignment = -1;
REBARBANDINFOW rbbinfo;
@ -754,6 +767,8 @@ static LRESULT OnInitPopupMenu( HWND hWnd, WPARAM wParam, LPARAM lParam )
CheckMenuItem(hMenu, ID_TOGGLE_TOOLBAR, 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;
}
@ -770,8 +785,14 @@ static LRESULT OnSize( HWND hWnd, WPARAM wParam, LPARAM lParam )
if (hwndStatusBar)
{
SendMessage(hwndStatusBar, WM_SIZE, 0, 0);
GetClientRect(hwndStatusBar, &rc);
nStatusSize = rc.bottom - rc.top;
if (IsWindowVisible(hwndStatusBar))
{
GetClientRect(hwndStatusBar, &rc);
nStatusSize = rc.bottom - rc.top;
} else
{
nStatusSize = 0;
}
}
if (hwndToolBar)
{