using lyx::support::compare_ascii_no_case;
using lyx::support::getVectorFromString;
-using lyx::support::LibFileSearch;
+using lyx::support::libFileSearch;
using lyx::support::subst;
using std::endl;
using std::make_pair;
-
+using std::string;
using std::vector;
Toolbar tb;
tb.name = lex.getString();
+ lex.next(true);
+ if (!lex.isOK()) {
+ lyxerr << "ToolbarBackend::read: Malformed toolbar "
+ "description " << lex.getString() << endl;
+ return;
+ }
+ tb.gui_name = lex.getString();
bool quit = false;
lyxerr[Debug::PARSER]
<< "ToolbarBackend::read TO_ADD func: `"
<< func_arg << '\'' << endl;
- // Split func_arg in function and arg.
- string::size_type sp = func_arg.find(' ');
- if (sp != string::npos) {
-
- string const func =
- func_arg.substr(0, sp);
- string const arg =
- func_arg.substr(sp + 1,
- string::npos);
-
- kb_action const tf =
- lyxaction.LookupFunc(func);
-
- add(tb, FuncRequest(tf, arg), tooltip);
- } else {
- kb_action const tf = lyxaction.LookupFunc(func_arg);
- add(tb, FuncRequest(tf), tooltip);
-
- }
+ FuncRequest func =
+ lyxaction.lookupFunc(func_arg);
+ add(tb, func, tooltip);
}
break;
FuncRequest const & func, string const & tooltip)
{
tb.items.push_back(make_pair(func, tooltip));
+ tb.items.back().first.origin = FuncRequest::UI;
}
string const ToolbarBackend::getIcon(FuncRequest const & f)
{
+ using lyx::frontend::find_xpm;
+
string fullname;
if (f.action == LFUN_INSERT_MATH) {
if (!f.argument.empty())
xpm_name = subst(name + ' ' + f.argument, ' ', '_');
- fullname = LibFileSearch("images", xpm_name, "xpm");
+ fullname = libFileSearch("images", xpm_name, "xpm");
if (fullname.empty()) {
// try without the argument
- fullname = LibFileSearch("images", name, "xpm");
+ fullname = libFileSearch("images", name, "xpm");
}
}
lyxerr[Debug::GUI] << "Cannot find icon for command \""
<< lyxaction.getActionName(f.action)
<< '(' << f.argument << ")\"" << endl;
- return LibFileSearch("images", "unknown", "xpm");
+ return libFileSearch("images", "unknown", "xpm");
}