Juergen Spitzmueller wrote:
> I have done what you've proposed and this works indeed. I have added a new
> method UpdateClassParams which updates the necessary params after a new
> class is selected (only the fontsizes so far). These method is called from
> class_update too.

Actually, we need to update pagestyle too. I have moved this into the new 
method. I'm not shure if we need to update extra options. I left it in place 
for now.

Please take this patch instead of my previous one.

Thanks,
Juergen
Index: src/frontends/xforms/ChangeLog
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/frontends/xforms/ChangeLog,v
retrieving revision 1.346
diff -u -r1.346 ChangeLog
--- src/frontends/xforms/ChangeLog	2002/04/08 09:42:57	1.346
+++ src/frontends/xforms/ChangeLog	2002/04/08 17:14:43
@@ -1,3 +1,10 @@
+2002-04-08  Juergen Spitzmueller <[EMAIL PROTECTED]>
+
+	* FormDocument.[Ch]: Add a new method UpdateClassParams
+	which is used in CheckChoiceClass to update the fontsizes
+	and other necessary stuff (pagestyle) on class change
+	(hopefully finally fix bug #306)
+
 2002-04-08  Lars Gullik Bjønnes  <[EMAIL PROTECTED]>
 
 	* forms/Makefile.am (SUFFIXES): instead of .SUFFIXES
Index: src/frontends/xforms/FormDocument.C
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/frontends/xforms/FormDocument.C,v
retrieving revision 1.94
diff -u -r1.94 FormDocument.C
--- src/frontends/xforms/FormDocument.C	2002/03/28 13:15:16	1.94
+++ src/frontends/xforms/FormDocument.C	2002/04/08 17:14:46
@@ -964,11 +964,10 @@
 	bullets_apply(lv_->buffer()->params);
 }
 
-
-void FormDocument::class_update(BufferParams const & params)
+void FormDocument::UpdateClassParams(BufferParams const & params)
 {
-	if (!class_.get())
-		return;
+	// These are the params that have to be updated on any class change
+	// (even if the class defaults are not used) (JSpitzm 2002-04-08)
 
 	LyXTextClass const & tclass = textclasslist[params.textclass];
 
@@ -986,6 +985,17 @@
 			tclass.opt_pagestyle().c_str());
 	fl_set_choice(class_->choice_doc_pagestyle,
 		      tokenPos(tclass.opt_pagestyle(), '|', params.pagestyle)+2);
+}
+
+void FormDocument::class_update(BufferParams const & params)
+{
+	if (!class_.get())
+		return;
+
+	LyXTextClass const & tclass = textclasslist[params.textclass];
+
+	combo_doc_class->select(tclass.description());
+	UpdateClassParams(params);
 	fl_set_button(class_->radio_doc_indent, 0);
 	fl_set_button(class_->radio_doc_skip, 0);
 	if (params.paragraph_separation == BufferParams::PARSEP_INDENT)
@@ -1459,8 +1469,10 @@
 			params.useClassDefaults();
 			UpdateLayoutDocument(params);
 		} else {
+			// update the params which are needed in any case
+			// (fontsizes, pagestyle)
 			params.textclass = tc;
-			UpdateLayoutDocument(params);
+			UpdateClassParams(params);
 		}
 
 	} else {
Index: src/frontends/xforms/FormDocument.h
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/frontends/xforms/FormDocument.h,v
retrieving revision 1.24
diff -u -r1.24 FormDocument.h
--- src/frontends/xforms/FormDocument.h	2002/03/11 17:00:40	1.24
+++ src/frontends/xforms/FormDocument.h	2002/04/08 17:14:46
@@ -108,6 +108,8 @@
 	void CheckChoiceClass(FL_OBJECT * ob, long);
 	///
 	void UpdateLayoutDocument(BufferParams const & params);
+	///
+	void UpdateClassParams(BufferParams const & params);
 
 	///
 	void paper_update(BufferParams const &);

Reply via email to