The math icons for the symbol image in the math completer were hardcoded to the
command names. This is wrong for some icons for various reasons, e.g. the case
insensitivity of windows file systems. Therefore we have to use the replacement
list which is also used for the toolbar icons. Bug #3538 is not closed because
of this problem, but IMHO it has nothing to do with this bug, it is a more
general one.
/// \return the icon file name for the given action.
static docstring iconName(FuncRequest const & f, bool unknown);
+ /// \return the math icon name for the given command.
+ static docstring mathIcon(docstring const & c);
/// Handle a accented char key sequence
/// FIXME: this is only needed for LFUN_ACCENT_* in Text::dispatch()
}
+docstring Application::mathIcon(docstring const & c)
+{
+ return qstring_to_ucs4(findPng(toqstr(c)));
+}
+
+
FuncStatus GuiApplication::getStatus(FuncRequest const & cmd) const
{
FuncStatus status;
// get icon from cache
QPixmap scaled;
QString const name = ":" + toqstr(list_->icon(index.row()));
+ if (name == ":")
+ return scaled;
if (!QPixmapCache::find("completion" + name, scaled)) {
// load icon from disk
QPixmap p = QPixmap(name);
#include "OutputParams.h"
#include "Text.h"
+#include "frontends/Application.h"
#include "frontends/Clipboard.h"
#include "frontends/Painter.h"
#include "frontends/Selection.h"
cmd = locals[idx];
// get the icon resource name by stripping the backslash
- return "images/math/" + to_utf8(cmd.substr(1)) + ".png";
+ docstring icon_name = frontend::Application::mathIcon(cmd.substr(1));
+ if (icon_name.empty())
+ return std::string();
+ return "images/math/" + to_utf8(icon_name);
}
std::vector<docstring> MathCompletionList::globals;