From a7cbc1a5041c1e38df9d2fb01eed77bee9a29947 Mon Sep 17 00:00:00 2001 From: Birunthan Mohanathas Date: Sat, 24 Sep 2011 13:10:31 +0000 Subject: [PATCH] Minor changes. --- Library/ConfigParser.cpp | 3 ++- Library/DialogAbout.cpp | 8 ++++++-- Library/Litestep.h | 18 +++++++++--------- Library/MeterWindow.cpp | 33 +++++---------------------------- Library/resource.h | 4 ++++ 5 files changed, 26 insertions(+), 40 deletions(-) diff --git a/Library/ConfigParser.cpp b/Library/ConfigParser.cpp index 8c0532d0..0b962d04 100644 --- a/Library/ConfigParser.cpp +++ b/Library/ConfigParser.cpp @@ -22,6 +22,7 @@ #include "Rainmeter.h" #include "System.h" #include "Measure.h" +#include "resource.h" extern CRainmeter* Rainmeter; @@ -1033,7 +1034,7 @@ void CConfigParser::ReadIniFile(const std::vector& iniFileMappings { if (depth > 100) // Is 100 enough to assume the include loop never ends? { - MessageBox(NULL, L"It seems that you have created an infinite loop with @include.\nPlease check your skin.", APPNAME, MB_OK | MB_TOPMOST | MB_ICONERROR); + MessageBox(NULL, GetString(ID_STR_INCLUDEINFINITELOOP), APPNAME, MB_OK | MB_TOPMOST | MB_ICONERROR); return; } diff --git a/Library/DialogAbout.cpp b/Library/DialogAbout.cpp index 0bcf55da..35750a04 100644 --- a/Library/DialogAbout.cpp +++ b/Library/DialogAbout.cpp @@ -993,9 +993,13 @@ void CDialogAbout::CTabVersion::Initialize() { m_Initialized = true; - HWND item = GetDlgItem(m_Window, IDC_ABOUTVERSION_VERSION_TEXT); + HWND item = GetDlgItem(m_Window, IDC_ABOUTVERSION_RAINMETER_ICON); + HICON icon = LoadIcon(Rainmeter->GetInstance(), MAKEINTRESOURCE(IDI_WINDOW)); + Static_SetIcon(item, icon); + + item = GetDlgItem(m_Window, IDC_ABOUTVERSION_VERSION_TEXT); WCHAR tmpSz[64]; - _snwprintf_s(tmpSz, _TRUNCATE, L"%s%s r%s %s (%s)", APPVERSION, revision_beta ? L" beta" : L"", REVISION, APPBITS, APPDATE); + _snwprintf_s(tmpSz, _TRUNCATE, L"%s%s r%i %s (%s)", APPVERSION, revision_beta ? L" beta" : L"", revision_number, APPBITS, APPDATE); SetWindowText(item, tmpSz); item = GetDlgItem(m_Window, IDC_ABOUTVERSION_PATHS_TEXT); diff --git a/Library/Litestep.h b/Library/Litestep.h index a9fae239..9a822521 100644 --- a/Library/Litestep.h +++ b/Library/Litestep.h @@ -43,18 +43,11 @@ HRGN BitmapToRegion(HBITMAP hBmp, COLORREF cTransparentColor, COLORREF cToleranc HWND GetLitestepWnd(void); BOOL GetRCString(LPCSTR lpKeyName, LPSTR value, LPCSTR defStr, int maxLen); //int GetRCInt(LPCSTR lpKeyName, int nDefault); -HINSTANCE LSExecute(HWND Owner, LPCTSTR szCommand, int nShowCmd); BOOL RemoveBangCommand(LPCSTR command); //void TransparentBltLS (HDC dc, int nXDest, int nYDest, int nWidth, int nHeight, HDC tempDC, int nXSrc, int nYSrc, COLORREF colorTransparent); void VarExpansion(LPSTR buffer, LPCSTR value); //void LSSetVariable(const BSTR name, const BSTR value); -void RmNullCRTInvalidParameterHandler(const wchar_t* expression, const wchar_t* function, const wchar_t* file, unsigned int line, uintptr_t pReserved); - -void Log(int nLevel, const WCHAR* message, const WCHAR* module = L"Rainmeter"); // Wrapper for LSLog(). -void LogWithArgs(int nLevel, const WCHAR* format, ... ); // Replacement for DebugLog(), has the same functionality but has the option to set teh Log Level. -void LogError(CError& error); - void ResetLoggingFlag(); std::string ConvertToAscii(LPCTSTR str); @@ -62,10 +55,17 @@ std::wstring ConvertToWide(LPCSTR str); std::string ConvertToUTF8(LPCWSTR str); std::wstring ConvertUTF8ToWide(LPCSTR str); -WCHAR* GetString(UINT id); -std::wstring GetFormattedString(UINT id, ...); +void Log(int nLevel, const WCHAR* message, const WCHAR* module = L"Rainmeter"); // Wrapper for LSLog(). +void LogWithArgs(int nLevel, const WCHAR* format, ... ); // Replacement for DebugLog(), has the same functionality but has the option to set teh Log Level. +void LogError(CError& error); +HINSTANCE LSExecute(HWND Owner, LPCTSTR szCommand, int nShowCmd); HINSTANCE LSExecuteAsAdmin(HWND Owner, LPCTSTR szCommand, int nShowCmd); HINSTANCE ExecuteCommand(HWND Owner, LPCTSTR szCommand, int nShowCmd, LPCTSTR szVerb); +WCHAR* GetString(UINT id); +std::wstring GetFormattedString(UINT id, ...); + +void RmNullCRTInvalidParameterHandler(const wchar_t* expression, const wchar_t* function, const wchar_t* file, unsigned int line, uintptr_t pReserved); + #endif diff --git a/Library/MeterWindow.cpp b/Library/MeterWindow.cpp index a1e9cbea..125f05f7 100644 --- a/Library/MeterWindow.cpp +++ b/Library/MeterWindow.cpp @@ -2090,11 +2090,7 @@ bool CMeterWindow::ReadSkin() // Verify whether the file exists if (_waccess(iniFile.c_str(), 0) == -1) { - std::wstring message = L"Unable to refresh skin \"" + m_SkinName; - message += L"\\"; - message += m_SkinIniFile; - message += L"\": File not found."; - Log(LOG_WARNING, message.c_str()); + std::wstring message = GetFormattedString(ID_STR_UNABLETOREFRESHSKIN, m_SkinName.c_str(), m_SkinIniFile.c_str()); MessageBox(m_Window, message.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION); return false; } @@ -2126,12 +2122,7 @@ bool CMeterWindow::ReadSkin() _snwprintf_s(buffer, _TRUNCATE, L"%i.%i", appVersion / 1000000, (appVersion / 1000) % 1000); } - std::wstring text = L"The skin \"" + m_SkinName; - text += L"\\"; - text += m_SkinIniFile; - text += L"\" needs Rainmeter "; - text += buffer; - text += L" or newer.\nDownload the latest version of Rainmeter from www.rainmeter.net."; + std::wstring text = GetFormattedString(ID_STR_NEWVERSIONREQUIRED, m_SkinName.c_str(), m_SkinIniFile.c_str(), buffer); MessageBox(m_Window, text.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION); } @@ -2354,23 +2345,9 @@ bool CMeterWindow::ReadSkin() if (m_Meters.empty()) { - std::wstring text = L"The skin \"" + m_SkinName; - text += L"\\"; - text += m_SkinIniFile; - if (m_Measures.empty()) - { - text += L"\" does not contain\nany meters or measures and will be deactivated.\n\nThe file may be damaged or may not be a Rainmeter skin."; - MessageBox(m_Window, text.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION); - return false; - } - else - { - text += L"\" does not contain any meters.\nDo you want to deactivate this skin?"; - if (IDYES == MessageBox(m_Window, text.c_str(), APPNAME, MB_YESNO | MB_TOPMOST | MB_ICONEXCLAMATION)) - { - return false; - } - } + std::wstring text = GetFormattedString(ID_STR_NOMETERSINSKIN, m_SkinName.c_str(), m_SkinIniFile.c_str()); + MessageBox(m_Window, text.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION); + return false; } else { diff --git a/Library/resource.h b/Library/resource.h index 651d9b6b..5895f5b9 100644 --- a/Library/resource.h +++ b/Library/resource.h @@ -31,6 +31,7 @@ #define IDC_ABOUTVERSION_VERSION_TEXT 1010 #define IDC_ABOUTVERSION_PATHS_TEXT 1011 #define IDC_ABOUTVERSION_COPY_BUTTON 1012 +#define IDC_ABOUTVERSION_RAINMETER_ICON 1013 #define IDC_MANAGE_TAB 1017 #define IDC_REFRESHALL_BUTTON 1018 @@ -121,6 +122,9 @@ #define ID_STR_NOAVAILABLESKINS 2040 #define ID_STR_UNABLETOACTIVATESKIN 2041 #define ID_STR_UNABLETOREFRESHSKIN 2042 +#define ID_STR_NEWVERSIONREQUIRED 2043 +#define ID_STR_NOMETERSINSKIN 2044 +#define ID_STR_INCLUDEINFINITELOOP 2045 #define ID_CONTEXT_REFRESH 4001 #define ID_CONTEXT_QUIT 4002