mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Changed behavior so as not to indicate the error message box when DynamicVariables is 1 and FontSize is 0. (issue 126)
FIXED: Virtual Bytes usage for an x64 process with perfmon plugin does not display value greater than 4 GB (issue 113) The numerical value greater than 32bit can be now displayed when NumOfDecimals is 0 in Meter=STRING. Fixed the broken compatibility in Windows 2000. (AboutDialog, SysInfo)
This commit is contained in:
parent
4d25eb85f7
commit
c9fd071177
@ -216,7 +216,12 @@ void ScanPlugins()
|
|||||||
|
|
||||||
// Try to get the version and author
|
// Try to get the version and author
|
||||||
std::wstring tmpSz = Rainmeter->GetPluginPath() + fileData.cFileName;
|
std::wstring tmpSz = Rainmeter->GetPluginPath() + fileData.cFileName;
|
||||||
|
UINT oldMode = SetErrorMode(0);
|
||||||
|
SetErrorMode(oldMode | SEM_FAILCRITICALERRORS); // Prevent the system from displaying message box
|
||||||
|
SetLastError(ERROR_SUCCESS);
|
||||||
HMODULE dll = LoadLibrary(tmpSz.c_str());
|
HMODULE dll = LoadLibrary(tmpSz.c_str());
|
||||||
|
DWORD err = GetLastError();
|
||||||
|
SetErrorMode(oldMode); // Reset
|
||||||
if (dll)
|
if (dll)
|
||||||
{
|
{
|
||||||
GETPLUGINAUTHOR GetAuthorFunc = (GETPLUGINAUTHOR)GetProcAddress(dll, "GetPluginAuthor");
|
GETPLUGINAUTHOR GetAuthorFunc = (GETPLUGINAUTHOR)GetProcAddress(dll, "GetPluginAuthor");
|
||||||
@ -236,6 +241,10 @@ void ScanPlugins()
|
|||||||
}
|
}
|
||||||
FreeLibrary(dll);
|
FreeLibrary(dll);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DebugLog(L"Unable to load library: \"%s\", ErrorCode=%i", tmpSz.c_str(), err);
|
||||||
|
}
|
||||||
|
|
||||||
g_Plugins.push_back(info);
|
g_Plugins.push_back(info);
|
||||||
}
|
}
|
||||||
|
@ -481,7 +481,7 @@ const WCHAR* CMeasure::GetStringValue(bool autoScale, double scale, int decimals
|
|||||||
{
|
{
|
||||||
double val = theValue * (1.0 / scale);
|
double val = theValue * (1.0 / scale);
|
||||||
val = (val + ( (val >= 0) ? 0.5 : -0.5 ) );
|
val = (val + ( (val >= 0) ? 0.5 : -0.5 ) );
|
||||||
swprintf(buffer, L"%i", (UINT)val);
|
swprintf(buffer, L"%lli", (LONGLONG)val);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -137,7 +137,10 @@ void CMeterString::Initialize()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
c_FontFamilies[m_FontFace] = m_FontFamily;
|
if(m_FontFamily)
|
||||||
|
{
|
||||||
|
c_FontFamilies[m_FontFace] = m_FontFamily;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FontStyle style = FontStyleRegular;
|
FontStyle style = FontStyleRegular;
|
||||||
@ -180,12 +183,21 @@ void CMeterString::Initialize()
|
|||||||
{
|
{
|
||||||
m_Font = new Gdiplus::Font(FontFamily::GenericSansSerif(), size, style);
|
m_Font = new Gdiplus::Font(FontFamily::GenericSansSerif(), size, style);
|
||||||
}
|
}
|
||||||
c_Fonts[properties] = m_Font;
|
|
||||||
|
|
||||||
Status status = m_Font->GetLastStatus();
|
Status status = m_Font->GetLastStatus();
|
||||||
if(Ok != status)
|
if (Ok == status)
|
||||||
{
|
{
|
||||||
throw CError(std::wstring(L"Unable to create font: ") + m_FontFace, __LINE__, __FILE__);
|
c_Fonts[properties] = m_Font;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
delete m_Font;
|
||||||
|
m_Font = NULL;
|
||||||
|
|
||||||
|
if (!m_DynamicVariables || m_FontSize != 0)
|
||||||
|
{
|
||||||
|
throw CError(std::wstring(L"Unable to create font: ") + m_FontFace, __LINE__, __FILE__);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -241,7 +253,7 @@ void CMeterString::ReadConfig(const WCHAR* section)
|
|||||||
m_AutoScale = 0!=parser.ReadInt(section, L"AutoScale", 0);
|
m_AutoScale = 0!=parser.ReadInt(section, L"AutoScale", 0);
|
||||||
m_ClipString = 0!=parser.ReadInt(section, L"ClipString", 0);
|
m_ClipString = 0!=parser.ReadInt(section, L"ClipString", 0);
|
||||||
|
|
||||||
m_FontSize = parser.ReadFormula(section, L"FontSize", 10);
|
m_FontSize = (int)parser.ReadFormula(section, L"FontSize", 10);
|
||||||
m_NumOfDecimals = parser.ReadInt(section, L"NumOfDecimals", -1);
|
m_NumOfDecimals = parser.ReadInt(section, L"NumOfDecimals", -1);
|
||||||
|
|
||||||
m_Angle = (Gdiplus::REAL)parser.ReadFloat(section, L"Angle", 0.0);
|
m_Angle = (Gdiplus::REAL)parser.ReadFloat(section, L"Angle", 0.0);
|
||||||
@ -347,7 +359,7 @@ void CMeterString::ReadConfig(const WCHAR* section)
|
|||||||
*/
|
*/
|
||||||
bool CMeterString::Update()
|
bool CMeterString::Update()
|
||||||
{
|
{
|
||||||
if (CMeter::Update())
|
if (CMeter::Update() && m_Font)
|
||||||
{
|
{
|
||||||
std::vector<std::wstring> stringValues;
|
std::vector<std::wstring> stringValues;
|
||||||
|
|
||||||
@ -422,7 +434,7 @@ bool CMeterString::Update()
|
|||||||
*/
|
*/
|
||||||
bool CMeterString::Draw(Graphics& graphics)
|
bool CMeterString::Draw(Graphics& graphics)
|
||||||
{
|
{
|
||||||
if(!CMeter::Draw(graphics)) return false;
|
if(!CMeter::Draw(graphics) || m_Font == NULL) return false;
|
||||||
|
|
||||||
return DrawString(graphics, NULL);
|
return DrawString(graphics, NULL);
|
||||||
}
|
}
|
||||||
|
@ -100,9 +100,9 @@ UINT Initialize(HMODULE instance, LPCTSTR iniFile, LPCTSTR section, UINT id)
|
|||||||
This function is called when new value should be measured.
|
This function is called when new value should be measured.
|
||||||
The function returns the new value.
|
The function returns the new value.
|
||||||
*/
|
*/
|
||||||
UINT Update(UINT id)
|
double Update2(UINT id)
|
||||||
{
|
{
|
||||||
UINT value = 0;
|
double value = 0;
|
||||||
|
|
||||||
std::map<UINT, PerfMeasure*>::iterator i = g_Measures.find(id);
|
std::map<UINT, PerfMeasure*>::iterator i = g_Measures.find(id);
|
||||||
if(i != g_Measures.end())
|
if(i != g_Measures.end())
|
||||||
@ -127,14 +127,14 @@ UINT Update(UINT id)
|
|||||||
// Compare with the old value
|
// Compare with the old value
|
||||||
if(!measure->FirstTime)
|
if(!measure->FirstTime)
|
||||||
{
|
{
|
||||||
value = (UINT)(longvalue - measure->OldValue);
|
value = (double)(longvalue - measure->OldValue);
|
||||||
}
|
}
|
||||||
measure->OldValue = longvalue;
|
measure->OldValue = longvalue;
|
||||||
measure->FirstTime = false;
|
measure->FirstTime = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
value = (UINT)longvalue;
|
value = (double)longvalue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -15,7 +15,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
__declspec( dllexport ) UINT Initialize(HMODULE instance, LPCTSTR iniFile, LPCTSTR section, UINT id);
|
__declspec( dllexport ) UINT Initialize(HMODULE instance, LPCTSTR iniFile, LPCTSTR section, UINT id);
|
||||||
__declspec( dllexport ) void Finalize(HMODULE instance, UINT id);
|
__declspec( dllexport ) void Finalize(HMODULE instance, UINT id);
|
||||||
__declspec( dllexport ) UINT Update(UINT id);
|
__declspec( dllexport ) double Update2(UINT id);
|
||||||
__declspec( dllexport ) UINT GetPluginVersion();
|
__declspec( dllexport ) UINT GetPluginVersion();
|
||||||
__declspec( dllexport ) LPCTSTR GetPluginAuthor();
|
__declspec( dllexport ) LPCTSTR GetPluginAuthor();
|
||||||
}
|
}
|
||||||
|
@ -609,7 +609,17 @@ void GetOSVersion(WCHAR* buffer)
|
|||||||
void GetOSBits(WCHAR* buffer)
|
void GetOSBits(WCHAR* buffer)
|
||||||
{
|
{
|
||||||
SYSTEM_INFO systemInfo = {0};
|
SYSTEM_INFO systemInfo = {0};
|
||||||
GetNativeSystemInfo(&systemInfo);
|
|
||||||
|
typedef void (WINAPI *FPGETNATIVESYSTEMINFO)(LPSYSTEM_INFO lpSystemInfo);
|
||||||
|
FPGETNATIVESYSTEMINFO GetNativeSystemInfo = (FPGETNATIVESYSTEMINFO)GetProcAddress(GetModuleHandle(L"kernel32"), "GetNativeSystemInfo");
|
||||||
|
if (GetNativeSystemInfo != NULL)
|
||||||
|
{
|
||||||
|
GetNativeSystemInfo(&systemInfo);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GetSystemInfo(&systemInfo);
|
||||||
|
}
|
||||||
|
|
||||||
if (systemInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64 ||
|
if (systemInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64 ||
|
||||||
systemInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_IA64)
|
systemInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_IA64)
|
||||||
|
Loading…
Reference in New Issue
Block a user