Allan Rae wrote: > The new design is better than what I had thought of and the logic > seems spot-on. I've tested all sorts of combinations of stuff and it > produces the right results. Very nice indeed.
Thanks :-) > All that is missing are some feedback messages to tell me to include > units in my dimensions and such. You're right! Patch attached. > > It is a lot of code for my means, so please don't shoot at me if > > there are more elegant ways (Angus, remember that I was not able to > > disable the Natbib choice few weeks ago; this time there were a lot > > of much more complex things to do ;-). Please review the code. > > I haven't looked at the code yet but the logic and operation are > excellent. Where have you been hiding all these years that LyX > needed a human-computer interface designer? Please stop it ;-) You have to thank Angus, JMarc and others who have brought an old confirmed non-technician to finally *try* to read code ("do it yourself, man ;-)") instead of linguistic books. > You are not allowed to leave until you've revised all the dialogs. > Okay? Well since this is much more fun than writing my PhD and since my PhD will not be finished during the next year (and since I want to write my PhD with LyX 1.2.0!) I won't leave that quick. But don't expect too much, my skills are /very/ limited. Greets, Jürgen > ;-) > Allan. (ARRae)
Index: src/frontends/xforms/ChangeLog =================================================================== RCS file: /cvs/lyx/lyx-devel/src/frontends/xforms/ChangeLog,v retrieving revision 1.178 diff -u -r1.178 ChangeLog --- src/frontends/xforms/ChangeLog 2001/10/03 16:31:10 1.178 +++ src/frontends/xforms/ChangeLog 2001/10/04 07:49:40 @@ -1,3 +1,8 @@ +2001-10-04 Jürgen Spitzmüller <[EMAIL PROTECTED]> + + * FormDocument.C: add warnings when invalid data is inserted + to the input fields in the paper tab. + 2001-10-03 Jürgen Spitzmüller <[EMAIL PROTECTED]> * forms/form_document.fd: rearrangement of the paper tab; Index: src/frontends/xforms/FormDocument.C =================================================================== RCS file: /cvs/lyx/lyx-devel/src/frontends/xforms/FormDocument.C,v retrieving revision 1.64 diff -u -r1.64 FormDocument.C --- src/frontends/xforms/FormDocument.C 2001/10/03 16:31:10 1.64 +++ src/frontends/xforms/FormDocument.C 2001/10/04 07:49:42 @@ -953,6 +953,7 @@ int val; bool ok = true; char const * input; + bool valid = true; checkMarginValues(); if (ob == paper_->choice_papersize2) { @@ -1031,22 +1032,103 @@ // the document buttons and so the whole stuff has to be tested again. str = fl_get_input(paper_->input_custom_width); ok = ok && (str.empty() || isValidLength(str)); + if (ob == paper_->input_custom_width) { + if (!isValidLength(str)) { + fl_set_object_label(dialog_->text_warning, + _("Warning: Invalid Length (valid example: 10mm)")); + fl_show_object(dialog_->text_warning); + valid = false; + } else + fl_hide_object(dialog_->text_warning); + } str = fl_get_input(paper_->input_custom_height); ok = ok && (str.empty() || isValidLength(str)); + if (ob == paper_->input_custom_height) { + if (!isValidLength(str)) { + fl_set_object_label(dialog_->text_warning, + ("Warning: Invalid Length (valid example: 10mm)")); + fl_show_object(dialog_->text_warning); + valid = false; + } else + fl_hide_object(dialog_->text_warning); + } str = fl_get_input(paper_->input_left_margin); ok = ok && (str.empty() || isValidLength(str)); + if (ob == paper_->input_left_margin) { + if (!isValidLength(str)) { + fl_set_object_label(dialog_->text_warning, + _("Warning: Invalid Length (valid example: 10mm)")); + fl_show_object(dialog_->text_warning); + valid = false; + } else + fl_hide_object(dialog_->text_warning); + } str = fl_get_input(paper_->input_right_margin); ok = ok && (str.empty() || isValidLength(str)); + if (ob == paper_->input_right_margin) { + if (!isValidLength(str)) { + fl_set_object_label(dialog_->text_warning, + _("Warning: Invalid Length (valid example: 10mm)")); + fl_show_object(dialog_->text_warning); + valid = false; + } else + fl_hide_object(dialog_->text_warning); + } str = fl_get_input(paper_->input_top_margin); ok = ok && (str.empty() || isValidLength(str)); + if (ob == paper_->input_top_margin) { + if (!isValidLength(str)) { + fl_set_object_label(dialog_->text_warning, + _("Warning: Invalid Length (valid example: 10mm)")); + fl_show_object(dialog_->text_warning); + valid = false; + } else + fl_hide_object(dialog_->text_warning); + } str = fl_get_input(paper_->input_bottom_margin); ok = ok && (str.empty() || isValidLength(str)); + if (ob == paper_->input_bottom_margin) { + if (!isValidLength(str)) { + fl_set_object_label(dialog_->text_warning, + _("Warning: Invalid Length (valid example: 10mm)")); + fl_show_object(dialog_->text_warning); + valid = false; + } else + fl_hide_object(dialog_->text_warning); + } str = fl_get_input(paper_->input_head_height); ok = ok && (str.empty() || isValidLength(str)); + if (ob == paper_->input_head_height) { + if (!isValidLength(str)) { + fl_set_object_label(dialog_->text_warning, + _("Warning: Invalid Length (valid example: 10mm)")); + fl_show_object(dialog_->text_warning); + valid = false; + } else + fl_hide_object(dialog_->text_warning); + } str = fl_get_input(paper_->input_head_sep); ok = ok && (str.empty() || isValidLength(str)); + if (ob == paper_->input_head_sep) { + if (!isValidLength(str)) { + fl_set_object_label(dialog_->text_warning, + _("Warning: Invalid Length (valid example: 10mm)")); + fl_show_object(dialog_->text_warning); + valid = false; + } else + fl_hide_object(dialog_->text_warning); + } str = fl_get_input(paper_->input_foot_skip); ok = ok && (str.empty() || isValidLength(str)); + if (ob == paper_->input_foot_skip) { + if (!isValidLength(str)) { + fl_set_object_label(dialog_->text_warning, + _("Warning: Invalid Length (valid example: 10mm)")); + fl_show_object(dialog_->text_warning); + valid = false; + } else + fl_hide_object(dialog_->text_warning); + } // "Synchronize" the choice and the input field, so that it // is impossible to commit senseless data. input = fl_get_input (class_->input_doc_skip);