- Added Version tab to About dialog

- Fixed: Treeview in Manage Skins tab didn't update on Refresh All
- Fixed: Backup button in Manage Themes didn't work when path contained space
This commit is contained in:
Birunthan Mohanathas 2011-08-28 12:28:00 +00:00
parent 69f3ab1803
commit 6629527e83
7 changed files with 207 additions and 80 deletions

View File

@ -41,7 +41,8 @@ CDialogAbout* CDialogAbout::c_Dialog = NULL;
CDialogAbout::CDialogAbout(HWND wnd) : CDialog(wnd),
m_TabLog(),
m_TabMeasures(),
m_TabPlugins()
m_TabPlugins(),
m_TabVersion()
{
}
@ -56,6 +57,7 @@ CDialogAbout::~CDialogAbout()
delete m_TabLog;
delete m_TabMeasures;
delete m_TabPlugins;
delete m_TabVersion;
}
/*
@ -144,8 +146,8 @@ INT_PTR CALLBACK CDialogAbout::DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPAR
case WM_GETMINMAXINFO:
{
MINMAXINFO* mmi = (MINMAXINFO*)lParam;
mmi->ptMinTrackSize.x = 400;
mmi->ptMinTrackSize.y = 250;
mmi->ptMinTrackSize.x = 550;
mmi->ptMinTrackSize.y = 350;
}
return TRUE;
@ -160,10 +162,6 @@ INT_PTR CALLBACK CDialogAbout::DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPAR
HWND item = GetDlgItem(hWnd, IDC_ABOUT_TAB);
SetWindowPos(item, NULL, 0, 0, w - 18, h - 47, SWP_NOMOVE | SWP_NOZORDER);
item = GetDlgItem(hWnd, IDC_ABOUT_VERSION_TEXT);
GetClientRect(item, &r);
SetWindowPos(item, NULL, 8, h - r.bottom - 11, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
item = GetDlgItem(hWnd, IDCLOSE);
GetClientRect(item, &r);
SetWindowPos(item, NULL, w - r.right - 9, h - r.bottom - 8, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
@ -171,6 +169,7 @@ INT_PTR CALLBACK CDialogAbout::DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPAR
c_Dialog->m_TabLog->Resize(w - 48, h - 100);
c_Dialog->m_TabMeasures->Resize(w - 48, h - 100);
c_Dialog->m_TabPlugins->Resize(w - 48, h - 100);
c_Dialog->m_TabVersion->Resize(w - 48, h - 100);
}
}
return TRUE;
@ -220,16 +219,14 @@ INT_PTR CDialogAbout::OnInitDialog(WPARAM wParam, LPARAM lParam)
TabCtrl_InsertItem(item, 1, &tci);
tci.pszText = L"Plugins";
TabCtrl_InsertItem(item, 2, &tci);
item = GetDlgItem(m_Window, IDC_ABOUT_VERSION_TEXT);
WCHAR tmpSz[128];
_snwprintf_s(tmpSz, _TRUNCATE, L"%s %s%s r%i %s (%s)", APPNAME, APPVERSION, revision_beta ? L" beta" : L"", revision_number, APPBITS, APPDATE);
SetWindowText(item, tmpSz);
tci.pszText = L"Version";
TabCtrl_InsertItem(item, 3, &tci);
HINSTANCE instance = Rainmeter->GetInstance();
m_TabLog = new CTabLog(CreateDialog(instance, MAKEINTRESOURCE(IDD_ABOUTLOG_DIALOG), m_Window, CDialogAbout::CTabLog::DlgProc));
m_TabMeasures = new CTabMeasures(CreateDialog(instance, MAKEINTRESOURCE(IDD_ABOUTMEASURES_DIALOG), m_Window, CDialogAbout::CTabMeasures::DlgProc));
m_TabPlugins = new CTabPlugins(CreateDialog(instance, MAKEINTRESOURCE(IDD_ABOUTPLUGINS_DIALOG), m_Window, CDialogAbout::CTabPlugins::DlgProc));
m_TabLog = new CTabLog(CreateDialog(instance, MAKEINTRESOURCE(IDD_ABOUTLOG_DIALOG), m_Window, CTabLog::DlgProc));
m_TabMeasures = new CTabMeasures(CreateDialog(instance, MAKEINTRESOURCE(IDD_ABOUTMEASURES_DIALOG), m_Window, CTabMeasures::DlgProc));
m_TabPlugins = new CTabPlugins(CreateDialog(instance, MAKEINTRESOURCE(IDD_ABOUTPLUGINS_DIALOG), m_Window, CTabPlugins::DlgProc));
m_TabVersion = new CTabVersion(CreateDialog(instance, MAKEINTRESOURCE(IDD_ABOUTVERSION_DIALOG), m_Window, CTabVersion::DlgProc));
if (CSystem::GetOSPlatform() >= OSPLATFORM_VISTA)
{
@ -273,10 +270,14 @@ INT_PTR CDialogAbout::OnNotify(WPARAM wParam, LPARAM lParam)
{
tab = m_TabMeasures;
}
else // if (sel == 2)
else if (sel == 2)
{
tab = m_TabPlugins;
}
else // if (sel == 3)
{
tab = m_TabVersion;
}
if (tab)
{
@ -916,8 +917,6 @@ void CDialogAbout::CTabPlugins::Initialize()
while (FindNextFile(hSearch, &fileData));
FindClose(hSearch);
LSLog(LOG_ERROR, L"Rainmeter", L"here end");
}
/*
@ -960,3 +959,122 @@ INT_PTR CALLBACK CDialogAbout::CTabPlugins::DlgProc(HWND hWnd, UINT uMsg, WPARAM
return FALSE;
}
// -----------------------------------------------------------------------------------------------
//
// Version tab
//
// -----------------------------------------------------------------------------------------------
/*
** CTabVersion
**
** Constructor.
**
*/
CDialogAbout::CTabVersion::CTabVersion(HWND wnd) : CTab(wnd)
{
}
/*
** Initialize
**
** Called when tab is displayed.
**
*/
void CDialogAbout::CTabVersion::Initialize()
{
m_Initialized = true;
HWND item = GetDlgItem(m_Window, IDC_ABOUTVERSION_VERSION_TEXT);
WCHAR tmpSz[128];
_snwprintf_s(tmpSz, _TRUNCATE, L"%s %s%s r%i %s (%s)", APPNAME, APPVERSION, revision_beta ? L" beta" : L"", revision_number, APPBITS, APPDATE);
SetWindowText(item, tmpSz);
item = GetDlgItem(m_Window, IDC_ABOUTVERSION_PATHS_TEXT);
std::wstring text = L"Path: " + Rainmeter->GetPath();
text += L"\r\nSettings: ";
text += Rainmeter->GetSettingsPath();
text += L"\r\nSkins: ";
text += Rainmeter->GetSkinPath();
SetWindowText(item, text.c_str());
}
/*
** Resize
**
** Resizes window and repositions controls.
**
*/
void CDialogAbout::CTabVersion::Resize(int w, int h)
{
SetWindowPos(m_Window, NULL, 0, 0, w, h, SWP_NOMOVE | SWP_NOZORDER);
}
/*
** DlgProc
**
** Dialog procedure for the Version tab.
**
*/
INT_PTR CALLBACK CDialogAbout::CTabVersion::DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_COMMAND:
return c_Dialog->m_TabVersion->OnCommand(wParam, lParam);
case WM_NOTIFY:
return c_Dialog->m_TabVersion->OnNotify(wParam, lParam);
case WM_CTLCOLORDLG:
return OnColorDialog(wParam, lParam);
case WM_CTLCOLORBTN:
case WM_CTLCOLORSTATIC:
return OnColorStatic(wParam, lParam);
}
return FALSE;
}
INT_PTR CDialogAbout::CTabVersion::OnCommand(WPARAM wParam, LPARAM lParam)
{
switch (LOWORD(wParam))
{
case IDC_ABOUTVERSION_COPY_BUTTON:
{
WCHAR tmpSz[128];
_snwprintf_s(tmpSz, _TRUNCATE, L"%s %s%s r%i %s (%s)", APPNAME, APPVERSION, revision_beta ? L" beta" : L"", revision_number, APPBITS, APPDATE);
std::wstring text = tmpSz;
text += L"\r\nPath: " + Rainmeter->GetPath();
text += L"\r\nSettings: ";
text += Rainmeter->GetSettingsPath();
text += L"\r\nSkins: ";
text += Rainmeter->GetSkinPath();
CSystem::SetClipboardText(text);
}
break;
default:
return FALSE;
}
return TRUE;
}
INT_PTR CDialogAbout::CTabVersion::OnNotify(WPARAM wParam, LPARAM lParam)
{
LPNMHDR nm = (LPNMHDR)lParam;
switch (nm->code)
{
case NM_CLICK:
LSExecute(NULL, ((PNMLINK)lParam)->item.szUrl, SW_SHOWNORMAL);
break;
default:
return FALSE;
}
return TRUE;
}

View File

@ -97,9 +97,24 @@ private:
typedef UINT (*GETPLUGINVERSION)();
};
// Version tab
class CTabVersion : public CTab
{
public:
CTabVersion(HWND window);
virtual void Initialize();
virtual void Resize(int w, int h);
static INT_PTR CALLBACK DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
INT_PTR OnNotify(WPARAM wParam, LPARAM lParam);
INT_PTR OnCommand(WPARAM wParam, LPARAM lParam);
};
CTabLog* m_TabLog;
CTabMeasures* m_TabMeasures;
CTabPlugins* m_TabPlugins;
CTabVersion* m_TabVersion;
};
#endif

View File

@ -375,13 +375,7 @@ void CDialogManage::CTabSkins::Initialize()
// Apply icons and populate tree
item = GetDlgItem(m_Window, IDC_MANAGESKINS_SKINS_TREEVIEW);
TreeView_SetImageList(item, hImageList, TVSIL_NORMAL);
TV_INSERTSTRUCT tvi = {0};
tvi.hParent = NULL;
tvi.hInsertAfter = TVI_LAST;
tvi.item.mask= TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
tvi.item.iImage = tvi.item.iSelectedImage= 0;
PopulateTree(item, tvi, Rainmeter->m_ConfigMenu);
UpdateSkins(NULL);
// Get rid of the EDITTEXT control border
item = GetDlgItem(m_Window, IDC_MANAGESKINS_DESCRIPTION_TEXT);
@ -430,30 +424,46 @@ void CDialogManage::CTabSkins::Initialize()
*/
void CDialogManage::CTabSkins::Update(CMeterWindow* meterWindow, bool deleted)
{
if (m_IgnoreUpdate)
if (meterWindow)
{
// Changed setting from dialog, no need to update
m_IgnoreUpdate = false;
}
else if (m_SkinWindow && m_SkinWindow == meterWindow)
{
// Update from currently open skin
m_HandleCommands = false;
if (deleted)
if (m_IgnoreUpdate)
{
DisableControls();
m_SkinWindow = NULL;
// Changed setting from dialog, no need to update
m_IgnoreUpdate = false;
}
else
else if (m_SkinWindow && m_SkinWindow == meterWindow)
{
SetControls();
// Update from currently open skin
m_HandleCommands = false;
if (deleted)
{
DisableControls();
m_SkinWindow = NULL;
}
else
{
SetControls();
}
m_HandleCommands = true;
}
else if (wcscmp(meterWindow->GetSkinName().c_str(), m_SkinName.c_str()) == 0 &&
wcscmp(meterWindow->GetSkinIniFile().c_str(), m_FileName.c_str()) == 0)
{
ReadSkin();
}
m_HandleCommands = true;
}
else if (wcscmp(meterWindow->GetSkinName().c_str(), m_SkinName.c_str()) == 0 &&
wcscmp(meterWindow->GetSkinIniFile().c_str(), m_FileName.c_str()) == 0)
else
{
ReadSkin();
// Populate tree
HWND item = GetDlgItem(m_Window, IDC_MANAGESKINS_SKINS_TREEVIEW);
TreeView_DeleteAllItems(item);
TV_INSERTSTRUCT tvi = {0};
tvi.hParent = NULL;
tvi.hInsertAfter = TVI_LAST;
tvi.item.mask= TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
tvi.item.iImage = tvi.item.iSelectedImage= 0;
PopulateTree(item, tvi, Rainmeter->m_ConfigMenu);
}
}
@ -740,7 +750,6 @@ void CDialogManage::CTabSkins::PopulateTree(HWND tree, TV_INSERTSTRUCT& tvi, con
else
{
tvi.item.iImage = tvi.item.iSelectedImage = 1;
//MessageBox(NULL, configMenuData[i].name.c_str(), NULL, MB_TOPMOST | MB_OK);
tvi.item.pszText = const_cast<WCHAR*>(configMenuData[i].name.c_str());
SendMessage(tree, TVM_INSERTITEM, 0, (LPARAM)&tvi);
}
@ -1611,8 +1620,8 @@ INT_PTR CDialogManage::CTabThemes::OnCommand(WPARAM wParam, LPARAM lParam)
case IDC_MANAGETHEMES_BACKUP_BUTTON:
{
std::wstring command = Rainmeter->GetAddonPath();
command += L"RainBackup\\RainBackup.exe";
std::wstring command = L"\"" + Rainmeter->GetAddonPath();
command += L"RainBackup\\RainBackup.exe\"";
LSExecute(NULL, command.c_str(), SW_SHOWNORMAL);
}
break;
@ -1658,10 +1667,6 @@ void CDialogManage::CTabSettings::Initialize()
BOOL isLogFile = (_waccess(Rainmeter->GetLogFile().c_str(), 0) != -1);
EnableWindow(GetDlgItem(m_Window, IDC_MANAGESETTINGS_SHOWLOGFILE_BUTTON), isLogFile);
EnableWindow(GetDlgItem(m_Window, IDC_MANAGESETTINGS_DELETELOGFILE_BUTTON), isLogFile);
WCHAR tmpSz[128];
_snwprintf_s(tmpSz, _TRUNCATE, L"%s %s%s r%i %s (%s).", APPNAME, APPVERSION, revision_beta ? L" beta" : L"", revision_number, APPBITS, APPDATE);
SetWindowText(GetDlgItem(m_Window, IDC_MANAGESETTINGS_VERSION_LABEL), tmpSz);
}
/*
@ -1677,9 +1682,6 @@ INT_PTR CALLBACK CDialogManage::CTabSettings::DlgProc(HWND hWnd, UINT uMsg, WPAR
case WM_COMMAND:
return c_Dialog->m_TabSettings->OnCommand(wParam, lParam);
case WM_NOTIFY:
return c_Dialog->m_TabSettings->OnNotify(wParam, lParam);
case WM_CTLCOLORDLG:
return OnColorDialog(wParam, lParam);
@ -1751,19 +1753,3 @@ INT_PTR CDialogManage::CTabSettings::OnCommand(WPARAM wParam, LPARAM lParam)
return TRUE;
}
INT_PTR CDialogManage::CTabSettings::OnNotify(WPARAM wParam, LPARAM lParam)
{
LPNMHDR nm = (LPNMHDR)lParam;
switch (nm->code)
{
case NM_CLICK:
LSExecute(NULL, ((PNMLINK)lParam)->item.szUrl, SW_SHOWNORMAL);
break;
default:
return FALSE;
}
return TRUE;
}

View File

@ -102,7 +102,6 @@ private:
virtual void Initialize();
static INT_PTR CALLBACK DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
INT_PTR OnNotify(WPARAM wParam, LPARAM lParam);
INT_PTR OnCommand(WPARAM wParam, LPARAM lParam);
};

View File

@ -201,7 +201,6 @@ CAPTION "About Rainmeter"
FONT 8, "MS Shell Dlg 2", 0, 0, 0x0
BEGIN
CONTROL "", IDC_ABOUT_TAB, "SysTabControl32", TCS_TABS | TCS_FIXEDWIDTH, 6, 6, 388, 181
LTEXT "", IDC_ABOUT_VERSION_TEXT, 5, 194, 200, 9
DEFPUSHBUTTON "Close", IDCLOSE, 344, 191, 50, 14
END
@ -231,6 +230,18 @@ BEGIN
CONTROL "", IDC_ABOUTPLUGINS_ITEMS_LISTVIEW, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP, 0, 0, 368, 148
END
IDD_ABOUTVERSION_DIALOG DIALOGEX 15, 30, 370, 148
STYLE DS_CONTROL | WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS
FONT 8, "MS Shell Dlg 2", 0, 0, 0x0
BEGIN
CONTROL IDI_WINDOW, IDC_ABOUTVERSION_LOGO_BITMAP, STATIC, SS_ICON | WS_CHILD | WS_VISIBLE, 0, 8, 24, 24
LTEXT "", IDC_ABOUTVERSION_VERSION_TEXT, 28, 0, 300, 9
CONTROL "Get the latest version at <a href=""http://rainmeter.net"">rainmeter.net</a>.", IDC_STATIC, "SysLink", 0x0, 28, 13, 300, 9
CONTROL "Rainmeter is an open source project distributed under the <a href=""http://www.gnu.org/licenses"">GNU GPL v2</a> license.", IDC_STATIC, "SysLink", 0x0, 28, 26, 300, 9
LTEXT "", IDC_ABOUTVERSION_PATHS_TEXT, 0, 43, 300, 34
PUSHBUTTON "Copy to clipboard", IDC_ABOUTVERSION_COPY_BUTTON, 0, 81, 80, 14, WS_TABSTOP
END
IDD_MANAGE_DIALOG DIALOGEX 0, 0, 500, 322
STYLE DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_APPWINDOW | WS_EX_CONTROLPARENT
@ -292,7 +303,7 @@ STYLE DS_CONTROL | WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS
FONT 8, "MS Shell Dlg 2", 0, 0, 0x0
BEGIN
GROUPBOX "Save new theme", IDC_STATIC, 0, 0, 230, 150
LTEXT "A theme allows you to save the current layout of your Rainmeter skins and restore it at a later time. Themes remember your skins' positions and settings, but restoring an old theme will not undo edits or updates to your skins.", IDC_STATIC, 6, 16, 205, 44
LTEXT "A theme allows you to save the current layout of your Rainmeter skins and restore it at a later time. Restoring an old theme will restore the layout, but will not not undo edits or updates to your skins.", IDC_STATIC, 6, 16, 205, 44
AUTOCHECKBOX "Save as empty theme", IDC_MANAGETHEMES_EMPTYTHEME_CHECKBOX, 6, 70, 120, 9, WS_TABSTOP
AUTOCHECKBOX "Exclude unused skins", IDC_MANAGETHEMES_UNUSEDSKINS_CHECKBOX, 6, 83, 120, 9, WS_TABSTOP
AUTOCHECKBOX "Include current wallpaper", IDC_MANAGETHEMES_WALLPAPER_CHECKBOX, 6, 96, 120, 9, WS_TABSTOP
@ -326,10 +337,6 @@ BEGIN
AUTOCHECKBOX "Verbose logging (debug mode)", IDC_MANAGESETTINGS_VERBOSELOGGING_CHECKBOX, 6, 104, 140, 9
PUSHBUTTON "Show log file", IDC_MANAGESETTINGS_SHOWLOGFILE_BUTTON, 6, 122, 70, 14
PUSHBUTTON "Delete log file", IDC_MANAGESETTINGS_DELETELOGFILE_BUTTON, 80, 122, 70, 14
LTEXT "Rainmeter 2.1.0 beta r886 (64-bit). Built on Aug 1 2011.\r\n", IDC_MANAGESETTINGS_VERSION_LABEL, 0, 225, 300, 27
CONTROL "Get the latest version at <a href=""http://rainmeter.net"">rainmeter.net</a>.", IDC_STATIC, "SysLink", 0x0, 0, 238, 300, 9
CONTROL "Rainmeter is an open source project distributed under the <a href=""http://www.gnu.org/licenses"">GNU GPL v2</a> license.", IDC_STATIC, "SysLink", 0x0, 0, 251, 300, 9
END
/////////////////////////////////////////////////////////////////////////////

View File

@ -2177,9 +2177,6 @@ void CRainmeter::CreateDefaultConfigFile(const std::wstring& strFile)
void CRainmeter::ReloadSettings()
{
// TODO FIXME
// UpdateDialog();
ScanForConfigs(m_SkinPath);
ScanForThemes(GetSettingsPath() + L"Themes");
ReadGeneralSettings(m_IniFile);
@ -3528,6 +3525,8 @@ void CRainmeter::RefreshAll()
}
}
}
CDialogManage::UpdateSkins(NULL);
}
/*

View File

@ -12,7 +12,7 @@
#define IDD_ABOUTLOG_DIALOG 106
#define IDD_ABOUTMEASURES_DIALOG 107
#define IDD_ABOUTPLUGINS_DIALOG 108
//#define IDD_ABOUTINFO_DIALOG 109
#define IDD_ABOUTVERSION_DIALOG 109
#define IDD_MANAGE_DIALOG 110
#define IDD_MANAGESKINS_DIALOG 111
#define IDD_MANAGETHEMES_DIALOG 112
@ -28,6 +28,10 @@
#define IDC_ABOUTMEASURES_ITEMS_LISTBOX 1007
#define IDC_ABOUTMEASURES_ITEMS_LISTVIEW 1008
#define IDC_ABOUTPLUGINS_ITEMS_LISTVIEW 1009
#define IDC_ABOUTVERSION_LOGO_BITMAP 1010
#define IDC_ABOUTVERSION_VERSION_TEXT 1011
#define IDC_ABOUTVERSION_PATHS_TEXT 1012
#define IDC_ABOUTVERSION_COPY_BUTTON 1013
#define IDC_MANAGE_TAB 1017
#define IDC_REFRESHALL_BUTTON 1018
@ -74,7 +78,6 @@
#define IDC_MANAGESETTINGS_VERBOSELOGGING_CHECKBOX 1056
#define IDC_MANAGESETTINGS_SHOWLOGFILE_BUTTON 1057
#define IDC_MANAGESETTINGS_DELETELOGFILE_BUTTON 1058
#define IDC_MANAGESETTINGS_VERSION_LABEL 1059
#define ID_CONTEXT_REFRESH 4001
#define ID_CONTEXT_QUIT 4002