mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Minor tweaks.
This commit is contained in:
parent
af8be41663
commit
efc8275ed1
@ -668,7 +668,7 @@ void CConfigParser::AddMeasure(CMeasure* pMeasure)
|
||||
{
|
||||
if (pMeasure)
|
||||
{
|
||||
m_Measures[StrToLower(pMeasure->GetName())] = pMeasure;
|
||||
m_Measures[StrToLower(pMeasure->GetOriginalName())] = pMeasure;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -108,8 +108,8 @@ private:
|
||||
static void SetMultiMonitorVariables(bool reset);
|
||||
static void SetMonitorVariable(const std::wstring& strVariable, const std::wstring& strValue) { SetVariable(c_MonitorVariables, strVariable, strValue); }
|
||||
|
||||
static std::wstring StrToLower(const std::wstring& str) { std::wstring strTmp(str); return StrToLowerC(strTmp); }
|
||||
static std::wstring StrToLower(const WCHAR* str) { std::wstring strTmp(str); return StrToLowerC(strTmp); }
|
||||
static std::wstring StrToLower(const std::wstring& str) { std::wstring strTmp(str); StrToLowerC(strTmp); return strTmp; }
|
||||
static std::wstring StrToLower(const WCHAR* str) { std::wstring strTmp(str); StrToLowerC(strTmp); return strTmp; }
|
||||
static std::wstring& StrToLowerC(std::wstring& str) { std::transform(str.begin(), str.end(), str.begin(), ::towlower); return str; }
|
||||
|
||||
std::wstring m_Filename;
|
||||
|
@ -56,6 +56,7 @@ public:
|
||||
virtual const WCHAR* GetStats();
|
||||
|
||||
const WCHAR* GetName() { return m_Name.c_str(); }
|
||||
const std::wstring& GetOriginalName() { return m_Name; }
|
||||
const char* GetAsciiName() { return m_AsciiName.c_str(); }
|
||||
|
||||
void Disable() { m_Disabled = true; }
|
||||
|
@ -390,14 +390,14 @@ void CMeter::ReadConfig(CConfigParser& parser, const WCHAR* section)
|
||||
m_SolidColor2 = parser.ReadColor(section, L"SolidColor2", m_SolidColor);
|
||||
m_SolidAngle = (Gdiplus::REAL)parser.ReadFloat(section, L"GradientAngle", 0.0);
|
||||
|
||||
m_RightMouseDownAction = parser.ReadString(section, L"RightMouseDownAction", L"", false);
|
||||
m_LeftMouseDownAction = parser.ReadString(section, L"LeftMouseDownAction", L"", false);
|
||||
m_RightMouseDownAction = parser.ReadString(section, L"RightMouseDownAction", L"", false);
|
||||
m_MiddleMouseDownAction = parser.ReadString(section, L"MiddleMouseDownAction", L"", false);
|
||||
m_RightMouseUpAction = parser.ReadString(section, L"RightMouseUpAction", L"", false);
|
||||
m_LeftMouseUpAction = parser.ReadString(section, L"LeftMouseUpAction", L"", false);
|
||||
m_RightMouseUpAction = parser.ReadString(section, L"RightMouseUpAction", L"", false);
|
||||
m_MiddleMouseUpAction = parser.ReadString(section, L"MiddleMouseUpAction", L"", false);
|
||||
m_RightMouseDoubleClickAction = parser.ReadString(section, L"RightMouseDoubleClickAction", L"", false);
|
||||
m_LeftMouseDoubleClickAction = parser.ReadString(section, L"LeftMouseDoubleClickAction", L"", false);
|
||||
m_RightMouseDoubleClickAction = parser.ReadString(section, L"RightMouseDoubleClickAction", L"", false);
|
||||
m_MiddleMouseDoubleClickAction = parser.ReadString(section, L"MiddleMouseDoubleClickAction", L"", false);
|
||||
m_MouseOverAction = parser.ReadString(section, L"MouseOverAction", L"", false);
|
||||
m_MouseLeaveAction = parser.ReadString(section, L"MouseLeaveAction", L"", false);
|
||||
|
@ -92,6 +92,7 @@ public:
|
||||
bool IsMouseOver() { return m_MouseOver; }
|
||||
|
||||
const WCHAR* GetName() { return m_Name.c_str(); }
|
||||
const std::wstring& GetOriginalName() { return m_Name; }
|
||||
|
||||
void ResetUpdateCounter() { m_UpdateCounter = m_UpdateDivider; }
|
||||
int GetUpdateCounter() { return m_UpdateCounter; }
|
||||
@ -156,14 +157,14 @@ protected:
|
||||
|
||||
HWND m_ToolTipHandle;
|
||||
|
||||
std::wstring m_RightMouseDownAction; // Actions for left and right and middle mouse buttons
|
||||
std::wstring m_RightMouseUpAction;
|
||||
std::wstring m_RightMouseDoubleClickAction;
|
||||
std::wstring m_LeftMouseDownAction;
|
||||
std::wstring m_LeftMouseUpAction;
|
||||
std::wstring m_LeftMouseDoubleClickAction;
|
||||
std::wstring m_LeftMouseDownAction; // Actions for left/right/middle mouse buttons
|
||||
std::wstring m_RightMouseDownAction;
|
||||
std::wstring m_MiddleMouseDownAction;
|
||||
std::wstring m_LeftMouseUpAction;
|
||||
std::wstring m_RightMouseUpAction;
|
||||
std::wstring m_MiddleMouseUpAction;
|
||||
std::wstring m_LeftMouseDoubleClickAction;
|
||||
std::wstring m_RightMouseDoubleClickAction;
|
||||
std::wstring m_MiddleMouseDoubleClickAction;
|
||||
std::wstring m_MouseOverAction;
|
||||
std::wstring m_MouseLeaveAction;
|
||||
|
@ -1468,11 +1468,11 @@ void CMeterWindow::SetOption(const WCHAR* arg, bool group)
|
||||
|
||||
if (value.empty())
|
||||
{
|
||||
GetParser().DeleteValue((*j)->GetName(), option);
|
||||
GetParser().DeleteValue((*j)->GetOriginalName(), option);
|
||||
}
|
||||
else
|
||||
{
|
||||
GetParser().SetValue((*j)->GetName(), option, value);
|
||||
GetParser().SetValue((*j)->GetOriginalName(), option, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2138,14 +2138,14 @@ bool CMeterWindow::ReadSkin()
|
||||
}
|
||||
}
|
||||
|
||||
m_RightMouseDownAction = m_Parser.ReadString(L"Rainmeter", L"RightMouseDownAction", L"", false);
|
||||
m_LeftMouseDownAction = m_Parser.ReadString(L"Rainmeter", L"LeftMouseDownAction", L"", false);
|
||||
m_RightMouseDownAction = m_Parser.ReadString(L"Rainmeter", L"RightMouseDownAction", L"", false);
|
||||
m_MiddleMouseDownAction = m_Parser.ReadString(L"Rainmeter", L"MiddleMouseDownAction", L"", false);
|
||||
m_RightMouseUpAction = m_Parser.ReadString(L"Rainmeter", L"RightMouseUpAction", L"", false);
|
||||
m_LeftMouseUpAction = m_Parser.ReadString(L"Rainmeter", L"LeftMouseUpAction", L"", false);
|
||||
m_RightMouseUpAction = m_Parser.ReadString(L"Rainmeter", L"RightMouseUpAction", L"", false);
|
||||
m_MiddleMouseUpAction = m_Parser.ReadString(L"Rainmeter", L"MiddleMouseUpAction", L"", false);
|
||||
m_RightMouseDoubleClickAction = m_Parser.ReadString(L"Rainmeter", L"RightMouseDoubleClickAction", L"", false);
|
||||
m_LeftMouseDoubleClickAction = m_Parser.ReadString(L"Rainmeter", L"LeftMouseDoubleClickAction", L"", false);
|
||||
m_RightMouseDoubleClickAction = m_Parser.ReadString(L"Rainmeter", L"RightMouseDoubleClickAction", L"", false);
|
||||
m_MiddleMouseDoubleClickAction = m_Parser.ReadString(L"Rainmeter", L"MiddleMouseDoubleClickAction", L"", false);
|
||||
m_MouseOverAction = m_Parser.ReadString(L"Rainmeter", L"MouseOverAction", L"", false);
|
||||
m_MouseLeaveAction = m_Parser.ReadString(L"Rainmeter", L"MouseLeaveAction", L"", false);
|
||||
|
@ -360,14 +360,14 @@ private:
|
||||
|
||||
HWND m_Window; // Handle to the Rainmeter window
|
||||
|
||||
std::wstring m_RightMouseDownAction; // Action to run when right mouse is pressed
|
||||
std::wstring m_LeftMouseDownAction; // Action to run when left mouse is pressed
|
||||
std::wstring m_RightMouseDownAction; // Action to run when right mouse is pressed
|
||||
std::wstring m_MiddleMouseDownAction; // Action to run when middle mouse is pressed
|
||||
std::wstring m_RightMouseUpAction; // Action to run when right mouse is released
|
||||
std::wstring m_LeftMouseUpAction; // Action to run when left mouse is released
|
||||
std::wstring m_RightMouseUpAction; // Action to run when right mouse is released
|
||||
std::wstring m_MiddleMouseUpAction; // Action to run when middle mouse is released
|
||||
std::wstring m_RightMouseDoubleClickAction; // Action to run when right mouse is double-clicked
|
||||
std::wstring m_LeftMouseDoubleClickAction; // Action to run when left mouse is double-clicked
|
||||
std::wstring m_RightMouseDoubleClickAction; // Action to run when right mouse is double-clicked
|
||||
std::wstring m_MiddleMouseDoubleClickAction; // Action to run when middle mouse is double-clicked
|
||||
std::wstring m_MouseOverAction; // Action to run when mouse goes over the window
|
||||
std::wstring m_MouseLeaveAction; // Action to run when mouse leaves the window
|
||||
|
@ -1148,10 +1148,10 @@ void CRainmeter::ActivateActiveConfigs()
|
||||
std::multimap<int, int>::const_iterator iter = m_ConfigOrders.begin();
|
||||
for ( ; iter != m_ConfigOrders.end(); ++iter)
|
||||
{
|
||||
const CONFIG& config = m_ConfigStrings[(*iter).second];
|
||||
if (config.active > 0 && config.active <= (int)config.iniFiles.size())
|
||||
const CONFIG& configS = m_ConfigStrings[(*iter).second];
|
||||
if (configS.active > 0 && configS.active <= (int)configS.iniFiles.size())
|
||||
{
|
||||
ActivateConfig((*iter).second, config.active - 1);
|
||||
ActivateConfig((*iter).second, configS.active - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1403,12 +1403,13 @@ std::pair<int, int> CRainmeter::GetMeterWindowIndex(const std::wstring& config,
|
||||
|
||||
for (int i = 0, isize = (int)m_ConfigStrings.size(); i < isize; ++i)
|
||||
{
|
||||
if (_wcsicmp(m_ConfigStrings[i].config.c_str(), configName) == 0)
|
||||
const CONFIG& configS = m_ConfigStrings[i];
|
||||
if (_wcsicmp(configS.config.c_str(), configName) == 0)
|
||||
{
|
||||
const WCHAR* iniFileName = iniFile.c_str();
|
||||
for (int j = 0, jsize = (int)m_ConfigStrings[i].iniFiles.size(); j < jsize; ++j)
|
||||
for (int j = 0, jsize = (int)configS.iniFiles.size(); j < jsize; ++j)
|
||||
{
|
||||
if (_wcsicmp(m_ConfigStrings[i].iniFiles[j].c_str(), iniFileName) == 0)
|
||||
if (_wcsicmp(configS.iniFiles[j].c_str(), iniFileName) == 0)
|
||||
{
|
||||
indexes = std::make_pair(i, j);
|
||||
return indexes;
|
||||
@ -1430,10 +1431,11 @@ std::pair<int, int> CRainmeter::GetMeterWindowIndex(UINT menuCommand)
|
||||
// Check which config was selected
|
||||
for (size_t i = 0, isize = m_ConfigStrings.size(); i < isize; ++i)
|
||||
{
|
||||
if (menuCommand >= m_ConfigStrings[i].commandBase &&
|
||||
menuCommand < (m_ConfigStrings[i].commandBase + m_ConfigStrings[i].iniFiles.size()))
|
||||
const CONFIG& configS = m_ConfigStrings[i];
|
||||
if (menuCommand >= configS.commandBase &&
|
||||
menuCommand < (configS.commandBase + configS.iniFiles.size()))
|
||||
{
|
||||
indexes = std::make_pair(i, menuCommand - m_ConfigStrings[i].commandBase);
|
||||
indexes = std::make_pair(i, menuCommand - configS.commandBase);
|
||||
return indexes;
|
||||
}
|
||||
}
|
||||
@ -1443,7 +1445,6 @@ std::pair<int, int> CRainmeter::GetMeterWindowIndex(UINT menuCommand)
|
||||
return indexes;
|
||||
}
|
||||
|
||||
|
||||
CMeterWindow* CRainmeter::GetMeterWindow(HWND hwnd)
|
||||
{
|
||||
std::map<std::wstring, CMeterWindow*>::const_iterator iter = m_Meters.begin();
|
||||
@ -1593,6 +1594,8 @@ int CRainmeter::ScanForConfigsRecursive(const std::wstring& path, std::wstring b
|
||||
base += L"\\";
|
||||
}
|
||||
|
||||
menu.reserve(menu.size() + folders.size());
|
||||
|
||||
std::list<std::wstring>::const_iterator iter = folders.begin();
|
||||
for ( ; iter != folders.end(); ++iter)
|
||||
{
|
||||
@ -2227,15 +2230,16 @@ void CRainmeter::ReadGeneralSettings(const std::wstring& iniFile)
|
||||
|
||||
for (int i = 0, isize = (int)m_ConfigStrings.size(); i < isize; ++i)
|
||||
{
|
||||
int active = parser.ReadInt(m_ConfigStrings[i].config.c_str(), L"Active", 0);
|
||||
CONFIG& configS = m_ConfigStrings[i];
|
||||
int active = parser.ReadInt(configS.config.c_str(), L"Active", 0);
|
||||
|
||||
// Make sure there is a ini file available
|
||||
if (active > 0 && active <= (int)m_ConfigStrings[i].iniFiles.size())
|
||||
if (active > 0 && active <= (int)configS.iniFiles.size())
|
||||
{
|
||||
m_ConfigStrings[i].active = active;
|
||||
configS.active = active;
|
||||
}
|
||||
|
||||
int order = parser.ReadInt(m_ConfigStrings[i].config.c_str(), L"LoadOrder", 0);
|
||||
int order = parser.ReadInt(configS.config.c_str(), L"LoadOrder", 0);
|
||||
SetLoadOrder(i, order);
|
||||
}
|
||||
}
|
||||
@ -2277,19 +2281,20 @@ void CRainmeter::RefreshAll()
|
||||
const std::wstring& skinConfig = mw->GetSkinName();
|
||||
for (int i = 0, isize = (int)m_ConfigStrings.size(); i < isize; ++i)
|
||||
{
|
||||
if (_wcsicmp(skinConfig.c_str(), m_ConfigStrings[i].config.c_str()) == 0)
|
||||
CONFIG& configS = m_ConfigStrings[i];
|
||||
if (_wcsicmp(skinConfig.c_str(), configS.config.c_str()) == 0)
|
||||
{
|
||||
found = 1;
|
||||
const std::wstring& skinIniFile = mw->GetSkinIniFile();
|
||||
for (int j = 0, jsize = (int)m_ConfigStrings[i].iniFiles.size(); j < jsize; ++j)
|
||||
for (int j = 0, jsize = (int)configS.iniFiles.size(); j < jsize; ++j)
|
||||
{
|
||||
if (_wcsicmp(skinIniFile.c_str(), m_ConfigStrings[i].iniFiles[j].c_str()) == 0)
|
||||
if (_wcsicmp(skinIniFile.c_str(), configS.iniFiles[j].c_str()) == 0)
|
||||
{
|
||||
found = 2;
|
||||
if (m_ConfigStrings[i].active != j + 1)
|
||||
if (configS.active != j + 1)
|
||||
{
|
||||
// Switch to new ini-file order
|
||||
m_ConfigStrings[i].active = j + 1;
|
||||
configS.active = j + 1;
|
||||
WriteActive(skinConfig, j);
|
||||
}
|
||||
break;
|
||||
@ -2738,9 +2743,10 @@ HMENU CRainmeter::CreateConfigMenu(HMENU configMenu, const std::vector<CONFIGMEN
|
||||
bool separator = false;
|
||||
for (int i = 0, j = 0, isize = (int)configMenuData.size(); i < isize; ++i)
|
||||
{
|
||||
if (configMenuData[i].index == -1)
|
||||
const CONFIGMENU& configMenuS = configMenuData[i];
|
||||
if (configMenuS.index == -1)
|
||||
{
|
||||
HMENU submenu = CreateConfigMenu(NULL, configMenuData[i].children);
|
||||
HMENU submenu = CreateConfigMenu(NULL, configMenuS.children);
|
||||
if (submenu)
|
||||
{
|
||||
if (separator)
|
||||
@ -2750,13 +2756,13 @@ HMENU CRainmeter::CreateConfigMenu(HMENU configMenu, const std::vector<CONFIGMEN
|
||||
++j;
|
||||
separator = false;
|
||||
}
|
||||
InsertMenu(configMenu, i + j, MF_BYPOSITION | MF_POPUP, (UINT_PTR)submenu, configMenuData[i].name.c_str());
|
||||
InsertMenu(configMenu, i + j, MF_BYPOSITION | MF_POPUP, (UINT_PTR)submenu, configMenuS.name.c_str());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CONFIG& config = m_ConfigStrings[configMenuData[i].index];
|
||||
InsertMenu(configMenu, i, MF_BYPOSITION | ((config.active == i + 1) ? MF_CHECKED : MF_UNCHECKED), config.commandBase + i, configMenuData[i].name.c_str());
|
||||
const CONFIG& configS = m_ConfigStrings[configMenuS.index];
|
||||
InsertMenu(configMenu, i, MF_BYPOSITION | ((configS.active == i + 1) ? MF_CHECKED : MF_UNCHECKED), configS.commandBase + i, configMenuS.name.c_str());
|
||||
separator = true;
|
||||
}
|
||||
}
|
||||
@ -2930,12 +2936,12 @@ HMENU CRainmeter::CreateSkinMenu(CMeterWindow* meterWindow, int index, HMENU con
|
||||
const WCHAR* skin = skinName.c_str();
|
||||
for (int i = 0, isize = (int)m_ConfigStrings.size(); i < isize; ++i)
|
||||
{
|
||||
const CONFIG& config = m_ConfigStrings[i];
|
||||
if (_wcsicmp(config.config.c_str(), skin) == 0)
|
||||
const CONFIG& configS = m_ConfigStrings[i];
|
||||
if (_wcsicmp(configS.config.c_str(), skin) == 0)
|
||||
{
|
||||
for (int j = 0, jsize = (int)config.iniFiles.size(); j < jsize; ++j)
|
||||
for (int j = 0, jsize = (int)configS.iniFiles.size(); j < jsize; ++j)
|
||||
{
|
||||
InsertMenu(variantsMenu, j, MF_BYPOSITION | ((config.active == j + 1) ? MF_CHECKED : MF_UNCHECKED), config.commandBase + j, config.iniFiles[j].c_str());
|
||||
InsertMenu(variantsMenu, j, MF_BYPOSITION | ((configS.active == j + 1) ? MF_CHECKED : MF_UNCHECKED), configS.commandBase + j, configS.iniFiles[j].c_str());
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ void CSystem::Initialize(HINSTANCE instance)
|
||||
|
||||
SetOSPlatform();
|
||||
|
||||
c_Monitors.monitors.reserve(8);
|
||||
c_Monitors.monitors.reserve(4);
|
||||
SetMultiMonitorInfo();
|
||||
|
||||
WCHAR directory[MAX_PATH] = {0};
|
||||
|
@ -19,9 +19,9 @@ static int Measure_GetOption(lua_State* L)
|
||||
CConfigParser& parser = meterWindow->GetParser();
|
||||
|
||||
std::wstring strTmp = LuaManager::ToWide(L, 2);
|
||||
strTmp = parser.GetValue(self->GetName(), strTmp, L"");
|
||||
strTmp = parser.GetValue(self->GetOriginalName(), strTmp, L"");
|
||||
|
||||
parser.SetBuiltInVariable(L"CURRENTSECTION", self->GetName()); // Set temporarily
|
||||
parser.SetBuiltInVariable(L"CURRENTSECTION", self->GetOriginalName()); // Set temporarily
|
||||
parser.ReplaceVariables(strTmp);
|
||||
parser.SetBuiltInVariable(L"CURRENTSECTION", L""); // Reset
|
||||
parser.ReplaceMeasures(strTmp);
|
||||
|
@ -18,9 +18,9 @@ static int Meter_GetOption(lua_State* L)
|
||||
CConfigParser& parser = meterWindow->GetParser();
|
||||
|
||||
std::wstring strTmp = LuaManager::ToWide(L, 2);
|
||||
strTmp = parser.GetValue(self->GetName(), strTmp, L"");
|
||||
strTmp = parser.GetValue(self->GetOriginalName(), strTmp, L"");
|
||||
|
||||
parser.SetBuiltInVariable(L"CURRENTSECTION", self->GetName()); // Set temporarily
|
||||
parser.SetBuiltInVariable(L"CURRENTSECTION", self->GetOriginalName()); // Set temporarily
|
||||
parser.ReplaceVariables(strTmp);
|
||||
parser.SetBuiltInVariable(L"CURRENTSECTION", L""); // Reset
|
||||
parser.ReplaceMeasures(strTmp);
|
||||
|
Loading…
Reference in New Issue
Block a user