[LyX/master] GuiNames for float counters.

Richard Kimberly Heck rikiheck at lyx.org
Sun May 3 02:56:55 UTC 2020


commit 0f4b60c642fe891037b2b1af72047e84b12a6b05
Author: Richard Kimberly Heck <rikiheck at lyx.org>
Date:   Sat May 2 23:11:53 2020 -0400

    GuiNames for float counters.
---
 src/Counters.cpp  |   10 ++++++----
 src/Counters.h    |    5 +++--
 src/TextClass.cpp |    8 +++++---
 3 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/src/Counters.cpp b/src/Counters.cpp
index 42e10e8..15cede1 100644
--- a/src/Counters.cpp
+++ b/src/Counters.cpp
@@ -41,8 +41,9 @@ Counter::Counter()
 
 
 Counter::Counter(docstring const & mc, docstring const & ls,
-                docstring const & lsa)
-	: initial_value_(0), master_(mc), labelstring_(ls), labelstringappendix_(lsa)
+		docstring const & lsa, docstring const & guiname)
+	: initial_value_(0), master_(mc), labelstring_(ls),
+	  labelstringappendix_(lsa), guiname_(guiname)
 {
 	reset();
 }
@@ -211,7 +212,8 @@ Counters::Counters() : appendix_(false), subfloat_(false), longtable_(false)
 void Counters::newCounter(docstring const & newc,
 			  docstring const & masterc,
 			  docstring const & ls,
-			  docstring const & lsa)
+			  docstring const & lsa,
+			  docstring const & guiname)
 {
 	if (!masterc.empty() && !hasCounter(masterc)) {
 		lyxerr << "Master counter does not exist: "
@@ -219,7 +221,7 @@ void Counters::newCounter(docstring const & newc,
 		       << endl;
 		return;
 	}
-	counterList_[newc] = Counter(masterc, ls, lsa);
+	counterList_[newc] = Counter(masterc, ls, lsa, guiname);
 }
 
 
diff --git a/src/Counters.h b/src/Counters.h
index 92643c1..ffc091b 100644
--- a/src/Counters.h
+++ b/src/Counters.h
@@ -35,7 +35,7 @@ public:
 	Counter();
 	///
 	Counter(docstring const & mc, docstring const & ls,
-		docstring const & lsa);
+		docstring const & lsa, docstring const & guiname);
 	/// \return true on success
 	bool read(Lexer & lex);
 	///
@@ -124,7 +124,8 @@ public:
 	void newCounter(docstring const & newc,
 			docstring const & masterc,
 			docstring const & ls,
-			docstring const & lsa);
+			docstring const & lsa,
+			docstring const & guiname);
 	/// Checks whether the given counter exists.
 	bool hasCounter(docstring const & c) const;
 	/// reads the counter name
diff --git a/src/TextClass.cpp b/src/TextClass.cpp
index c8fbfaf..c34f5ca 100644
--- a/src/TextClass.cpp
+++ b/src/TextClass.cpp
@@ -913,7 +913,7 @@ TextClass::ReturnValues TextClass::read(Lexer & lexrc, ReadType rt)
 	// If we do not succeed, then it was not there, which means that
 	// the textclass did not provide the definitions of the standard
 	// insets. So we need to try to load them.
-	int erased = provides_.erase("stdinsets");
+	size_type const erased = provides_.erase("stdinsets");
 	if (!erased) {
 		FileName tmp = libFileSearch("layouts", "stdinsets.inc");
 
@@ -1569,11 +1569,13 @@ bool TextClass::readFloat(Lexer & lexrc)
 		floatlist_.newFloat(fl);
 		// each float has its own counter
 		counters_.newCounter(from_ascii(type), from_ascii(within),
-				      docstring(), docstring());
+				docstring(), docstring(),
+				bformat(_("%1$s (Float)"), from_ascii(name)));
 		// also define sub-float counters
 		docstring const subtype = "sub-" + from_ascii(type);
 		counters_.newCounter(subtype, from_ascii(type),
-				      "\\alph{" + subtype + "}", docstring());
+				"\\alph{" + subtype + "}", docstring(),
+				 bformat(_("Sub-%1$s (Float)"), from_ascii(name)));
 	}
 	return getout;
 }


More information about the lyx-cvs mailing list