mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Changed !SetOption to work with X, Y, and Hidden
This commit is contained in:
parent
6a1a880801
commit
2f543e5dcb
@ -149,6 +149,28 @@ int CMeter::GetY(bool abs)
|
|||||||
return m_Y;
|
return m_Y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CMeter::SetX(int x)
|
||||||
|
{
|
||||||
|
m_X = x;
|
||||||
|
m_RelativeX = POSITION_ABSOLUTE;
|
||||||
|
|
||||||
|
// Change the option as well to avoid reset in ReadOptions().
|
||||||
|
WCHAR buffer[32];
|
||||||
|
_itow_s(x, buffer, 10);
|
||||||
|
m_MeterWindow->GetParser().SetValue(m_Name, L"X", buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMeter::SetY(int y)
|
||||||
|
{
|
||||||
|
m_Y = y;
|
||||||
|
m_RelativeY = POSITION_ABSOLUTE;
|
||||||
|
|
||||||
|
// Change the option as well to avoid reset in ReadOptions().
|
||||||
|
WCHAR buffer[32];
|
||||||
|
_itow_s(y, buffer, 10);
|
||||||
|
m_MeterWindow->GetParser().SetValue(m_Name, L"Y", buffer);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Returns a RECT containing the dimensions of the meter within the MeterWindow
|
** Returns a RECT containing the dimensions of the meter within the MeterWindow
|
||||||
**
|
**
|
||||||
@ -186,6 +208,9 @@ void CMeter::Show()
|
|||||||
{
|
{
|
||||||
m_Hidden = false;
|
m_Hidden = false;
|
||||||
|
|
||||||
|
// Change the option as well to avoid reset in ReadOptions().
|
||||||
|
m_MeterWindow->GetParser().SetValue(m_Name, L"Hidden", L"0");
|
||||||
|
|
||||||
if (m_ToolTipHandle != NULL)
|
if (m_ToolTipHandle != NULL)
|
||||||
{
|
{
|
||||||
if (!m_ToolTipHidden)
|
if (!m_ToolTipHidden)
|
||||||
@ -203,6 +228,9 @@ void CMeter::Hide()
|
|||||||
{
|
{
|
||||||
m_Hidden = true;
|
m_Hidden = true;
|
||||||
|
|
||||||
|
// Change the option as well to avoid reset in ReadOptions().
|
||||||
|
m_MeterWindow->GetParser().SetValue(m_Name, L"Hidden", L"1");
|
||||||
|
|
||||||
if (m_ToolTipHandle != NULL)
|
if (m_ToolTipHandle != NULL)
|
||||||
{
|
{
|
||||||
SendMessage(m_ToolTipHandle, TTM_ACTIVATE, FALSE, NULL);
|
SendMessage(m_ToolTipHandle, TTM_ACTIVATE, FALSE, NULL);
|
||||||
@ -223,71 +251,59 @@ void CMeter::ReadOptions(CConfigParser& parser, const WCHAR* section)
|
|||||||
parser.SetStyleTemplate(style);
|
parser.SetStyleTemplate(style);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::wstring oldStyleX = m_StyleX;
|
std::wstring& x = (std::wstring&)parser.ReadString(section, L"X", L"0");
|
||||||
std::wstring oldStyleY = m_StyleY;
|
if (!x.empty())
|
||||||
std::wstring oldStyleHidden = m_StyleHidden;
|
|
||||||
|
|
||||||
std::wstring coord = parser.ReadString(section, L"X", L"0");
|
|
||||||
m_StyleX = parser.GetLastUsedStyle();
|
|
||||||
if (!m_Initialized || parser.GetLastReplaced() || wcscmp(m_StyleX.c_str(), oldStyleX.c_str()) != 0)
|
|
||||||
{
|
{
|
||||||
if (!coord.empty())
|
WCHAR lastChar = x[x.size() - 1];
|
||||||
{
|
|
||||||
WCHAR lastChar = coord[coord.size() - 1];
|
|
||||||
if (lastChar == L'r')
|
if (lastChar == L'r')
|
||||||
{
|
{
|
||||||
m_RelativeX = POSITION_RELATIVE_TL;
|
m_RelativeX = POSITION_RELATIVE_TL;
|
||||||
coord.pop_back();
|
x.pop_back();
|
||||||
}
|
}
|
||||||
else if (lastChar == L'R')
|
else if (lastChar == L'R')
|
||||||
{
|
{
|
||||||
m_RelativeX = POSITION_RELATIVE_BR;
|
m_RelativeX = POSITION_RELATIVE_BR;
|
||||||
coord.pop_back();
|
x.pop_back();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_RelativeX = POSITION_ABSOLUTE;
|
m_RelativeX = POSITION_ABSOLUTE;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_X = parser.ParseInt(coord.c_str(), 0);
|
m_X = parser.ParseInt(x.c_str(), 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_X = 0;
|
m_X = 0;
|
||||||
m_RelativeX = POSITION_ABSOLUTE;
|
m_RelativeX = POSITION_ABSOLUTE;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
coord = parser.ReadString(section, L"Y", L"0");
|
std::wstring& y = (std::wstring&)parser.ReadString(section, L"Y", L"0");
|
||||||
m_StyleY = parser.GetLastUsedStyle();
|
if (!y.empty())
|
||||||
if (!m_Initialized || parser.GetLastReplaced() || wcscmp(m_StyleY.c_str(), oldStyleY.c_str()) != 0)
|
|
||||||
{
|
{
|
||||||
if (!coord.empty())
|
WCHAR lastChar = y[y.size() - 1];
|
||||||
{
|
|
||||||
WCHAR lastChar = coord[coord.size() - 1];
|
|
||||||
if (lastChar == L'r')
|
if (lastChar == L'r')
|
||||||
{
|
{
|
||||||
m_RelativeY = POSITION_RELATIVE_TL;
|
m_RelativeY = POSITION_RELATIVE_TL;
|
||||||
coord.pop_back();
|
y.pop_back();
|
||||||
}
|
}
|
||||||
else if (lastChar == L'R')
|
else if (lastChar == L'R')
|
||||||
{
|
{
|
||||||
m_RelativeY = POSITION_RELATIVE_BR;
|
m_RelativeY = POSITION_RELATIVE_BR;
|
||||||
coord.pop_back();
|
y.pop_back();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_RelativeY = POSITION_ABSOLUTE;
|
m_RelativeY = POSITION_ABSOLUTE;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Y = parser.ParseInt(coord.c_str(), 0);
|
m_Y = parser.ParseInt(y.c_str(), 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_Y = 0;
|
m_Y = 0;
|
||||||
m_RelativeY = POSITION_ABSOLUTE;
|
m_RelativeY = POSITION_ABSOLUTE;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
m_W = parser.ReadInt(section, L"W", 1);
|
m_W = parser.ReadInt(section, L"W", 1);
|
||||||
m_WDefined = parser.GetLastValueDefined();
|
m_WDefined = parser.GetLastValueDefined();
|
||||||
@ -295,12 +311,7 @@ void CMeter::ReadOptions(CConfigParser& parser, const WCHAR* section)
|
|||||||
m_H = parser.ReadInt(section, L"H", 1);
|
m_H = parser.ReadInt(section, L"H", 1);
|
||||||
m_HDefined = parser.GetLastValueDefined();
|
m_HDefined = parser.GetLastValueDefined();
|
||||||
|
|
||||||
const std::wstring& hidden = parser.ReadString(section, L"Hidden", L"0");
|
m_Hidden = 0!=parser.ReadInt(section, L"Hidden", 0);
|
||||||
m_StyleHidden = parser.GetLastUsedStyle();
|
|
||||||
if (!m_Initialized || parser.GetLastReplaced() || wcscmp(m_StyleHidden.c_str(), oldStyleHidden.c_str()) != 0)
|
|
||||||
{
|
|
||||||
m_Hidden = 0!=parser.ParseInt(hidden.c_str(), 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_SolidBevel = (BEVELTYPE)parser.ReadInt(section, L"BevelType", BEVELTYPE_NONE);
|
m_SolidBevel = (BEVELTYPE)parser.ReadInt(section, L"BevelType", BEVELTYPE_NONE);
|
||||||
|
|
||||||
|
@ -58,8 +58,8 @@ public:
|
|||||||
|
|
||||||
void SetW(int w) { m_W = w; }
|
void SetW(int w) { m_W = w; }
|
||||||
void SetH(int h) { m_H = h; }
|
void SetH(int h) { m_H = h; }
|
||||||
void SetX(int x) { m_X = x; m_RelativeX = POSITION_ABSOLUTE; }
|
void SetX(int x);
|
||||||
void SetY(int y) { m_Y = y; m_RelativeY = POSITION_ABSOLUTE; }
|
void SetY(int y);
|
||||||
|
|
||||||
const CMouse& GetMouse() { return m_Mouse; }
|
const CMouse& GetMouse() { return m_Mouse; }
|
||||||
bool HasMouseAction() { return m_HasMouseAction; }
|
bool HasMouseAction() { return m_HasMouseAction; }
|
||||||
@ -138,10 +138,6 @@ protected:
|
|||||||
|
|
||||||
Gdiplus::Matrix* m_Transformation;
|
Gdiplus::Matrix* m_Transformation;
|
||||||
|
|
||||||
std::wstring m_StyleX;
|
|
||||||
std::wstring m_StyleY;
|
|
||||||
std::wstring m_StyleHidden;
|
|
||||||
|
|
||||||
std::wstring m_ToolTipText;
|
std::wstring m_ToolTipText;
|
||||||
std::wstring m_ToolTipTitle;
|
std::wstring m_ToolTipTitle;
|
||||||
std::wstring m_ToolTipIcon;
|
std::wstring m_ToolTipIcon;
|
||||||
|
Loading…
Reference in New Issue
Block a user