Jean-Marc Lasgouttes wrote: > Juergen> I do not understand this, sorry. > > Forget about all this. Let's get it to work first :)
Feel free to explain. You know, the devel-language (develeranto) is sometimes like chinese to me. But as a linguist in profession, I'm always interested in foreign languages (in particular, if they are spoken by a community separatated from the rest of the world ;-)) > Juergen> Please have a look at the following code part. Does this get > Juergen> closer to your plan? > > Yes. You can indeed remove the two fl_set_choice_text in class_update. Done. > And does it work? This is the important question, after all :) Yes. At least in all cases I've checked (I think I have tested all necessary cases, but there's always a Michael Schmitt around the corner ;-)) Patch attached. Thanks for your education. Juergen. > JMarc
Index: src/frontends/xforms/ChangeLog =================================================================== RCS file: /cvs/lyx/lyx-devel/src/frontends/xforms/ChangeLog,v retrieving revision 1.348 diff -u -r1.348 ChangeLog --- src/frontends/xforms/ChangeLog 2002/04/08 17:03:04 1.348 +++ src/frontends/xforms/ChangeLog 2002/04/10 10:07:08 @@ -2,6 +2,13 @@ * xformsGImage.C (clip): no need to check if the width, height are > 0 because the BoundingBox would be empty() in this weren't the case. + +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]> 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/10 10:07:11 @@ -964,28 +964,38 @@ 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]; combo_doc_class->select(tclass.description()); - fl_set_choice_text(class_->choice_doc_fonts, params.fonts.c_str()); fl_clear_choice(class_->choice_doc_fontsize); fl_addto_choice(class_->choice_doc_fontsize, "default"); fl_addto_choice(class_->choice_doc_fontsize, tclass.opt_fontsize().c_str()); - fl_set_choice(class_->choice_doc_fontsize, - tokenPos(tclass.opt_fontsize(), '|', params.fontsize)+2); + fl_set_choice_text(class_->choice_doc_fontsize, + params.fontsize.c_str()); fl_clear_choice(class_->choice_doc_pagestyle); fl_addto_choice(class_->choice_doc_pagestyle, "default"); fl_addto_choice(class_->choice_doc_pagestyle, tclass.opt_pagestyle().c_str()); - fl_set_choice(class_->choice_doc_pagestyle, - tokenPos(tclass.opt_pagestyle(), '|', params.pagestyle)+2); + fl_set_choice_text(class_->choice_doc_pagestyle, + params.pagestyle.c_str()); + +} + +void FormDocument::class_update(BufferParams const & params) +{ + if (!class_.get()) + return; + + UpdateClassParams(params); + + fl_set_choice_text(class_->choice_doc_fonts, + params.fonts.c_str()); 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/10 10:07:11 @@ -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 &);