mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Code optimization.
This commit is contained in:
parent
0e1486f0be
commit
999ab0bd18
@ -87,48 +87,30 @@ void CConfigParser::SetBuiltInVariables(CRainmeter* pRainmeter, CMeterWindow* me
|
|||||||
if (pRainmeter)
|
if (pRainmeter)
|
||||||
{
|
{
|
||||||
SetBuiltInVariable(L"PROGRAMPATH", pRainmeter->GetPath());
|
SetBuiltInVariable(L"PROGRAMPATH", pRainmeter->GetPath());
|
||||||
|
SetBuiltInVariable(L"PROGRAMDRIVE", pRainmeter->GetDrive());
|
||||||
// Extract volume path from program path
|
|
||||||
// E.g.:
|
|
||||||
// "C:\path\" to "C:"
|
|
||||||
// "\\server\share\" to "\\server\share"
|
|
||||||
// "\\server\C:\path\" to "\\server\C:"
|
|
||||||
const std::wstring& path = pRainmeter->GetPath();
|
|
||||||
std::wstring::size_type loc, loc2;
|
|
||||||
if ((loc = path.find_first_of(L':')) != std::wstring::npos)
|
|
||||||
{
|
|
||||||
SetBuiltInVariable(L"PROGRAMDRIVE", path.substr(0, loc + 1));
|
|
||||||
}
|
|
||||||
else if (path.length() >= 2 && (path[0] == L'\\' || path[0] == L'/') && (path[1] == L'\\' || path[1] == L'/'))
|
|
||||||
{
|
|
||||||
if ((loc = path.find_first_of(L"\\/", 2)) != std::wstring::npos)
|
|
||||||
{
|
|
||||||
if ((loc2 = path.find_first_of(L"\\/", loc + 1)) != std::wstring::npos || loc != (path.length() - 1))
|
|
||||||
{
|
|
||||||
loc = loc2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
SetBuiltInVariable(L"PROGRAMDRIVE", path.substr(0, loc));
|
|
||||||
}
|
|
||||||
|
|
||||||
SetBuiltInVariable(L"SETTINGSPATH", pRainmeter->GetSettingsPath());
|
SetBuiltInVariable(L"SETTINGSPATH", pRainmeter->GetSettingsPath());
|
||||||
SetBuiltInVariable(L"SKINSPATH", pRainmeter->GetSkinPath());
|
SetBuiltInVariable(L"SKINSPATH", pRainmeter->GetSkinPath());
|
||||||
SetBuiltInVariable(L"PLUGINSPATH", pRainmeter->GetPluginPath());
|
SetBuiltInVariable(L"PLUGINSPATH", pRainmeter->GetPluginPath());
|
||||||
SetBuiltInVariable(L"CURRENTPATH", CRainmeter::ExtractPath(m_Filename));
|
SetBuiltInVariable(L"CURRENTPATH", CRainmeter::ExtractPath(m_Filename));
|
||||||
SetBuiltInVariable(L"ADDONSPATH", pRainmeter->GetPath() + L"Addons\\");
|
SetBuiltInVariable(L"ADDONSPATH", pRainmeter->GetAddonPath());
|
||||||
SetBuiltInVariable(L"CRLF", L"\n");
|
SetBuiltInVariable(L"CRLF", L"\n");
|
||||||
|
|
||||||
if (meterWindow)
|
if (meterWindow)
|
||||||
{
|
{
|
||||||
const std::wstring& config = meterWindow->GetSkinName();
|
const std::wstring& config = meterWindow->GetSkinName();
|
||||||
|
std::wstring path = pRainmeter->GetSkinPath();
|
||||||
|
|
||||||
|
std::wstring::size_type loc;
|
||||||
if ((loc = config.find_first_of(L'\\')) != std::wstring::npos)
|
if ((loc = config.find_first_of(L'\\')) != std::wstring::npos)
|
||||||
{
|
{
|
||||||
SetBuiltInVariable(L"ROOTCONFIGPATH", pRainmeter->GetSkinPath() + config.substr(0, loc + 1));
|
path += config.substr(0, loc + 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SetBuiltInVariable(L"ROOTCONFIGPATH", pRainmeter->GetSkinPath() + config + L"\\");
|
path += config;
|
||||||
|
path += L"\\";
|
||||||
}
|
}
|
||||||
|
SetBuiltInVariable(L"ROOTCONFIGPATH", path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (meterWindow)
|
if (meterWindow)
|
||||||
@ -1126,7 +1108,10 @@ void CConfigParser::SetValue(const std::wstring& strSection, const std::wstring&
|
|||||||
std::vector<std::wstring>& array = (*iter).second;
|
std::vector<std::wstring>& array = (*iter).second;
|
||||||
array.push_back(strTmpKey);
|
array.push_back(strTmpKey);
|
||||||
}
|
}
|
||||||
m_Values[strTmpSection + L"::" + strTmpKey] = strValue;
|
|
||||||
|
strTmpSection += L"::";
|
||||||
|
strTmpSection += strTmpKey;
|
||||||
|
m_Values[strTmpSection] = strValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
@ -1140,7 +1125,8 @@ void CConfigParser::SetValue(const std::wstring& strSection, const std::wstring&
|
|||||||
*/
|
*/
|
||||||
const std::wstring& CConfigParser::GetValue(const std::wstring& strSection, const std::wstring& strKey, const std::wstring& strDefault)
|
const std::wstring& CConfigParser::GetValue(const std::wstring& strSection, const std::wstring& strKey, const std::wstring& strDefault)
|
||||||
{
|
{
|
||||||
std::wstring strTmp(strSection + L"::" + strKey);
|
std::wstring strTmp(strSection + L"::");
|
||||||
|
strTmp += strKey;
|
||||||
std::transform(strTmp.begin(), strTmp.end(), strTmp.begin(), ::towlower);
|
std::transform(strTmp.begin(), strTmp.end(), strTmp.begin(), ::towlower);
|
||||||
|
|
||||||
stdext::hash_map<std::wstring, std::wstring>::const_iterator iter = m_Values.find(strTmp);
|
stdext::hash_map<std::wstring, std::wstring>::const_iterator iter = m_Values.find(strTmp);
|
||||||
|
@ -373,9 +373,7 @@ HINSTANCE ExecuteCommand(HWND Owner, LPCTSTR szCommand, int nShowCmd, LPCTSTR sz
|
|||||||
|
|
||||||
std::wstring dir = CRainmeter::ExtractPath(command);
|
std::wstring dir = CRainmeter::ExtractPath(command);
|
||||||
|
|
||||||
SHELLEXECUTEINFO si;
|
SHELLEXECUTEINFO si = {sizeof(SHELLEXECUTEINFO)};
|
||||||
memset(&si, 0, sizeof(si));
|
|
||||||
si.cbSize = sizeof(SHELLEXECUTEINFO);
|
|
||||||
si.hwnd = Owner;
|
si.hwnd = Owner;
|
||||||
si.lpVerb = szVerb;
|
si.lpVerb = szVerb;
|
||||||
si.lpFile = command.c_str();
|
si.lpFile = command.c_str();
|
||||||
|
@ -117,9 +117,9 @@ void CMeasurePlugin::ReadConfig(CConfigParser& parser, const WCHAR* section)
|
|||||||
pos = m_PluginName.rfind(L'\\');
|
pos = m_PluginName.rfind(L'\\');
|
||||||
if (pos != std::wstring::npos)
|
if (pos != std::wstring::npos)
|
||||||
{
|
{
|
||||||
m_PluginName = L"..\\" + m_PluginName;
|
m_PluginName.insert(0, L"..\\");
|
||||||
}
|
}
|
||||||
m_PluginName = Rainmeter->GetPluginPath() + m_PluginName;
|
m_PluginName.insert(0, Rainmeter->GetPluginPath());
|
||||||
|
|
||||||
DWORD err = 0;
|
DWORD err = 0;
|
||||||
m_Plugin = CSystem::RmLoadLibrary(m_PluginName.c_str(), &err);
|
m_Plugin = CSystem::RmLoadLibrary(m_PluginName.c_str(), &err);
|
||||||
@ -151,8 +151,7 @@ void CMeasurePlugin::ReadConfig(CConfigParser& parser, const WCHAR* section)
|
|||||||
|
|
||||||
if (m_Plugin == NULL)
|
if (m_Plugin == NULL)
|
||||||
{
|
{
|
||||||
std::wstring error = L"Rainmeter plugin ";
|
std::wstring error = L"Rainmeter plugin " + m_PluginName;
|
||||||
error += m_PluginName;
|
|
||||||
error += L" not found!";
|
error += L" not found!";
|
||||||
throw CError(error, __LINE__, __FILE__);
|
throw CError(error, __LINE__, __FILE__);
|
||||||
}
|
}
|
||||||
@ -169,8 +168,7 @@ void CMeasurePlugin::ReadConfig(CConfigParser& parser, const WCHAR* section)
|
|||||||
{
|
{
|
||||||
FreeLibrary(m_Plugin);
|
FreeLibrary(m_Plugin);
|
||||||
|
|
||||||
std::wstring error = L"Rainmeter plugin ";
|
std::wstring error = L"Rainmeter plugin " + m_PluginName;
|
||||||
error += m_PluginName;
|
|
||||||
error += L" doesn't export Update or GetString function!";
|
error += L" doesn't export Update or GetString function!";
|
||||||
throw CError(error, __LINE__, __FILE__);
|
throw CError(error, __LINE__, __FILE__);
|
||||||
}
|
}
|
||||||
|
@ -149,8 +149,7 @@ void CMeasureRegistry::ReadConfig(CConfigParser& parser, const WCHAR* section)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::wstring error = L"HKEY=";
|
std::wstring error = L"HKEY=" + keyname;
|
||||||
error += keyname;
|
|
||||||
error += L" is not valid in measure [";
|
error += L" is not valid in measure [";
|
||||||
error += m_Name;
|
error += m_Name;
|
||||||
error += L"].";
|
error += L"].";
|
||||||
|
@ -444,8 +444,7 @@ void CMeter::BindMeasure(const std::list<CMeasure*>& measures)
|
|||||||
// The meter is not bound to anything
|
// The meter is not bound to anything
|
||||||
if (m_MeasureName.empty())
|
if (m_MeasureName.empty())
|
||||||
{
|
{
|
||||||
std::wstring error = L"The meter [";
|
std::wstring error = L"The meter [" + m_Name;
|
||||||
error += m_Name;
|
|
||||||
error += L"] is not bound to anything!";
|
error += L"] is not bound to anything!";
|
||||||
throw CError(error, __LINE__, __FILE__);
|
throw CError(error, __LINE__, __FILE__);
|
||||||
}
|
}
|
||||||
@ -462,8 +461,7 @@ void CMeter::BindMeasure(const std::list<CMeasure*>& measures)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Error :)
|
// Error :)
|
||||||
std::wstring error = L"The meter [";
|
std::wstring error = L"The meter [" + m_Name;
|
||||||
error += m_Name;
|
|
||||||
error += L"] cannot be bound with [";
|
error += L"] cannot be bound with [";
|
||||||
error += m_MeasureName;
|
error += m_MeasureName;
|
||||||
error += L"]!";
|
error += L"]!";
|
||||||
|
@ -108,7 +108,10 @@ void CMeterBar::ReadConfig(const WCHAR* section)
|
|||||||
m_Color = parser.ReadColor(section, L"BarColor", Color::Green);
|
m_Color = parser.ReadColor(section, L"BarColor", Color::Green);
|
||||||
|
|
||||||
m_ImageName = parser.ReadString(section, L"BarImage", L"");
|
m_ImageName = parser.ReadString(section, L"BarImage", L"");
|
||||||
m_ImageName = m_MeterWindow->MakePathAbsolute(m_ImageName);
|
if (!m_ImageName.empty())
|
||||||
|
{
|
||||||
|
m_ImageName = m_MeterWindow->MakePathAbsolute(m_ImageName);
|
||||||
|
}
|
||||||
|
|
||||||
m_Border = parser.ReadInt(section, L"BarBorder", 0);
|
m_Border = parser.ReadInt(section, L"BarBorder", 0);
|
||||||
|
|
||||||
@ -126,8 +129,7 @@ void CMeterBar::ReadConfig(const WCHAR* section)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::wstring error = L"BarOrientation=";
|
std::wstring error = L"BarOrientation=" + orientation;
|
||||||
error += orientation;
|
|
||||||
error += L" is not valid in meter [";
|
error += L" is not valid in meter [";
|
||||||
error += m_Name;
|
error += m_Name;
|
||||||
error += L"].";
|
error += L"].";
|
||||||
|
@ -184,7 +184,10 @@ void CMeterBitmap::ReadConfig(const WCHAR* section)
|
|||||||
CConfigParser& parser = m_MeterWindow->GetParser();
|
CConfigParser& parser = m_MeterWindow->GetParser();
|
||||||
|
|
||||||
m_ImageName = parser.ReadString(section, L"BitmapImage", L"");
|
m_ImageName = parser.ReadString(section, L"BitmapImage", L"");
|
||||||
m_ImageName = m_MeterWindow->MakePathAbsolute(m_ImageName);
|
if (!m_ImageName.empty())
|
||||||
|
{
|
||||||
|
m_ImageName = m_MeterWindow->MakePathAbsolute(m_ImageName);
|
||||||
|
}
|
||||||
|
|
||||||
m_FrameCount = parser.ReadInt(section, L"BitmapFrames", 1);
|
m_FrameCount = parser.ReadInt(section, L"BitmapFrames", 1);
|
||||||
m_ZeroFrame = 0!=parser.ReadInt(section, L"BitmapZeroFrame", 0);
|
m_ZeroFrame = 0!=parser.ReadInt(section, L"BitmapZeroFrame", 0);
|
||||||
@ -211,8 +214,7 @@ void CMeterBitmap::ReadConfig(const WCHAR* section)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::wstring error = L"BitmapAlign=";
|
std::wstring error = L"BitmapAlign=" + align;
|
||||||
error += align;
|
|
||||||
error += L" is not valid in meter [";
|
error += L" is not valid in meter [";
|
||||||
error += m_Name;
|
error += m_Name;
|
||||||
error += L"].";
|
error += L"].";
|
||||||
|
@ -170,7 +170,10 @@ void CMeterButton::ReadConfig(const WCHAR* section)
|
|||||||
CConfigParser& parser = m_MeterWindow->GetParser();
|
CConfigParser& parser = m_MeterWindow->GetParser();
|
||||||
|
|
||||||
m_ImageName = parser.ReadString(section, L"ButtonImage", L"");
|
m_ImageName = parser.ReadString(section, L"ButtonImage", L"");
|
||||||
m_ImageName = m_MeterWindow->MakePathAbsolute(m_ImageName);
|
if (!m_ImageName.empty())
|
||||||
|
{
|
||||||
|
m_ImageName = m_MeterWindow->MakePathAbsolute(m_ImageName);
|
||||||
|
}
|
||||||
|
|
||||||
m_Command = parser.ReadString(section, L"ButtonCommand", L"", false);
|
m_Command = parser.ReadString(section, L"ButtonCommand", L"", false);
|
||||||
|
|
||||||
|
@ -265,13 +265,22 @@ void CMeterHistogram::ReadConfig(const WCHAR* section)
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_PrimaryImageName = parser.ReadString(section, L"PrimaryImage", L"");
|
m_PrimaryImageName = parser.ReadString(section, L"PrimaryImage", L"");
|
||||||
m_PrimaryImageName = m_MeterWindow->MakePathAbsolute(m_PrimaryImageName);
|
if (!m_PrimaryImageName.empty())
|
||||||
|
{
|
||||||
|
m_PrimaryImageName = m_MeterWindow->MakePathAbsolute(m_PrimaryImageName);
|
||||||
|
}
|
||||||
|
|
||||||
m_SecondaryImageName = parser.ReadString(section, L"SecondaryImage", L"");
|
m_SecondaryImageName = parser.ReadString(section, L"SecondaryImage", L"");
|
||||||
m_SecondaryImageName = m_MeterWindow->MakePathAbsolute(m_SecondaryImageName);
|
if (!m_SecondaryImageName.empty())
|
||||||
|
{
|
||||||
|
m_SecondaryImageName = m_MeterWindow->MakePathAbsolute(m_SecondaryImageName);
|
||||||
|
}
|
||||||
|
|
||||||
m_BothImageName = parser.ReadString(section, L"BothImage", L"");
|
m_BothImageName = parser.ReadString(section, L"BothImage", L"");
|
||||||
m_BothImageName = m_MeterWindow->MakePathAbsolute(m_BothImageName);
|
if (!m_BothImageName.empty())
|
||||||
|
{
|
||||||
|
m_BothImageName = m_MeterWindow->MakePathAbsolute(m_BothImageName);
|
||||||
|
}
|
||||||
|
|
||||||
m_Autoscale = 0!=parser.ReadInt(section, L"AutoScale", 0);
|
m_Autoscale = 0!=parser.ReadInt(section, L"AutoScale", 0);
|
||||||
m_Flip = 0!=parser.ReadInt(section, L"Flip", 0);
|
m_Flip = 0!=parser.ReadInt(section, L"Flip", 0);
|
||||||
@ -580,8 +589,7 @@ void CMeterHistogram::BindMeasure(const std::list<CMeasure*>& measures)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::wstring error = L"The meter [";
|
std::wstring error = L"The meter [" + m_Name;
|
||||||
error += m_Name;
|
|
||||||
error += L"] cannot be bound with [";
|
error += L"] cannot be bound with [";
|
||||||
error += m_SecondaryMeasureName;
|
error += m_SecondaryMeasureName;
|
||||||
error += L"]!";
|
error += L"]!";
|
||||||
|
@ -419,7 +419,11 @@ void CMeterImage::ReadConfig(const WCHAR* section)
|
|||||||
std::wstring oldImageName = m_ImageName;
|
std::wstring oldImageName = m_ImageName;
|
||||||
|
|
||||||
m_ImageName = parser.ReadString(section, L"ImageName", L"");
|
m_ImageName = parser.ReadString(section, L"ImageName", L"");
|
||||||
m_ImageName = m_MeterWindow->MakePathAbsolute(m_Path + m_ImageName);
|
if (!m_ImageName.empty())
|
||||||
|
{
|
||||||
|
m_ImageName.insert(0, m_Path);
|
||||||
|
m_ImageName = m_MeterWindow->MakePathAbsolute(m_ImageName);
|
||||||
|
}
|
||||||
|
|
||||||
if (m_DynamicVariables)
|
if (m_DynamicVariables)
|
||||||
{
|
{
|
||||||
@ -539,8 +543,7 @@ void CMeterImage::ReadConfig(const WCHAR* section)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::wstring error = L"ImageFlip=";
|
std::wstring error = L"ImageFlip=" + flip;
|
||||||
error += flip;
|
|
||||||
error += L" is not valid in meter [";
|
error += L" is not valid in meter [";
|
||||||
error += m_Name;
|
error += m_Name;
|
||||||
error += L"].";
|
error += L"].";
|
||||||
@ -588,7 +591,8 @@ bool CMeterImage::Update()
|
|||||||
std::wstring val = m_Measure->GetStringValue(false, 1, 0, false);
|
std::wstring val = m_Measure->GetStringValue(false, 1, 0, false);
|
||||||
if (!val.empty())
|
if (!val.empty())
|
||||||
{
|
{
|
||||||
val = m_MeterWindow->MakePathAbsolute(m_Path + val);
|
val.insert(0, m_Path);
|
||||||
|
val = m_MeterWindow->MakePathAbsolute(val);
|
||||||
if (val != m_ImageName)
|
if (val != m_ImageName)
|
||||||
{
|
{
|
||||||
m_ImageName = val;
|
m_ImageName = val;
|
||||||
|
@ -397,8 +397,7 @@ void CMeterLine::BindMeasure(const std::list<CMeasure*>& measures)
|
|||||||
|
|
||||||
if (i == measures.end())
|
if (i == measures.end())
|
||||||
{
|
{
|
||||||
std::wstring error = L"The meter [";
|
std::wstring error = L"The meter [" + m_Name;
|
||||||
error += m_Name;
|
|
||||||
error += L"] cannot be bound with [";
|
error += L"] cannot be bound with [";
|
||||||
error += (*j);
|
error += (*j);
|
||||||
error += L"]!";
|
error += L"]!";
|
||||||
|
@ -99,7 +99,10 @@ void CMeterRotator::ReadConfig(const WCHAR* section)
|
|||||||
CConfigParser& parser = m_MeterWindow->GetParser();
|
CConfigParser& parser = m_MeterWindow->GetParser();
|
||||||
|
|
||||||
m_ImageName = parser.ReadString(section, L"ImageName", L"");
|
m_ImageName = parser.ReadString(section, L"ImageName", L"");
|
||||||
m_ImageName = m_MeterWindow->MakePathAbsolute(m_ImageName);
|
if (!m_ImageName.empty())
|
||||||
|
{
|
||||||
|
m_ImageName = m_MeterWindow->MakePathAbsolute(m_ImageName);
|
||||||
|
}
|
||||||
|
|
||||||
m_OffsetX = parser.ReadFloat(section, L"OffsetX", 0.0);
|
m_OffsetX = parser.ReadFloat(section, L"OffsetX", 0.0);
|
||||||
m_OffsetY = parser.ReadFloat(section, L"OffsetY", 0.0);
|
m_OffsetY = parser.ReadFloat(section, L"OffsetY", 0.0);
|
||||||
|
@ -161,8 +161,7 @@ void CMeterString::Initialize()
|
|||||||
// It couldn't find the font family: Log it.
|
// It couldn't find the font family: Log it.
|
||||||
if(Ok != status)
|
if(Ok != status)
|
||||||
{
|
{
|
||||||
std::wstring error = L"Error: Couldn't load font family: ";
|
std::wstring error = L"Error: Couldn't load font family: " + m_FontFace;
|
||||||
error += m_FontFace;
|
|
||||||
LSLog(LOG_DEBUG, APPNAME, error.c_str());
|
LSLog(LOG_DEBUG, APPNAME, error.c_str());
|
||||||
|
|
||||||
delete m_FontFamily;
|
delete m_FontFamily;
|
||||||
@ -230,8 +229,7 @@ void CMeterString::Initialize()
|
|||||||
|
|
||||||
if (m_FontSize != 0)
|
if (m_FontSize != 0)
|
||||||
{
|
{
|
||||||
std::wstring error = L"Unable to create font: ";
|
std::wstring error = L"Unable to create font: " + m_FontFace;
|
||||||
error += m_FontFace;
|
|
||||||
throw CError(error, __LINE__, __FILE__);
|
throw CError(error, __LINE__, __FILE__);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -333,8 +331,7 @@ void CMeterString::ReadConfig(const WCHAR* section)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::wstring error = L"StringAlign=";
|
std::wstring error = L"StringAlign=" + align;
|
||||||
error += align;
|
|
||||||
error += L" is not valid in meter [";
|
error += L" is not valid in meter [";
|
||||||
error += m_Name;
|
error += m_Name;
|
||||||
error += L"].";
|
error += L"].";
|
||||||
@ -361,8 +358,7 @@ void CMeterString::ReadConfig(const WCHAR* section)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::wstring error = L"StringCase=";
|
std::wstring error = L"StringCase=" + stringCase;
|
||||||
error += stringCase;
|
|
||||||
error += L" is not valid in meter [";
|
error += L" is not valid in meter [";
|
||||||
error += m_Name;
|
error += m_Name;
|
||||||
error += L"].";
|
error += L"].";
|
||||||
@ -389,8 +385,7 @@ void CMeterString::ReadConfig(const WCHAR* section)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::wstring error = L"StringStyle=";
|
std::wstring error = L"StringStyle=" + style;
|
||||||
error += style;
|
|
||||||
error += L" is not valid in meter [";
|
error += L" is not valid in meter [";
|
||||||
error += m_Name;
|
error += m_Name;
|
||||||
error += L"].";
|
error += L"].";
|
||||||
@ -413,8 +408,7 @@ void CMeterString::ReadConfig(const WCHAR* section)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::wstring error = L"StringEffect=";
|
std::wstring error = L"StringEffect=" + effect;
|
||||||
error += effect;
|
|
||||||
error += L" is not valid in meter [";
|
error += L" is not valid in meter [";
|
||||||
error += m_Name;
|
error += m_Name;
|
||||||
error += L"].";
|
error += L"].";
|
||||||
@ -656,8 +650,7 @@ void CMeterString::BindMeasure(const std::list<CMeasure*>& measures)
|
|||||||
|
|
||||||
if (i == measures.end())
|
if (i == measures.end())
|
||||||
{
|
{
|
||||||
std::wstring error = L"The meter [";
|
std::wstring error = L"The meter [" + m_Name;
|
||||||
error += m_Name;
|
|
||||||
error += L"] cannot be bound with [";
|
error += L"] cannot be bound with [";
|
||||||
error += (*j);
|
error += (*j);
|
||||||
error += L"]!";
|
error += L"]!";
|
||||||
@ -698,18 +691,21 @@ void CMeterString::FreeFontCache()
|
|||||||
*/
|
*/
|
||||||
std::wstring CMeterString::FontPropertiesToString(FontFamily* fontFamily, REAL size, FontStyle style)
|
std::wstring CMeterString::FontPropertiesToString(FontFamily* fontFamily, REAL size, FontStyle style)
|
||||||
{
|
{
|
||||||
std::wstringstream stream;
|
WCHAR ids[128] = {0};
|
||||||
stream << size << L"-" << (int)style;
|
swprintf(ids, L"%.1f-%i", size, (int)style);
|
||||||
|
|
||||||
if (fontFamily)
|
if (fontFamily)
|
||||||
{
|
{
|
||||||
WCHAR familyName[LF_FACESIZE];
|
WCHAR familyName[LF_FACESIZE];
|
||||||
if (Ok == fontFamily->GetFamilyName(familyName))
|
if (Ok == fontFamily->GetFamilyName(familyName))
|
||||||
{
|
{
|
||||||
return std::wstring(familyName) + L"-" + stream.str();
|
std::wstring prop = familyName;
|
||||||
|
prop += L"-";
|
||||||
|
prop += ids;
|
||||||
|
return prop;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return stream.str();
|
return ids;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -184,14 +184,12 @@ CMeterWindow::~CMeterWindow()
|
|||||||
*/
|
*/
|
||||||
int CMeterWindow::Initialize(CRainmeter& Rainmeter)
|
int CMeterWindow::Initialize(CRainmeter& Rainmeter)
|
||||||
{
|
{
|
||||||
WNDCLASSEX wc;
|
WNDCLASSEX wc = {sizeof(WNDCLASSEX)};
|
||||||
|
|
||||||
m_Rainmeter = &Rainmeter;
|
m_Rainmeter = &Rainmeter;
|
||||||
|
|
||||||
// Register the windowclass
|
// Register the windowclass
|
||||||
memset(&wc, 0, sizeof(WNDCLASSEX));
|
|
||||||
wc.style = CS_NOCLOSE | CS_DBLCLKS;
|
wc.style = CS_NOCLOSE | CS_DBLCLKS;
|
||||||
wc.cbSize = sizeof(WNDCLASSEX);
|
|
||||||
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
|
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||||
wc.lpfnWndProc = WndProc;
|
wc.lpfnWndProc = WndProc;
|
||||||
wc.hInstance = m_Rainmeter->GetInstance();
|
wc.hInstance = m_Rainmeter->GetInstance();
|
||||||
@ -295,7 +293,8 @@ void CMeterWindow::Refresh(bool init, bool all)
|
|||||||
m_Rainmeter->SetCurrentParser(&m_Parser);
|
m_Rainmeter->SetCurrentParser(&m_Parser);
|
||||||
|
|
||||||
std::wstring dbg = L"Refreshing skin \"" + m_SkinName;
|
std::wstring dbg = L"Refreshing skin \"" + m_SkinName;
|
||||||
dbg += L"\\" + m_SkinIniFile;
|
dbg += L"\\";
|
||||||
|
dbg += m_SkinIniFile;
|
||||||
dbg += L"\"";
|
dbg += L"\"";
|
||||||
LSLog(LOG_DEBUG, APPNAME, dbg.c_str());
|
LSLog(LOG_DEBUG, APPNAME, dbg.c_str());
|
||||||
|
|
||||||
@ -1266,15 +1265,8 @@ void CMeterWindow::WindowToScreen()
|
|||||||
{
|
{
|
||||||
index = index + 1;
|
index = index + 1;
|
||||||
index2 = m_WindowX.find_first_not_of(L"0123456789", index);
|
index2 = m_WindowX.find_first_not_of(L"0123456789", index);
|
||||||
std::wstring screenStr;
|
|
||||||
if (index2 != std::wstring::npos)
|
std::wstring screenStr = m_WindowX.substr(index, (index2 != std::wstring::npos) ? index2 - index : std::wstring::npos);
|
||||||
{
|
|
||||||
screenStr = m_WindowX.substr(index, index2 - index);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
screenStr = m_WindowX.substr(index);
|
|
||||||
}
|
|
||||||
if (!screenStr.empty())
|
if (!screenStr.empty())
|
||||||
{
|
{
|
||||||
int screenIndex = _wtoi(screenStr.c_str());
|
int screenIndex = _wtoi(screenStr.c_str());
|
||||||
@ -1335,15 +1327,8 @@ void CMeterWindow::WindowToScreen()
|
|||||||
{
|
{
|
||||||
index = index + 1;
|
index = index + 1;
|
||||||
index2 = m_WindowY.find_first_not_of(L"0123456789", index);
|
index2 = m_WindowY.find_first_not_of(L"0123456789", index);
|
||||||
std::wstring screenStr;
|
|
||||||
if (index2 != std::wstring::npos)
|
std::wstring screenStr = m_WindowY.substr(index, (index2 != std::wstring::npos) ? index2 - index : std::wstring::npos);
|
||||||
{
|
|
||||||
screenStr = m_WindowY.substr(index, index2 - index);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
screenStr = m_WindowY.substr(index);
|
|
||||||
}
|
|
||||||
if (!screenStr.empty())
|
if (!screenStr.empty())
|
||||||
{
|
{
|
||||||
int screenIndex = _wtoi(screenStr.c_str());
|
int screenIndex = _wtoi(screenStr.c_str());
|
||||||
@ -1524,7 +1509,7 @@ void CMeterWindow::ScreenToWindow()
|
|||||||
*/
|
*/
|
||||||
void CMeterWindow::ReadConfig()
|
void CMeterWindow::ReadConfig()
|
||||||
{
|
{
|
||||||
std::wstring iniFile = m_Rainmeter->GetIniFile();
|
const std::wstring& iniFile = m_Rainmeter->GetIniFile();
|
||||||
const WCHAR* section = L"Rainmeter";
|
const WCHAR* section = L"Rainmeter";
|
||||||
|
|
||||||
// Reset settings to the default value
|
// Reset settings to the default value
|
||||||
@ -1651,7 +1636,7 @@ void CMeterWindow::ReadConfig()
|
|||||||
void CMeterWindow::WriteConfig()
|
void CMeterWindow::WriteConfig()
|
||||||
{
|
{
|
||||||
WCHAR buffer[32];
|
WCHAR buffer[32];
|
||||||
std::wstring iniFile = m_Rainmeter->GetIniFile();
|
const std::wstring& iniFile = m_Rainmeter->GetIniFile();
|
||||||
const WCHAR* section = m_SkinName.c_str();
|
const WCHAR* section = m_SkinName.c_str();
|
||||||
|
|
||||||
if(!iniFile.empty())
|
if(!iniFile.empty())
|
||||||
@ -1699,16 +1684,14 @@ void CMeterWindow::WriteConfig()
|
|||||||
*/
|
*/
|
||||||
bool CMeterWindow::ReadSkin()
|
bool CMeterWindow::ReadSkin()
|
||||||
{
|
{
|
||||||
std::wstring iniFile = m_SkinPath;
|
std::wstring iniFile = m_SkinPath + m_SkinName;
|
||||||
iniFile += m_SkinName;
|
|
||||||
iniFile += L"\\";
|
iniFile += L"\\";
|
||||||
iniFile += m_SkinIniFile;
|
iniFile += m_SkinIniFile;
|
||||||
|
|
||||||
// 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 = L"Unable to refresh skin \"";
|
std::wstring message = L"Unable to refresh skin \"" + m_SkinName;
|
||||||
message += m_SkinName;
|
|
||||||
message += L"\\";
|
message += L"\\";
|
||||||
message += m_SkinIniFile;
|
message += m_SkinIniFile;
|
||||||
message += L"\": Ini-file not found.";
|
message += L"\": Ini-file not found.";
|
||||||
@ -1742,8 +1725,7 @@ bool CMeterWindow::ReadSkin()
|
|||||||
wsprintf(buffer, L"%i.%i", appVersion / 1000000, (appVersion / 1000) % 1000);
|
wsprintf(buffer, L"%i.%i", appVersion / 1000000, (appVersion / 1000) % 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::wstring text = L"The skin \"";
|
std::wstring text = L"The skin \"" + m_SkinName;
|
||||||
text += m_SkinName;
|
|
||||||
text += L"\\";
|
text += L"\\";
|
||||||
text += m_SkinIniFile;
|
text += m_SkinIniFile;
|
||||||
text += L"\" needs Rainmeter ";
|
text += L"\" needs Rainmeter ";
|
||||||
@ -1835,8 +1817,7 @@ bool CMeterWindow::ReadSkin()
|
|||||||
nResults = m_FontCollection->AddFontFile(szFontFile.c_str());
|
nResults = m_FontCollection->AddFontFile(szFontFile.c_str());
|
||||||
if(nResults != Ok)
|
if(nResults != Ok)
|
||||||
{
|
{
|
||||||
std::wstring error = L"Error: Couldn't load font file: ";
|
std::wstring error = L"Error: Couldn't load font file: " + localFont;
|
||||||
error += localFont;
|
|
||||||
LSLog(LOG_DEBUG, APPNAME, error.c_str());
|
LSLog(LOG_DEBUG, APPNAME, error.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1879,8 +1860,7 @@ bool CMeterWindow::ReadSkin()
|
|||||||
// The font file wasn't found anywhere, log the error
|
// The font file wasn't found anywhere, log the error
|
||||||
if(nResults != Ok)
|
if(nResults != Ok)
|
||||||
{
|
{
|
||||||
std::wstring error = L"Error: Couldn't load font file: ";
|
std::wstring error = L"Error: Couldn't load font file: " + localFont;
|
||||||
error += localFont;
|
|
||||||
LSLog(LOG_DEBUG, APPNAME, error.c_str());
|
LSLog(LOG_DEBUG, APPNAME, error.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1997,8 +1977,7 @@ bool CMeterWindow::ReadSkin()
|
|||||||
|
|
||||||
if (m_Meters.empty())
|
if (m_Meters.empty())
|
||||||
{
|
{
|
||||||
std::wstring text = L"The skin \"";
|
std::wstring text = L"The skin \"" + m_SkinName;
|
||||||
text += m_SkinName;
|
|
||||||
text += L"\\";
|
text += L"\\";
|
||||||
text += m_SkinIniFile;
|
text += m_SkinIniFile;
|
||||||
if (m_Measures.empty())
|
if (m_Measures.empty())
|
||||||
@ -3109,9 +3088,13 @@ LRESULT CMeterWindow::OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||||||
{
|
{
|
||||||
if(wParam == ID_CONTEXT_SKINMENU_EDITSKIN)
|
if(wParam == ID_CONTEXT_SKINMENU_EDITSKIN)
|
||||||
{
|
{
|
||||||
std::wstring command = m_Rainmeter->GetConfigEditor();
|
std::wstring command = m_Rainmeter->GetConfigEditor() + L" \"";
|
||||||
command += L" \"";
|
command += m_SkinPath;
|
||||||
command += m_SkinPath + L"\\" + m_SkinName + L"\\" + m_SkinIniFile + L"\"";
|
command += L"\\";
|
||||||
|
command += m_SkinName;
|
||||||
|
command += L"\\";
|
||||||
|
command += m_SkinIniFile;
|
||||||
|
command += L"\"";
|
||||||
|
|
||||||
// If the skins are in the program folder start the editor as admin
|
// If the skins are in the program folder start the editor as admin
|
||||||
if (m_Rainmeter->GetPath() + L"Skins\\" == m_Rainmeter->GetSkinPath())
|
if (m_Rainmeter->GetPath() + L"Skins\\" == m_Rainmeter->GetSkinPath())
|
||||||
@ -3125,8 +3108,9 @@ LRESULT CMeterWindow::OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||||||
}
|
}
|
||||||
else if(wParam == ID_CONTEXT_SKINMENU_OPENSKINSFOLDER)
|
else if(wParam == ID_CONTEXT_SKINMENU_OPENSKINSFOLDER)
|
||||||
{
|
{
|
||||||
std::wstring command = L"\"";
|
std::wstring command = L"\"" + m_SkinPath;
|
||||||
command += m_SkinPath + L"\\" + m_SkinName;
|
command += L"\\";
|
||||||
|
command += m_SkinName;
|
||||||
command += L"\"";
|
command += L"\"";
|
||||||
LSExecute(NULL, command.c_str(), SW_SHOWNORMAL);
|
LSExecute(NULL, command.c_str(), SW_SHOWNORMAL);
|
||||||
}
|
}
|
||||||
|
@ -1302,7 +1302,8 @@ int CRainmeter::Initialize(HWND Parent, HINSTANCE Instance, LPCSTR szPath)
|
|||||||
|
|
||||||
if (c_CmdLine.empty())
|
if (c_CmdLine.empty())
|
||||||
{
|
{
|
||||||
m_IniFile = m_Path + L"Rainmeter.ini";
|
m_IniFile = m_Path;
|
||||||
|
m_IniFile += L"Rainmeter.ini";
|
||||||
|
|
||||||
// If the ini file doesn't exist in the program folder store it to the %APPDATA% instead so that things work better in Vista/Win7
|
// If the ini file doesn't exist in the program folder store it to the %APPDATA% instead so that things work better in Vista/Win7
|
||||||
if (_waccess(m_IniFile.c_str(), 0) == -1)
|
if (_waccess(m_IniFile.c_str(), 0) == -1)
|
||||||
@ -1382,9 +1383,10 @@ int CRainmeter::Initialize(HWND Parent, HINSTANCE Instance, LPCSTR szPath)
|
|||||||
StartLogging();
|
StartLogging();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_PluginPath = tmpName;
|
m_PluginPath = m_AddonPath = m_SkinPath = m_Path;
|
||||||
m_PluginPath += L"Plugins\\";
|
m_PluginPath += L"Plugins\\";
|
||||||
m_SkinPath = m_Path + L"Skins\\";
|
m_AddonPath += L"Addons\\";
|
||||||
|
m_SkinPath += L"Skins\\";
|
||||||
|
|
||||||
// Read the skin folder from the ini file
|
// Read the skin folder from the ini file
|
||||||
WCHAR tmpSz[MAX_LINE_LENGTH];
|
WCHAR tmpSz[MAX_LINE_LENGTH];
|
||||||
@ -1404,14 +1406,13 @@ int CRainmeter::Initialize(HWND Parent, HINSTANCE Instance, LPCSTR szPath)
|
|||||||
m_SkinPath = szPath;
|
m_SkinPath = szPath;
|
||||||
m_SkinPath += L"\\Rainmeter";
|
m_SkinPath += L"\\Rainmeter";
|
||||||
CreateDirectory(m_SkinPath.c_str(), NULL);
|
CreateDirectory(m_SkinPath.c_str(), NULL);
|
||||||
m_SkinPath += L"\\Skins";
|
m_SkinPath += L"\\Skins\\";
|
||||||
DWORD result = CreateDirectory(m_SkinPath.c_str(), NULL);
|
DWORD result = CreateDirectory(m_SkinPath.c_str(), NULL);
|
||||||
m_SkinPath += L"\\";
|
|
||||||
if (result != 0)
|
if (result != 0)
|
||||||
{
|
{
|
||||||
// The folder was created successfully which means that it wasn't available yet.
|
// The folder was created successfully which means that it wasn't available yet.
|
||||||
// Copy the default skin to the Skins folder
|
// Copy the default skin to the Skins folder
|
||||||
std::wstring strFrom(m_Path + L"Skins\\" + L"*.*");
|
std::wstring strFrom(m_Path + L"Skins\\*.*");
|
||||||
std::wstring strTo(m_SkinPath);
|
std::wstring strTo(m_SkinPath);
|
||||||
CSystem::CopyFiles(strFrom, strTo);
|
CSystem::CopyFiles(strFrom, strTo);
|
||||||
|
|
||||||
@ -1420,10 +1421,9 @@ int CRainmeter::Initialize(HWND Parent, HINSTANCE Instance, LPCSTR szPath)
|
|||||||
CSystem::RemoveFile(strNote);
|
CSystem::RemoveFile(strNote);
|
||||||
|
|
||||||
// Copy also the themes to the %APPDATA%
|
// Copy also the themes to the %APPDATA%
|
||||||
strFrom = std::wstring(m_Path + L"Themes\\" + L"*.*");
|
strFrom = std::wstring(m_Path + L"Themes\\*.*");
|
||||||
strTo = std::wstring(GetSettingsPath() + L"Themes");
|
strTo = std::wstring(GetSettingsPath() + L"Themes\\");
|
||||||
CreateDirectory(strTo.c_str(), NULL);
|
CreateDirectory(strTo.c_str(), NULL);
|
||||||
strTo += L"\\";
|
|
||||||
CSystem::CopyFiles(strFrom, strTo);
|
CSystem::CopyFiles(strFrom, strTo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1469,6 +1469,29 @@ int CRainmeter::Initialize(HWND Parent, HINSTANCE Instance, LPCSTR szPath)
|
|||||||
DebugLog(L"SkinPath: %s", m_SkinPath.c_str());
|
DebugLog(L"SkinPath: %s", m_SkinPath.c_str());
|
||||||
DebugLog(L"PluginPath: %s", m_PluginPath.c_str());
|
DebugLog(L"PluginPath: %s", m_PluginPath.c_str());
|
||||||
|
|
||||||
|
// Extract volume path from program path
|
||||||
|
// E.g.:
|
||||||
|
// "C:\path\" to "C:"
|
||||||
|
// "\\server\share\" to "\\server\share"
|
||||||
|
// "\\server\C:\path\" to "\\server\C:"
|
||||||
|
std::wstring::size_type loc;
|
||||||
|
if ((loc = m_Path.find_first_of(L':')) != std::wstring::npos)
|
||||||
|
{
|
||||||
|
m_Drive = m_Path.substr(0, loc + 1);
|
||||||
|
}
|
||||||
|
else if (m_Path.length() >= 2 && (m_Path[0] == L'\\' || m_Path[0] == L'/') && (m_Path[1] == L'\\' || m_Path[1] == L'/'))
|
||||||
|
{
|
||||||
|
if ((loc = m_Path.find_first_of(L"\\/", 2)) != std::wstring::npos)
|
||||||
|
{
|
||||||
|
std::wstring::size_type loc2;
|
||||||
|
if ((loc2 = m_Path.find_first_of(L"\\/", loc + 1)) != std::wstring::npos || loc != (m_Path.length() - 1))
|
||||||
|
{
|
||||||
|
loc = loc2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m_Drive = m_Path.substr(0, loc);
|
||||||
|
}
|
||||||
|
|
||||||
// Test that the Rainmeter.ini file is writable
|
// Test that the Rainmeter.ini file is writable
|
||||||
TestSettingsFile(bDefaultIniLocation);
|
TestSettingsFile(bDefaultIniLocation);
|
||||||
|
|
||||||
@ -1622,8 +1645,10 @@ void CRainmeter::CheckSkinVersions()
|
|||||||
// DebugLog(L"%s", menu[i].name.c_str());
|
// DebugLog(L"%s", menu[i].name.c_str());
|
||||||
|
|
||||||
// Read the version files
|
// Read the version files
|
||||||
std::wstring strNewVersionFile = strMainSkinsPath + menu[i].name + L"\\version";
|
std::wstring strNewVersionFile = strMainSkinsPath + menu[i].name;
|
||||||
std::wstring strCurrentVersionFile = m_SkinPath + menu[i].name + L"\\version";
|
strNewVersionFile += L"\\version";
|
||||||
|
std::wstring strCurrentVersionFile = m_SkinPath + menu[i].name;
|
||||||
|
strCurrentVersionFile += L"\\version";
|
||||||
|
|
||||||
std::string strVersion;
|
std::string strVersion;
|
||||||
std::wstring strVersionNew;
|
std::wstring strVersionNew;
|
||||||
@ -1664,13 +1689,13 @@ void CRainmeter::CheckSkinVersions()
|
|||||||
std::wstring strSkinPath = m_SkinPath + menu[i].name;
|
std::wstring strSkinPath = m_SkinPath + menu[i].name;
|
||||||
if (_wstat(strSkinPath.c_str(), &s) == 0)
|
if (_wstat(strSkinPath.c_str(), &s) == 0)
|
||||||
{
|
{
|
||||||
std::wstring strMessage = L"A new version of config \"" + menu[i].name + L"\" is available.\n\n";
|
std::wstring strMessage = L"A new version of config \"" + menu[i].name;
|
||||||
strMessage += L"New version: " + (strVersionNew.empty() ? L"Unknown" : strVersionNew) + L"\n";
|
strMessage += L"\" is available.\n\nNew version: ";
|
||||||
strMessage += L"Current version: " + (strVersionCurrent.empty() ? L"Unknown" : strVersionCurrent) + L"\n";
|
strMessage += strVersionNew.empty() ? L"Unknown" : strVersionNew;
|
||||||
strMessage += L"\n";
|
strMessage += L"\nCurrent version: ";
|
||||||
strMessage += L"Do you want to upgrade?";
|
strMessage += strVersionCurrent.empty() ? L"Unknown" : strVersionCurrent;
|
||||||
strMessage += L"\n\n";
|
strMessage += L"\n\nDo you want to upgrade?\n\n"
|
||||||
strMessage += L"(If you select 'Yes' your current config\nwill be moved into the 'Backup' folder)";
|
L"(If you select 'Yes' your current config\nwill be moved into the 'Backup' folder)";
|
||||||
|
|
||||||
if (IDYES == MessageBox(NULL, strMessage.c_str(), APPNAME, MB_YESNO | MB_ICONQUESTION))
|
if (IDYES == MessageBox(NULL, strMessage.c_str(), APPNAME, MB_YESNO | MB_ICONQUESTION))
|
||||||
{
|
{
|
||||||
@ -1680,7 +1705,10 @@ void CRainmeter::CheckSkinVersions()
|
|||||||
// Check for illegal characters from the version number
|
// Check for illegal characters from the version number
|
||||||
if (strVersionCurrent.find_first_of(L"\\/\"*:?<>|") == std::wstring::npos)
|
if (strVersionCurrent.find_first_of(L"\\/\"*:?<>|") == std::wstring::npos)
|
||||||
{
|
{
|
||||||
std::wstring strTarget = m_SkinPath + L"Backup\\" + menu[i].name + L"-" + strVersionCurrent;
|
std::wstring strTarget = m_SkinPath + L"Backup\\";
|
||||||
|
strTarget += menu[i].name;
|
||||||
|
strTarget += L"-";
|
||||||
|
strTarget += strVersionCurrent;
|
||||||
if (CSystem::CopyFiles(m_SkinPath + menu[i].name, strTarget, true)) // Move the folder to "backup"
|
if (CSystem::CopyFiles(m_SkinPath + menu[i].name, strTarget, true)) // Move the folder to "backup"
|
||||||
{
|
{
|
||||||
// Upgrade the skin
|
// Upgrade the skin
|
||||||
@ -1710,8 +1738,9 @@ void CRainmeter::CheckSkinVersions()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::wstring strMessage = L"A new version of config \"" + menu[i].name + L"\" is available\n";
|
std::wstring strMessage = L"A new version of config \"" + menu[i].name;
|
||||||
strMessage += L"Do you want to add it to your skin and themes libraries?";
|
strMessage += L"\" is available\n"
|
||||||
|
L"Do you want to add it to your skin and themes libraries?";
|
||||||
if (IDYES == MessageBox(NULL, strMessage.c_str(), APPNAME, MB_YESNO | MB_ICONQUESTION))
|
if (IDYES == MessageBox(NULL, strMessage.c_str(), APPNAME, MB_YESNO | MB_ICONQUESTION))
|
||||||
{
|
{
|
||||||
CSystem::CopyFiles(strMainSkinsPath + menu[i].name, m_SkinPath);
|
CSystem::CopyFiles(strMainSkinsPath + menu[i].name, m_SkinPath);
|
||||||
@ -1829,15 +1858,13 @@ void CRainmeter::ActivateConfig(int configIndex, int iniIndex)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Verify whether the ini-file exists
|
// Verify whether the ini-file exists
|
||||||
std::wstring skinIniPath = skinPath;
|
std::wstring skinIniPath = skinPath + skinConfig;
|
||||||
skinIniPath += skinConfig;
|
|
||||||
skinIniPath += L"\\";
|
skinIniPath += L"\\";
|
||||||
skinIniPath += skinIniFile;
|
skinIniPath += skinIniFile;
|
||||||
|
|
||||||
if (_waccess(skinIniPath.c_str(), 0) == -1)
|
if (_waccess(skinIniPath.c_str(), 0) == -1)
|
||||||
{
|
{
|
||||||
std::wstring message = L"Unable to activate skin \"";
|
std::wstring message = L"Unable to activate skin \"" + skinConfig;
|
||||||
message += skinConfig;
|
|
||||||
message += L"\\";
|
message += L"\\";
|
||||||
message += skinIniFile;
|
message += skinIniFile;
|
||||||
message += L"\": Ini-file not found.";
|
message += L"\": Ini-file not found.";
|
||||||
@ -2221,7 +2248,8 @@ int CRainmeter::ScanForConfigsRecursive(const std::wstring& path, std::wstring b
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Scan for folders
|
// Scan for folders
|
||||||
std::wstring files = path + base + L"*";
|
std::wstring files = path + base;
|
||||||
|
files += L"*";
|
||||||
hSearch = FindFirstFile(files.c_str(), &fileData);
|
hSearch = FindFirstFile(files.c_str(), &fileData);
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
@ -2561,8 +2589,7 @@ BOOL CRainmeter::ExecuteBang(const std::wstring& bang, const std::wstring& arg,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::wstring error = L"Unknown !bang: ";
|
std::wstring error = L"Unknown !bang: " + bang;
|
||||||
error += bang;
|
|
||||||
MessageBox(NULL, error.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
|
MessageBox(NULL, error.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -2734,8 +2761,6 @@ void CRainmeter::ReadGeneralSettings(const std::wstring& iniFile)
|
|||||||
|
|
||||||
// Read Logging settings
|
// Read Logging settings
|
||||||
m_Logging = 0!=parser.ReadInt(L"Rainmeter", L"Logging", 0);
|
m_Logging = 0!=parser.ReadInt(L"Rainmeter", L"Logging", 0);
|
||||||
m_DisableDrag = 0!=parser.ReadInt(L"Rainmeter", L"DisableDrag", 0);
|
|
||||||
m_DisableRDP = 0!=parser.ReadInt(L"Rainmeter", L"DisableRDP", 0);
|
|
||||||
c_Debug = 0!=parser.ReadInt(L"Rainmeter", L"Debug", 0);
|
c_Debug = 0!=parser.ReadInt(L"Rainmeter", L"Debug", 0);
|
||||||
|
|
||||||
if (m_Logging)
|
if (m_Logging)
|
||||||
@ -2751,6 +2776,9 @@ void CRainmeter::ReadGeneralSettings(const std::wstring& iniFile)
|
|||||||
c_GlobalConfig.netInSpeed = parser.ReadFloat(L"Rainmeter", L"NetInSpeed", 0.0);
|
c_GlobalConfig.netInSpeed = parser.ReadFloat(L"Rainmeter", L"NetInSpeed", 0.0);
|
||||||
c_GlobalConfig.netOutSpeed = parser.ReadFloat(L"Rainmeter", L"NetOutSpeed", 0.0);
|
c_GlobalConfig.netOutSpeed = parser.ReadFloat(L"Rainmeter", L"NetOutSpeed", 0.0);
|
||||||
|
|
||||||
|
m_DisableDrag = 0!=parser.ReadInt(L"Rainmeter", L"DisableDrag", 0);
|
||||||
|
m_DisableRDP = 0!=parser.ReadInt(L"Rainmeter", L"DisableRDP", 0);
|
||||||
|
|
||||||
m_ConfigEditor = parser.ReadString(L"Rainmeter", L"ConfigEditor", L"");
|
m_ConfigEditor = parser.ReadString(L"Rainmeter", L"ConfigEditor", L"");
|
||||||
if (m_ConfigEditor.empty())
|
if (m_ConfigEditor.empty())
|
||||||
{
|
{
|
||||||
@ -2859,7 +2887,10 @@ void CRainmeter::ReadGeneralSettings(const std::wstring& iniFile)
|
|||||||
{
|
{
|
||||||
if (!SetActiveConfig(skinName, skinIni))
|
if (!SetActiveConfig(skinName, skinIni))
|
||||||
{
|
{
|
||||||
std::wstring error = L"The selected skin (L" + skinName + L"\\" + skinIni + L") cannot be found.";
|
std::wstring error = L"The selected skin (L" + skinName;
|
||||||
|
error += L"\\";
|
||||||
|
error += skinIni;
|
||||||
|
error += L") cannot be found.";
|
||||||
MessageBox(NULL, error.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
|
MessageBox(NULL, error.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -2967,8 +2998,7 @@ void CRainmeter::RefreshAll()
|
|||||||
{
|
{
|
||||||
DeactivateConfig(mw, i);
|
DeactivateConfig(mw, i);
|
||||||
|
|
||||||
std::wstring message = L"Unable to refresh skin \"";
|
std::wstring message = L"Unable to refresh skin \"" + skinConfig;
|
||||||
message += skinConfig;
|
|
||||||
message += L"\\";
|
message += L"\\";
|
||||||
message += skinIniFile;
|
message += skinIniFile;
|
||||||
message += L"\": Ini-file not found.";
|
message += L"\": Ini-file not found.";
|
||||||
@ -2985,8 +3015,7 @@ void CRainmeter::RefreshAll()
|
|||||||
{
|
{
|
||||||
DeactivateConfig(mw, -2); // -2 = Deactivate the config forcibly
|
DeactivateConfig(mw, -2); // -2 = Deactivate the config forcibly
|
||||||
|
|
||||||
std::wstring message = L"Unable to refresh config \"";
|
std::wstring message = L"Unable to refresh config \"" + skinConfig;
|
||||||
message += skinConfig;
|
|
||||||
message += L"\": Config not found.";
|
message += L"\": Config not found.";
|
||||||
LSLog(LOG_DEBUG, APPNAME, message.c_str());
|
LSLog(LOG_DEBUG, APPNAME, message.c_str());
|
||||||
MessageBox(NULL, message.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
|
MessageBox(NULL, message.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
|
||||||
@ -3693,8 +3722,7 @@ void CRainmeter::StartLogging()
|
|||||||
ResetLoggingFlag(); // Re-enable logging
|
ResetLoggingFlag(); // Re-enable logging
|
||||||
SetLogging(true);
|
SetLogging(true);
|
||||||
|
|
||||||
std::wstring message = L"Log file created at: ";
|
std::wstring message = L"Log file created at: " + m_LogFile;
|
||||||
message += m_LogFile;
|
|
||||||
MessageBox(NULL, message.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONINFORMATION);
|
MessageBox(NULL, message.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONINFORMATION);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -3703,8 +3731,7 @@ void CRainmeter::StartLogging()
|
|||||||
SetLogging(false);
|
SetLogging(false);
|
||||||
ResetLoggingFlag();
|
ResetLoggingFlag();
|
||||||
|
|
||||||
std::wstring message = L"Unable to create log file: ";
|
std::wstring message = L"Unable to create log file: " + m_LogFile;
|
||||||
message += m_LogFile;
|
|
||||||
MessageBox(NULL, message.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONERROR);
|
MessageBox(NULL, message.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3724,9 +3751,8 @@ void CRainmeter::DeleteLogFile()
|
|||||||
// Check if the file exists
|
// Check if the file exists
|
||||||
if (_waccess(m_LogFile.c_str(), 0) != -1)
|
if (_waccess(m_LogFile.c_str(), 0) != -1)
|
||||||
{
|
{
|
||||||
std::wstring message = L"Do you want to delete the following log file?\n";
|
std::wstring message = L"Do you want to delete the following log file?\n" + m_LogFile;
|
||||||
message += m_LogFile;
|
int res = MessageBox(NULL, message.c_str(), APPNAME, MB_YESNO | MB_TOPMOST | MB_ICONQUESTION);
|
||||||
int res = MessageBox(NULL, message.c_str(), L"Rainmeter", MB_YESNO | MB_TOPMOST | MB_ICONQUESTION);
|
|
||||||
if (res == IDYES)
|
if (res == IDYES)
|
||||||
{
|
{
|
||||||
// Disable logging
|
// Disable logging
|
||||||
@ -3785,8 +3811,8 @@ void CRainmeter::TestSettingsFile(bool bDefaultIniLocation)
|
|||||||
{
|
{
|
||||||
LSLog(LOG_DEBUG, APPNAME, L"The Rainmeter.ini file is NOT writable.");
|
LSLog(LOG_DEBUG, APPNAME, L"The Rainmeter.ini file is NOT writable.");
|
||||||
|
|
||||||
std::wstring error = L"The Rainmeter.ini file is not writable. This means that the\n";
|
std::wstring error = L"The Rainmeter.ini file is not writable. This means that the\n"
|
||||||
error += L"application will not be able to save any settings permanently.\n\n";
|
L"application will not be able to save any settings permanently.\n\n";
|
||||||
|
|
||||||
if (!bDefaultIniLocation)
|
if (!bDefaultIniLocation)
|
||||||
{
|
{
|
||||||
@ -3797,16 +3823,16 @@ void CRainmeter::TestSettingsFile(bool bDefaultIniLocation)
|
|||||||
error += m_IniFile;
|
error += m_IniFile;
|
||||||
error += L"\n\nto\n\n";
|
error += L"\n\nto\n\n";
|
||||||
error += strTarget;
|
error += strTarget;
|
||||||
error += L"\n\nAlternatively you can simply remove the file and\n";
|
error += L"\n\nAlternatively you can simply remove the file and\n"
|
||||||
error += L"it will be automatically recreated in the correct location\n";
|
L"it will be automatically recreated in the correct location\n"
|
||||||
error += L"when Rainmeter is restarted the next time (you\'ll lose your\n";
|
L"when Rainmeter is restarted the next time (you\'ll lose your\n"
|
||||||
error += L"current settings though).\n";
|
L"current settings though).\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
error += L"Make sure that the settings file is not set as read-only and\n";
|
error += L"Make sure that the settings file is not set as read-only and\n"
|
||||||
error += L"that it is located in a folder where you have write permissions.\n\n";
|
L"that it is located in a folder where you have write permissions.\n\n"
|
||||||
error += L"The settings file is located at:\n";
|
L"The settings file is located at:\n";
|
||||||
error += m_IniFile;
|
error += m_IniFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,8 +161,11 @@ public:
|
|||||||
const std::wstring& GetLogFile() { return m_LogFile; }
|
const std::wstring& GetLogFile() { return m_LogFile; }
|
||||||
const std::wstring& GetSkinPath() { return m_SkinPath; }
|
const std::wstring& GetSkinPath() { return m_SkinPath; }
|
||||||
const std::wstring& GetPluginPath() { return m_PluginPath; }
|
const std::wstring& GetPluginPath() { return m_PluginPath; }
|
||||||
|
const std::wstring& GetAddonPath() { return m_AddonPath; }
|
||||||
std::wstring GetSettingsPath() { return ExtractPath(m_IniFile); }
|
std::wstring GetSettingsPath() { return ExtractPath(m_IniFile); }
|
||||||
|
|
||||||
|
const std::wstring& GetDrive() { return m_Drive; }
|
||||||
|
|
||||||
const std::wstring& GetConfigEditor() { return m_ConfigEditor; }
|
const std::wstring& GetConfigEditor() { return m_ConfigEditor; }
|
||||||
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; }
|
||||||
@ -263,6 +266,9 @@ private:
|
|||||||
std::wstring m_LogFile; // The log file
|
std::wstring m_LogFile; // The log file
|
||||||
std::wstring m_SkinPath; // Path to the folder where the skins are
|
std::wstring m_SkinPath; // Path to the folder where the skins are
|
||||||
std::wstring m_PluginPath; // Path to the folder where the plugins are
|
std::wstring m_PluginPath; // Path to the folder where the plugins are
|
||||||
|
std::wstring m_AddonPath; // Path to the folder where the addons are
|
||||||
|
|
||||||
|
std::wstring m_Drive;
|
||||||
|
|
||||||
std::wstring m_StatsDate; // The date when stats gathering started
|
std::wstring m_StatsDate; // The date when stats gathering started
|
||||||
|
|
||||||
|
@ -107,7 +107,6 @@ CTrayWindow::~CTrayWindow()
|
|||||||
BOOL CTrayWindow::AddTrayIcon()
|
BOOL CTrayWindow::AddTrayIcon()
|
||||||
{
|
{
|
||||||
BOOL res = FALSE;
|
BOOL res = FALSE;
|
||||||
NOTIFYICONDATA tnid;
|
|
||||||
|
|
||||||
if (m_TrayIcon)
|
if (m_TrayIcon)
|
||||||
{
|
{
|
||||||
@ -119,7 +118,7 @@ BOOL CTrayWindow::AddTrayIcon()
|
|||||||
|
|
||||||
if (m_TrayIcon)
|
if (m_TrayIcon)
|
||||||
{
|
{
|
||||||
tnid.cbSize = sizeof(NOTIFYICONDATA);
|
NOTIFYICONDATA tnid = {sizeof(NOTIFYICONDATA)};
|
||||||
tnid.hWnd = m_Window;
|
tnid.hWnd = m_Window;
|
||||||
tnid.uID = IDI_TRAY;
|
tnid.uID = IDI_TRAY;
|
||||||
tnid.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
|
tnid.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
|
||||||
@ -138,9 +137,7 @@ BOOL CTrayWindow::RemoveTrayIcon()
|
|||||||
|
|
||||||
if (m_TrayIcon)
|
if (m_TrayIcon)
|
||||||
{
|
{
|
||||||
NOTIFYICONDATA tnid;
|
NOTIFYICONDATA tnid = {sizeof(NOTIFYICONDATA)};
|
||||||
|
|
||||||
tnid.cbSize = sizeof(NOTIFYICONDATA);
|
|
||||||
tnid.hWnd = m_Window;
|
tnid.hWnd = m_Window;
|
||||||
tnid.uID = IDI_TRAY;
|
tnid.uID = IDI_TRAY;
|
||||||
tnid.uFlags = 0;
|
tnid.uFlags = 0;
|
||||||
@ -157,7 +154,6 @@ BOOL CTrayWindow::RemoveTrayIcon()
|
|||||||
BOOL CTrayWindow::ModifyTrayIcon(double value)
|
BOOL CTrayWindow::ModifyTrayIcon(double value)
|
||||||
{
|
{
|
||||||
BOOL res = FALSE;
|
BOOL res = FALSE;
|
||||||
NOTIFYICONDATA tnid;
|
|
||||||
|
|
||||||
if (m_TrayIcon)
|
if (m_TrayIcon)
|
||||||
{
|
{
|
||||||
@ -167,7 +163,7 @@ BOOL CTrayWindow::ModifyTrayIcon(double value)
|
|||||||
|
|
||||||
m_TrayIcon = CreateTrayIcon(value);
|
m_TrayIcon = CreateTrayIcon(value);
|
||||||
|
|
||||||
tnid.cbSize = sizeof(NOTIFYICONDATA);
|
NOTIFYICONDATA tnid = {sizeof(NOTIFYICONDATA)};
|
||||||
tnid.hWnd = m_Window;
|
tnid.hWnd = m_Window;
|
||||||
tnid.uID = IDI_TRAY;
|
tnid.uID = IDI_TRAY;
|
||||||
tnid.uFlags = NIF_ICON;
|
tnid.uFlags = NIF_ICON;
|
||||||
@ -182,19 +178,16 @@ BOOL CTrayWindow::ShowBalloonHelp()
|
|||||||
{
|
{
|
||||||
BOOL res = FALSE;
|
BOOL res = FALSE;
|
||||||
|
|
||||||
NOTIFYICONDATA nid;
|
NOTIFYICONDATA tnid = {sizeof(NOTIFYICONDATA)};
|
||||||
memset(&nid, 0, sizeof(NOTIFYICONDATA));
|
tnid.hWnd = m_Window;
|
||||||
|
tnid.uID = IDI_TRAY;
|
||||||
nid.hWnd = m_Window;
|
tnid.uFlags = NIF_INFO;
|
||||||
nid.uID = IDI_TRAY;
|
tnid.uTimeout = 30000;
|
||||||
nid.cbSize=sizeof(NOTIFYICONDATA);
|
tnid.dwInfoFlags = 4; // NIIF_USER;
|
||||||
nid.uFlags = NIF_INFO;
|
tnid.hIcon = LoadIcon(m_Instance, MAKEINTRESOURCE(IDI_TRAY));
|
||||||
nid.uTimeout = 30000;
|
wcscpy(tnid.szInfo, L"There aren't any configs active at the moment. Open the context menu from Rainmeter's tray icon and select a config you want to use.");
|
||||||
nid.dwInfoFlags = 4; // NIIF_USER;
|
wcscpy(tnid.szInfoTitle, L"Rainmeter");
|
||||||
nid.hIcon = LoadIcon(m_Instance, MAKEINTRESOURCE(IDI_TRAY));
|
res = Shell_NotifyIcon(NIM_MODIFY, &tnid);
|
||||||
wcscpy(nid.szInfo, L"There aren't any configs active at the moment. Open the context menu from Rainmeter's tray icon and select a config you want to use.");
|
|
||||||
wcscpy(nid.szInfoTitle, L"Rainmeter");
|
|
||||||
res = Shell_NotifyIcon(NIM_MODIFY, &nid);
|
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@ -334,7 +327,7 @@ void CTrayWindow::ReadConfig(CConfigParser& parser)
|
|||||||
// Load the bitmaps if defined
|
// Load the bitmaps if defined
|
||||||
if (!imageName.empty())
|
if (!imageName.empty())
|
||||||
{
|
{
|
||||||
imageName = Rainmeter->GetSkinPath() + imageName;
|
imageName.insert(0, Rainmeter->GetSkinPath());
|
||||||
if (imageName.size() > 3)
|
if (imageName.size() > 3)
|
||||||
{
|
{
|
||||||
std::wstring extension = imageName.substr(imageName.size() - 3);
|
std::wstring extension = imageName.substr(imageName.size() - 3);
|
||||||
@ -425,7 +418,7 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
|
|||||||
else if(wParam == ID_CONTEXT_SHOWLOGFILE)
|
else if(wParam == ID_CONTEXT_SHOWLOGFILE)
|
||||||
{
|
{
|
||||||
// Check if the file exists
|
// Check if the file exists
|
||||||
std::wstring log = Rainmeter->GetLogFile();
|
const std::wstring& log = Rainmeter->GetLogFile();
|
||||||
if (_waccess(log.c_str(), 0) != -1)
|
if (_waccess(log.c_str(), 0) != -1)
|
||||||
{
|
{
|
||||||
std::wstring command = Rainmeter->GetLogViewer();
|
std::wstring command = Rainmeter->GetLogViewer();
|
||||||
@ -455,22 +448,21 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
|
|||||||
}
|
}
|
||||||
else if(wParam == ID_CONTEXT_EDITCONFIG)
|
else if(wParam == ID_CONTEXT_EDITCONFIG)
|
||||||
{
|
{
|
||||||
std::wstring command = Rainmeter->GetConfigEditor();
|
std::wstring command = Rainmeter->GetConfigEditor() + L" \"";
|
||||||
command += L" \"";
|
|
||||||
command += Rainmeter->GetIniFile();
|
command += Rainmeter->GetIniFile();
|
||||||
command += L"\"";
|
command += L"\"";
|
||||||
LSExecute(tray->GetWindow(), command.c_str(), SW_SHOWNORMAL);
|
LSExecute(tray->GetWindow(), command.c_str(), SW_SHOWNORMAL);
|
||||||
}
|
}
|
||||||
else if(wParam == ID_CONTEXT_MANAGETHEMES)
|
else if(wParam == ID_CONTEXT_MANAGETHEMES)
|
||||||
{
|
{
|
||||||
std::wstring command = L"\"" + Rainmeter->GetPath();
|
std::wstring command = L"\"" + Rainmeter->GetAddonPath();
|
||||||
command += L"\\Addons\\RainThemes\\RainThemes.exe\"";
|
command += L"RainThemes\\RainThemes.exe\"";
|
||||||
LSExecute(tray->GetWindow(), command.c_str(), SW_SHOWNORMAL);
|
LSExecute(tray->GetWindow(), command.c_str(), SW_SHOWNORMAL);
|
||||||
}
|
}
|
||||||
else if(wParam == ID_CONTEXT_MANAGESKINS)
|
else if(wParam == ID_CONTEXT_MANAGESKINS)
|
||||||
{
|
{
|
||||||
std::wstring command = L"\"" + Rainmeter->GetPath();
|
std::wstring command = L"\"" + Rainmeter->GetAddonPath();
|
||||||
command += L"\\Addons\\RainBrowser\\RainBrowser.exe\"";
|
command += L"RainBrowser\\RainBrowser.exe\"";
|
||||||
LSExecute(tray->GetWindow(), command.c_str(), SW_SHOWNORMAL);
|
LSExecute(tray->GetWindow(), command.c_str(), SW_SHOWNORMAL);
|
||||||
}
|
}
|
||||||
else if(wParam == ID_CONTEXT_QUIT)
|
else if(wParam == ID_CONTEXT_QUIT)
|
||||||
@ -480,8 +472,7 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
|
|||||||
}
|
}
|
||||||
else if(wParam == ID_CONTEXT_OPENSKINSFOLDER)
|
else if(wParam == ID_CONTEXT_OPENSKINSFOLDER)
|
||||||
{
|
{
|
||||||
std::wstring command = L"\"";
|
std::wstring command = L"\"" + Rainmeter->GetSkinPath();
|
||||||
command += Rainmeter->GetSkinPath();
|
|
||||||
command += L"\"";
|
command += L"\"";
|
||||||
LSExecute(tray->GetWindow(), command.c_str(), SW_SHOWNORMAL);
|
LSExecute(tray->GetWindow(), command.c_str(), SW_SHOWNORMAL);
|
||||||
}
|
}
|
||||||
@ -492,8 +483,8 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
|
|||||||
const std::vector<std::wstring>& themes = Rainmeter->GetAllThemes();
|
const std::vector<std::wstring>& themes = Rainmeter->GetAllThemes();
|
||||||
if (pos >= 0 && pos < (int)themes.size())
|
if (pos >= 0 && pos < (int)themes.size())
|
||||||
{
|
{
|
||||||
std::wstring command = L"\"" + Rainmeter->GetPath();
|
std::wstring command = L"\"" + Rainmeter->GetAddonPath();
|
||||||
command += L"\\Addons\\RainThemes\\RainThemes.exe\" /load \"";
|
command += L"RainThemes\\RainThemes.exe\" /load \"";
|
||||||
command += themes[pos];
|
command += themes[pos];
|
||||||
command += L"\"";
|
command += L"\"";
|
||||||
LSExecute(tray->GetWindow(), command.c_str(), SW_SHOWNORMAL);
|
LSExecute(tray->GetWindow(), command.c_str(), SW_SHOWNORMAL);
|
||||||
@ -607,11 +598,11 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
|
|||||||
case WM_QUERY_RAINMETER:
|
case WM_QUERY_RAINMETER:
|
||||||
if (Rainmeter && IsWindow((HWND)lParam))
|
if (Rainmeter && IsWindow((HWND)lParam))
|
||||||
{
|
{
|
||||||
|
COPYDATASTRUCT cds;
|
||||||
|
|
||||||
if(wParam == RAINMETER_QUERY_ID_SKINS_PATH)
|
if(wParam == RAINMETER_QUERY_ID_SKINS_PATH)
|
||||||
{
|
{
|
||||||
std::wstring path = Rainmeter->GetSkinPath();
|
const std::wstring& path = Rainmeter->GetSkinPath();
|
||||||
|
|
||||||
COPYDATASTRUCT cds;
|
|
||||||
|
|
||||||
cds.dwData = RAINMETER_QUERY_ID_SKINS_PATH;
|
cds.dwData = RAINMETER_QUERY_ID_SKINS_PATH;
|
||||||
cds.cbData = (path.size() + 1) * sizeof(wchar_t);
|
cds.cbData = (path.size() + 1) * sizeof(wchar_t);
|
||||||
@ -625,8 +616,6 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
|
|||||||
{
|
{
|
||||||
std::wstring path = Rainmeter->GetSettingsPath();
|
std::wstring path = Rainmeter->GetSettingsPath();
|
||||||
|
|
||||||
COPYDATASTRUCT cds;
|
|
||||||
|
|
||||||
cds.dwData = RAINMETER_QUERY_ID_SETTINGS_PATH;
|
cds.dwData = RAINMETER_QUERY_ID_SETTINGS_PATH;
|
||||||
cds.cbData = (path.size() + 1) * sizeof(wchar_t);
|
cds.cbData = (path.size() + 1) * sizeof(wchar_t);
|
||||||
cds.lpData = (LPVOID) path.c_str();
|
cds.lpData = (LPVOID) path.c_str();
|
||||||
@ -637,9 +626,7 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
|
|||||||
}
|
}
|
||||||
else if(wParam == RAINMETER_QUERY_ID_PLUGINS_PATH)
|
else if(wParam == RAINMETER_QUERY_ID_PLUGINS_PATH)
|
||||||
{
|
{
|
||||||
std::wstring path = Rainmeter->GetPluginPath();
|
const std::wstring& path = Rainmeter->GetPluginPath();
|
||||||
|
|
||||||
COPYDATASTRUCT cds;
|
|
||||||
|
|
||||||
cds.dwData = RAINMETER_QUERY_ID_PLUGINS_PATH;
|
cds.dwData = RAINMETER_QUERY_ID_PLUGINS_PATH;
|
||||||
cds.cbData = (path.size() + 1) * sizeof(wchar_t);
|
cds.cbData = (path.size() + 1) * sizeof(wchar_t);
|
||||||
@ -651,9 +638,7 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
|
|||||||
}
|
}
|
||||||
else if(wParam == RAINMETER_QUERY_ID_PROGRAM_PATH)
|
else if(wParam == RAINMETER_QUERY_ID_PROGRAM_PATH)
|
||||||
{
|
{
|
||||||
std::wstring path = Rainmeter->GetPath();
|
const std::wstring& path = Rainmeter->GetPath();
|
||||||
|
|
||||||
COPYDATASTRUCT cds;
|
|
||||||
|
|
||||||
cds.dwData = RAINMETER_QUERY_ID_PROGRAM_PATH;
|
cds.dwData = RAINMETER_QUERY_ID_PROGRAM_PATH;
|
||||||
cds.cbData = (path.size() + 1) * sizeof(wchar_t);
|
cds.cbData = (path.size() + 1) * sizeof(wchar_t);
|
||||||
@ -665,9 +650,7 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
|
|||||||
}
|
}
|
||||||
else if(wParam == RAINMETER_QUERY_ID_LOG_PATH)
|
else if(wParam == RAINMETER_QUERY_ID_LOG_PATH)
|
||||||
{
|
{
|
||||||
std::wstring path = Rainmeter->GetLogFile();
|
const std::wstring& path = Rainmeter->GetLogFile();
|
||||||
|
|
||||||
COPYDATASTRUCT cds;
|
|
||||||
|
|
||||||
cds.dwData = RAINMETER_QUERY_ID_LOG_PATH;
|
cds.dwData = RAINMETER_QUERY_ID_LOG_PATH;
|
||||||
cds.cbData = (path.size() + 1) * sizeof(wchar_t);
|
cds.cbData = (path.size() + 1) * sizeof(wchar_t);
|
||||||
@ -679,9 +662,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)
|
||||||
{
|
{
|
||||||
std::wstring editor = Rainmeter->GetConfigEditor();
|
const std::wstring& editor = Rainmeter->GetConfigEditor();
|
||||||
|
|
||||||
COPYDATASTRUCT cds;
|
|
||||||
|
|
||||||
cds.dwData = RAINMETER_QUERY_ID_CONFIG_EDITOR;
|
cds.dwData = RAINMETER_QUERY_ID_CONFIG_EDITOR;
|
||||||
cds.cbData = (editor.size() + 1) * sizeof(wchar_t);
|
cds.cbData = (editor.size() + 1) * sizeof(wchar_t);
|
||||||
@ -695,8 +676,6 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
|
|||||||
{
|
{
|
||||||
std::wstring commandline = Rainmeter->GetCommandLine();
|
std::wstring commandline = Rainmeter->GetCommandLine();
|
||||||
|
|
||||||
COPYDATASTRUCT cds;
|
|
||||||
|
|
||||||
cds.dwData = RAINMETER_QUERY_ID_COMMAND_LINE;
|
cds.dwData = RAINMETER_QUERY_ID_COMMAND_LINE;
|
||||||
cds.cbData = (commandline.size() + 1) * sizeof(wchar_t);
|
cds.cbData = (commandline.size() + 1) * sizeof(wchar_t);
|
||||||
cds.lpData = (LPVOID) commandline.c_str();
|
cds.lpData = (LPVOID) commandline.c_str();
|
||||||
@ -723,9 +702,7 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
|
|||||||
}
|
}
|
||||||
else if(wParam == RAINMETER_QUERY_ID_STATS_DATE)
|
else if(wParam == RAINMETER_QUERY_ID_STATS_DATE)
|
||||||
{
|
{
|
||||||
std::wstring date = Rainmeter->GetStatsDate();
|
const std::wstring& date = Rainmeter->GetStatsDate();
|
||||||
|
|
||||||
COPYDATASTRUCT cds;
|
|
||||||
|
|
||||||
cds.dwData = RAINMETER_QUERY_ID_STATS_DATE;
|
cds.dwData = RAINMETER_QUERY_ID_STATS_DATE;
|
||||||
cds.cbData = (date.size() + 1) * sizeof(wchar_t);
|
cds.cbData = (date.size() + 1) * sizeof(wchar_t);
|
||||||
@ -737,9 +714,7 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
|
|||||||
}
|
}
|
||||||
else if(wParam == RAINMETER_QUERY_ID_TRAY_EX_L)
|
else if(wParam == RAINMETER_QUERY_ID_TRAY_EX_L)
|
||||||
{
|
{
|
||||||
std::wstring tray = Rainmeter->GetTrayExecuteL();
|
const std::wstring& tray = Rainmeter->GetTrayExecuteL();
|
||||||
|
|
||||||
COPYDATASTRUCT cds;
|
|
||||||
|
|
||||||
cds.dwData = RAINMETER_QUERY_ID_TRAY_EX_L;
|
cds.dwData = RAINMETER_QUERY_ID_TRAY_EX_L;
|
||||||
cds.cbData = (tray.size() + 1) * sizeof(wchar_t);
|
cds.cbData = (tray.size() + 1) * sizeof(wchar_t);
|
||||||
@ -751,9 +726,7 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
|
|||||||
}
|
}
|
||||||
else if(wParam == RAINMETER_QUERY_ID_TRAY_EX_R)
|
else if(wParam == RAINMETER_QUERY_ID_TRAY_EX_R)
|
||||||
{
|
{
|
||||||
std::wstring tray = Rainmeter->GetTrayExecuteR();
|
const std::wstring& tray = Rainmeter->GetTrayExecuteR();
|
||||||
|
|
||||||
COPYDATASTRUCT cds;
|
|
||||||
|
|
||||||
cds.dwData = RAINMETER_QUERY_ID_TRAY_EX_R;
|
cds.dwData = RAINMETER_QUERY_ID_TRAY_EX_R;
|
||||||
cds.cbData = (tray.size() + 1) * sizeof(wchar_t);
|
cds.cbData = (tray.size() + 1) * sizeof(wchar_t);
|
||||||
@ -765,9 +738,7 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
|
|||||||
}
|
}
|
||||||
else if(wParam == RAINMETER_QUERY_ID_TRAY_EX_M)
|
else if(wParam == RAINMETER_QUERY_ID_TRAY_EX_M)
|
||||||
{
|
{
|
||||||
std::wstring tray = Rainmeter->GetTrayExecuteM();
|
const std::wstring& tray = Rainmeter->GetTrayExecuteM();
|
||||||
|
|
||||||
COPYDATASTRUCT cds;
|
|
||||||
|
|
||||||
cds.dwData = RAINMETER_QUERY_ID_TRAY_EX_M;
|
cds.dwData = RAINMETER_QUERY_ID_TRAY_EX_M;
|
||||||
cds.cbData = (tray.size() + 1) * sizeof(wchar_t);
|
cds.cbData = (tray.size() + 1) * sizeof(wchar_t);
|
||||||
@ -779,9 +750,7 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
|
|||||||
}
|
}
|
||||||
else if(wParam == RAINMETER_QUERY_ID_TRAY_EX_DL)
|
else if(wParam == RAINMETER_QUERY_ID_TRAY_EX_DL)
|
||||||
{
|
{
|
||||||
std::wstring tray = Rainmeter->GetTrayExecuteDL();
|
const std::wstring& tray = Rainmeter->GetTrayExecuteDL();
|
||||||
|
|
||||||
COPYDATASTRUCT cds;
|
|
||||||
|
|
||||||
cds.dwData = RAINMETER_QUERY_ID_TRAY_EX_DL;
|
cds.dwData = RAINMETER_QUERY_ID_TRAY_EX_DL;
|
||||||
cds.cbData = (tray.size() + 1) * sizeof(wchar_t);
|
cds.cbData = (tray.size() + 1) * sizeof(wchar_t);
|
||||||
@ -793,9 +762,7 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
|
|||||||
}
|
}
|
||||||
else if(wParam == RAINMETER_QUERY_ID_TRAY_EX_DR)
|
else if(wParam == RAINMETER_QUERY_ID_TRAY_EX_DR)
|
||||||
{
|
{
|
||||||
std::wstring tray = Rainmeter->GetTrayExecuteDR();
|
const std::wstring& tray = Rainmeter->GetTrayExecuteDR();
|
||||||
|
|
||||||
COPYDATASTRUCT cds;
|
|
||||||
|
|
||||||
cds.dwData = RAINMETER_QUERY_ID_TRAY_EX_DR;
|
cds.dwData = RAINMETER_QUERY_ID_TRAY_EX_DR;
|
||||||
cds.cbData = (tray.size() + 1) * sizeof(wchar_t);
|
cds.cbData = (tray.size() + 1) * sizeof(wchar_t);
|
||||||
@ -807,9 +774,7 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
|
|||||||
}
|
}
|
||||||
else if(wParam == RAINMETER_QUERY_ID_TRAY_EX_DM)
|
else if(wParam == RAINMETER_QUERY_ID_TRAY_EX_DM)
|
||||||
{
|
{
|
||||||
std::wstring tray = Rainmeter->GetTrayExecuteDM();
|
const std::wstring& tray = Rainmeter->GetTrayExecuteDM();
|
||||||
|
|
||||||
COPYDATASTRUCT cds;
|
|
||||||
|
|
||||||
cds.dwData = RAINMETER_QUERY_ID_TRAY_EX_DM;
|
cds.dwData = RAINMETER_QUERY_ID_TRAY_EX_DM;
|
||||||
cds.cbData = (tray.size() + 1) * sizeof(wchar_t);
|
cds.cbData = (tray.size() + 1) * sizeof(wchar_t);
|
||||||
|
Loading…
Reference in New Issue
Block a user