The idea here is to implement something like \refstepcounter for LyX. We
do this by tracking the "active" counter in Counters.cpp. We also have
to track when we go in and out of environments to which counters are
local, and so on and so forth.
This all gets done in updateLabels(), but only if we are producing
output, which is why I added the output boolean a while ago.
I expect there are bugs in here, though it seems to work pretty well
with the documents I've tested.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33108 a592a061-630c-0410-9148-cb99ea01b6c8
* Counters.cpp (flatLabelString): return a cache of the flattened strings for each used language
* Counters.cpp (theCounter, counterLabel, flattenLabelString): add a lang parameter; in theCounter, populate the cache as needed.
* insets/InsetCaption.cpp:
* insets/InsetFoot.cpp:
* insets/InsetBibitem.cpp:
* insets/InsetCollapsable.cpp:
* Paragraph.cpp:
* Buffer.cpp: pass a language argument to counter methods.
* Paragraph.cpp (translateIfPossible): use the function with same name in gettext.cpp.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30520 a592a061-630c-0410-9148-cb99ea01b6c8
This patch is from JMarc, except the docs, which are due to me.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29906 a592a061-630c-0410-9148-cb99ea01b6c8
are computed recursively to get rid of any \thexxx string by the method
flattenLabelString. The values are cached in Counter objects.
On my mac, the total time (updatelabels+redraw) goes down by 30%. YMMV.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29342 a592a061-630c-0410-9148-cb99ea01b6c8
update an existing counter rather than overwrite it.
This turns out to be more complicated than it might seem. There are two
large parts to the patch. One moves the counter read routine out of TextClass
and into the Counter and Counters classes. The other changes the syntax of
counters from:
Counter
Name whatever
....
to:
Counter whatever
....
This allows us to get the name of the counter right away, so we can decide
whether it is an old one or a new one. So the layout format had to be
changed (again), with corresponding layout2layout code.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26779 a592a061-630c-0410-9148-cb99ea01b6c8
e.g.:
Counter
Name Version
LabelString "\theVersion.0"
End
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23166 a592a061-630c-0410-9148-cb99ea01b6c8
Now support/* should have no dependencies on src/* anymore.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21851 a592a061-630c-0410-9148-cb99ea01b6c8
* src/Counters.cpp (Counter::labelString/labelStringAppendix): new
accessors for two new variables
(Counter::setMaster): removed
(Counter::Counter): add a version with arguments.
(Counters::newCounter): add relevant arguments; allow to redefine
an existing counter.
(Counters::reset): reset the current float float.
(Counters::theCounter): return a representation of a given counter
using its labelstring or by default \themaster.\arabic{counter}.
Handle appendix too.
(Counters::counterLabel): add support for macros of the form
\thecounter.
* src/TextClass.cpp (readCounters): also read LabelString and
LabelStringAppendix.
(readFloats): allow to update an existing float; create the
counter associated with the float.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19602 a592a061-630c-0410-9148-cb99ea01b6c8
We now go up to 999. If you have more sections that that, you are out
of luck!
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19363 a592a061-630c-0410-9148-cb99ea01b6c8
whether we are in appendix mode.
* buffer_funcs.cpp (setLabel): set Counters::appendix as needed.
This fixes bug 3862 automagically.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19039 a592a061-630c-0410-9148-cb99ea01b6c8
Remove all explicit 8bit characters from the source, to fix compilation
with windows xp under a chinese locale (bug 3496).
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18256 a592a061-630c-0410-9148-cb99ea01b6c8