mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-09-02 12:23:31 +00:00
option "display version on desktop background"
svn path=/branches/lean-explorer/; revision=8909
This commit is contained in:
@@ -158,56 +158,37 @@ BOOL IsAnyDesktopRunning()
|
||||
}
|
||||
|
||||
|
||||
static void draw_desktop_background(HWND hwnd, HDC hdc)
|
||||
{
|
||||
ClientRect rect(hwnd);
|
||||
|
||||
PaintDesktop(hdc);
|
||||
/*
|
||||
HBRUSH bkgndBrush = CreateSolidBrush(RGB(0,32,160)); // dark blue
|
||||
FillRect(hdc, &rect, bkgndBrush);
|
||||
DeleteBrush(bkgndBrush);
|
||||
*/
|
||||
|
||||
rect.left = rect.right - 280;
|
||||
rect.top = rect.bottom - 56 - DESKTOPBARBAR_HEIGHT;
|
||||
rect.right = rect.left + 250;
|
||||
rect.bottom = rect.top + 40;
|
||||
|
||||
#include "../buildno.h"
|
||||
static const LPCTSTR BkgndText = TEXT("ReactOS ")TEXT(KERNEL_VERSION_STR)TEXT(" Explorer\nby Martin Fuchs");
|
||||
|
||||
BkMode bkMode(hdc, TRANSPARENT);
|
||||
|
||||
TextColor textColor(hdc, RGB(128,128,192));
|
||||
DrawText(hdc, BkgndText, -1, &rect, DT_RIGHT);
|
||||
|
||||
SetTextColor(hdc, RGB(255,255,255));
|
||||
--rect.right;
|
||||
++rect.top;
|
||||
DrawText(hdc, BkgndText, -1, &rect, DT_RIGHT);
|
||||
}
|
||||
|
||||
|
||||
BackgroundWindow::BackgroundWindow(HWND hwnd)
|
||||
: super(hwnd)
|
||||
{
|
||||
// set background brush for the short moment of displaying the
|
||||
// background color while moving foreground windows
|
||||
SetClassLong(hwnd, GCL_HBRBACKGROUND, COLOR_BACKGROUND+1);
|
||||
|
||||
_display_version = RegGetDWORDValue(HKEY_CURRENT_USER, TEXT("Control Panel\\Desktop"), TEXT("PaintDesktopVersion"), 1);
|
||||
}
|
||||
|
||||
LRESULT BackgroundWindow::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
|
||||
{
|
||||
switch(nmsg) {
|
||||
case WM_ERASEBKGND:
|
||||
PaintDesktop((HDC)wparam);
|
||||
DrawDesktopBkgnd((HDC)wparam);
|
||||
return TRUE;
|
||||
|
||||
case WM_MBUTTONDBLCLK:
|
||||
explorer_show_frame(SW_SHOWNORMAL);
|
||||
break;
|
||||
|
||||
case PM_DISPLAY_VERSION:
|
||||
if (lparam || wparam) {
|
||||
DWORD or_mask = wparam;
|
||||
DWORD reset_mask = LOWORD(lparam);
|
||||
DWORD xor_mask = HIWORD(lparam);
|
||||
_display_version = ((_display_version&~reset_mask) | or_mask) ^ xor_mask;
|
||||
InvalidateRect(_hwnd, NULL, TRUE);
|
||||
}
|
||||
return _display_version;
|
||||
|
||||
default:
|
||||
return super::WndProc(nmsg, wparam, lparam);
|
||||
}
|
||||
@@ -215,6 +196,38 @@ LRESULT BackgroundWindow::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void BackgroundWindow::DrawDesktopBkgnd(HDC hdc)
|
||||
{
|
||||
PaintDesktop(hdc);
|
||||
|
||||
/* special solid background
|
||||
HBRUSH bkgndBrush = CreateSolidBrush(RGB(0,32,160)); // dark blue
|
||||
FillRect(hdc, &rect, bkgndBrush);
|
||||
DeleteBrush(bkgndBrush);
|
||||
*/
|
||||
if (_display_version) {
|
||||
ClientRect rect(_hwnd);
|
||||
|
||||
rect.left = rect.right - 280;
|
||||
rect.top = rect.bottom - 56 - DESKTOPBARBAR_HEIGHT;
|
||||
rect.right = rect.left + 250;
|
||||
rect.bottom = rect.top + 40;
|
||||
|
||||
#include "../buildno.h"
|
||||
static const LPCTSTR BkgndText = TEXT("ReactOS ")TEXT(KERNEL_VERSION_STR)TEXT(" Explorer\nby Martin Fuchs");
|
||||
|
||||
BkMode bkMode(hdc, TRANSPARENT);
|
||||
|
||||
TextColor textColor(hdc, RGB(128,128,192));
|
||||
DrawText(hdc, BkgndText, -1, &rect, DT_RIGHT);
|
||||
|
||||
SetTextColor(hdc, RGB(255,255,255));
|
||||
--rect.right;
|
||||
++rect.top;
|
||||
DrawText(hdc, BkgndText, -1, &rect, DT_RIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
DesktopWindow::DesktopWindow(HWND hwnd)
|
||||
: super(hwnd)
|
||||
@@ -337,10 +350,6 @@ LRESULT DesktopWindow::Init(LPCREATESTRUCT pcs)
|
||||
LRESULT DesktopWindow::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
|
||||
{
|
||||
switch(nmsg) {
|
||||
case WM_PAINT:
|
||||
draw_desktop_background(_hwnd, PaintCanvas(_hwnd));
|
||||
break;
|
||||
|
||||
case WM_LBUTTONDBLCLK:
|
||||
case WM_RBUTTONDBLCLK:
|
||||
case WM_MBUTTONDBLCLK:
|
||||
@@ -444,6 +453,9 @@ LRESULT DesktopShellView::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
|
||||
DoDesktopContextMenu(GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam));
|
||||
break;
|
||||
|
||||
case PM_DISPLAY_VERSION:
|
||||
return SendMessage(_hwndListView, nmsg, wparam, lparam);
|
||||
|
||||
default:
|
||||
return super::WndProc(nmsg, wparam, lparam);
|
||||
}
|
||||
|
||||
@@ -69,6 +69,8 @@ void ExplorerPropertySheet(HWND hparent)
|
||||
DesktopSettingsDlg::DesktopSettingsDlg(HWND hwnd)
|
||||
: super(hwnd)
|
||||
{
|
||||
_display_version_org = SendMessage(g_Globals._hwndShellView, PM_DISPLAY_VERSION, 0, MAKELONG(0,0));
|
||||
CheckDlgButton(hwnd, ID_DESKTOP_VERSION, _display_version_org? BST_CHECKED: BST_UNCHECKED);
|
||||
}
|
||||
|
||||
#ifndef PSN_QUERYINITIALFOCUS // currently (as of 18.01.2004) missing in MinGW headers
|
||||
@@ -82,9 +84,11 @@ int DesktopSettingsDlg::Notify(int id, NMHDR* pnmh)
|
||||
break;
|
||||
|
||||
case PSN_APPLY:
|
||||
_display_version_org = SendMessage(g_Globals._hwndShellView, PM_DISPLAY_VERSION, 0, MAKELONG(0,0));
|
||||
break;
|
||||
|
||||
case PSN_RESET:
|
||||
SendMessage(g_Globals._hwndShellView, PM_DISPLAY_VERSION, _display_version_org, MAKELONG(1,0));
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -96,7 +100,17 @@ int DesktopSettingsDlg::Notify(int id, NMHDR* pnmh)
|
||||
|
||||
int DesktopSettingsDlg::Command(int id, int code)
|
||||
{
|
||||
return FALSE;
|
||||
switch(id) {
|
||||
case ID_DESKTOP_VERSION:
|
||||
SendMessage(g_Globals._hwndShellView, PM_DISPLAY_VERSION, 0, MAKELONG(0,1)); // toggle version display flag
|
||||
PropSheet_Changed(GetParent(_hwnd), _hwnd);
|
||||
break;
|
||||
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -41,6 +41,8 @@ struct DesktopSettingsDlg : public OwnerDrawParent<PropSheetPageDlg>
|
||||
protected:
|
||||
virtual int Command(int id, int code);
|
||||
virtual int Notify(int id, NMHDR* pnmh);
|
||||
|
||||
int _display_version_org;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -89,11 +89,11 @@ void HandleException(COMException& e, HWND hwnd)
|
||||
if (hwnd && !IsWindowVisible(hwnd))
|
||||
hwnd = 0;
|
||||
|
||||
MessageBox(hwnd, msg, TEXT("ShellClasses COM Exception"), MB_ICONHAND|MB_OK);
|
||||
MessageBox(hwnd, msg, TEXT("ShellClasses Exception"), MB_ICONHAND|MB_OK);
|
||||
|
||||
// If displaying the error message box _with_ parent was not successfull, display it now without a parent window.
|
||||
if (GetLastError() == ERROR_INVALID_WINDOW_HANDLE)
|
||||
MessageBox(0, msg, TEXT("ShellClasses COM Exception"), MB_ICONHAND|MB_OK);
|
||||
MessageBox(0, msg, TEXT("ShellClasses Exception"), MB_ICONHAND|MB_OK);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ using namespace _com_util;
|
||||
#endif
|
||||
|
||||
|
||||
// COM Exception Handling
|
||||
// Exception Handling
|
||||
|
||||
#ifndef _NO_COMUTIL
|
||||
|
||||
@@ -78,7 +78,7 @@ struct COMExceptionBase
|
||||
LocalFree(pBuf);
|
||||
} else {
|
||||
TCHAR buffer[128];
|
||||
_stprintf(buffer, TEXT("unknown COM Exception: 0x%08X"), _hr);
|
||||
_stprintf(buffer, TEXT("unknown Exception: 0x%08X"), _hr);
|
||||
_msg = buffer;
|
||||
}
|
||||
}
|
||||
@@ -94,7 +94,7 @@ protected:
|
||||
#endif
|
||||
|
||||
|
||||
/// COM Exception with context information
|
||||
/// Exception with context information
|
||||
|
||||
struct COMException : public COMExceptionBase
|
||||
{
|
||||
|
||||
@@ -326,3 +326,22 @@ BOOL RecursiveCreateDirectory(LPCTSTR path_in)
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
DWORD RegGetDWORDValue(HKEY root, LPCTSTR path, LPCTSTR valueName, DWORD def)
|
||||
{
|
||||
HKEY hkey;
|
||||
DWORD ret;
|
||||
|
||||
if (!RegOpenKey(root, path, &hkey)) {
|
||||
DWORD len = sizeof(ret);
|
||||
|
||||
if (RegQueryValueEx(hkey, valueName, 0, NULL, (LPBYTE)&ret, &len))
|
||||
ret = def;
|
||||
|
||||
RegCloseKey(hkey);
|
||||
|
||||
return ret;
|
||||
} else
|
||||
return def;
|
||||
}
|
||||
|
||||
@@ -149,6 +149,9 @@ BOOL RunDLL(HWND hwnd, LPCTSTR dllname, LPCSTR procname, LPCTSTR cmdline, UINT n
|
||||
// create a directory with all missing parent directories
|
||||
BOOL RecursiveCreateDirectory(LPCTSTR path_in);
|
||||
|
||||
// read DWORD value from registry
|
||||
DWORD RegGetDWORDValue(HKEY root, LPCTSTR path, LPCTSTR valueName, DWORD def);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
@@ -620,7 +623,7 @@ protected:
|
||||
};
|
||||
|
||||
|
||||
/// string class for convenience
|
||||
/// string class for TCHAR strings
|
||||
struct String
|
||||
#ifdef UNICODE
|
||||
: public wstring
|
||||
|
||||
@@ -428,6 +428,11 @@ Dialog::~Dialog()
|
||||
unregister_dialog(_hwnd);
|
||||
}
|
||||
|
||||
LRESULT Dialog::Init(LPCREATESTRUCT pcs)
|
||||
{
|
||||
return TRUE; // set standard focus
|
||||
}
|
||||
|
||||
int Dialog::DoModal(UINT nid, CREATORFUNC creator, HWND hwndParent)
|
||||
{
|
||||
Lock lock(GetStaticWindowData()._create_crit_sect); // protect access to s_window_creator and s_new_info
|
||||
@@ -455,7 +460,7 @@ INT_PTR CALLBACK Window::DialogProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM
|
||||
if (pThis) {
|
||||
switch(nmsg) {
|
||||
case WM_COMMAND:
|
||||
pThis->Command(LOWORD(wparam), HIWORD(wparam));
|
||||
SetWindowLong(hwnd, DWL_MSGRESULT, (LPARAM)pThis->Command(LOWORD(wparam), HIWORD(wparam)));
|
||||
return TRUE; // message has been processed
|
||||
|
||||
case WM_NOTIFY:
|
||||
@@ -478,6 +483,8 @@ INT_PTR CALLBACK Window::DialogProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM
|
||||
|
||||
if (pThis)
|
||||
return pThis->Init(NULL);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE; // message has not been processed
|
||||
@@ -1137,7 +1144,7 @@ INT_PTR CALLBACK PropSheetPageDlg::DialogProc(HWND hwnd, UINT nmsg, WPARAM wpara
|
||||
if (pThis) {
|
||||
switch(nmsg) {
|
||||
case WM_COMMAND:
|
||||
pThis->Command(LOWORD(wparam), HIWORD(wparam));
|
||||
SetWindowLong(hwnd, DWL_MSGRESULT, (LPARAM)pThis->Command(LOWORD(wparam), HIWORD(wparam)));
|
||||
return TRUE; // message has been processed
|
||||
|
||||
case WM_NOTIFY:
|
||||
@@ -1165,6 +1172,8 @@ INT_PTR CALLBACK PropSheetPageDlg::DialogProc(HWND hwnd, UINT nmsg, WPARAM wpara
|
||||
if (pThis)
|
||||
return pThis->Init(NULL);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE; // message has not been processed
|
||||
@@ -1174,5 +1183,5 @@ int PropSheetPageDlg::Command(int id, int code)
|
||||
{
|
||||
// override call to EndDialog in Dialog::Command();
|
||||
|
||||
return FALSE;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -319,6 +319,7 @@ struct Dialog : public Window
|
||||
static int DoModal(UINT nid, CREATORFUNC_INFO creator, const void* info, HWND hwndParent=0);
|
||||
|
||||
protected:
|
||||
LRESULT Init(LPCREATESTRUCT pcs);
|
||||
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam);
|
||||
int Command(int id, int code);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user