Additional changes to 2f543e5

This commit is contained in:
Birunthan Mohanathas 2012-07-17 22:15:06 +03:00
parent 1ecf6086bd
commit ef375232a8
2 changed files with 17 additions and 9 deletions

View File

@ -251,6 +251,7 @@ void CMeter::ReadOptions(CConfigParser& parser, const WCHAR* section)
parser.SetStyleTemplate(style); parser.SetStyleTemplate(style);
} }
int oldX = m_X;
std::wstring& x = (std::wstring&)parser.ReadString(section, L"X", L"0"); std::wstring& x = (std::wstring&)parser.ReadString(section, L"X", L"0");
if (!x.empty()) if (!x.empty())
{ {
@ -278,6 +279,7 @@ void CMeter::ReadOptions(CConfigParser& parser, const WCHAR* section)
m_RelativeX = POSITION_ABSOLUTE; m_RelativeX = POSITION_ABSOLUTE;
} }
int oldY = m_Y;
std::wstring& y = (std::wstring&)parser.ReadString(section, L"Y", L"0"); std::wstring& y = (std::wstring&)parser.ReadString(section, L"Y", L"0");
if (!y.empty()) if (!y.empty())
{ {
@ -311,8 +313,14 @@ 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();
bool oldHidden = m_Hidden;
m_Hidden = 0!=parser.ReadInt(section, L"Hidden", 0); m_Hidden = 0!=parser.ReadInt(section, L"Hidden", 0);
if (oldX != m_X || oldY != m_Y || oldHidden != m_Hidden)
{
m_MeterWindow->SetResizeWindowMode(RESIZEMODE_CHECK); // Need to recalculate the window size
}
m_SolidBevel = (BEVELTYPE)parser.ReadInt(section, L"BevelType", BEVELTYPE_NONE); m_SolidBevel = (BEVELTYPE)parser.ReadInt(section, L"BevelType", BEVELTYPE_NONE);
m_SolidColor = parser.ReadColor(section, L"SolidColor", Color::MakeARGB(0, 0, 0, 0)); m_SolidColor = parser.ReadColor(section, L"SolidColor", Color::MakeARGB(0, 0, 0, 0));

View File

@ -139,6 +139,13 @@ enum BANGCOMMAND
BANG_SETOPTIONGROUP BANG_SETOPTIONGROUP
}; };
enum RESIZEMODE
{
RESIZEMODE_NONE = 0,
RESIZEMODE_CHECK,
RESIZEMODE_RESET
};
class CRainmeter; class CRainmeter;
class CMeasure; class CMeasure;
class CMeter; class CMeter;
@ -182,6 +189,8 @@ public:
bool IsBlur() { return m_Blur; } bool IsBlur() { return m_Blur; }
void SetBlur(bool b) { m_Blur = b; } void SetBlur(bool b) { m_Blur = b; }
void SetResizeWindowMode(RESIZEMODE mode) { if (m_ResizeWindow != RESIZEMODE_RESET || mode != RESIZEMODE_CHECK) m_ResizeWindow = mode; }
Gdiplus::Bitmap* GetDoubleBuffer() { return m_DoubleBuffer; } Gdiplus::Bitmap* GetDoubleBuffer() { return m_DoubleBuffer; }
HWND GetWindow() { return m_Window; } HWND GetWindow() { return m_Window; }
@ -288,15 +297,6 @@ private:
OPTION_ALL = 0xFFFFFFFF OPTION_ALL = 0xFFFFFFFF
}; };
enum RESIZEMODE
{
RESIZEMODE_NONE = 0,
RESIZEMODE_CHECK,
RESIZEMODE_RESET
};
void SetResizeWindowMode(RESIZEMODE mode) { if (m_ResizeWindow != RESIZEMODE_RESET || mode != RESIZEMODE_CHECK) m_ResizeWindow = mode; }
bool HitTest(int x, int y); bool HitTest(int x, int y);
void SnapToWindow(CMeterWindow* window, LPWINDOWPOS wp); void SnapToWindow(CMeterWindow* window, LPWINDOWPOS wp);