Cosmetics: Changed "config" to more consistent and descriptive terms

This commit is contained in:
Birunthan Mohanathas 2012-06-01 16:06:36 +03:00
parent dac6303c1a
commit 922dd098c9
43 changed files with 429 additions and 448 deletions

View File

@ -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_Measures.clear();
m_Sections.clear(); m_Sections.clear();
@ -73,7 +73,7 @@ void CConfigParser::Initialize(const std::wstring& filename, CMeterWindow* meter
CSystem::UpdateIniFileMappingList(); CSystem::UpdateIniFileMappingList();
ReadIniFile(filename, config); ReadIniFile(filename, skinSection);
ReadVariables(); ReadVariables();
// Clear and minimize // Clear and minimize
@ -98,9 +98,9 @@ void CConfigParser::SetBuiltInVariables(const std::wstring& filename, const std:
if (meterWindow) if (meterWindow)
{ {
insertVariable(L"CURRENTFILE", meterWindow->GetSkinIniFile()); insertVariable(L"CURRENTFILE", meterWindow->GetFileName());
insertVariable(L"CURRENTCONFIG", meterWindow->GetSkinName()); insertVariable(L"CURRENTCONFIG", meterWindow->GetFolderPath());
insertVariable(L"ROOTCONFIGPATH", meterWindow->GetSkinRootPath()); insertVariable(L"ROOTCONFIGPATH", meterWindow->GetRootPath());
} }
insertVariable(L"CRLF", L"\n"); 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. ** 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? 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* pos = NULL;
WCHAR* epos = NULL; WCHAR* epos = NULL;
if (config == NULL) if (skinSection == NULL)
{ {
// Get all the sections // Get all the sections
do 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" // Special case: Read only "Rainmeter" and specified section from "Rainmeter.ini"
const std::wstring strRainmeter = L"Rainmeter"; const std::wstring strRainmeter = L"Rainmeter";
const std::wstring strConfig = config; const std::wstring strFolder = skinSection;
sections.push_back(strRainmeter); sections.push_back(strRainmeter);
sections.push_back(strConfig); sections.push_back(strFolder);
if (depth == 0) // Add once if (depth == 0) // Add once
{ {
m_Sections.push_back(strRainmeter); 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(); const WCHAR* sectionName = (*iter).c_str();
bool isVariables = (_wcsicmp(sectionName, L"Variables") == 0); 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 // Read all "key=value" from the section
do do
@ -1323,7 +1323,7 @@ void CConfigParser::ReadIniFile(const std::wstring& iniFile, LPCTSTR config, int
// Relative to the ini folder // Relative to the ini folder
value.insert(0, CRainmeter::ExtractPath(iniFile)); value.insert(0, CRainmeter::ExtractPath(iniFile));
} }
ReadIniFile(value, config, depth + 1); ReadIniFile(value, skinSection, depth + 1);
} }
} }
else else

View File

@ -40,7 +40,7 @@ public:
CConfigParser(); CConfigParser();
~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); void AddMeasure(CMeasure* pMeasure);
bool GetVariable(const std::wstring& strVariable, std::wstring& strValue); bool GetVariable(const std::wstring& strVariable, std::wstring& strValue);
@ -106,7 +106,7 @@ private:
CMeasure* GetMeasure(const std::wstring& name); 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); void SetAutoSelectedMonitorVariables(CMeterWindow* meterWindow);

View File

@ -405,7 +405,7 @@ void CDialogAbout::CTabLog::Initialize()
ListView_InsertColumn(item, 2, &lvc); ListView_InsertColumn(item, 2, &lvc);
// Add stored entires // Add stored entires
std::list<CRainmeter::LOG_INFO>::const_iterator iter = Rainmeter->GetAboutLogData().begin(); std::list<CRainmeter::LogInfo>::const_iterator iter = Rainmeter->GetAboutLogData().begin();
for ( ; iter != Rainmeter->GetAboutLogData().end(); ++iter) for ( ; iter != Rainmeter->GetAboutLogData().end(); ++iter)
{ {
AddItem((*iter).level, (*iter).timestamp.c_str(), (*iter).message.c_str()); AddItem((*iter).level, (*iter).timestamp.c_str(), (*iter).message.c_str());

View File

@ -117,8 +117,8 @@ void CDialogManage::OpenSkin(CMeterWindow* meterWindow)
if (c_Dialog) if (c_Dialog)
{ {
std::wstring name = meterWindow->GetSkinName() + L'\\'; std::wstring name = meterWindow->GetFolderPath() + L'\\';
name += meterWindow->GetSkinIniFile(); name += meterWindow->GetFileName();
HWND item = GetDlgItem(c_Dialog->m_TabSkins.GetWindow(), IDC_MANAGESKINS_SKINS_TREEVIEW); HWND item = GetDlgItem(c_Dialog->m_TabSkins.GetWindow(), IDC_MANAGESKINS_SKINS_TREEVIEW);
c_Dialog->m_TabSkins.SelectTreeItem(item, TreeView_GetRoot(item), name.c_str()); 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; m_HandleCommands = true;
} }
else if (wcscmp(meterWindow->GetSkinName().c_str(), m_SkinName.c_str()) == 0 && else if (wcscmp(meterWindow->GetFolderPath().c_str(), m_SkinFolderPath.c_str()) == 0 &&
wcscmp(meterWindow->GetSkinIniFile().c_str(), m_FileName.c_str()) == 0) wcscmp(meterWindow->GetFileName().c_str(), m_SkinFileName.c_str()) == 0)
{ {
ReadSkin(); ReadSkin();
} }
@ -535,7 +535,7 @@ void CDialogManage::CTabSkins::SetControls()
item = GetDlgItem(m_Window, IDC_MANAGESKINS_LOADORDER_TEXT); item = GetDlgItem(m_Window, IDC_MANAGESKINS_LOADORDER_TEXT);
EnableWindow(item, TRUE); EnableWindow(item, TRUE);
_itow_s(Rainmeter->GetLoadOrder(m_SkinName), buffer, 10); _itow_s(Rainmeter->GetLoadOrder(m_SkinFolderPath), buffer, 10);
SetWindowText(item, buffer); SetWindowText(item, buffer);
item = GetDlgItem(m_Window, IDC_MANAGESKINS_ONHOVER_COMBOBOX); item = GetDlgItem(m_Window, IDC_MANAGESKINS_ONHOVER_COMBOBOX);
@ -641,17 +641,17 @@ void CDialogManage::CTabSkins::DisableControls(bool clear)
void CDialogManage::CTabSkins::ReadSkin() void CDialogManage::CTabSkins::ReadSkin()
{ {
HWND item = GetDlgItem(m_Window, IDC_MANAGESKINS_FILE_TEXT); 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); 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); item = GetDlgItem(m_Window, IDC_MANAGESKINS_EDIT_BUTTON);
EnableWindow(item, TRUE); EnableWindow(item, TRUE);
std::wstring file = Rainmeter->GetSkinPath() + m_SkinName; std::wstring file = Rainmeter->GetSkinPath() + m_SkinFolderPath;
file += L'\\'; file += L'\\';
file += m_FileName; file += m_SkinFileName;
m_SkinWindow = Rainmeter->GetMeterWindowByINI(file); m_SkinWindow = Rainmeter->GetMeterWindowByINI(file);
if (!m_SkinWindow) 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(); const size_t max = Rainmeter->m_SkinFolders.size();
while (index < max) while (index < max)
{ {
const CRainmeter::SkinFolder& folder = Rainmeter->m_SkinFolders[index]; const CRainmeter::SkinFolder& skinFolder = Rainmeter->m_SkinFolders[index];
if (folder.level != initialLevel) if (skinFolder.level != initialLevel)
{ {
return index - 1; return index - 1;
} }
@ -756,7 +756,7 @@ int CDialogManage::CTabSkins::PopulateTree(HWND tree, TVINSERTSTRUCT& tvi, int i
// Add folder // Add folder
tvi.item.iImage = tvi.item.iSelectedImage = 0; 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); tvi.hParent = TreeView_InsertItem(tree, &tvi);
// Add subfolders // Add subfolders
@ -768,9 +768,9 @@ int CDialogManage::CTabSkins::PopulateTree(HWND tree, TVINSERTSTRUCT& tvi, int i
// Add files // Add files
tvi.item.iImage = tvi.item.iSelectedImage = 1; 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); TreeView_InsertItem(tree, &tvi);
} }
@ -873,8 +873,8 @@ INT_PTR CDialogManage::CTabSkins::OnCommand(WPARAM wParam, LPARAM lParam)
int index = 0; int index = 0;
for ( ; iter != Rainmeter->GetAllMeterWindows().end(); ++iter) for ( ; iter != Rainmeter->GetAllMeterWindows().end(); ++iter)
{ {
std::wstring name = ((*iter).second)->GetSkinName() + L'\\'; std::wstring name = ((*iter).second)->GetFolderPath() + L'\\';
name += ((*iter).second)->GetSkinIniFile(); name += ((*iter).second)->GetFileName();
InsertMenu(menu, index, MF_BYPOSITION, ID_CONFIG_FIRST + index, name.c_str()); InsertMenu(menu, index, MF_BYPOSITION, ID_CONFIG_FIRST + index, name.c_str());
++index; ++index;
} }
@ -905,10 +905,10 @@ INT_PTR CDialogManage::CTabSkins::OnCommand(WPARAM wParam, LPARAM lParam)
if (!m_SkinWindow) if (!m_SkinWindow)
{ {
// Skin not active, load // Skin not active, load
std::pair<int, int> indexes = Rainmeter->GetMeterWindowIndex(m_SkinName, m_FileName); std::pair<int, int> indexes = Rainmeter->GetMeterWindowIndex(m_SkinFolderPath, m_SkinFileName);
if (indexes.first != -1 && indexes.second != -1) 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 // Fake selection change to update controls
NMHDR nm; NMHDR nm;
@ -921,7 +921,7 @@ INT_PTR CDialogManage::CTabSkins::OnCommand(WPARAM wParam, LPARAM lParam)
else else
{ {
m_HandleCommands = false; m_HandleCommands = false;
Rainmeter->DeactivateConfig(m_SkinWindow, -1); Rainmeter->DeactivateSkin(m_SkinWindow, -1);
} }
} }
break; break;
@ -934,7 +934,7 @@ INT_PTR CDialogManage::CTabSkins::OnCommand(WPARAM wParam, LPARAM lParam)
break; break;
case IDC_MANAGESKINS_EDIT_BUTTON: case IDC_MANAGESKINS_EDIT_BUTTON:
Rainmeter->EditSkinFile(m_SkinName, m_FileName); Rainmeter->EditSkinFile(m_SkinFolderPath, m_SkinFileName);
break; break;
case IDC_MANAGESKINS_X_TEXT: case IDC_MANAGESKINS_X_TEXT:
@ -1001,7 +1001,7 @@ INT_PTR CDialogManage::CTabSkins::OnCommand(WPARAM wParam, LPARAM lParam)
// Reset selection // Reset selection
Edit_SetSel((HWND)lParam, LOWORD(sel), HIWORD(sel)); 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<int, int> indexes = Rainmeter->GetMeterWindowIndex(m_SkinWindow); std::pair<int, int> indexes = Rainmeter->GetMeterWindowIndex(m_SkinWindow);
if (indexes.first != -1) if (indexes.first != -1)
{ {
@ -1131,8 +1131,8 @@ INT_PTR CDialogManage::CTabSkins::OnCommand(WPARAM wParam, LPARAM lParam)
{ {
if (i == index) if (i == index)
{ {
std::wstring name = ((*iter).second)->GetSkinName() + L'\\'; std::wstring name = ((*iter).second)->GetFolderPath() + L'\\';
name += ((*iter).second)->GetSkinIniFile(); name += ((*iter).second)->GetFileName();
HWND item = GetDlgItem(m_Window, IDC_MANAGESKINS_SKINS_TREEVIEW); HWND item = GetDlgItem(m_Window, IDC_MANAGESKINS_SKINS_TREEVIEW);
SelectTreeItem(item, TreeView_GetRoot(item), name.c_str()); SelectTreeItem(item, TreeView_GetRoot(item), name.c_str());
@ -1167,9 +1167,9 @@ INT_PTR CDialogManage::CTabSkins::OnNotify(WPARAM wParam, LPARAM lParam)
case NM_CLICK: case NM_CLICK:
if (nm->idFrom == IDC_MANAGESKINS_ADDMETADATA_LINK) if (nm->idFrom == IDC_MANAGESKINS_ADDMETADATA_LINK)
{ {
std::wstring file = Rainmeter->GetSkinPath() + m_SkinName; std::wstring file = Rainmeter->GetSkinPath() + m_SkinFolderPath;
file += L'\\'; 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()); 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); SendMessage(m_Window, WM_COMMAND, MAKEWPARAM(IDC_MANAGESKINS_EDIT_BUTTON, 0), 0);
ShowWindow(nm->hwndFrom, SW_HIDE); ShowWindow(nm->hwndFrom, SW_HIDE);
@ -1177,7 +1177,7 @@ INT_PTR CDialogManage::CTabSkins::OnNotify(WPARAM wParam, LPARAM lParam)
break; break;
case NM_DBLCLK: 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); 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.cbSize = sizeof(MENUITEMINFO);
mii.fMask = MIIM_STRING; mii.fMask = MIIM_STRING;
if (m_FileName.empty()) if (m_SkinFileName.empty())
{ {
// It's a folder // It's a folder
subMenu = GetSubMenu(menu, 0); subMenu = GetSubMenu(menu, 0);
@ -1259,8 +1259,8 @@ INT_PTR CDialogManage::CTabSkins::OnNotify(WPARAM wParam, LPARAM lParam)
if (nm->idFrom == IDC_MANAGESKINS_SKINS_TREEVIEW) if (nm->idFrom == IDC_MANAGESKINS_SKINS_TREEVIEW)
{ {
m_SkinWindow = NULL; m_SkinWindow = NULL;
m_FileName.clear(); m_SkinFileName.clear();
m_SkinName.clear(); m_SkinFolderPath.clear();
// Temporarily disable handling commands // Temporarily disable handling commands
m_HandleCommands = false; m_HandleCommands = false;
@ -1278,19 +1278,19 @@ INT_PTR CDialogManage::CTabSkins::OnNotify(WPARAM wParam, LPARAM lParam)
if (tvi.cChildren == 0) if (tvi.cChildren == 0)
{ {
// Current selection is file // Current selection is file
m_FileName = buffer; m_SkinFileName = buffer;
tvi.mask = TVIF_TEXT; tvi.mask = TVIF_TEXT;
// Loop through parents to get config // Loop through parents to get skin folder
m_SkinName.clear(); m_SkinFolderPath.clear();
while ((tvi.hItem = TreeView_GetParent(nm->hwndFrom, tvi.hItem)) != NULL) while ((tvi.hItem = TreeView_GetParent(nm->hwndFrom, tvi.hItem)) != NULL)
{ {
TreeView_GetItem(nm->hwndFrom, &tvi); TreeView_GetItem(nm->hwndFrom, &tvi);
m_SkinName.insert(0, 1, L'\\'); m_SkinFolderPath.insert(0, 1, L'\\');
m_SkinName.insert(0, buffer); 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(); ReadSkin();
} }
@ -1522,7 +1522,7 @@ INT_PTR CDialogManage::CTabThemes::OnCommand(WPARAM wParam, LPARAM lParam)
args += L"Themes\\"; args += L"Themes\\";
args += themes[sel]; args += themes[sel];
args += L"\\Rainmeter.thm"; args += L"\\Rainmeter.thm";
RunFile(Rainmeter->GetConfigEditor().c_str(), args.c_str()); RunFile(Rainmeter->GetSkinEditor().c_str(), args.c_str());
} }
break; break;

View File

@ -68,8 +68,8 @@ private:
static int PopulateTree(HWND tree, TVINSERTSTRUCT& tvi, int index = 0); static int PopulateTree(HWND tree, TVINSERTSTRUCT& tvi, int index = 0);
std::wstring m_FileName; std::wstring m_SkinFileName;
std::wstring m_SkinName; std::wstring m_SkinFolderPath;
CMeterWindow* m_SkinWindow; CMeterWindow* m_SkinWindow;
bool m_HandleCommands; bool m_HandleCommands;
bool m_IgnoreUpdate; bool m_IgnoreUpdate;

View File

@ -138,7 +138,7 @@ LPCWSTR PluginBridge(LPCWSTR command, LPCWSTR data)
if (meterWindow) if (meterWindow)
{ {
g_Buffer = L"\""; g_Buffer = L"\"";
g_Buffer += meterWindow->GetSkinName(); g_Buffer += meterWindow->GetFolderPath();
g_Buffer += L"\""; g_Buffer += L"\"";
return g_Buffer.c_str(); return g_Buffer.c_str();
} }

View File

@ -232,13 +232,13 @@ void LogInternal(int nLevel, ULONGLONG elapsed, LPCTSTR pszMessage)
void Log(int nLevel, const WCHAR* message) void Log(int nLevel, const WCHAR* message)
{ {
struct DELAYED_LOG_INFO struct DELAYED_LogInfo
{ {
int level; int level;
ULONGLONG elapsed; ULONGLONG elapsed;
std::wstring message; std::wstring message;
}; };
static std::list<DELAYED_LOG_INFO> c_LogDelay; static std::list<DELAYED_LogInfo> c_LogDelay;
static ULONGLONG startTime = CSystem::GetTickCount64(); static ULONGLONG startTime = CSystem::GetTickCount64();
ULONGLONG elapsed = CSystem::GetTickCount64() - startTime; ULONGLONG elapsed = CSystem::GetTickCount64() - startTime;
@ -250,7 +250,7 @@ void Log(int nLevel, const WCHAR* message)
while (!c_LogDelay.empty()) 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()); LogInternal(logInfo.level, logInfo.elapsed, logInfo.message.c_str());
c_LogDelay.erase(c_LogDelay.begin()); c_LogDelay.erase(c_LogDelay.begin());
@ -268,7 +268,7 @@ void Log(int nLevel, const WCHAR* message)
// Queue the message // Queue the message
EnterCriticalSection(&g_CsLogDelay); EnterCriticalSection(&g_CsLogDelay);
DELAYED_LOG_INFO logInfo = {nLevel, elapsed, message}; DELAYED_LogInfo logInfo = {nLevel, elapsed, message};
c_LogDelay.push_back(logInfo); c_LogDelay.push_back(logInfo);
LeaveCriticalSection(&g_CsLogDelay); LeaveCriticalSection(&g_CsLogDelay);

View File

@ -111,8 +111,8 @@ void CMeasure::Initialize()
} }
/* /*
** Reads the common configs for all Measures. The inherited classes ** Read the common options specified in the ini file. The inherited classes must
** must call the base implementation if they overwrite this method. ** call this base implementation if they overwrite this method.
** **
*/ */
void CMeasure::ReadOptions(CConfigParser& parser, const WCHAR* section) void CMeasure::ReadOptions(CConfigParser& parser, const WCHAR* section)

View File

@ -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) void CMeasureCPU::ReadOptions(CConfigParser& parser, const WCHAR* section)

View File

@ -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) void CMeasureCalc::ReadOptions(CConfigParser& parser, const WCHAR* section)

View File

@ -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) void CMeasureDiskSpace::ReadOptions(CConfigParser& parser, const WCHAR* section)

View File

@ -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) void CMeasureMemory::ReadOptions(CConfigParser& parser, const WCHAR* section)

View File

@ -434,8 +434,7 @@ ULONG64 CMeasureNet::GetNetStatsValue(NET net)
} }
/* /*
** Reads the measure specific configs. This is the same for in, out and total. ** Read the options specified in the ini file. Base implementation for In/Out/Total.
** the net-parameter informs which inherited class called this method.
** **
*/ */
void CMeasureNet::ReadOptions(CConfigParser& parser, const WCHAR* section, NET net) 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) if (net == NET_IN)
{ {
netName = L"NetInSpeed"; netName = L"NetInSpeed";
value = Rainmeter->GetGlobalConfig().netInSpeed; value = Rainmeter->GetGlobalOptions().netInSpeed;
} }
else if (net == NET_OUT) else if (net == NET_OUT)
{ {
netName = L"NetOutSpeed"; netName = L"NetOutSpeed";
value = Rainmeter->GetGlobalConfig().netOutSpeed; value = Rainmeter->GetGlobalOptions().netOutSpeed;
} }
else else
{ {
netName = L"NetTotalSpeed"; 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); double maxValue = parser.ReadFloat(section, L"MaxValue", -1);

View File

@ -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) void CMeasureNetIn::ReadOptions(CConfigParser& parser, const WCHAR* section)

View File

@ -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) void CMeasureNetOut::ReadOptions(CConfigParser& parser, const WCHAR* section)

View File

@ -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) void CMeasureNetTotal::ReadOptions(CConfigParser& parser, const WCHAR* section)

View File

@ -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) void CMeasurePhysicalMemory::ReadOptions(CConfigParser& parser, const WCHAR* section)

View File

@ -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) void CMeasurePlugin::ReadOptions(CConfigParser& parser, const WCHAR* section)
@ -169,7 +169,7 @@ void CMeasurePlugin::ReadOptions(CConfigParser& parser, const WCHAR* section)
if (initializeFunc) 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);
} }
} }

View File

@ -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) void CMeasureRegistry::ReadOptions(CConfigParser& parser, const WCHAR* section)

View File

@ -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) void CMeasureScript::ReadOptions(CConfigParser& parser, const WCHAR* section)
{ {
// Read common configs
CMeasure::ReadOptions(parser, section); CMeasure::ReadOptions(parser, section);
std::wstring file = parser.ReadString(section, L"ScriptFile", L""); std::wstring file = parser.ReadString(section, L"ScriptFile", L"");

View File

@ -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) void CMeasureTime::ReadOptions(CConfigParser& parser, const WCHAR* section)

View File

@ -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) void CMeasureUptime::ReadOptions(CConfigParser& parser, const WCHAR* section)

View File

@ -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) void CMeasureVirtualMemory::ReadOptions(CConfigParser& parser, const WCHAR* section)

View File

@ -248,9 +248,8 @@ void CMeter::Hide()
} }
/* /*
** Reads the meter-specific configs from the ini-file. The base implementation ** Read the common options specified in the ini file. The inherited classes must
** reads the common settings for all meters. The inherited classes must call ** call this base implementation if they overwrite this method.
** the base implementation if they overwrite this method.
** **
*/ */
void CMeter::ReadOptions(CConfigParser& parser, const WCHAR* section) void CMeter::ReadOptions(CConfigParser& parser, const WCHAR* section)

View File

@ -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) 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 oldW = m_W;
int oldH = m_H; int oldH = m_H;
// Read common configs
CMeter::ReadOptions(parser, section); CMeter::ReadOptions(parser, section);
m_Color = parser.ReadColor(section, L"BarColor", Color::Green); 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); m_MeterWindow->MakePathAbsolute(m_ImageName);
// Read tinting configs // Read tinting options
m_Image.ReadOptions(parser, section); m_Image.ReadOptions(parser, section);
} }
else else

View File

@ -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) 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 oldW = m_W;
int oldH = m_H; int oldH = m_H;
// Read common configs
CMeter::ReadOptions(parser, section); CMeter::ReadOptions(parser, section);
m_ImageName = parser.ReadString(section, L"BitmapImage", L""); 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); m_MeterWindow->MakePathAbsolute(m_ImageName);
// Read tinting configs // Read tinting options
m_Image.ReadOptions(parser, section); m_Image.ReadOptions(parser, section);
} }
else else

View File

@ -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) 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 oldW = m_W;
int oldH = m_H; int oldH = m_H;
// Read common configs
CMeter::ReadOptions(parser, section); CMeter::ReadOptions(parser, section);
m_ImageName = parser.ReadString(section, L"ButtonImage", L""); 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); m_MeterWindow->MakePathAbsolute(m_ImageName);
// Read tinting configs // Read tinting options
m_Image.ReadOptions(parser, section); m_Image.ReadOptions(parser, section);
} }
else else

View File

@ -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) 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 oldW = m_W;
int oldH = m_H; int oldH = m_H;
// Read common configs
CMeter::ReadOptions(parser, section); CMeter::ReadOptions(parser, section);
m_PrimaryColor = parser.ReadColor(section, L"PrimaryColor", Color::Green); 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); m_MeterWindow->MakePathAbsolute(m_PrimaryImageName);
// Read tinting configs // Read tinting options
m_PrimaryImage.ReadOptions(parser, section); m_PrimaryImage.ReadOptions(parser, section);
} }
else else
@ -225,7 +224,7 @@ void CMeterHistogram::ReadOptions(CConfigParser& parser, const WCHAR* section)
{ {
m_MeterWindow->MakePathAbsolute(m_SecondaryImageName); m_MeterWindow->MakePathAbsolute(m_SecondaryImageName);
// Read tinting configs // Read tinting options
m_SecondaryImage.ReadOptions(parser, section); m_SecondaryImage.ReadOptions(parser, section);
} }
else else
@ -238,7 +237,7 @@ void CMeterHistogram::ReadOptions(CConfigParser& parser, const WCHAR* section)
{ {
m_MeterWindow->MakePathAbsolute(m_OverlapImageName); m_MeterWindow->MakePathAbsolute(m_OverlapImageName);
// Read tinting configs // Read tinting options
m_OverlapImage.ReadOptions(parser, section); m_OverlapImage.ReadOptions(parser, section);
} }
else else

View File

@ -76,9 +76,9 @@ private:
bool m_GraphStartLeft; bool m_GraphStartLeft;
bool m_GraphHorizontalOrientation; bool m_GraphHorizontalOrientation;
static const WCHAR* c_PrimaryOptionArray[CTintedImage::ConfigCount]; static const WCHAR* c_PrimaryOptionArray[CTintedImage::OptionCount];
static const WCHAR* c_SecondaryOptionArray[CTintedImage::ConfigCount]; static const WCHAR* c_SecondaryOptionArray[CTintedImage::OptionCount];
static const WCHAR* c_BothOptionArray[CTintedImage::ConfigCount]; static const WCHAR* c_BothOptionArray[CTintedImage::OptionCount];
}; };
#endif #endif

View File

@ -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) void CMeterImage::ReadOptions(CConfigParser& parser, const WCHAR* section)
{ {
// Read common configs
CMeter::ReadOptions(parser, section); CMeter::ReadOptions(parser, section);
// Check for extra measures // Check for extra measures
@ -134,7 +133,7 @@ void CMeterImage::ReadOptions(CConfigParser& parser, const WCHAR* section)
static const RECT defMargins = {0}; static const RECT defMargins = {0};
m_ScaleMargins = parser.ReadRECT(section, L"ScaleMargins", defMargins); m_ScaleMargins = parser.ReadRECT(section, L"ScaleMargins", defMargins);
// Read tinting configs // Read tinting options
m_Image.ReadOptions(parser, section); m_Image.ReadOptions(parser, section);
if (m_Initialized && if (m_Initialized &&

View File

@ -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) 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 oldLineCount = (int)m_Colors.size();
int oldW = m_W; int oldW = m_W;
// Read common configs
CMeter::ReadOptions(parser, section); CMeter::ReadOptions(parser, section);
int lineCount = parser.ReadInt(section, L"LineCount", 1); int lineCount = parser.ReadInt(section, L"LineCount", 1);

View File

@ -54,7 +54,7 @@ CMeterRotator::~CMeterRotator()
} }
/* /*
** Load the image & configs. ** Load the image.
** **
*/ */
void CMeterRotator::Initialize() 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) 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 // Store the current values so we know if the image needs to be updated
std::wstring oldImageName = m_ImageName; std::wstring oldImageName = m_ImageName;
// Read common configs
CMeter::ReadOptions(parser, section); CMeter::ReadOptions(parser, section);
m_ImageName = parser.ReadString(section, L"ImageName", L""); 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); m_MeterWindow->MakePathAbsolute(m_ImageName);
// Read tinting configs // Read tinting options
m_Image.ReadOptions(parser, section); m_Image.ReadOptions(parser, section);
} }
else else

View File

@ -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) void CMeterRoundLine::ReadOptions(CConfigParser& parser, const WCHAR* section)
{ {
// Read common configs
CMeter::ReadOptions(parser, section); CMeter::ReadOptions(parser, section);
m_LineWidth = parser.ReadFloat(section, L"LineWidth", 1.0); m_LineWidth = parser.ReadFloat(section, L"LineWidth", 1.0);

View File

@ -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) void CMeterString::ReadOptions(CConfigParser& parser, const WCHAR* section)
@ -317,7 +317,6 @@ void CMeterString::ReadOptions(CConfigParser& parser, const WCHAR* section)
int oldFontSize = m_FontSize; int oldFontSize = m_FontSize;
TEXTSTYLE oldStyle = m_Style; TEXTSTYLE oldStyle = m_Style;
// Read common configs
CMeter::ReadOptions(parser, section); CMeter::ReadOptions(parser, section);
// Check for extra measures // Check for extra measures

View File

@ -73,7 +73,7 @@ extern CRainmeter* Rainmeter;
** Constructor ** 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_DoubleBuffer(),
m_DIBSectionBuffer(), m_DIBSectionBuffer(),
m_DIBSectionBufferPixels(), 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) void CMeterWindow::Refresh(bool init, bool all)
@ -335,9 +335,9 @@ void CMeterWindow::Refresh(bool init, bool all)
Rainmeter->SetCurrentParser(&m_Parser); Rainmeter->SetCurrentParser(&m_Parser);
std::wstring notice = L"Refreshing skin \"" + m_SkinName; std::wstring notice = L"Refreshing skin \"" + m_FolderPath;
notice += L'\\'; notice += L'\\';
notice += m_SkinIniFile; notice += m_FileName;
notice += L'"'; notice += L'"';
Log(LOG_NOTICE, notice.c_str()); Log(LOG_NOTICE, notice.c_str());
@ -395,7 +395,7 @@ void CMeterWindow::Refresh(bool init, bool all)
ReadOptions(); // Read the general settings ReadOptions(); // Read the general settings
if (!ReadSkin()) if (!ReadSkin())
{ {
Rainmeter->DeactivateConfig(this, -1); Rainmeter->DeactivateSkin(this, -1);
return; return;
} }
@ -572,7 +572,7 @@ void CMeterWindow::MoveWindow(int x, int y)
if (m_SavePosition) 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 // Post-updates
PostUpdate(bActiveTransition); 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 options
** Calculates the screen cordinates from the WindowX/Y config
** **
*/ */
void CMeterWindow::WindowToScreen() void CMeterWindow::WindowToScreen()
@ -1771,14 +1770,14 @@ void CMeterWindow::ScreenToWindow()
} }
/* /*
** Reads the current config ** Reads the skin options from Rainmeter.ini
** **
*/ */
void CMeterWindow::ReadOptions() void CMeterWindow::ReadOptions()
{ {
WCHAR buffer[32]; WCHAR buffer[32];
const WCHAR* section = m_SkinName.c_str(); const WCHAR* section = m_FolderPath.c_str();
CConfigParser parser; CConfigParser parser;
parser.Initialize(Rainmeter->GetIniFile(), NULL, section); parser.Initialize(Rainmeter->GetIniFile(), NULL, section);
@ -1794,14 +1793,14 @@ void CMeterWindow::ReadOptions()
// Check if the window position should be read as a formula // Check if the window position should be read as a formula
double value; double value;
m_WindowX = parser.ReadString(section, L"WindowX", L"0"); m_WindowX = parser.ReadString(section, L"WindowX", L"0");
addWriteFlag(SETTING_WINDOWPOSITION); addWriteFlag(OPTION_POSITION);
if (parser.ParseFormula(m_WindowX, &value)) if (parser.ParseFormula(m_WindowX, &value))
{ {
_itow_s((int)value, buffer, 10); _itow_s((int)value, buffer, 10);
m_WindowX = buffer; m_WindowX = buffer;
} }
m_WindowY = parser.ReadString(section, L"WindowY", L"0"); m_WindowY = parser.ReadString(section, L"WindowY", L"0");
addWriteFlag(SETTING_WINDOWPOSITION); addWriteFlag(OPTION_POSITION);
if (parser.ParseFormula(m_WindowY, &value)) if (parser.ParseFormula(m_WindowY, &value))
{ {
_itow_s((int)value, buffer, 10); _itow_s((int)value, buffer, 10);
@ -1812,23 +1811,23 @@ void CMeterWindow::ReadOptions()
m_AnchorY = parser.ReadString(section, L"AnchorY", L"0"); m_AnchorY = parser.ReadString(section, L"AnchorY", L"0");
int zPos = parser.ReadInt(section, L"AlwaysOnTop", ZPOSITION_NORMAL); 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; m_WindowZPosition = (zPos >= ZPOSITION_ONDESKTOP && zPos <= ZPOSITION_ONTOPMOST) ? (ZPOSITION)zPos : ZPOSITION_NORMAL;
int hideMode = parser.ReadInt(section, L"HideOnMouseOver", HIDEMODE_NONE); int hideMode = parser.ReadInt(section, L"HideOnMouseOver", HIDEMODE_NONE);
m_WindowHide = (hideMode >= HIDEMODE_NONE && hideMode <= HIDEMODE_FADEOUT) ? (HIDEMODE)hideMode : HIDEMODE_NONE; m_WindowHide = (hideMode >= HIDEMODE_NONE && hideMode <= HIDEMODE_FADEOUT) ? (HIDEMODE)hideMode : HIDEMODE_NONE;
m_WindowDraggable = 0!=parser.ReadInt(section, L"Draggable", 1); m_WindowDraggable = 0!=parser.ReadInt(section, L"Draggable", 1);
addWriteFlag(SETTING_WINDOWDRAGGABLE); addWriteFlag(OPTION_DRAGGABLE);
m_SnapEdges = 0!=parser.ReadInt(section, L"SnapEdges", 1); m_SnapEdges = 0!=parser.ReadInt(section, L"SnapEdges", 1);
addWriteFlag(SETTING_SNAPEDGES); addWriteFlag(OPTION_SNAPEDGES);
m_ClickThrough = 0!=parser.ReadInt(section, L"ClickThrough", 0); m_ClickThrough = 0!=parser.ReadInt(section, L"ClickThrough", 0);
addWriteFlag(SETTING_CLICKTHROUGH); addWriteFlag(OPTION_CLICKTHROUGH);
m_KeepOnScreen = 0!=parser.ReadInt(section, L"KeepOnScreen", 1); 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_SavePosition = 0!=parser.ReadInt(section, L"SavePosition", 1);
m_WindowStartHidden = 0!=parser.ReadInt(section, L"StartHidden", 0); 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_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) 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) void CMeterWindow::WriteOptions(INT setting)
@ -1862,14 +1861,14 @@ void CMeterWindow::WriteOptions(INT setting)
if (*iniFile) if (*iniFile)
{ {
WCHAR buffer[32]; 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); CDialogManage::UpdateSkins(this);
} }
if (setting & SETTING_WINDOWPOSITION) if (setting & OPTION_POSITION)
{ {
// If position needs to be save, do so. // If position needs to be save, do so.
if (m_SavePosition) 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); _itow_s(m_AlphaValue, buffer, 10);
WritePrivateProfileString(section, L"AlphaValue", buffer, iniFile); WritePrivateProfileString(section, L"AlphaValue", buffer, iniFile);
} }
if (setting & SETTING_FADEDURATION) if (setting & OPTION_FADEDURATION)
{ {
_itow_s(m_FadeDuration, buffer, 10); _itow_s(m_FadeDuration, buffer, 10);
WritePrivateProfileString(section, L"FadeDuration", buffer, iniFile); 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); 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); 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); _itow_s(m_WindowHide, buffer, 10);
WritePrivateProfileString(section, L"HideOnMouseOver", buffer, iniFile); 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); 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); 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); 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); 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); _itow_s(m_WindowZPosition, buffer, 10);
WritePrivateProfileString(section, L"AlwaysOnTop", buffer, iniFile); 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() bool CMeterWindow::ReadSkin()
{ {
WCHAR buffer[128]; WCHAR buffer[128];
std::wstring iniFile = GetSkinFilePath(); std::wstring iniFile = GetFilePath();
// Verify whether the file exists // Verify whether the file exists
if (_waccess(iniFile.c_str(), 0) == -1) 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); MessageBox(m_Window, message.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
return false; return false;
} }
std::wstring resourcePath = GetSkinResourcesPath(); std::wstring resourcePath = GetResourcesPath();
bool hasResourcesFolder = (_waccess(resourcePath.c_str(), 0) == 0); bool hasResourcesFolder = (_waccess(resourcePath.c_str(), 0) == 0);
m_Parser.Initialize(iniFile, this, NULL, &resourcePath); 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); _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); MessageBox(m_Window, text.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
return false; return false;
} }
@ -1985,10 +1984,10 @@ bool CMeterWindow::ReadSkin()
const std::wstring& group = m_Parser.ReadString(L"Rainmeter", L"Group", L""); const std::wstring& group = m_Parser.ReadString(L"Rainmeter", L"Group", L"");
if (!group.empty()) if (!group.empty())
{ {
m_ConfigGroup += L'|'; m_SkinGroup += L'|';
m_ConfigGroup += group; m_SkinGroup += group;
} }
InitializeGroup(m_ConfigGroup); InitializeGroup(m_SkinGroup);
static const RECT defMargins = {0}; static const RECT defMargins = {0};
m_BackgroundMargins = m_Parser.ReadRECT(L"Rainmeter", L"BackgroundMargins", defMargins); m_BackgroundMargins = m_Parser.ReadRECT(L"Rainmeter", L"BackgroundMargins", defMargins);
@ -2226,7 +2225,7 @@ bool CMeterWindow::ReadSkin()
if (m_Meters.empty()) 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); MessageBox(m_Window, text.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
return false; return false;
} }
@ -2456,7 +2455,7 @@ bool CMeterWindow::ResizeWindow(bool reset)
// Get the size form the background bitmap // Get the size form the background bitmap
m_WindowW = m_Background->GetWidth(); m_WindowW = m_Background->GetWidth();
m_WindowH = m_Background->GetHeight(); m_WindowH = m_Background->GetHeight();
//Calculate the window position from the config parameters
WindowToScreen(); WindowToScreen();
} }
@ -3307,7 +3306,7 @@ LRESULT CMeterWindow::OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
if (wParam == IDM_SKIN_EDITSKIN) if (wParam == IDM_SKIN_EDITSKIN)
{ {
Rainmeter->EditSkinFile(m_SkinName, m_SkinIniFile); Rainmeter->EditSkinFile(m_FolderPath, m_FileName);
} }
else if (wParam == IDM_SKIN_REFRESH) 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) else if (wParam == IDM_SKIN_OPENSKINSFOLDER)
{ {
Rainmeter->OpenSkinFolder(m_SkinName); Rainmeter->OpenSkinFolder(m_FolderPath);
} }
else if (wParam == IDM_SKIN_MANAGESKIN) 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))); m_AlphaValue = (int)(255.0 - (wParam - IDM_SKIN_TRANSPARENCY_0) * (230.0 / (IDM_SKIN_TRANSPARENCY_90 - IDM_SKIN_TRANSPARENCY_0)));
UpdateWindow(m_AlphaValue, false); UpdateWindow(m_AlphaValue, false);
WriteOptions(SETTING_ALPHAVALUE); WriteOptions(OPTION_ALPHAVALUE);
} }
else if (wParam == IDM_CLOSESKIN) else if (wParam == IDM_CLOSESKIN)
{ {
Rainmeter->DeactivateConfig(this, -1); Rainmeter->DeactivateSkin(this, -1);
} }
else if (wParam == IDM_SKIN_FROMRIGHT) else if (wParam == IDM_SKIN_FROMRIGHT)
{ {
m_WindowXFromRight = !m_WindowXFromRight; m_WindowXFromRight = !m_WindowXFromRight;
ScreenToWindow(); ScreenToWindow();
WriteOptions(SETTING_WINDOWPOSITION); WriteOptions(OPTION_POSITION);
} }
else if (wParam == IDM_SKIN_FROMBOTTOM) else if (wParam == IDM_SKIN_FROMBOTTOM)
{ {
m_WindowYFromBottom = !m_WindowYFromBottom; m_WindowYFromBottom = !m_WindowYFromBottom;
ScreenToWindow(); ScreenToWindow();
WriteOptions(SETTING_WINDOWPOSITION); WriteOptions(OPTION_POSITION);
} }
else if (wParam == IDM_SKIN_XPERCENTAGE) else if (wParam == IDM_SKIN_XPERCENTAGE)
{ {
m_WindowXPercentage = !m_WindowXPercentage; m_WindowXPercentage = !m_WindowXPercentage;
ScreenToWindow(); ScreenToWindow();
WriteOptions(SETTING_WINDOWPOSITION); WriteOptions(OPTION_POSITION);
} }
else if (wParam == IDM_SKIN_YPERCENTAGE) else if (wParam == IDM_SKIN_YPERCENTAGE)
{ {
m_WindowYPercentage = !m_WindowYPercentage; m_WindowYPercentage = !m_WindowYPercentage;
ScreenToWindow(); ScreenToWindow();
WriteOptions(SETTING_WINDOWPOSITION); WriteOptions(OPTION_POSITION);
} }
else if (wParam == IDM_SKIN_MONITOR_AUTOSELECT) else if (wParam == IDM_SKIN_MONITOR_AUTOSELECT)
{ {
m_AutoSelectScreen = !m_AutoSelectScreen; m_AutoSelectScreen = !m_AutoSelectScreen;
ScreenToWindow(); 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) 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 m_Parser.ResetMonitorVariables(this); // Set present monitor variables
ScreenToWindow(); ScreenToWindow();
WriteOptions(SETTING_WINDOWPOSITION | SETTING_AUTOSELECTSCREEN); WriteOptions(OPTION_POSITION | OPTION_AUTOSELECTSCREEN);
} }
} }
else else
@ -3481,7 +3480,7 @@ LRESULT CMeterWindow::OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam)
void CMeterWindow::SetClickThrough(bool b) void CMeterWindow::SetClickThrough(bool b)
{ {
m_ClickThrough = b; m_ClickThrough = b;
WriteOptions(SETTING_CLICKTHROUGH); WriteOptions(OPTION_CLICKTHROUGH);
if (!m_ClickThrough) if (!m_ClickThrough)
{ {
@ -3502,7 +3501,7 @@ void CMeterWindow::SetClickThrough(bool b)
void CMeterWindow::SetKeepOnScreen(bool b) void CMeterWindow::SetKeepOnScreen(bool b)
{ {
m_KeepOnScreen = b; m_KeepOnScreen = b;
WriteOptions(SETTING_KEEPONSCREEN); WriteOptions(OPTION_KEEPONSCREEN);
if (m_KeepOnScreen) if (m_KeepOnScreen)
{ {
@ -3523,7 +3522,7 @@ void CMeterWindow::SetKeepOnScreen(bool b)
void CMeterWindow::SetWindowDraggable(bool b) void CMeterWindow::SetWindowDraggable(bool b)
{ {
m_WindowDraggable = b; m_WindowDraggable = b;
WriteOptions(SETTING_WINDOWDRAGGABLE); WriteOptions(OPTION_DRAGGABLE);
} }
/* /*
@ -3533,7 +3532,7 @@ void CMeterWindow::SetWindowDraggable(bool b)
void CMeterWindow::SetSavePosition(bool b) void CMeterWindow::SetSavePosition(bool b)
{ {
m_SavePosition = 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) void CMeterWindow::SetSnapEdges(bool b)
{ {
m_SnapEdges = b; m_SnapEdges = b;
WriteOptions(SETTING_SNAPEDGES); WriteOptions(OPTION_SNAPEDGES);
} }
/* /*
@ -3554,7 +3553,7 @@ void CMeterWindow::SetWindowHide(HIDEMODE hide)
{ {
m_WindowHide = hide; m_WindowHide = hide;
UpdateWindow(m_AlphaValue, false); UpdateWindow(m_AlphaValue, false);
WriteOptions(SETTING_HIDEONMOUSEOVER); WriteOptions(OPTION_HIDEONMOUSEOVER);
} }
/* /*
@ -3564,7 +3563,7 @@ void CMeterWindow::SetWindowHide(HIDEMODE hide)
void CMeterWindow::SetWindowZPosition(ZPOSITION zpos) void CMeterWindow::SetWindowZPosition(ZPOSITION zpos)
{ {
ChangeSingleZPos(zpos); ChangeSingleZPos(zpos);
WriteOptions(SETTING_ALWAYSONTOP); WriteOptions(OPTION_ALWAYSONTOP);
} }
/* /*
@ -3591,10 +3590,9 @@ LRESULT CMeterWindow::OnSysCommand(UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
ScreenToWindow(); ScreenToWindow();
// Write the new place of the window to config file
if (m_SavePosition) if (m_SavePosition)
{ {
WriteOptions(SETTING_WINDOWPOSITION); WriteOptions(OPTION_POSITION);
} }
POINT pos; POINT pos;
@ -4344,7 +4342,7 @@ bool CMeterWindow::DoMoveAction(int x, int y, MOUSE mouse)
if (!m_MouseOver) if (!m_MouseOver)
{ {
// If the mouse is over a meter it's also over the main window // 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; m_MouseOver = true;
SetMouseLeaveEvent(false); SetMouseLeaveEvent(false);
@ -4381,7 +4379,7 @@ bool CMeterWindow::DoMoveAction(int x, int y, MOUSE mouse)
!((*j)->GetMouseLeaveAction().empty()) || !((*j)->GetMouseLeaveAction().empty()) ||
button) 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); (*j)->SetMouseOver(true);
if (!((*j)->GetMouseOverAction().empty())) if (!((*j)->GetMouseOverAction().empty()))
@ -4407,7 +4405,7 @@ bool CMeterWindow::DoMoveAction(int x, int y, MOUSE mouse)
button->SetFocus(false); 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); (*j)->SetMouseOver(false);
if (!((*j)->GetMouseLeaveAction().empty())) if (!((*j)->GetMouseLeaveAction().empty()))
@ -4427,7 +4425,7 @@ bool CMeterWindow::DoMoveAction(int x, int y, MOUSE mouse)
{ {
if (!m_MouseOver) 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; m_MouseOver = true;
SetMouseLeaveEvent(false); 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 // Mouse leave happens when the mouse is outside the window
if (m_MouseOver) 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; m_MouseOver = false;
SetMouseLeaveEvent(true); SetMouseLeaveEvent(true);
@ -4625,7 +4623,7 @@ LRESULT CMeterWindow::OnCopyData(UINT uMsg, WPARAM wParam, LPARAM lParam)
else else
{ {
// This meterwindow has been deactivated // 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; return TRUE;
@ -4675,44 +4673,44 @@ void CMeterWindow::MakePathAbsolute(std::wstring& path)
else else
{ {
std::wstring absolute; 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 = Rainmeter->GetSkinPath();
absolute += m_SkinName; absolute += m_FolderPath;
absolute += L'\\'; absolute += L'\\';
absolute += path; absolute += path;
absolute.swap(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 += L'\\';
file += m_SkinIniFile; file += m_FileName;
return file; return file;
} }
std::wstring CMeterWindow::GetSkinRootPath() std::wstring CMeterWindow::GetRootPath()
{ {
std::wstring path = Rainmeter->GetSkinPath(); std::wstring path = Rainmeter->GetSkinPath();
std::wstring::size_type loc; 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 else
{ {
path += m_SkinName; path += m_FolderPath;
path += L'\\'; path += L'\\';
} }
return path; return path;
} }
std::wstring CMeterWindow::GetSkinResourcesPath() std::wstring CMeterWindow::GetResourcesPath()
{ {
std::wstring path = GetSkinRootPath(); std::wstring path = GetRootPath();
path += L"@Resources\\"; path += L"@Resources\\";
return path; return path;
} }

View File

@ -160,7 +160,7 @@ class CMeter;
class CMeterWindow : public CGroup class CMeterWindow : public CGroup
{ {
public: public:
CMeterWindow(const std::wstring& config, const std::wstring& iniFile); CMeterWindow(const std::wstring& folderPath, const std::wstring& file);
~CMeterWindow(); ~CMeterWindow();
int Initialize(); int Initialize();
@ -201,11 +201,11 @@ public:
CConfigParser& GetParser() { return m_Parser; } CConfigParser& GetParser() { return m_Parser; }
const std::wstring& GetSkinName() { return m_SkinName; } const std::wstring& GetFolderPath() { return m_FolderPath; }
const std::wstring& GetSkinIniFile() { return m_SkinIniFile; } const std::wstring& GetFileName() { return m_FileName; }
std::wstring GetSkinFilePath(); std::wstring GetFilePath();
std::wstring GetSkinRootPath(); std::wstring GetRootPath();
std::wstring GetSkinResourcesPath(); std::wstring GetResourcesPath();
std::list<CMeasure*>& GetMeasures() { return m_Measures; } std::list<CMeasure*>& GetMeasures() { return m_Measures; }
std::list<CMeter*>& GetMeters() { return m_Meters; } std::list<CMeter*>& GetMeters() { return m_Meters; }
@ -284,21 +284,21 @@ protected:
LRESULT OnDisplayChange(UINT uMsg, WPARAM wParam, LPARAM lParam); LRESULT OnDisplayChange(UINT uMsg, WPARAM wParam, LPARAM lParam);
private: private:
enum SETTING enum OPTION
{ {
SETTING_WINDOWPOSITION = 0x00000001, OPTION_POSITION = 0x00000001,
SETTING_ALPHAVALUE = 0x00000002, OPTION_ALPHAVALUE = 0x00000002,
SETTING_FADEDURATION = 0x00000004, OPTION_FADEDURATION = 0x00000004,
SETTING_CLICKTHROUGH = 0x00000008, OPTION_CLICKTHROUGH = 0x00000008,
SETTING_WINDOWDRAGGABLE = 0x00000010, OPTION_DRAGGABLE = 0x00000010,
SETTING_HIDEONMOUSEOVER = 0x00000020, OPTION_HIDEONMOUSEOVER = 0x00000020,
SETTING_SAVEPOSITION = 0x00000040, OPTION_SAVEPOSITION = 0x00000040,
SETTING_SNAPEDGES = 0x00000080, OPTION_SNAPEDGES = 0x00000080,
SETTING_KEEPONSCREEN = 0x00000100, OPTION_KEEPONSCREEN = 0x00000100,
SETTING_AUTOSELECTSCREEN = 0x00000200, OPTION_AUTOSELECTSCREEN = 0x00000200,
SETTING_ALWAYSONTOP = 0x00000400, OPTION_ALWAYSONTOP = 0x00000400,
SETTING_ALL = 0xFFFFFFFF OPTION_ALL = 0xFFFFFFFF
}; };
enum RESIZEMODE enum RESIZEMODE
@ -312,7 +312,6 @@ private:
bool HitTest(int x, int y); bool HitTest(int x, int y);
void GetSkinFolders(const std::wstring& folder);
void SnapToWindow(CMeterWindow* window, LPWINDOWPOS wp); void SnapToWindow(CMeterWindow* window, LPWINDOWPOS wp);
void MapCoordsToScreen(int& x, int& y, int w, int h); void MapCoordsToScreen(int& x, int& y, int w, int h);
void WindowToScreen(); void WindowToScreen();
@ -323,7 +322,7 @@ private:
void Update(bool refresh); void Update(bool refresh);
void UpdateWindow(int alpha, bool reset); void UpdateWindow(int alpha, bool reset);
void ReadOptions(); void ReadOptions();
void WriteOptions(INT setting = SETTING_ALL); void WriteOptions(INT setting = OPTION_ALL);
bool ReadSkin(); bool ReadSkin();
void InitializeMeasures(); void InitializeMeasures();
void InitializeMeters(); void InitializeMeters();
@ -381,7 +380,7 @@ private:
bool m_MouseOver; bool m_MouseOver;
std::wstring m_ConfigGroup; std::wstring m_SkinGroup;
std::wstring m_BackgroundName; std::wstring m_BackgroundName;
RECT m_BackgroundMargins; RECT m_BackgroundMargins;
RECT m_DragMargins; RECT m_DragMargins;
@ -449,8 +448,8 @@ private:
std::list<CMeasure*> m_Measures; std::list<CMeasure*> m_Measures;
std::list<CMeter*> m_Meters; std::list<CMeter*> m_Meters;
const std::wstring m_SkinName; const std::wstring m_FolderPath;
const std::wstring m_SkinIniFile; const std::wstring m_FileName;
int m_UpdateCounter; int m_UpdateCounter;
UINT m_MouseMoveCounter; UINT m_MouseMoveCounter;

View File

@ -219,23 +219,23 @@ void CRainmeter::BangWithArgs(BANGCOMMAND bang, std::vector<std::wstring>& args,
// Use the specified window instead of meterWindow parameter // Use the specified window instead of meterWindow parameter
if (argsCount > numOfArgs) if (argsCount > numOfArgs)
{ {
const std::wstring& config = args[numOfArgs]; const std::wstring& folderPath = args[numOfArgs];
if (!config.empty() && (config.length() != 1 || config[0] != L'*')) if (!folderPath.empty() && (folderPath.length() != 1 || folderPath[0] != L'*'))
{ {
CMeterWindow* meterWindow = GetMeterWindow(config); CMeterWindow* meterWindow = GetMeterWindow(folderPath);
if (meterWindow) if (meterWindow)
{ {
meterWindow->RunBang(bang, args); meterWindow->RunBang(bang, args);
} }
else 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; return;
} }
} }
// No config defined -> apply to all. // No skin defined -> apply to all.
std::map<std::wstring, CMeterWindow*>::const_iterator iter = m_MeterWindows.begin(); std::map<std::wstring, CMeterWindow*>::const_iterator iter = m_MeterWindows.begin();
for (; iter != m_MeterWindows.end(); ++iter) for (; iter != m_MeterWindows.end(); ++iter)
{ {
@ -295,14 +295,14 @@ void CRainmeter::BangGroupWithArgs(BANGCOMMAND bang, std::vector<std::wstring>&
** !ActivateConfig bang ** !ActivateConfig bang
** **
*/ */
void CRainmeter::Bang_ActivateConfig(std::vector<std::wstring>& args) void CRainmeter::Bang_ActivateSkin(std::vector<std::wstring>& args)
{ {
if (args.size() > 1) if (args.size() > 1)
{ {
std::pair<int, int> indexes = GetMeterWindowIndex(args[0], args[1]); std::pair<int, int> indexes = GetMeterWindowIndex(args[0], args[1]);
if (indexes.first != -1 && indexes.second != -1) if (indexes.first != -1 && indexes.second != -1)
{ {
ActivateConfig(indexes.first, indexes.second); ActivateSkin(indexes.first, indexes.second);
return; return;
} }
LogWithArgs(LOG_ERROR, L"!ActivateConfig: \"%s\\%s\" not found", args[0].c_str(), args[1].c_str()); 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<std::wstring>& args)
** !DeactivateConfig bang ** !DeactivateConfig bang
** **
*/ */
void CRainmeter::Bang_DeactivateConfig(std::vector<std::wstring>& args, CMeterWindow* meterWindow) void CRainmeter::Bang_DeactivateSkin(std::vector<std::wstring>& args, CMeterWindow* meterWindow)
{ {
if (!args.empty()) if (!args.empty())
{ {
@ -332,7 +332,7 @@ void CRainmeter::Bang_DeactivateConfig(std::vector<std::wstring>& args, CMeterWi
if (meterWindow) if (meterWindow)
{ {
DeactivateConfig(meterWindow, -1); DeactivateSkin(meterWindow, -1);
} }
else else
{ {
@ -344,19 +344,19 @@ void CRainmeter::Bang_DeactivateConfig(std::vector<std::wstring>& args, CMeterWi
** !ToggleConfig bang ** !ToggleConfig bang
** **
*/ */
void CRainmeter::Bang_ToggleConfig(std::vector<std::wstring>& args) void CRainmeter::Bang_ToggleSkin(std::vector<std::wstring>& args)
{ {
if (args.size() >= 2) if (args.size() >= 2)
{ {
CMeterWindow* mw = GetMeterWindow(args[0]); CMeterWindow* mw = GetMeterWindow(args[0]);
if (mw) if (mw)
{ {
DeactivateConfig(mw, -1); DeactivateSkin(mw, -1);
return; return;
} }
// If the config wasn't active, activate it // If the skin wasn't active, activate it
Bang_ActivateConfig(args); Bang_ActivateSkin(args);
} }
else else
{ {
@ -368,7 +368,7 @@ void CRainmeter::Bang_ToggleConfig(std::vector<std::wstring>& args)
** !DeactivateConfigGroup bang ** !DeactivateConfigGroup bang
** **
*/ */
void CRainmeter::Bang_DeactivateConfigGroup(std::vector<std::wstring>& args) void CRainmeter::Bang_DeactivateSkinGroup(std::vector<std::wstring>& args)
{ {
if (!args.empty()) if (!args.empty())
{ {
@ -378,7 +378,7 @@ void CRainmeter::Bang_DeactivateConfigGroup(std::vector<std::wstring>& args)
std::multimap<int, CMeterWindow*>::const_iterator iter = windows.begin(); std::multimap<int, CMeterWindow*>::const_iterator iter = windows.begin();
for (; iter != windows.end(); ++iter) for (; iter != windows.end(); ++iter)
{ {
DeactivateConfig((*iter).second, -1); DeactivateSkin((*iter).second, -1);
} }
} }
else else
@ -475,8 +475,8 @@ void CRainmeter::Bang_WriteKeyValue(std::vector<std::wstring>& args, CMeterWindo
{ {
if (args.size() == 3 && meterWindow) if (args.size() == 3 && meterWindow)
{ {
// Add the config filepath to the args // Add the skin file path to the args
args.push_back(meterWindow->GetSkinFilePath()); args.push_back(meterWindow->GetFilePath());
} }
else if (args.size() < 4) else if (args.size() < 4)
{ {
@ -667,7 +667,7 @@ CRainmeter::CRainmeter() :
m_ResourceInstance(), m_ResourceInstance(),
m_ResourceLCID(), m_ResourceLCID(),
m_GDIplusToken(), m_GDIplusToken(),
m_GlobalConfig() m_GlobalOptions()
{ {
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE); CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
@ -930,7 +930,7 @@ int CRainmeter::Initialize(LPCWSTR iniPath)
// Create a default Rainmeter.ini file if needed // Create a default Rainmeter.ini file if needed
if (_waccess(iniFile, 0) == -1) if (_waccess(iniFile, 0) == -1)
{ {
CreateDefaultConfigFile(); CreateOptionsFile();
} }
delete [] buffer; delete [] buffer;
@ -975,7 +975,7 @@ int CRainmeter::Initialize(LPCWSTR iniPath)
CMeterString::EnumerateInstalledFontFamilies(); CMeterString::EnumerateInstalledFontFamilies();
} }
// Tray must exist before configs are read // Tray must exist before skins are read
m_TrayWindow = new CTrayWindow(); m_TrayWindow = new CTrayWindow();
m_TrayWindow->Initialize(); m_TrayWindow->Initialize();
@ -996,8 +996,8 @@ int CRainmeter::Initialize(LPCWSTR iniPath)
UpdateDesktopWorkArea(false); UpdateDesktopWorkArea(false);
} }
// Create meter windows for active configs // Create meter windows for active skins
ActivateActiveConfigs(); ActivateActiveSkins();
if (dataFileCreated) if (dataFileCreated)
{ {
@ -1157,7 +1157,7 @@ void CRainmeter::SetNetworkStatisticsTimer()
static bool set = SetTimer(m_Window, TIMER_NETSTATS, INTERVAL_NETSTATS, NULL); 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'\\'); size_t pos = m_IniFile.find_last_of(L'\\');
if (pos != std::wstring::npos) if (pos != std::wstring::npos)
@ -1196,14 +1196,14 @@ void CRainmeter::CreateDataFile()
void CRainmeter::ReloadSettings() void CRainmeter::ReloadSettings()
{ {
ScanForConfigs(m_SkinPath); ScanForSkins(m_SkinPath);
ScanForThemes(GetSettingsPath() + L"Themes"); ScanForThemes(GetSettingsPath() + L"Themes");
ReadGeneralSettings(m_IniFile); ReadGeneralSettings(m_IniFile);
} }
void CRainmeter::EditSettings() 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) 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()); bool writable = CSystem::IsFileWritable(args.c_str());
// Execute as admin if in protected location // 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) void CRainmeter::OpenSkinFolder(const std::wstring& name)
{ {
std::wstring folder = m_SkinPath + name; std::wstring folderPath = m_SkinPath + name;
RunFile(folder.c_str()); RunFile(folderPath.c_str());
} }
void CRainmeter::ActivateActiveConfigs() void CRainmeter::ActivateActiveSkins()
{ {
std::multimap<int, int>::const_iterator iter = m_ConfigOrders.begin(); std::multimap<int, int>::const_iterator iter = m_SkinOrders.begin();
for ( ; iter != m_ConfigOrders.end(); ++iter) for ( ; iter != m_SkinOrders.end(); ++iter)
{ {
const SkinFolder& folder = m_SkinFolders[(*iter).second]; const SkinFolder& skinFolder = m_SkinFolders[(*iter).second];
if (folder.active > 0 && folder.active <= (int)folder.files.size()) 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() && if (folderIndex >= 0 && folderIndex < (int)m_SkinFolders.size() &&
fileIndex >= 0 && fileIndex < (int)m_SkinFolders[folderIndex].files.size()) fileIndex >= 0 && fileIndex < (int)m_SkinFolders[folderIndex].files.size())
{ {
const SkinFolder& folder = m_SkinFolders[folderIndex]; const SkinFolder& skinFolder = m_SkinFolders[folderIndex];
const std::wstring& skinFile = folder.files[fileIndex]; const std::wstring& file = skinFolder.files[fileIndex];
const WCHAR* file = skinFile.c_str(); const WCHAR* fileSz = file.c_str();
std::wstring skinFolder = GetSkinFolderPath(folderIndex); std::wstring folderPath = GetFolderPath(folderIndex);
// Verify that the config is not already active // Verify that the skin is not already active
std::map<std::wstring, CMeterWindow*>::const_iterator iter = m_MeterWindows.find(skinFolder); std::map<std::wstring, CMeterWindow*>::const_iterator iter = m_MeterWindows.find(folderPath);
if (iter != m_MeterWindows.end()) 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; return;
} }
else else
{ {
// Deactivate the existing config // Deactivate the existing skin
DeactivateConfig((*iter).second, folderIndex); DeactivateSkin((*iter).second, folderIndex);
} }
} }
// Verify whether the ini-file exists // Verify whether the ini-file exists
std::wstring skinIniPath = m_SkinPath + skinFolder; std::wstring skinIniPath = m_SkinPath + folderPath;
skinIniPath += L'\\'; skinIniPath += L'\\';
skinIniPath += skinFile; skinIniPath += file;
if (_waccess(skinIniPath.c_str(), 0) == -1) 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); MessageBox(NULL, message.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
return; return;
} }
m_SkinFolders[folderIndex].active = fileIndex + 1; 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()) 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) else if (folderIndex == -1 && meterWindow)
{ {
folderIndex = FindSkinFolderIndex(meterWindow->GetSkinName()); folderIndex = FindSkinFolderIndex(meterWindow->GetFolderPath());
if (folderIndex != -1) if (folderIndex != -1)
{ {
m_SkinFolders[folderIndex].active = 0; m_SkinFolders[folderIndex].active = 0;
@ -1301,45 +1301,45 @@ void CRainmeter::DeactivateConfig(CMeterWindow* meterWindow, int folderIndex, bo
{ {
if (save) if (save)
{ {
// Disable the config in the ini-file // Disable the skin in the ini-file
WriteActive(meterWindow->GetSkinName(), -1); WriteActive(meterWindow->GetFolderPath(), -1);
} }
meterWindow->Deactivate(); meterWindow->Deactivate();
} }
} }
void CRainmeter::ToggleConfig(int folderIndex, int fileIndex) void CRainmeter::ToggleSkin(int folderIndex, int fileIndex)
{ {
if (folderIndex >= 0 && folderIndex < (int)m_SkinFolders.size() && if (folderIndex >= 0 && folderIndex < (int)m_SkinFolders.size() &&
fileIndex >= 0 && fileIndex < (int)m_SkinFolders[folderIndex].files.size()) fileIndex >= 0 && fileIndex < (int)m_SkinFolders[folderIndex].files.size())
{ {
if (m_SkinFolders[folderIndex].active == fileIndex + 1) if (m_SkinFolders[folderIndex].active == fileIndex + 1)
{ {
CMeterWindow* meterWindow = Rainmeter->GetMeterWindow(GetSkinFolderPath(folderIndex)); CMeterWindow* meterWindow = Rainmeter->GetMeterWindow(GetFolderPath(folderIndex));
DeactivateConfig(meterWindow, folderIndex); DeactivateSkin(meterWindow, folderIndex);
} }
else 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]; WCHAR buffer[32];
_itow_s(fileIndex + 1, buffer, 10); _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) if (mw)
{ {
m_MeterWindows[config] = mw; m_MeterWindows.insert(std::make_pair(folderPath, mw));
try try
{ {
@ -1350,7 +1350,7 @@ void CRainmeter::CreateMeterWindow(const std::wstring& config, const std::wstrin
} }
catch (CError& error) catch (CError& error)
{ {
DeactivateConfig(mw, -1); DeactivateSkin(mw, -1);
LogError(error); LogError(error);
} }
} }
@ -1388,13 +1388,13 @@ void CRainmeter::DeleteMeterWindow(CMeterWindow* meterWindow, bool force)
CDialogAbout::UpdateSkins(); 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<std::wstring, CMeterWindow*>::const_iterator iter = m_MeterWindows.begin(); std::map<std::wstring, CMeterWindow*>::const_iterator iter = m_MeterWindows.begin();
for (; iter != m_MeterWindows.end(); ++iter) 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; return (*iter).second;
} }
@ -1412,8 +1412,8 @@ CMeterWindow* CRainmeter::GetMeterWindowByINI(const std::wstring& ini_searching)
std::map<std::wstring, CMeterWindow*>::const_iterator iter = m_MeterWindows.begin(); std::map<std::wstring, CMeterWindow*>::const_iterator iter = m_MeterWindows.begin();
for (; iter != m_MeterWindows.end(); ++iter) for (; iter != m_MeterWindows.end(); ++iter)
{ {
std::wstring config_current = (*iter).second->GetSkinName() + L'\\'; std::wstring config_current = (*iter).second->GetFolderPath() + L'\\';
config_current += (*iter).second->GetSkinIniFile(); config_current += (*iter).second->GetFileName();
if (_wcsicmp(config_current.c_str(), config_searching.c_str()) == 0) 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; return NULL;
} }
std::pair<int, int> CRainmeter::GetMeterWindowIndex(const std::wstring& config, const std::wstring& iniFile) std::pair<int, int> CRainmeter::GetMeterWindowIndex(const std::wstring& folderPath, const std::wstring& file)
{ {
int index = FindSkinFolderIndex(config); int index = FindSkinFolderIndex(folderPath);
if (index != -1) if (index != -1)
{ {
const SkinFolder& folder = m_SkinFolders[index]; const SkinFolder& skinFolder = m_SkinFolders[index];
const WCHAR* fileSz = iniFile.c_str(); const WCHAR* fileSz = file.c_str();
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(folder.files[i].c_str(), fileSz) == 0) if (_wcsicmp(skinFolder.files[i].c_str(), fileSz) == 0)
{ {
return std::make_pair(index, i); return std::make_pair(index, i);
} }
@ -1451,14 +1451,14 @@ std::pair<int, int> CRainmeter::GetMeterWindowIndex(UINT menuCommand)
if (menuCommand >= ID_CONFIG_FIRST && menuCommand <= ID_CONFIG_LAST) 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) for (size_t i = 0, isize = m_SkinFolders.size(); i < isize; ++i)
{ {
const SkinFolder& folder = m_SkinFolders[i]; const SkinFolder& skinFolder = m_SkinFolders[i];
if (menuCommand >= folder.commandBase && if (menuCommand >= skinFolder.commandBase &&
menuCommand < (folder.commandBase + folder.files.size())) menuCommand < (skinFolder.commandBase + skinFolder.files.size()))
{ {
indexes = std::make_pair(i, menuCommand - folder.commandBase); indexes = std::make_pair(i, menuCommand - skinFolder.commandBase);
return indexes; return indexes;
} }
} }
@ -1499,11 +1499,11 @@ void CRainmeter::GetMeterWindowsByLoadOrder(std::multimap<int, CMeterWindow*>& w
** Returns the skin folder path relative to the skin folder (e.g. illustro\Clock). ** 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]; const SkinFolder& skinFolder = m_SkinFolders[folderIndex];
std::wstring path = folder.name; std::wstring path = skinFolder.name;
for (int i = folder.level - 1, index = folderIndex; i >= 1; --i) for (int i = skinFolder.level - 1, index = folderIndex; i >= 1; --i)
{ {
while (m_SkinFolders[index].level != i) while (m_SkinFolders[index].level != i)
{ {
@ -1527,10 +1527,10 @@ int CRainmeter::FindSkinFolderIndex(const std::wstring& folderPath)
int level = 1; int level = 1;
for (int i = 0, isize = (int)m_SkinFolders.size(); i < isize; ++i) for (int i = 0, isize = (int)m_SkinFolders.size(); i < isize; ++i)
{ {
const SkinFolder& folder = m_SkinFolders[i]; const SkinFolder& skinFolder = m_SkinFolders[i];
if (folder.level == level) 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; path += len;
if (*path) if (*path)
@ -1548,7 +1548,7 @@ int CRainmeter::FindSkinFolderIndex(const std::wstring& folderPath)
++level; ++level;
} }
} }
else if (folder.level < level) else if (skinFolder.level < level)
{ {
break; break;
} }
@ -1560,14 +1560,14 @@ int CRainmeter::FindSkinFolderIndex(const std::wstring& folderPath)
void CRainmeter::SetLoadOrder(int folderIndex, int order) void CRainmeter::SetLoadOrder(int folderIndex, int order)
{ {
std::multimap<int, int>::iterator iter = m_ConfigOrders.begin(); std::multimap<int, int>::iterator iter = m_SkinOrders.begin();
for ( ; iter != m_ConfigOrders.end(); ++iter) for ( ; iter != m_SkinOrders.end(); ++iter)
{ {
if ((*iter).second == folderIndex) // already exists if ((*iter).second == folderIndex) // already exists
{ {
if ((*iter).first != order) if ((*iter).first != order)
{ {
m_ConfigOrders.erase(iter); m_SkinOrders.erase(iter);
break; break;
} }
else else
@ -1577,16 +1577,16 @@ void CRainmeter::SetLoadOrder(int folderIndex, int order)
} }
} }
m_ConfigOrders.insert(std::pair<int, int>(order, folderIndex)); m_SkinOrders.insert(std::pair<int, int>(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) if (index != -1)
{ {
std::multimap<int, int>::const_iterator iter = m_ConfigOrders.begin(); std::multimap<int, int>::const_iterator iter = m_SkinOrders.begin();
for ( ; iter != m_ConfigOrders.end(); ++iter) for ( ; iter != m_SkinOrders.end(); ++iter)
{ {
if ((*iter).second == index) if ((*iter).second == index)
{ {
@ -1602,15 +1602,15 @@ int CRainmeter::GetLoadOrder(const std::wstring& config)
/* /*
** Scans all the subfolders and locates the ini-files. ** 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_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 WIN32_FIND_DATA fileData; // Data structure describes the file found
HANDLE hSearch; // Search handle returned by FindFirstFile HANDLE hSearch; // Search handle returned by FindFirstFile
@ -1631,10 +1631,10 @@ int CRainmeter::ScanForConfigsRecursive(const std::wstring& path, std::wstring b
bool foundFiles = false; bool foundFiles = false;
if (hSearch != INVALID_HANDLE_VALUE) if (hSearch != INVALID_HANDLE_VALUE)
{ {
SkinFolder folder; SkinFolder skinFolder;
folder.commandBase = ID_CONFIG_FIRST + index; skinFolder.commandBase = ID_CONFIG_FIRST + index;
folder.active = 0; skinFolder.active = 0;
folder.level = level; skinFolder.level = level;
do 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) if (filenameLen >= 4 && _wcsicmp(fileData.cFileName + (filenameLen - 4), L".ini") == 0)
{ {
foundFiles = true; foundFiles = true;
folder.files.push_back(filename); skinFolder.files.push_back(filename);
++index; ++index;
} }
} }
@ -1670,15 +1670,15 @@ int CRainmeter::ScanForConfigsRecursive(const std::wstring& path, std::wstring b
{ {
if (level == 1) if (level == 1)
{ {
folder.name = base; skinFolder.name = base;
} }
else else
{ {
std::wstring::size_type pos = base.rfind(L'\\') + 1; 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<std::wstring>::const_iterator iter = subfolders.begin(); std::list<std::wstring>::const_iterator iter = subfolders.begin();
for ( ; iter != subfolders.end(); ++iter) 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) if (newIndex != index)
{ {
popFolder = false; popFolder = false;
@ -1855,15 +1855,15 @@ void CRainmeter::ExecuteBang(const WCHAR* bang, std::vector<std::wstring>& args,
} }
else if (_wcsicmp(bang, L"ActivateConfig") == 0) else if (_wcsicmp(bang, L"ActivateConfig") == 0)
{ {
Bang_ActivateConfig(args); Bang_ActivateSkin(args);
} }
else if (_wcsicmp(bang, L"DeactivateConfig") == 0) else if (_wcsicmp(bang, L"DeactivateConfig") == 0)
{ {
Bang_DeactivateConfig(args, meterWindow); Bang_DeactivateSkin(args, meterWindow);
} }
else if (_wcsicmp(bang, L"ToggleConfig") == 0) else if (_wcsicmp(bang, L"ToggleConfig") == 0)
{ {
Bang_ToggleConfig(args); Bang_ToggleSkin(args);
} }
else if (_wcsicmp(bang, L"Move") == 0) else if (_wcsicmp(bang, L"Move") == 0)
{ {
@ -1971,7 +1971,7 @@ void CRainmeter::ExecuteBang(const WCHAR* bang, std::vector<std::wstring>& args,
} }
else if (_wcsicmp(bang, L"DeactivateConfigGroup") == 0) else if (_wcsicmp(bang, L"DeactivateConfigGroup") == 0)
{ {
Bang_DeactivateConfigGroup(args); Bang_DeactivateSkinGroup(args);
} }
else if (_wcsicmp(bang, L"ZPosGroup") == 0) else if (_wcsicmp(bang, L"ZPosGroup") == 0)
{ {
@ -2242,19 +2242,19 @@ void CRainmeter::ReadGeneralSettings(const std::wstring& iniFile)
m_TrayWindow->ReadOptions(parser); m_TrayWindow->ReadOptions(parser);
} }
m_GlobalConfig.netInSpeed = parser.ReadFloat(L"Rainmeter", L"NetInSpeed", 0.0); m_GlobalOptions.netInSpeed = parser.ReadFloat(L"Rainmeter", L"NetInSpeed", 0.0);
m_GlobalConfig.netOutSpeed = parser.ReadFloat(L"Rainmeter", L"NetOutSpeed", 0.0); m_GlobalOptions.netOutSpeed = parser.ReadFloat(L"Rainmeter", L"NetOutSpeed", 0.0);
m_DisableDragging = 0!=parser.ReadInt(L"Rainmeter", L"DisableDragging", 0); m_DisableDragging = 0!=parser.ReadInt(L"Rainmeter", L"DisableDragging", 0);
m_DisableRDP = 0!=parser.ReadInt(L"Rainmeter", L"DisableRDP", 0); m_DisableRDP = 0!=parser.ReadInt(L"Rainmeter", L"DisableRDP", 0);
m_ConfigEditor = parser.ReadString(L"Rainmeter", L"ConfigEditor", L""); m_SkinEditor = parser.ReadString(L"Rainmeter", L"ConfigEditor", L"");
if (m_ConfigEditor.empty()) if (m_SkinEditor.empty())
{ {
// Get the program path associated with .ini files // Get the program path associated with .ini files
DWORD cchOut = MAX_PATH; DWORD cchOut = MAX_PATH;
HRESULT hr = AssocQueryString(ASSOCF_NOTRUNCATE, ASSOCSTR_EXECUTABLE, L".ini", L"open", buffer, &cchOut); 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""); m_LogViewer = parser.ReadString(L"Rainmeter", L"LogViewer", L"");
@ -2268,7 +2268,7 @@ void CRainmeter::ReadGeneralSettings(const std::wstring& iniFile)
if (m_Debug) 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()); LogWithArgs(LOG_NOTICE, L"LogViewer: %s", m_LogViewer.c_str());
} }
@ -2317,13 +2317,13 @@ void CRainmeter::ReadGeneralSettings(const std::wstring& iniFile)
continue; continue;
} }
SkinFolder& folder = m_SkinFolders[index]; SkinFolder& skinFolder = m_SkinFolders[index];
// Make sure there is a ini file available // Make sure there is a ini file available
int active = parser.ReadInt(section, L"Active", 0); 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); int order = parser.ReadInt(section, L"LoadOrder", 0);
@ -2361,27 +2361,27 @@ void CRainmeter::RefreshAll()
CMeterWindow* mw = (*iter).second; CMeterWindow* mw = (*iter).second;
if (mw) if (mw)
{ {
const WCHAR* skinFolder = mw->GetSkinName().c_str(); const WCHAR* skinFolder = mw->GetFolderPath().c_str();
// Verify whether the cached information is valid // Verify whether the cached information is valid
int index = FindSkinFolderIndex(mw->GetSkinName()); int index = FindSkinFolderIndex(mw->GetFolderPath());
if (index != -1) 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; 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; found = true;
if (folder.active != i + 1) if (skinFolder.active != i + 1)
{ {
// Switch to new ini-file order // Switch to new ini-file order
folder.active = i + 1; skinFolder.active = i + 1;
WriteActive(mw->GetSkinName(), i); WriteActive(mw->GetFolderPath(), i);
} }
break; break;
} }
@ -2389,7 +2389,7 @@ void CRainmeter::RefreshAll()
if (!found) if (!found)
{ {
DeactivateConfig(mw, index); DeactivateSkin(mw, index);
std::wstring error = GetFormattedString(ID_STR_UNABLETOREFRESHSKIN, skinFolder, skinIniFile); std::wstring error = GetFormattedString(ID_STR_UNABLETOREFRESHSKIN, skinFolder, skinIniFile);
MessageBox(NULL, error.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION); MessageBox(NULL, error.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
@ -2397,7 +2397,7 @@ void CRainmeter::RefreshAll()
} }
else else
{ {
DeactivateConfig(mw, -2); // -2 = Deactivate the config forcibly DeactivateSkin(mw, -2); // -2 = Force deactivate
std::wstring error = GetFormattedString(ID_STR_UNABLETOREFRESHSKIN, skinFolder, L""); std::wstring error = GetFormattedString(ID_STR_UNABLETOREFRESHSKIN, skinFolder, L"");
MessageBox(NULL, error.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION); MessageBox(NULL, error.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
@ -2465,8 +2465,8 @@ void CRainmeter::LoadTheme(const std::wstring& name)
ReloadSettings(); ReloadSettings();
// Create meter windows for active configs // Create meter windows for active skins
ActivateActiveConfigs(); ActivateActiveSkins();
} }
void CRainmeter::PreserveSetting(const std::wstring& from, LPCTSTR key, bool replace) 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); CheckMenuItem(subMenu, IDM_DEBUGLOG, MF_BYCOMMAND | MF_CHECKED);
} }
HMENU configMenu = GetSubMenu(subMenu, 4); HMENU skinMenu = GetSubMenu(subMenu, 4);
if (configMenu) if (skinMenu)
{ {
if (!m_SkinFolders.empty()) if (!m_SkinFolders.empty())
{ {
DeleteMenu(configMenu, 0, MF_BYPOSITION); // "No skins available" menuitem DeleteMenu(skinMenu, 0, MF_BYPOSITION); // "No skins available" menuitem
CreateAllSkinsMenu(configMenu); CreateAllSkinsMenu(skinMenu);
} }
if (m_DisableDragging) 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) if (meterWindow)
{ {
HMENU rainmeterMenu = subMenu; HMENU rainmeterMenu = subMenu;
subMenu = CreateSkinMenu(meterWindow, 0, configMenu); subMenu = CreateSkinMenu(meterWindow, 0, skinMenu);
WCHAR buffer[256]; WCHAR buffer[256];
GetMenuString(menu, 0, buffer, 256, MF_BYPOSITION); 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); 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; int index = 0;
std::map<std::wstring, CMeterWindow*>::const_iterator iter = m_MeterWindows.begin(); std::map<std::wstring, CMeterWindow*>::const_iterator iter = m_MeterWindows.begin();
for (; iter != m_MeterWindows.end(); ++iter) for (; iter != m_MeterWindows.end(); ++iter)
{ {
CMeterWindow* mw = ((*iter).second); CMeterWindow* mw = ((*iter).second);
HMENU skinMenu = CreateSkinMenu(mw, index, configMenu); HMENU menu = CreateSkinMenu(mw, index, skinMenu);
InsertMenu(subMenu, 12, MF_BYPOSITION | MF_POPUP, (UINT_PTR)skinMenu, mw->GetSkinName().c_str()); InsertMenu(subMenu, 12, MF_BYPOSITION | MF_POPUP, (UINT_PTR)menu, mw->GetFolderPath().c_str());
++index; ++index;
} }
// Put Update notifications in the Tray menu // Add update notification item
if (m_NewVersion) if (m_NewVersion)
{ {
InsertMenu(subMenu, 0, MF_BYPOSITION, IDM_NEW_VERSION, GetString(ID_STR_UPDATEAVAILABLE)); 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(); const size_t max = Rainmeter->m_SkinFolders.size();
while (index < max) while (index < max)
{ {
const SkinFolder& folder = Rainmeter->m_SkinFolders[index]; const SkinFolder& skinFolder = Rainmeter->m_SkinFolders[index];
if (folder.level != initialLevel) if (skinFolder.level != initialLevel)
{ {
return index - 1; return index - 1;
} }
@ -2824,7 +2824,7 @@ int CRainmeter::CreateAllSkinsMenuRecursive(HMENU skinMenu, int index)
HMENU subMenu = CreatePopupMenu(); HMENU subMenu = CreatePopupMenu();
// Add current folder // 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 // Add subfolders
const bool hasSubfolder = (index + 1) < max && m_SkinFolders[index + 1].level == initialLevel + 1; 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 // Add files
{ {
int fileIndex = 0; int fileIndex = 0;
int fileCount = (int)folder.files.size(); int fileCount = (int)skinFolder.files.size();
for ( ; fileIndex < fileCount; ++fileIndex) 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); CheckMenuRadioItem(subMenu, checkPos, checkPos, checkPos, MF_BYPOSITION);
} }
@ -2861,7 +2861,7 @@ int CRainmeter::CreateAllSkinsMenuRecursive(HMENU skinMenu, int index)
return 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)); 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 // 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()); ModifyMenu(skinMenu, IDM_SKIN_OPENSKINSFOLDER, MF_BYCOMMAND, IDM_SKIN_OPENSKINSFOLDER, skinName.c_str());
SetMenuDefaultItem(skinMenu, IDM_SKIN_OPENSKINSFOLDER, FALSE); SetMenuDefaultItem(skinMenu, IDM_SKIN_OPENSKINSFOLDER, FALSE);
@ -2986,24 +2986,24 @@ HMENU CRainmeter::CreateSkinMenu(CMeterWindow* meterWindow, int index, HMENU con
// Add the variants menu // Add the variants menu
if (variantsMenu) if (variantsMenu)
{ {
const SkinFolder& folder = m_SkinFolders[FindSkinFolderIndex(skinName)]; const SkinFolder& skinFolder = m_SkinFolders[FindSkinFolderIndex(skinName)];
for (int i = 0, isize = (int)folder.files.size(); i < isize; ++i) 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); CheckMenuRadioItem(variantsMenu, checkPos, checkPos, checkPos, MF_BYPOSITION);
} }
} }
// Add config's root menu // Add skin root menu
int itemCount = GetMenuItemCount(configMenu); int itemCount = GetMenuItemCount(menu);
if (itemCount > 0) if (itemCount > 0)
{ {
std::wstring root = meterWindow->GetSkinName(); std::wstring root = meterWindow->GetFolderPath();
std::wstring::size_type pos = root.find_first_of(L'\\'); std::wstring::size_type pos = root.find_first_of(L'\\');
if (pos != std::wstring::npos) 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) 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; if (state == 0xFFFFFFFF || (state & MF_POPUP) == 0) break;
WCHAR buffer[MAX_PATH]; 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) if (_wcsicmp(root.c_str(), buffer) == 0)
{ {
HMENU configRootMenu = GetSubMenu(configMenu, i); HMENU skinRootMenu = GetSubMenu(menu, i);
if (configRootMenu) 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; break;
} }
@ -3079,7 +3079,6 @@ void CRainmeter::CreateMonitorMenu(HMENU monitorMenu, CMeterWindow* meterWindow)
} }
} }
// Tick the configs
if (!screenDefined) if (!screenDefined)
{ {
CheckMenuItem(monitorMenu, IDM_SKIN_MONITOR_PRIMARY, MF_BYCOMMAND | MF_CHECKED); 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) void CRainmeter::AddAboutLogInfo(int level, LPCWSTR time, LPCWSTR message)
{ {
// Store 20 last items // Store 20 last items
LOG_INFO logInfo = {level, time, message}; LogInfo logInfo = {level, time, message};
m_LogData.push_back(logInfo); m_LogData.push_back(logInfo);
if (m_LogData.size() > 20) if (m_LogData.size() > 20)
{ {

View File

@ -46,7 +46,7 @@
#define WM_RAINMETER_DELAYED_EXECUTE WM_APP + 1 #define WM_RAINMETER_DELAYED_EXECUTE WM_APP + 1
#define WM_RAINMETER_EXECUTE WM_APP + 2 #define WM_RAINMETER_EXECUTE WM_APP + 2
struct GlobalConfig struct GlobalOptions
{ {
double netInSpeed; double netInSpeed;
double netOutSpeed; double netOutSpeed;
@ -89,7 +89,7 @@ public:
} }
}; };
struct LOG_INFO struct LogInfo
{ {
int level; int level;
std::wstring timestamp; std::wstring timestamp;
@ -110,27 +110,27 @@ public:
CTrayWindow* GetTrayWindow() { return m_TrayWindow; } CTrayWindow* GetTrayWindow() { return m_TrayWindow; }
CMeterWindow* GetMeterWindow(const std::wstring& config); CMeterWindow* GetMeterWindow(const std::wstring& folderPath);
CMeterWindow* GetMeterWindowByINI(const std::wstring& ini_searching); CMeterWindow* GetMeterWindowByINI(const std::wstring& ini_searching);
std::pair<int, int> GetMeterWindowIndex(const std::wstring& config, const std::wstring& iniFile); std::pair<int, int> GetMeterWindowIndex(const std::wstring& folderPath, const std::wstring& file);
std::pair<int, int> GetMeterWindowIndex(CMeterWindow* meterWindow) { return GetMeterWindowIndex(meterWindow->GetSkinName(), meterWindow->GetSkinIniFile()); } std::pair<int, int> GetMeterWindowIndex(CMeterWindow* meterWindow) { return GetMeterWindowIndex(meterWindow->GetFolderPath(), meterWindow->GetFileName()); }
std::pair<int, int> GetMeterWindowIndex(UINT menuCommand); std::pair<int, int> GetMeterWindowIndex(UINT menuCommand);
CMeterWindow* GetMeterWindow(HWND hwnd); CMeterWindow* GetMeterWindow(HWND hwnd);
void GetMeterWindowsByLoadOrder(std::multimap<int, CMeterWindow*>& windows, const std::wstring& group = std::wstring()); void GetMeterWindowsByLoadOrder(std::multimap<int, CMeterWindow*>& windows, const std::wstring& group = std::wstring());
std::map<std::wstring, CMeterWindow*>& GetAllMeterWindows() { return m_MeterWindows; } std::map<std::wstring, CMeterWindow*>& GetAllMeterWindows() { return m_MeterWindows; }
std::wstring GetSkinFolderPath(int folderIndex); std::wstring GetFolderPath(int folderIndex);
int FindSkinFolderIndex(const std::wstring& folderPath); int FindSkinFolderIndex(const std::wstring& folderPath);
const std::vector<SkinFolder>& GetSkinFolders() { return m_SkinFolders; } const std::vector<SkinFolder>& GetFolders() { return m_SkinFolders; }
const std::vector<std::wstring>& GetAllThemes() { return m_Themes; } const std::vector<std::wstring>& GetAllThemes() { return m_Themes; }
void DeleteMeterWindow(CMeterWindow* meterWindow, bool force = false); void DeleteMeterWindow(CMeterWindow* meterWindow, bool force = false);
void ActivateConfig(int folderIndex, int fileIndex); void ActivateSkin(int folderIndex, int fileIndex);
void DeactivateConfig(CMeterWindow* meterWindow, int folderIndex, bool save = true); void DeactivateSkin(CMeterWindow* meterWindow, int folderIndex, bool save = true);
void ToggleConfig(int folderIndex, int fileIndex); void ToggleSkin(int folderIndex, int fileIndex);
const std::wstring& GetPath() { return m_Path; } const std::wstring& GetPath() { return m_Path; }
const std::wstring& GetIniFile() { return m_IniFile; } const std::wstring& GetIniFile() { return m_IniFile; }
@ -146,7 +146,7 @@ public:
const std::wstring& GetDrive() { return m_Drive; } 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& GetLogViewer() { return m_LogViewer; }
const std::wstring& GetStatsDate() { return m_StatsDate; } const std::wstring& GetStatsDate() { return m_StatsDate; }
@ -158,7 +158,7 @@ public:
bool GetDebug() { return m_Debug; } bool GetDebug() { return m_Debug; }
GlobalConfig& GetGlobalConfig() { return m_GlobalConfig; } GlobalOptions& GetGlobalOptions() { return m_GlobalOptions; }
void ReloadSettings(); void ReloadSettings();
void EditSettings(); void EditSettings();
@ -190,7 +190,7 @@ public:
bool IsNormalStayDesktop() { return m_NormalStayDesktop; } bool IsNormalStayDesktop() { return m_NormalStayDesktop; }
void AddAboutLogInfo(int level, LPCWSTR time, LPCWSTR message); void AddAboutLogInfo(int level, LPCWSTR time, LPCWSTR message);
const std::list<LOG_INFO>& GetAboutLogData() { return m_LogData; } const std::list<LogInfo>& GetAboutLogData() { return m_LogData; }
void SetDebug(bool debug); void SetDebug(bool debug);
@ -222,10 +222,10 @@ private:
void BangWithArgs(BANGCOMMAND bang, std::vector<std::wstring>& args, size_t numOfArgs, CMeterWindow* meterWindow); void BangWithArgs(BANGCOMMAND bang, std::vector<std::wstring>& args, size_t numOfArgs, CMeterWindow* meterWindow);
void BangGroupWithArgs(BANGCOMMAND bang, std::vector<std::wstring>& args, size_t numOfArgs, CMeterWindow* meterWindow); void BangGroupWithArgs(BANGCOMMAND bang, std::vector<std::wstring>& args, size_t numOfArgs, CMeterWindow* meterWindow);
void Bang_ActivateConfig(std::vector<std::wstring>& args); void Bang_ActivateSkin(std::vector<std::wstring>& args);
void Bang_DeactivateConfig(std::vector<std::wstring>& args, CMeterWindow* meterWindow); void Bang_DeactivateSkin(std::vector<std::wstring>& args, CMeterWindow* meterWindow);
void Bang_ToggleConfig(std::vector<std::wstring>& args); void Bang_ToggleSkin(std::vector<std::wstring>& args);
void Bang_DeactivateConfigGroup(std::vector<std::wstring>& args); void Bang_DeactivateSkinGroup(std::vector<std::wstring>& args);
void Bang_SetClip(std::vector<std::wstring>& args); void Bang_SetClip(std::vector<std::wstring>& args);
void Bang_SetWallpaper(std::vector<std::wstring>& args, CMeterWindow* meterWindow); void Bang_SetWallpaper(std::vector<std::wstring>& args, CMeterWindow* meterWindow);
void Bang_SkinMenu(std::vector<std::wstring>& args, CMeterWindow* meterWindow); void Bang_SkinMenu(std::vector<std::wstring>& args, CMeterWindow* meterWindow);
@ -233,25 +233,25 @@ private:
void Bang_WriteKeyValue(std::vector<std::wstring>& args, CMeterWindow* meterWindow); void Bang_WriteKeyValue(std::vector<std::wstring>& args, CMeterWindow* meterWindow);
void Bang_Log(std::vector<std::wstring>& args); void Bang_Log(std::vector<std::wstring>& args);
void ActivateActiveConfigs(); void ActivateActiveSkins();
void CreateMeterWindow(const std::wstring& config, const std::wstring& iniFile); void CreateMeterWindow(const std::wstring& folderPath, const std::wstring& file);
void WriteActive(const std::wstring& config, int fileIndex); void WriteActive(const std::wstring& folderPath, int fileIndex);
void ScanForConfigs(const std::wstring& path); void ScanForSkins(const std::wstring& path);
void ScanForThemes(const std::wstring& path); void ScanForThemes(const std::wstring& path);
void ReadGeneralSettings(const std::wstring& iniFile); void ReadGeneralSettings(const std::wstring& iniFile);
void SetLoadOrder(int folderIndex, int order); void SetLoadOrder(int folderIndex, int order);
int GetLoadOrder(const std::wstring& config); int GetLoadOrder(const std::wstring& folderPath);
void UpdateDesktopWorkArea(bool reset); 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); 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); } void CreateAllSkinsMenu(HMENU skinMenu) { CreateAllSkinsMenuRecursive(skinMenu, 0); }
int CreateAllSkinsMenuRecursive(HMENU skinMenu, int index); int CreateAllSkinsMenuRecursive(HMENU skinMenu, int index);
void CreateThemeMenu(HMENU themeMenu); void CreateThemeMenu(HMENU themeMenu);
void CreateMonitorMenu(HMENU monitorMenu, CMeterWindow* meterWindow); void CreateMonitorMenu(HMENU monitorMenu, CMeterWindow* meterWindow);
void CreateDefaultConfigFile(); void CreateOptionsFile();
void CreateDataFile(); void CreateDataFile();
void SetLogging(bool logging); void SetLogging(bool logging);
void TestSettingsFile(bool bDefaultIniLocation); void TestSettingsFile(bool bDefaultIniLocation);
@ -259,7 +259,7 @@ private:
CTrayWindow* m_TrayWindow; CTrayWindow* m_TrayWindow;
std::vector<SkinFolder> m_SkinFolders; std::vector<SkinFolder> m_SkinFolders;
std::multimap<int, int> m_ConfigOrders; std::multimap<int, int> m_SkinOrders;
std::map<std::wstring, CMeterWindow*> m_MeterWindows; std::map<std::wstring, CMeterWindow*> m_MeterWindows;
std::vector<std::wstring> m_Themes; std::vector<std::wstring> m_Themes;
@ -299,9 +299,9 @@ private:
bool m_Logging; bool m_Logging;
std::list<LOG_INFO> m_LogData; std::list<LogInfo> m_LogData;
std::wstring m_ConfigEditor; std::wstring m_SkinEditor;
std::wstring m_LogViewer; std::wstring m_LogViewer;
CConfigParser* m_CurrentParser; CConfigParser* m_CurrentParser;
@ -315,7 +315,7 @@ private:
ULONG_PTR m_GDIplusToken; ULONG_PTR m_GDIplusToken;
GlobalConfig m_GlobalConfig; GlobalOptions m_GlobalOptions;
}; };
#ifdef LIBRARY_EXPORTS #ifdef LIBRARY_EXPORTS

View File

@ -732,7 +732,7 @@ BOOL CALLBACK MyEnumWindowsProc(HWND hwnd, LPARAM lParam)
if (logging) if (logging)
{ {
LogWithArgs(LOG_DEBUG, L"%c [%c] 0x%p : %s (Name: \"%s\", zPos=%i)", 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 else

View File

@ -148,14 +148,12 @@ CTintedImageHelper_DefineOptionArray(CTintedImage::c_DefaultOptionArray, L"");
/* /*
** The constructor. ** The constructor.
** **
** If disableTransform is true, following configs are ignored: ** If disableTransform is true, ImageCrop and ImageRotate are ignored.
** - ImageCrop
** - ImageRotate
** **
*/ */
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_Name(name ? name : L"Image"),
m_OptionArray(configArray ? configArray : c_DefaultOptionArray), m_OptionArray(optionArray ? optionArray : c_DefaultOptionArray),
m_Bitmap(), m_Bitmap(),
m_BitmapTint(), 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) void CTintedImage::ReadOptions(CConfigParser& parser, const WCHAR* section)

View File

@ -24,12 +24,11 @@
#include <string> #include <string>
/* /*
** Helper macro to define the array of the config item. ** Helper macro to define an array of option names. A prefix must be given.
** It's necessary to give a string literal to the prefix parameter.
** **
*/ */
#define CTintedImageHelper_DefineOptionArray(name, prefix) \ #define CTintedImageHelper_DefineOptionArray(name, prefix) \
const WCHAR* (name)[CTintedImage::ConfigCount] = { \ const WCHAR* (name)[CTintedImage::OptionCount] = { \
prefix L"ImageCrop", \ prefix L"ImageCrop", \
prefix L"Greyscale", \ prefix L"Greyscale", \
prefix L"ImageTint", \ prefix L"ImageTint", \
@ -62,10 +61,10 @@ public:
OptionIndexImageFlip, OptionIndexImageFlip,
OptionIndexImageRotate, 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(); ~CTintedImage();
void ReadOptions(CConfigParser& parser, const WCHAR* section); void ReadOptions(CConfigParser& parser, const WCHAR* section);
@ -124,7 +123,7 @@ protected:
static const Gdiplus::ColorMatrix c_GreyScaleMatrix; static const Gdiplus::ColorMatrix c_GreyScaleMatrix;
static const Gdiplus::ColorMatrix c_IdentityMatrix; static const Gdiplus::ColorMatrix c_IdentityMatrix;
static const WCHAR* c_DefaultOptionArray[ConfigCount]; static const WCHAR* c_DefaultOptionArray[OptionCount];
}; };
#endif #endif

View File

@ -501,7 +501,7 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
std::pair<int, int> indexes = Rainmeter->GetMeterWindowIndex((UINT)(wParam & 0x0ffff)); std::pair<int, int> indexes = Rainmeter->GetMeterWindowIndex((UINT)(wParam & 0x0ffff));
if (indexes.first != -1 && indexes.second != -1) if (indexes.first != -1 && indexes.second != -1)
{ {
Rainmeter->ToggleConfig(indexes.first, indexes.second); Rainmeter->ToggleSkin(indexes.first, indexes.second);
} }
} }
else else
@ -625,7 +625,7 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
} }
else if (wParam == RAINMETER_QUERY_ID_CONFIG_EDITOR) else if (wParam == RAINMETER_QUERY_ID_CONFIG_EDITOR)
{ {
sendCopyData(Rainmeter->GetConfigEditor()); sendCopyData(Rainmeter->GetSkinEditor());
return 0; return 0;
} }
else if (wParam == RAINMETER_QUERY_ID_IS_DEBUGGING) 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; COPYDATASTRUCT* cds = (COPYDATASTRUCT*)lParam;
if (cds->dwData == RAINMETER_QUERY_ID_SKIN_WINDOWHANDLE) if (cds->dwData == RAINMETER_QUERY_ID_SKIN_WINDOWHANDLE)
{ {
LPCWSTR configName = (LPCWSTR)cds->lpData; LPCWSTR folderPath = (LPCWSTR)cds->lpData;
CMeterWindow* mw = Rainmeter->GetMeterWindow(configName); CMeterWindow* mw = Rainmeter->GetMeterWindow(folderPath);
return (mw) ? (LRESULT)mw->GetWindow() : NULL; return (mw) ? (LRESULT)mw->GetWindow() : NULL;
} }
} }

View File

@ -18,12 +18,12 @@
#ifndef __LUAMANAGER_H__ #ifndef __LUAMANAGER_H__
#define __LUAMANAGER_H__ #define __LUAMANAGER_H__
extern "C" extern "C"
{ {
#include "lua.h" #include "lua.h"
#include "lualib.h" #include "lualib.h"
#include "lauxlib.h" #include "lauxlib.h"
} }
class LuaManager class LuaManager