mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-09 02:28:19 +00:00
Keep sort order of counter actions
This commit is contained in:
parent
5f5cb7eea7
commit
5171b7ea6c
@ -48,7 +48,7 @@ GuiCounter::GuiCounter(GuiView & lv, QWidget * parent) :
|
||||
this, SIGNAL(changed()));
|
||||
|
||||
// These are hardcoded and do not change
|
||||
std::map<std::string, std::string> const & ct =
|
||||
std::vector<std::pair<std::string, std::string>> const & ct =
|
||||
InsetCounter::counterTable;
|
||||
actionCB->clear();
|
||||
for (auto const & c : ct) {
|
||||
|
@ -58,7 +58,7 @@ InsetCounter::InsetCounter(InsetCounter const & ir)
|
||||
{}
|
||||
|
||||
|
||||
const map<string, string> InsetCounter::counterTable =
|
||||
const vector<pair<string, string>> InsetCounter::counterTable =
|
||||
{
|
||||
{"set", N_("Set counter to ...")},
|
||||
{"addto", N_("Increase counter by ...")},
|
||||
@ -68,8 +68,13 @@ const map<string, string> InsetCounter::counterTable =
|
||||
};
|
||||
|
||||
|
||||
bool InsetCounter::isCompatibleCommand(string const & s) {
|
||||
return counterTable.count(s);
|
||||
bool InsetCounter::isCompatibleCommand(string const & s)
|
||||
{
|
||||
for (auto & i : counterTable) {
|
||||
if (i.first == s)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -204,9 +209,12 @@ void InsetCounter::updateBuffer(ParIterator const &, UpdateType, bool const)
|
||||
string const cmd = getCmdName();
|
||||
docstring cntr = getParam("counter");
|
||||
Counters & cnts = buffer().params().documentClass().counters();
|
||||
map<string, string>::const_iterator cit = counterTable.find(cmd);
|
||||
LASSERT(cit != counterTable.end(), return);
|
||||
string const label = cit->second;
|
||||
string label;
|
||||
for (auto & i : counterTable) {
|
||||
if (i.first == cmd)
|
||||
label = i.second;
|
||||
}
|
||||
LASSERT(!label.empty(), return);
|
||||
docstring const tlabel = translateIfPossible(from_ascii(label));
|
||||
|
||||
if (cmd == "set") {
|
||||
|
@ -62,7 +62,7 @@ public:
|
||||
static bool isCompatibleCommand(std::string const & s);
|
||||
//@}
|
||||
/// keys are commands, values are GUI strings
|
||||
static const std::map<std::string, std::string> counterTable;
|
||||
static const std::vector<std::pair<std::string, std::string>> counterTable;
|
||||
static const std::map<std::string, std::string> valueTable;
|
||||
|
||||
protected:
|
||||
|
Loading…
Reference in New Issue
Block a user