as the subject says: this patch makes it possible again to cusomize the toolbars with user defined
images. if nobody objects i'll put it in tomorrow.
bernhard
Index: src/frontends/qt4/GuiToolbar.cpp
===================================================================
--- src/frontends/qt4/GuiToolbar.cpp (revision 21075)
+++ src/frontends/qt4/GuiToolbar.cpp (working copy)
@@ -33,6 +33,7 @@
#include "qt_helpers.h"
#include "InsertTableWidget.h"
+#include "support/filetools.h"
#include "support/lstrings.h"
#include "support/lyxalgo.h" // sorted
@@ -59,6 +60,7 @@
using std::string;
using std::endl;
+using support::libFileSearch;
using support::subst;
using support::compare;
@@ -171,15 +173,20 @@
QPixmap pm;
string name1;
string name2;
+ string path;
+ string fullname;
switch (f.action) {
case LFUN_MATH_INSERT:
- if (!f.argument().empty())
- name1 = "math/" +
find_png(to_utf8(f.argument()).substr(1));
+ if (!f.argument().empty()) {
+ path = "math/";
+ name1 = find_png(to_utf8(f.argument()).substr(1));
+ }
break;
case LFUN_MATH_DELIM:
case LFUN_MATH_BIGDELIM:
- name1 = "math/" + find_png(to_utf8(f.argument()));
+ path = "math/";
+ name1 = find_png(to_utf8(f.argument()));
break;
default:
name2 = lyxaction.getActionName(f.action);
@@ -189,12 +196,20 @@
name1 = subst(name2 + ' ' + to_utf8(f.argument()), ' ',
'_');
}
- if (pm.load(":/images/" + toqstr(name1) + ".png"))
+ if (pm.load(":/images/" + toqstr(path + name1) + ".png"))
return pm;
- if (pm.load(":/images/" + toqstr(name2) + ".png"))
+ if (pm.load(":/images/" + toqstr(path + name2) + ".png"))
return pm;
+ fullname = libFileSearch("images/" + path, name1, "png").absFilename();
+ if (pm.load(toqstr(fullname)))
+ return pm;
+
+ fullname = libFileSearch("images/" + path, name2, "png").absFilename();
+ if (pm.load(toqstr(fullname)))
+ return pm;
+
LYXERR(Debug::GUI) << "Cannot find icon for command \""
<< lyxaction.getActionName(f.action)
<< '(' << to_utf8(f.argument()) << ")\"" << endl;