From 8785516c09ec9716e9b61a325583fde97d7fa809 Mon Sep 17 00:00:00 2001 From: jsmorley Date: Mon, 21 Jun 2010 16:00:19 +0000 Subject: [PATCH] 1) JamesAC / spx change to Windows Messages / Dexpot support, with fix for copy / paste error in previous commit. 2) Change to version checking: * CheckVersion= setting depreciated. Removed from "About" dialog and automatically ignored and removed from Rainmeter.ini at Rainmeter start. * New DisableVersionCheck= (1/0) setting added, which now changes the default from "don't check version" to "do check version" unless this is set to "1" --- Application/Application.rc | 8 ++++---- Library/AboutDialog.cpp | 12 ++++++------ Library/Library.rc | 2 +- Library/Rainmeter.cpp | 26 +++++++++++++++++++------- Library/Rainmeter.h | 16 ++++++++++------ Library/TrayWindow.cpp | 10 +++++++--- Library/UpdateCheck.cpp | 13 +++++++------ Library/resource.h | 3 ++- revision-number.h | 2 +- 9 files changed, 57 insertions(+), 35 deletions(-) diff --git a/Application/Application.rc b/Application/Application.rc index 98f95698..695dac69 100644 --- a/Application/Application.rc +++ b/Application/Application.rc @@ -28,8 +28,8 @@ LANGUAGE LANG_FINNISH, SUBLANG_DEFAULT // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,3,0,440 - PRODUCTVERSION 1,3,0,440 + FILEVERSION 1,3,0,443 + PRODUCTVERSION 1,3,0,443 FILEFLAGSMASK 0x17L #ifdef _DEBUG FILEFLAGS 0x1L @@ -45,12 +45,12 @@ BEGIN BLOCK "040b04b0" BEGIN VALUE "FileDescription", "Rainmeter - A Customizable Resource Meter" - VALUE "FileVersion", "1, 3, 0, 440" + VALUE "FileVersion", "1, 3, 0, 442" VALUE "InternalName", "Rainmeter" VALUE "LegalCopyright", "Copyright (C) 2010 - Rainy" VALUE "OriginalFilename", "Rainmeter.exe" VALUE "ProductName", "Rainmeter" - VALUE "ProductVersion", "1, 3, 0, 440" + VALUE "ProductVersion", "1, 3, 0, 442" END END BLOCK "VarFileInfo" diff --git a/Library/AboutDialog.cpp b/Library/AboutDialog.cpp index eaa1dff5..eadc209a 100644 --- a/Library/AboutDialog.cpp +++ b/Library/AboutDialog.cpp @@ -273,7 +273,7 @@ void RepositionControls(HWND hwndDlg) widget = GetDlgItem(hwndDlg, IDC_URL_STRING); SetWindowPos(widget, NULL, 0, 0, r.right - 44, sr.bottom, SWP_NOMOVE | SWP_NOZORDER); - widget = GetDlgItem(hwndDlg, IDC_CHECK_FOR_UPDATE); + widget = GetDlgItem(hwndDlg, IDC_DISABLE_VERSION_CHECK); GetClientRect(widget, &wr); MapWindowPoints(widget, hwndDlg, (LPPOINT)&wr, 2); SetWindowPos(widget, NULL, (r.right - (wr.right - wr.left)) / 2, wr.top, 0, 0, SWP_NOSIZE | SWP_NOZORDER); @@ -337,7 +337,7 @@ BOOL OnInitAboutDialog(HWND window) lvc.pszText = L"Range"; ListView_InsertColumn(widget, 2, &lvc); - CheckDlgButton(window, IDC_CHECK_FOR_UPDATE, Rainmeter->GetCheckUpdate() ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(window, IDC_DISABLE_VERSION_CHECK, Rainmeter->GetDisableVersionCheck() ? BST_CHECKED : BST_UNCHECKED); ScanPlugins(); UpdateWidgets(window); @@ -388,14 +388,14 @@ INT_PTR CALLBACK AboutProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lPa case WM_COMMAND: switch (LOWORD(wParam)) { - case IDC_CHECK_FOR_UPDATE: - if (IsDlgButtonChecked(hwndDlg, IDC_CHECK_FOR_UPDATE)) + case IDC_DISABLE_VERSION_CHECK: + if (IsDlgButtonChecked(hwndDlg, IDC_DISABLE_VERSION_CHECK)) { - Rainmeter->SetCheckUpdate(TRUE); + Rainmeter->SetDisableVersionCheck(TRUE); } else { - Rainmeter->SetCheckUpdate(FALSE); + Rainmeter->SetDisableVersionCheck(FALSE); } break; diff --git a/Library/Library.rc b/Library/Library.rc index 0e5da218..995f764b 100644 --- a/Library/Library.rc +++ b/Library/Library.rc @@ -167,7 +167,7 @@ BEGIN GROUPBOX "About",IDC_STATIC_ABOUT,7,7,220,69 CTEXT "(build on ??? ?? ????)",IDC_BUILD_STRING,19,30,201,8 DEFPUSHBUTTON "OK",IDOK,91,204,50,14 - CONTROL "Check for update on startup",IDC_CHECK_FOR_UPDATE, + CONTROL "Disable check for updates",IDC_DISABLE_VERSION_CHECK, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,67,56,104,10 END diff --git a/Library/Rainmeter.cpp b/Library/Rainmeter.cpp index 5899bb4c..2be91791 100644 --- a/Library/Rainmeter.cpp +++ b/Library/Rainmeter.cpp @@ -680,7 +680,8 @@ CRainmeter::CRainmeter() m_DesktopWorkAreaChanged = false; m_DesktopWorkArea.left = m_DesktopWorkArea.top = m_DesktopWorkArea.right = m_DesktopWorkArea.bottom = 0; - m_CheckUpdate = FALSE; + m_DisableVersionCheck = FALSE; + m_NewVersion = FALSE; m_Instance = NULL; m_CurrentParser = NULL; @@ -959,7 +960,9 @@ int CRainmeter::Initialize(HWND Parent, HINSTANCE Instance, LPCSTR szPath) ReadGeneralSettings(m_IniFile); - if (m_CheckUpdate) + WritePrivateProfileString(L"Rainmeter", L"CheckUpdate", NULL , m_IniFile.c_str()); + + if (!m_DisableVersionCheck) { CheckUpdate(); } @@ -1664,7 +1667,8 @@ void CRainmeter::ScanForThemes(std::wstring& path) void CRainmeter::SaveSettings() { // Just one setting for writing at the moment - WritePrivateProfileString(L"Rainmeter", L"CheckUpdate", m_CheckUpdate ? L"1" : L"0" , m_IniFile.c_str()); + WritePrivateProfileString(L"Rainmeter", L"CheckUpdate", NULL , m_IniFile.c_str()); + WritePrivateProfileString(L"Rainmeter", L"DisableVersionCheck", m_DisableVersionCheck ? L"1" : L"0" , m_IniFile.c_str()); } BOOL CRainmeter::ExecuteBang(const std::wstring& bang, const std::wstring& arg, CMeterWindow* meterWindow) @@ -1996,8 +2000,8 @@ void CRainmeter::ReadGeneralSettings(std::wstring& iniFile) m_TrayExecuteDR = parser.ReadString(L"Rainmeter", L"TrayExecuteDR", L"", false); m_TrayExecuteDM = parser.ReadString(L"Rainmeter", L"TrayExecuteDM", L"", false); - m_CheckUpdate = parser.ReadInt(L"Rainmeter", L"CheckUpdate", 0); - + m_DisableVersionCheck = parser.ReadInt(L"Rainmeter", L"DisableVersionCheck", 0); + std::wstring area = parser.ReadString(L"Rainmeter", L"DesktopWorkArea", L""); if (!area.empty()) { @@ -2239,7 +2243,7 @@ void CRainmeter::ShowContextMenu(POINT pos, CMeterWindow* meterWindow) if(subMenu) { if (!GetDummyLitestep()) - { + { // Disable Quit if ran as a Litestep plugin EnableMenuItem(subMenu, ID_CONTEXT_QUIT, MF_BYCOMMAND | MF_GRAYED); EnableMenuItem(subMenu, ID_CONTEXT_SHOWLOGFILE, MF_BYCOMMAND | MF_GRAYED); @@ -2269,6 +2273,14 @@ void CRainmeter::ShowContextMenu(POINT pos, CMeterWindow* meterWindow) } else { + UINT configPos = 10; + //Put Update notifications in the Tray menu + if (m_NewVersion) + { + configPos += 1; + InsertMenu(subMenu, 2, MF_BYPOSITION | MF_ENABLED, ID_CONTEXT_NEW_VERSION, L"Update Available"); + } + // Create a menu for all active configs std::map::const_iterator iter = Rainmeter->GetAllMeterWindows().begin(); @@ -2277,7 +2289,7 @@ void CRainmeter::ShowContextMenu(POINT pos, CMeterWindow* meterWindow) { CMeterWindow* mw = ((*iter).second); HMENU skinMenu = CreateSkinMenu(mw, index); - InsertMenu(subMenu, 10, MF_BYPOSITION | MF_POPUP, (UINT_PTR)skinMenu, mw->GetSkinName().c_str()); + InsertMenu(subMenu, configPos, MF_BYPOSITION | MF_POPUP, (UINT_PTR)skinMenu, mw->GetSkinName().c_str()); ++index; } } diff --git a/Library/Rainmeter.h b/Library/Rainmeter.h index 4a603962..c12332f4 100644 --- a/Library/Rainmeter.h +++ b/Library/Rainmeter.h @@ -32,13 +32,13 @@ #define MAKE_VER(major, minor1, minor2) major * 1000000 + minor1 * 1000 + minor2 #define APPNAME L"Rainmeter" -#define APPVERSION L"1.3" +#define APPVERSION L"1.2" #ifdef _WIN64 #define APPBITS L"(64-bit)" #else #define APPBITS L"(32-bit)" #endif -#define RAINMETER_VERSION MAKE_VER(1, 3, 0) +#define RAINMETER_VERSION MAKE_VER(1, 2, 0) //newvercheck enum PLATFORM { @@ -156,8 +156,11 @@ public: void WriteStats(bool bForce); void ResetStats(); - BOOL GetCheckUpdate() { return m_CheckUpdate; }; - void SetCheckUpdate(BOOL check) { m_CheckUpdate = check; }; + BOOL GetDisableVersionCheck() { return m_DisableVersionCheck; }; + BOOL GetNewVersion() { return m_NewVersion; }; + void SetDisableVersionCheck(BOOL check) { m_DisableVersionCheck = check; }; + void SetNewVersion(BOOL NewVer) { m_NewVersion = NewVer; }; + void ShowContextMenu(POINT pos, CMeterWindow* meterWindow); @@ -224,8 +227,9 @@ private: std::wstring m_TrayExecuteDR; std::wstring m_TrayExecuteDM; - BOOL m_CheckUpdate; - + BOOL m_DisableVersionCheck; + BOOL m_NewVersion; + BOOL m_DesktopWorkAreaChanged; RECT m_DesktopWorkArea; diff --git a/Library/TrayWindow.cpp b/Library/TrayWindow.cpp index 80ad9407..31f3bd98 100644 --- a/Library/TrayWindow.cpp +++ b/Library/TrayWindow.cpp @@ -467,6 +467,10 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA command += L"\\Addons\\RainThemes\\RainThemes.exe\""; LSExecute(tray->GetWindow(), command.c_str(), SW_SHOWNORMAL); } + else if(wParam == ID_CONTEXT_NEW_VERSION) //newvercheck + { + LSExecute(NULL, L"http://rainmeter.net/RainCMS/", SW_SHOWNORMAL); + } else if(wParam == ID_CONTEXT_MANAGESKINS) { std::wstring command = L"\"" + Rainmeter->GetPath(); @@ -639,7 +643,7 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA COPYDATASTRUCT cds; - cds.dwData = RAINMETER_QUERY_ID_SKINS_PATH; + cds.dwData = RAINMETER_QUERY_ID_SETTINGS_PATH; cds.cbData = (path.size() + 1) * 2; cds.lpData = (LPVOID) path.c_str(); @@ -653,7 +657,7 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA COPYDATASTRUCT cds; - cds.dwData = RAINMETER_QUERY_ID_SKINS_PATH; + cds.dwData = RAINMETER_QUERY_ID_PLUGINS_PATH; cds.cbData = (path.size() + 1) * 2; cds.lpData = (LPVOID) path.c_str(); @@ -663,7 +667,7 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA } } return 1; - + case WM_TIMER: if (tray && tray->m_Measure) { diff --git a/Library/UpdateCheck.cpp b/Library/UpdateCheck.cpp index e880b79e..eac38a15 100644 --- a/Library/UpdateCheck.cpp +++ b/Library/UpdateCheck.cpp @@ -24,9 +24,11 @@ #include #include +extern CRainmeter* Rainmeter; + void CheckVersion(void* dummy) { - int version = 0; + double version = 0.0; HINTERNET hRootHandle = InternetOpen(L"Rainmeter", INTERNET_OPEN_TYPE_PRECONFIG, @@ -63,22 +65,21 @@ void CheckVersion(void* dummy) version += atoi(verMinor1.c_str()) * 1000; version += atoi(verMinor2.c_str()); + } else { version += atoi(verMinor.c_str()) * 1000; } } - + if (version > RAINMETER_VERSION) { - if (IDYES == MessageBox(NULL, L"A new version of Rainmeter is available.\nDo you want to open the web page now?", APPNAME, MB_YESNO | MB_ICONQUESTION)) - { - LSExecute(NULL, L"http://code.google.com/p/rainmeter/", SW_SHOWNORMAL); - } + Rainmeter->SetNewVersion(TRUE); } else { + Rainmeter->SetNewVersion(FALSE); DebugLog(L"CheckUpdate: No new version available."); } } diff --git a/Library/resource.h b/Library/resource.h index ff14258f..6f4dbfbe 100644 --- a/Library/resource.h +++ b/Library/resource.h @@ -14,7 +14,7 @@ #define IDC_URL_STRING 1005 #define IDC_CONFIG_TAB 1006 #define IDC_AUTHOR_STRING 1007 -#define IDC_CHECK_FOR_UPDATE 1009 +#define IDC_DISABLE_VERSION_CHECK 1008 #define ID_CONTEXT_REFRESH 4001 #define ID_CONTEXT_QUIT 4002 #define ID_CONTEXT_ABOUT 4004 @@ -58,6 +58,7 @@ #define ID_CONTEXT_MANAGESKINS 4047 #define ID_CONTEXT_SKINMENU_MONITOR_PRIMARY 4048 #define ID_CONTEXT_SKINMENU_MONITOR_AUTOSELECT 4049 +#define ID_CONTEXT_NEW_VERSION 4050 //newvercheck #define WM_QUERY_RAINMETER WM_APP + 1000 diff --git a/revision-number.h b/revision-number.h index b896d577..f097b134 100644 --- a/revision-number.h +++ b/revision-number.h @@ -1,2 +1,2 @@ #pragma once -const int revision_number = 440; \ No newline at end of file +const int revision_number = 443; \ No newline at end of file