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"
This commit is contained in:
jsmorley 2010-06-21 16:00:19 +00:00
parent b7ef7417b6
commit 8785516c09
9 changed files with 57 additions and 35 deletions

View File

@ -28,8 +28,8 @@ LANGUAGE LANG_FINNISH, SUBLANG_DEFAULT
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,3,0,440 FILEVERSION 1,3,0,443
PRODUCTVERSION 1,3,0,440 PRODUCTVERSION 1,3,0,443
FILEFLAGSMASK 0x17L FILEFLAGSMASK 0x17L
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -45,12 +45,12 @@ BEGIN
BLOCK "040b04b0" BLOCK "040b04b0"
BEGIN BEGIN
VALUE "FileDescription", "Rainmeter - A Customizable Resource Meter" VALUE "FileDescription", "Rainmeter - A Customizable Resource Meter"
VALUE "FileVersion", "1, 3, 0, 440" VALUE "FileVersion", "1, 3, 0, 442"
VALUE "InternalName", "Rainmeter" VALUE "InternalName", "Rainmeter"
VALUE "LegalCopyright", "Copyright (C) 2010 - Rainy" VALUE "LegalCopyright", "Copyright (C) 2010 - Rainy"
VALUE "OriginalFilename", "Rainmeter.exe" VALUE "OriginalFilename", "Rainmeter.exe"
VALUE "ProductName", "Rainmeter" VALUE "ProductName", "Rainmeter"
VALUE "ProductVersion", "1, 3, 0, 440" VALUE "ProductVersion", "1, 3, 0, 442"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

View File

@ -273,7 +273,7 @@ void RepositionControls(HWND hwndDlg)
widget = GetDlgItem(hwndDlg, IDC_URL_STRING); widget = GetDlgItem(hwndDlg, IDC_URL_STRING);
SetWindowPos(widget, NULL, 0, 0, r.right - 44, sr.bottom, SWP_NOMOVE | SWP_NOZORDER); 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); GetClientRect(widget, &wr);
MapWindowPoints(widget, hwndDlg, (LPPOINT)&wr, 2); MapWindowPoints(widget, hwndDlg, (LPPOINT)&wr, 2);
SetWindowPos(widget, NULL, (r.right - (wr.right - wr.left)) / 2, wr.top, 0, 0, SWP_NOSIZE | SWP_NOZORDER); 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"; lvc.pszText = L"Range";
ListView_InsertColumn(widget, 2, &lvc); 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(); ScanPlugins();
UpdateWidgets(window); UpdateWidgets(window);
@ -388,14 +388,14 @@ INT_PTR CALLBACK AboutProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lPa
case WM_COMMAND: case WM_COMMAND:
switch (LOWORD(wParam)) switch (LOWORD(wParam))
{ {
case IDC_CHECK_FOR_UPDATE: case IDC_DISABLE_VERSION_CHECK:
if (IsDlgButtonChecked(hwndDlg, IDC_CHECK_FOR_UPDATE)) if (IsDlgButtonChecked(hwndDlg, IDC_DISABLE_VERSION_CHECK))
{ {
Rainmeter->SetCheckUpdate(TRUE); Rainmeter->SetDisableVersionCheck(TRUE);
} }
else else
{ {
Rainmeter->SetCheckUpdate(FALSE); Rainmeter->SetDisableVersionCheck(FALSE);
} }
break; break;

View File

@ -167,7 +167,7 @@ BEGIN
GROUPBOX "About",IDC_STATIC_ABOUT,7,7,220,69 GROUPBOX "About",IDC_STATIC_ABOUT,7,7,220,69
CTEXT "(build on ??? ?? ????)",IDC_BUILD_STRING,19,30,201,8 CTEXT "(build on ??? ?? ????)",IDC_BUILD_STRING,19,30,201,8
DEFPUSHBUTTON "OK",IDOK,91,204,50,14 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 "Button",BS_AUTOCHECKBOX | WS_TABSTOP,67,56,104,10
END END

View File

@ -680,7 +680,8 @@ CRainmeter::CRainmeter()
m_DesktopWorkAreaChanged = false; m_DesktopWorkAreaChanged = false;
m_DesktopWorkArea.left = m_DesktopWorkArea.top = m_DesktopWorkArea.right = m_DesktopWorkArea.bottom = 0; 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_Instance = NULL;
m_CurrentParser = NULL; m_CurrentParser = NULL;
@ -959,7 +960,9 @@ int CRainmeter::Initialize(HWND Parent, HINSTANCE Instance, LPCSTR szPath)
ReadGeneralSettings(m_IniFile); ReadGeneralSettings(m_IniFile);
if (m_CheckUpdate) WritePrivateProfileString(L"Rainmeter", L"CheckUpdate", NULL , m_IniFile.c_str());
if (!m_DisableVersionCheck)
{ {
CheckUpdate(); CheckUpdate();
} }
@ -1664,7 +1667,8 @@ void CRainmeter::ScanForThemes(std::wstring& path)
void CRainmeter::SaveSettings() void CRainmeter::SaveSettings()
{ {
// Just one setting for writing at the moment // 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) 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_TrayExecuteDR = parser.ReadString(L"Rainmeter", L"TrayExecuteDR", L"", false);
m_TrayExecuteDM = parser.ReadString(L"Rainmeter", L"TrayExecuteDM", 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""); std::wstring area = parser.ReadString(L"Rainmeter", L"DesktopWorkArea", L"");
if (!area.empty()) if (!area.empty())
{ {
@ -2239,7 +2243,7 @@ void CRainmeter::ShowContextMenu(POINT pos, CMeterWindow* meterWindow)
if(subMenu) if(subMenu)
{ {
if (!GetDummyLitestep()) if (!GetDummyLitestep())
{ {
// Disable Quit if ran as a Litestep plugin // Disable Quit if ran as a Litestep plugin
EnableMenuItem(subMenu, ID_CONTEXT_QUIT, MF_BYCOMMAND | MF_GRAYED); EnableMenuItem(subMenu, ID_CONTEXT_QUIT, MF_BYCOMMAND | MF_GRAYED);
EnableMenuItem(subMenu, ID_CONTEXT_SHOWLOGFILE, 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 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 // Create a menu for all active configs
std::map<std::wstring, CMeterWindow*>::const_iterator iter = Rainmeter->GetAllMeterWindows().begin(); std::map<std::wstring, CMeterWindow*>::const_iterator iter = Rainmeter->GetAllMeterWindows().begin();
@ -2277,7 +2289,7 @@ void CRainmeter::ShowContextMenu(POINT pos, CMeterWindow* meterWindow)
{ {
CMeterWindow* mw = ((*iter).second); CMeterWindow* mw = ((*iter).second);
HMENU skinMenu = CreateSkinMenu(mw, index); 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; ++index;
} }
} }

View File

@ -32,13 +32,13 @@
#define MAKE_VER(major, minor1, minor2) major * 1000000 + minor1 * 1000 + minor2 #define MAKE_VER(major, minor1, minor2) major * 1000000 + minor1 * 1000 + minor2
#define APPNAME L"Rainmeter" #define APPNAME L"Rainmeter"
#define APPVERSION L"1.3" #define APPVERSION L"1.2"
#ifdef _WIN64 #ifdef _WIN64
#define APPBITS L"(64-bit)" #define APPBITS L"(64-bit)"
#else #else
#define APPBITS L"(32-bit)" #define APPBITS L"(32-bit)"
#endif #endif
#define RAINMETER_VERSION MAKE_VER(1, 3, 0) #define RAINMETER_VERSION MAKE_VER(1, 2, 0) //newvercheck
enum PLATFORM enum PLATFORM
{ {
@ -156,8 +156,11 @@ public:
void WriteStats(bool bForce); void WriteStats(bool bForce);
void ResetStats(); void ResetStats();
BOOL GetCheckUpdate() { return m_CheckUpdate; }; BOOL GetDisableVersionCheck() { return m_DisableVersionCheck; };
void SetCheckUpdate(BOOL check) { m_CheckUpdate = check; }; 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); void ShowContextMenu(POINT pos, CMeterWindow* meterWindow);
@ -224,8 +227,9 @@ private:
std::wstring m_TrayExecuteDR; std::wstring m_TrayExecuteDR;
std::wstring m_TrayExecuteDM; std::wstring m_TrayExecuteDM;
BOOL m_CheckUpdate; BOOL m_DisableVersionCheck;
BOOL m_NewVersion;
BOOL m_DesktopWorkAreaChanged; BOOL m_DesktopWorkAreaChanged;
RECT m_DesktopWorkArea; RECT m_DesktopWorkArea;

View File

@ -467,6 +467,10 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
command += L"\\Addons\\RainThemes\\RainThemes.exe\""; command += L"\\Addons\\RainThemes\\RainThemes.exe\"";
LSExecute(tray->GetWindow(), command.c_str(), SW_SHOWNORMAL); 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) else if(wParam == ID_CONTEXT_MANAGESKINS)
{ {
std::wstring command = L"\"" + Rainmeter->GetPath(); std::wstring command = L"\"" + Rainmeter->GetPath();
@ -639,7 +643,7 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
COPYDATASTRUCT cds; COPYDATASTRUCT cds;
cds.dwData = RAINMETER_QUERY_ID_SKINS_PATH; cds.dwData = RAINMETER_QUERY_ID_SETTINGS_PATH;
cds.cbData = (path.size() + 1) * 2; cds.cbData = (path.size() + 1) * 2;
cds.lpData = (LPVOID) path.c_str(); cds.lpData = (LPVOID) path.c_str();
@ -653,7 +657,7 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
COPYDATASTRUCT cds; COPYDATASTRUCT cds;
cds.dwData = RAINMETER_QUERY_ID_SKINS_PATH; cds.dwData = RAINMETER_QUERY_ID_PLUGINS_PATH;
cds.cbData = (path.size() + 1) * 2; cds.cbData = (path.size() + 1) * 2;
cds.lpData = (LPVOID) path.c_str(); cds.lpData = (LPVOID) path.c_str();
@ -663,7 +667,7 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
} }
} }
return 1; return 1;
case WM_TIMER: case WM_TIMER:
if (tray && tray->m_Measure) if (tray && tray->m_Measure)
{ {

View File

@ -24,9 +24,11 @@
#include <Wininet.h> #include <Wininet.h>
#include <process.h> #include <process.h>
extern CRainmeter* Rainmeter;
void CheckVersion(void* dummy) void CheckVersion(void* dummy)
{ {
int version = 0; double version = 0.0;
HINTERNET hRootHandle = InternetOpen(L"Rainmeter", HINTERNET hRootHandle = InternetOpen(L"Rainmeter",
INTERNET_OPEN_TYPE_PRECONFIG, INTERNET_OPEN_TYPE_PRECONFIG,
@ -63,22 +65,21 @@ void CheckVersion(void* dummy)
version += atoi(verMinor1.c_str()) * 1000; version += atoi(verMinor1.c_str()) * 1000;
version += atoi(verMinor2.c_str()); version += atoi(verMinor2.c_str());
} }
else else
{ {
version += atoi(verMinor.c_str()) * 1000; version += atoi(verMinor.c_str()) * 1000;
} }
} }
if (version > RAINMETER_VERSION) 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)) Rainmeter->SetNewVersion(TRUE);
{
LSExecute(NULL, L"http://code.google.com/p/rainmeter/", SW_SHOWNORMAL);
}
} }
else else
{ {
Rainmeter->SetNewVersion(FALSE);
DebugLog(L"CheckUpdate: No new version available."); DebugLog(L"CheckUpdate: No new version available.");
} }
} }

View File

@ -14,7 +14,7 @@
#define IDC_URL_STRING 1005 #define IDC_URL_STRING 1005
#define IDC_CONFIG_TAB 1006 #define IDC_CONFIG_TAB 1006
#define IDC_AUTHOR_STRING 1007 #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_REFRESH 4001
#define ID_CONTEXT_QUIT 4002 #define ID_CONTEXT_QUIT 4002
#define ID_CONTEXT_ABOUT 4004 #define ID_CONTEXT_ABOUT 4004
@ -58,6 +58,7 @@
#define ID_CONTEXT_MANAGESKINS 4047 #define ID_CONTEXT_MANAGESKINS 4047
#define ID_CONTEXT_SKINMENU_MONITOR_PRIMARY 4048 #define ID_CONTEXT_SKINMENU_MONITOR_PRIMARY 4048
#define ID_CONTEXT_SKINMENU_MONITOR_AUTOSELECT 4049 #define ID_CONTEXT_SKINMENU_MONITOR_AUTOSELECT 4049
#define ID_CONTEXT_NEW_VERSION 4050 //newvercheck
#define WM_QUERY_RAINMETER WM_APP + 1000 #define WM_QUERY_RAINMETER WM_APP + 1000

View File

@ -1,2 +1,2 @@
#pragma once #pragma once
const int revision_number = 440; const int revision_number = 443;