merge neutrino-mp menu/buttons/icons changes, (C) martii

This commit is contained in:
[CST] Focus
2014-07-17 14:32:44 +04:00
parent 9f1c7f2800
commit cf91f2eccb
48 changed files with 1285 additions and 970 deletions

View File

@@ -1086,13 +1086,24 @@ int CLuaInstance::MenuAddItem(lua_State *L)
} else
m->m->addItem(GenericMenuSeparatorLine);
} else {
std::string right_icon; tableLookup(L, "right_icon", right_icon);
std::string right_icon_str; tableLookup(L, "right_icon", right_icon_str);
std::string action; tableLookup(L, "action", action);
std::string value; tableLookup(L, "value", value);
std::string hint; tableLookup(L, "hint", hint);
std::string hint_icon; tableLookup(L, "hint_icon", hint_icon);
std::string hint_icon_str; tableLookup(L, "hint_icon", hint_icon_str);
std::string id; tableLookup(L, "id", id);
std::string tmp;
char *right_icon = NULL;
if (!right_icon_str.empty()) {
right_icon = strdup(right_icon_str.c_str());
m->tofree.push_back(right_icon);
}
char *hint_icon = NULL;
if (!hint_icon_str.empty()) {
hint_icon = strdup(hint_icon_str.c_str());
m->tofree.push_back(hint_icon);
}
int directkey = CRCInput::RC_nokey; tableLookup(L, "directkey", directkey);
int pulldown = false; tableLookup(L, "pulldown", pulldown);
tmp = "true";
@@ -1107,8 +1118,8 @@ int CLuaInstance::MenuAddItem(lua_State *L)
if (type == "forwarder") {
b->str_val = value;
CLuaMenuForwarder *forwarder = new CLuaMenuForwarder(L, action, id);
mi = new CMenuForwarder(b->name, enabled, b->str_val, forwarder, NULL/*ActionKey*/, directkey, icon.c_str(), right_icon.c_str());
if (!hint.empty() || !hint_icon.empty())
mi = new CMenuForwarder(b->name, enabled, b->str_val, forwarder, NULL/*ActionKey*/, directkey, icon.c_str(), right_icon);
if (!hint.empty() || hint_icon)
mi->setHint(hint_icon, hint);
m->targets.push_back(forwarder);
} else if (type == "chooser") {
@@ -1161,7 +1172,7 @@ int CLuaInstance::MenuAddItem(lua_State *L)
int sms = 0; tableLookup(L, "sms", sms);
int size = 30; tableLookup(L, "size", size);
CLuaMenuStringinput *stringinput = new CLuaMenuStringinput(L, action, id, b->name.c_str(), &b->str_val, size, valid_chars, m->observ, icon.c_str(), sms);
mi = new CMenuForwarder(b->name, enabled, b->str_val, stringinput, NULL/*ActionKey*/, directkey, icon.c_str(), right_icon.c_str());
mi = new CMenuForwarder(b->name, enabled, b->str_val, stringinput, NULL/*ActionKey*/, directkey, icon.c_str(), right_icon);
m->targets.push_back(stringinput);
} else if (type == "filebrowser") {
b->str_val = value;
@@ -1177,12 +1188,12 @@ int CLuaInstance::MenuAddItem(lua_State *L)
}
lua_pop(L, 1);
mi = new CMenuForwarder(b->name, enabled, b->str_val, filebrowser, NULL/*ActionKey*/, directkey, icon.c_str(), right_icon.c_str());
mi = new CMenuForwarder(b->name, enabled, b->str_val, filebrowser, NULL/*ActionKey*/, directkey, icon.c_str(), right_icon);
m->targets.push_back(filebrowser);
}
if (mi) {
mi->setLua(L, action, id);
if (!hint.empty() || !hint_icon.empty())
if (!hint.empty() || hint_icon)
mi->setHint(hint_icon, hint);
m->m->addItem(mi);
}