]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetInfo.cpp
Circumvent odd stmary font metrics (part of #9990).
[lyx.git] / src / insets / InsetInfo.cpp
index ac2fd03143be197d6fcc7e0d140283b439b050d3..2f26c971f864b8293b3d146e59fb038d21775f23 100644 (file)
@@ -94,7 +94,6 @@ NameTranslator const & nameTranslator()
 InsetInfo::InsetInfo(Buffer * buf, string const & name) 
        : InsetCollapsable(buf), type_(UNKNOWN_INFO), name_()
 {
-       setAutoBreakRows(true);
        setInfo(name);
        status_ = Collapsed;
 }
@@ -170,12 +169,20 @@ bool InsetInfo::validateModifyArgument(docstring const & arg) const
 
        case SHORTCUT_INFO:
        case SHORTCUTS_INFO:
-       case MENU_INFO:
-       case ICON_INFO: {
+       case MENU_INFO: {
                FuncRequest func = lyxaction.lookupFunc(name);
                return func.action() != LFUN_UNKNOWN_ACTION;
        }
 
+       case ICON_INFO: {
+               FuncCode const action = lyxaction.lookupFunc(name).action();
+               if (action == LFUN_UNKNOWN_ACTION) {
+                       string dir = "images";
+                       return !imageLibFileSearch(dir, name, "svgz,png").empty();
+               }
+               return true;
+       }
+
        case LYXRC_INFO: {
                ostringstream oss;
                lyxrc.write(oss, true, name);
@@ -420,6 +427,10 @@ void InsetInfo::updateInfo()
                        break;
                int percent_scale = 100;
                if (use_gui) {
+                       // Compute the scale factor for the icon such that its
+                       // width on screen is equal to 1em in pixels.
+                       // The scale factor is rounded to the integer nearest
+                       // to the float value of the ratio 100*iconsize/imgsize.
                        int imgsize = QImage(toqstr(file.absFileName())).width();
                        if (imgsize > 0) {
                                int iconsize = Length(1, Length::EM).inPixels(1);