so we can write a limited amount when using this for TOC and
tooltip output.
This should solve the problem with slowness that Kornel noticed,
which was caused by our trying to write an entire plaintext
bibliography every time we updated the TOC. We did that because
he had a bibliography inside a branch, and we use plaintext for
creating the tooltip that goes with the branch list.
Other related bugs were fixed along the way. E.g., it turns out
that, if someone had an InsetInclude inside a branch, then we would
have been writing a *plaintext file* for that inset every time we
updated the TOC. I wonder if some of the other reports of slowness
we have received might be due to this kind of issue?
preparatory to fixing #7080. Note that mathed uses the same routine, but
for a completely different purpose, so I did not rename it there. I have
seen no difference in behavior after testing, e.g., opening and
exporting Math.lyx, and also re-saving it and looking at the diff.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38109 a592a061-630c-0410-9148-cb99ea01b6c8
counting when exporting to latex. This is done for the code comprised
between \begin{document} and \end{document}, while the preamble code
still needs manual calls to TexRow::newline() for registering new lines.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37584 a592a061-630c-0410-9148-cb99ea01b6c8
blank lines may be inadvertently output. This is achieved by using two
special iomanip-like variables (breakln and safebreakln) in the lyx::
namespace. When they are inserted in the stream, a newline is output
only if not already at the beginning of a line. The difference between
breakln and safebreakln is that, if needed, the former outputs '\n'
and the latter "%\n".
In future, the new class will also be used for counting the number of
newlines issued. Even if the infractrure for doing that is already in
place, the counting is essentially still done the old way.
There are still places in the code where the functionality of the
class could be used, most probably. ATM, it is used for InsetTabular,
InsetListings, InsetFloat, and InsetText.
The Comment and GreyedOut insets required a special treatment and a
new InsetLayout parameter (Display) has been introduced. The default
for Display is "true", meaning that the corresponding latex
environment is of "display" type, i.e., it stands on its own, whereas
"false" means that the contents appear inline with the text. The
latter is the case for both Comment and GreyedOut insets.
Mostly, the only visible effects on latex exports should be the
disappearing of some redundant % chars and the appearing/disappearing
of null {} latex groups after a comment or lyxgreyedout environments
(they are related to the presence or absence of a space immediately
after those environments), as well as the fact that math environments
are now started on their own lines.
As a last thing, only the latex code between \begin{document} and
\end{document} goes through the new class, the preamble being directly
output through odocstream, as usual.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37360 a592a061-630c-0410-9148-cb99ea01b6c8
as to allow us to call the routine when we are preparing for output and
so to do certain things we might not want to do every time.
This is an abuse of updateLabels(), in a way, but updateLabels() long
ago became the general recurse-through-the-Buffer routine, and to
implement the sort of thing I want to do here in validate(), say, much
of the code in updateLabels()---in particular, the counter-update
code---would have to be duplicated. So I believe this is the best, and
easiest, way to go.
Actual use of the new argument will follow.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32318 a592a061-630c-0410-9148-cb99ea01b6c8
* DocIterator as MacroPosition
* Iterative search for macro in scope until a visible one is found.
This include the ability to resolve macro inside nested text insets.
* Speed up macro lookups by factor 2: only getMacro(name) call, no
further hasMacro(name) call before
* Both way child/master support
* Correct macro scope for multi-paragraph environments
* Correct macro scope for multi-depth-paragraphs
* Buffer::updateMacros made const
* Update macros when loaded (of master and child)
* Do not remove too many braces when unfolding a macro. This could
lead to a data loss because the relationship between arguments of
macros can be mixed up if nested macros are unfold at once.
* Reduce dependencies to MetricsInfo in MathMacro
* Update macros when needed. Normally it's done just before doing
metrics. But in cases without a brace around some constructs (like
\left(bla\right)) there is some help needed.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22241 a592a061-630c-0410-9148-cb99ea01b6c8
* buffer_funcs.cpp (updateLabels): new function taking a buffer and
a ParIterator as arguments. This one is used to update labels
into an InsetText. Cleanup the code to reset depth. Call setLabel
for each paragraph, and then updateLabel on each inset it contains.
(setCaptionLabels, setCaptions): removed.
(setLabel): use Counters::current_float to make caption paragraphs
labels.
* insets/Inset.h (updateLabels): new virtual method, empty by
default; this numbers the inset itself (if relevant) and then all
the paragraphs it may contain.
* insets/InsetText.cpp (updateLabels): basically calls
lyx::updateLabels from buffer_func.cpp.
* insets/InsetCaption.cpp (addToToc): use the label constructed by
updateLabels.
(computeFullLabel): removed.
(metrics, plaintext): don't use computeFullLabel.
(updateLabels): new method; set the label from
Counters::current_float.
* insets/InsetWrap.cpp (updateLabels):
* insets/InsetFloat.cpp (updateLabel): new method; sets
Counters::current_float to the float type.
* insets/InsetBranch.cpp (updateLabels): new method; the numbering
is reset afterwards if the branch is inactive. (bug 2671)
* insets/InsetNote.cpp (updateLabels): new method; the numbering
is reset after the underlying InsetText has been numbered.
(bug 2671)
* insets/InsetTabular.cpp (updateLabels): new method (also handles
longtable)
* insets/InsetListings.cpp (updateLabels): new method; mimics what
is done for Floats (although Listings are not floats technically)
* insets/InsetInclude.cpp (getScreenLabel): in the listings case,
use the computed label.
(updateLabels): new method; that either renumbers the child
document or number the current listing.
* LyXFunc.cpp (menuNew): do not updateLabels on empty documents
(why do we do that at all?)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19482 a592a061-630c-0410-9148-cb99ea01b6c8
* InsetMath::name(): deleted.
* buffer_funcs.cpp:setCaptions() fix potential bug by using docstring copy instead of reference while using Inset::name.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18119 a592a061-630c-0410-9148-cb99ea01b6c8