From 211e1d657f72241397c78704ed8d63b90f350848 Mon Sep 17 00:00:00 2001 From: Birunthan Mohanathas Date: Tue, 13 Nov 2012 16:11:43 +0200 Subject: [PATCH] Tweaks and fixes --- Library/DialogManage.cpp | 13 +++++++------ Library/Rainmeter.cpp | 4 ++-- Library/Rainmeter.h | 4 ++-- Library/TrayWindow.cpp | 21 ++++++--------------- Library/TrayWindow.h | 2 +- 5 files changed, 18 insertions(+), 26 deletions(-) diff --git a/Library/DialogManage.cpp b/Library/DialogManage.cpp index 54dff7ba..d8218553 100644 --- a/Library/DialogManage.cpp +++ b/Library/DialogManage.cpp @@ -270,22 +270,23 @@ INT_PTR CDialogManage::OnCommand(WPARAM wParam, LPARAM lParam) case IDC_MANAGE_HELP_BUTTON: { - std::wstring url = L"http://docs.rainmeter.net/"; + std::wstring url = L"http://docs.rainmeter.net/manual/user-interface/manage#"; HWND hwnd = c_Dialog->GetActiveTabWindow(); if (hwnd == m_TabSkins.GetWindow()) { - url.append(L"manual/user-interface/manage#SkinsTab"); + url += L"Skins"; } else if (hwnd == m_TabLayouts.GetWindow()) { - url.append(L"/manual/user-interface/manage#LayoutsTab"); + url += L"Layouts"; } - else if (hwnd == m_TabSettings.GetWindow()) + else // if (hwnd == m_TabSettings.GetWindow()) { - url.append(L"/manual/user-interface/manage#SettingsTab"); + url += L"Settings"; } - + + url += L"Tab"; ShellExecute(m_Window, L"open", url.c_str(), NULL, NULL, SW_SHOWNORMAL); } break; diff --git a/Library/Rainmeter.cpp b/Library/Rainmeter.cpp index 38ea1e1c..90599b83 100644 --- a/Library/Rainmeter.cpp +++ b/Library/Rainmeter.cpp @@ -1498,12 +1498,12 @@ void CRainmeter::ToggleSkin(int folderIndex, int fileIndex) } } -void CRainmeter::SetSkinPath(std::wstring skinPath) +void CRainmeter::SetSkinPath(const std::wstring& skinPath) { WritePrivateProfileString(L"Rainmeter", L"SkinPath", skinPath.c_str(), m_IniFile.c_str()); } -void CRainmeter::SetSkinEditor(std::wstring editor) +void CRainmeter::SetSkinEditor(const std::wstring& editor) { LPCWSTR tmp = editor.empty() ? NULL : editor.c_str(); if (!tmp) diff --git a/Library/Rainmeter.h b/Library/Rainmeter.h index cb649df0..6dece2d8 100644 --- a/Library/Rainmeter.h +++ b/Library/Rainmeter.h @@ -138,7 +138,7 @@ public: const std::wstring& GetLogFile() { return m_LogFile; } const std::wstring& GetSettingsPath() { return m_SettingsPath; } const std::wstring& GetSkinPath() { return m_SkinPath; } - void SetSkinPath(std::wstring skinPath); + void SetSkinPath(const std::wstring& skinPath); std::wstring GetLayoutPath() { return m_SettingsPath + L"Layouts\\"; } std::wstring GetPluginPath() { return m_Path + L"Plugins\\"; } std::wstring GetUserPluginPath() { return m_SettingsPath + L"Plugins\\"; } @@ -154,7 +154,7 @@ public: const std::wstring& GetDrive() { return m_Drive; } const std::wstring& GetSkinEditor() { return m_SkinEditor; } - void SetSkinEditor(std::wstring editor); + void SetSkinEditor(const std::wstring& editor); const std::wstring& GetStatsDate() { return m_StatsDate; } HWND GetWindow() { return m_Window; } diff --git a/Library/TrayWindow.cpp b/Library/TrayWindow.cpp index 0c23b265..dbaf0988 100644 --- a/Library/TrayWindow.cpp +++ b/Library/TrayWindow.cpp @@ -333,23 +333,14 @@ void CTrayWindow::ShowUpdateNotification(const WCHAR* newVersion) ShowNotification(TRAY_NOTIFICATION_UPDATE, GetString(ID_STR_UPDATEAVAILABLE), text.c_str()); } -void CTrayWindow::SetTrayIcon(bool state) +void CTrayWindow::SetTrayIcon(bool enabled) { - std::wstring iniFile = Rainmeter->GetIniFile(); + enabled ? TryAddTrayIcon() : RemoveTrayIcon(); + m_IconEnabled = enabled; - if (state) - { - // Delete the key from Rainmeter.ini - WritePrivateProfileString(L"Rainmeter", L"TrayIcon", NULL, iniFile.c_str()); - } - else - { - WritePrivateProfileString(L"Rainmeter", L"TrayIcon", L"0", iniFile.c_str()); - } - - CConfigParser parser; - parser.Initialize(iniFile, NULL, NULL); - ReadOptions(parser); + // Save to Rainmeter.ini. + const std::wstring& iniFile = Rainmeter->GetIniFile(); + WritePrivateProfileString(L"Rainmeter", L"TrayIcon", enabled ? NULL : L"0", iniFile.c_str()); } void CTrayWindow::ReadOptions(CConfigParser& parser) diff --git a/Library/TrayWindow.h b/Library/TrayWindow.h index febbfc05..f5c35ed7 100644 --- a/Library/TrayWindow.h +++ b/Library/TrayWindow.h @@ -47,7 +47,7 @@ public: void ReadOptions(CConfigParser& parser); HWND GetWindow() { return m_Window; } bool IsTrayIconEnabled() { return m_IconEnabled; } - void SetTrayIcon(bool state); + void SetTrayIcon(bool enabled); void ShowWelcomeNotification(); void ShowUpdateNotification(const WCHAR* newVersion);