Author: cwittich
Date: Wed Jan 30 11:49:48 2008
New Revision: 32048
URL:
http://svn.reactos.org/svn/reactos?rev=32048&view=rev
Log:
improve StatusBar handling
See issue #3011 for more details.
Modified:
trunk/reactos/base/applications/notepad/main.c
trunk/reactos/base/applications/notepad/main.h
trunk/reactos/base/applications/notepad/settings.c
Modified: trunk/reactos/base/applications/notepad/main.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/notepad/…
==============================================================================
--- trunk/reactos/base/applications/notepad/main.c (original)
+++ trunk/reactos/base/applications/notepad/main.c Wed Jan 30 11:49:48 2008
@@ -288,6 +288,31 @@
EnableMenuItem(menu, CMD_SELECT_ALL,
GetWindowTextLength(Globals.hEdit) ? MF_ENABLED : MF_GRAYED);
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);
}
/***********************************************************************
@@ -312,6 +337,9 @@
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 @@
break;
case WM_DESTROY:
+ SetWindowLongPtr(Globals.hEdit, GWLP_WNDPROC, (LONG_PTR)Globals.EditProc);
PostQuitMessage(0);
break;
@@ -562,6 +591,8 @@
UpdateWindow(Globals.hMainWnd);
DragAcceptFiles(Globals.hMainWnd, TRUE);
+ DIALOG_ViewStatusBar();
+
HandleCommandLine(cmdline);
hAccel = LoadAccelerators( hInstance, MAKEINTRESOURCE(ID_ACCEL) );
Modified: trunk/reactos/base/applications/notepad/main.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/notepad/…
==============================================================================
--- trunk/reactos/base/applications/notepad/main.h (original)
+++ trunk/reactos/base/applications/notepad/main.h Wed Jan 30 11:49:48 2008
@@ -67,6 +67,7 @@
int iEoln;
FINDREPLACE find;
+ WNDPROC EditProc;
} NOTEPAD_GLOBALS;
extern NOTEPAD_GLOBALS Globals;
Modified: trunk/reactos/base/applications/notepad/settings.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/notepad/…
==============================================================================
--- trunk/reactos/base/applications/notepad/settings.c (original)
+++ trunk/reactos/base/applications/notepad/settings.c Wed Jan 30 11:49:48 2008
@@ -110,20 +110,23 @@
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 @@
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);
}