mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
- Added skin related variables.
#CURRENTCONFIGX# #CURRENTCONFIGY# #CURRENTCONFIGWIDTH# #CURRENTCONFIGHEIGHT# - Code cleanup.
This commit is contained in:
parent
9da749acf4
commit
f0e2084c42
@ -659,14 +659,14 @@ const std::wstring& CConfigParser::ReadString(LPCTSTR section, LPCTSTR key, LPCT
|
||||
}
|
||||
}
|
||||
|
||||
SetVariable(L"CURRENTSECTION", section); // Set temporarily
|
||||
SetBuiltInVariable(L"CURRENTSECTION", section); // Set temporarily
|
||||
|
||||
if (ReplaceVariables(result))
|
||||
{
|
||||
m_LastReplaced = true;
|
||||
}
|
||||
|
||||
SetVariable(L"CURRENTSECTION", L""); // Reset
|
||||
SetBuiltInVariable(L"CURRENTSECTION", L""); // Reset
|
||||
|
||||
if (bReplaceMeasures && ReplaceMeasures(result))
|
||||
{
|
||||
|
@ -43,6 +43,7 @@ public:
|
||||
void AddMeasure(CMeasure* pMeasure);
|
||||
|
||||
void SetVariable(const std::wstring& strVariable, const std::wstring& strValue) { SetVariable(m_Variables, strVariable, strValue); }
|
||||
void SetBuiltInVariable(const std::wstring& strVariable, const std::wstring& strValue) { SetVariable(m_BuiltInVariables, strVariable, strValue); }
|
||||
|
||||
void SetStyleTemplate(const std::wstring& strStyle) { m_StyleTemplate = Tokenize(strStyle, L"|"); }
|
||||
void ClearStyleTemplate() { m_StyleTemplate.clear(); }
|
||||
@ -89,7 +90,6 @@ public:
|
||||
|
||||
private:
|
||||
void SetBuiltInVariables(CRainmeter* pRainmeter, CMeterWindow* meterWindow);
|
||||
void SetBuiltInVariable(const std::wstring& strVariable, const std::wstring& strValue) { SetVariable(m_BuiltInVariables, strVariable, strValue); }
|
||||
|
||||
void ReadVariables();
|
||||
|
||||
|
@ -1802,6 +1802,8 @@ bool CMeterWindow::ReadSkin()
|
||||
}
|
||||
|
||||
m_Parser.Initialize(iniFile.c_str(), m_Rainmeter, this);
|
||||
SetWindowPositionVariables(m_ScreenX, m_ScreenY);
|
||||
SetWindowSizeVariables(0, 0);
|
||||
|
||||
// Global settings
|
||||
std::wstring group = m_Parser.ReadString(L"Rainmeter", L"Group", L"");
|
||||
@ -2353,6 +2355,8 @@ bool CMeterWindow::ResizeWindow(bool reset)
|
||||
WindowToScreen();
|
||||
}
|
||||
|
||||
SetWindowSizeVariables(m_WindowW, m_WindowH);
|
||||
|
||||
// If Background is not set, take a copy from the desktop
|
||||
if(m_Background == NULL)
|
||||
{
|
||||
@ -4569,6 +4573,8 @@ LRESULT CMeterWindow::OnMove(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
m_ScreenX = (SHORT)LOWORD(lParam);
|
||||
m_ScreenY = (SHORT)HIWORD(lParam);
|
||||
|
||||
SetWindowPositionVariables(m_ScreenX, m_ScreenY);
|
||||
|
||||
if (m_Dragging)
|
||||
{
|
||||
ScreenToWindow();
|
||||
@ -4809,6 +4815,38 @@ LRESULT CMeterWindow::OnCopyData(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** SetWindowPositionVariables
|
||||
**
|
||||
** Sets up the window position variables.
|
||||
**
|
||||
*/
|
||||
void CMeterWindow::SetWindowPositionVariables(int x, int y)
|
||||
{
|
||||
WCHAR buffer[32];
|
||||
|
||||
_snwprintf_s(buffer, _TRUNCATE, L"%i", x);
|
||||
m_Parser.SetBuiltInVariable(L"CURRENTCONFIGX", buffer);
|
||||
_snwprintf_s(buffer, _TRUNCATE, L"%i", y);
|
||||
m_Parser.SetBuiltInVariable(L"CURRENTCONFIGY", buffer);
|
||||
}
|
||||
|
||||
/*
|
||||
** SetWindowSizeVariables
|
||||
**
|
||||
** Sets up the window size variables.
|
||||
**
|
||||
*/
|
||||
void CMeterWindow::SetWindowSizeVariables(int w, int h)
|
||||
{
|
||||
WCHAR buffer[32];
|
||||
|
||||
_snwprintf_s(buffer, _TRUNCATE, L"%i", w);
|
||||
m_Parser.SetBuiltInVariable(L"CURRENTCONFIGWIDTH", buffer);
|
||||
_snwprintf_s(buffer, _TRUNCATE, L"%i", h);
|
||||
m_Parser.SetBuiltInVariable(L"CURRENTCONFIGHEIGHT", buffer);
|
||||
}
|
||||
|
||||
/*
|
||||
** MakePathAbsolute
|
||||
**
|
||||
|
@ -196,6 +196,11 @@ public:
|
||||
bool GetXFromRight() { return m_WindowXFromRight; }
|
||||
bool GetYFromBottom() { return m_WindowYFromBottom; }
|
||||
|
||||
int GetW() { return m_WindowW; }
|
||||
int GetH() { return m_WindowH; }
|
||||
int GetX() { return m_ScreenX; }
|
||||
int GetY() { return m_ScreenY; }
|
||||
|
||||
bool GetXScreenDefined() { return m_WindowXScreenDefined; }
|
||||
bool GetYScreenDefined() { return m_WindowYScreenDefined; }
|
||||
int GetXScreen() { return m_WindowXScreen; }
|
||||
@ -292,6 +297,8 @@ private:
|
||||
bool DoMoveAction(int x, int y, MOUSE mouse);
|
||||
bool ResizeWindow(bool reset);
|
||||
void IgnoreAeroPeek();
|
||||
void SetWindowPositionVariables(int x, int y);
|
||||
void SetWindowSizeVariables(int w, int h);
|
||||
|
||||
CConfigParser m_Parser;
|
||||
|
||||
|
@ -558,7 +558,7 @@ void CTintedImage::ReadConfig(CConfigParser& parser, const WCHAR* section)
|
||||
std::vector<Gdiplus::REAL> matrix = parser.ReadFloats(section, m_ConfigColorMatrix1.c_str());
|
||||
if (matrix.size() == 5)
|
||||
{
|
||||
for (int i = 0; i < 5; ++i)
|
||||
for (int i = 0; i < 4; ++i) // The fifth column must be 0.
|
||||
{
|
||||
m_ColorMatrix.m[0][i] = matrix[i];
|
||||
}
|
||||
@ -571,7 +571,7 @@ void CTintedImage::ReadConfig(CConfigParser& parser, const WCHAR* section)
|
||||
matrix = parser.ReadFloats(section, m_ConfigColorMatrix2.c_str());
|
||||
if (matrix.size() == 5)
|
||||
{
|
||||
for(int i = 0; i < 5; ++i)
|
||||
for(int i = 0; i < 4; ++i) // The fifth column must be 0.
|
||||
{
|
||||
m_ColorMatrix.m[1][i] = matrix[i];
|
||||
}
|
||||
@ -584,7 +584,7 @@ void CTintedImage::ReadConfig(CConfigParser& parser, const WCHAR* section)
|
||||
matrix = parser.ReadFloats(section, m_ConfigColorMatrix3.c_str());
|
||||
if (matrix.size() == 5)
|
||||
{
|
||||
for(int i = 0; i < 5; ++i)
|
||||
for(int i = 0; i < 4; ++i) // The fifth column must be 0.
|
||||
{
|
||||
m_ColorMatrix.m[2][i] = matrix[i];
|
||||
}
|
||||
@ -597,7 +597,7 @@ void CTintedImage::ReadConfig(CConfigParser& parser, const WCHAR* section)
|
||||
matrix = parser.ReadFloats(section, m_ConfigColorMatrix4.c_str());
|
||||
if (matrix.size() == 5)
|
||||
{
|
||||
for(int i = 0; i < 5; ++i)
|
||||
for(int i = 0; i < 4; ++i) // The fifth column must be 0.
|
||||
{
|
||||
m_ColorMatrix.m[3][i] = matrix[i];
|
||||
}
|
||||
@ -610,7 +610,7 @@ void CTintedImage::ReadConfig(CConfigParser& parser, const WCHAR* section)
|
||||
matrix = parser.ReadFloats(section, m_ConfigColorMatrix5.c_str());
|
||||
if (matrix.size() == 5)
|
||||
{
|
||||
for(int i = 0; i < 5; ++i)
|
||||
for(int i = 0; i < 4; ++i) // The fifth column must be 1.
|
||||
{
|
||||
m_ColorMatrix.m[4][i] = matrix[i];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user