[LyX/master] Use a lock symbol to indicate when an inset is being edited externally.

Richard Kimberly Heck rikiheck at lyx.org
Sun Dec 6 01:47:03 UTC 2020


commit 877a46f7b0786095e914b0e87eb191d5ce6d87f8
Author: Richard Kimberly Heck <rikiheck at lyx.org>
Date:   Sat Dec 5 21:16:17 2020 -0500

    Use a lock symbol to indicate when an inset is being edited externally.
    
    Good idea from Scott.
---
 src/insets/InsetCollapsible.cpp |    8 +++++---
 src/insets/InsetERT.cpp         |    6 +++---
 src/insets/InsetListings.cpp    |    6 +++---
 3 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/src/insets/InsetCollapsible.cpp b/src/insets/InsetCollapsible.cpp
index 9c095c9..3b739d2 100644
--- a/src/insets/InsetCollapsible.cpp
+++ b/src/insets/InsetCollapsible.cpp
@@ -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);
 }
 
 
diff --git a/src/insets/InsetERT.cpp b/src/insets/InsetERT.cpp
index 113b31b..d7a1a11 100644
--- a/src/insets/InsetERT.cpp
+++ b/src/insets/InsetERT.cpp
@@ -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"));
 }
 
 
diff --git a/src/insets/InsetListings.cpp b/src/insets/InsetListings.cpp
index 25743b9..e930ca8 100644
--- a/src/insets/InsetListings.cpp
+++ b/src/insets/InsetListings.cpp
@@ -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"));
 }
 
 


More information about the lyx-cvs mailing list