]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt2/Toolbar_pimpl.C
better selection and scrolling behaviour
[lyx.git] / src / frontends / qt2 / Toolbar_pimpl.C
index 43ba1b62300a0c3441113d80f25009a5ac449de1..330b49cbf3d944416f77852331197b54def55bba 100644 (file)
 #include "support/filetools.h"
 #include "support/lstrings.h"
 
-#include "QtView.h"
-
-#include "Toolbar_pimpl.h"
+#include "ControlMath.h"
 
 #include <boost/tuple/tuple.hpp>
 
+#include "QtView.h"
+#include "Toolbar_pimpl.h"
+
 #include <qtoolbar.h>
 #include <qcombobox.h>
 #include <qtooltip.h>
@@ -47,27 +48,28 @@ QPixmap getIconPixmap(int action)
 {
        FuncRequest f = lyxaction.retrieveActionArg(action);
 
-       string xpm_name;
+       string fullname;
 
        if (f.action == LFUN_INSERT_MATH && !f.argument.empty()) {
-               xpm_name = "math/" + subst(f.argument.substr(1), ' ', '_');
+               fullname = find_xpm(f.argument.substr(1));
        } else {
                string const name = lyxaction.getActionName(f.action);
+               string xpm_name(name);
+
                if (!f.argument.empty())
                        xpm_name = subst(name + ' ' + f.argument, ' ','_');
-               else
-                       xpm_name = name;
+
+               fullname = LibFileSearch("images", xpm_name, "xpm");
        }
 
-       string fullname = LibFileSearch("images", xpm_name, "xpm");
 
        if (!fullname.empty()) {
                lyxerr[Debug::GUI] << "Full icon name is `"
-                                  << fullname << "'" << endl;
+                                  << fullname << '\'' << endl;
                return QPixmap(fullname.c_str());
        }
 
-       lyxerr << "Unable to find icon `" << xpm_name << "'" << endl;
+       lyxerr << "Unable to find icon `" << fullname << '\'' << endl;
        fullname = LibFileSearch("images", "unknown", "xpm");
        if (!fullname.empty()) {
                lyxerr[Debug::GUI] << "Using default `unknown' icon"