]> git.lyx.org Git - lyx.git/commitdiff
Allow using icon names in InsetInfo
authorEnrico Forestieri <forenr@lyx.org>
Sat, 28 Mar 2015 11:45:20 +0000 (12:45 +0100)
committerEnrico Forestieri <forenr@lyx.org>
Sat, 28 Mar 2015 11:45:20 +0000 (12:45 +0100)
Currently, only lfun names are accepeted but there are cases in which
the lfun name does not map directly to an icon. Fore example, in the
outliner, the icon named "promote" is used for the lfun outline-out.
As a result, a graphics inset is used in the documentation for describing
the corresponding icon. Now one can also use an icon name. The argument
of "info-isert icon" is firstly lookep up as an lfun. If no corresponding
icon is found, the argument is taken as the name of the icon. If no such
icon exists, the "unknown" icon is used.

src/LyXAction.cpp
src/insets/InsetInfo.cpp

index 85059406dbc75e04fd75cbc09184180fa0f6d859..4ac1a0e95ba5a13dbb2fd24fa986f991b9728c95 100644 (file)
@@ -418,7 +418,7 @@ void LyXAction::init()
                      package: name of latex package (e.g. listings) \n
                      textclass: name of textclass (e.g. article) \n
                      menu: name of lfun used in menu  \n
-                     icon: icon of lfun used in toolbar \n
+                     icon: icon of lfun used in toolbar or direct icon name\n
                      buffer: "name"|"path"|"class"|"vcs-tree-revision"|
                               "vcs-revision"|"vcs-author"|"vcs-date"|"vcs-time"
  * \li Sample: command-sequence info-insert buffer path; info-insert buffer name
index 98fe7d7c9b21caabb0ddfde97a848375aca91a4d..acf073aa107103064ee5fd4e67d8a4e1fb1e1359 100644 (file)
@@ -410,6 +410,12 @@ void InsetInfo::updateInfo()
                // installed one is preferred anyway, and all icons that are
                // embedded in the resources are installed as well.
                FileName file(to_utf8(icon_name));
+               if (file.onlyFileNameWithoutExt() == "unknown") {
+                       string dir = "images";
+                       FileName file2(imageLibFileSearch(dir, name_, "svgz,png"));
+                       if (!file2.empty())
+                               file = file2;
+               }
                if (!file.exists())
                        break;
                int percent_scale = 100;