Added: Lua functions for group child debugging
--HG-- branch : develop
This commit is contained in:
parent
215d7bda99
commit
85a806ec44
2 changed files with 53 additions and 21 deletions
|
@ -211,6 +211,11 @@ namespace NLGUI
|
|||
int luaGetNumGroups(CLuaState &ls);
|
||||
int luaGetGroup(CLuaState &ls);
|
||||
|
||||
// debug functions
|
||||
int luaDumpSize(CLuaState &ls);
|
||||
int luaDumpEltsOrder(CLuaState &ls);
|
||||
int luaDumpGroups(CLuaState &ls);
|
||||
|
||||
void setMaxSizeRef(const std::string &maxSizeRef);
|
||||
std::string getMaxSizeRefAsString() const;
|
||||
|
||||
|
@ -223,6 +228,9 @@ namespace NLGUI
|
|||
REFLECT_LUA_METHOD("delGroup", luaDelGroup);
|
||||
REFLECT_LUA_METHOD("getNumGroups", luaGetNumGroups);
|
||||
REFLECT_LUA_METHOD("getGroup", luaGetGroup);
|
||||
REFLECT_LUA_METHOD("dumpSize", luaDumpSize);
|
||||
REFLECT_LUA_METHOD("dumpEltsOrder", luaDumpEltsOrder);
|
||||
REFLECT_LUA_METHOD("dumpGroups", luaDumpGroups);
|
||||
REFLECT_STRING ("left_click", getLeftClickHandler, setLeftClickHandler);
|
||||
REFLECT_STRING ("right_click", getRightClickHandler, setRightClickHandler);
|
||||
REFLECT_STRING ("left_click_params", getLeftClickHandlerParams, setLeftClickHandlerParams);
|
||||
|
@ -274,8 +282,8 @@ namespace NLGUI
|
|||
sint getInsertionOrder(CViewBase *vb) const;
|
||||
|
||||
// for debug only
|
||||
void dumpGroups();
|
||||
void dumpEltsOrder();
|
||||
void dumpGroups() const;
|
||||
void dumpEltsOrder() const;
|
||||
|
||||
virtual void renderWiredQuads(CInterfaceElement::TRenderWired type, const std::string &uiFilter);
|
||||
|
||||
|
|
|
@ -2149,7 +2149,34 @@ namespace NLGUI
|
|||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void CInterfaceGroup::dumpGroups()
|
||||
int CInterfaceGroup::luaDumpSize(CLuaState &ls)
|
||||
{
|
||||
const char *funcName = "dumpSize";
|
||||
CLuaIHM::checkArgCount(ls, funcName, 0);
|
||||
dumpSize();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
int CInterfaceGroup::luaDumpEltsOrder(CLuaState &ls)
|
||||
{
|
||||
const char *funcName = "dumpEltsOrder";
|
||||
CLuaIHM::checkArgCount(ls, funcName, 0);
|
||||
dumpEltsOrder();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
int CInterfaceGroup::luaDumpGroups(CLuaState &ls)
|
||||
{
|
||||
const char *funcName = "dumpGroups";
|
||||
CLuaIHM::checkArgCount(ls, funcName, 0);
|
||||
dumpGroups();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void CInterfaceGroup::dumpGroups() const
|
||||
{
|
||||
nlinfo("Num groups = %d", (int) _ChildrenGroups.size());
|
||||
for(uint k = 0; k < _ChildrenGroups.size(); ++k)
|
||||
|
@ -2166,21 +2193,18 @@ namespace NLGUI
|
|||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void CInterfaceGroup::dumpEltsOrder()
|
||||
void CInterfaceGroup::dumpEltsOrder() const
|
||||
{
|
||||
nlinfo("Num elements = %d", (int) _EltOrder.size());
|
||||
nlinfo("Num elements = %d, num groups = %d", (int) _EltOrder.size(), _ChildrenGroups.size());
|
||||
for(uint k = 0; k < _EltOrder.size(); ++k)
|
||||
{
|
||||
std::string typeName = "???";
|
||||
if (_ChildrenGroups[k])
|
||||
{
|
||||
NLGUI::CViewBase *view = _EltOrder[k];
|
||||
const type_info &ti = typeid(*view);
|
||||
typeName = ti.name();
|
||||
}
|
||||
CInterfaceElement *el = _EltOrder[k];
|
||||
if (el)
|
||||
{
|
||||
std::string typeName;
|
||||
NLGUI::CViewBase *view = _EltOrder[k];
|
||||
const type_info &ti = typeid(*view);
|
||||
typeName = ti.name();
|
||||
nlinfo("Element %d, name = %s, type=%s, x=%d, y=%d, parent_name=%s parentposname=%s xreal=%d, yreal=%d, wreal=%d, hreal=%d",
|
||||
k, el->getId().c_str(), typeName.c_str(), el->getX(), el->getY(), el->getParent() ? el->getParent()->getId().c_str() : "no parent",
|
||||
el->getParentPos() ? el->getParentPos()->getId().c_str() : "parent",
|
||||
|
|
Loading…
Reference in a new issue