mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
honor secnumdepth for section headers; avoid multiple labels for environments; update counters when switching class
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9831 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
a682330716
commit
887137a87a
@ -1,3 +1,20 @@
|
||||
2005-04-14 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
|
||||
|
||||
* lyxfunc.C (actOnUpdatedPrefs): avoid warning
|
||||
(dispatch): update counters and screen after LFUN_TEXTCLASS_APPLY.
|
||||
|
||||
* rowpainter.C (paintFirst): simplify the code a little bit. In
|
||||
particular, remove the test for secnumdepth.
|
||||
* text.C (setHeightOfRow): only allocate space for chapter number
|
||||
when updateCounters provided an actual label, instead of looking
|
||||
at secnumdepth directly.
|
||||
|
||||
* lyxlayout.C (LyXLayout): set toclevel to -2 by default.
|
||||
|
||||
* buffer_funcs.C (setCounter): only number LABEL_COUNTER
|
||||
paragraphs when secnumdepth is large enough or, for environments,
|
||||
when they are not the first in a sequence.
|
||||
|
||||
2005-04-17 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* buffer.C (makeLaTeXFile): replace code to manipulate a path
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "LaTeX.h"
|
||||
#include "lyxtextclass.h"
|
||||
#include "paragraph.h"
|
||||
#include "paragraph_funcs.h"
|
||||
#include "ParagraphList_fwd.h"
|
||||
#include "ParagraphParameters.h"
|
||||
#include "pariterator.h"
|
||||
@ -377,9 +378,14 @@ void setCounter(Buffer const & buf, ParIterator & it)
|
||||
|
||||
// is it a layout that has an automatic label?
|
||||
if (layout->labeltype == LABEL_COUNTER) {
|
||||
if (layout->toclevel <= buf.params().secnumdepth
|
||||
&& (!layout->isEnvironment()
|
||||
|| isFirstInSequence(it.pit(), it.plist()))) {
|
||||
counters.step(layout->counter);
|
||||
string label = expandLabel(textclass, layout, par.params().appendix());
|
||||
string label = expandLabel(textclass, layout,
|
||||
par.params().appendix());
|
||||
par.params().labelString(label);
|
||||
}
|
||||
} else if (layout->labeltype == LABEL_ITEMIZE) {
|
||||
// At some point of time we should do something more
|
||||
// clever here, like:
|
||||
|
@ -1474,6 +1474,8 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
|
||||
bufferErrors(*buffer, el);
|
||||
view()->showErrorList(_("Class switch"));
|
||||
updateCounters(*buffer);
|
||||
update = true;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1971,6 +1973,7 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
|
||||
case LyXRC::RC_SPELL_COMMAND:
|
||||
case LyXRC::RC_TEMPDIRPATH:
|
||||
case LyXRC::RC_TEMPLATEPATH:
|
||||
case LyXRC::RC_TEX_ALLOWS_SPACES:
|
||||
case LyXRC::RC_UIFILE:
|
||||
case LyXRC::RC_USER_EMAIL:
|
||||
case LyXRC::RC_USER_NAME:
|
||||
|
@ -121,7 +121,7 @@ LyXLayout::LyXLayout ()
|
||||
free_spacing = false;
|
||||
pass_thru = false;
|
||||
is_environment = false;
|
||||
toclevel = 0;
|
||||
toclevel = -2;
|
||||
commanddepth = 0;
|
||||
}
|
||||
|
||||
|
@ -501,16 +501,15 @@ void RowPainter::paintFirst()
|
||||
|| layout->latextype != LATEX_ENVIRONMENT
|
||||
|| is_seq)) {
|
||||
|
||||
LyXFont font = getLabelFont();
|
||||
if (!par_.getLabelstring().empty()) {
|
||||
double x = x_;
|
||||
LyXFont const font = getLabelFont();
|
||||
string const str = par_.getLabelstring();
|
||||
if (!str.empty()) {
|
||||
double x = x_;
|
||||
|
||||
// this is special code for the chapter layout. This is
|
||||
// printed in an extra row and has a pagebreak at
|
||||
// the top.
|
||||
if (layout->counter == "chapter") {
|
||||
if (buffer.params().secnumdepth >= 0) {
|
||||
double spacing_val = 1.0;
|
||||
if (!parparams.spacing().isDefault()) {
|
||||
spacing_val = parparams.spacing().getValue();
|
||||
@ -531,7 +530,6 @@ void RowPainter::paintFirst()
|
||||
}
|
||||
|
||||
pain_.text(int(x), yo_ - maxdesc - labeladdon, str, font);
|
||||
}
|
||||
} else {
|
||||
if (is_rtl) {
|
||||
x = width_ - leftMargin()
|
||||
|
@ -911,12 +911,13 @@ void LyXText::setHeightOfRow(pit_type const pit, Row & row)
|
||||
maxasc += bufparams.getDefSkip().inPixels(*bv());
|
||||
}
|
||||
|
||||
if (pars_[pit].params().startOfAppendix())
|
||||
if (par.params().startOfAppendix())
|
||||
maxasc += int(3 * dh);
|
||||
|
||||
// This is special code for the chapter, since the label of this
|
||||
// layout is printed in an extra row
|
||||
if (layout->counter == "chapter" && bufparams.secnumdepth >= 0) {
|
||||
if (layout->counter == "chapter"
|
||||
&& !par.params().labelString().empty()) {
|
||||
labeladdon = int(font_metrics::maxHeight(labelfont)
|
||||
* layout->spacing.getValue()
|
||||
* spacing(par));
|
||||
|
Loading…
Reference in New Issue
Block a user