diff --git a/Library/Library.vcxproj b/Library/Library.vcxproj index aea549ec..82c02889 100644 --- a/Library/Library.vcxproj +++ b/Library/Library.vcxproj @@ -767,14 +767,6 @@ Use ../../StdAfx.h - - Use - ../../StdAfx.h - Use - ../../StdAfx.h - Use - ../../StdAfx.h - Use ../../StdAfx.h diff --git a/Library/Library.vcxproj.filters b/Library/Library.vcxproj.filters index 126b1345..75c8d611 100644 --- a/Library/Library.vcxproj.filters +++ b/Library/Library.vcxproj.filters @@ -153,9 +153,6 @@ Lua\glue - - Lua\glue - Lua\glue diff --git a/Library/lua/LuaManager.cpp b/Library/lua/LuaManager.cpp index de774718..d075c175 100644 --- a/Library/lua/LuaManager.cpp +++ b/Library/lua/LuaManager.cpp @@ -44,7 +44,6 @@ void LuaManager::Initialize() RegisterMeasure(c_State); RegisterMeter(c_State); RegisterMeterWindow(c_State); - RegisterMeterString(c_State); tolua_endmodule(c_State); } diff --git a/Library/lua/glue/LuaMeter.cpp b/Library/lua/glue/LuaMeter.cpp index 013fd780..3f1de2a9 100644 --- a/Library/lua/glue/LuaMeter.cpp +++ b/Library/lua/glue/LuaMeter.cpp @@ -19,6 +19,7 @@ #include "../../StdAfx.h" #include "../LuaManager.h" #include "../../Meter.h" +#include "../../MeterString.h" static int Meter_GetName(lua_State* L) { @@ -138,6 +139,19 @@ static int Meter_Show(lua_State* L) return 0; } +static int Meter_SetText(lua_State* L) +{ + CMeter* self = (CMeter*)tolua_tousertype(L, 1, 0); + + if (CMeterString* stringMeter = dynamic_cast(self)) + { + std::wstring str = LuaManager::ToWide(L, 2); + stringMeter->SetText(str.c_str()); + } + + return 0; +} + void LuaManager::RegisterMeter(lua_State* L) { tolua_usertype(L, "CMeter"); @@ -156,5 +170,6 @@ void LuaManager::RegisterMeter(lua_State* L) tolua_function(L, "SetY", Meter_SetY); tolua_function(L, "Hide", Meter_Hide); tolua_function(L, "Show", Meter_Show); + tolua_function(L, "SetText", Meter_SetText); tolua_endmodule(L); } diff --git a/Library/lua/glue/LuaMeterString.cpp b/Library/lua/glue/LuaMeterString.cpp deleted file mode 100644 index c7ae665d..00000000 --- a/Library/lua/glue/LuaMeterString.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/* - Copyright (C) 2010 Matt King, Birunthan Mohanathas - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - -#include "../../StdAfx.h" -#include "../LuaManager.h" -#include "../../MeterString.h" - -static int MeterString_GetX(lua_State* L) -{ - CMeterString* self = (CMeterString*)tolua_tousertype(L, 1, 0); - bool abs = (bool)tolua_toboolean(L, 2, false); - int val = self->GetX(abs); - lua_pushnumber(L, (lua_Number)val); - - return 1; -} - -static int MeterString_Update(lua_State* L) -{ - CMeterString* self = (CMeterString*)tolua_tousertype(L, 1, 0); - bool val = self->Update(); - lua_pushboolean(L, val); - - return 1; -} - -static int MeterString_SetText(lua_State* L) -{ - CMeterString* self = (CMeterString*)tolua_tousertype(L, 1, 0); - std::wstring str = LuaManager::ToWide(L, 2); - self->SetText(str.c_str()); - - return 0; -} - -void LuaManager::RegisterMeterString(lua_State* L) -{ - tolua_usertype(L, "CMeterString"); - tolua_cclass(L, "CMeterString", "CMeterString", "CMeter", NULL); - - tolua_beginmodule(L, "CMeterString"); - tolua_function(L, "GetX", MeterString_GetX); - tolua_function(L, "Update", MeterString_Update); - tolua_function(L, "SetText", MeterString_SetText); - tolua_endmodule(L); -} diff --git a/Library/lua/glue/LuaMeterWindow.cpp b/Library/lua/glue/LuaMeterWindow.cpp index 5b794065..be78d418 100644 --- a/Library/lua/glue/LuaMeterWindow.cpp +++ b/Library/lua/glue/LuaMeterWindow.cpp @@ -122,14 +122,7 @@ static int MeterWindow_GetMeter(lua_State* L) return 0; } - if (CMeterString* stringMeter = dynamic_cast(meter)) - { - tolua_pushusertype(L, stringMeter, "CMeterString"); - } - else - { - tolua_pushusertype(L, meter, "CMeter"); - } + tolua_pushusertype(L, meter, "CMeter"); return 1; }