X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fxforms%2FFormParagraph.C;h=66e2b819e701a5e399fe4f7df3e7e7c5f2c2a576;hb=eba67bc3120dc301bf193c3f3b570f51f00a4654;hp=1adfec0e3f2bf1e870c54ee2bb0c851d335870dc;hpb=e7401bd8f2310213b4b765c01676459f37adb530;p=lyx.git diff --git a/src/frontends/xforms/FormParagraph.C b/src/frontends/xforms/FormParagraph.C index 1adfec0e3f..66e2b819e7 100644 --- a/src/frontends/xforms/FormParagraph.C +++ b/src/frontends/xforms/FormParagraph.C @@ -30,8 +30,8 @@ using Liason::setMinibuffer; #endif FormParagraph::FormParagraph(LyXView * lv, Dialogs * d) - : FormBase(lv, d, _("Paragraph Layout"), BUFFER_DEPENDENT, UPDATE, - new NoRepeatedApplyReadOnlyPolicy), + : FormBaseBD(lv, d, _("Paragraph Layout"), + new NoRepeatedApplyReadOnlyPolicy), dialog_(0), general_(0), extra_(0) { // let the popup be shown @@ -49,6 +49,19 @@ FormParagraph::~FormParagraph() } +void FormParagraph::redraw() +{ + if( form() && form()->visible ) + fl_redraw_form( form() ); + else + return; + + FL_FORM * outer_form = fl_get_active_folder(dialog_->tabbed_folder); + if (outer_form && outer_form->visible) + fl_redraw_form( outer_form ); +} + + FL_FORM * FormParagraph::form() const { if (dialog_) return dialog_->form; @@ -61,7 +74,11 @@ void FormParagraph::build() // the tabbed folder dialog_ = build_tabbed_paragraph(); - // manage the restore, ok, apply and cancel/close buttons + // Workaround dumb xforms sizing bug + minw_ = form()->w; + minh_ = form()->h; + + // Manage the ok, apply, restore and cancel/close buttons bc_.setOK(dialog_->button_ok); bc_.setApply(dialog_->button_apply); bc_.setCancel(dialog_->button_cancel); @@ -88,6 +105,8 @@ void FormParagraph::build() bc_.addReadOnly (general_->radio_align_center); bc_.addReadOnly (general_->check_lines_top); bc_.addReadOnly (general_->check_lines_bottom); + bc_.addReadOnly (general_->check_pagebreaks_top); + bc_.addReadOnly (general_->check_pagebreaks_bottom); bc_.addReadOnly (general_->choice_space_above); bc_.addReadOnly (general_->input_space_above); bc_.addReadOnly (general_->check_space_above); @@ -106,6 +125,8 @@ void FormParagraph::build() bc_.addReadOnly (extra_->radio_pextra_indent); bc_.addReadOnly (extra_->radio_pextra_minipage); bc_.addReadOnly (extra_->radio_pextra_floatflt); + bc_.addReadOnly (extra_->radio_pextra_hfill); + bc_.addReadOnly (extra_->radio_pextra_startmp); // now make them fit together fl_addto_tabfolder(dialog_->tabbed_folder,_("General"), general_->form); @@ -135,6 +156,7 @@ void FormParagraph::update() general_update(); extra_update(); + bc_.readOnly(lv_->buffer()->isReadonly()); } @@ -183,7 +205,8 @@ void FormParagraph::general_apply() space_top = VSpace(VSpace::VFILL); break; case 7: - space_top = VSpace(LyXGlueLength(fl_get_input(general_->input_space_above))); + space_top = + VSpace(LyXGlueLength(fl_get_input(general_->input_space_above))); break; } if (fl_get_button (general_->check_space_above)) @@ -208,7 +231,8 @@ void FormParagraph::general_apply() space_bottom = VSpace(VSpace::VFILL); break; case 7: - space_bottom = VSpace(LyXGlueLength(fl_get_input(general_->input_space_below))); + space_bottom = + VSpace(LyXGlueLength(fl_get_input(general_->input_space_below))); break; } if (fl_get_button (general_->check_space_below)) @@ -458,7 +482,7 @@ void FormParagraph::extra_update() par->pextra_width.c_str()); fl_set_input(extra_->input_pextra_widthp, par->pextra_widthp.c_str()); - switch(par->pextra_alignment) { + switch (par->pextra_alignment) { case LyXParagraph::MINIPAGE_ALIGN_TOP: fl_set_button(extra_->radio_pextra_top, 1); break; @@ -539,17 +563,17 @@ bool FormParagraph::input(FL_OBJECT * ob, long) // // "Synchronize" the choices and input fields, making it // impossible to commit senseless data. - if (ob == general_->choice_space_above) { - if (fl_get_choice (general_->choice_space_above) != 7) - fl_set_input (general_->input_space_above, ""); - } else if (ob == general_->choice_space_below) { - if (fl_get_choice (general_->choice_space_below) != 7) - fl_set_input (general_->input_space_below, ""); - } + + if (fl_get_choice (general_->choice_space_above) != 7) + fl_set_input (general_->input_space_above, ""); + + if (fl_get_choice (general_->choice_space_below) != 7) + fl_set_input (general_->input_space_below, ""); + // // then the extra form // - else if (ob == extra_->radio_pextra_indent) { + if (ob == extra_->radio_pextra_indent) { int n = fl_get_button(extra_->radio_pextra_indent); if (n) { fl_set_button(extra_->radio_pextra_minipage, 0); @@ -640,32 +664,28 @@ bool FormParagraph::input(FL_OBJECT * ob, long) // first the general form // string input = fl_get_input (general_->input_space_above); + bool invalid = false; - if (input.empty()) { - fl_set_choice (general_->choice_space_above, 1); - } else if (isValidGlueLength (input)) { - fl_set_choice (general_->choice_space_above, 7); - } else { - fl_set_choice (general_->choice_space_above, 7); - fl_set_object_label(dialog_->text_warning, - _("Warning: Invalid Length (valid example: 10mm)")); - fl_show_object(dialog_->text_warning); - ret = false; - } - + if (fl_get_choice(general_->choice_space_above)==7) + invalid = !input.empty() && !isValidGlueLength(input); + input = fl_get_input (general_->input_space_below); - - if (input.empty()) { - fl_set_choice (general_->choice_space_below, 1); - } else if (isValidGlueLength(input)) { - fl_set_choice (general_->choice_space_below, 7); - } else { - fl_set_choice (general_->choice_space_below, 7); - fl_set_object_label(dialog_->text_warning, - _("Warning: Invalid Length (valid example: 10mm)")); - fl_show_object(dialog_->text_warning); - ret = false; + + if (fl_get_choice(general_->choice_space_below)==7) + invalid = invalid || (!input.empty() && !isValidGlueLength(input)); + + if (ob == general_->input_space_above || ob == general_->input_space_below) { + if (invalid) { + fl_set_object_label(dialog_->text_warning, + _("Warning: Invalid Length (valid example: 10mm)")); + fl_show_object(dialog_->text_warning); + return false; + } else { + fl_hide_object(dialog_->text_warning); + return true; + } } + // // then the extra form //