Jean-Marc Lasgouttes wrote: > I'd rather see LyXLenght::CM than "cm". But don't worry about it for > now. > > Also, the repeated code for metric units should be factorized out > somewhere (although I do not know where).
OK. But I think I finish the patch for now without those changes. I'd like to have it working before cleaning the existing code. I just have to move the if-clauses from the Form*.C-files to getLengthFromWidgets. I'm not shure how to do it right, though. Can someone give me a hint, please? Here is an example of the code which has to be moved: if (isValidGlueLength(fl_get_input(paper_->input_top_margin))) params.topmargin = fl_get_input(paper_->input_top_margin); else params.topmargin = getLengthFromWidgets(paper_->input_top_margin, paper_->choice_top_margin_units); And here's the code from xforms_helpers.C: string getLengthFromWidgets(FL_OBJECT * input, FL_OBJECT * choice) { // Paranoia check lyx::Assert(input && input->objclass == FL_INPUT && choice && choice->objclass == FL_CHOICE); string const length = strip(frontStrip(fl_get_input(input))); if (length.empty()) return string(); string unit = strip(frontStrip(fl_get_choice_text(choice))); unit = subst(unit, "%%", "%"); return length + unit; } Any way I try to implement isValidGlueLength() here, I get the errror xforms_helpers.C: In function `class string getLengthFromWidgets(FL_OBJECT *, FL_OBJECT *)': xforms_helpers.C:135: implicit declaration of function `int isValidGlueLength(...)' xforms_helpers.C:135: warning: cannot pass objects of type `const string' through `...' What's wrong? Thanks, Juergen. > JMarc