mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Tweaks.
This commit is contained in:
parent
20e2a53324
commit
8515877c48
@ -80,7 +80,8 @@ void CConfigParser::Initialize(LPCTSTR filename, CRainmeter* pRainmeter, CMeterW
|
|||||||
ReadIniFile(iniFileMappings, m_Filename, config);
|
ReadIniFile(iniFileMappings, m_Filename, config);
|
||||||
ReadVariables();
|
ReadVariables();
|
||||||
|
|
||||||
std::unordered_set<std::wstring>().swap(m_FoundSections); // clear and minimize
|
// Clear and minimize
|
||||||
|
std::vector<std::wstring>().swap(m_ListVariables);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1107,6 +1108,8 @@ void CConfigParser::ReadIniFile(const std::vector<std::wstring>& iniFileMappings
|
|||||||
{
|
{
|
||||||
m_Sections.push_back(L"Rainmeter");
|
m_Sections.push_back(L"Rainmeter");
|
||||||
m_Sections.push_back(config);
|
m_Sections.push_back(config);
|
||||||
|
m_FoundSections.insert(L"rainmeter");
|
||||||
|
m_FoundSections.insert(StrToLower(config));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,6 +72,7 @@ public:
|
|||||||
|
|
||||||
const std::wstring& GetFilename() { return m_Filename; }
|
const std::wstring& GetFilename() { return m_Filename; }
|
||||||
const std::vector<std::wstring>& GetSections() { return m_Sections; }
|
const std::vector<std::wstring>& GetSections() { return m_Sections; }
|
||||||
|
bool IsSectionDefined(LPCTSTR section) { return m_FoundSections.find(StrToLower(section)) != m_FoundSections.end(); }
|
||||||
|
|
||||||
bool ReplaceVariables(std::wstring& result);
|
bool ReplaceVariables(std::wstring& result);
|
||||||
bool ReplaceMeasures(std::wstring& result);
|
bool ReplaceMeasures(std::wstring& result);
|
||||||
|
@ -2516,31 +2516,8 @@ void CRainmeter::GetMeterWindowsByLoadOrder(std::multimap<int, CMeterWindow*>& w
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CRainmeter::SetConfigOrder(int configIndex)
|
void CRainmeter::SetLoadOrder(int configIndex, int order)
|
||||||
{
|
{
|
||||||
WCHAR buffer[256];
|
|
||||||
int order;
|
|
||||||
|
|
||||||
if (GetPrivateProfileString(m_ConfigStrings[configIndex].config.c_str(), L"LoadOrder", L"", buffer, 256, m_IniFile.c_str()) > 0)
|
|
||||||
{
|
|
||||||
if (_wcsicmp(buffer, L"LAST") == 0)
|
|
||||||
{
|
|
||||||
order = INT_MAX;
|
|
||||||
}
|
|
||||||
else if (_wcsicmp(buffer, L"FIRST") == 0)
|
|
||||||
{
|
|
||||||
order = INT_MIN;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
order = _wtoi(buffer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else // LoadOrder not exists
|
|
||||||
{
|
|
||||||
order = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::multimap<int, int>::iterator iter = m_ConfigOrders.begin();
|
std::multimap<int, int>::iterator iter = m_ConfigOrders.begin();
|
||||||
for ( ; iter != m_ConfigOrders.end(); ++iter)
|
for ( ; iter != m_ConfigOrders.end(); ++iter)
|
||||||
{
|
{
|
||||||
@ -3394,7 +3371,6 @@ void CRainmeter::ReadGeneralSettings(const std::wstring& iniFile)
|
|||||||
|
|
||||||
for (UINT i = 1; i <= CSystem::GetMonitorCount(); ++i)
|
for (UINT i = 1; i <= CSystem::GetMonitorCount(); ++i)
|
||||||
{
|
{
|
||||||
WCHAR buffer[64];
|
|
||||||
_snwprintf_s(buffer, _TRUNCATE, L"DesktopWorkArea@%i", i);
|
_snwprintf_s(buffer, _TRUNCATE, L"DesktopWorkArea@%i", i);
|
||||||
area = parser.ReadString(L"Rainmeter", buffer, L"");
|
area = parser.ReadString(L"Rainmeter", buffer, L"");
|
||||||
if (!area.empty())
|
if (!area.empty())
|
||||||
@ -3450,7 +3426,33 @@ void CRainmeter::ReadGeneralSettings(const std::wstring& iniFile)
|
|||||||
m_ConfigStrings[i].active = active;
|
m_ConfigStrings[i].active = active;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetConfigOrder(i);
|
int order;
|
||||||
|
if (parser.IsSectionDefined(m_ConfigStrings[i].config.c_str()))
|
||||||
|
{
|
||||||
|
std::wstring orderStr = parser.ReadString(m_ConfigStrings[i].config.c_str(), L"LoadOrder", L"", false);
|
||||||
|
if (orderStr.empty())
|
||||||
|
{
|
||||||
|
order = 0;
|
||||||
|
}
|
||||||
|
else if (_wcsicmp(orderStr.c_str(), L"LAST") == 0)
|
||||||
|
{
|
||||||
|
order = INT_MAX;
|
||||||
|
}
|
||||||
|
else if (_wcsicmp(orderStr.c_str(), L"FIRST") == 0)
|
||||||
|
{
|
||||||
|
order = INT_MIN;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
order = _wtoi(orderStr.c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
order = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
SetLoadOrder(i, order);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -263,7 +263,7 @@ private:
|
|||||||
void ScanForConfigs(const std::wstring& path);
|
void ScanForConfigs(const std::wstring& path);
|
||||||
void ScanForThemes(const std::wstring& path);
|
void ScanForThemes(const std::wstring& path);
|
||||||
void ReadGeneralSettings(const std::wstring& iniFile);
|
void ReadGeneralSettings(const std::wstring& iniFile);
|
||||||
void SetConfigOrder(int configIndex);
|
void SetLoadOrder(int configIndex, int order);
|
||||||
int GetLoadOrder(const std::wstring& config);
|
int GetLoadOrder(const std::wstring& config);
|
||||||
bool SetActiveConfig(const std::wstring& skinName, const std::wstring& skinIni);
|
bool SetActiveConfig(const std::wstring& skinName, const std::wstring& skinIni);
|
||||||
void UpdateDesktopWorkArea(bool reset);
|
void UpdateDesktopWorkArea(bool reset);
|
||||||
|
@ -272,17 +272,27 @@ HICON CTrayWindow::CreateTrayIcon(double value)
|
|||||||
|
|
||||||
void CTrayWindow::ReadConfig(CConfigParser& parser)
|
void CTrayWindow::ReadConfig(CConfigParser& parser)
|
||||||
{
|
{
|
||||||
|
// Clear old Settings
|
||||||
KillTimer(m_Window, TRAYTIMER);
|
KillTimer(m_Window, TRAYTIMER);
|
||||||
|
|
||||||
delete m_Measure;
|
delete m_Measure;
|
||||||
m_Measure = NULL;
|
m_Measure = NULL;
|
||||||
|
|
||||||
|
delete m_Bitmap;
|
||||||
|
m_Bitmap = NULL;
|
||||||
|
|
||||||
for (size_t i = 0, isize = m_TrayIcons.size(); i < isize; ++i)
|
for (size_t i = 0, isize = m_TrayIcons.size(); i < isize; ++i)
|
||||||
{
|
{
|
||||||
DestroyIcon(m_TrayIcons[i]);
|
DestroyIcon(m_TrayIcons[i]);
|
||||||
}
|
}
|
||||||
m_TrayIcons.clear();
|
m_TrayIcons.clear();
|
||||||
|
|
||||||
|
m_MeterType = TRAY_METER_TYPE_NONE;
|
||||||
|
|
||||||
|
// Read tray settings
|
||||||
|
m_TrayIconEnabled = 0!=parser.ReadInt(L"Rainmeter", L"TrayIcon", 1);
|
||||||
|
if (m_TrayIconEnabled)
|
||||||
|
{
|
||||||
std::wstring measureName = parser.ReadString(L"TrayMeasure", L"Measure", L"");
|
std::wstring measureName = parser.ReadString(L"TrayMeasure", L"Measure", L"");
|
||||||
|
|
||||||
if (!measureName.empty())
|
if (!measureName.empty())
|
||||||
@ -308,10 +318,12 @@ void CTrayWindow::ReadConfig(CConfigParser& parser)
|
|||||||
Rainmeter->SetCurrentParser(oldParser);
|
Rainmeter->SetCurrentParser(oldParser);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_MeterType = TRAY_METER_TYPE_NONE;
|
std::wstring type = parser.ReadString(L"TrayMeasure", L"TrayMeter", m_Measure ? L"HISTOGRAM" : L"NONE");
|
||||||
|
if (_wcsicmp(type.c_str(), L"NONE") == 0)
|
||||||
std::wstring type = parser.ReadString(L"TrayMeasure", L"TrayMeter", L"HISTOGRAM");
|
{
|
||||||
if (_wcsicmp(type.c_str(), L"HISTOGRAM") == 0)
|
// Use main icon
|
||||||
|
}
|
||||||
|
else if (_wcsicmp(type.c_str(), L"HISTOGRAM") == 0)
|
||||||
{
|
{
|
||||||
m_MeterType = TRAY_METER_TYPE_HISTOGRAM;
|
m_MeterType = TRAY_METER_TYPE_HISTOGRAM;
|
||||||
m_TrayColor1 = parser.ReadColor(L"TrayMeasure", L"TrayColor1", Color(0, 100, 0));
|
m_TrayColor1 = parser.ReadColor(L"TrayMeasure", L"TrayColor1", Color(0, 100, 0));
|
||||||
@ -368,9 +380,6 @@ void CTrayWindow::ReadConfig(CConfigParser& parser)
|
|||||||
LogWithArgs(LOG_ERROR, L"No such TrayMeter: %s", type.c_str());
|
LogWithArgs(LOG_ERROR, L"No such TrayMeter: %s", type.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
m_TrayIconEnabled = 0!=parser.ReadInt(L"Rainmeter", L"TrayIcon", 1);
|
|
||||||
if (m_TrayIconEnabled)
|
|
||||||
{
|
|
||||||
AddTrayIcon();
|
AddTrayIcon();
|
||||||
|
|
||||||
if (m_Measure)
|
if (m_Measure)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user