mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 18:08:10 +00:00
Assign equation numbers in updateBuffer instead of
addToToc so that they can be used in updateToc to assign label cross-refs
This commit is contained in:
parent
89a479f60d
commit
ca3004fc67
@ -32,6 +32,8 @@ public:
|
|||||||
///
|
///
|
||||||
docstring const & formattedCounter() const { return formatted_counter_; }
|
docstring const & formattedCounter() const { return formatted_counter_; }
|
||||||
///
|
///
|
||||||
|
void setCounterValue(docstring cv) { counter_value_ = cv; }
|
||||||
|
///
|
||||||
void setPrettyCounter(docstring pc) { pretty_counter_ = pc; }
|
void setPrettyCounter(docstring pc) { pretty_counter_ = pc; }
|
||||||
///
|
///
|
||||||
void setFormattedCounter(docstring fc) { formatted_counter_ = fc; }
|
void setFormattedCounter(docstring fc) { formatted_counter_ = fc; }
|
||||||
|
@ -274,6 +274,32 @@ void InsetMathHull::updateBuffer(ParIterator const & it, UpdateType utype, bool
|
|||||||
if (label_[i])
|
if (label_[i])
|
||||||
label_[i]->updateBuffer(it, utype, deleted);
|
label_[i]->updateBuffer(it, utype, deleted);
|
||||||
}
|
}
|
||||||
|
// set up equation numbers
|
||||||
|
|
||||||
|
// compute first and last item
|
||||||
|
row_type first = nrows();
|
||||||
|
for (row_type row = 0; row != nrows(); ++row)
|
||||||
|
if (numbered(row)) {
|
||||||
|
first = row;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (first != nrows()) {
|
||||||
|
row_type last = nrows() - 1;
|
||||||
|
for (; last != 0; --last)
|
||||||
|
if (numbered(last))
|
||||||
|
break;
|
||||||
|
|
||||||
|
for (row_type row = 0; row != nrows(); ++row) {
|
||||||
|
if (!numbered(row))
|
||||||
|
continue;
|
||||||
|
if (label_[row]) {
|
||||||
|
label_[row]->setCounterValue(numbers_[row]);
|
||||||
|
label_[row]->setPrettyCounter("(" + numbers_[row] + ")");
|
||||||
|
label_[row]->setFormattedCounter("(" + numbers_[row] + ")");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// pass down
|
// pass down
|
||||||
InsetMathGrid::updateBuffer(it, utype, deleted);
|
InsetMathGrid::updateBuffer(it, utype, deleted);
|
||||||
}
|
}
|
||||||
@ -305,7 +331,6 @@ void InsetMathHull::addToToc(DocIterator const & pit, bool output_active,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
TocBuilder & b = backend.builder("equation");
|
TocBuilder & b = backend.builder("equation");
|
||||||
// add equation numbers
|
|
||||||
b.pushItem(pit, docstring(), output_active);
|
b.pushItem(pit, docstring(), output_active);
|
||||||
if (first != last)
|
if (first != last)
|
||||||
b.argumentItem(bformat(from_ascii("(%1$s-%2$s)"),
|
b.argumentItem(bformat(from_ascii("(%1$s-%2$s)"),
|
||||||
@ -321,8 +346,6 @@ void InsetMathHull::addToToc(DocIterator const & pit, bool output_active,
|
|||||||
if (!numbered(row))
|
if (!numbered(row))
|
||||||
continue;
|
continue;
|
||||||
if (label_[row]) {
|
if (label_[row]) {
|
||||||
label_[row]->setPrettyCounter(_("Equation") + " " + numbers_[row]);
|
|
||||||
label_[row]->setFormattedCounter(_("Equation") + " " + numbers_[row]);
|
|
||||||
label_[row]->addToToc(pit, output_active, utype, backend);
|
label_[row]->addToToc(pit, output_active, utype, backend);
|
||||||
}
|
}
|
||||||
docstring label = nicelabel(row);
|
docstring label = nicelabel(row);
|
||||||
|
Loading…
Reference in New Issue
Block a user