From 754c33f82f4e398819aa31c2863f72f4f196232b Mon Sep 17 00:00:00 2001 From: Birunthan Mohanathas Date: Sat, 3 Sep 2011 16:45:29 +0000 Subject: [PATCH] - Script: Fixed that Unicode characters were not correctly displayed - About Log: 20 last log items are now displayed on launch - LOG_DEBUG messages are ignored from plugins only when not in Debug mode --- Library/DialogAbout.cpp | 23 ++++--- Library/Library.rc | 4 +- Library/Library.vcxproj | 9 --- Library/Library.vcxproj.filters | 6 -- Library/Litestep.cpp | 93 ++++++++++++++--------------- Library/Litestep.h | 2 +- Library/MeasureScript.cpp | 2 +- Library/Rainmeter.cpp | 8 ++- Library/Rainmeter.h | 1 + Library/lua/LuaManager.cpp | 16 ++++- Library/lua/LuaManager.h | 4 +- Library/lua/LuaPush.cpp | 50 ---------------- Library/lua/LuaPush.h | 18 ------ Library/lua/LuaScript.cpp | 2 +- Library/lua/glue/LuaMeasure.cpp | 9 ++- Library/lua/glue/LuaMeter.cpp | 8 +-- Library/lua/glue/LuaMeterString.cpp | 4 +- Library/lua/glue/LuaMeterWindow.cpp | 27 ++++----- 18 files changed, 111 insertions(+), 175 deletions(-) delete mode 100644 Library/lua/LuaPush.cpp delete mode 100644 Library/lua/LuaPush.h diff --git a/Library/DialogAbout.cpp b/Library/DialogAbout.cpp index 2d20b395..edf3ddfa 100644 --- a/Library/DialogAbout.cpp +++ b/Library/DialogAbout.cpp @@ -368,6 +368,13 @@ void CDialogAbout::CTabLog::Initialize() lvc.pszText = L"Message"; ListView_InsertColumn(item, 2, &lvc); + // Add stored entires + std::list::const_iterator iter = Rainmeter->GetAboutLogData().begin(); + for ( ; iter != Rainmeter->GetAboutLogData().end(); ++iter) + { + AddItem((*iter).level, (*iter).timestamp.c_str(), (*iter).message.c_str()); + } + item = GetDlgItem(m_Window, IDC_ABOUTLOG_ERROR_CHECKBOX); Button_SetCheck(item, BST_CHECKED); @@ -561,7 +568,7 @@ void CDialogAbout::CTabMeasures::Initialize() lvc.pszText = L"Range"; ListView_InsertColumn(item, 1, &lvc); lvc.iSubItem = 2; - lvc.cx = 160; + lvc.cx = 130; lvc.pszText = L"Value"; ListView_InsertColumn(item, 2, &lvc); @@ -597,17 +604,17 @@ void CDialogAbout::CTabMeasures::Resize(int w, int h) { SetWindowPos(m_Window, NULL, 0, 0, w, h, SWP_NOMOVE | SWP_NOZORDER); - HWND item = GetDlgItem(m_Window, IDC_ABOUTMEASURES_ITEMS_LISTVIEW); - SetWindowPos(item, NULL, 0, 0, w - 160, h, SWP_NOMOVE | SWP_NOZORDER); + HWND item = GetDlgItem(m_Window, IDC_ABOUTMEASURES_ITEMS_LISTBOX); + SetWindowPos(item, NULL, 0, 0, 180, h, SWP_NOMOVE | SWP_NOZORDER); - // Adjust third colum + item = GetDlgItem(m_Window, IDC_ABOUTMEASURES_ITEMS_LISTVIEW); + SetWindowPos(item, NULL, 0, 0, w - 190, h, SWP_NOMOVE | SWP_NOZORDER); + + // Adjust third column LVCOLUMN lvc; lvc.mask = LVCF_WIDTH; - lvc.cx = w - 392; + lvc.cx = w - 422; ListView_SetColumn(item, 2, &lvc); - - item = GetDlgItem(m_Window, IDC_ABOUTMEASURES_ITEMS_LISTBOX); - SetWindowPos(item, NULL, 0, 0, 150, h, SWP_NOMOVE | SWP_NOZORDER); } /* diff --git a/Library/Library.rc b/Library/Library.rc index 3d1c6783..be0fb444 100644 --- a/Library/Library.rc +++ b/Library/Library.rc @@ -219,8 +219,8 @@ IDD_ABOUTMEASURES_DIALOG DIALOGEX 15, 30, 370, 148 STYLE DS_CONTROL | WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS FONT 8, "MS Shell Dlg 2", 0, 0, 0x0 BEGIN - LISTBOX IDC_ABOUTMEASURES_ITEMS_LISTBOX, 0, 0, 100, 148, LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP - CONTROL "", IDC_ABOUTMEASURES_ITEMS_LISTVIEW, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP, 105, 0, 262, 148 + LISTBOX IDC_ABOUTMEASURES_ITEMS_LISTBOX, 0, 0, 120, 148, LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP + CONTROL "", IDC_ABOUTMEASURES_ITEMS_LISTVIEW, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP, 125, 0, 242, 148 END IDD_ABOUTPLUGINS_DIALOG DIALOGEX 15, 30, 370, 148 diff --git a/Library/Library.vcxproj b/Library/Library.vcxproj index 4b7f8107..da6f28b8 100644 --- a/Library/Library.vcxproj +++ b/Library/Library.vcxproj @@ -759,14 +759,6 @@ Use ../StdAfx.h - - Use - ../StdAfx.h - Use - ../StdAfx.h - Use - ../StdAfx.h - Use ../StdAfx.h @@ -914,7 +906,6 @@ - diff --git a/Library/Library.vcxproj.filters b/Library/Library.vcxproj.filters index 6e4ae3dc..beb57252 100644 --- a/Library/Library.vcxproj.filters +++ b/Library/Library.vcxproj.filters @@ -162,9 +162,6 @@ Lua - - Lua - Lua @@ -505,9 +502,6 @@ Lua - - Lua - Lua diff --git a/Library/Litestep.cpp b/Library/Litestep.cpp index 38517452..6ea53c7b 100644 --- a/Library/Litestep.cpp +++ b/Library/Litestep.cpp @@ -639,60 +639,59 @@ BOOL LogInternal(int nLevel, LPCTSTR pszModule, ULONGLONG elapsed, LPCTSTR pszMe BOOL LSLog(int nLevel, LPCTSTR pszModule, LPCTSTR pszMessage) { + // Ignore LOG_DEBUG messages from plugins unless in debug mode if (nLevel != LOG_DEBUG || Rainmeter->GetDebug()) { - struct DELAYED_LOG_INFO - { - int level; - std::wstring module; - ULONGLONG elapsed; - std::wstring message; - }; - static std::list c_LogDelay; - - static ULONGLONG startTime = CSystem::GetTickCount64(); - ULONGLONG elapsed = CSystem::GetTickCount64() - startTime; - - if (TryEnterCriticalSection(&g_CsLog)) - { - // Log the queued messages first - EnterCriticalSection(&g_CsLogDelay); - - while (!c_LogDelay.empty()) - { - DELAYED_LOG_INFO& logInfo = c_LogDelay.front(); - LogInternal(logInfo.level, logInfo.module.c_str(), logInfo.elapsed, logInfo.message.c_str()); - - c_LogDelay.erase(c_LogDelay.begin()); - } - - LeaveCriticalSection(&g_CsLogDelay); - - // Log the message - BOOL ret = LogInternal(nLevel, pszModule, elapsed, pszMessage); - - LeaveCriticalSection(&g_CsLog); - - return ret; - } - else - { - // Queue the message - EnterCriticalSection(&g_CsLogDelay); - - DELAYED_LOG_INFO logInfo = {nLevel, pszModule, elapsed, pszMessage}; - c_LogDelay.push_back(logInfo); - - LeaveCriticalSection(&g_CsLogDelay); - } + Log(nLevel, pszMessage, pszModule); } return TRUE; } -void Log(int nLevel, const WCHAR* message) +void Log(int nLevel, const WCHAR* message, const WCHAR* module) { - LSLog(nLevel, L"Rainmeter", message); + struct DELAYED_LOG_INFO + { + int level; + std::wstring module; + ULONGLONG elapsed; + std::wstring message; + }; + static std::list c_LogDelay; + + static ULONGLONG startTime = CSystem::GetTickCount64(); + ULONGLONG elapsed = CSystem::GetTickCount64() - startTime; + + if (TryEnterCriticalSection(&g_CsLog)) + { + // Log the queued messages first + EnterCriticalSection(&g_CsLogDelay); + + while (!c_LogDelay.empty()) + { + DELAYED_LOG_INFO& logInfo = c_LogDelay.front(); + LogInternal(logInfo.level, logInfo.module.c_str(), logInfo.elapsed, logInfo.message.c_str()); + + c_LogDelay.erase(c_LogDelay.begin()); + } + + LeaveCriticalSection(&g_CsLogDelay); + + // Log the message + LogInternal(nLevel, module, elapsed, message); + + LeaveCriticalSection(&g_CsLog); + } + else + { + // Queue the message + EnterCriticalSection(&g_CsLogDelay); + + DELAYED_LOG_INFO logInfo = {nLevel, module, elapsed, message}; + c_LogDelay.push_back(logInfo); + + LeaveCriticalSection(&g_CsLogDelay); + } } void LogWithArgs(int nLevel, const WCHAR* format, ... ) @@ -714,7 +713,7 @@ void LogWithArgs(int nLevel, const WCHAR* format, ... ) _set_invalid_parameter_handler(oldHandler); - LSLog(nLevel, L"Rainmeter", buffer); + Log(nLevel, buffer); va_end(args); delete [] buffer; diff --git a/Library/Litestep.h b/Library/Litestep.h index 4da466f0..857da37e 100644 --- a/Library/Litestep.h +++ b/Library/Litestep.h @@ -50,7 +50,7 @@ void VarExpansion(LPSTR buffer, LPCSTR value); void RmNullCRTInvalidParameterHandler(const wchar_t* expression, const wchar_t* function, const wchar_t* file, unsigned int line, uintptr_t pReserved); -void Log(int nLevel, const WCHAR* message); // Wrapper for LSLog(). +void Log(int nLevel, const WCHAR* message, const WCHAR* module = L"Rainmeter"); // Wrapper for LSLog(). void LogWithArgs(int nLevel, const WCHAR* format, ... ); // Replacement for DebugLog(), has the same functionality but has the option to set teh Log Level. void ResetLoggingFlag(); diff --git a/Library/MeasureScript.cpp b/Library/MeasureScript.cpp index a1e35d19..6a45697a 100644 --- a/Library/MeasureScript.cpp +++ b/Library/MeasureScript.cpp @@ -232,7 +232,7 @@ void CMeasureScript::ReadConfig(CConfigParser& parser, const WCHAR* section) */ void CMeasureScript::ExecuteBang(const WCHAR* args) { - std::string str = ConvertToAscii(args); + std::string str = ConvertToUTF8(args); m_LuaScript->RunString(str.c_str()); } diff --git a/Library/Rainmeter.cpp b/Library/Rainmeter.cpp index 5880960b..81fb3731 100644 --- a/Library/Rainmeter.cpp +++ b/Library/Rainmeter.cpp @@ -4268,7 +4268,13 @@ void CRainmeter::DeleteLogFile() void CRainmeter::AddAboutLogInfo(int level, LPCWSTR time, LPCWSTR message) { - // TODO: Store items in vector + // Store 20 last items + LOG_INFO logInfo = {level, time, message}; + m_LogData.push_back(logInfo); + if (m_LogData.size() > 20) + { + m_LogData.pop_front(); + } CDialogAbout::AddLogItem(level, time, message); } diff --git a/Library/Rainmeter.h b/Library/Rainmeter.h index 5bf8b235..52e61f12 100644 --- a/Library/Rainmeter.h +++ b/Library/Rainmeter.h @@ -236,6 +236,7 @@ public: void SetDisableDragging(bool dragging); void AddAboutLogInfo(int level, LPCWSTR time, LPCWSTR message); + const std::list& GetAboutLogData() { return m_LogData; } void SetDebug(bool debug); diff --git a/Library/lua/LuaManager.cpp b/Library/lua/LuaManager.cpp index 47713795..cfaf5cd4 100644 --- a/Library/lua/LuaManager.cpp +++ b/Library/lua/LuaManager.cpp @@ -78,7 +78,7 @@ void LuaManager::ReportErrors(lua_State* L) } std::wstring str = L"Script: "; - str += ConvertToWide(error.c_str()); + str += ConvertUTF8ToWide(error.c_str()); Log(LOG_ERROR, str.c_str()); } @@ -100,9 +100,19 @@ void LuaManager::LuaLog(int nLevel, const char* format, ... ) _set_invalid_parameter_handler(oldHandler); - std::wstring str = ConvertToWide(buffer); + std::wstring str = ConvertUTF8ToWide(buffer); Log(nLevel, str.c_str()); va_end(args); delete [] buffer; -} \ No newline at end of file +} + +void LuaManager::PushWide(lua_State* L, const WCHAR* str) +{ + lua_pushstring(L, ConvertToUTF8(str).c_str()); +} + +std::wstring LuaManager::ToWide(lua_State* L, int narg) +{ + return ConvertUTF8ToWide(lua_tostring(L, narg)); +} diff --git a/Library/lua/LuaManager.h b/Library/lua/LuaManager.h index a8a17586..9d212b3b 100644 --- a/Library/lua/LuaManager.h +++ b/Library/lua/LuaManager.h @@ -19,7 +19,6 @@ #include "lua.hpp" #include "tolua++.h" -#include "LuaPush.h" class LuaManager { @@ -32,6 +31,9 @@ public: static void ReportErrors(lua_State* L); static void LuaLog(int nLevel, const char* format, ... ); + static void PushWide(lua_State* L, const WCHAR* str); + static std::wstring ToWide(lua_State* L, int narg); + protected: static int c_RefCount; static lua_State* c_State; diff --git a/Library/lua/LuaPush.cpp b/Library/lua/LuaPush.cpp deleted file mode 100644 index 96a13e9b..00000000 --- a/Library/lua/LuaPush.cpp +++ /dev/null @@ -1,50 +0,0 @@ -#include "../StdAfx.h" -#include "LuaPush.h" - -#include "../Litestep.h" - -void push_wstring(lua_State* L, const std::wstring& value) -{ - push_wchar(L, value.c_str()); -} - -void push_wchar(lua_State* L, const WCHAR* value) -{ - std::string str = ConvertToAscii(value); - lua_pushstring(L, str.c_str()); -} - -std::wstring to_wstring(lua_State* L, int arg, void* type) -{ - return ConvertToWide(lua_tostring(L,arg)); -} - -const WCHAR* to_wchar(lua_State* L, int arg, void* type) -{ - // We have a static wstring here so we can keep a copy of the string - // passed in alive while its being passed around. - // This isn't exactly safe, but we shouldn't really have to worry as - // Rainmeter isn't threaded. - static std::wstring str; - str = ConvertToWide(lua_tostring(L,arg)); - - return str.c_str(); -} - -int is_wstring(lua_State* L, int lo, const char* type, int def, tolua_Error* err) -{ - return is_wchar(L,lo,type,def,err); -} - -int is_wchar(lua_State* L, int lo, const char* type, int def, tolua_Error* err) -{ - if (def && lua_gettop(L)index = lo; - err->array = 0; - err->type = type; - return 0; -} diff --git a/Library/lua/LuaPush.h b/Library/lua/LuaPush.h deleted file mode 100644 index aadca6f3..00000000 --- a/Library/lua/LuaPush.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef __LUAPUSH_H__ -#define __LUAPUSH_H__ - -#include -#include - -#include "lua.hpp" -#include "tolua++.h" - -std::wstring to_wstring(lua_State* L, int arg, void* type); -void push_wstring(lua_State* L, const std::wstring& value); -int is_wstring(lua_State* L, int lo, const char* type, int def, tolua_Error* err); - -void push_wchar(lua_State* L, const WCHAR* value); -const WCHAR* to_wchar(lua_State* L, int arg, void* type); -int is_wchar(lua_State* L, int lo, const char* type, int def, tolua_Error* err); - -#endif diff --git a/Library/lua/LuaScript.cpp b/Library/lua/LuaScript.cpp index 3e929f27..90e9d071 100644 --- a/Library/lua/LuaScript.cpp +++ b/Library/lua/LuaScript.cpp @@ -176,7 +176,7 @@ int LuaScript::RunFunctionWithReturn(const char* funcName, double& numValue, std else if (type == LUA_TSTRING) { const char* str = lua_tostring(m_State, -1); - strValue = ConvertToWide(str); + strValue = ConvertUTF8ToWide(str); numValue = strtod(str, NULL); } diff --git a/Library/lua/glue/LuaMeasure.cpp b/Library/lua/glue/LuaMeasure.cpp index 09b19cda..8b3a9113 100644 --- a/Library/lua/glue/LuaMeasure.cpp +++ b/Library/lua/glue/LuaMeasure.cpp @@ -7,7 +7,7 @@ static int Measure_GetName(lua_State* L) { CMeasure* self = (CMeasure*)tolua_tousertype(L, 1, 0); const WCHAR* val = (const WCHAR*)self->GetName(); - push_wchar(L, val); + LuaManager::PushWide(L, val); return 1; } @@ -18,8 +18,7 @@ static int Measure_GetOption(lua_State* L) CMeterWindow* meterWindow = self->GetMeterWindow(); CConfigParser& parser = meterWindow->GetParser(); - const char* arg = (const char*)tolua_tostring(L, 2, 0); - std::wstring strTmp = ConvertToWide(arg); + std::wstring strTmp = LuaManager::ToWide(L, 2); strTmp = parser.GetValue(self->GetName(), strTmp, L""); parser.SetBuiltInVariable(L"CURRENTSECTION", self->GetName()); // Set temporarily @@ -27,7 +26,7 @@ static int Measure_GetOption(lua_State* L) parser.SetBuiltInVariable(L"CURRENTSECTION", L""); // Reset parser.ReplaceMeasures(strTmp); - push_wchar(L, strTmp.c_str()); + LuaManager::PushWide(L, strTmp.c_str()); return 1; } @@ -101,7 +100,7 @@ static int Measure_GetStringValue(lua_State* L) bool percentual = (bool)tolua_toboolean(L, 5, false); const WCHAR* val = self->GetStringValue(autoScale, scale, decimals, percentual); - push_wchar(L, val); + LuaManager::PushWide(L, val); return 1; } diff --git a/Library/lua/glue/LuaMeter.cpp b/Library/lua/glue/LuaMeter.cpp index 900489b9..16829c9a 100644 --- a/Library/lua/glue/LuaMeter.cpp +++ b/Library/lua/glue/LuaMeter.cpp @@ -6,7 +6,8 @@ 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); + LuaManager::PushWide(L, val); + return 1; } @@ -16,8 +17,7 @@ static int Meter_GetOption(lua_State* L) CMeterWindow* meterWindow = self->GetMeterWindow(); CConfigParser& parser = meterWindow->GetParser(); - const char* arg = (const char*)tolua_tostring(L, 2, 0); - std::wstring strTmp = ConvertToWide(arg); + std::wstring strTmp = LuaManager::ToWide(L, 2); strTmp = parser.GetValue(self->GetName(), strTmp, L""); parser.SetBuiltInVariable(L"CURRENTSECTION", self->GetName()); // Set temporarily @@ -25,7 +25,7 @@ static int Meter_GetOption(lua_State* L) parser.SetBuiltInVariable(L"CURRENTSECTION", L""); // Reset parser.ReplaceMeasures(strTmp); - push_wchar(L, strTmp.c_str()); + LuaManager::PushWide(L, strTmp.c_str()); return 1; } diff --git a/Library/lua/glue/LuaMeterString.cpp b/Library/lua/glue/LuaMeterString.cpp index add6d286..63448b9f 100644 --- a/Library/lua/glue/LuaMeterString.cpp +++ b/Library/lua/glue/LuaMeterString.cpp @@ -24,8 +24,8 @@ static int MeterString_Update(lua_State* L) static int MeterString_SetText(lua_State* L) { CMeterString* self = (CMeterString*)tolua_tousertype(L, 1, 0); - const WCHAR* text = to_wchar(L, 2, 0); - self->SetText(text); + std::wstring str = LuaManager::ToWide(L, 2); + self->SetText(str.c_str()); return 0; } diff --git a/Library/lua/glue/LuaMeterWindow.cpp b/Library/lua/glue/LuaMeterWindow.cpp index 0261b36c..f50d96f1 100644 --- a/Library/lua/glue/LuaMeterWindow.cpp +++ b/Library/lua/glue/LuaMeterWindow.cpp @@ -29,7 +29,7 @@ static int MeterWindow_GetSkinName(lua_State* L) { CMeterWindow* self = (CMeterWindow*)tolua_tousertype(L, 1, 0); const std::wstring& val = self->GetSkinName(); - push_wstring(L, val); + LuaManager::PushWide(L, val.c_str()); return 1; } @@ -38,7 +38,7 @@ static int MeterWindow_GetSkinIniFile(lua_State* L) { CMeterWindow* self = (CMeterWindow*)tolua_tousertype(L, 1, 0); const std::wstring& val = self->GetSkinIniFile(); - push_wchar(L, val.c_str()); + LuaManager::PushWide(L, val.c_str()); return 1; } @@ -82,10 +82,10 @@ static int MeterWindow_GetY(lua_State* L) static int MeterWindow_MakePathAbsolute(lua_State* L) { CMeterWindow* self = (CMeterWindow*)tolua_tousertype(L, 1, 0); - const std::wstring path = to_wstring(L, 2, 0); + const std::wstring path = LuaManager::ToWide(L, 2); std::wstring val = self->MakePathAbsolute(path); - push_wstring(L, val); + LuaManager::PushWide(L, val.c_str()); return 1; } @@ -93,7 +93,7 @@ static int MeterWindow_MakePathAbsolute(lua_State* L) static int MeterWindow_GetMeter(lua_State* L) { CMeterWindow* self = (CMeterWindow*)tolua_tousertype(L, 1, 0); - const std::wstring meterName = to_wstring(L, 2, 0); + const std::wstring meterName = LuaManager::ToWide(L, 2); CMeter* meter = self->GetMeter(meterName); if (!meter) @@ -120,7 +120,7 @@ static int MeterWindow_GetMeter(lua_State* L) static int MeterWindow_GetMeasure(lua_State* L) { CMeterWindow* self = (CMeterWindow*)tolua_tousertype(L, 1, 0); - const std::wstring measureName = to_wstring(L, 2, 0); + const std::wstring measureName = LuaManager::ToWide(L, 2); CMeasure* val = self->GetMeasure(measureName); tolua_pushusertype(L, (void*)val, "CMeasure"); @@ -131,13 +131,11 @@ static int MeterWindow_GetMeasure(lua_State* L) static int MeterWindow_GetVariable(lua_State* L) { CMeterWindow* self = (CMeterWindow*)tolua_tousertype(L, 1, 0); - const char* arg = (const char*)tolua_tostring(L, 2, 0); - std::wstring strTmp = ConvertToWide(arg); + std::wstring strTmp = LuaManager::ToWide(L, 2); if (self->GetParser().GetVariable(strTmp, strTmp)) { - std::string val = ConvertToAscii(strTmp.c_str()); - tolua_pushstring(L, val.c_str()); + LuaManager::PushWide(L, strTmp.c_str()); return 1; } else @@ -149,12 +147,10 @@ static int MeterWindow_GetVariable(lua_State* L) static int MeterWindow_ReplaceVariables(lua_State* L) { CMeterWindow* self = (CMeterWindow*)tolua_tousertype(L, 1, 0); - const char* arg = (const char*)tolua_tostring(L, 2, 0); - std::wstring strTmp = ConvertToWide(arg); + std::wstring strTmp = LuaManager::ToWide(L, 2); self->GetParser().ReplaceVariables(strTmp); - std::string val = ConvertToAscii(strTmp.c_str()); - tolua_pushstring(L, val.c_str()); + LuaManager::PushWide(L, strTmp.c_str()); return 1; } @@ -162,8 +158,7 @@ static int MeterWindow_ReplaceVariables(lua_State* L) static int MeterWindow_Bang(lua_State* L) { CMeterWindow* self = (CMeterWindow*)tolua_tousertype(L, 1, 0); - const char* arg = (const char*)tolua_tostring(L, 2, 0); - std::wstring strTmp = ConvertToWide(arg); + std::wstring strTmp = LuaManager::ToWide(L, 2); CConfigParser& parser = self->GetParser(); parser.ReplaceVariables(strTmp);