>>>>> "Helge" == Helge Hafting <[EMAIL PROTECTED]> writes:

Helge> It has been a while since I had a crash or malfunction to
Helge> report. So here is the biggest problem currently:

Helge> Numbering of subsubsections are displayed wrong in lyx. I have
Helge> set things up so chapters, sections and subsections are
Helge> numbered, and the output reflects that. But inside lyx, the
Helge> subsubsections are also numbered and that is irritating to look
Helge> at. They should be unnumbered, as they are in the output. It is
Helge> nice that lyx 1.4 shows the correct numbering inside lyx, but
Helge> it is a bit overdone when even unnumbered section levels gets
Helge> numbers.

The following preliminary patch fixes the problem. Why is it
preliminary, I hear you ask? Because I am not sure why artcile and
book use different TocLevel settings for things like sections and
Subsections. So currently, the display is off-by-one for books.

Juergen, in your tests how do you handle the difference between books
and articles?

Helge, testing would be welcome...

JMarc

Index: src/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ChangeLog,v
retrieving revision 1.2150
diff -u -p -r1.2150 ChangeLog
--- src/ChangeLog	11 Apr 2005 13:35:14 -0000	1.2150
+++ src/ChangeLog	11 Apr 2005 14:21:55 -0000
@@ -1,3 +1,10 @@
+2005-04-11  Jean-Marc Lasgouttes  <[EMAIL PROTECTED]>
+
+	* lyxlayout.C (LyXLayout): set toclevel to -1 by default.
+
+	* buffer_funcs.C (setCounter): only number LABEL_COUNTER
+	paragraphs when secnumdepth is large enough.
+
 2005-04-06  Jean-Marc Lasgouttes  <[EMAIL PROTECTED]>
 
 	* FontIterator.C (operator*): avoid a copy of the font.
Index: src/buffer_funcs.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/buffer_funcs.C,v
retrieving revision 1.24
diff -u -p -r1.24 buffer_funcs.C
--- src/buffer_funcs.C	25 Feb 2005 11:55:31 -0000	1.24
+++ src/buffer_funcs.C	11 Apr 2005 14:21:55 -0000
@@ -377,9 +377,12 @@ void setCounter(Buffer const & buf, ParI
 
 	// is it a layout that has an automatic label?
 	if (layout->labeltype == LABEL_COUNTER) {
-		counters.step(layout->counter);
-		string label = expandLabel(textclass, layout, par.params().appendix());
-		par.params().labelString(label);
+		if (layout->toclevel <= buf.params().secnumdepth) {
+			counters.step(layout->counter);
+			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:
Index: lib/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/ChangeLog,v
retrieving revision 1.684
diff -u -p -r1.684 ChangeLog
--- lib/ChangeLog	9 Apr 2005 10:52:52 -0000	1.684
+++ lib/ChangeLog	11 Apr 2005 14:21:55 -0000
@@ -1,3 +1,11 @@
+2005-04-11  Jean-Marc Lasgouttes  <[EMAIL PROTECTED]>
+
+	* layouts/numarticle.inc: 
+	* layouts/numreports.inc: add numbering stuff for Paragraph and
+	SubParagraph. 
+
+	* layouts/numarticle.inc: set Part TocLevel to 0.
+
 2005-04-09  Angus Leeming  <[EMAIL PROTECTED]>
 
 	* Makefile.am (dist_scripts_DATA): add scripts/fig_copy.sh and
Index: lib/layouts/numarticle.inc
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/layouts/numarticle.inc,v
retrieving revision 1.3
diff -u -p -r1.3 numarticle.inc
--- lib/layouts/numarticle.inc	13 Oct 2003 09:50:10 -0000	1.3
+++ lib/layouts/numarticle.inc	11 Apr 2005 14:21:56 -0000
@@ -5,6 +5,7 @@ Style Part
 	LabelType             Counter
 	LabelCounter          part
 	LabelString           "Part \Roman{part}"
+	TocLevel              0
 End
 
 
@@ -36,10 +37,18 @@ End
 
 
 Style Paragraph
+	LabelType             Counter
+	LabelCounter          paragraph
+	LabelString           "@[EMAIL PROTECTED]"
+	LabelStringAppendix   "@[EMAIL PROTECTED]"
 	TocLevel              4
 End
 
 
 Style Subparagraph
+	LabelType             Counter
+	LabelCounter          subparagraph
+	LabelString           "@[EMAIL PROTECTED]"
+	LabelStringAppendix   "@[EMAIL PROTECTED]"
 	TocLevel              5
 End
Index: lib/layouts/numreport.inc
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/layouts/numreport.inc,v
retrieving revision 1.3
diff -u -p -r1.3 numreport.inc
--- lib/layouts/numreport.inc	13 Oct 2003 09:50:10 -0000	1.3
+++ lib/layouts/numreport.inc	11 Apr 2005 14:21:56 -0000
@@ -45,10 +45,18 @@ End
 
 
 Style Paragraph
+	LabelType             Counter
+	LabelCounter          paragraph
+	LabelString           "@[EMAIL PROTECTED]"
+	LabelStringAppendix   "@[EMAIL PROTECTED]"
 	TocLevel              5
 End
 
 
 Style Subparagraph
+	LabelType             Counter
+	LabelCounter          subparagraph
+	LabelString           "@[EMAIL PROTECTED]"
+	LabelStringAppendix   "@[EMAIL PROTECTED]"
 	TocLevel              6
 End
Index: src/frontends/controllers/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ChangeLog,v
retrieving revision 1.471
diff -u -p -r1.471 ChangeLog
--- src/frontends/controllers/ChangeLog	27 Mar 2005 07:14:12 -0000	1.471
+++ src/frontends/controllers/ChangeLog	11 Apr 2005 14:21:56 -0000
@@ -1,4 +1,9 @@
-2005-03-27  MArtin Vermeer  <[EMAIL PROTECTED]>
+2005-04-11  Jean-Marc Lasgouttes  <[EMAIL PROTECTED]>
+
+	* ControlDocument.C (dispatchParams): update the counters if
+	necessary. 
+
+2005-03-27  Martin Vermeer  <[EMAIL PROTECTED]>
 
 	* ControlDocument.C (dispatch_bufferparams): fix bug 1843
 
Index: src/frontends/controllers/ControlDocument.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ControlDocument.C,v
retrieving revision 1.54
diff -u -p -r1.54 ControlDocument.C
--- src/frontends/controllers/ControlDocument.C	27 Mar 2005 07:14:12 -0000	1.54
+++ src/frontends/controllers/ControlDocument.C	11 Apr 2005 14:21:56 -0000
@@ -16,6 +16,8 @@
 #include "BranchList.h"
 #include "buffer.h"
 #include "bufferparams.h"
+#include "BufferView.h"
+#include "buffer_funcs.h"
 #include "funcrequest.h"
 #include "language.h"
 #include "LColor.h"
@@ -89,14 +91,22 @@ void ControlDocument::dispatchParams()
 	textclass_type const old_class =
 		kernel().buffer().params().textclass;
 	textclass_type const new_class = bp_->textclass;
-
 	if (new_class != old_class) {
 		string const name = textclasslist[new_class].name();
 		kernel().dispatch(FuncRequest(LFUN_TEXTCLASS_APPLY, name));
 	}
 
+	int const old_secnumdepth = kernel().buffer().params().secnumdepth;
+	int const new_secnumdepth = bp_->secnumdepth;
+
 	// Apply the BufferParams.
 	dispatch_bufferparams(kernel(), params(), LFUN_BUFFERPARAMS_APPLY);
+
+	// redo the numbering if necessary
+	if (new_secnumdepth != old_secnumdepth) {
+		updateCounters(kernel().buffer());
+		kernel().bufferview()->update();
+	}
 
 	// Generate the colours requested by each new branch.
 	BranchList & branchlist = params().branchlist();

Reply via email to