GuiNames for float counters.

This commit is contained in:
Richard Kimberly Heck 2020-05-02 23:11:53 -04:00
parent a7e26710cb
commit 0f4b60c642
3 changed files with 14 additions and 9 deletions

View File

@ -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);
}

View File

@ -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

View File

@ -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;
}