]> git.lyx.org Git - features.git/commitdiff
Use a lock symbol to indicate when an inset is being edited externally.
authorRichard Kimberly Heck <rikiheck@lyx.org>
Sun, 6 Dec 2020 02:16:17 +0000 (21:16 -0500)
committerRichard Kimberly Heck <rikiheck@lyx.org>
Sun, 6 Dec 2020 02:16:17 +0000 (21:16 -0500)
Good idea from Scott.

src/insets/InsetCollapsible.cpp
src/insets/InsetERT.cpp
src/insets/InsetListings.cpp

index 9c095c937a614738845cee2125f5fea8c2578c2e..3b739d28c8985d2f72a890f0a967dc4cc38f1715 100644 (file)
@@ -648,11 +648,11 @@ bool InsetCollapsible::getStatus(Cursor & cur, FuncRequest const & cmd,
                return true;
 
        case LFUN_INSET_EDIT:
-               flag.setEnabled(getLayout().editExternally() && tempfile_ == 0);
+               flag.setEnabled(getLayout().editExternally() && tempfile_ == nullptr);
                return true;
 
        case LFUN_INSET_END_EDIT:
-               flag.setEnabled(getLayout().editExternally() && tempfile_ != 0);
+               flag.setEnabled(getLayout().editExternally() && tempfile_ != nullptr);
                return true;
 
        default:
@@ -681,11 +681,13 @@ docstring const InsetCollapsible::buttonLabel(BufferView const & bv) const
        // ✎ U+270E LOWER RIGHT PENCIL
        docstring const indicator = (isChanged() && geometry(bv) == ButtonOnly)
                ? docstring(1, 0x270E) : docstring();
+       // U+1F512 LOCK
+       docstring const locked = tempfile_ ? docstring(1, 0x1F512) : docstring();
        InsetLayout const & il = getLayout();
        docstring const label = getLabel();
        if (!il.contentaslabel() || geometry(bv) != ButtonOnly)
                return indicator + label;
-       return indicator + getNewLabel(label);
+       return locked + indicator + getNewLabel(label);
 }
 
 
index 113b31b1556ae245270ba49bfe406b2e1e083e0b..d7a1a11832de1e6aa57b1e0f49227371444b32d5 100644 (file)
@@ -168,10 +168,10 @@ bool InsetERT::getStatus(Cursor & cur, FuncRequest const & cmd,
 
 docstring const InsetERT::buttonLabel(BufferView const & bv) const
 {
+       docstring const locked = tempfile_ ? docstring(1, 0x1F512) : docstring();
        if (decoration() == InsetLayout::CLASSIC)
-               return isOpen(bv) ? _("ERT") : getNewLabel(_("ERT"));
-       else
-               return getNewLabel(_("ERT"));
+               return locked + (isOpen(bv) ? _("ERT") : getNewLabel(_("ERT")));
+       return locked + getNewLabel(_("ERT"));
 }
 
 
index 25743b909c2f54448ae38370eab08ef29560a92c..e930ca80d4735d72ecd57b9e6baab2130ae06621 100644 (file)
@@ -606,10 +606,10 @@ bool InsetListings::getStatus(Cursor & cur, FuncRequest const & cmd,
 docstring const InsetListings::buttonLabel(BufferView const & bv) const
 {
        // FIXME UNICODE
+       docstring const locked = tempfile_ ? docstring(1, 0x1F512) : docstring();
        if (decoration() == InsetLayout::CLASSIC)
-               return isOpen(bv) ? _("Listing") : getNewLabel(_("Listing"));
-       else
-               return getNewLabel(_("Listing"));
+               return locked + (isOpen(bv) ? _("Listing") : getNewLabel(_("Listing")));
+       return locked + getNewLabel(_("Listing"));
 }