diff --git a/Library/ConfigParser.cpp b/Library/ConfigParser.cpp index e0635472..d501980e 100644 --- a/Library/ConfigParser.cpp +++ b/Library/ConfigParser.cpp @@ -51,7 +51,7 @@ CConfigParser::~CConfigParser() { } -void CConfigParser::Initialize(const std::wstring& filename, CMeterWindow* meterWindow, LPCTSTR config, const std::wstring* resourcePath) +void CConfigParser::Initialize(const std::wstring& filename, CMeterWindow* meterWindow, LPCTSTR skinSection, const std::wstring* resourcePath) { m_Measures.clear(); m_Sections.clear(); @@ -73,7 +73,7 @@ void CConfigParser::Initialize(const std::wstring& filename, CMeterWindow* meter CSystem::UpdateIniFileMappingList(); - ReadIniFile(filename, config); + ReadIniFile(filename, skinSection); ReadVariables(); // Clear and minimize @@ -98,9 +98,9 @@ void CConfigParser::SetBuiltInVariables(const std::wstring& filename, const std: if (meterWindow) { - insertVariable(L"CURRENTFILE", meterWindow->GetSkinIniFile()); - insertVariable(L"CURRENTCONFIG", meterWindow->GetSkinName()); - insertVariable(L"ROOTCONFIGPATH", meterWindow->GetSkinRootPath()); + insertVariable(L"CURRENTFILE", meterWindow->GetFileName()); + insertVariable(L"CURRENTCONFIG", meterWindow->GetFolderPath()); + insertVariable(L"ROOTCONFIGPATH", meterWindow->GetRootPath()); } insertVariable(L"CRLF", L"\n"); @@ -1156,7 +1156,7 @@ RECT CConfigParser::ParseRECT(LPCTSTR string) ** Reads the given ini file and fills the m_Values and m_Keys maps. ** */ -void CConfigParser::ReadIniFile(const std::wstring& iniFile, LPCTSTR config, int depth) +void CConfigParser::ReadIniFile(const std::wstring& iniFile, LPCTSTR skinSection, int depth) { if (depth > 100) // Is 100 enough to assume the include loop never ends? { @@ -1195,7 +1195,7 @@ void CConfigParser::ReadIniFile(const std::wstring& iniFile, LPCTSTR config, int WCHAR* pos = NULL; WCHAR* epos = NULL; - if (config == NULL) + if (skinSection == NULL) { // Get all the sections do @@ -1248,15 +1248,15 @@ void CConfigParser::ReadIniFile(const std::wstring& iniFile, LPCTSTR config, int { // Special case: Read only "Rainmeter" and specified section from "Rainmeter.ini" const std::wstring strRainmeter = L"Rainmeter"; - const std::wstring strConfig = config; + const std::wstring strFolder = skinSection; sections.push_back(strRainmeter); - sections.push_back(strConfig); + sections.push_back(strFolder); if (depth == 0) // Add once { m_Sections.push_back(strRainmeter); - m_Sections.push_back(strConfig); + m_Sections.push_back(strFolder); } } @@ -1268,7 +1268,7 @@ void CConfigParser::ReadIniFile(const std::wstring& iniFile, LPCTSTR config, int const WCHAR* sectionName = (*iter).c_str(); bool isVariables = (_wcsicmp(sectionName, L"Variables") == 0); - bool isMetadata = (config == NULL && !isVariables && _wcsicmp(sectionName, L"Metadata") == 0); + bool isMetadata = (skinSection == NULL && !isVariables && _wcsicmp(sectionName, L"Metadata") == 0); // Read all "key=value" from the section do @@ -1323,7 +1323,7 @@ void CConfigParser::ReadIniFile(const std::wstring& iniFile, LPCTSTR config, int // Relative to the ini folder value.insert(0, CRainmeter::ExtractPath(iniFile)); } - ReadIniFile(value, config, depth + 1); + ReadIniFile(value, skinSection, depth + 1); } } else diff --git a/Library/ConfigParser.h b/Library/ConfigParser.h index 1796d328..ce646313 100644 --- a/Library/ConfigParser.h +++ b/Library/ConfigParser.h @@ -40,7 +40,7 @@ public: CConfigParser(); ~CConfigParser(); - void Initialize(const std::wstring& filename, CMeterWindow* meterWindow = NULL, LPCTSTR config = NULL, const std::wstring* resourcePath = NULL); + void Initialize(const std::wstring& filename, CMeterWindow* meterWindow = NULL, LPCTSTR skinSection = NULL, const std::wstring* resourcePath = NULL); void AddMeasure(CMeasure* pMeasure); bool GetVariable(const std::wstring& strVariable, std::wstring& strValue); @@ -106,7 +106,7 @@ private: CMeasure* GetMeasure(const std::wstring& name); - void ReadIniFile(const std::wstring& iniFile, LPCTSTR config = NULL, int depth = 0); + void ReadIniFile(const std::wstring& iniFile, LPCTSTR skinSection = NULL, int depth = 0); void SetAutoSelectedMonitorVariables(CMeterWindow* meterWindow); diff --git a/Library/DialogAbout.cpp b/Library/DialogAbout.cpp index 9861d023..a0af2866 100644 --- a/Library/DialogAbout.cpp +++ b/Library/DialogAbout.cpp @@ -405,7 +405,7 @@ void CDialogAbout::CTabLog::Initialize() ListView_InsertColumn(item, 2, &lvc); // Add stored entires - std::list::const_iterator iter = Rainmeter->GetAboutLogData().begin(); + std::list::const_iterator iter = Rainmeter->GetAboutLogData().begin(); for ( ; iter != Rainmeter->GetAboutLogData().end(); ++iter) { AddItem((*iter).level, (*iter).timestamp.c_str(), (*iter).message.c_str()); diff --git a/Library/DialogManage.cpp b/Library/DialogManage.cpp index 23f90fa3..028721c9 100644 --- a/Library/DialogManage.cpp +++ b/Library/DialogManage.cpp @@ -117,8 +117,8 @@ void CDialogManage::OpenSkin(CMeterWindow* meterWindow) if (c_Dialog) { - std::wstring name = meterWindow->GetSkinName() + L'\\'; - name += meterWindow->GetSkinIniFile(); + std::wstring name = meterWindow->GetFolderPath() + L'\\'; + name += meterWindow->GetFileName(); HWND item = GetDlgItem(c_Dialog->m_TabSkins.GetWindow(), IDC_MANAGESKINS_SKINS_TREEVIEW); c_Dialog->m_TabSkins.SelectTreeItem(item, TreeView_GetRoot(item), name.c_str()); @@ -444,8 +444,8 @@ void CDialogManage::CTabSkins::Update(CMeterWindow* meterWindow, bool deleted) } m_HandleCommands = true; } - else if (wcscmp(meterWindow->GetSkinName().c_str(), m_SkinName.c_str()) == 0 && - wcscmp(meterWindow->GetSkinIniFile().c_str(), m_FileName.c_str()) == 0) + else if (wcscmp(meterWindow->GetFolderPath().c_str(), m_SkinFolderPath.c_str()) == 0 && + wcscmp(meterWindow->GetFileName().c_str(), m_SkinFileName.c_str()) == 0) { ReadSkin(); } @@ -535,7 +535,7 @@ void CDialogManage::CTabSkins::SetControls() item = GetDlgItem(m_Window, IDC_MANAGESKINS_LOADORDER_TEXT); EnableWindow(item, TRUE); - _itow_s(Rainmeter->GetLoadOrder(m_SkinName), buffer, 10); + _itow_s(Rainmeter->GetLoadOrder(m_SkinFolderPath), buffer, 10); SetWindowText(item, buffer); item = GetDlgItem(m_Window, IDC_MANAGESKINS_ONHOVER_COMBOBOX); @@ -641,17 +641,17 @@ void CDialogManage::CTabSkins::DisableControls(bool clear) void CDialogManage::CTabSkins::ReadSkin() { HWND item = GetDlgItem(m_Window, IDC_MANAGESKINS_FILE_TEXT); - SetWindowText(item, m_FileName.c_str()); + SetWindowText(item, m_SkinFileName.c_str()); item = GetDlgItem(m_Window, IDC_MANAGESKINS_CONFIG_TEXT); - SetWindowText(item, m_SkinName.c_str()); + SetWindowText(item, m_SkinFolderPath.c_str()); item = GetDlgItem(m_Window, IDC_MANAGESKINS_EDIT_BUTTON); EnableWindow(item, TRUE); - std::wstring file = Rainmeter->GetSkinPath() + m_SkinName; + std::wstring file = Rainmeter->GetSkinPath() + m_SkinFolderPath; file += L'\\'; - file += m_FileName; + file += m_SkinFileName; m_SkinWindow = Rainmeter->GetMeterWindowByINI(file); if (!m_SkinWindow) { @@ -746,8 +746,8 @@ int CDialogManage::CTabSkins::PopulateTree(HWND tree, TVINSERTSTRUCT& tvi, int i const size_t max = Rainmeter->m_SkinFolders.size(); while (index < max) { - const CRainmeter::SkinFolder& folder = Rainmeter->m_SkinFolders[index]; - if (folder.level != initialLevel) + const CRainmeter::SkinFolder& skinFolder = Rainmeter->m_SkinFolders[index]; + if (skinFolder.level != initialLevel) { return index - 1; } @@ -756,7 +756,7 @@ int CDialogManage::CTabSkins::PopulateTree(HWND tree, TVINSERTSTRUCT& tvi, int i // Add folder tvi.item.iImage = tvi.item.iSelectedImage = 0; - tvi.item.pszText = (WCHAR*)folder.name.c_str(); + tvi.item.pszText = (WCHAR*)skinFolder.name.c_str(); tvi.hParent = TreeView_InsertItem(tree, &tvi); // Add subfolders @@ -768,9 +768,9 @@ int CDialogManage::CTabSkins::PopulateTree(HWND tree, TVINSERTSTRUCT& tvi, int i // Add files tvi.item.iImage = tvi.item.iSelectedImage = 1; - for (int i = 0, isize = (int)folder.files.size(); i < isize; ++i) + for (int i = 0, isize = (int)skinFolder.files.size(); i < isize; ++i) { - tvi.item.pszText = (WCHAR*)folder.files[i].c_str(); + tvi.item.pszText = (WCHAR*)skinFolder.files[i].c_str(); TreeView_InsertItem(tree, &tvi); } @@ -873,8 +873,8 @@ INT_PTR CDialogManage::CTabSkins::OnCommand(WPARAM wParam, LPARAM lParam) int index = 0; for ( ; iter != Rainmeter->GetAllMeterWindows().end(); ++iter) { - std::wstring name = ((*iter).second)->GetSkinName() + L'\\'; - name += ((*iter).second)->GetSkinIniFile(); + std::wstring name = ((*iter).second)->GetFolderPath() + L'\\'; + name += ((*iter).second)->GetFileName(); InsertMenu(menu, index, MF_BYPOSITION, ID_CONFIG_FIRST + index, name.c_str()); ++index; } @@ -905,10 +905,10 @@ INT_PTR CDialogManage::CTabSkins::OnCommand(WPARAM wParam, LPARAM lParam) if (!m_SkinWindow) { // Skin not active, load - std::pair indexes = Rainmeter->GetMeterWindowIndex(m_SkinName, m_FileName); + std::pair indexes = Rainmeter->GetMeterWindowIndex(m_SkinFolderPath, m_SkinFileName); if (indexes.first != -1 && indexes.second != -1) { - Rainmeter->ActivateConfig(indexes.first, indexes.second); + Rainmeter->ActivateSkin(indexes.first, indexes.second); // Fake selection change to update controls NMHDR nm; @@ -921,7 +921,7 @@ INT_PTR CDialogManage::CTabSkins::OnCommand(WPARAM wParam, LPARAM lParam) else { m_HandleCommands = false; - Rainmeter->DeactivateConfig(m_SkinWindow, -1); + Rainmeter->DeactivateSkin(m_SkinWindow, -1); } } break; @@ -934,7 +934,7 @@ INT_PTR CDialogManage::CTabSkins::OnCommand(WPARAM wParam, LPARAM lParam) break; case IDC_MANAGESKINS_EDIT_BUTTON: - Rainmeter->EditSkinFile(m_SkinName, m_FileName); + Rainmeter->EditSkinFile(m_SkinFolderPath, m_SkinFileName); break; case IDC_MANAGESKINS_X_TEXT: @@ -1001,7 +1001,7 @@ INT_PTR CDialogManage::CTabSkins::OnCommand(WPARAM wParam, LPARAM lParam) // Reset selection Edit_SetSel((HWND)lParam, LOWORD(sel), HIWORD(sel)); - WritePrivateProfileString(m_SkinName.c_str(), L"LoadOrder", buffer, Rainmeter->GetIniFile().c_str()); + WritePrivateProfileString(m_SkinFolderPath.c_str(), L"LoadOrder", buffer, Rainmeter->GetIniFile().c_str()); std::pair indexes = Rainmeter->GetMeterWindowIndex(m_SkinWindow); if (indexes.first != -1) { @@ -1131,8 +1131,8 @@ INT_PTR CDialogManage::CTabSkins::OnCommand(WPARAM wParam, LPARAM lParam) { if (i == index) { - std::wstring name = ((*iter).second)->GetSkinName() + L'\\'; - name += ((*iter).second)->GetSkinIniFile(); + std::wstring name = ((*iter).second)->GetFolderPath() + L'\\'; + name += ((*iter).second)->GetFileName(); HWND item = GetDlgItem(m_Window, IDC_MANAGESKINS_SKINS_TREEVIEW); SelectTreeItem(item, TreeView_GetRoot(item), name.c_str()); @@ -1167,9 +1167,9 @@ INT_PTR CDialogManage::CTabSkins::OnNotify(WPARAM wParam, LPARAM lParam) case NM_CLICK: if (nm->idFrom == IDC_MANAGESKINS_ADDMETADATA_LINK) { - std::wstring file = Rainmeter->GetSkinPath() + m_SkinName; + std::wstring file = Rainmeter->GetSkinPath() + m_SkinFolderPath; file += L'\\'; - file += m_FileName; + file += m_SkinFileName; WritePrivateProfileString(L"Rainmeter", L"\r\n[Metadata]\r\nName=\r\nInformation=\r\nLicense=\r\nVersion", L"", file.c_str()); SendMessage(m_Window, WM_COMMAND, MAKEWPARAM(IDC_MANAGESKINS_EDIT_BUTTON, 0), 0); ShowWindow(nm->hwndFrom, SW_HIDE); @@ -1177,7 +1177,7 @@ INT_PTR CDialogManage::CTabSkins::OnNotify(WPARAM wParam, LPARAM lParam) break; case NM_DBLCLK: - if (nm->idFrom == IDC_MANAGESKINS_SKINS_TREEVIEW && !m_FileName.empty()) + if (nm->idFrom == IDC_MANAGESKINS_SKINS_TREEVIEW && !m_SkinFileName.empty()) { OnCommand(MAKEWPARAM(IDC_MANAGESKINS_LOAD_BUTTON, 0), 0); } @@ -1209,7 +1209,7 @@ INT_PTR CDialogManage::CTabSkins::OnNotify(WPARAM wParam, LPARAM lParam) mii.cbSize = sizeof(MENUITEMINFO); mii.fMask = MIIM_STRING; - if (m_FileName.empty()) + if (m_SkinFileName.empty()) { // It's a folder subMenu = GetSubMenu(menu, 0); @@ -1259,8 +1259,8 @@ INT_PTR CDialogManage::CTabSkins::OnNotify(WPARAM wParam, LPARAM lParam) if (nm->idFrom == IDC_MANAGESKINS_SKINS_TREEVIEW) { m_SkinWindow = NULL; - m_FileName.clear(); - m_SkinName.clear(); + m_SkinFileName.clear(); + m_SkinFolderPath.clear(); // Temporarily disable handling commands m_HandleCommands = false; @@ -1278,19 +1278,19 @@ INT_PTR CDialogManage::CTabSkins::OnNotify(WPARAM wParam, LPARAM lParam) if (tvi.cChildren == 0) { // Current selection is file - m_FileName = buffer; + m_SkinFileName = buffer; tvi.mask = TVIF_TEXT; - // Loop through parents to get config - m_SkinName.clear(); + // Loop through parents to get skin folder + m_SkinFolderPath.clear(); while ((tvi.hItem = TreeView_GetParent(nm->hwndFrom, tvi.hItem)) != NULL) { TreeView_GetItem(nm->hwndFrom, &tvi); - m_SkinName.insert(0, 1, L'\\'); - m_SkinName.insert(0, buffer); + m_SkinFolderPath.insert(0, 1, L'\\'); + m_SkinFolderPath.insert(0, buffer); } - m_SkinName.resize(m_SkinName.length() - 1); // Get rid of trailing slash + m_SkinFolderPath.resize(m_SkinFolderPath.length() - 1); // Get rid of trailing slash ReadSkin(); } @@ -1522,7 +1522,7 @@ INT_PTR CDialogManage::CTabThemes::OnCommand(WPARAM wParam, LPARAM lParam) args += L"Themes\\"; args += themes[sel]; args += L"\\Rainmeter.thm"; - RunFile(Rainmeter->GetConfigEditor().c_str(), args.c_str()); + RunFile(Rainmeter->GetSkinEditor().c_str(), args.c_str()); } break; diff --git a/Library/DialogManage.h b/Library/DialogManage.h index 7fc34360..ef9db4d7 100644 --- a/Library/DialogManage.h +++ b/Library/DialogManage.h @@ -68,8 +68,8 @@ private: static int PopulateTree(HWND tree, TVINSERTSTRUCT& tvi, int index = 0); - std::wstring m_FileName; - std::wstring m_SkinName; + std::wstring m_SkinFileName; + std::wstring m_SkinFolderPath; CMeterWindow* m_SkinWindow; bool m_HandleCommands; bool m_IgnoreUpdate; diff --git a/Library/Export.cpp b/Library/Export.cpp index fd14da40..3f7ca779 100644 --- a/Library/Export.cpp +++ b/Library/Export.cpp @@ -138,7 +138,7 @@ LPCWSTR PluginBridge(LPCWSTR command, LPCWSTR data) if (meterWindow) { g_Buffer = L"\""; - g_Buffer += meterWindow->GetSkinName(); + g_Buffer += meterWindow->GetFolderPath(); g_Buffer += L"\""; return g_Buffer.c_str(); } diff --git a/Library/Litestep.cpp b/Library/Litestep.cpp index 1b0e175d..f95561b8 100644 --- a/Library/Litestep.cpp +++ b/Library/Litestep.cpp @@ -232,13 +232,13 @@ void LogInternal(int nLevel, ULONGLONG elapsed, LPCTSTR pszMessage) void Log(int nLevel, const WCHAR* message) { - struct DELAYED_LOG_INFO + struct DELAYED_LogInfo { int level; ULONGLONG elapsed; std::wstring message; }; - static std::list c_LogDelay; + static std::list c_LogDelay; static ULONGLONG startTime = CSystem::GetTickCount64(); ULONGLONG elapsed = CSystem::GetTickCount64() - startTime; @@ -250,7 +250,7 @@ void Log(int nLevel, const WCHAR* message) while (!c_LogDelay.empty()) { - DELAYED_LOG_INFO& logInfo = c_LogDelay.front(); + DELAYED_LogInfo& logInfo = c_LogDelay.front(); LogInternal(logInfo.level, logInfo.elapsed, logInfo.message.c_str()); c_LogDelay.erase(c_LogDelay.begin()); @@ -268,7 +268,7 @@ void Log(int nLevel, const WCHAR* message) // Queue the message EnterCriticalSection(&g_CsLogDelay); - DELAYED_LOG_INFO logInfo = {nLevel, elapsed, message}; + DELAYED_LogInfo logInfo = {nLevel, elapsed, message}; c_LogDelay.push_back(logInfo); LeaveCriticalSection(&g_CsLogDelay); diff --git a/Library/Measure.cpp b/Library/Measure.cpp index 0b335e97..d35089ab 100644 --- a/Library/Measure.cpp +++ b/Library/Measure.cpp @@ -111,8 +111,8 @@ void CMeasure::Initialize() } /* -** Reads the common configs for all Measures. The inherited classes -** must call the base implementation if they overwrite this method. +** Read the common options specified in the ini file. The inherited classes must +** call this base implementation if they overwrite this method. ** */ void CMeasure::ReadOptions(CConfigParser& parser, const WCHAR* section) diff --git a/Library/MeasureCPU.cpp b/Library/MeasureCPU.cpp index 05a712ed..5552ecca 100644 --- a/Library/MeasureCPU.cpp +++ b/Library/MeasureCPU.cpp @@ -91,7 +91,7 @@ CMeasureCPU::~CMeasureCPU() } /* -** Reads the measure specific configs. +** Read the options specified in the ini file. ** */ void CMeasureCPU::ReadOptions(CConfigParser& parser, const WCHAR* section) diff --git a/Library/MeasureCalc.cpp b/Library/MeasureCalc.cpp index 9e882470..6e496e7f 100644 --- a/Library/MeasureCalc.cpp +++ b/Library/MeasureCalc.cpp @@ -72,7 +72,7 @@ void CMeasureCalc::UpdateValue() } /* -** Reads the measure specific configs. +** Read the options specified in the ini file. ** */ void CMeasureCalc::ReadOptions(CConfigParser& parser, const WCHAR* section) diff --git a/Library/MeasureDiskSpace.cpp b/Library/MeasureDiskSpace.cpp index bf7d3b92..214ad277 100644 --- a/Library/MeasureDiskSpace.cpp +++ b/Library/MeasureDiskSpace.cpp @@ -176,7 +176,7 @@ const WCHAR* CMeasureDiskSpace::GetStringValue(AUTOSCALE autoScale, double scale } /* -** Reads the measure specific configs. +** Read the options specified in the ini file. ** */ void CMeasureDiskSpace::ReadOptions(CConfigParser& parser, const WCHAR* section) diff --git a/Library/MeasureMemory.cpp b/Library/MeasureMemory.cpp index 0925354c..f2be5cdd 100644 --- a/Library/MeasureMemory.cpp +++ b/Library/MeasureMemory.cpp @@ -57,7 +57,7 @@ void CMeasureMemory::UpdateValue() } /* -** Reads the measure specific configs. +** Read the options specified in the ini file. ** */ void CMeasureMemory::ReadOptions(CConfigParser& parser, const WCHAR* section) diff --git a/Library/MeasureNet.cpp b/Library/MeasureNet.cpp index 4bf1ac80..747184cb 100644 --- a/Library/MeasureNet.cpp +++ b/Library/MeasureNet.cpp @@ -434,8 +434,7 @@ ULONG64 CMeasureNet::GetNetStatsValue(NET net) } /* -** Reads the measure specific configs. This is the same for in, out and total. -** the net-parameter informs which inherited class called this method. +** Read the options specified in the ini file. Base implementation for In/Out/Total. ** */ void CMeasureNet::ReadOptions(CConfigParser& parser, const WCHAR* section, NET net) @@ -446,17 +445,17 @@ void CMeasureNet::ReadOptions(CConfigParser& parser, const WCHAR* section, NET n if (net == NET_IN) { netName = L"NetInSpeed"; - value = Rainmeter->GetGlobalConfig().netInSpeed; + value = Rainmeter->GetGlobalOptions().netInSpeed; } else if (net == NET_OUT) { netName = L"NetOutSpeed"; - value = Rainmeter->GetGlobalConfig().netOutSpeed; + value = Rainmeter->GetGlobalOptions().netOutSpeed; } else { netName = L"NetTotalSpeed"; - value = Rainmeter->GetGlobalConfig().netInSpeed + Rainmeter->GetGlobalConfig().netOutSpeed; + value = Rainmeter->GetGlobalOptions().netInSpeed + Rainmeter->GetGlobalOptions().netOutSpeed; } double maxValue = parser.ReadFloat(section, L"MaxValue", -1); diff --git a/Library/MeasureNetIn.cpp b/Library/MeasureNetIn.cpp index fd77852b..a39a7fde 100644 --- a/Library/MeasureNetIn.cpp +++ b/Library/MeasureNetIn.cpp @@ -79,7 +79,7 @@ void CMeasureNetIn::UpdateValue() } /* -** Reads the measure specific configs. +** Read the options specified in the ini file. ** */ void CMeasureNetIn::ReadOptions(CConfigParser& parser, const WCHAR* section) diff --git a/Library/MeasureNetOut.cpp b/Library/MeasureNetOut.cpp index 018a4e51..b3a7e546 100644 --- a/Library/MeasureNetOut.cpp +++ b/Library/MeasureNetOut.cpp @@ -79,7 +79,7 @@ void CMeasureNetOut::UpdateValue() } /* -** Reads the measure specific configs. +** Read the options specified in the ini file. ** */ void CMeasureNetOut::ReadOptions(CConfigParser& parser, const WCHAR* section) diff --git a/Library/MeasureNetTotal.cpp b/Library/MeasureNetTotal.cpp index 973d5a6d..9606e75a 100644 --- a/Library/MeasureNetTotal.cpp +++ b/Library/MeasureNetTotal.cpp @@ -79,7 +79,7 @@ void CMeasureNetTotal::UpdateValue() } /* -** Reads the measure specific configs. +** Read the options specified in the ini file. ** */ void CMeasureNetTotal::ReadOptions(CConfigParser& parser, const WCHAR* section) diff --git a/Library/MeasurePhysicalMemory.cpp b/Library/MeasurePhysicalMemory.cpp index e071e90e..caf7e86d 100644 --- a/Library/MeasurePhysicalMemory.cpp +++ b/Library/MeasurePhysicalMemory.cpp @@ -57,7 +57,7 @@ void CMeasurePhysicalMemory::UpdateValue() } /* -** Reads the measure specific configs. +** Read the options specified in the ini file. ** */ void CMeasurePhysicalMemory::ReadOptions(CConfigParser& parser, const WCHAR* section) diff --git a/Library/MeasurePlugin.cpp b/Library/MeasurePlugin.cpp index 4b6c2e5b..e325d068 100644 --- a/Library/MeasurePlugin.cpp +++ b/Library/MeasurePlugin.cpp @@ -96,7 +96,7 @@ void CMeasurePlugin::UpdateValue() } /* -** Reads the configs and loads & initializes the plugin +** Reads the options and loads the plugin ** */ void CMeasurePlugin::ReadOptions(CConfigParser& parser, const WCHAR* section) @@ -169,7 +169,7 @@ void CMeasurePlugin::ReadOptions(CConfigParser& parser, const WCHAR* section) if (initializeFunc) { - maxValue = ((INITIALIZE)initializeFunc)(m_Plugin, m_MeterWindow->GetSkinFilePath().c_str(), section, m_ID); + maxValue = ((INITIALIZE)initializeFunc)(m_Plugin, m_MeterWindow->GetFilePath().c_str(), section, m_ID); } } diff --git a/Library/MeasureRegistry.cpp b/Library/MeasureRegistry.cpp index 20abdedd..b61cbb16 100644 --- a/Library/MeasureRegistry.cpp +++ b/Library/MeasureRegistry.cpp @@ -101,7 +101,7 @@ void CMeasureRegistry::UpdateValue() } /* -** Reads the measure specific configs. +** Read the options specified in the ini file. ** */ void CMeasureRegistry::ReadOptions(CConfigParser& parser, const WCHAR* section) diff --git a/Library/MeasureScript.cpp b/Library/MeasureScript.cpp index 90a191a1..ac0a2142 100644 --- a/Library/MeasureScript.cpp +++ b/Library/MeasureScript.cpp @@ -107,12 +107,11 @@ const WCHAR* CMeasureScript::GetStringValue(AUTOSCALE autoScale, double scale, i } /* -** Reads the measure specific configs. +** Read the options specified in the ini file. ** */ void CMeasureScript::ReadOptions(CConfigParser& parser, const WCHAR* section) { - // Read common configs CMeasure::ReadOptions(parser, section); std::wstring file = parser.ReadString(section, L"ScriptFile", L""); diff --git a/Library/MeasureTime.cpp b/Library/MeasureTime.cpp index 3aeb9591..2094494e 100644 --- a/Library/MeasureTime.cpp +++ b/Library/MeasureTime.cpp @@ -207,7 +207,7 @@ const WCHAR* CMeasureTime::GetStringValue(AUTOSCALE autoScale, double scale, int } /* -** Reads the measure specific configs. +** Read the options specified in the ini file. ** */ void CMeasureTime::ReadOptions(CConfigParser& parser, const WCHAR* section) diff --git a/Library/MeasureUptime.cpp b/Library/MeasureUptime.cpp index 0738903b..ac615337 100644 --- a/Library/MeasureUptime.cpp +++ b/Library/MeasureUptime.cpp @@ -39,7 +39,7 @@ CMeasureUptime::~CMeasureUptime() } /* -** Reads the measure specific configs. +** Read the options specified in the ini file. ** */ void CMeasureUptime::ReadOptions(CConfigParser& parser, const WCHAR* section) diff --git a/Library/MeasureVirtualMemory.cpp b/Library/MeasureVirtualMemory.cpp index b2beee0f..64e2878d 100644 --- a/Library/MeasureVirtualMemory.cpp +++ b/Library/MeasureVirtualMemory.cpp @@ -57,7 +57,7 @@ void CMeasureVirtualMemory::UpdateValue() } /* -** Reads the measure specific configs. +** Read the options specified in the ini file. ** */ void CMeasureVirtualMemory::ReadOptions(CConfigParser& parser, const WCHAR* section) diff --git a/Library/Meter.cpp b/Library/Meter.cpp index 96c5ba91..872df058 100644 --- a/Library/Meter.cpp +++ b/Library/Meter.cpp @@ -248,9 +248,8 @@ void CMeter::Hide() } /* -** Reads the meter-specific configs from the ini-file. The base implementation -** reads the common settings for all meters. The inherited classes must call -** the base implementation if they overwrite this method. +** Read the common options specified in the ini file. The inherited classes must +** call this base implementation if they overwrite this method. ** */ void CMeter::ReadOptions(CConfigParser& parser, const WCHAR* section) diff --git a/Library/MeterBar.cpp b/Library/MeterBar.cpp index ab87121b..364c9037 100644 --- a/Library/MeterBar.cpp +++ b/Library/MeterBar.cpp @@ -79,7 +79,7 @@ void CMeterBar::Initialize() } /* -** Read the meter-specific configs from the ini-file. +** Read the options specified in the ini file. ** */ void CMeterBar::ReadOptions(CConfigParser& parser, const WCHAR* section) @@ -89,7 +89,6 @@ void CMeterBar::ReadOptions(CConfigParser& parser, const WCHAR* section) int oldW = m_W; int oldH = m_H; - // Read common configs CMeter::ReadOptions(parser, section); m_Color = parser.ReadColor(section, L"BarColor", Color::Green); @@ -99,7 +98,7 @@ void CMeterBar::ReadOptions(CConfigParser& parser, const WCHAR* section) { m_MeterWindow->MakePathAbsolute(m_ImageName); - // Read tinting configs + // Read tinting options m_Image.ReadOptions(parser, section); } else diff --git a/Library/MeterBitmap.cpp b/Library/MeterBitmap.cpp index 7daf9a20..82e972fc 100644 --- a/Library/MeterBitmap.cpp +++ b/Library/MeterBitmap.cpp @@ -151,7 +151,7 @@ bool CMeterBitmap::HitTest(int x, int y) } /* -** Read the meter-specific configs from the ini-file. +** Read the options specified in the ini file. ** */ void CMeterBitmap::ReadOptions(CConfigParser& parser, const WCHAR* section) @@ -161,7 +161,6 @@ void CMeterBitmap::ReadOptions(CConfigParser& parser, const WCHAR* section) int oldW = m_W; int oldH = m_H; - // Read common configs CMeter::ReadOptions(parser, section); m_ImageName = parser.ReadString(section, L"BitmapImage", L""); @@ -169,7 +168,7 @@ void CMeterBitmap::ReadOptions(CConfigParser& parser, const WCHAR* section) { m_MeterWindow->MakePathAbsolute(m_ImageName); - // Read tinting configs + // Read tinting options m_Image.ReadOptions(parser, section); } else diff --git a/Library/MeterButton.cpp b/Library/MeterButton.cpp index 524fcc57..cac19ec0 100644 --- a/Library/MeterButton.cpp +++ b/Library/MeterButton.cpp @@ -123,7 +123,7 @@ void CMeterButton::Initialize() } /* -** Read the meter-specific configs from the ini-file. +** Read the options specified in the ini file. ** */ void CMeterButton::ReadOptions(CConfigParser& parser, const WCHAR* section) @@ -133,7 +133,6 @@ void CMeterButton::ReadOptions(CConfigParser& parser, const WCHAR* section) int oldW = m_W; int oldH = m_H; - // Read common configs CMeter::ReadOptions(parser, section); m_ImageName = parser.ReadString(section, L"ButtonImage", L""); @@ -141,7 +140,7 @@ void CMeterButton::ReadOptions(CConfigParser& parser, const WCHAR* section) { m_MeterWindow->MakePathAbsolute(m_ImageName); - // Read tinting configs + // Read tinting options m_Image.ReadOptions(parser, section); } else diff --git a/Library/MeterHistogram.cpp b/Library/MeterHistogram.cpp index 041878d2..306d9823 100644 --- a/Library/MeterHistogram.cpp +++ b/Library/MeterHistogram.cpp @@ -179,7 +179,7 @@ void CMeterHistogram::Initialize() } /* -** Read the meter-specific configs from the ini-file. +** Read the options specified in the ini file. ** */ void CMeterHistogram::ReadOptions(CConfigParser& parser, const WCHAR* section) @@ -191,7 +191,6 @@ void CMeterHistogram::ReadOptions(CConfigParser& parser, const WCHAR* section) int oldW = m_W; int oldH = m_H; - // Read common configs CMeter::ReadOptions(parser, section); m_PrimaryColor = parser.ReadColor(section, L"PrimaryColor", Color::Green); @@ -212,7 +211,7 @@ void CMeterHistogram::ReadOptions(CConfigParser& parser, const WCHAR* section) { m_MeterWindow->MakePathAbsolute(m_PrimaryImageName); - // Read tinting configs + // Read tinting options m_PrimaryImage.ReadOptions(parser, section); } else @@ -225,7 +224,7 @@ void CMeterHistogram::ReadOptions(CConfigParser& parser, const WCHAR* section) { m_MeterWindow->MakePathAbsolute(m_SecondaryImageName); - // Read tinting configs + // Read tinting options m_SecondaryImage.ReadOptions(parser, section); } else @@ -238,7 +237,7 @@ void CMeterHistogram::ReadOptions(CConfigParser& parser, const WCHAR* section) { m_MeterWindow->MakePathAbsolute(m_OverlapImageName); - // Read tinting configs + // Read tinting options m_OverlapImage.ReadOptions(parser, section); } else diff --git a/Library/MeterHistogram.h b/Library/MeterHistogram.h index 1c46f739..ba428376 100644 --- a/Library/MeterHistogram.h +++ b/Library/MeterHistogram.h @@ -76,9 +76,9 @@ private: bool m_GraphStartLeft; bool m_GraphHorizontalOrientation; - static const WCHAR* c_PrimaryOptionArray[CTintedImage::ConfigCount]; - static const WCHAR* c_SecondaryOptionArray[CTintedImage::ConfigCount]; - static const WCHAR* c_BothOptionArray[CTintedImage::ConfigCount]; + static const WCHAR* c_PrimaryOptionArray[CTintedImage::OptionCount]; + static const WCHAR* c_SecondaryOptionArray[CTintedImage::OptionCount]; + static const WCHAR* c_BothOptionArray[CTintedImage::OptionCount]; }; #endif diff --git a/Library/MeterImage.cpp b/Library/MeterImage.cpp index 656d95b0..b1a7fd9c 100644 --- a/Library/MeterImage.cpp +++ b/Library/MeterImage.cpp @@ -103,12 +103,11 @@ void CMeterImage::LoadImage(const std::wstring& imageName, bool bLoadAlways) } /* -** Read the meter-specific configs from the ini-file. +** Read the options specified in the ini file. ** */ void CMeterImage::ReadOptions(CConfigParser& parser, const WCHAR* section) { - // Read common configs CMeter::ReadOptions(parser, section); // Check for extra measures @@ -134,7 +133,7 @@ void CMeterImage::ReadOptions(CConfigParser& parser, const WCHAR* section) static const RECT defMargins = {0}; m_ScaleMargins = parser.ReadRECT(section, L"ScaleMargins", defMargins); - // Read tinting configs + // Read tinting options m_Image.ReadOptions(parser, section); if (m_Initialized && diff --git a/Library/MeterLine.cpp b/Library/MeterLine.cpp index d3dfc8d2..d315211f 100644 --- a/Library/MeterLine.cpp +++ b/Library/MeterLine.cpp @@ -96,7 +96,7 @@ void CMeterLine::Initialize() } /* -** Read the meter-specific configs from the ini-file. +** Read the options specified in the ini file. ** */ void CMeterLine::ReadOptions(CConfigParser& parser, const WCHAR* section) @@ -107,7 +107,6 @@ void CMeterLine::ReadOptions(CConfigParser& parser, const WCHAR* section) int oldLineCount = (int)m_Colors.size(); int oldW = m_W; - // Read common configs CMeter::ReadOptions(parser, section); int lineCount = parser.ReadInt(section, L"LineCount", 1); diff --git a/Library/MeterRotator.cpp b/Library/MeterRotator.cpp index 833280f6..6827c375 100644 --- a/Library/MeterRotator.cpp +++ b/Library/MeterRotator.cpp @@ -54,7 +54,7 @@ CMeterRotator::~CMeterRotator() } /* -** Load the image & configs. +** Load the image. ** */ void CMeterRotator::Initialize() @@ -73,7 +73,7 @@ void CMeterRotator::Initialize() } /* -** Read the meter-specific configs from the ini-file. +** Read the options specified in the ini file. ** */ void CMeterRotator::ReadOptions(CConfigParser& parser, const WCHAR* section) @@ -81,7 +81,6 @@ void CMeterRotator::ReadOptions(CConfigParser& parser, const WCHAR* section) // Store the current values so we know if the image needs to be updated std::wstring oldImageName = m_ImageName; - // Read common configs CMeter::ReadOptions(parser, section); m_ImageName = parser.ReadString(section, L"ImageName", L""); @@ -89,7 +88,7 @@ void CMeterRotator::ReadOptions(CConfigParser& parser, const WCHAR* section) { m_MeterWindow->MakePathAbsolute(m_ImageName); - // Read tinting configs + // Read tinting options m_Image.ReadOptions(parser, section); } else diff --git a/Library/MeterRoundLine.cpp b/Library/MeterRoundLine.cpp index 16387522..e800baf2 100644 --- a/Library/MeterRoundLine.cpp +++ b/Library/MeterRoundLine.cpp @@ -57,12 +57,11 @@ CMeterRoundLine::~CMeterRoundLine() } /* -** Read the meter-specific configs from the ini-file. +** Read the options specified in the ini file. ** */ void CMeterRoundLine::ReadOptions(CConfigParser& parser, const WCHAR* section) { - // Read common configs CMeter::ReadOptions(parser, section); m_LineWidth = parser.ReadFloat(section, L"LineWidth", 1.0); diff --git a/Library/MeterString.cpp b/Library/MeterString.cpp index c87956ac..047e859a 100644 --- a/Library/MeterString.cpp +++ b/Library/MeterString.cpp @@ -307,7 +307,7 @@ void CMeterString::Initialize() } /* -** Read the meter-specific configs from the ini-file. +** Read the options specified in the ini file. ** */ void CMeterString::ReadOptions(CConfigParser& parser, const WCHAR* section) @@ -317,7 +317,6 @@ void CMeterString::ReadOptions(CConfigParser& parser, const WCHAR* section) int oldFontSize = m_FontSize; TEXTSTYLE oldStyle = m_Style; - // Read common configs CMeter::ReadOptions(parser, section); // Check for extra measures diff --git a/Library/MeterWindow.cpp b/Library/MeterWindow.cpp index 5c42932c..fd7e451d 100644 --- a/Library/MeterWindow.cpp +++ b/Library/MeterWindow.cpp @@ -73,7 +73,7 @@ extern CRainmeter* Rainmeter; ** Constructor ** */ -CMeterWindow::CMeterWindow(const std::wstring& config, const std::wstring& iniFile) : m_SkinName(config), m_SkinIniFile(iniFile), +CMeterWindow::CMeterWindow(const std::wstring& folderPath, const std::wstring& file) : m_FolderPath(folderPath), m_FileName(file), m_DoubleBuffer(), m_DIBSectionBuffer(), m_DIBSectionBufferPixels(), @@ -326,7 +326,7 @@ void CMeterWindow::Deactivate() } /* -** This deletes everything and rebuilds the config again. +** Rebuilds the skin. ** */ void CMeterWindow::Refresh(bool init, bool all) @@ -335,9 +335,9 @@ void CMeterWindow::Refresh(bool init, bool all) Rainmeter->SetCurrentParser(&m_Parser); - std::wstring notice = L"Refreshing skin \"" + m_SkinName; + std::wstring notice = L"Refreshing skin \"" + m_FolderPath; notice += L'\\'; - notice += m_SkinIniFile; + notice += m_FileName; notice += L'"'; Log(LOG_NOTICE, notice.c_str()); @@ -395,7 +395,7 @@ void CMeterWindow::Refresh(bool init, bool all) ReadOptions(); // Read the general settings if (!ReadSkin()) { - Rainmeter->DeactivateConfig(this, -1); + Rainmeter->DeactivateSkin(this, -1); return; } @@ -572,7 +572,7 @@ void CMeterWindow::MoveWindow(int x, int y) if (m_SavePosition) { - WriteOptions(SETTING_WINDOWPOSITION); + WriteOptions(OPTION_POSITION); } } @@ -1108,7 +1108,7 @@ void CMeterWindow::ShowMeter(const std::wstring& name, bool group) } } - if (!group) LogWithArgs(LOG_NOTICE, L"!ShowMeter: [%s] not found in \"%s\"", meter, m_SkinName.c_str()); + if (!group) LogWithArgs(LOG_NOTICE, L"!ShowMeter: [%s] not found in \"%s\"", meter, m_FolderPath.c_str()); } /* @@ -1130,7 +1130,7 @@ void CMeterWindow::HideMeter(const std::wstring& name, bool group) } } - if (!group) LogWithArgs(LOG_ERROR, L"!HideMeter: [%s] not found in \"%s\"", meter, m_SkinName.c_str()); + if (!group) LogWithArgs(LOG_ERROR, L"!HideMeter: [%s] not found in \"%s\"", meter, m_FolderPath.c_str()); } /* @@ -1159,7 +1159,7 @@ void CMeterWindow::ToggleMeter(const std::wstring& name, bool group) } } - if (!group) LogWithArgs(LOG_ERROR, L"!ToggleMeter: [%s] not found in \"%s\"", meter, m_SkinName.c_str()); + if (!group) LogWithArgs(LOG_ERROR, L"!ToggleMeter: [%s] not found in \"%s\"", meter, m_FolderPath.c_str()); } /* @@ -1182,7 +1182,7 @@ void CMeterWindow::MoveMeter(const std::wstring& name, int x, int y) } } - LogWithArgs(LOG_ERROR, L"!MoveMeter: [%s] not found in \"%s\"", meter, m_SkinName.c_str()); + LogWithArgs(LOG_ERROR, L"!MoveMeter: [%s] not found in \"%s\"", meter, m_FolderPath.c_str()); } /* @@ -1222,7 +1222,7 @@ void CMeterWindow::UpdateMeter(const std::wstring& name, bool group) // Post-updates PostUpdate(bActiveTransition); - if (!group && bContinue) LogWithArgs(LOG_ERROR, L"!UpdateMeter: [%s] not found in \"%s\"", meter, m_SkinName.c_str()); + if (!group && bContinue) LogWithArgs(LOG_ERROR, L"!UpdateMeter: [%s] not found in \"%s\"", meter, m_FolderPath.c_str()); } /* @@ -1243,7 +1243,7 @@ void CMeterWindow::EnableMeasure(const std::wstring& name, bool group) } } - if (!group) LogWithArgs(LOG_ERROR, L"!EnableMeasure: [%s] not found in \"%s\"", measure, m_SkinName.c_str()); + if (!group) LogWithArgs(LOG_ERROR, L"!EnableMeasure: [%s] not found in \"%s\"", measure, m_FolderPath.c_str()); } /* @@ -1264,7 +1264,7 @@ void CMeterWindow::DisableMeasure(const std::wstring& name, bool group) } } - if (!group) LogWithArgs(LOG_ERROR, L"!DisableMeasure: [%s] not found in \"%s\"", measure, m_SkinName.c_str()); + if (!group) LogWithArgs(LOG_ERROR, L"!DisableMeasure: [%s] not found in \"%s\"", measure, m_FolderPath.c_str()); } /* @@ -1292,7 +1292,7 @@ void CMeterWindow::ToggleMeasure(const std::wstring& name, bool group) } } - if (!group) LogWithArgs(LOG_ERROR, L"!ToggleMeasure: [%s] not found in \"%s\"", measure, m_SkinName.c_str()); + if (!group) LogWithArgs(LOG_ERROR, L"!ToggleMeasure: [%s] not found in \"%s\"", measure, m_FolderPath.c_str()); } /* @@ -1321,7 +1321,7 @@ void CMeterWindow::UpdateMeasure(const std::wstring& name, bool group) } } - if (!group) LogWithArgs(LOG_ERROR, L"!UpdateMeasure: [%s] not found in \"%s\"", measure, m_SkinName.c_str()); + if (!group) LogWithArgs(LOG_ERROR, L"!UpdateMeasure: [%s] not found in \"%s\"", measure, m_FolderPath.c_str()); } /* @@ -1433,9 +1433,8 @@ void CMeterWindow::SetOption(const std::wstring& section, const std::wstring& op } } -/* WindowToScreen -** -** Calculates the screen cordinates from the WindowX/Y config +/* +** Calculates the screen cordinates from the WindowX/Y options ** */ void CMeterWindow::WindowToScreen() @@ -1771,14 +1770,14 @@ void CMeterWindow::ScreenToWindow() } /* -** Reads the current config +** Reads the skin options from Rainmeter.ini ** */ void CMeterWindow::ReadOptions() { WCHAR buffer[32]; - const WCHAR* section = m_SkinName.c_str(); + const WCHAR* section = m_FolderPath.c_str(); CConfigParser parser; parser.Initialize(Rainmeter->GetIniFile(), NULL, section); @@ -1794,14 +1793,14 @@ void CMeterWindow::ReadOptions() // Check if the window position should be read as a formula double value; m_WindowX = parser.ReadString(section, L"WindowX", L"0"); - addWriteFlag(SETTING_WINDOWPOSITION); + addWriteFlag(OPTION_POSITION); if (parser.ParseFormula(m_WindowX, &value)) { _itow_s((int)value, buffer, 10); m_WindowX = buffer; } m_WindowY = parser.ReadString(section, L"WindowY", L"0"); - addWriteFlag(SETTING_WINDOWPOSITION); + addWriteFlag(OPTION_POSITION); if (parser.ParseFormula(m_WindowY, &value)) { _itow_s((int)value, buffer, 10); @@ -1812,23 +1811,23 @@ void CMeterWindow::ReadOptions() m_AnchorY = parser.ReadString(section, L"AnchorY", L"0"); int zPos = parser.ReadInt(section, L"AlwaysOnTop", ZPOSITION_NORMAL); - addWriteFlag(SETTING_ALWAYSONTOP); + addWriteFlag(OPTION_ALWAYSONTOP); m_WindowZPosition = (zPos >= ZPOSITION_ONDESKTOP && zPos <= ZPOSITION_ONTOPMOST) ? (ZPOSITION)zPos : ZPOSITION_NORMAL; int hideMode = parser.ReadInt(section, L"HideOnMouseOver", HIDEMODE_NONE); m_WindowHide = (hideMode >= HIDEMODE_NONE && hideMode <= HIDEMODE_FADEOUT) ? (HIDEMODE)hideMode : HIDEMODE_NONE; m_WindowDraggable = 0!=parser.ReadInt(section, L"Draggable", 1); - addWriteFlag(SETTING_WINDOWDRAGGABLE); + addWriteFlag(OPTION_DRAGGABLE); m_SnapEdges = 0!=parser.ReadInt(section, L"SnapEdges", 1); - addWriteFlag(SETTING_SNAPEDGES); + addWriteFlag(OPTION_SNAPEDGES); m_ClickThrough = 0!=parser.ReadInt(section, L"ClickThrough", 0); - addWriteFlag(SETTING_CLICKTHROUGH); + addWriteFlag(OPTION_CLICKTHROUGH); m_KeepOnScreen = 0!=parser.ReadInt(section, L"KeepOnScreen", 1); - addWriteFlag(SETTING_KEEPONSCREEN); + addWriteFlag(OPTION_KEEPONSCREEN); m_SavePosition = 0!=parser.ReadInt(section, L"SavePosition", 1); m_WindowStartHidden = 0!=parser.ReadInt(section, L"StartHidden", 0); @@ -1840,7 +1839,7 @@ void CMeterWindow::ReadOptions() m_FadeDuration = parser.ReadInt(section, L"FadeDuration", 250); - m_ConfigGroup = parser.ReadString(section, L"Group", L""); + m_SkinGroup = parser.ReadString(section, L"Group", L""); if (writeFlags != 0) { @@ -1852,7 +1851,7 @@ void CMeterWindow::ReadOptions() } /* -** Writes the new settings to the config +** Writes the specified options to Rainmeter.ini ** */ void CMeterWindow::WriteOptions(INT setting) @@ -1862,14 +1861,14 @@ void CMeterWindow::WriteOptions(INT setting) if (*iniFile) { WCHAR buffer[32]; - const WCHAR* section = m_SkinName.c_str(); + const WCHAR* section = m_FolderPath.c_str(); - if (setting != SETTING_ALL) + if (setting != OPTION_ALL) { CDialogManage::UpdateSkins(this); } - if (setting & SETTING_WINDOWPOSITION) + if (setting & OPTION_POSITION) { // If position needs to be save, do so. if (m_SavePosition) @@ -1880,55 +1879,55 @@ void CMeterWindow::WriteOptions(INT setting) } } - if (setting & SETTING_ALPHAVALUE) + if (setting & OPTION_ALPHAVALUE) { _itow_s(m_AlphaValue, buffer, 10); WritePrivateProfileString(section, L"AlphaValue", buffer, iniFile); } - if (setting & SETTING_FADEDURATION) + if (setting & OPTION_FADEDURATION) { _itow_s(m_FadeDuration, buffer, 10); WritePrivateProfileString(section, L"FadeDuration", buffer, iniFile); } - if (setting & SETTING_CLICKTHROUGH) + if (setting & OPTION_CLICKTHROUGH) { WritePrivateProfileString(section, L"ClickThrough", m_ClickThrough ? L"1" : L"0", iniFile); } - if (setting & SETTING_WINDOWDRAGGABLE) + if (setting & OPTION_DRAGGABLE) { WritePrivateProfileString(section, L"Draggable", m_WindowDraggable ? L"1" : L"0", iniFile); } - if (setting & SETTING_HIDEONMOUSEOVER) + if (setting & OPTION_HIDEONMOUSEOVER) { _itow_s(m_WindowHide, buffer, 10); WritePrivateProfileString(section, L"HideOnMouseOver", buffer, iniFile); } - if (setting & SETTING_SAVEPOSITION) + if (setting & OPTION_SAVEPOSITION) { WritePrivateProfileString(section, L"SavePosition", m_SavePosition ? L"1" : L"0", iniFile); } - if (setting & SETTING_SNAPEDGES) + if (setting & OPTION_SNAPEDGES) { WritePrivateProfileString(section, L"SnapEdges", m_SnapEdges ? L"1" : L"0", iniFile); } - if (setting & SETTING_KEEPONSCREEN) + if (setting & OPTION_KEEPONSCREEN) { WritePrivateProfileString(section, L"KeepOnScreen", m_KeepOnScreen ? L"1" : L"0", iniFile); } - if (setting & SETTING_AUTOSELECTSCREEN) + if (setting & OPTION_AUTOSELECTSCREEN) { WritePrivateProfileString(section, L"AutoSelectScreen", m_AutoSelectScreen ? L"1" : L"0", iniFile); } - if (setting & SETTING_ALWAYSONTOP) + if (setting & OPTION_ALWAYSONTOP) { _itow_s(m_WindowZPosition, buffer, 10); WritePrivateProfileString(section, L"AlwaysOnTop", buffer, iniFile); @@ -1937,24 +1936,24 @@ void CMeterWindow::WriteOptions(INT setting) } /* -** Reads the skin config, creates the meters and measures and does the bindings. +** Reads the skin file and creates the meters and measures. ** */ bool CMeterWindow::ReadSkin() { WCHAR buffer[128]; - std::wstring iniFile = GetSkinFilePath(); + std::wstring iniFile = GetFilePath(); // Verify whether the file exists if (_waccess(iniFile.c_str(), 0) == -1) { - std::wstring message = GetFormattedString(ID_STR_UNABLETOREFRESHSKIN, m_SkinName.c_str(), m_SkinIniFile.c_str()); + std::wstring message = GetFormattedString(ID_STR_UNABLETOREFRESHSKIN, m_FolderPath.c_str(), m_FileName.c_str()); MessageBox(m_Window, message.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION); return false; } - std::wstring resourcePath = GetSkinResourcesPath(); + std::wstring resourcePath = GetResourcesPath(); bool hasResourcesFolder = (_waccess(resourcePath.c_str(), 0) == 0); m_Parser.Initialize(iniFile, this, NULL, &resourcePath); @@ -1972,7 +1971,7 @@ bool CMeterWindow::ReadSkin() _snwprintf_s(buffer, _TRUNCATE, L"%u.%u", appVersion / 1000000, (appVersion / 1000) % 1000); } - std::wstring text = GetFormattedString(ID_STR_NEWVERSIONREQUIRED, m_SkinName.c_str(), m_SkinIniFile.c_str(), buffer); + std::wstring text = GetFormattedString(ID_STR_NEWVERSIONREQUIRED, m_FolderPath.c_str(), m_FileName.c_str(), buffer); MessageBox(m_Window, text.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION); return false; } @@ -1985,10 +1984,10 @@ bool CMeterWindow::ReadSkin() const std::wstring& group = m_Parser.ReadString(L"Rainmeter", L"Group", L""); if (!group.empty()) { - m_ConfigGroup += L'|'; - m_ConfigGroup += group; + m_SkinGroup += L'|'; + m_SkinGroup += group; } - InitializeGroup(m_ConfigGroup); + InitializeGroup(m_SkinGroup); static const RECT defMargins = {0}; m_BackgroundMargins = m_Parser.ReadRECT(L"Rainmeter", L"BackgroundMargins", defMargins); @@ -2226,7 +2225,7 @@ bool CMeterWindow::ReadSkin() if (m_Meters.empty()) { - std::wstring text = GetFormattedString(ID_STR_NOMETERSINSKIN, m_SkinName.c_str(), m_SkinIniFile.c_str()); + std::wstring text = GetFormattedString(ID_STR_NOMETERSINSKIN, m_FolderPath.c_str(), m_FileName.c_str()); MessageBox(m_Window, text.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION); return false; } @@ -2456,7 +2455,7 @@ bool CMeterWindow::ResizeWindow(bool reset) // Get the size form the background bitmap m_WindowW = m_Background->GetWidth(); m_WindowH = m_Background->GetHeight(); - //Calculate the window position from the config parameters + WindowToScreen(); } @@ -3307,7 +3306,7 @@ LRESULT CMeterWindow::OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam) { if (wParam == IDM_SKIN_EDITSKIN) { - Rainmeter->EditSkinFile(m_SkinName, m_SkinIniFile); + Rainmeter->EditSkinFile(m_FolderPath, m_FileName); } else if (wParam == IDM_SKIN_REFRESH) { @@ -3315,7 +3314,7 @@ LRESULT CMeterWindow::OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam) } else if (wParam == IDM_SKIN_OPENSKINSFOLDER) { - Rainmeter->OpenSkinFolder(m_SkinName); + Rainmeter->OpenSkinFolder(m_FolderPath); } else if (wParam == IDM_SKIN_MANAGESKIN) { @@ -3377,46 +3376,46 @@ LRESULT CMeterWindow::OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam) { m_AlphaValue = (int)(255.0 - (wParam - IDM_SKIN_TRANSPARENCY_0) * (230.0 / (IDM_SKIN_TRANSPARENCY_90 - IDM_SKIN_TRANSPARENCY_0))); UpdateWindow(m_AlphaValue, false); - WriteOptions(SETTING_ALPHAVALUE); + WriteOptions(OPTION_ALPHAVALUE); } else if (wParam == IDM_CLOSESKIN) { - Rainmeter->DeactivateConfig(this, -1); + Rainmeter->DeactivateSkin(this, -1); } else if (wParam == IDM_SKIN_FROMRIGHT) { m_WindowXFromRight = !m_WindowXFromRight; ScreenToWindow(); - WriteOptions(SETTING_WINDOWPOSITION); + WriteOptions(OPTION_POSITION); } else if (wParam == IDM_SKIN_FROMBOTTOM) { m_WindowYFromBottom = !m_WindowYFromBottom; ScreenToWindow(); - WriteOptions(SETTING_WINDOWPOSITION); + WriteOptions(OPTION_POSITION); } else if (wParam == IDM_SKIN_XPERCENTAGE) { m_WindowXPercentage = !m_WindowXPercentage; ScreenToWindow(); - WriteOptions(SETTING_WINDOWPOSITION); + WriteOptions(OPTION_POSITION); } else if (wParam == IDM_SKIN_YPERCENTAGE) { m_WindowYPercentage = !m_WindowYPercentage; ScreenToWindow(); - WriteOptions(SETTING_WINDOWPOSITION); + WriteOptions(OPTION_POSITION); } else if (wParam == IDM_SKIN_MONITOR_AUTOSELECT) { m_AutoSelectScreen = !m_AutoSelectScreen; ScreenToWindow(); - WriteOptions(SETTING_WINDOWPOSITION | SETTING_AUTOSELECTSCREEN); + WriteOptions(OPTION_POSITION | OPTION_AUTOSELECTSCREEN); } else if (wParam == IDM_SKIN_MONITOR_PRIMARY || wParam >= ID_MONITOR_FIRST && wParam <= ID_MONITOR_LAST) { @@ -3448,7 +3447,7 @@ LRESULT CMeterWindow::OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam) m_Parser.ResetMonitorVariables(this); // Set present monitor variables ScreenToWindow(); - WriteOptions(SETTING_WINDOWPOSITION | SETTING_AUTOSELECTSCREEN); + WriteOptions(OPTION_POSITION | OPTION_AUTOSELECTSCREEN); } } else @@ -3481,7 +3480,7 @@ LRESULT CMeterWindow::OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam) void CMeterWindow::SetClickThrough(bool b) { m_ClickThrough = b; - WriteOptions(SETTING_CLICKTHROUGH); + WriteOptions(OPTION_CLICKTHROUGH); if (!m_ClickThrough) { @@ -3502,7 +3501,7 @@ void CMeterWindow::SetClickThrough(bool b) void CMeterWindow::SetKeepOnScreen(bool b) { m_KeepOnScreen = b; - WriteOptions(SETTING_KEEPONSCREEN); + WriteOptions(OPTION_KEEPONSCREEN); if (m_KeepOnScreen) { @@ -3523,7 +3522,7 @@ void CMeterWindow::SetKeepOnScreen(bool b) void CMeterWindow::SetWindowDraggable(bool b) { m_WindowDraggable = b; - WriteOptions(SETTING_WINDOWDRAGGABLE); + WriteOptions(OPTION_DRAGGABLE); } /* @@ -3533,7 +3532,7 @@ void CMeterWindow::SetWindowDraggable(bool b) void CMeterWindow::SetSavePosition(bool b) { m_SavePosition = b; - WriteOptions(SETTING_WINDOWPOSITION | SETTING_SAVEPOSITION); + WriteOptions(OPTION_POSITION | OPTION_SAVEPOSITION); } /* @@ -3543,7 +3542,7 @@ void CMeterWindow::SetSavePosition(bool b) void CMeterWindow::SetSnapEdges(bool b) { m_SnapEdges = b; - WriteOptions(SETTING_SNAPEDGES); + WriteOptions(OPTION_SNAPEDGES); } /* @@ -3554,7 +3553,7 @@ void CMeterWindow::SetWindowHide(HIDEMODE hide) { m_WindowHide = hide; UpdateWindow(m_AlphaValue, false); - WriteOptions(SETTING_HIDEONMOUSEOVER); + WriteOptions(OPTION_HIDEONMOUSEOVER); } /* @@ -3564,7 +3563,7 @@ void CMeterWindow::SetWindowHide(HIDEMODE hide) void CMeterWindow::SetWindowZPosition(ZPOSITION zpos) { ChangeSingleZPos(zpos); - WriteOptions(SETTING_ALWAYSONTOP); + WriteOptions(OPTION_ALWAYSONTOP); } /* @@ -3591,10 +3590,9 @@ LRESULT CMeterWindow::OnSysCommand(UINT uMsg, WPARAM wParam, LPARAM lParam) { ScreenToWindow(); - // Write the new place of the window to config file if (m_SavePosition) { - WriteOptions(SETTING_WINDOWPOSITION); + WriteOptions(OPTION_POSITION); } POINT pos; @@ -4344,7 +4342,7 @@ bool CMeterWindow::DoMoveAction(int x, int y, MOUSE mouse) if (!m_MouseOver) { // If the mouse is over a meter it's also over the main window - //LogWithArgs(LOG_DEBUG, L"@Enter: %s", m_SkinName.c_str()); + //LogWithArgs(LOG_DEBUG, L"@Enter: %s", m_FolderPath.c_str()); m_MouseOver = true; SetMouseLeaveEvent(false); @@ -4381,7 +4379,7 @@ bool CMeterWindow::DoMoveAction(int x, int y, MOUSE mouse) !((*j)->GetMouseLeaveAction().empty()) || button) { - //LogWithArgs(LOG_DEBUG, L"MeterEnter: %s - [%s]", m_SkinName.c_str(), (*j)->GetName()); + //LogWithArgs(LOG_DEBUG, L"MeterEnter: %s - [%s]", m_FolderPath.c_str(), (*j)->GetName()); (*j)->SetMouseOver(true); if (!((*j)->GetMouseOverAction().empty())) @@ -4407,7 +4405,7 @@ bool CMeterWindow::DoMoveAction(int x, int y, MOUSE mouse) button->SetFocus(false); } - //LogWithArgs(LOG_DEBUG, L"MeterLeave: %s - [%s]", m_SkinName.c_str(), (*j)->GetName()); + //LogWithArgs(LOG_DEBUG, L"MeterLeave: %s - [%s]", m_FolderPath.c_str(), (*j)->GetName()); (*j)->SetMouseOver(false); if (!((*j)->GetMouseLeaveAction().empty())) @@ -4427,7 +4425,7 @@ bool CMeterWindow::DoMoveAction(int x, int y, MOUSE mouse) { if (!m_MouseOver) { - //LogWithArgs(LOG_DEBUG, L"Enter: %s", m_SkinName.c_str()); + //LogWithArgs(LOG_DEBUG, L"Enter: %s", m_FolderPath.c_str()); m_MouseOver = true; SetMouseLeaveEvent(false); @@ -4447,7 +4445,7 @@ bool CMeterWindow::DoMoveAction(int x, int y, MOUSE mouse) // Mouse leave happens when the mouse is outside the window if (m_MouseOver) { - //LogWithArgs(LOG_DEBUG, L"Leave: %s", m_SkinName.c_str()); + //LogWithArgs(LOG_DEBUG, L"Leave: %s", m_FolderPath.c_str()); m_MouseOver = false; SetMouseLeaveEvent(true); @@ -4625,7 +4623,7 @@ LRESULT CMeterWindow::OnCopyData(UINT uMsg, WPARAM wParam, LPARAM lParam) else { // This meterwindow has been deactivated - Log(LOG_WARNING, L"Unable to bang a deactivated config"); + Log(LOG_WARNING, L"Unable to bang unloaded skin"); } return TRUE; @@ -4675,44 +4673,44 @@ void CMeterWindow::MakePathAbsolute(std::wstring& path) else { std::wstring absolute; - absolute.reserve(Rainmeter->GetSkinPath().size() + m_SkinName.size() + 1 + path.size()); + absolute.reserve(Rainmeter->GetSkinPath().size() + m_FolderPath.size() + 1 + path.size()); absolute = Rainmeter->GetSkinPath(); - absolute += m_SkinName; + absolute += m_FolderPath; absolute += L'\\'; absolute += path; absolute.swap(path); } } -std::wstring CMeterWindow::GetSkinFilePath() +std::wstring CMeterWindow::GetFilePath() { - std::wstring file = Rainmeter->GetSkinPath() + m_SkinName; + std::wstring file = Rainmeter->GetSkinPath() + m_FolderPath; file += L'\\'; - file += m_SkinIniFile; + file += m_FileName; return file; } -std::wstring CMeterWindow::GetSkinRootPath() +std::wstring CMeterWindow::GetRootPath() { std::wstring path = Rainmeter->GetSkinPath(); std::wstring::size_type loc; - if ((loc = m_SkinName.find_first_of(L'\\')) != std::wstring::npos) + if ((loc = m_FolderPath.find_first_of(L'\\')) != std::wstring::npos) { - path.append(m_SkinName, 0, loc + 1); + path.append(m_FolderPath, 0, loc + 1); } else { - path += m_SkinName; + path += m_FolderPath; path += L'\\'; } return path; } -std::wstring CMeterWindow::GetSkinResourcesPath() +std::wstring CMeterWindow::GetResourcesPath() { - std::wstring path = GetSkinRootPath(); + std::wstring path = GetRootPath(); path += L"@Resources\\"; return path; } diff --git a/Library/MeterWindow.h b/Library/MeterWindow.h index 7e12fca6..78aa5d6a 100644 --- a/Library/MeterWindow.h +++ b/Library/MeterWindow.h @@ -160,7 +160,7 @@ class CMeter; class CMeterWindow : public CGroup { public: - CMeterWindow(const std::wstring& config, const std::wstring& iniFile); + CMeterWindow(const std::wstring& folderPath, const std::wstring& file); ~CMeterWindow(); int Initialize(); @@ -201,11 +201,11 @@ public: CConfigParser& GetParser() { return m_Parser; } - const std::wstring& GetSkinName() { return m_SkinName; } - const std::wstring& GetSkinIniFile() { return m_SkinIniFile; } - std::wstring GetSkinFilePath(); - std::wstring GetSkinRootPath(); - std::wstring GetSkinResourcesPath(); + const std::wstring& GetFolderPath() { return m_FolderPath; } + const std::wstring& GetFileName() { return m_FileName; } + std::wstring GetFilePath(); + std::wstring GetRootPath(); + std::wstring GetResourcesPath(); std::list& GetMeasures() { return m_Measures; } std::list& GetMeters() { return m_Meters; } @@ -284,21 +284,21 @@ protected: LRESULT OnDisplayChange(UINT uMsg, WPARAM wParam, LPARAM lParam); private: - enum SETTING + enum OPTION { - SETTING_WINDOWPOSITION = 0x00000001, - SETTING_ALPHAVALUE = 0x00000002, - SETTING_FADEDURATION = 0x00000004, - SETTING_CLICKTHROUGH = 0x00000008, - SETTING_WINDOWDRAGGABLE = 0x00000010, - SETTING_HIDEONMOUSEOVER = 0x00000020, - SETTING_SAVEPOSITION = 0x00000040, - SETTING_SNAPEDGES = 0x00000080, - SETTING_KEEPONSCREEN = 0x00000100, - SETTING_AUTOSELECTSCREEN = 0x00000200, - SETTING_ALWAYSONTOP = 0x00000400, + OPTION_POSITION = 0x00000001, + OPTION_ALPHAVALUE = 0x00000002, + OPTION_FADEDURATION = 0x00000004, + OPTION_CLICKTHROUGH = 0x00000008, + OPTION_DRAGGABLE = 0x00000010, + OPTION_HIDEONMOUSEOVER = 0x00000020, + OPTION_SAVEPOSITION = 0x00000040, + OPTION_SNAPEDGES = 0x00000080, + OPTION_KEEPONSCREEN = 0x00000100, + OPTION_AUTOSELECTSCREEN = 0x00000200, + OPTION_ALWAYSONTOP = 0x00000400, - SETTING_ALL = 0xFFFFFFFF + OPTION_ALL = 0xFFFFFFFF }; enum RESIZEMODE @@ -312,7 +312,6 @@ private: bool HitTest(int x, int y); - void GetSkinFolders(const std::wstring& folder); void SnapToWindow(CMeterWindow* window, LPWINDOWPOS wp); void MapCoordsToScreen(int& x, int& y, int w, int h); void WindowToScreen(); @@ -323,7 +322,7 @@ private: void Update(bool refresh); void UpdateWindow(int alpha, bool reset); void ReadOptions(); - void WriteOptions(INT setting = SETTING_ALL); + void WriteOptions(INT setting = OPTION_ALL); bool ReadSkin(); void InitializeMeasures(); void InitializeMeters(); @@ -381,7 +380,7 @@ private: bool m_MouseOver; - std::wstring m_ConfigGroup; + std::wstring m_SkinGroup; std::wstring m_BackgroundName; RECT m_BackgroundMargins; RECT m_DragMargins; @@ -449,8 +448,8 @@ private: std::list m_Measures; std::list m_Meters; - const std::wstring m_SkinName; - const std::wstring m_SkinIniFile; + const std::wstring m_FolderPath; + const std::wstring m_FileName; int m_UpdateCounter; UINT m_MouseMoveCounter; diff --git a/Library/Rainmeter.cpp b/Library/Rainmeter.cpp index 4b417368..09cd17a6 100644 --- a/Library/Rainmeter.cpp +++ b/Library/Rainmeter.cpp @@ -219,23 +219,23 @@ void CRainmeter::BangWithArgs(BANGCOMMAND bang, std::vector& args, // Use the specified window instead of meterWindow parameter if (argsCount > numOfArgs) { - const std::wstring& config = args[numOfArgs]; - if (!config.empty() && (config.length() != 1 || config[0] != L'*')) + const std::wstring& folderPath = args[numOfArgs]; + if (!folderPath.empty() && (folderPath.length() != 1 || folderPath[0] != L'*')) { - CMeterWindow* meterWindow = GetMeterWindow(config); + CMeterWindow* meterWindow = GetMeterWindow(folderPath); if (meterWindow) { meterWindow->RunBang(bang, args); } else { - LogWithArgs(LOG_ERROR, L"Bang: Config \"%s\" not found", config.c_str()); + LogWithArgs(LOG_ERROR, L"Bang: Skin \"%s\" not found", folderPath.c_str()); } return; } } - // No config defined -> apply to all. + // No skin defined -> apply to all. std::map::const_iterator iter = m_MeterWindows.begin(); for (; iter != m_MeterWindows.end(); ++iter) { @@ -295,14 +295,14 @@ void CRainmeter::BangGroupWithArgs(BANGCOMMAND bang, std::vector& ** !ActivateConfig bang ** */ -void CRainmeter::Bang_ActivateConfig(std::vector& args) +void CRainmeter::Bang_ActivateSkin(std::vector& args) { if (args.size() > 1) { std::pair indexes = GetMeterWindowIndex(args[0], args[1]); if (indexes.first != -1 && indexes.second != -1) { - ActivateConfig(indexes.first, indexes.second); + ActivateSkin(indexes.first, indexes.second); return; } LogWithArgs(LOG_ERROR, L"!ActivateConfig: \"%s\\%s\" not found", args[0].c_str(), args[1].c_str()); @@ -318,7 +318,7 @@ void CRainmeter::Bang_ActivateConfig(std::vector& args) ** !DeactivateConfig bang ** */ -void CRainmeter::Bang_DeactivateConfig(std::vector& args, CMeterWindow* meterWindow) +void CRainmeter::Bang_DeactivateSkin(std::vector& args, CMeterWindow* meterWindow) { if (!args.empty()) { @@ -332,7 +332,7 @@ void CRainmeter::Bang_DeactivateConfig(std::vector& args, CMeterWi if (meterWindow) { - DeactivateConfig(meterWindow, -1); + DeactivateSkin(meterWindow, -1); } else { @@ -344,19 +344,19 @@ void CRainmeter::Bang_DeactivateConfig(std::vector& args, CMeterWi ** !ToggleConfig bang ** */ -void CRainmeter::Bang_ToggleConfig(std::vector& args) +void CRainmeter::Bang_ToggleSkin(std::vector& args) { if (args.size() >= 2) { CMeterWindow* mw = GetMeterWindow(args[0]); if (mw) { - DeactivateConfig(mw, -1); + DeactivateSkin(mw, -1); return; } - // If the config wasn't active, activate it - Bang_ActivateConfig(args); + // If the skin wasn't active, activate it + Bang_ActivateSkin(args); } else { @@ -368,7 +368,7 @@ void CRainmeter::Bang_ToggleConfig(std::vector& args) ** !DeactivateConfigGroup bang ** */ -void CRainmeter::Bang_DeactivateConfigGroup(std::vector& args) +void CRainmeter::Bang_DeactivateSkinGroup(std::vector& args) { if (!args.empty()) { @@ -378,7 +378,7 @@ void CRainmeter::Bang_DeactivateConfigGroup(std::vector& args) std::multimap::const_iterator iter = windows.begin(); for (; iter != windows.end(); ++iter) { - DeactivateConfig((*iter).second, -1); + DeactivateSkin((*iter).second, -1); } } else @@ -475,8 +475,8 @@ void CRainmeter::Bang_WriteKeyValue(std::vector& args, CMeterWindo { if (args.size() == 3 && meterWindow) { - // Add the config filepath to the args - args.push_back(meterWindow->GetSkinFilePath()); + // Add the skin file path to the args + args.push_back(meterWindow->GetFilePath()); } else if (args.size() < 4) { @@ -667,7 +667,7 @@ CRainmeter::CRainmeter() : m_ResourceInstance(), m_ResourceLCID(), m_GDIplusToken(), - m_GlobalConfig() + m_GlobalOptions() { CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE); @@ -930,7 +930,7 @@ int CRainmeter::Initialize(LPCWSTR iniPath) // Create a default Rainmeter.ini file if needed if (_waccess(iniFile, 0) == -1) { - CreateDefaultConfigFile(); + CreateOptionsFile(); } delete [] buffer; @@ -975,7 +975,7 @@ int CRainmeter::Initialize(LPCWSTR iniPath) CMeterString::EnumerateInstalledFontFamilies(); } - // Tray must exist before configs are read + // Tray must exist before skins are read m_TrayWindow = new CTrayWindow(); m_TrayWindow->Initialize(); @@ -996,8 +996,8 @@ int CRainmeter::Initialize(LPCWSTR iniPath) UpdateDesktopWorkArea(false); } - // Create meter windows for active configs - ActivateActiveConfigs(); + // Create meter windows for active skins + ActivateActiveSkins(); if (dataFileCreated) { @@ -1157,7 +1157,7 @@ void CRainmeter::SetNetworkStatisticsTimer() static bool set = SetTimer(m_Window, TIMER_NETSTATS, INTERVAL_NETSTATS, NULL); } -void CRainmeter::CreateDefaultConfigFile() +void CRainmeter::CreateOptionsFile() { size_t pos = m_IniFile.find_last_of(L'\\'); if (pos != std::wstring::npos) @@ -1196,14 +1196,14 @@ void CRainmeter::CreateDataFile() void CRainmeter::ReloadSettings() { - ScanForConfigs(m_SkinPath); + ScanForSkins(m_SkinPath); ScanForThemes(GetSettingsPath() + L"Themes"); ReadGeneralSettings(m_IniFile); } void CRainmeter::EditSettings() { - RunFile(m_ConfigEditor.c_str(), m_IniFile.c_str()); + RunFile(m_SkinEditor.c_str(), m_IniFile.c_str()); } void CRainmeter::EditSkinFile(const std::wstring& name, const std::wstring& iniFile) @@ -1214,83 +1214,83 @@ void CRainmeter::EditSkinFile(const std::wstring& name, const std::wstring& iniF bool writable = CSystem::IsFileWritable(args.c_str()); // Execute as admin if in protected location - RunFile(m_ConfigEditor.c_str(), args.c_str(), !writable); + RunFile(m_SkinEditor.c_str(), args.c_str(), !writable); } void CRainmeter::OpenSkinFolder(const std::wstring& name) { - std::wstring folder = m_SkinPath + name; - RunFile(folder.c_str()); + std::wstring folderPath = m_SkinPath + name; + RunFile(folderPath.c_str()); } -void CRainmeter::ActivateActiveConfigs() +void CRainmeter::ActivateActiveSkins() { - std::multimap::const_iterator iter = m_ConfigOrders.begin(); - for ( ; iter != m_ConfigOrders.end(); ++iter) + std::multimap::const_iterator iter = m_SkinOrders.begin(); + for ( ; iter != m_SkinOrders.end(); ++iter) { - const SkinFolder& folder = m_SkinFolders[(*iter).second]; - if (folder.active > 0 && folder.active <= (int)folder.files.size()) + const SkinFolder& skinFolder = m_SkinFolders[(*iter).second]; + if (skinFolder.active > 0 && skinFolder.active <= (int)skinFolder.files.size()) { - ActivateConfig((*iter).second, folder.active - 1); + ActivateSkin((*iter).second, skinFolder.active - 1); } } } -void CRainmeter::ActivateConfig(int folderIndex, int fileIndex) +void CRainmeter::ActivateSkin(int folderIndex, int fileIndex) { if (folderIndex >= 0 && folderIndex < (int)m_SkinFolders.size() && fileIndex >= 0 && fileIndex < (int)m_SkinFolders[folderIndex].files.size()) { - const SkinFolder& folder = m_SkinFolders[folderIndex]; - const std::wstring& skinFile = folder.files[fileIndex]; - const WCHAR* file = skinFile.c_str(); + const SkinFolder& skinFolder = m_SkinFolders[folderIndex]; + const std::wstring& file = skinFolder.files[fileIndex]; + const WCHAR* fileSz = file.c_str(); - std::wstring skinFolder = GetSkinFolderPath(folderIndex); + std::wstring folderPath = GetFolderPath(folderIndex); - // Verify that the config is not already active - std::map::const_iterator iter = m_MeterWindows.find(skinFolder); + // Verify that the skin is not already active + std::map::const_iterator iter = m_MeterWindows.find(folderPath); if (iter != m_MeterWindows.end()) { - if (wcscmp(((*iter).second)->GetSkinIniFile().c_str(), file) == 0) + if (wcscmp(((*iter).second)->GetFileName().c_str(), fileSz) == 0) { - LogWithArgs(LOG_WARNING, L"!ActivateConfig: \"%s\" already active", skinFolder.c_str()); + LogWithArgs(LOG_WARNING, L"!ActivateConfig: \"%s\" already active", folderPath.c_str()); return; } else { - // Deactivate the existing config - DeactivateConfig((*iter).second, folderIndex); + // Deactivate the existing skin + DeactivateSkin((*iter).second, folderIndex); } } // Verify whether the ini-file exists - std::wstring skinIniPath = m_SkinPath + skinFolder; + std::wstring skinIniPath = m_SkinPath + folderPath; skinIniPath += L'\\'; - skinIniPath += skinFile; + skinIniPath += file; if (_waccess(skinIniPath.c_str(), 0) == -1) { - std::wstring message = GetFormattedString(ID_STR_UNABLETOACTIVATESKIN, skinFolder.c_str(), file); + std::wstring message = GetFormattedString(ID_STR_UNABLETOACTIVATESKIN, folderPath.c_str(), fileSz); MessageBox(NULL, message.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION); return; } m_SkinFolders[folderIndex].active = fileIndex + 1; - WriteActive(skinFolder, fileIndex); + WriteActive(folderPath, fileIndex); - CreateMeterWindow(skinFolder, skinFile); + CreateMeterWindow(folderPath, file); } } -void CRainmeter::DeactivateConfig(CMeterWindow* meterWindow, int folderIndex, bool save) +void CRainmeter::DeactivateSkin(CMeterWindow* meterWindow, int folderIndex, bool save) { if (folderIndex >= 0 && folderIndex < (int)m_SkinFolders.size()) { - m_SkinFolders[folderIndex].active = 0; // Deactivate the config + m_SkinFolders[folderIndex].active = 0; // Deactivate the skin } else if (folderIndex == -1 && meterWindow) { - folderIndex = FindSkinFolderIndex(meterWindow->GetSkinName()); + folderIndex = FindSkinFolderIndex(meterWindow->GetFolderPath()); if (folderIndex != -1) { m_SkinFolders[folderIndex].active = 0; @@ -1301,45 +1301,45 @@ void CRainmeter::DeactivateConfig(CMeterWindow* meterWindow, int folderIndex, bo { if (save) { - // Disable the config in the ini-file - WriteActive(meterWindow->GetSkinName(), -1); + // Disable the skin in the ini-file + WriteActive(meterWindow->GetFolderPath(), -1); } meterWindow->Deactivate(); } } -void CRainmeter::ToggleConfig(int folderIndex, int fileIndex) +void CRainmeter::ToggleSkin(int folderIndex, int fileIndex) { if (folderIndex >= 0 && folderIndex < (int)m_SkinFolders.size() && fileIndex >= 0 && fileIndex < (int)m_SkinFolders[folderIndex].files.size()) { if (m_SkinFolders[folderIndex].active == fileIndex + 1) { - CMeterWindow* meterWindow = Rainmeter->GetMeterWindow(GetSkinFolderPath(folderIndex)); - DeactivateConfig(meterWindow, folderIndex); + CMeterWindow* meterWindow = Rainmeter->GetMeterWindow(GetFolderPath(folderIndex)); + DeactivateSkin(meterWindow, folderIndex); } else { - ActivateConfig(folderIndex, fileIndex); + ActivateSkin(folderIndex, fileIndex); } } } -void CRainmeter::WriteActive(const std::wstring& config, int fileIndex) +void CRainmeter::WriteActive(const std::wstring& folderPath, int fileIndex) { WCHAR buffer[32]; _itow_s(fileIndex + 1, buffer, 10); - WritePrivateProfileString(config.c_str(), L"Active", buffer, m_IniFile.c_str()); + WritePrivateProfileString(folderPath.c_str(), L"Active", buffer, m_IniFile.c_str()); } -void CRainmeter::CreateMeterWindow(const std::wstring& config, const std::wstring& iniFile) +void CRainmeter::CreateMeterWindow(const std::wstring& folderPath, const std::wstring& file) { - CMeterWindow* mw = new CMeterWindow(config, iniFile); + CMeterWindow* mw = new CMeterWindow(folderPath, file); if (mw) { - m_MeterWindows[config] = mw; + m_MeterWindows.insert(std::make_pair(folderPath, mw)); try { @@ -1350,7 +1350,7 @@ void CRainmeter::CreateMeterWindow(const std::wstring& config, const std::wstrin } catch (CError& error) { - DeactivateConfig(mw, -1); + DeactivateSkin(mw, -1); LogError(error); } } @@ -1388,13 +1388,13 @@ void CRainmeter::DeleteMeterWindow(CMeterWindow* meterWindow, bool force) CDialogAbout::UpdateSkins(); } -CMeterWindow* CRainmeter::GetMeterWindow(const std::wstring& config) +CMeterWindow* CRainmeter::GetMeterWindow(const std::wstring& folderPath) { - const WCHAR* configName = config.c_str(); + const WCHAR* folderSz = folderPath.c_str(); std::map::const_iterator iter = m_MeterWindows.begin(); for (; iter != m_MeterWindows.end(); ++iter) { - if (_wcsicmp((*iter).first.c_str(), configName) == 0) + if (_wcsicmp((*iter).first.c_str(), folderSz) == 0) { return (*iter).second; } @@ -1412,8 +1412,8 @@ CMeterWindow* CRainmeter::GetMeterWindowByINI(const std::wstring& ini_searching) std::map::const_iterator iter = m_MeterWindows.begin(); for (; iter != m_MeterWindows.end(); ++iter) { - std::wstring config_current = (*iter).second->GetSkinName() + L'\\'; - config_current += (*iter).second->GetSkinIniFile(); + std::wstring config_current = (*iter).second->GetFolderPath() + L'\\'; + config_current += (*iter).second->GetFileName(); if (_wcsicmp(config_current.c_str(), config_searching.c_str()) == 0) { @@ -1425,17 +1425,17 @@ CMeterWindow* CRainmeter::GetMeterWindowByINI(const std::wstring& ini_searching) return NULL; } -std::pair CRainmeter::GetMeterWindowIndex(const std::wstring& config, const std::wstring& iniFile) +std::pair CRainmeter::GetMeterWindowIndex(const std::wstring& folderPath, const std::wstring& file) { - int index = FindSkinFolderIndex(config); + int index = FindSkinFolderIndex(folderPath); if (index != -1) { - const SkinFolder& folder = m_SkinFolders[index]; + const SkinFolder& skinFolder = m_SkinFolders[index]; - const WCHAR* fileSz = iniFile.c_str(); - for (int i = 0, isize = (int)folder.files.size(); i < isize; ++i) + const WCHAR* fileSz = file.c_str(); + for (int i = 0, isize = (int)skinFolder.files.size(); i < isize; ++i) { - if (_wcsicmp(folder.files[i].c_str(), fileSz) == 0) + if (_wcsicmp(skinFolder.files[i].c_str(), fileSz) == 0) { return std::make_pair(index, i); } @@ -1451,14 +1451,14 @@ std::pair CRainmeter::GetMeterWindowIndex(UINT menuCommand) if (menuCommand >= ID_CONFIG_FIRST && menuCommand <= ID_CONFIG_LAST) { - // Check which config was selected + // Check which skin was selected for (size_t i = 0, isize = m_SkinFolders.size(); i < isize; ++i) { - const SkinFolder& folder = m_SkinFolders[i]; - if (menuCommand >= folder.commandBase && - menuCommand < (folder.commandBase + folder.files.size())) + const SkinFolder& skinFolder = m_SkinFolders[i]; + if (menuCommand >= skinFolder.commandBase && + menuCommand < (skinFolder.commandBase + skinFolder.files.size())) { - indexes = std::make_pair(i, menuCommand - folder.commandBase); + indexes = std::make_pair(i, menuCommand - skinFolder.commandBase); return indexes; } } @@ -1499,11 +1499,11 @@ void CRainmeter::GetMeterWindowsByLoadOrder(std::multimap& w ** Returns the skin folder path relative to the skin folder (e.g. illustro\Clock). ** */ -std::wstring CRainmeter::GetSkinFolderPath(int folderIndex) +std::wstring CRainmeter::GetFolderPath(int folderIndex) { - const SkinFolder& folder = m_SkinFolders[folderIndex]; - std::wstring path = folder.name; - for (int i = folder.level - 1, index = folderIndex; i >= 1; --i) + const SkinFolder& skinFolder = m_SkinFolders[folderIndex]; + std::wstring path = skinFolder.name; + for (int i = skinFolder.level - 1, index = folderIndex; i >= 1; --i) { while (m_SkinFolders[index].level != i) { @@ -1527,10 +1527,10 @@ int CRainmeter::FindSkinFolderIndex(const std::wstring& folderPath) int level = 1; for (int i = 0, isize = (int)m_SkinFolders.size(); i < isize; ++i) { - const SkinFolder& folder = m_SkinFolders[i]; - if (folder.level == level) + const SkinFolder& skinFolder = m_SkinFolders[i]; + if (skinFolder.level == level) { - if (folder.name.length() == len && _wcsnicmp(folder.name.c_str(), path, len) == 0) + if (skinFolder.name.length() == len && _wcsnicmp(skinFolder.name.c_str(), path, len) == 0) { path += len; if (*path) @@ -1548,7 +1548,7 @@ int CRainmeter::FindSkinFolderIndex(const std::wstring& folderPath) ++level; } } - else if (folder.level < level) + else if (skinFolder.level < level) { break; } @@ -1560,14 +1560,14 @@ int CRainmeter::FindSkinFolderIndex(const std::wstring& folderPath) void CRainmeter::SetLoadOrder(int folderIndex, int order) { - std::multimap::iterator iter = m_ConfigOrders.begin(); - for ( ; iter != m_ConfigOrders.end(); ++iter) + std::multimap::iterator iter = m_SkinOrders.begin(); + for ( ; iter != m_SkinOrders.end(); ++iter) { if ((*iter).second == folderIndex) // already exists { if ((*iter).first != order) { - m_ConfigOrders.erase(iter); + m_SkinOrders.erase(iter); break; } else @@ -1577,16 +1577,16 @@ void CRainmeter::SetLoadOrder(int folderIndex, int order) } } - m_ConfigOrders.insert(std::pair(order, folderIndex)); + m_SkinOrders.insert(std::pair(order, folderIndex)); } -int CRainmeter::GetLoadOrder(const std::wstring& config) +int CRainmeter::GetLoadOrder(const std::wstring& folderPath) { - int index = FindSkinFolderIndex(config); + int index = FindSkinFolderIndex(folderPath); if (index != -1) { - std::multimap::const_iterator iter = m_ConfigOrders.begin(); - for ( ; iter != m_ConfigOrders.end(); ++iter) + std::multimap::const_iterator iter = m_SkinOrders.begin(); + for ( ; iter != m_SkinOrders.end(); ++iter) { if ((*iter).second == index) { @@ -1602,15 +1602,15 @@ int CRainmeter::GetLoadOrder(const std::wstring& config) /* ** Scans all the subfolders and locates the ini-files. */ -void CRainmeter::ScanForConfigs(const std::wstring& path) +void CRainmeter::ScanForSkins(const std::wstring& path) { m_SkinFolders.clear(); - m_ConfigOrders.clear(); + m_SkinOrders.clear(); - ScanForConfigsRecursive(path, L"", 0, 0); + ScanForSkinsRecursive(path, L"", 0, 0); } -int CRainmeter::ScanForConfigsRecursive(const std::wstring& path, std::wstring base, int index, UINT level) +int CRainmeter::ScanForSkinsRecursive(const std::wstring& path, std::wstring base, int index, UINT level) { WIN32_FIND_DATA fileData; // Data structure describes the file found HANDLE hSearch; // Search handle returned by FindFirstFile @@ -1631,10 +1631,10 @@ int CRainmeter::ScanForConfigsRecursive(const std::wstring& path, std::wstring b bool foundFiles = false; if (hSearch != INVALID_HANDLE_VALUE) { - SkinFolder folder; - folder.commandBase = ID_CONFIG_FIRST + index; - folder.active = 0; - folder.level = level; + SkinFolder skinFolder; + skinFolder.commandBase = ID_CONFIG_FIRST + index; + skinFolder.active = 0; + skinFolder.level = level; do { @@ -1657,7 +1657,7 @@ int CRainmeter::ScanForConfigsRecursive(const std::wstring& path, std::wstring b if (filenameLen >= 4 && _wcsicmp(fileData.cFileName + (filenameLen - 4), L".ini") == 0) { foundFiles = true; - folder.files.push_back(filename); + skinFolder.files.push_back(filename); ++index; } } @@ -1670,15 +1670,15 @@ int CRainmeter::ScanForConfigsRecursive(const std::wstring& path, std::wstring b { if (level == 1) { - folder.name = base; + skinFolder.name = base; } else { std::wstring::size_type pos = base.rfind(L'\\') + 1; - folder.name.assign(base, pos, base.length() - pos); + skinFolder.name.assign(base, pos, base.length() - pos); } - m_SkinFolders.push_back(std::move(folder)); + m_SkinFolders.push_back(std::move(skinFolder)); } } @@ -1694,7 +1694,7 @@ int CRainmeter::ScanForConfigsRecursive(const std::wstring& path, std::wstring b std::list::const_iterator iter = subfolders.begin(); for ( ; iter != subfolders.end(); ++iter) { - int newIndex = ScanForConfigsRecursive(path, base + (*iter), index, level + 1); + int newIndex = ScanForSkinsRecursive(path, base + (*iter), index, level + 1); if (newIndex != index) { popFolder = false; @@ -1855,15 +1855,15 @@ void CRainmeter::ExecuteBang(const WCHAR* bang, std::vector& args, } else if (_wcsicmp(bang, L"ActivateConfig") == 0) { - Bang_ActivateConfig(args); + Bang_ActivateSkin(args); } else if (_wcsicmp(bang, L"DeactivateConfig") == 0) { - Bang_DeactivateConfig(args, meterWindow); + Bang_DeactivateSkin(args, meterWindow); } else if (_wcsicmp(bang, L"ToggleConfig") == 0) { - Bang_ToggleConfig(args); + Bang_ToggleSkin(args); } else if (_wcsicmp(bang, L"Move") == 0) { @@ -1971,7 +1971,7 @@ void CRainmeter::ExecuteBang(const WCHAR* bang, std::vector& args, } else if (_wcsicmp(bang, L"DeactivateConfigGroup") == 0) { - Bang_DeactivateConfigGroup(args); + Bang_DeactivateSkinGroup(args); } else if (_wcsicmp(bang, L"ZPosGroup") == 0) { @@ -2242,19 +2242,19 @@ void CRainmeter::ReadGeneralSettings(const std::wstring& iniFile) m_TrayWindow->ReadOptions(parser); } - m_GlobalConfig.netInSpeed = parser.ReadFloat(L"Rainmeter", L"NetInSpeed", 0.0); - m_GlobalConfig.netOutSpeed = parser.ReadFloat(L"Rainmeter", L"NetOutSpeed", 0.0); + m_GlobalOptions.netInSpeed = parser.ReadFloat(L"Rainmeter", L"NetInSpeed", 0.0); + m_GlobalOptions.netOutSpeed = parser.ReadFloat(L"Rainmeter", L"NetOutSpeed", 0.0); m_DisableDragging = 0!=parser.ReadInt(L"Rainmeter", L"DisableDragging", 0); m_DisableRDP = 0!=parser.ReadInt(L"Rainmeter", L"DisableRDP", 0); - m_ConfigEditor = parser.ReadString(L"Rainmeter", L"ConfigEditor", L""); - if (m_ConfigEditor.empty()) + m_SkinEditor = parser.ReadString(L"Rainmeter", L"ConfigEditor", L""); + if (m_SkinEditor.empty()) { // Get the program path associated with .ini files DWORD cchOut = MAX_PATH; HRESULT hr = AssocQueryString(ASSOCF_NOTRUNCATE, ASSOCSTR_EXECUTABLE, L".ini", L"open", buffer, &cchOut); - m_ConfigEditor = (SUCCEEDED(hr) && cchOut > 0) ? buffer : L"Notepad"; + m_SkinEditor = (SUCCEEDED(hr) && cchOut > 0) ? buffer : L"Notepad"; } m_LogViewer = parser.ReadString(L"Rainmeter", L"LogViewer", L""); @@ -2268,7 +2268,7 @@ void CRainmeter::ReadGeneralSettings(const std::wstring& iniFile) if (m_Debug) { - LogWithArgs(LOG_NOTICE, L"ConfigEditor: %s", m_ConfigEditor.c_str()); + LogWithArgs(LOG_NOTICE, L"ConfigEditor: %s", m_SkinEditor.c_str()); LogWithArgs(LOG_NOTICE, L"LogViewer: %s", m_LogViewer.c_str()); } @@ -2317,13 +2317,13 @@ void CRainmeter::ReadGeneralSettings(const std::wstring& iniFile) continue; } - SkinFolder& folder = m_SkinFolders[index]; + SkinFolder& skinFolder = m_SkinFolders[index]; // Make sure there is a ini file available int active = parser.ReadInt(section, L"Active", 0); - if (active > 0 && active <= (int)folder.files.size()) + if (active > 0 && active <= (int)skinFolder.files.size()) { - folder.active = active; + skinFolder.active = active; } int order = parser.ReadInt(section, L"LoadOrder", 0); @@ -2361,27 +2361,27 @@ void CRainmeter::RefreshAll() CMeterWindow* mw = (*iter).second; if (mw) { - const WCHAR* skinFolder = mw->GetSkinName().c_str(); + const WCHAR* skinFolder = mw->GetFolderPath().c_str(); // Verify whether the cached information is valid - int index = FindSkinFolderIndex(mw->GetSkinName()); + int index = FindSkinFolderIndex(mw->GetFolderPath()); if (index != -1) { - SkinFolder& folder = m_SkinFolders[index]; + SkinFolder& skinFolder = m_SkinFolders[index]; - const WCHAR* skinIniFile = mw->GetSkinIniFile().c_str(); + const WCHAR* skinIniFile = mw->GetFileName().c_str(); bool found = false; - for (int i = 0, isize = (int)folder.files.size(); i < isize; ++i) + for (int i = 0, isize = (int)skinFolder.files.size(); i < isize; ++i) { - if (_wcsicmp(skinIniFile, folder.files[i].c_str()) == 0) + if (_wcsicmp(skinIniFile, skinFolder.files[i].c_str()) == 0) { found = true; - if (folder.active != i + 1) + if (skinFolder.active != i + 1) { // Switch to new ini-file order - folder.active = i + 1; - WriteActive(mw->GetSkinName(), i); + skinFolder.active = i + 1; + WriteActive(mw->GetFolderPath(), i); } break; } @@ -2389,7 +2389,7 @@ void CRainmeter::RefreshAll() if (!found) { - DeactivateConfig(mw, index); + DeactivateSkin(mw, index); std::wstring error = GetFormattedString(ID_STR_UNABLETOREFRESHSKIN, skinFolder, skinIniFile); MessageBox(NULL, error.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION); @@ -2397,7 +2397,7 @@ void CRainmeter::RefreshAll() } else { - DeactivateConfig(mw, -2); // -2 = Deactivate the config forcibly + DeactivateSkin(mw, -2); // -2 = Force deactivate std::wstring error = GetFormattedString(ID_STR_UNABLETOREFRESHSKIN, skinFolder, L""); MessageBox(NULL, error.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION); @@ -2465,8 +2465,8 @@ void CRainmeter::LoadTheme(const std::wstring& name) ReloadSettings(); - // Create meter windows for active configs - ActivateActiveConfigs(); + // Create meter windows for active skins + ActivateActiveSkins(); } void CRainmeter::PreserveSetting(const std::wstring& from, LPCTSTR key, bool replace) @@ -2701,18 +2701,18 @@ void CRainmeter::ShowContextMenu(POINT pos, CMeterWindow* meterWindow) CheckMenuItem(subMenu, IDM_DEBUGLOG, MF_BYCOMMAND | MF_CHECKED); } - HMENU configMenu = GetSubMenu(subMenu, 4); - if (configMenu) + HMENU skinMenu = GetSubMenu(subMenu, 4); + if (skinMenu) { if (!m_SkinFolders.empty()) { - DeleteMenu(configMenu, 0, MF_BYPOSITION); // "No skins available" menuitem - CreateAllSkinsMenu(configMenu); + DeleteMenu(skinMenu, 0, MF_BYPOSITION); // "No skins available" menuitem + CreateAllSkinsMenu(skinMenu); } if (m_DisableDragging) { - CheckMenuItem(configMenu, IDM_DISABLEDRAG, MF_BYCOMMAND | MF_CHECKED); + CheckMenuItem(skinMenu, IDM_DISABLEDRAG, MF_BYCOMMAND | MF_CHECKED); } } @@ -2729,7 +2729,7 @@ void CRainmeter::ShowContextMenu(POINT pos, CMeterWindow* meterWindow) if (meterWindow) { HMENU rainmeterMenu = subMenu; - subMenu = CreateSkinMenu(meterWindow, 0, configMenu); + subMenu = CreateSkinMenu(meterWindow, 0, skinMenu); WCHAR buffer[256]; GetMenuString(menu, 0, buffer, 256, MF_BYPOSITION); @@ -2740,18 +2740,18 @@ void CRainmeter::ShowContextMenu(POINT pos, CMeterWindow* meterWindow) { InsertMenu(subMenu, 12, MF_BYPOSITION | MF_SEPARATOR, 0, NULL); - // Create a menu for all active configs + // Create a menu for all active skins int index = 0; std::map::const_iterator iter = m_MeterWindows.begin(); for (; iter != m_MeterWindows.end(); ++iter) { CMeterWindow* mw = ((*iter).second); - HMENU skinMenu = CreateSkinMenu(mw, index, configMenu); - InsertMenu(subMenu, 12, MF_BYPOSITION | MF_POPUP, (UINT_PTR)skinMenu, mw->GetSkinName().c_str()); + HMENU menu = CreateSkinMenu(mw, index, skinMenu); + InsertMenu(subMenu, 12, MF_BYPOSITION | MF_POPUP, (UINT_PTR)menu, mw->GetFolderPath().c_str()); ++index; } - // Put Update notifications in the Tray menu + // Add update notification item if (m_NewVersion) { InsertMenu(subMenu, 0, MF_BYPOSITION, IDM_NEW_VERSION, GetString(ID_STR_UPDATEAVAILABLE)); @@ -2815,8 +2815,8 @@ int CRainmeter::CreateAllSkinsMenuRecursive(HMENU skinMenu, int index) const size_t max = Rainmeter->m_SkinFolders.size(); while (index < max) { - const SkinFolder& folder = Rainmeter->m_SkinFolders[index]; - if (folder.level != initialLevel) + const SkinFolder& skinFolder = Rainmeter->m_SkinFolders[index]; + if (skinFolder.level != initialLevel) { return index - 1; } @@ -2824,7 +2824,7 @@ int CRainmeter::CreateAllSkinsMenuRecursive(HMENU skinMenu, int index) HMENU subMenu = CreatePopupMenu(); // Add current folder - InsertMenu(skinMenu, menuIndex, MF_POPUP | MF_BYPOSITION, (UINT_PTR)subMenu, folder.name.c_str()); + InsertMenu(skinMenu, menuIndex, MF_POPUP | MF_BYPOSITION, (UINT_PTR)subMenu, skinFolder.name.c_str()); // Add subfolders const bool hasSubfolder = (index + 1) < max && m_SkinFolders[index + 1].level == initialLevel + 1; @@ -2836,15 +2836,15 @@ int CRainmeter::CreateAllSkinsMenuRecursive(HMENU skinMenu, int index) // Add files { int fileIndex = 0; - int fileCount = (int)folder.files.size(); + int fileCount = (int)skinFolder.files.size(); for ( ; fileIndex < fileCount; ++fileIndex) { - InsertMenu(subMenu, fileIndex, MF_STRING | MF_BYPOSITION, folder.commandBase + fileIndex, folder.files[fileIndex].c_str()); + InsertMenu(subMenu, fileIndex, MF_STRING | MF_BYPOSITION, skinFolder.commandBase + fileIndex, skinFolder.files[fileIndex].c_str()); } - if (folder.active) + if (skinFolder.active) { - UINT checkPos = folder.active - 1; + UINT checkPos = skinFolder.active - 1; CheckMenuRadioItem(subMenu, checkPos, checkPos, checkPos, MF_BYPOSITION); } @@ -2861,7 +2861,7 @@ int CRainmeter::CreateAllSkinsMenuRecursive(HMENU skinMenu, int index) return index; } -HMENU CRainmeter::CreateSkinMenu(CMeterWindow* meterWindow, int index, HMENU configMenu) +HMENU CRainmeter::CreateSkinMenu(CMeterWindow* meterWindow, int index, HMENU menu) { HMENU skinMenu = LoadMenu(m_ResourceInstance, MAKEINTRESOURCE(IDR_SKIN_MENU)); @@ -2969,7 +2969,7 @@ HMENU CRainmeter::CreateSkinMenu(CMeterWindow* meterWindow, int index, HMENU con } // Add the name of the Skin to the menu - const std::wstring& skinName = meterWindow->GetSkinName(); + const std::wstring& skinName = meterWindow->GetFolderPath(); ModifyMenu(skinMenu, IDM_SKIN_OPENSKINSFOLDER, MF_BYCOMMAND, IDM_SKIN_OPENSKINSFOLDER, skinName.c_str()); SetMenuDefaultItem(skinMenu, IDM_SKIN_OPENSKINSFOLDER, FALSE); @@ -2986,24 +2986,24 @@ HMENU CRainmeter::CreateSkinMenu(CMeterWindow* meterWindow, int index, HMENU con // Add the variants menu if (variantsMenu) { - const SkinFolder& folder = m_SkinFolders[FindSkinFolderIndex(skinName)]; - for (int i = 0, isize = (int)folder.files.size(); i < isize; ++i) + const SkinFolder& skinFolder = m_SkinFolders[FindSkinFolderIndex(skinName)]; + for (int i = 0, isize = (int)skinFolder.files.size(); i < isize; ++i) { - InsertMenu(variantsMenu, i, MF_BYPOSITION, folder.commandBase + i, folder.files[i].c_str()); + InsertMenu(variantsMenu, i, MF_BYPOSITION, skinFolder.commandBase + i, skinFolder.files[i].c_str()); } - if (folder.active) + if (skinFolder.active) { - UINT checkPos = folder.active - 1; + UINT checkPos = skinFolder.active - 1; CheckMenuRadioItem(variantsMenu, checkPos, checkPos, checkPos, MF_BYPOSITION); } } - // Add config's root menu - int itemCount = GetMenuItemCount(configMenu); + // Add skin root menu + int itemCount = GetMenuItemCount(menu); if (itemCount > 0) { - std::wstring root = meterWindow->GetSkinName(); + std::wstring root = meterWindow->GetFolderPath(); std::wstring::size_type pos = root.find_first_of(L'\\'); if (pos != std::wstring::npos) { @@ -3012,18 +3012,18 @@ HMENU CRainmeter::CreateSkinMenu(CMeterWindow* meterWindow, int index, HMENU con for (int i = 0; i < itemCount; ++i) { - UINT state = GetMenuState(configMenu, i, MF_BYPOSITION); + UINT state = GetMenuState(menu, i, MF_BYPOSITION); if (state == 0xFFFFFFFF || (state & MF_POPUP) == 0) break; WCHAR buffer[MAX_PATH]; - if (GetMenuString(configMenu, i, buffer, MAX_PATH, MF_BYPOSITION)) + if (GetMenuString(menu, i, buffer, MAX_PATH, MF_BYPOSITION)) { if (_wcsicmp(root.c_str(), buffer) == 0) { - HMENU configRootMenu = GetSubMenu(configMenu, i); - if (configRootMenu) + HMENU skinRootMenu = GetSubMenu(menu, i); + if (skinRootMenu) { - InsertMenu(skinMenu, 3, MF_BYPOSITION | MF_POPUP, (UINT_PTR)configRootMenu, root.c_str()); + InsertMenu(skinMenu, 3, MF_BYPOSITION | MF_POPUP, (UINT_PTR)skinRootMenu, root.c_str()); } break; } @@ -3079,7 +3079,6 @@ void CRainmeter::CreateMonitorMenu(HMENU monitorMenu, CMeterWindow* meterWindow) } } - // Tick the configs if (!screenDefined) { CheckMenuItem(monitorMenu, IDM_SKIN_MONITOR_PRIMARY, MF_BYCOMMAND | MF_CHECKED); @@ -3181,7 +3180,7 @@ void CRainmeter::DeleteLogFile() void CRainmeter::AddAboutLogInfo(int level, LPCWSTR time, LPCWSTR message) { // Store 20 last items - LOG_INFO logInfo = {level, time, message}; + LogInfo logInfo = {level, time, message}; m_LogData.push_back(logInfo); if (m_LogData.size() > 20) { diff --git a/Library/Rainmeter.h b/Library/Rainmeter.h index 25a53cec..f3f64f7a 100644 --- a/Library/Rainmeter.h +++ b/Library/Rainmeter.h @@ -46,7 +46,7 @@ #define WM_RAINMETER_DELAYED_EXECUTE WM_APP + 1 #define WM_RAINMETER_EXECUTE WM_APP + 2 -struct GlobalConfig +struct GlobalOptions { double netInSpeed; double netOutSpeed; @@ -89,7 +89,7 @@ public: } }; - struct LOG_INFO + struct LogInfo { int level; std::wstring timestamp; @@ -110,27 +110,27 @@ public: CTrayWindow* GetTrayWindow() { return m_TrayWindow; } - CMeterWindow* GetMeterWindow(const std::wstring& config); + CMeterWindow* GetMeterWindow(const std::wstring& folderPath); CMeterWindow* GetMeterWindowByINI(const std::wstring& ini_searching); - std::pair GetMeterWindowIndex(const std::wstring& config, const std::wstring& iniFile); - std::pair GetMeterWindowIndex(CMeterWindow* meterWindow) { return GetMeterWindowIndex(meterWindow->GetSkinName(), meterWindow->GetSkinIniFile()); } + std::pair GetMeterWindowIndex(const std::wstring& folderPath, const std::wstring& file); + std::pair GetMeterWindowIndex(CMeterWindow* meterWindow) { return GetMeterWindowIndex(meterWindow->GetFolderPath(), meterWindow->GetFileName()); } std::pair GetMeterWindowIndex(UINT menuCommand); CMeterWindow* GetMeterWindow(HWND hwnd); void GetMeterWindowsByLoadOrder(std::multimap& windows, const std::wstring& group = std::wstring()); std::map& GetAllMeterWindows() { return m_MeterWindows; } - std::wstring GetSkinFolderPath(int folderIndex); + std::wstring GetFolderPath(int folderIndex); int FindSkinFolderIndex(const std::wstring& folderPath); - const std::vector& GetSkinFolders() { return m_SkinFolders; } + const std::vector& GetFolders() { return m_SkinFolders; } const std::vector& GetAllThemes() { return m_Themes; } void DeleteMeterWindow(CMeterWindow* meterWindow, bool force = false); - void ActivateConfig(int folderIndex, int fileIndex); - void DeactivateConfig(CMeterWindow* meterWindow, int folderIndex, bool save = true); - void ToggleConfig(int folderIndex, int fileIndex); + void ActivateSkin(int folderIndex, int fileIndex); + void DeactivateSkin(CMeterWindow* meterWindow, int folderIndex, bool save = true); + void ToggleSkin(int folderIndex, int fileIndex); const std::wstring& GetPath() { return m_Path; } const std::wstring& GetIniFile() { return m_IniFile; } @@ -146,7 +146,7 @@ public: const std::wstring& GetDrive() { return m_Drive; } - const std::wstring& GetConfigEditor() { return m_ConfigEditor; } + const std::wstring& GetSkinEditor() { return m_SkinEditor; } const std::wstring& GetLogViewer() { return m_LogViewer; } const std::wstring& GetStatsDate() { return m_StatsDate; } @@ -158,7 +158,7 @@ public: bool GetDebug() { return m_Debug; } - GlobalConfig& GetGlobalConfig() { return m_GlobalConfig; } + GlobalOptions& GetGlobalOptions() { return m_GlobalOptions; } void ReloadSettings(); void EditSettings(); @@ -190,7 +190,7 @@ public: bool IsNormalStayDesktop() { return m_NormalStayDesktop; } void AddAboutLogInfo(int level, LPCWSTR time, LPCWSTR message); - const std::list& GetAboutLogData() { return m_LogData; } + const std::list& GetAboutLogData() { return m_LogData; } void SetDebug(bool debug); @@ -222,10 +222,10 @@ private: void BangWithArgs(BANGCOMMAND bang, std::vector& args, size_t numOfArgs, CMeterWindow* meterWindow); void BangGroupWithArgs(BANGCOMMAND bang, std::vector& args, size_t numOfArgs, CMeterWindow* meterWindow); - void Bang_ActivateConfig(std::vector& args); - void Bang_DeactivateConfig(std::vector& args, CMeterWindow* meterWindow); - void Bang_ToggleConfig(std::vector& args); - void Bang_DeactivateConfigGroup(std::vector& args); + void Bang_ActivateSkin(std::vector& args); + void Bang_DeactivateSkin(std::vector& args, CMeterWindow* meterWindow); + void Bang_ToggleSkin(std::vector& args); + void Bang_DeactivateSkinGroup(std::vector& args); void Bang_SetClip(std::vector& args); void Bang_SetWallpaper(std::vector& args, CMeterWindow* meterWindow); void Bang_SkinMenu(std::vector& args, CMeterWindow* meterWindow); @@ -233,25 +233,25 @@ private: void Bang_WriteKeyValue(std::vector& args, CMeterWindow* meterWindow); void Bang_Log(std::vector& args); - void ActivateActiveConfigs(); - void CreateMeterWindow(const std::wstring& config, const std::wstring& iniFile); - void WriteActive(const std::wstring& config, int fileIndex); - void ScanForConfigs(const std::wstring& path); + void ActivateActiveSkins(); + void CreateMeterWindow(const std::wstring& folderPath, const std::wstring& file); + void WriteActive(const std::wstring& folderPath, int fileIndex); + void ScanForSkins(const std::wstring& path); void ScanForThemes(const std::wstring& path); void ReadGeneralSettings(const std::wstring& iniFile); void SetLoadOrder(int folderIndex, int order); - int GetLoadOrder(const std::wstring& config); + int GetLoadOrder(const std::wstring& folderPath); void UpdateDesktopWorkArea(bool reset); - HMENU CreateSkinMenu(CMeterWindow* meterWindow, int index, HMENU configMenu); + HMENU CreateSkinMenu(CMeterWindow* meterWindow, int index, HMENU menu); void ChangeSkinIndex(HMENU subMenu, int index); - int ScanForConfigsRecursive(const std::wstring& path, std::wstring base, int index, UINT level); + int ScanForSkinsRecursive(const std::wstring& path, std::wstring base, int index, UINT level); void CreateAllSkinsMenu(HMENU skinMenu) { CreateAllSkinsMenuRecursive(skinMenu, 0); } int CreateAllSkinsMenuRecursive(HMENU skinMenu, int index); void CreateThemeMenu(HMENU themeMenu); void CreateMonitorMenu(HMENU monitorMenu, CMeterWindow* meterWindow); - void CreateDefaultConfigFile(); + void CreateOptionsFile(); void CreateDataFile(); void SetLogging(bool logging); void TestSettingsFile(bool bDefaultIniLocation); @@ -259,7 +259,7 @@ private: CTrayWindow* m_TrayWindow; std::vector m_SkinFolders; - std::multimap m_ConfigOrders; + std::multimap m_SkinOrders; std::map m_MeterWindows; std::vector m_Themes; @@ -299,9 +299,9 @@ private: bool m_Logging; - std::list m_LogData; + std::list m_LogData; - std::wstring m_ConfigEditor; + std::wstring m_SkinEditor; std::wstring m_LogViewer; CConfigParser* m_CurrentParser; @@ -315,7 +315,7 @@ private: ULONG_PTR m_GDIplusToken; - GlobalConfig m_GlobalConfig; + GlobalOptions m_GlobalOptions; }; #ifdef LIBRARY_EXPORTS diff --git a/Library/System.cpp b/Library/System.cpp index 8b86970a..3f087a94 100644 --- a/Library/System.cpp +++ b/Library/System.cpp @@ -732,7 +732,7 @@ BOOL CALLBACK MyEnumWindowsProc(HWND hwnd, LPARAM lParam) if (logging) { LogWithArgs(LOG_DEBUG, L"%c [%c] 0x%p : %s (Name: \"%s\", zPos=%i)", - flag, IsWindowVisible(hwnd) ? L'V' : L'H', hwnd, className, Window->GetSkinName().c_str(), (int)zPos); + flag, IsWindowVisible(hwnd) ? L'V' : L'H', hwnd, className, Window->GetFolderPath().c_str(), (int)zPos); } } else diff --git a/Library/TintedImage.cpp b/Library/TintedImage.cpp index 0a37a5e5..6a432605 100644 --- a/Library/TintedImage.cpp +++ b/Library/TintedImage.cpp @@ -148,14 +148,12 @@ CTintedImageHelper_DefineOptionArray(CTintedImage::c_DefaultOptionArray, L""); /* ** The constructor. ** -** If disableTransform is true, following configs are ignored: -** - ImageCrop -** - ImageRotate +** If disableTransform is true, ImageCrop and ImageRotate are ignored. ** */ -CTintedImage::CTintedImage(const WCHAR* name, const WCHAR** configArray, bool disableTransform) : m_DisableTransform(disableTransform), +CTintedImage::CTintedImage(const WCHAR* name, const WCHAR** optionArray, bool disableTransform) : m_DisableTransform(disableTransform), m_Name(name ? name : L"Image"), - m_OptionArray(configArray ? configArray : c_DefaultOptionArray), + m_OptionArray(optionArray ? optionArray : c_DefaultOptionArray), m_Bitmap(), m_BitmapTint(), @@ -563,7 +561,7 @@ void CTintedImage::ApplyTransform() } /* -** Read the meter-specific configs from the ini-file. +** Read the meter-specific options from the ini-file. ** */ void CTintedImage::ReadOptions(CConfigParser& parser, const WCHAR* section) diff --git a/Library/TintedImage.h b/Library/TintedImage.h index b6dd07b6..cf4654f5 100644 --- a/Library/TintedImage.h +++ b/Library/TintedImage.h @@ -24,12 +24,11 @@ #include /* -** Helper macro to define the array of the config item. -** It's necessary to give a string literal to the prefix parameter. +** Helper macro to define an array of option names. A prefix must be given. ** */ #define CTintedImageHelper_DefineOptionArray(name, prefix) \ - const WCHAR* (name)[CTintedImage::ConfigCount] = { \ + const WCHAR* (name)[CTintedImage::OptionCount] = { \ prefix L"ImageCrop", \ prefix L"Greyscale", \ prefix L"ImageTint", \ @@ -62,10 +61,10 @@ public: OptionIndexImageFlip, OptionIndexImageRotate, - ConfigCount + OptionCount }; - CTintedImage(const WCHAR* name = L"Image", const WCHAR** configArray = c_DefaultOptionArray, bool disableTransform = false); + CTintedImage(const WCHAR* name = L"Image", const WCHAR** optionArray = c_DefaultOptionArray, bool disableTransform = false); ~CTintedImage(); void ReadOptions(CConfigParser& parser, const WCHAR* section); @@ -124,7 +123,7 @@ protected: static const Gdiplus::ColorMatrix c_GreyScaleMatrix; static const Gdiplus::ColorMatrix c_IdentityMatrix; - static const WCHAR* c_DefaultOptionArray[ConfigCount]; + static const WCHAR* c_DefaultOptionArray[OptionCount]; }; #endif diff --git a/Library/TrayWindow.cpp b/Library/TrayWindow.cpp index 4bcd5790..21fd2247 100644 --- a/Library/TrayWindow.cpp +++ b/Library/TrayWindow.cpp @@ -501,7 +501,7 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA std::pair indexes = Rainmeter->GetMeterWindowIndex((UINT)(wParam & 0x0ffff)); if (indexes.first != -1 && indexes.second != -1) { - Rainmeter->ToggleConfig(indexes.first, indexes.second); + Rainmeter->ToggleSkin(indexes.first, indexes.second); } } else @@ -625,7 +625,7 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA } else if (wParam == RAINMETER_QUERY_ID_CONFIG_EDITOR) { - sendCopyData(Rainmeter->GetConfigEditor()); + sendCopyData(Rainmeter->GetSkinEditor()); return 0; } else if (wParam == RAINMETER_QUERY_ID_IS_DEBUGGING) @@ -642,8 +642,8 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA COPYDATASTRUCT* cds = (COPYDATASTRUCT*)lParam; if (cds->dwData == RAINMETER_QUERY_ID_SKIN_WINDOWHANDLE) { - LPCWSTR configName = (LPCWSTR)cds->lpData; - CMeterWindow* mw = Rainmeter->GetMeterWindow(configName); + LPCWSTR folderPath = (LPCWSTR)cds->lpData; + CMeterWindow* mw = Rainmeter->GetMeterWindow(folderPath); return (mw) ? (LRESULT)mw->GetWindow() : NULL; } } diff --git a/Library/lua/LuaManager.h b/Library/lua/LuaManager.h index 709c2068..94fcac9d 100644 --- a/Library/lua/LuaManager.h +++ b/Library/lua/LuaManager.h @@ -18,12 +18,12 @@ #ifndef __LUAMANAGER_H__ #define __LUAMANAGER_H__ - -extern "C" -{ -#include "lua.h" -#include "lualib.h" -#include "lauxlib.h" + +extern "C" +{ +#include "lua.h" +#include "lualib.h" +#include "lauxlib.h" } class LuaManager