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();
}
CT_LABELSTRING_APPENDIX,
CT_PRETTYFORMAT,
CT_INITIALVALUE,
+ CT_GUINAME,
CT_END
};
LexerKeyword counterTags[] = {
{ "end", CT_END },
- { "initialvalue", CT_INITIALVALUE},
+ { "guiname", CT_GUINAME },
+ { "initialvalue", CT_INITIALVALUE},
{ "labelstring", CT_LABELSTRING },
{ "labelstringappendix", CT_LABELSTRING_APPENDIX },
{ "prettyformat", CT_PRETTYFORMAT },
lex.next();
labelstringappendix_ = lex.getDocString();
break;
+ case CT_GUINAME:
+ lex.next();
+ guiname_ = lex.getDocString();
+ break;
case CT_END:
getout = true;
break;
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: "
<< endl;
return;
}
- counterList_[newc] = Counter(masterc, ls, lsa);
+ counterList_[newc] = Counter(masterc, ls, lsa, guiname);
}
}
+docstring const & Counters::guiName(docstring const & cntr) const
+{
+ CounterList::const_iterator it = counterList_.find(cntr);
+ if (it == counterList_.end()) {
+ lyxerr << "step: Counter does not exist: "
+ << to_utf8(cntr) << endl;
+ return empty_docstring();
+ }
+
+ docstring const & guiname = it->second.guiName();
+ if (guiname.empty())
+ return cntr;
+ return guiname;
+}
+
+
void Counters::reset()
{
appendix_ = false;