Minor changes.

This commit is contained in:
Birunthan Mohanathas 2011-09-24 13:10:31 +00:00
parent 1609fb7f59
commit a7cbc1a504
5 changed files with 26 additions and 40 deletions

View File

@ -22,6 +22,7 @@
#include "Rainmeter.h" #include "Rainmeter.h"
#include "System.h" #include "System.h"
#include "Measure.h" #include "Measure.h"
#include "resource.h"
extern CRainmeter* Rainmeter; extern CRainmeter* Rainmeter;
@ -1033,7 +1034,7 @@ void CConfigParser::ReadIniFile(const std::vector<std::wstring>& iniFileMappings
{ {
if (depth > 100) // Is 100 enough to assume the include loop never ends? 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; return;
} }

View File

@ -993,9 +993,13 @@ void CDialogAbout::CTabVersion::Initialize()
{ {
m_Initialized = true; 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]; 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); SetWindowText(item, tmpSz);
item = GetDlgItem(m_Window, IDC_ABOUTVERSION_PATHS_TEXT); item = GetDlgItem(m_Window, IDC_ABOUTVERSION_PATHS_TEXT);

View File

@ -43,18 +43,11 @@ HRGN BitmapToRegion(HBITMAP hBmp, COLORREF cTransparentColor, COLORREF cToleranc
HWND GetLitestepWnd(void); HWND GetLitestepWnd(void);
BOOL GetRCString(LPCSTR lpKeyName, LPSTR value, LPCSTR defStr, int maxLen); BOOL GetRCString(LPCSTR lpKeyName, LPSTR value, LPCSTR defStr, int maxLen);
//int GetRCInt(LPCSTR lpKeyName, int nDefault); //int GetRCInt(LPCSTR lpKeyName, int nDefault);
HINSTANCE LSExecute(HWND Owner, LPCTSTR szCommand, int nShowCmd);
BOOL RemoveBangCommand(LPCSTR command); 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 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 VarExpansion(LPSTR buffer, LPCSTR value);
//void LSSetVariable(const BSTR name, const BSTR 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(); void ResetLoggingFlag();
std::string ConvertToAscii(LPCTSTR str); std::string ConvertToAscii(LPCTSTR str);
@ -62,10 +55,17 @@ std::wstring ConvertToWide(LPCSTR str);
std::string ConvertToUTF8(LPCWSTR str); std::string ConvertToUTF8(LPCWSTR str);
std::wstring ConvertUTF8ToWide(LPCSTR str); std::wstring ConvertUTF8ToWide(LPCSTR str);
WCHAR* GetString(UINT id); void Log(int nLevel, const WCHAR* message, const WCHAR* module = L"Rainmeter"); // Wrapper for LSLog().
std::wstring GetFormattedString(UINT id, ...); 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 LSExecuteAsAdmin(HWND Owner, LPCTSTR szCommand, int nShowCmd);
HINSTANCE ExecuteCommand(HWND Owner, LPCTSTR szCommand, int nShowCmd, LPCTSTR szVerb); 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 #endif

View File

@ -2090,11 +2090,7 @@ bool CMeterWindow::ReadSkin()
// Verify whether the file exists // Verify whether the file exists
if (_waccess(iniFile.c_str(), 0) == -1) if (_waccess(iniFile.c_str(), 0) == -1)
{ {
std::wstring message = L"Unable to refresh skin \"" + m_SkinName; std::wstring message = GetFormattedString(ID_STR_UNABLETOREFRESHSKIN, m_SkinName.c_str(), m_SkinIniFile.c_str());
message += L"\\";
message += m_SkinIniFile;
message += L"\": File not found.";
Log(LOG_WARNING, message.c_str());
MessageBox(m_Window, message.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION); MessageBox(m_Window, message.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
return false; return false;
} }
@ -2126,12 +2122,7 @@ bool CMeterWindow::ReadSkin()
_snwprintf_s(buffer, _TRUNCATE, L"%i.%i", appVersion / 1000000, (appVersion / 1000) % 1000); _snwprintf_s(buffer, _TRUNCATE, L"%i.%i", appVersion / 1000000, (appVersion / 1000) % 1000);
} }
std::wstring text = L"The skin \"" + m_SkinName; std::wstring text = GetFormattedString(ID_STR_NEWVERSIONREQUIRED, m_SkinName.c_str(), m_SkinIniFile.c_str(), buffer);
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.";
MessageBox(m_Window, text.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION); MessageBox(m_Window, text.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
} }
@ -2354,25 +2345,11 @@ bool CMeterWindow::ReadSkin()
if (m_Meters.empty()) if (m_Meters.empty())
{ {
std::wstring text = L"The skin \"" + m_SkinName; std::wstring text = GetFormattedString(ID_STR_NOMETERSINSKIN, m_SkinName.c_str(), m_SkinIniFile.c_str());
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); MessageBox(m_Window, text.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
return false; return false;
} }
else 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;
}
}
}
else
{ {
// Bind the meters to the measures // Bind the meters to the measures
std::list<CMeter*>::const_iterator j = m_Meters.begin(); std::list<CMeter*>::const_iterator j = m_Meters.begin();

View File

@ -31,6 +31,7 @@
#define IDC_ABOUTVERSION_VERSION_TEXT 1010 #define IDC_ABOUTVERSION_VERSION_TEXT 1010
#define IDC_ABOUTVERSION_PATHS_TEXT 1011 #define IDC_ABOUTVERSION_PATHS_TEXT 1011
#define IDC_ABOUTVERSION_COPY_BUTTON 1012 #define IDC_ABOUTVERSION_COPY_BUTTON 1012
#define IDC_ABOUTVERSION_RAINMETER_ICON 1013
#define IDC_MANAGE_TAB 1017 #define IDC_MANAGE_TAB 1017
#define IDC_REFRESHALL_BUTTON 1018 #define IDC_REFRESHALL_BUTTON 1018
@ -121,6 +122,9 @@
#define ID_STR_NOAVAILABLESKINS 2040 #define ID_STR_NOAVAILABLESKINS 2040
#define ID_STR_UNABLETOACTIVATESKIN 2041 #define ID_STR_UNABLETOACTIVATESKIN 2041
#define ID_STR_UNABLETOREFRESHSKIN 2042 #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_REFRESH 4001
#define ID_CONTEXT_QUIT 4002 #define ID_CONTEXT_QUIT 4002