mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Cosmetic changes.
This commit is contained in:
parent
e15fff8946
commit
b65b26c2b7
@ -132,7 +132,7 @@ LPCWSTR PluginBridge(LPCWSTR command, LPCWSTR data)
|
||||
|
||||
if (_wcsicmp(command, L"GetConfig") == 0)
|
||||
{
|
||||
CMeterWindow *meterWindow = Rainmeter->GetMeterWindowByINI(data);
|
||||
CMeterWindow* meterWindow = Rainmeter->GetMeterWindowByINI(data);
|
||||
if (meterWindow)
|
||||
{
|
||||
g_Buffer = L"\"";
|
||||
@ -151,7 +151,7 @@ LPCWSTR PluginBridge(LPCWSTR command, LPCWSTR data)
|
||||
{
|
||||
const std::wstring& config = subStrings[0];
|
||||
|
||||
CMeterWindow *meterWindow = Rainmeter->GetMeterWindow(config);
|
||||
CMeterWindow* meterWindow = Rainmeter->GetMeterWindow(config);
|
||||
if (meterWindow)
|
||||
{
|
||||
WCHAR buf1[64];
|
||||
@ -171,7 +171,7 @@ LPCWSTR PluginBridge(LPCWSTR command, LPCWSTR data)
|
||||
{
|
||||
const std::wstring& config = subStrings[0];
|
||||
|
||||
CMeterWindow *meterWindow = Rainmeter->GetMeterWindow(config);
|
||||
CMeterWindow* meterWindow = Rainmeter->GetMeterWindow(config);
|
||||
if (meterWindow)
|
||||
{
|
||||
const std::wstring& variable = subStrings[1];
|
||||
@ -187,20 +187,15 @@ LPCWSTR PluginBridge(LPCWSTR command, LPCWSTR data)
|
||||
}
|
||||
else if (_wcsicmp(command, L"SetVariable") == 0)
|
||||
{
|
||||
const WCHAR* pos = wcschr(data, L' ');
|
||||
if (pos)
|
||||
{
|
||||
std::wstring config(data + 1, pos - 1);
|
||||
std::vector<std::wstring> subStrings = CRainmeter::ParseString(pos);
|
||||
std::vector<std::wstring> subStrings = CRainmeter::ParseString(data);
|
||||
|
||||
if (subStrings.size() == 2)
|
||||
if (subStrings.size() == 3)
|
||||
{
|
||||
CMeterWindow* meterWindow = Rainmeter->GetMeterWindow(subStrings[0]);
|
||||
if (meterWindow)
|
||||
{
|
||||
CMeterWindow *meterWindow = Rainmeter->GetMeterWindow(config);
|
||||
if (meterWindow)
|
||||
{
|
||||
meterWindow->RunBang(BANG_SETVARIABLE, subStrings);
|
||||
return L"success";
|
||||
}
|
||||
meterWindow->SetVariable(subStrings[1], subStrings[2]);
|
||||
return L"success";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -843,9 +843,7 @@ void CMeterWindow::RunBang(BANGCOMMAND bang, const std::vector<std::wstring>& ar
|
||||
break;
|
||||
|
||||
case BANG_MOVE:
|
||||
{
|
||||
MoveWindow(_wtoi(args[0].c_str()), _wtoi(args[1].c_str()));
|
||||
}
|
||||
MoveWindow(_wtoi(args[0].c_str()), _wtoi(args[1].c_str()));
|
||||
break;
|
||||
|
||||
case BANG_ZPOS:
|
||||
@ -950,27 +948,7 @@ void CMeterWindow::RunBang(BANGCOMMAND bang, const std::vector<std::wstring>& ar
|
||||
break;
|
||||
|
||||
case BANG_SETVARIABLE:
|
||||
{
|
||||
const std::wstring& variable = args[0];
|
||||
const std::wstring& value = args[1];
|
||||
|
||||
// Formula read fine
|
||||
double result;
|
||||
if (m_Parser.ParseFormula(value, &result))
|
||||
{
|
||||
WCHAR buffer[256];
|
||||
int len = _snwprintf_s(buffer, _TRUNCATE, L"%.5f", result);
|
||||
CMeasure::RemoveTrailingZero(buffer, len);
|
||||
|
||||
const std::wstring& resultString = buffer;
|
||||
|
||||
m_Parser.SetVariable(variable, resultString);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Parser.SetVariable(variable, value);
|
||||
}
|
||||
}
|
||||
SetVariable(args[0], args[1]);
|
||||
break;
|
||||
|
||||
case BANG_SETOPTION:
|
||||
@ -1384,6 +1362,31 @@ 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());
|
||||
}
|
||||
|
||||
/*
|
||||
** SetVariable
|
||||
**
|
||||
** Sets variable to given value.
|
||||
**
|
||||
*/
|
||||
void CMeterWindow::SetVariable(const std::wstring& variable, const std::wstring& value)
|
||||
{
|
||||
double result;
|
||||
if (m_Parser.ParseFormula(value, &result))
|
||||
{
|
||||
WCHAR buffer[256];
|
||||
int len = _snwprintf_s(buffer, _TRUNCATE, L"%.5f", result);
|
||||
CMeasure::RemoveTrailingZero(buffer, len);
|
||||
|
||||
const std::wstring& resultString = buffer;
|
||||
|
||||
m_Parser.SetVariable(variable, resultString);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Parser.SetVariable(variable, value);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** SetOption
|
||||
**
|
||||
|
@ -181,6 +181,7 @@ public:
|
||||
void UpdateMeasure(const std::wstring& name, bool group = false);
|
||||
void Refresh(bool init, bool all = false);
|
||||
void Redraw();
|
||||
void SetVariable(const std::wstring& variable, const std::wstring& value);
|
||||
void SetOption(const std::wstring& section, const std::wstring& option, const std::wstring& value, bool group);
|
||||
|
||||
void SetMouseLeaveEvent(bool cancel);
|
||||
|
Loading…
Reference in New Issue
Block a user