dist_pkgdata_DATA = CREDITS autocorrect chkconfig.ltx \
encodings layouttranslations languages latexfonts RELEASE-NOTES \
- symbols syntax.default unicodesymbols
+ symbols syntax.default unicodesymbols images/icon.aliases
# We use DATA now instead of PYTHON because automake 1.11.2 complains.
# Note that we "chmod 755" manually this file in install-data-hook.
#
# Toolbar "name" "GUI Name"
#
-# Only seven commands are allowed inside the Toolbar and End
+# Only eight commands are allowed inside the Toolbar and End
# directives:
# Item "The tooltip" "<action> [<parameter>]" adds an icon to the toolbar performing
# "<action> <parameter>"
# Item Emphasized set-emph
#
# BidiItem is like Item, but an alternative icon (with name ending
-# with "+rtl") will be used <hen the paragraph has a right-to-left
-# layout. If this alternative icon does not exist, the LtR icon will
-# be mirrored instead.
+# with "+rtl") will be used <hen the paragraph has a right-to-left
+# layout. If this alternative icon does not exist, the LtR icon will
+# be mirrored instead.
#
# Layouts adds the layouts combo-box to the toolbar
#
# Minibuffer adds the command buffer (only one may exist)
#
# TableInsert "The tooltip" adds a special widget for quick
-# insertion of tables
+# insertion of tables
#
# PopupMenu "name" "The tooltip"
#
-# ... inserts a button with a popup menu derived from Toolbar "name"
+# ... inserts a button with a popup menu derived from Toolbar "name"
#
# IconPalette "name" "The tooltip"
#
-# ... inserts a button with a popup iconpalette derived from Toolbar "name"
+# ... inserts a button with a popup icon palette derived from Toolbar "name"
#
#
-# The icons are found in the lib/images/ direcory under the name
+# The icons are found in the lib/images/ directory under the name
# action.png or action_parameter.png, except for math-insert, which
# is e.g. lib/image/math/sum.png. Note that some characters are
# replaced (e.g. ')' -> rbracket).
#
-# All other lyx commands will get a "unknown" icon.
+# Note that the lib/images/icon.aliases file can be used to specify
+# fallback icons for some functions.
+#
+# All other LyX commands will get a "unknown" icon.
#
# This is the default toolbar:
}
+namespace {
+
+QString getAlias(QString name) {
+ static bool has_aliases = false;
+ static vector <pair<QString,QString>> aliases;
+ // Initialize aliases list (once).
+ if (!has_aliases) {
+ FileName alfile = libFileSearch("images", "icon.aliases");
+ if (alfile.exists()) {
+ Lexer lex;
+ lex.setFile(alfile);
+ while(lex.isOK()) {
+ string from, to;
+ lex >> from >> to;
+ if (!from.empty())
+ aliases.push_back({toqstr(from), toqstr(to)});
+ }
+ }
+ has_aliases = true;
+ }
+ // check for the following aliases
+ for (auto alias : aliases) {
+ if (name.contains(alias.first))
+ name.replace(alias.first, alias.second);
+ }
+ return name;
+}
+
+}
+
IconInfo iconInfo(FuncRequest const & f, bool unknown, bool rtl)
{
IconInfo res;
name.replace(' ', '_');
name.replace(';', '_');
name.replace('\\', "backslash");
- // avoid duplication for these
- name.replace("dialog-toggle", "dialog-show");
names << name;
+ QString alias = getAlias(name);
+ if (alias != name)
+ names << alias;
// then special default icon for some lfuns
switch (f.action()) {
// next thing to try is function name alone
names << lfunname;
+ QString alias = getAlias(lfunname);
+ if (alias != lfunname)
+ names << alias;
// and finally maybe the unknown icon
if (unknown)