commit 5f3bb073bb7890377c98da8c09204660fa061812
Author: Enrico Forestieri <[email protected]>
Date:   Sat Mar 28 20:36:05 2015 +0100

    Allow using icon names in InsetInfo
    
    Currently, only lfun names are accepeted but there are cases in which
    the lfun name does not map directly to an icon. For 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 first looked 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.

diff --git a/src/LyXAction.cpp b/src/LyXAction.cpp
index 7d84cdc..76e6032 100644
--- a/src/LyXAction.cpp
+++ b/src/LyXAction.cpp
@@ -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
diff --git a/src/insets/InsetInfo.cpp b/src/insets/InsetInfo.cpp
index d914d94..cfee1d2 100644
--- a/src/insets/InsetInfo.cpp
+++ b/src/insets/InsetInfo.cpp
@@ -405,6 +405,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_, "png"));
+                       if (!file2.empty())
+                               file = file2;
+               }
                if (!file.exists())
                        break;
                InsetGraphics * inset = new InsetGraphics(buffer_);
diff --git a/status.21x b/status.21x
index 59c6491..1a44c61 100644
--- a/status.21x
+++ b/status.21x
@@ -57,6 +57,8 @@ What's new
 - Fix display of limits for some math operators provided by stmaryrd.sty
   (bug 9458).
 
+- Allow using icon names other than lfun's as argument for "info-insert icon".
+
 
 * DOCUMENTATION AND LOCALIZATION
 

Reply via email to