mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Cosmetics.
This commit is contained in:
parent
7767300379
commit
ad2a986e88
@ -746,19 +746,18 @@ double CConfigParser::ReadFormula(LPCTSTR section, LPCTSTR key, double defValue)
|
||||
}
|
||||
|
||||
// Returns true if the formula was read successfully, false for failure.
|
||||
// Pass a pointer to a double.
|
||||
bool CConfigParser::ParseFormula(const std::wstring& result, double* resultValue)
|
||||
bool CConfigParser::ParseFormula(const std::wstring& formula, double* resultValue)
|
||||
{
|
||||
// Formulas must be surrounded by parenthesis
|
||||
if (!result.empty() && result[0] == L'(' && result[result.size() - 1] == L')')
|
||||
if (!formula.empty() && formula.front() == L'(' && formula.back() == L')')
|
||||
{
|
||||
const WCHAR* errMsg = MathParser::CheckedParse(result.c_str(), resultValue);
|
||||
const WCHAR* errMsg = MathParser::CheckedParse(formula.c_str(), resultValue);
|
||||
if (errMsg != NULL)
|
||||
{
|
||||
std::wstring error = L"ParseFormula: ";
|
||||
error += errMsg;
|
||||
error += L": ";
|
||||
error += result;
|
||||
error += formula;
|
||||
Log(LOG_ERROR, error.c_str());
|
||||
return false;
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ public:
|
||||
RECT ReadRECT(LPCTSTR section, LPCTSTR key, const RECT& defValue);
|
||||
std::vector<Gdiplus::REAL> ReadFloats(LPCTSTR section, LPCTSTR key);
|
||||
|
||||
bool ParseFormula(const std::wstring& result, double* resultValue);
|
||||
bool ParseFormula(const std::wstring& formula, double* resultValue);
|
||||
|
||||
const std::wstring& GetFilename() { return m_Filename; }
|
||||
const std::list<std::wstring>& GetSections() { return m_Sections; }
|
||||
|
@ -839,8 +839,8 @@ void CMeterWindow::RunBang(BANGCOMMAND bang, const std::vector<std::wstring>& ar
|
||||
int y = m_Parser.ParseFormula(args[1], &value) ? (int)value : _wtoi(args[1].c_str());
|
||||
|
||||
MoveWindow(x, y);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case BANG_ZPOS:
|
||||
SetWindowZPosition((ZPOSITION)_wtoi(args[0].c_str()));
|
||||
@ -891,8 +891,8 @@ void CMeterWindow::RunBang(BANGCOMMAND bang, const std::vector<std::wstring>& ar
|
||||
int y = m_Parser.ParseFormula(args[1], &value) ? (int)value : _wtoi(args[1].c_str());
|
||||
|
||||
MoveMeter(args[2], x, y);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case BANG_COMMANDMEASURE:
|
||||
{
|
||||
|
@ -29,8 +29,7 @@ inline CMeasure* GetSelf(lua_State* L)
|
||||
static int GetName(lua_State* L)
|
||||
{
|
||||
CMeasure* self = GetSelf(L);
|
||||
const WCHAR* val = (const WCHAR*)self->GetName();
|
||||
LuaManager::PushWide(L, val);
|
||||
LuaManager::PushWide(L, self->GetName());
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -93,8 +92,7 @@ static int Enable(lua_State* L)
|
||||
static int GetValue(lua_State* L)
|
||||
{
|
||||
CMeasure* self = GetSelf(L);
|
||||
double val = (double)self->GetValue();
|
||||
lua_pushnumber(L, (lua_Number)val);
|
||||
lua_pushnumber(L, self->GetValue());
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -102,8 +100,7 @@ static int GetValue(lua_State* L)
|
||||
static int GetRelativeValue(lua_State* L)
|
||||
{
|
||||
CMeasure* self = GetSelf(L);
|
||||
double val = (double)self->GetRelativeValue();
|
||||
lua_pushnumber(L, (lua_Number)val);
|
||||
lua_pushnumber(L, self->GetRelativeValue());
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -111,8 +108,7 @@ static int GetRelativeValue(lua_State* L)
|
||||
static int GetValueRange(lua_State* L)
|
||||
{
|
||||
CMeasure* self = GetSelf(L);
|
||||
double val = (double)self->GetValueRange();
|
||||
lua_pushnumber(L, (lua_Number)val);
|
||||
lua_pushnumber(L, self->GetValueRange());
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -120,8 +116,7 @@ static int GetValueRange(lua_State* L)
|
||||
static int GetMinValue(lua_State* L)
|
||||
{
|
||||
CMeasure* self = GetSelf(L);
|
||||
double val = (double)self->GetMinValue();
|
||||
lua_pushnumber(L, (lua_Number)val);
|
||||
lua_pushnumber(L, self->GetMinValue());
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -129,8 +124,7 @@ static int GetMinValue(lua_State* L)
|
||||
static int GetMaxValue(lua_State* L)
|
||||
{
|
||||
CMeasure* self = GetSelf(L);
|
||||
double val = (double)self->GetMaxValue();
|
||||
lua_pushnumber(L, (lua_Number)val);
|
||||
lua_pushnumber(L, self->GetMaxValue());
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -29,8 +29,7 @@ inline CMeter* GetSelf(lua_State* L)
|
||||
static int GetName(lua_State* L)
|
||||
{
|
||||
CMeter* self = GetSelf(L);
|
||||
const WCHAR* val = (const WCHAR*)self->GetName();
|
||||
LuaManager::PushWide(L, val);
|
||||
LuaManager::PushWide(L, self->GetName());
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -138,7 +137,6 @@ static int Show(lua_State* L)
|
||||
static int SetText(lua_State* L)
|
||||
{
|
||||
CMeter* self = GetSelf(L);
|
||||
|
||||
if (CMeterString* stringMeter = dynamic_cast<CMeterString*>(self))
|
||||
{
|
||||
std::wstring str = LuaManager::ToWide(L, 2);
|
||||
|
@ -169,7 +169,7 @@ static int GetY(lua_State* L)
|
||||
|
||||
static int MakePathAbsolute(lua_State* L)
|
||||
{
|
||||
CMeterWindow* self = *(CMeterWindow**)lua_touserdata(L, 1);
|
||||
CMeterWindow* self = GetSelf(L);
|
||||
std::wstring path = LuaManager::ToWide(L, 2);
|
||||
self->MakePathAbsolute(path);
|
||||
LuaManager::PushWide(L, path.c_str());
|
||||
|
Loading…
Reference in New Issue
Block a user