mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 10:58:52 +00:00
Fix display of counters for included listings.
This commit is contained in:
parent
fe99f7b01e
commit
91bd457a67
@ -79,6 +79,7 @@ End
|
|||||||
|
|
||||||
Counter listing
|
Counter listing
|
||||||
GuiName Listing
|
GuiName Listing
|
||||||
|
PrettyFormat "Listing ##"
|
||||||
End
|
End
|
||||||
|
|
||||||
Counter equation
|
Counter equation
|
||||||
|
@ -1444,22 +1444,28 @@ void InsetInclude::updateBuffer(ParIterator const & it, UpdateType utype, bool c
|
|||||||
if (!isListings(params()))
|
if (!isListings(params()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Buffer const & master = *buffer().masterBuffer();
|
||||||
|
listings_label_ = master.B_("Program Listing");
|
||||||
|
Counters & counters = master.params().documentClass().counters();
|
||||||
|
docstring const cnt = from_ascii("listing");
|
||||||
|
bool const hasCounter = counters.hasCounter(cnt);
|
||||||
|
if (hasCounter) {
|
||||||
|
counters.saveLastCounter();
|
||||||
|
counters.step(cnt, utype);
|
||||||
|
listings_label_ += " " + convert<docstring>(counters.value(cnt));
|
||||||
|
}
|
||||||
|
|
||||||
if (label_)
|
if (label_)
|
||||||
label_->updateBuffer(it, utype, deleted);
|
label_->updateBuffer(it, utype, deleted);
|
||||||
|
|
||||||
|
if (hasCounter)
|
||||||
|
counters.restoreLastCounter();
|
||||||
|
|
||||||
InsetListingsParams const par(to_utf8(params()["lstparams"]));
|
InsetListingsParams const par(to_utf8(params()["lstparams"]));
|
||||||
if (par.getParamValue("caption").empty()) {
|
if (par.getParamValue("caption").empty()) {
|
||||||
listings_label_ = buffer().B_("Program Listing");
|
listings_label_ = buffer().B_("Program Listing");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Buffer const & master = *buffer().masterBuffer();
|
|
||||||
Counters & counters = master.params().documentClass().counters();
|
|
||||||
docstring const cnt = from_ascii("listing");
|
|
||||||
listings_label_ = master.B_("Program Listing");
|
|
||||||
if (counters.hasCounter(cnt)) {
|
|
||||||
counters.step(cnt, utype);
|
|
||||||
listings_label_ += " " + convert<docstring>(counters.value(cnt));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user