mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
- 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
This commit is contained in:
parent
aa45f4fc7b
commit
754c33f82f
@ -368,6 +368,13 @@ void CDialogAbout::CTabLog::Initialize()
|
||||
lvc.pszText = L"Message";
|
||||
ListView_InsertColumn(item, 2, &lvc);
|
||||
|
||||
// Add stored entires
|
||||
std::list<CRainmeter::LOG_INFO>::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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -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
|
||||
|
@ -759,14 +759,6 @@
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">../StdAfx.h</PrecompiledHeaderFile>
|
||||
</ClCompile>
|
||||
<ClCompile Include="lua\LuaPush.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../StdAfx.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">../StdAfx.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">../StdAfx.h</PrecompiledHeaderFile>
|
||||
</ClCompile>
|
||||
<ClCompile Include="lua\LuaScript.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../StdAfx.h</PrecompiledHeaderFile>
|
||||
@ -914,7 +906,6 @@
|
||||
<ClInclude Include="ccalc-0.5.1\pack.h" />
|
||||
<ClInclude Include="ccalc-0.5.1\strmap.h" />
|
||||
<ClInclude Include="lua\LuaManager.h" />
|
||||
<ClInclude Include="lua\LuaPush.h" />
|
||||
<ClInclude Include="lua\LuaScript.h" />
|
||||
<ClInclude Include="lua\include\lua.hpp" />
|
||||
<ClInclude Include="lua\lua\luaconf.h" />
|
||||
|
@ -162,9 +162,6 @@
|
||||
<ClCompile Include="lua\LuaManager.cpp">
|
||||
<Filter>Lua</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="lua\LuaPush.cpp">
|
||||
<Filter>Lua</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="lua\LuaScript.cpp">
|
||||
<Filter>Lua</Filter>
|
||||
</ClCompile>
|
||||
@ -505,9 +502,6 @@
|
||||
<ClInclude Include="lua\LuaManager.h">
|
||||
<Filter>Lua</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="lua\LuaPush.h">
|
||||
<Filter>Lua</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="lua\LuaScript.h">
|
||||
<Filter>Lua</Filter>
|
||||
</ClInclude>
|
||||
|
@ -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<DELAYED_LOG_INFO> 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<DELAYED_LOG_INFO> 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;
|
||||
|
@ -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();
|
||||
|
@ -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());
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -236,6 +236,7 @@ public:
|
||||
void SetDisableDragging(bool dragging);
|
||||
|
||||
void AddAboutLogInfo(int level, LPCWSTR time, LPCWSTR message);
|
||||
const std::list<LOG_INFO>& GetAboutLogData() { return m_LogData; }
|
||||
|
||||
void SetDebug(bool debug);
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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)<abs(lo))
|
||||
return 1;
|
||||
if (lua_isnil(L,lo) || lua_isstring(L,lo))
|
||||
return 1;
|
||||
|
||||
err->index = lo;
|
||||
err->array = 0;
|
||||
err->type = type;
|
||||
return 0;
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
#ifndef __LUAPUSH_H__
|
||||
#define __LUAPUSH_H__
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string>
|
||||
|
||||
#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
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user