mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-26 11:16:55 +00:00
Fix missing symbols in math completer
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.
This commit is contained in:
parent
f9f05c364b
commit
7adc6125f7
@ -235,6 +235,8 @@ public:
|
||||
|
||||
/// \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()
|
||||
|
@ -1079,6 +1079,12 @@ docstring Application::iconName(FuncRequest const & f, bool unknown)
|
||||
}
|
||||
|
||||
|
||||
docstring Application::mathIcon(docstring const & c)
|
||||
{
|
||||
return qstring_to_ucs4(findPng(toqstr(c)));
|
||||
}
|
||||
|
||||
|
||||
FuncStatus GuiApplication::getStatus(FuncRequest const & cmd) const
|
||||
{
|
||||
FuncStatus status;
|
||||
|
@ -137,6 +137,8 @@ public:
|
||||
// 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);
|
||||
|
@ -54,6 +54,7 @@
|
||||
#include "OutputParams.h"
|
||||
#include "Text.h"
|
||||
|
||||
#include "frontends/Application.h"
|
||||
#include "frontends/Clipboard.h"
|
||||
#include "frontends/Painter.h"
|
||||
#include "frontends/Selection.h"
|
||||
@ -2240,7 +2241,10 @@ std::string MathCompletionList::icon(size_t idx) const
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user