const map<string, string> InsetCounter::counterTable =
{
- {"set", N_("Set")},
- {"addto", N_("Add To")},
- {"reset", N_("Reset")},
- {"save", N_("Save")},
- {"restore", N_("Restore")},
- {"value", N_("Value")}
+ {"set", N_("Set Counter To")},
+ {"addto", N_("Increase Counter By")},
+ {"reset", N_("Reset Counter To 0")},
+ {"save", N_("Save Value of Counter")},
+ {"restore", N_("Restore Value of Counter")},
};
if (param_info_.empty()) {
param_info_.add("counter", ParamInfo::LYX_INTERNAL);
param_info_.add("value", ParamInfo::LYX_INTERNAL);
- param_info_.add("vtype", ParamInfo::LYX_INTERNAL);
param_info_.add("lyxonly", ParamInfo::LYX_INTERNAL);
}
return param_info_;
cnts.restoreValue(cntr);
os << "\\setcounter{" << cntr
<< "{\\value{" << lyxSaveCounter() << "}}";
- } else if (cmd == "value") {
- os << "\\value{" << cntr << "}";
}
}
}
-void InsetCounter::trackCounters(string const & cmd) const
-{
- Counters & cnts = buffer().params().documentClass().counters();
- docstring cntr = getParam("counter");
- if (cmd == "set") {
- docstring const & val = getParam("value");
- cnts.set(cntr, convert<int>(val));
- } else if (cmd == "addto") {
- docstring const & val = getParam("value");
- cnts.addto(cntr, convert<int>(val));
- } else if (cmd == "reset") {
- cnts.reset(cntr);
- } else if (cmd == "save") {
- cnts.saveValue(cntr);
- } else if (cmd == "restore") {
- cnts.restoreValue(cntr);
- }
-}
-
-
+#if 0
+// save this code until we get it working in InsetInfo
const map<string, string> InsetCounter::valueTable =
{
{"Roman", N_("Roman Uppercase")},
LATTEST(false);
return empty_docstring();
}
+#endif
+void InsetCounter::trackCounters(string const & cmd) const
+{
+ Counters & cnts = buffer().params().documentClass().counters();
+ docstring cntr = getParam("counter");
+ if (cmd == "set") {
+ docstring const & val = getParam("value");
+ cnts.set(cntr, convert<int>(val));
+ } else if (cmd == "addto") {
+ docstring const & val = getParam("value");
+ cnts.addto(cntr, convert<int>(val));
+ } else if (cmd == "reset") {
+ cnts.reset(cntr);
+ } else if (cmd == "save") {
+ cnts.saveValue(cntr);
+ } else if (cmd == "restore") {
+ cnts.restoreValue(cntr);
+ }
+}
-int InsetCounter::docbook(odocstream & os, OutputParams const &) const
+int InsetCounter::docbook(odocstream &, OutputParams const &) const
{
// Here, we need to track counter values ourselves,
// since unlike in the LaTeX case, there is no external
// mechanism for doing that.
- string const cmd = getCmdName();
- if (cmd == "value") {
- docstring cntr = getParam("counter");
- Counters & cnts = buffer().params().documentClass().counters();
- if (cnts.hasCounter(cntr))
- os << cnts.value(cntr);
- } else
- trackCounters(cmd);
-
+ trackCounters(getCmdName());
return 0;
}
-docstring InsetCounter::xhtml(XHTMLStream & xs, OutputParams const &) const
+docstring InsetCounter::xhtml(XHTMLStream &, OutputParams const &) const
{
// Here, we need to track counter values ourselves,
// since unlike in the LaTeX case, there is no external
// mechanism for doing that.
- string const cmd = getCmdName();
- if (cmd == "value") {
- docstring cntr = getParam("counter");
- Counters & cnts = buffer().params().documentClass().counters();
- if (cnts.hasCounter(cntr))
- xs << cnts.value(cntr);
- } else
- trackCounters(cmd);
-
+ trackCounters(getCmdName());
return docstring();
}
docstring const & val = getParam("value");
cnts.addto(cntr, convert<int>(val));
screen_label_ = bformat(_("Counter: Add to %1$s"), cntr);
- tooltip_ = bformat(_("Add to value of counter %1$s"), cntr);
+ tooltip_ = bformat(_("Add %1$s to value of counter %2$s"), val, cntr);
} else if (cmd == "reset") {
cnts.reset(cntr);
screen_label_ = bformat(_("Counter: Reset %1$s"), cntr);
cnts.restoreValue(cntr);
screen_label_ = bformat(_("Counter: Restore %1$s"), cntr);
tooltip_ = bformat(_("Restore value of counter %1$s"), cntr);
- } else if (cmd == "value") {
- screen_label_ = bformat(_("Counter: Value %1$s"), cntr);
- tooltip_ = bformat(_("Print value of counter %1$s"), cntr);
}
-
}