]> git.lyx.org Git - lyx.git/blobdiff - src/ToolbarBackend.C
Fix bug 2485 and crash on middle mouse paste on math
[lyx.git] / src / ToolbarBackend.C
index 01cad0b86b886240f6ae501aa18297975547540f..eaf6a61dbe66fec6802f7e79557064a402652012 100644 (file)
 
 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;
 
 
@@ -75,6 +75,13 @@ void ToolbarBackend::read(LyXLex & lex)
 
        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;
 
@@ -200,11 +207,14 @@ void ToolbarBackend::add(Toolbar & tb,
                         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) {
@@ -219,11 +229,11 @@ string const ToolbarBackend::getIcon(FuncRequest const & f)
                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");
                }
        }
 
@@ -236,5 +246,5 @@ string const ToolbarBackend::getIcon(FuncRequest const & f)
        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");
 }