]> git.lyx.org Git - features.git/blobdiff - src/insets/InsetInfo.cpp
InsetInfo: Pass back inset-modify that do not target this inset
[features.git] / src / insets / InsetInfo.cpp
index f0f731bff2bfaa3ac98a5d9eda9aa0c762ac8920..b23255aafea8e7e2b03cbceed6e77801397e1ad2 100644 (file)
@@ -624,6 +624,8 @@ bool InsetInfo::getStatus(Cursor & cur, FuncRequest const & cmd,
                return true;
 
        case LFUN_INSET_MODIFY:
+               if (nameTranslator().find(cmd.getArg(0)) == InsetInfoParams::UNKNOWN_INFO)
+                       return Inset::getStatus(cur, cmd, flag);
                if (params_.validateArgument(&buffer(), cmd.argument())) {
                        flag.setEnabled(true);
                        string typestr;
@@ -648,6 +650,10 @@ void InsetInfo::doDispatch(Cursor & cur, FuncRequest & cmd)
 {
        switch (cmd.action()) {
        case LFUN_INSET_MODIFY:
+               if (nameTranslator().find(cmd.getArg(0)) == InsetInfoParams::UNKNOWN_INFO) {
+                       cur.undispatched();
+                       break;
+               }
                cur.recordUndo();
                setInfo(to_utf8(cmd.argument()));
                cur.forceBufferUpdate();
@@ -749,7 +755,15 @@ bool InsetInfo::forceLTR(OutputParams const &) const
 }
 
 
-void InsetInfo::updateBuffer(ParIterator const & it, UpdateType utype) {
+bool InsetInfo::forceLocalFontSwitch() const
+{
+       return params_.type == InsetInfoParams::MENU_INFO
+               || params_.type == InsetInfoParams::SHORTCUTS_INFO
+               || params_.type == InsetInfoParams::L7N_INFO;
+}
+
+
+void InsetInfo::updateBuffer(ParIterator const & it, UpdateType utype, bool const deleted) {
        // If the Buffer is a clone, then we neither need nor want to do any
        // of what follows. We want, rather, just to inherit how things were
        // in the original Buffer. This is especially important for VCS.
@@ -1037,14 +1051,6 @@ void InsetInfo::updateBuffer(ParIterator const & it, UpdateType utype) {
                initialized_ = true;
                FuncRequest func = lyxaction.lookupFunc(params_.name);
                docstring icon_name = frontend::Application::iconName(func, true);
-               // FIXME: We should use the icon directly instead of
-               // going through FileName. The code below won't work
-               // if the icon is embedded in the executable through
-               // the Qt resource system.
-               // This is only a negligible performance problem:
-               // If the installed icon differs from the resource icon the
-               // 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";
@@ -1168,7 +1174,7 @@ void InsetInfo::updateBuffer(ParIterator const & it, UpdateType utype) {
 
        // Just to do something with that string
        LYXERR(Debug::INFO, "info inset text: " << gui);
-       InsetCollapsible::updateBuffer(it, utype);
+       InsetCollapsible::updateBuffer(it, utype, deleted);
 }