mirror of
https://github.com/reactos/reactos.git
synced 2025-05-21 10:05:35 +00:00
improve StatusBar handling
See issue #3011 for more details. svn path=/trunk/; revision=32048
This commit is contained in:
parent
a1407fd619
commit
ee02b70f0e
3 changed files with 50 additions and 14 deletions
|
@ -290,6 +290,31 @@ static VOID NOTEPAD_InitMenuPopup(HMENU menu, LPARAM index)
|
|||
DrawMenuBar(Globals.hMainWnd);
|
||||
}
|
||||
|
||||
LRESULT CALLBACK EDIT_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (msg)
|
||||
{
|
||||
case WM_KEYUP:
|
||||
{
|
||||
switch (wParam)
|
||||
{
|
||||
case VK_UP:
|
||||
case VK_DOWN:
|
||||
case VK_LEFT:
|
||||
case VK_RIGHT:
|
||||
DIALOG_StatusBarUpdateCaretPos();
|
||||
break;
|
||||
}
|
||||
}
|
||||
case WM_LBUTTONUP:
|
||||
{
|
||||
DIALOG_StatusBarUpdateCaretPos();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return CallWindowProc( (WNDPROC)Globals.EditProc, hWnd, msg, wParam, lParam);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* NOTEPAD_WndProc
|
||||
|
@ -312,6 +337,9 @@ static LRESULT WINAPI NOTEPAD_WndProc(HWND hWnd, UINT msg, WPARAM wParam,
|
|||
SendMessage(Globals.hEdit, EM_LIMITTEXT, 0, 0);
|
||||
if (Globals.hFont)
|
||||
SendMessage(Globals.hEdit, WM_SETFONT, (WPARAM)Globals.hFont, (LPARAM)TRUE);
|
||||
|
||||
Globals.EditProc = (WNDPROC) SetWindowLongPtr(Globals.hEdit, GWLP_WNDPROC, (LONG_PTR)EDIT_WndProc);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -340,6 +368,7 @@ static LRESULT WINAPI NOTEPAD_WndProc(HWND hWnd, UINT msg, WPARAM wParam,
|
|||
break;
|
||||
|
||||
case WM_DESTROY:
|
||||
SetWindowLongPtr(Globals.hEdit, GWLP_WNDPROC, (LONG_PTR)Globals.EditProc);
|
||||
PostQuitMessage(0);
|
||||
break;
|
||||
|
||||
|
@ -562,6 +591,8 @@ int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE prev, LPTSTR cmdline, int sh
|
|||
UpdateWindow(Globals.hMainWnd);
|
||||
DragAcceptFiles(Globals.hMainWnd, TRUE);
|
||||
|
||||
DIALOG_ViewStatusBar();
|
||||
|
||||
HandleCommandLine(cmdline);
|
||||
|
||||
hAccel = LoadAccelerators( hInstance, MAKEINTRESOURCE(ID_ACCEL) );
|
||||
|
|
|
@ -67,6 +67,7 @@ typedef struct
|
|||
int iEoln;
|
||||
|
||||
FINDREPLACE find;
|
||||
WNDPROC EditProc;
|
||||
} NOTEPAD_GLOBALS;
|
||||
|
||||
extern NOTEPAD_GLOBALS Globals;
|
||||
|
|
|
@ -110,20 +110,23 @@ void LoadSettings(void)
|
|||
|
||||
if (RegOpenKey(HKEY_CURRENT_USER, s_szRegistryKey, &hKey) == ERROR_SUCCESS)
|
||||
{
|
||||
QueryByte(hKey, _T("lfCharSet"), &Globals.lfFont.lfCharSet);
|
||||
QueryByte(hKey, _T("lfClipPrecision"), &Globals.lfFont.lfClipPrecision);
|
||||
QueryDword(hKey, _T("lfEscapement"), (DWORD*)&Globals.lfFont.lfEscapement);
|
||||
QueryString(hKey, _T("lfFaceName"), Globals.lfFont.lfFaceName, sizeof(Globals.lfFont.lfFaceName) / sizeof(Globals.lfFont.lfFaceName[0]));
|
||||
QueryByte(hKey, _T("lfItalic"), &Globals.lfFont.lfItalic);
|
||||
QueryDword(hKey, _T("lfOrientation"), (DWORD*)&Globals.lfFont.lfOrientation);
|
||||
QueryByte(hKey, _T("lfOutPrecision"), &Globals.lfFont.lfOutPrecision);
|
||||
QueryByte(hKey, _T("lfPitchAndFamily"), &Globals.lfFont.lfPitchAndFamily);
|
||||
QueryByte(hKey, _T("lfQuality"), &Globals.lfFont.lfQuality);
|
||||
QueryByte(hKey, _T("lfStrikeOut"), &Globals.lfFont.lfStrikeOut);
|
||||
QueryByte(hKey, _T("lfUnderline"), &Globals.lfFont.lfUnderline);
|
||||
QueryDword(hKey, _T("lfWeight"), (DWORD*)&Globals.lfFont.lfWeight);
|
||||
QueryDword(hKey, _T("iPointSize"), &dwPointSize);
|
||||
QueryBool(hKey, _T("fWrap"), &Globals.bWrapLongLines);
|
||||
QueryByte(hKey, _T("lfCharSet"), &Globals.lfFont.lfCharSet);
|
||||
QueryByte(hKey, _T("lfClipPrecision"), &Globals.lfFont.lfClipPrecision);
|
||||
QueryDword(hKey, _T("lfEscapement"), (DWORD*)&Globals.lfFont.lfEscapement);
|
||||
QueryString(hKey, _T("lfFaceName"), Globals.lfFont.lfFaceName, sizeof(Globals.lfFont.lfFaceName) / sizeof(Globals.lfFont.lfFaceName[0]));
|
||||
QueryByte(hKey, _T("lfItalic"), &Globals.lfFont.lfItalic);
|
||||
QueryDword(hKey, _T("lfOrientation"), (DWORD*)&Globals.lfFont.lfOrientation);
|
||||
QueryByte(hKey, _T("lfOutPrecision"), &Globals.lfFont.lfOutPrecision);
|
||||
QueryByte(hKey, _T("lfPitchAndFamily"), &Globals.lfFont.lfPitchAndFamily);
|
||||
QueryByte(hKey, _T("lfQuality"), &Globals.lfFont.lfQuality);
|
||||
QueryByte(hKey, _T("lfStrikeOut"), &Globals.lfFont.lfStrikeOut);
|
||||
QueryByte(hKey, _T("lfUnderline"), &Globals.lfFont.lfUnderline);
|
||||
QueryDword(hKey, _T("lfWeight"), (DWORD*)&Globals.lfFont.lfWeight);
|
||||
QueryDword(hKey, _T("iPointSize"), &dwPointSize);
|
||||
QueryBool(hKey, _T("fWrap"), &Globals.bWrapLongLines);
|
||||
QueryBool(hKey, _T("fStatusBar"), &Globals.bShowStatusBar);
|
||||
|
||||
Globals.bShowStatusBar = !Globals.bShowStatusBar; /* invert value becuase DIALOG_ViewStatusBar will be called to show it*/
|
||||
|
||||
if (dwPointSize != 0)
|
||||
Globals.lfFont.lfHeight = HeightFromPointSize(dwPointSize);
|
||||
|
@ -172,6 +175,7 @@ void SaveSettings(void)
|
|||
SaveDword(hKey, _T("lfWeight"), Globals.lfFont.lfWeight);
|
||||
SaveDword(hKey, _T("iPointSize"), PointSizeFromHeight(Globals.lfFont.lfHeight));
|
||||
SaveDword(hKey, _T("fWrap"), Globals.bWrapLongLines ? 1 : 0);
|
||||
SaveDword(hKey, _T("fStatusBar"), Globals.bShowStatusBar ? 1 : 0);
|
||||
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue