mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Dynamic variables can be used to change the font in the string Meter.cpp.
Removed the error message if the meter's dimensions are 0.
This commit is contained in:
parent
c09ff5cf61
commit
c6fdbf7b60
@ -63,6 +63,7 @@ CMeter::CMeter(CMeterWindow* meterWindow)
|
|||||||
m_MeterWindow = meterWindow;
|
m_MeterWindow = meterWindow;
|
||||||
m_AntiAlias = false;
|
m_AntiAlias = false;
|
||||||
m_DynamicVariables = false;
|
m_DynamicVariables = false;
|
||||||
|
m_Initialized = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -85,6 +86,7 @@ CMeter::~CMeter()
|
|||||||
*/
|
*/
|
||||||
void CMeter::Initialize()
|
void CMeter::Initialize()
|
||||||
{
|
{
|
||||||
|
m_Initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -280,11 +282,12 @@ void CMeter::ReadConfig(const WCHAR* section)
|
|||||||
DebugLog(L"The transformation matrix has incorrect number of values:", parser.ReadString(section, L"TransformationMatrix", L"").c_str());
|
DebugLog(L"The transformation matrix has incorrect number of values:", parser.ReadString(section, L"TransformationMatrix", L"").c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Are these necessary?
|
||||||
if (m_W == 0 || m_H == 0)
|
if (m_W == 0 || m_H == 0)
|
||||||
{
|
{
|
||||||
throw CError(std::wstring(L"The meter ") + section + L" has zero dimensions.", __LINE__, __FILE__);
|
throw CError(std::wstring(L"The meter ") + section + L" has zero dimensions.", __LINE__, __FILE__);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -126,6 +126,7 @@ protected:
|
|||||||
Gdiplus::Color m_SolidColor2;
|
Gdiplus::Color m_SolidColor2;
|
||||||
Gdiplus::REAL m_SolidAngle;
|
Gdiplus::REAL m_SolidAngle;
|
||||||
bool m_AntiAlias; // If true, the line is antialiased
|
bool m_AntiAlias; // If true, the line is antialiased
|
||||||
|
bool m_Initialized;
|
||||||
|
|
||||||
CMeterWindow* m_MeterWindow;
|
CMeterWindow* m_MeterWindow;
|
||||||
};
|
};
|
||||||
|
@ -164,6 +164,11 @@ void CMeterString::ReadConfig(const WCHAR* section)
|
|||||||
{
|
{
|
||||||
WCHAR tmpName[256];
|
WCHAR tmpName[256];
|
||||||
|
|
||||||
|
// Store the current font values so we know if the font needs to be updated
|
||||||
|
std::wstring oldFontFace = m_FontFace;
|
||||||
|
int oldFontSize = m_FontSize;
|
||||||
|
TEXTSTYLE oldStyle = m_Style;
|
||||||
|
|
||||||
// Read common configs
|
// Read common configs
|
||||||
CMeter::ReadConfig(section);
|
CMeter::ReadConfig(section);
|
||||||
|
|
||||||
@ -286,6 +291,14 @@ void CMeterString::ReadConfig(const WCHAR* section)
|
|||||||
{
|
{
|
||||||
m_DimensionsDefined = true;
|
m_DimensionsDefined = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_Initialized &&
|
||||||
|
(oldFontFace != m_FontFace ||
|
||||||
|
oldFontSize != m_FontSize ||
|
||||||
|
oldStyle != m_Style))
|
||||||
|
{
|
||||||
|
Initialize(); // Recreate the font
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -2590,15 +2590,7 @@ LRESULT CMeterWindow::OnNcHitTest(WPARAM wParam, LPARAM lParam)
|
|||||||
LRESULT CMeterWindow::OnSettingChange(WPARAM wParam, LPARAM lParam)
|
LRESULT CMeterWindow::OnSettingChange(WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
m_Monitors.count = 0;
|
m_Monitors.count = 0;
|
||||||
|
PostMessage(m_Window, WM_DELAYED_REFRESH, (WPARAM)NULL, (LPARAM)NULL);
|
||||||
try
|
|
||||||
{
|
|
||||||
Refresh(false);
|
|
||||||
}
|
|
||||||
catch (CError& error)
|
|
||||||
{
|
|
||||||
MessageBox(m_Window, error.GetString().c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Commented: Calling DefWindowProc seems to cause crash sometimes
|
// Commented: Calling DefWindowProc seems to cause crash sometimes
|
||||||
return 0; // DefWindowProc(m_Window, m_Message, wParam, lParam);
|
return 0; // DefWindowProc(m_Window, m_Message, wParam, lParam);
|
||||||
|
Loading…
Reference in New Issue
Block a user