mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
- Added !SetOption/!SetOptionGroup bangs.
- Script: Added GetOption() function
This commit is contained in:
parent
23f4a31bf0
commit
822c10060a
@ -1195,6 +1195,26 @@ void CConfigParser::SetValue(const std::wstring& strSection, const std::wstring&
|
|||||||
m_Values[StrToLower(strTmp)] = strValue;
|
m_Values[StrToLower(strTmp)] = strValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//==============================================================================
|
||||||
|
/**
|
||||||
|
** Deletes the value for the key under the given section.
|
||||||
|
**
|
||||||
|
** \param strSection The name of the section.
|
||||||
|
** \param strKey The name of the key.
|
||||||
|
** \param strValue The value for the key.
|
||||||
|
*/
|
||||||
|
void CConfigParser::DeleteValue(const std::wstring& strSection, const std::wstring& strKey)
|
||||||
|
{
|
||||||
|
std::wstring strTmp = strSection + L"::";
|
||||||
|
strTmp += strKey;
|
||||||
|
|
||||||
|
std::unordered_map<std::wstring, std::wstring>::iterator i = m_Values.find(StrToLower(strTmp));
|
||||||
|
if (i != m_Values.end())
|
||||||
|
{
|
||||||
|
m_Values.erase(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
/**
|
/**
|
||||||
** Returns the value for the key under the given section.
|
** Returns the value for the key under the given section.
|
||||||
|
@ -47,6 +47,10 @@ public:
|
|||||||
void SetBuiltInVariable(const std::wstring& strVariable, const std::wstring& strValue) { SetVariable(m_BuiltInVariables, strVariable, strValue); }
|
void SetBuiltInVariable(const std::wstring& strVariable, const std::wstring& strValue) { SetVariable(m_BuiltInVariables, strVariable, strValue); }
|
||||||
bool GetVariable(const std::wstring& strVariable, std::wstring& strValue);
|
bool GetVariable(const std::wstring& strVariable, std::wstring& strValue);
|
||||||
|
|
||||||
|
const std::wstring& GetValue(const std::wstring& strSection, const std::wstring& strKey, const std::wstring& strDefault);
|
||||||
|
void SetValue(const std::wstring& strSection, const std::wstring& strKey, const std::wstring& strValue);
|
||||||
|
void DeleteValue(const std::wstring& strSection, const std::wstring& strKey);
|
||||||
|
|
||||||
void SetStyleTemplate(const std::wstring& strStyle) { m_StyleTemplate = Tokenize(strStyle, L"|"); }
|
void SetStyleTemplate(const std::wstring& strStyle) { m_StyleTemplate = Tokenize(strStyle, L"|"); }
|
||||||
void ClearStyleTemplate() { m_StyleTemplate.clear(); }
|
void ClearStyleTemplate() { m_StyleTemplate.clear(); }
|
||||||
|
|
||||||
@ -94,8 +98,6 @@ private:
|
|||||||
CMeasure* GetMeasure(const std::wstring& name);
|
CMeasure* GetMeasure(const std::wstring& name);
|
||||||
|
|
||||||
void ReadIniFile(const std::vector<std::wstring>& iniFileMappings, const std::wstring& strFileName, LPCTSTR config = NULL, int depth = 0);
|
void ReadIniFile(const std::vector<std::wstring>& iniFileMappings, const std::wstring& strFileName, LPCTSTR config = NULL, int depth = 0);
|
||||||
void SetValue(const std::wstring& strSection, const std::wstring& strKey, const std::wstring& strValue);
|
|
||||||
const std::wstring& GetValue(const std::wstring& strSection, const std::wstring& strKey, const std::wstring& strDefault);
|
|
||||||
|
|
||||||
void SetAutoSelectedMonitorVariables(CMeterWindow* meterWindow);
|
void SetAutoSelectedMonitorVariables(CMeterWindow* meterWindow);
|
||||||
|
|
||||||
|
@ -63,6 +63,7 @@ public:
|
|||||||
bool IsDisabled() { return m_Disabled; }
|
bool IsDisabled() { return m_Disabled; }
|
||||||
|
|
||||||
bool HasDynamicVariables() { return m_DynamicVariables; }
|
bool HasDynamicVariables() { return m_DynamicVariables; }
|
||||||
|
void SetDynamicVariables(bool b) { m_DynamicVariables = b; }
|
||||||
|
|
||||||
virtual void ExecuteBang(const WCHAR* args);
|
virtual void ExecuteBang(const WCHAR* args);
|
||||||
|
|
||||||
@ -80,6 +81,8 @@ public:
|
|||||||
static void GetScaledValue(AUTOSCALE autoScale, int decimals, double theValue, WCHAR* buffer, size_t sizeInWords);
|
static void GetScaledValue(AUTOSCALE autoScale, int decimals, double theValue, WCHAR* buffer, size_t sizeInWords);
|
||||||
static void RemoveTrailingZero(WCHAR* str, int strLen);
|
static void RemoveTrailingZero(WCHAR* str, int strLen);
|
||||||
|
|
||||||
|
CMeterWindow* GetMeterWindow() { return m_MeterWindow; }
|
||||||
|
|
||||||
static CMeasure* Create(const WCHAR* measure, CMeterWindow* meterWindow, const WCHAR* name);
|
static CMeasure* Create(const WCHAR* measure, CMeterWindow* meterWindow, const WCHAR* name);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -173,10 +173,6 @@ void CMeasureScript::ReadConfig(CConfigParser& parser, const WCHAR* section)
|
|||||||
tolua_pushusertype(L, m_MeterWindow, "CMeterWindow");
|
tolua_pushusertype(L, m_MeterWindow, "CMeterWindow");
|
||||||
lua_settable(L, -3);
|
lua_settable(L, -3);
|
||||||
|
|
||||||
//lua_pushstring(L, "RAINMETER");
|
|
||||||
//tolua_pushusertype(L, m_MeterWindow->GetMainObject(), "CRainmeter");
|
|
||||||
//lua_settable(L, -3);
|
|
||||||
|
|
||||||
// Look in the properties table for values to read from the section.
|
// Look in the properties table for values to read from the section.
|
||||||
lua_getfield(L, -1, "PROPERTIES");
|
lua_getfield(L, -1, "PROPERTIES");
|
||||||
if (lua_isnil(L, -1) == 0)
|
if (lua_isnil(L, -1) == 0)
|
||||||
|
@ -46,6 +46,7 @@ public:
|
|||||||
virtual bool HasActiveTransition() { return false; }
|
virtual bool HasActiveTransition() { return false; }
|
||||||
|
|
||||||
bool HasDynamicVariables() { return m_DynamicVariables; }
|
bool HasDynamicVariables() { return m_DynamicVariables; }
|
||||||
|
void SetDynamicVariables(bool b) { m_DynamicVariables = b; }
|
||||||
|
|
||||||
virtual int GetW() { return m_Hidden ? 0 : m_W; }
|
virtual int GetW() { return m_Hidden ? 0 : m_W; }
|
||||||
virtual int GetH() { return m_Hidden ? 0 : m_H; }
|
virtual int GetH() { return m_Hidden ? 0 : m_H; }
|
||||||
@ -98,6 +99,8 @@ public:
|
|||||||
int GetUpdateCounter() { return m_UpdateCounter; }
|
int GetUpdateCounter() { return m_UpdateCounter; }
|
||||||
int GetUpdateDivider() { return m_UpdateDivider; }
|
int GetUpdateDivider() { return m_UpdateDivider; }
|
||||||
|
|
||||||
|
CMeterWindow* GetMeterWindow() { return m_MeterWindow; }
|
||||||
|
|
||||||
static CMeter* Create(const WCHAR* meter, CMeterWindow* meterWindow, const WCHAR* name);
|
static CMeter* Create(const WCHAR* meter, CMeterWindow* meterWindow, const WCHAR* name);
|
||||||
|
|
||||||
static void DrawBevel(Gdiplus::Graphics& graphics, const Gdiplus::Rect& rect, const Gdiplus::Pen& light, const Gdiplus::Pen& dark);
|
static void DrawBevel(Gdiplus::Graphics& graphics, const Gdiplus::Rect& rect, const Gdiplus::Pen& light, const Gdiplus::Pen& dark);
|
||||||
|
@ -1026,6 +1026,14 @@ void CMeterWindow::RunBang(BANGCOMMAND bang, const WCHAR* arg)
|
|||||||
Log(LOG_ERROR, L"Unable to parse parameters for !SetVariable");
|
Log(LOG_ERROR, L"Unable to parse parameters for !SetVariable");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case BANG_SETOPTION:
|
||||||
|
SetOption(arg, false);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case BANG_SETOPTIONGROUP:
|
||||||
|
SetOption(arg, true);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1435,6 +1443,104 @@ void CMeterWindow::UpdateMeasure(const WCHAR* name, bool group)
|
|||||||
if (!group) LogWithArgs(LOG_NOTICE, L"Unable to update the measure %s (there is no such thing in %s)", name, m_SkinName.c_str());
|
if (!group) LogWithArgs(LOG_NOTICE, L"Unable to update the measure %s (there is no such thing in %s)", name, m_SkinName.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
** SetOption
|
||||||
|
**
|
||||||
|
** Changes the property of a meter or measure.
|
||||||
|
**
|
||||||
|
*/
|
||||||
|
void CMeterWindow::SetOption(const WCHAR* arg, bool group)
|
||||||
|
{
|
||||||
|
const WCHAR* pos = wcschr(arg, L' ');
|
||||||
|
if (pos != NULL)
|
||||||
|
{
|
||||||
|
const WCHAR* pos2 = wcschr(pos + 1, L' ');
|
||||||
|
std::wstring section(arg, pos - arg);
|
||||||
|
std::wstring option(pos + 1, pos2);
|
||||||
|
std::wstring value(pos2 + 1);
|
||||||
|
|
||||||
|
if (group)
|
||||||
|
{
|
||||||
|
for (std::list<CMeter*>::const_iterator i = m_Meters.begin(); i != m_Meters.end(); ++i)
|
||||||
|
{
|
||||||
|
if ((*i)->BelongsToGroup(section))
|
||||||
|
{
|
||||||
|
(*i)->SetDynamicVariables(true);
|
||||||
|
|
||||||
|
if (value.empty())
|
||||||
|
{
|
||||||
|
GetParser().DeleteValue((*i)->GetName(), option);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GetParser().SetValue((*i)->GetName(), option, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (std::list<CMeasure*>::const_iterator i = m_Measures.begin(); i != m_Measures.end(); ++i)
|
||||||
|
{
|
||||||
|
if ((*i)->BelongsToGroup(section))
|
||||||
|
{
|
||||||
|
(*i)->SetDynamicVariables(true);
|
||||||
|
|
||||||
|
if (value.empty())
|
||||||
|
{
|
||||||
|
GetParser().DeleteValue(section, option);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GetParser().SetValue(section, option, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CMeter* meter = GetMeter(section);
|
||||||
|
if (meter)
|
||||||
|
{
|
||||||
|
// Force DynamicVariables temporarily (it will reset back to original setting in ReadConfig())
|
||||||
|
meter->SetDynamicVariables(true);
|
||||||
|
|
||||||
|
if (value.empty())
|
||||||
|
{
|
||||||
|
GetParser().DeleteValue(section, option);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GetParser().SetValue(section, option, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CMeasure* measure = GetMeasure(section);
|
||||||
|
if (measure)
|
||||||
|
{
|
||||||
|
measure->SetDynamicVariables(true);
|
||||||
|
|
||||||
|
if (value.empty())
|
||||||
|
{
|
||||||
|
GetParser().DeleteValue(section, option);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GetParser().SetValue(section, option, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Is it a style?
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Log(LOG_ERROR, L"Unable to parse parameters for !SetOption");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* WindowToScreen
|
/* WindowToScreen
|
||||||
**
|
**
|
||||||
** Calculates the screen cordinates from the WindowX/Y config
|
** Calculates the screen cordinates from the WindowX/Y config
|
||||||
|
@ -150,7 +150,9 @@ enum BANGCOMMAND
|
|||||||
|
|
||||||
BANG_LSHOOK,
|
BANG_LSHOOK,
|
||||||
BANG_PLUGIN,
|
BANG_PLUGIN,
|
||||||
BANG_SETVARIABLE
|
BANG_SETVARIABLE,
|
||||||
|
BANG_SETOPTION,
|
||||||
|
BANG_SETOPTIONGROUP
|
||||||
};
|
};
|
||||||
|
|
||||||
class CRainmeter;
|
class CRainmeter;
|
||||||
@ -181,6 +183,7 @@ public:
|
|||||||
void UpdateMeasure(const WCHAR* name, bool group = false);
|
void UpdateMeasure(const WCHAR* name, bool group = false);
|
||||||
void Refresh(bool init, bool all = false);
|
void Refresh(bool init, bool all = false);
|
||||||
void Redraw();
|
void Redraw();
|
||||||
|
void SetOption(const WCHAR* name, bool group);
|
||||||
|
|
||||||
void SetMouseLeaveEvent(bool cancel);
|
void SetMouseLeaveEvent(bool cancel);
|
||||||
|
|
||||||
|
@ -856,6 +856,17 @@ void RainmeterSetVariable(HWND, const char* arg)
|
|||||||
BangWithArgs(BANG_SETVARIABLE, ConvertToWide(arg).c_str(), 2);
|
BangWithArgs(BANG_SETVARIABLE, ConvertToWide(arg).c_str(), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
** RainmeterSetOption
|
||||||
|
**
|
||||||
|
** Callback for the !RainmeterSetOption bang
|
||||||
|
**
|
||||||
|
*/
|
||||||
|
void RainmeterSetOption(HWND, const char* arg)
|
||||||
|
{
|
||||||
|
BangWithArgs(BANG_SETOPTION, ConvertToWide(arg).c_str(), 3);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** RainmeterHideGroup
|
** RainmeterHideGroup
|
||||||
**
|
**
|
||||||
@ -1130,6 +1141,16 @@ void RainmeterSetVariableGroup(HWND, const char* arg)
|
|||||||
{
|
{
|
||||||
BangGroupWithArgs(BANG_SETVARIABLE, ConvertToWide(arg).c_str(), 2);
|
BangGroupWithArgs(BANG_SETVARIABLE, ConvertToWide(arg).c_str(), 2);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
** RainmeterSetOptionGroup
|
||||||
|
**
|
||||||
|
** Callback for the !RainmeterSetOptionGroup bang
|
||||||
|
**
|
||||||
|
*/
|
||||||
|
void RainmeterSetOptionGroup(HWND, const char* arg)
|
||||||
|
{
|
||||||
|
BangGroupWithArgs(BANG_SETOPTION, ConvertToWide(arg).c_str(), 3);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** RainmeterLsHook
|
** RainmeterLsHook
|
||||||
@ -2940,6 +2961,10 @@ BOOL CRainmeter::ExecuteBang(const std::wstring& bang, const std::wstring& arg,
|
|||||||
{
|
{
|
||||||
BangWithArgs(BANG_SETVARIABLE, arg.c_str(), 2);
|
BangWithArgs(BANG_SETVARIABLE, arg.c_str(), 2);
|
||||||
}
|
}
|
||||||
|
else if (_wcsicmp(name, L"SetOption") == 0)
|
||||||
|
{
|
||||||
|
BangWithArgs(BANG_SETOPTION, arg.c_str(), 3);
|
||||||
|
}
|
||||||
else if (_wcsicmp(name, L"RefreshGroup") == 0)
|
else if (_wcsicmp(name, L"RefreshGroup") == 0)
|
||||||
{
|
{
|
||||||
BangGroupWithArgs(BANG_REFRESH, arg.c_str(), 0);
|
BangGroupWithArgs(BANG_REFRESH, arg.c_str(), 0);
|
||||||
@ -3040,6 +3065,10 @@ BOOL CRainmeter::ExecuteBang(const std::wstring& bang, const std::wstring& arg,
|
|||||||
{
|
{
|
||||||
BangGroupWithArgs(BANG_SETVARIABLE, arg.c_str(), 2);
|
BangGroupWithArgs(BANG_SETVARIABLE, arg.c_str(), 2);
|
||||||
}
|
}
|
||||||
|
else if (_wcsicmp(name, L"SetOptionGroup") == 0)
|
||||||
|
{
|
||||||
|
BangWithArgs(BANG_SETOPTIONGROUP, arg.c_str(), 3);
|
||||||
|
}
|
||||||
else if (_wcsicmp(name, L"About") == 0)
|
else if (_wcsicmp(name, L"About") == 0)
|
||||||
{
|
{
|
||||||
RainmeterAboutWide();
|
RainmeterAboutWide();
|
||||||
|
@ -73,6 +73,7 @@ void RainmeterSnapEdges(HWND, const char* arg);
|
|||||||
void RainmeterKeepOnScreen(HWND, const char* arg);
|
void RainmeterKeepOnScreen(HWND, const char* arg);
|
||||||
void RainmeterSetTransparency(HWND, const char* arg);
|
void RainmeterSetTransparency(HWND, const char* arg);
|
||||||
void RainmeterSetVariable(HWND, const char* arg);
|
void RainmeterSetVariable(HWND, const char* arg);
|
||||||
|
void RainmeterSetOption(HWND, const char* arg);
|
||||||
|
|
||||||
void RainmeterRefreshGroup(HWND, const char* arg);
|
void RainmeterRefreshGroup(HWND, const char* arg);
|
||||||
void RainmeterRedrawGroup(HWND, const char* arg);
|
void RainmeterRedrawGroup(HWND, const char* arg);
|
||||||
@ -99,6 +100,7 @@ void RainmeterSnapEdgesGroup(HWND, const char* arg);
|
|||||||
void RainmeterKeepOnScreenGroup(HWND, const char* arg);
|
void RainmeterKeepOnScreenGroup(HWND, const char* arg);
|
||||||
void RainmeterSetTransparencyGroup(HWND, const char* arg);
|
void RainmeterSetTransparencyGroup(HWND, const char* arg);
|
||||||
void RainmeterSetVariableGroup(HWND, const char* arg);
|
void RainmeterSetVariableGroup(HWND, const char* arg);
|
||||||
|
void RainmeterSetOptionGroup(HWND, const char* arg);
|
||||||
|
|
||||||
void RainmeterLsHook(HWND, const char* arg);
|
void RainmeterLsHook(HWND, const char* arg);
|
||||||
void RainmeterAbout(HWND, const char* arg);
|
void RainmeterAbout(HWND, const char* arg);
|
||||||
|
@ -43,7 +43,6 @@ void LuaManager::Init()
|
|||||||
RegisterMeasure(c_State);
|
RegisterMeasure(c_State);
|
||||||
RegisterMeter(c_State);
|
RegisterMeter(c_State);
|
||||||
RegisterMeterWindow(c_State);
|
RegisterMeterWindow(c_State);
|
||||||
RegisterRainmeter(c_State);
|
|
||||||
RegisterMeterString(c_State);
|
RegisterMeterString(c_State);
|
||||||
tolua_endmodule(c_State);
|
tolua_endmodule(c_State);
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,6 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
static void RegisterGlobal(lua_State* L);
|
static void RegisterGlobal(lua_State* L);
|
||||||
static void RegisterRainmeter(lua_State* L);
|
|
||||||
static void RegisterGroup(lua_State* L);
|
static void RegisterGroup(lua_State* L);
|
||||||
static void RegisterMeasure(lua_State* L);
|
static void RegisterMeasure(lua_State* L);
|
||||||
static void RegisterMeter(lua_State* L);
|
static void RegisterMeter(lua_State* L);
|
||||||
|
@ -7,7 +7,7 @@ static int Group_BelongsToGroup(lua_State* L)
|
|||||||
CGroup* self = (CGroup*)tolua_tousertype(L, 1, 0);
|
CGroup* self = (CGroup*)tolua_tousertype(L, 1, 0);
|
||||||
const std::wstring group = (const std::wstring)to_wstring(L, 2, 0);
|
const std::wstring group = (const std::wstring)to_wstring(L, 2, 0);
|
||||||
bool val = self->BelongsToGroup(group);
|
bool val = self->BelongsToGroup(group);
|
||||||
tolua_pushboolean(L, val);
|
lua_pushboolean(L, val);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include "../../StdAfx.h"
|
#include "../../StdAfx.h"
|
||||||
#include "../LuaManager.h"
|
#include "../LuaManager.h"
|
||||||
#include "../../Measure.h"
|
#include "../../Measure.h"
|
||||||
|
#include "../../MeterWindow.h"
|
||||||
|
|
||||||
static int Measure_GetName(lua_State* L)
|
static int Measure_GetName(lua_State* L)
|
||||||
{
|
{
|
||||||
@ -11,12 +12,26 @@ static int Measure_GetName(lua_State* L)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int Measure_GetANSIName(lua_State* L)
|
static int Measure_GetOption(lua_State* L)
|
||||||
{
|
{
|
||||||
CMeasure* self = (CMeasure*)tolua_tousertype(L, 1, 0);
|
CMeasure* self = (CMeasure*)tolua_tousertype(L, 1, 0);
|
||||||
const char* val = (const char*)self->GetANSIName();
|
CMeterWindow* meterWindow = self->GetMeterWindow();
|
||||||
tolua_pushstring(L, (const char*)val);
|
CConfigParser& parser = meterWindow->GetParser();
|
||||||
|
|
||||||
|
const char* arg = (const char*)tolua_tostring(L, 2, 0);
|
||||||
|
std::wstring strTmp = ConvertToWide(arg);
|
||||||
|
strTmp = parser.GetValue(self->GetName(), strTmp, L"");
|
||||||
|
|
||||||
|
parser.SetBuiltInVariable(L"CURRENTSECTION", self->GetName()); // Set temporarily
|
||||||
|
parser.ReplaceVariables(strTmp);
|
||||||
|
parser.SetBuiltInVariable(L"CURRENTSECTION", L""); // Reset
|
||||||
|
|
||||||
|
if (self->HasDynamicVariables())
|
||||||
|
{
|
||||||
|
parser.ReplaceMeasures(strTmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
push_wchar(L, strTmp.c_str());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -36,29 +51,11 @@ static int Measure_Enable(lua_State* L)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int Measure_IsDisabled(lua_State* L)
|
|
||||||
{
|
|
||||||
CMeasure* self = (CMeasure*)tolua_tousertype(L, 1, 0);
|
|
||||||
bool val = self->IsDisabled();
|
|
||||||
tolua_pushboolean(L, val);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int Measure_HasDynamicVariables(lua_State* L)
|
|
||||||
{
|
|
||||||
CMeasure* self = (CMeasure*)tolua_tousertype(L, 1, 0);
|
|
||||||
bool val = self->HasDynamicVariables();
|
|
||||||
tolua_pushboolean(L, val);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int Measure_GetValue(lua_State* L)
|
static int Measure_GetValue(lua_State* L)
|
||||||
{
|
{
|
||||||
CMeasure* self = (CMeasure*)tolua_tousertype(L, 1, 0);
|
CMeasure* self = (CMeasure*)tolua_tousertype(L, 1, 0);
|
||||||
double val = (double)self->GetValue();
|
double val = (double)self->GetValue();
|
||||||
tolua_pushnumber(L, (lua_Number)val);
|
lua_pushnumber(L, (lua_Number)val);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -67,7 +64,7 @@ static int Measure_GetRelativeValue(lua_State* L)
|
|||||||
{
|
{
|
||||||
CMeasure* self = (CMeasure*)tolua_tousertype(L, 1, 0);
|
CMeasure* self = (CMeasure*)tolua_tousertype(L, 1, 0);
|
||||||
double val = (double)self->GetRelativeValue();
|
double val = (double)self->GetRelativeValue();
|
||||||
tolua_pushnumber(L, (lua_Number)val);
|
lua_pushnumber(L, (lua_Number)val);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -76,7 +73,7 @@ static int Measure_GetValueRange(lua_State* L)
|
|||||||
{
|
{
|
||||||
CMeasure* self = (CMeasure*)tolua_tousertype(L, 1, 0);
|
CMeasure* self = (CMeasure*)tolua_tousertype(L, 1, 0);
|
||||||
double val = (double)self->GetValueRange();
|
double val = (double)self->GetValueRange();
|
||||||
tolua_pushnumber(L, (lua_Number)val);
|
lua_pushnumber(L, (lua_Number)val);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -85,7 +82,7 @@ static int Measure_GetMinValue(lua_State* L)
|
|||||||
{
|
{
|
||||||
CMeasure* self = (CMeasure*)tolua_tousertype(L, 1, 0);
|
CMeasure* self = (CMeasure*)tolua_tousertype(L, 1, 0);
|
||||||
double val = (double)self->GetMinValue();
|
double val = (double)self->GetMinValue();
|
||||||
tolua_pushnumber(L, (lua_Number)val);
|
lua_pushnumber(L, (lua_Number)val);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -94,7 +91,7 @@ static int Measure_GetMaxValue(lua_State* L)
|
|||||||
{
|
{
|
||||||
CMeasure* self = (CMeasure*)tolua_tousertype(L, 1, 0);
|
CMeasure* self = (CMeasure*)tolua_tousertype(L, 1, 0);
|
||||||
double val = (double)self->GetMaxValue();
|
double val = (double)self->GetMaxValue();
|
||||||
tolua_pushnumber(L, (lua_Number)val);
|
lua_pushnumber(L, (lua_Number)val);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -115,23 +112,14 @@ static int Measure_GetStringValue(lua_State* L)
|
|||||||
|
|
||||||
void LuaManager::RegisterMeasure(lua_State* L)
|
void LuaManager::RegisterMeasure(lua_State* L)
|
||||||
{
|
{
|
||||||
tolua_constant(L, "AUTOSCALE_1024", AUTOSCALE_1024);
|
|
||||||
tolua_constant(L, "AUTOSCALE_1000", AUTOSCALE_1000);
|
|
||||||
tolua_constant(L, "AUTOSCALE_1024K", AUTOSCALE_1024K);
|
|
||||||
tolua_constant(L, "AUTOSCALE_1000K", AUTOSCALE_1000K);
|
|
||||||
tolua_constant(L, "AUTOSCALE_OFF", AUTOSCALE_OFF);
|
|
||||||
tolua_constant(L, "AUTOSCALE_ON", AUTOSCALE_ON);
|
|
||||||
|
|
||||||
tolua_usertype(L, "CMeasure");
|
tolua_usertype(L, "CMeasure");
|
||||||
tolua_cclass(L, "CMeasure", "CMeasure", "CGroup", NULL);
|
tolua_cclass(L, "CMeasure", "CMeasure", "CGroup", NULL);
|
||||||
|
|
||||||
tolua_beginmodule(L, "CMeasure");
|
tolua_beginmodule(L, "CMeasure");
|
||||||
tolua_function(L, "GetName", Measure_GetName);
|
tolua_function(L, "GetName", Measure_GetName);
|
||||||
tolua_function(L, "GetANSIName", Measure_GetANSIName);
|
tolua_function(L, "GetOption", Measure_GetOption);
|
||||||
tolua_function(L, "Disable", Measure_Disable);
|
tolua_function(L, "Disable", Measure_Disable);
|
||||||
tolua_function(L, "Enable", Measure_Enable);
|
tolua_function(L, "Enable", Measure_Enable);
|
||||||
tolua_function(L, "IsDisabled", Measure_IsDisabled);
|
|
||||||
tolua_function(L, "HasDynamicVariables", Measure_HasDynamicVariables);
|
|
||||||
tolua_function(L, "GetValue", Measure_GetValue);
|
tolua_function(L, "GetValue", Measure_GetValue);
|
||||||
tolua_function(L, "GetRelativeValue", Measure_GetRelativeValue);
|
tolua_function(L, "GetRelativeValue", Measure_GetRelativeValue);
|
||||||
tolua_function(L, "GetValueRange", Measure_GetValueRange);
|
tolua_function(L, "GetValueRange", Measure_GetValueRange);
|
||||||
|
@ -2,12 +2,34 @@
|
|||||||
#include "../LuaManager.h"
|
#include "../LuaManager.h"
|
||||||
#include "../../Meter.h"
|
#include "../../Meter.h"
|
||||||
|
|
||||||
static int Meter_HasDynamicVariables(lua_State* L)
|
static int Meter_GetName(lua_State* L)
|
||||||
{
|
{
|
||||||
CMeter* self = (CMeter*)tolua_tousertype(L, 1, 0);
|
CMeter* self = (CMeter*)tolua_tousertype(L, 1, 0);
|
||||||
bool val = self->HasDynamicVariables();
|
const WCHAR* val = (const WCHAR*)self->GetName();
|
||||||
tolua_pushboolean(L, val);
|
push_wchar(L, val);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int Meter_GetOption(lua_State* L)
|
||||||
|
{
|
||||||
|
CMeter* self = (CMeter*)tolua_tousertype(L, 1, 0);
|
||||||
|
CMeterWindow* meterWindow = self->GetMeterWindow();
|
||||||
|
CConfigParser& parser = meterWindow->GetParser();
|
||||||
|
|
||||||
|
const char* arg = (const char*)tolua_tostring(L, 2, 0);
|
||||||
|
std::wstring strTmp = ConvertToWide(arg);
|
||||||
|
strTmp = parser.GetValue(self->GetName(), strTmp, L"");
|
||||||
|
|
||||||
|
parser.SetBuiltInVariable(L"CURRENTSECTION", self->GetName()); // Set temporarily
|
||||||
|
parser.ReplaceVariables(strTmp);
|
||||||
|
parser.SetBuiltInVariable(L"CURRENTSECTION", L""); // Reset
|
||||||
|
|
||||||
|
if (self->HasDynamicVariables())
|
||||||
|
{
|
||||||
|
parser.ReplaceMeasures(strTmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
push_wchar(L, strTmp.c_str());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -15,7 +37,7 @@ static int Meter_GetW(lua_State* L)
|
|||||||
{
|
{
|
||||||
CMeter* self = (CMeter*)tolua_tousertype(L, 1, 0);
|
CMeter* self = (CMeter*)tolua_tousertype(L, 1, 0);
|
||||||
int val = (int)self->GetW();
|
int val = (int)self->GetW();
|
||||||
tolua_pushnumber(L, (lua_Number)val);
|
lua_pushnumber(L, (lua_Number)val);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -24,7 +46,7 @@ static int Meter_GetH(lua_State* L)
|
|||||||
{
|
{
|
||||||
CMeter* self = (CMeter*)tolua_tousertype(L, 1, 0);
|
CMeter* self = (CMeter*)tolua_tousertype(L, 1, 0);
|
||||||
int val = (int)self->GetH();
|
int val = (int)self->GetH();
|
||||||
tolua_pushnumber(L, (lua_Number)val);
|
lua_pushnumber(L, (lua_Number)val);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
@ -35,7 +57,7 @@ static int Meter_GetX(lua_State* L)
|
|||||||
CMeter* self = (CMeter*)tolua_tousertype(L, 1, 0);
|
CMeter* self = (CMeter*)tolua_tousertype(L, 1, 0);
|
||||||
bool abs = ((bool)tolua_toboolean(L, 2, false));
|
bool abs = ((bool)tolua_toboolean(L, 2, false));
|
||||||
int val = (int)self->GetX(abs);
|
int val = (int)self->GetX(abs);
|
||||||
tolua_pushnumber(L, (lua_Number)val);
|
lua_pushnumber(L, (lua_Number)val);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -45,7 +67,7 @@ static int Meter_GetY(lua_State* L)
|
|||||||
CMeter* self = (CMeter*)tolua_tousertype(L, 1, 0);
|
CMeter* self = (CMeter*)tolua_tousertype(L, 1, 0);
|
||||||
bool abs = ((bool)tolua_toboolean(L, 2, false));
|
bool abs = ((bool)tolua_toboolean(L, 2, false));
|
||||||
int val = (int)self->GetY(abs);
|
int val = (int)self->GetY(abs);
|
||||||
tolua_pushnumber(L, (lua_Number)val);
|
lua_pushnumber(L, (lua_Number)val);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -86,60 +108,6 @@ static int Meter_SetY(lua_State* L)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int Meter_GetToolTipText(lua_State* L)
|
|
||||||
{
|
|
||||||
CMeter* self = (CMeter*)tolua_tousertype(L, 1, 0);
|
|
||||||
const std::wstring& val = self->GetToolTipText();
|
|
||||||
push_wchar(L, val.c_str());
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int Meter_HasToolTip(lua_State* L)
|
|
||||||
{
|
|
||||||
CMeter* self = (CMeter*)tolua_tousertype(L, 1, 0);
|
|
||||||
bool val = self->HasToolTip();
|
|
||||||
tolua_pushboolean(L, val);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int Meter_SetToolTipHidden(lua_State* L)
|
|
||||||
{
|
|
||||||
CMeter* self = (CMeter*)tolua_tousertype(L, 1, 0);
|
|
||||||
bool b = (bool)tolua_toboolean(L, 2, 0);
|
|
||||||
self->SetToolTipHidden(b);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int Meter_HasMouseAction(lua_State* L)
|
|
||||||
{
|
|
||||||
CMeter* self = (CMeter*)tolua_tousertype(L, 1, 0);
|
|
||||||
bool val = self->HasMouseAction();
|
|
||||||
tolua_pushboolean(L, val);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int Meter_HasMouseActionCursor(lua_State* L)
|
|
||||||
{
|
|
||||||
CMeter* self = (CMeter*)tolua_tousertype(L, 1, 0);
|
|
||||||
bool val = self->HasMouseActionCursor();
|
|
||||||
tolua_pushboolean(L, val);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int Meter_SetMouseActionCursor(lua_State* L)
|
|
||||||
{
|
|
||||||
CMeter* self = (CMeter*)tolua_tousertype(L, 1, 0);
|
|
||||||
bool b = (bool)tolua_toboolean(L, 2, 0);
|
|
||||||
self->SetMouseActionCursor(b);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int Meter_Hide(lua_State* L)
|
static int Meter_Hide(lua_State* L)
|
||||||
{
|
{
|
||||||
CMeter* self = (CMeter*)tolua_tousertype(L, 1, 0);
|
CMeter* self = (CMeter*)tolua_tousertype(L, 1, 0);
|
||||||
@ -156,30 +124,14 @@ static int Meter_Show(lua_State* L)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int Meter_IsHidden(lua_State* L)
|
|
||||||
{
|
|
||||||
CMeter* self = (CMeter*)tolua_tousertype(L, 1, 0);
|
|
||||||
bool val = self->IsHidden();
|
|
||||||
tolua_pushboolean(L, val);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int Meter_GetName(lua_State* L)
|
|
||||||
{
|
|
||||||
CMeter* self = (CMeter*)tolua_tousertype(L, 1, 0);
|
|
||||||
const WCHAR* val = (const WCHAR*)self->GetName();
|
|
||||||
push_wchar(L, val);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void LuaManager::RegisterMeter(lua_State* L)
|
void LuaManager::RegisterMeter(lua_State* L)
|
||||||
{
|
{
|
||||||
tolua_usertype(L, "CMeter");
|
tolua_usertype(L, "CMeter");
|
||||||
tolua_cclass(L, "CMeter", "CMeter", "CGroup", NULL);
|
tolua_cclass(L, "CMeter", "CMeter", "CGroup", NULL);
|
||||||
|
|
||||||
tolua_beginmodule(L, "CMeter");
|
tolua_beginmodule(L, "CMeter");
|
||||||
tolua_function(L, "HasDynamicVariables", Meter_HasDynamicVariables);
|
tolua_function(L, "GetName", Meter_GetName);
|
||||||
|
tolua_function(L, "GetOption", Meter_GetOption);
|
||||||
tolua_function(L, "GetW", Meter_GetW);
|
tolua_function(L, "GetW", Meter_GetW);
|
||||||
tolua_function(L, "GetH", Meter_GetH);
|
tolua_function(L, "GetH", Meter_GetH);
|
||||||
tolua_function(L, "GetX", Meter_GetX);
|
tolua_function(L, "GetX", Meter_GetX);
|
||||||
@ -188,15 +140,7 @@ void LuaManager::RegisterMeter(lua_State* L)
|
|||||||
tolua_function(L, "SetH", Meter_SetH);
|
tolua_function(L, "SetH", Meter_SetH);
|
||||||
tolua_function(L, "SetX", Meter_SetX);
|
tolua_function(L, "SetX", Meter_SetX);
|
||||||
tolua_function(L, "SetY", Meter_SetY);
|
tolua_function(L, "SetY", Meter_SetY);
|
||||||
tolua_function(L, "GetToolTipText", Meter_GetToolTipText);
|
|
||||||
tolua_function(L, "HasToolTip", Meter_HasToolTip);
|
|
||||||
tolua_function(L, "SetToolTipHidden", Meter_SetToolTipHidden);
|
|
||||||
tolua_function(L, "HasMouseAction", Meter_HasMouseAction);
|
|
||||||
tolua_function(L, "HasMouseActionCursor", Meter_HasMouseActionCursor);
|
|
||||||
tolua_function(L, "SetMouseActionCursor", Meter_SetMouseActionCursor);
|
|
||||||
tolua_function(L, "Hide", Meter_Hide);
|
tolua_function(L, "Hide", Meter_Hide);
|
||||||
tolua_function(L, "Show", Meter_Show);
|
tolua_function(L, "Show", Meter_Show);
|
||||||
tolua_function(L, "IsHidden", Meter_IsHidden);
|
|
||||||
tolua_function(L, "GetName", Meter_GetName);
|
|
||||||
tolua_endmodule(L);
|
tolua_endmodule(L);
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ static int MeterString_GetX(lua_State* L)
|
|||||||
CMeterString* self = (CMeterString*)tolua_tousertype(L, 1, 0);
|
CMeterString* self = (CMeterString*)tolua_tousertype(L, 1, 0);
|
||||||
bool abs = (bool)tolua_toboolean(L, 2, false);
|
bool abs = (bool)tolua_toboolean(L, 2, false);
|
||||||
int val = self->GetX(abs);
|
int val = self->GetX(abs);
|
||||||
tolua_pushnumber(L, (lua_Number)val);
|
lua_pushnumber(L, (lua_Number)val);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -16,7 +16,7 @@ static int MeterString_Update(lua_State* L)
|
|||||||
{
|
{
|
||||||
CMeterString* self = (CMeterString*)tolua_tousertype(L, 1, 0);
|
CMeterString* self = (CMeterString*)tolua_tousertype(L, 1, 0);
|
||||||
bool val = self->Update();
|
bool val = self->Update();
|
||||||
tolua_pushboolean(L, val);
|
lua_pushboolean(L, val);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -147,7 +147,7 @@ static int MeterWindow_GetW(lua_State* L)
|
|||||||
{
|
{
|
||||||
CMeterWindow* self = (CMeterWindow*)tolua_tousertype(L, 1, 0);
|
CMeterWindow* self = (CMeterWindow*)tolua_tousertype(L, 1, 0);
|
||||||
int val = (int)self->GetW();
|
int val = (int)self->GetW();
|
||||||
tolua_pushnumber(L, (lua_Number)val);
|
lua_pushnumber(L, (lua_Number)val);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -156,7 +156,7 @@ static int MeterWindow_GetH(lua_State* L)
|
|||||||
{
|
{
|
||||||
CMeterWindow* self = (CMeterWindow*)tolua_tousertype(L, 1, 0);
|
CMeterWindow* self = (CMeterWindow*)tolua_tousertype(L, 1, 0);
|
||||||
int val = (int)self->GetH();
|
int val = (int)self->GetH();
|
||||||
tolua_pushnumber(L, (lua_Number)val);
|
lua_pushnumber(L, (lua_Number)val);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -165,7 +165,7 @@ static int MeterWindow_GetX(lua_State* L)
|
|||||||
{
|
{
|
||||||
CMeterWindow* self = (CMeterWindow*)tolua_tousertype(L, 1, 0);
|
CMeterWindow* self = (CMeterWindow*)tolua_tousertype(L, 1, 0);
|
||||||
int val = (int)self->GetX();
|
int val = (int)self->GetX();
|
||||||
tolua_pushnumber(L, (lua_Number)val);
|
lua_pushnumber(L, (lua_Number)val);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -174,7 +174,7 @@ static int MeterWindow_GetY(lua_State* L)
|
|||||||
{
|
{
|
||||||
CMeterWindow* self = (CMeterWindow*)tolua_tousertype(L, 1, 0);
|
CMeterWindow* self = (CMeterWindow*)tolua_tousertype(L, 1, 0);
|
||||||
int val = (int)self->GetY();
|
int val = (int)self->GetY();
|
||||||
tolua_pushnumber(L, (lua_Number)val);
|
lua_pushnumber(L, (lua_Number)val);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -183,7 +183,7 @@ static int MeterWindow_GetXScreen(lua_State* L)
|
|||||||
{
|
{
|
||||||
CMeterWindow* self = (CMeterWindow*)tolua_tousertype(L, 1, 0);
|
CMeterWindow* self = (CMeterWindow*)tolua_tousertype(L, 1, 0);
|
||||||
int val = (int)self->GetXScreen();
|
int val = (int)self->GetXScreen();
|
||||||
tolua_pushnumber(L, (lua_Number)val);
|
lua_pushnumber(L, (lua_Number)val);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -192,7 +192,7 @@ static int MeterWindow_GetYScreen(lua_State* L)
|
|||||||
{
|
{
|
||||||
CMeterWindow* self = (CMeterWindow*)tolua_tousertype(L, 1, 0);
|
CMeterWindow* self = (CMeterWindow*)tolua_tousertype(L, 1, 0);
|
||||||
int val = (int)self->GetYScreen();
|
int val = (int)self->GetYScreen();
|
||||||
tolua_pushnumber(L, (lua_Number)val);
|
lua_pushnumber(L, (lua_Number)val);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -1,61 +0,0 @@
|
|||||||
#include "../../StdAfx.h"
|
|
||||||
#include "../LuaManager.h"
|
|
||||||
#include "../../Rainmeter.h"
|
|
||||||
|
|
||||||
static int Rainmeter_GetConfigEditor(lua_State* L)
|
|
||||||
{
|
|
||||||
CRainmeter* self = (CRainmeter*)tolua_tousertype(L, 1, 0);
|
|
||||||
const std::wstring& val = self->GetConfigEditor();
|
|
||||||
push_wstring(L, val);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int Rainmeter_GetLogViewer(lua_State* L)
|
|
||||||
{
|
|
||||||
CRainmeter* self = (CRainmeter*)tolua_tousertype(L, 1, 0);
|
|
||||||
const std::wstring& val = self->GetLogViewer();
|
|
||||||
push_wstring(L, val);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int Rainmeter_GetStatsDate(lua_State* L)
|
|
||||||
{
|
|
||||||
CRainmeter* self = (CRainmeter*)tolua_tousertype(L, 1, 0);
|
|
||||||
const std::wstring& val = self->GetStatsDate();
|
|
||||||
push_wstring(L, val);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int Rainmeter_GetDebug(lua_State* L)
|
|
||||||
{
|
|
||||||
bool val = CRainmeter::GetDebug();
|
|
||||||
tolua_pushboolean(L, val);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int Rainmeter_IsMenuActive(lua_State* L)
|
|
||||||
{
|
|
||||||
CRainmeter* self = (CRainmeter*)tolua_tousertype(L, 1, 0);
|
|
||||||
bool val = self->IsMenuActive();
|
|
||||||
tolua_pushboolean(L, val);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void LuaManager::RegisterRainmeter(lua_State* L)
|
|
||||||
{
|
|
||||||
tolua_usertype(L, "CRainmeter");
|
|
||||||
tolua_cclass(L, "CRainmeter", "CRainmeter", "", NULL);
|
|
||||||
|
|
||||||
tolua_beginmodule(L, "CRainmeter");
|
|
||||||
tolua_function(L, "GetConfigEditor", Rainmeter_GetConfigEditor);
|
|
||||||
tolua_function(L, "GetLogViewer", Rainmeter_GetLogViewer);
|
|
||||||
tolua_function(L, "GetStatsDate", Rainmeter_GetStatsDate);
|
|
||||||
tolua_function(L, "GetDebug", Rainmeter_GetDebug);
|
|
||||||
tolua_function(L, "IsMenuActive", Rainmeter_IsMenuActive);
|
|
||||||
tolua_endmodule(L);
|
|
||||||
}
|
|
@ -1,116 +0,0 @@
|
|||||||
/*
|
|
||||||
** Lua binding: meter_image
|
|
||||||
** Generated automatically by tolua++-1.0.92 on 02/15/11 03:01:12.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "../../StdAfx.h"
|
|
||||||
|
|
||||||
#ifndef __cplusplus
|
|
||||||
#include "stdlib.h"
|
|
||||||
#endif
|
|
||||||
#include "string.h"
|
|
||||||
|
|
||||||
#include "tolua++.h"
|
|
||||||
|
|
||||||
/* Exported function */
|
|
||||||
TOLUA_API int tolua_meter_image_open (lua_State* tolua_S);
|
|
||||||
|
|
||||||
#include "../../MeterImage.h"
|
|
||||||
#include "../LuaPush.h"
|
|
||||||
|
|
||||||
/* function to register type */
|
|
||||||
static void tolua_reg_types (lua_State* tolua_S)
|
|
||||||
{
|
|
||||||
tolua_usertype(tolua_S,"CMeterImage");
|
|
||||||
tolua_usertype(tolua_S,"WCHAR");
|
|
||||||
tolua_usertype(tolua_S,"CMeter");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* method: SetImage of class CMeterImage */
|
|
||||||
#ifndef TOLUA_DISABLE_tolua_meter_image_CMeterImage_SetImage00
|
|
||||||
static int tolua_meter_image_CMeterImage_SetImage00(lua_State* tolua_S)
|
|
||||||
{
|
|
||||||
#ifndef TOLUA_RELEASE
|
|
||||||
tolua_Error tolua_err;
|
|
||||||
if (
|
|
||||||
!tolua_isusertype(tolua_S,1,"CMeterImage",0,&tolua_err) ||
|
|
||||||
!is_wchar(tolua_S,2,"const WCHAR",0,&tolua_err) ||
|
|
||||||
!tolua_isnoobj(tolua_S,3,&tolua_err)
|
|
||||||
)
|
|
||||||
goto tolua_lerror;
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
CMeterImage* self = (CMeterImage*) tolua_tousertype(tolua_S,1,0);
|
|
||||||
const WCHAR* imageName = ((const WCHAR*) to_wchar(tolua_S,2,0));
|
|
||||||
#ifndef TOLUA_RELEASE
|
|
||||||
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetImage'", NULL);
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
self->SetImage(imageName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
#ifndef TOLUA_RELEASE
|
|
||||||
tolua_lerror:
|
|
||||||
tolua_error(tolua_S,"#ferror in function 'SetImage'.",&tolua_err);
|
|
||||||
return 0;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#endif //#ifndef TOLUA_DISABLE
|
|
||||||
|
|
||||||
/* method: GetImage of class CMeterImage */
|
|
||||||
#ifndef TOLUA_DISABLE_tolua_meter_image_CMeterImage_GetImage00
|
|
||||||
static int tolua_meter_image_CMeterImage_GetImage00(lua_State* tolua_S)
|
|
||||||
{
|
|
||||||
#ifndef TOLUA_RELEASE
|
|
||||||
tolua_Error tolua_err;
|
|
||||||
if (
|
|
||||||
!tolua_isusertype(tolua_S,1,"CMeterImage",0,&tolua_err) ||
|
|
||||||
!tolua_isnoobj(tolua_S,2,&tolua_err)
|
|
||||||
)
|
|
||||||
goto tolua_lerror;
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
CMeterImage* self = (CMeterImage*) tolua_tousertype(tolua_S,1,0);
|
|
||||||
#ifndef TOLUA_RELEASE
|
|
||||||
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetImage'", NULL);
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
const WCHAR* tolua_ret = (const WCHAR*) self->GetImage();
|
|
||||||
push_wchar(tolua_S,(void*)tolua_ret,"const WCHAR");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
#ifndef TOLUA_RELEASE
|
|
||||||
tolua_lerror:
|
|
||||||
tolua_error(tolua_S,"#ferror in function 'GetImage'.",&tolua_err);
|
|
||||||
return 0;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#endif //#ifndef TOLUA_DISABLE
|
|
||||||
|
|
||||||
/* Open function */
|
|
||||||
TOLUA_API int tolua_meter_image_open (lua_State* tolua_S)
|
|
||||||
{
|
|
||||||
tolua_open(tolua_S);
|
|
||||||
tolua_reg_types(tolua_S);
|
|
||||||
tolua_module(tolua_S,NULL,0);
|
|
||||||
tolua_beginmodule(tolua_S,NULL);
|
|
||||||
tolua_cclass(tolua_S,"CMeterImage","CMeterImage","CMeter",NULL);
|
|
||||||
tolua_beginmodule(tolua_S,"CMeterImage");
|
|
||||||
tolua_function(tolua_S,"SetImage",tolua_meter_image_CMeterImage_SetImage00);
|
|
||||||
tolua_function(tolua_S,"GetImage",tolua_meter_image_CMeterImage_GetImage00);
|
|
||||||
tolua_endmodule(tolua_S);
|
|
||||||
tolua_endmodule(tolua_S);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(LUA_VERSION_NUM) && LUA_VERSION_NUM >= 501
|
|
||||||
TOLUA_API int luaopen_meter_image (lua_State* tolua_S) {
|
|
||||||
return tolua_meter_image_open(tolua_S);
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
|||||||
$#include "../../MeterImage.h"
|
|
||||||
$#include "../LuaPush.h"
|
|
||||||
|
|
||||||
class CMeterImage : public CMeter
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
void SetImage(const WCHAR* imageName);
|
|
||||||
const WCHAR* GetImage();
|
|
||||||
|
|
||||||
};
|
|
Loading…
x
Reference in New Issue
Block a user