]> git.lyx.org Git - lyx.git/blobdiff - src/ToolbarBackend.C
remove redundant lyxerr.debugging checks; macro LYXERR already checks whether the...
[lyx.git] / src / ToolbarBackend.C
index f2dd5d8a26ad361283204cf8fee9e09680ae9602..e737a9401636040ee6b267f6f3f78003e53d2ea5 100644 (file)
@@ -79,12 +79,12 @@ void ToolbarBackend::read(LyXLex & lex)
        Toolbar tb;
        tb.name = lex.getString();
        lex.next(true);
-       if (!lex.isOK()) {
+       tb.gui_name = lex.getString();
+       if (!lex) {
                lyxerr << "ToolbarBackend::read: Malformed toolbar "
                        "description " <<  lex.getString() << endl;
                return;
        }
-       tb.gui_name = lex.getString();
 
        bool quit = false;
 
@@ -97,10 +97,10 @@ void ToolbarBackend::read(LyXLex & lex)
                switch (lex.lex()) {
                case TO_ADD:
                        if (lex.next(true)) {
-                               docstring const tooltip = _(lex.getString());
+                               docstring const tooltip = translateIfPossible(lex.getDocString());
                                lex.next(true);
                                string const func_arg = lex.getString();
-                               lyxerr[Debug::PARSER]
+                               LYXERR(Debug::PARSER)
                                        << "ToolbarBackend::read TO_ADD func: `"
                                        << func_arg << '\'' << endl;
 
@@ -212,7 +212,7 @@ void ToolbarBackend::add(Toolbar & tb,
                         FuncRequest const & func, docstring const & tooltip)
 {
        tb.items.push_back(make_pair(func, tooltip));
-       tb.items.back().first.origin = FuncRequest::UI;
+       tb.items.back().first.origin = FuncRequest::TOOLBAR;
 }
 
 
@@ -238,24 +238,24 @@ string const ToolbarBackend::getIcon(FuncRequest const & f)
                if (!f.argument().empty())
                        xpm_name = subst(name + ' ' + to_utf8(f.argument()), ' ', '_');
 
-               fullname = libFileSearch("images", xpm_name, "xpm");
+               fullname = libFileSearch("images", xpm_name, "xpm").absFilename();
 
                if (fullname.empty()) {
                        // try without the argument
-                       fullname = libFileSearch("images", name, "xpm");
+                       fullname = libFileSearch("images", name, "xpm").absFilename();
                }
        }
 
        if (!fullname.empty()) {
-               lyxerr[Debug::GUI] << "Full icon name is `"
+               LYXERR(Debug::GUI) << "Full icon name is `"
                                   << fullname << '\'' << endl;
                return fullname;
        }
 
-       lyxerr[Debug::GUI] << "Cannot find icon for command \""
+       LYXERR(Debug::GUI) << "Cannot find icon for command \""
                           << lyxaction.getActionName(f.action)
                           << '(' << to_utf8(f.argument()) << ")\"" << endl;
-       return libFileSearch("images", "unknown", "xpm");
+       return libFileSearch("images", "unknown", "xpm").absFilename();
 }