Jean-Marc Lasgouttes wrote: > It should work. Try to extract this code from class_update and put it > in some mathod. If it does not work, you can always send a patch so > that I take a quick look.
Thanks for your hints, JMarc. 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. Please review the patch before applying. 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 16:03:49 @@ -1,3 +1,9 @@ +2002-04-08 Juergen Spitzmueller <[EMAIL PROTECTED]> + + * FormDocument.[Ch]: Add a new method UpdateClassParams + which is used in CheckChoiceClass to update the fontsizes + 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 16:03:52 @@ -964,11 +964,11 @@ 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 must be updated on any class change + // (even if the class defaults are not used) + // AFAICS these are only the font sizes (JSpitzm 2002-04-08) LyXTextClass const & tclass = textclasslist[params.textclass]; @@ -980,6 +980,17 @@ tclass.opt_fontsize().c_str()); fl_set_choice(class_->choice_doc_fontsize, tokenPos(tclass.opt_fontsize(), '|', params.fontsize)+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_clear_choice(class_->choice_doc_pagestyle); fl_addto_choice(class_->choice_doc_pagestyle, "default"); fl_addto_choice(class_->choice_doc_pagestyle, @@ -1459,8 +1470,10 @@ params.useClassDefaults(); UpdateLayoutDocument(params); } else { + // update the params which are needed in any case + // (only fontsizes so far) 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 16:03:52 @@ -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 &);