option "display version on desktop background"

svn path=/trunk/; revision=8908
This commit is contained in:
Martin Fuchs 2004-03-28 20:32:23 +00:00
parent f2d4a56a85
commit 9447d23bc1
7 changed files with 80 additions and 21 deletions

View file

@ -95,6 +95,9 @@ DesktopSettingsDlg::DesktopSettingsDlg(HWND hwnd)
_alignment_cur = SendMessage(g_Globals._hwndShellView, PM_GET_ICON_ALGORITHM, 0, 0);
_alignment_tmp = _alignment_cur;
_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
@ -110,11 +113,13 @@ int DesktopSettingsDlg::Notify(int id, NMHDR* pnmh)
case PSN_APPLY:
_alignment_cur = _alignment_tmp;
_display_version_org = SendMessage(g_Globals._hwndShellView, PM_DISPLAY_VERSION, 0, MAKELONG(0,0));
break;
case PSN_RESET:
if (_alignment_tmp != _alignment_cur)
SendMessage(g_Globals._hwndShellView, PM_SET_ICON_ALGORITHM, _alignment_cur, 0);
SendMessage(g_Globals._hwndShellView, PM_DISPLAY_VERSION, _display_version_org, MAKELONG(1,0));
break;
default:
@ -140,7 +145,17 @@ int DesktopSettingsDlg::Command(int id, int code)
return 0;
}
return 1;
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;
}
@ -152,6 +167,25 @@ TaskbarSettingsDlg::TaskbarSettingsDlg(HWND hwnd)
CheckDlgButton(hwnd, ID_HIDE_INACTIVE_ICONS, XMLBool(g_Globals.get_cfg("notify-icons"), "options", "hide-inactive", true)? BST_CHECKED: BST_UNCHECKED);
}
int TaskbarSettingsDlg::Notify(int id, NMHDR* pnmh)
{
switch(pnmh->code) {
case PSN_APPLY:
_cfg_org = g_Globals._cfg;
break;
case PSN_RESET:
g_Globals._cfg = _cfg_org;
SendMessage(g_Globals._hwndDesktopBar, PM_REFRESH_CONFIG, 0, 0);
break;
default:
return super::Notify(id, pnmh);
}
return 0;
}
int TaskbarSettingsDlg::Command(int id, int code)
{
switch(id) {
@ -171,11 +205,6 @@ int TaskbarSettingsDlg::Command(int id, int code)
PropSheet_Changed(GetParent(_hwnd), _hwnd);
break;
case PSN_RESET:
g_Globals._cfg = _cfg_org;
SendMessage(g_Globals._hwndDesktopBar, PM_REFRESH_CONFIG, 0, 0);
break;
default:
return 1;
}

View file

@ -54,6 +54,8 @@ protected:
int _alignment_cur;
int _alignment_tmp;
int _display_version_org;
virtual int Command(int id, int code);
virtual int Notify(int id, NMHDR* pnmh);
};
@ -67,6 +69,7 @@ struct TaskbarSettingsDlg : public PropSheetPageDlg
TaskbarSettingsDlg(HWND hwnd);
virtual int Command(int id, int code);
virtual int Notify(int id, NMHDR* pnmh);
protected:
XMLDoc _cfg_org;

View file

@ -333,3 +333,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;
}

View file

@ -149,6 +149,9 @@ extern int find_window_class(LPCTSTR classname);
// 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"

View file

@ -649,11 +649,6 @@ 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
@ -685,7 +680,7 @@ INT_PTR CALLBACK Window::DialogProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM
if (pThis) {
switch(nmsg) {
case WM_COMMAND:
SetWindowLong(hwnd, DWL_MSGRESULT, (LPARAM)pThis->Command(LOWORD(wparam), HIWORD(wparam)));
pThis->Command(LOWORD(wparam), HIWORD(wparam));
return TRUE; // message has been processed
case WM_NOTIFY:
@ -708,8 +703,6 @@ 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
@ -1373,7 +1366,7 @@ INT_PTR CALLBACK PropSheetPageDlg::DialogProc(HWND hwnd, UINT nmsg, WPARAM wpara
if (pThis) {
switch(nmsg) {
case WM_COMMAND:
SetWindowLong(hwnd, DWL_MSGRESULT, (LPARAM)pThis->Command(LOWORD(wparam), HIWORD(wparam)));
pThis->Command(LOWORD(wparam), HIWORD(wparam));
return TRUE; // message has been processed
case WM_NOTIFY:
@ -1401,8 +1394,6 @@ 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
@ -1412,5 +1403,5 @@ int PropSheetPageDlg::Command(int id, int code)
{
// override call to EndDialog in Dialog::Command();
return 1;
return FALSE;
}

View file

@ -371,7 +371,6 @@ 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);
};

View file

@ -303,6 +303,21 @@ struct XMLNode : public String
}
}
XMLNode& operator=(const XMLNode& other)
{
_children.clear();
for(Children::const_iterator it=other._children.begin(); it!=other._children.end(); ++it)
_children.push_back(new XMLNode(**it));
_attributes = other._attributes;
_content = other._content;
_trailing = other._trailing;
return *this;
}
/// add a new child node
void add_child(XMLNode* child)
{
@ -329,7 +344,7 @@ struct XMLNode : public String
/// convenient value access in children node
String value(const String& name, const String& attr_name) const
{
XMLNode* node = find_first(name);
const XMLNode* node = find_first(name);
if (node)
return (*node)[attr_name];
@ -365,7 +380,7 @@ struct XMLNode : public String
/// convenient value access in children node
String value(const char* name, const char* attr_name) const
{
XMLNode* node = find_first(name);
const XMLNode* node = find_first(name);
if (node)
return (*node)[attr_name];