Further clean-up. Now looks a lot better.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3791 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2002-03-20 18:47:43 +00:00
parent 293a38272a
commit 9d5ac82f16
2 changed files with 70 additions and 48 deletions

View File

@ -1,3 +1,7 @@
2002-03-20 Angus Leeming <a.leeming@ic.ac.uk>
* FormParagraph.C: a little more factorisation.
2002-03-20 Angus Leeming <a.leeming@ic.ac.uk>
* xforms_helpers.C (setCursorColor):

View File

@ -234,6 +234,23 @@ VSpace setVSpaceFromWidgets(FL_OBJECT * choice_type,
return space;
}
void validateVSpaceWidgets(FL_OBJECT * choice_type, FL_OBJECT * input_length)
{
// Paranoia check!
lyx::Assert(choice_type && choice_type->objclass == FL_CHOICE &&
input_length && input_length->objclass == FL_INPUT);
if (fl_get_choice(choice_type) != 7)
return;
// If a vspace kind is "Length" but there's no text in
// the input field, reset the kind to "None".
string const input = strip(getStringFromInput(input_length));
if (input.empty())
fl_set_choice(choice_type, 1);
}
} // namespace anon
@ -244,17 +261,10 @@ void FormParagraph::apply()
// If a vspace kind is "Length" but there's no text in
// the input field, reset the kind to "None".
if ((fl_get_choice(dialog_->choice_space_above) == 7) &&
!*(fl_get_input(dialog_->input_space_above)))
{
fl_set_choice(dialog_->choice_space_above, 1);
}
if ((fl_get_choice (dialog_->choice_space_below) == 7) &&
!*(fl_get_input (dialog_->input_space_below)))
{
fl_set_choice(dialog_->choice_space_below, 1);
}
validateVSpaceWidgets(dialog_->choice_space_above,
dialog_->input_space_above);
validateVSpaceWidgets(dialog_->choice_space_below,
dialog_->input_space_below);
bool const line_top = fl_get_button(dialog_->check_lines_top);
bool const line_bottom = fl_get_button(dialog_->check_lines_bottom);
@ -289,19 +299,27 @@ void FormParagraph::apply()
bool const noindent = fl_get_button(dialog_->check_noindent);
Spacing::Space linespacing = Spacing::Default;
string other_linespacing;
string other;
switch (fl_get_choice(dialog_->choice_linespacing)) {
case 1: linespacing = Spacing::Default; break;
case 2: linespacing = Spacing::Single; break;
case 3: linespacing = Spacing::Onehalf; break;
case 4: linespacing = Spacing::Double; break;
case 1:
linespacing = Spacing::Default;
break;
case 2:
linespacing = Spacing::Single;
break;
case 3:
linespacing = Spacing::Onehalf;
break;
case 4:
linespacing = Spacing::Double;
break;
case 5:
linespacing = Spacing::Other;
other_linespacing = fl_get_input(dialog_->input_linespacing);
other = getStringFromInput(dialog_->input_linespacing);
break;
}
Spacing const spacing(linespacing, other_linespacing);
Spacing const spacing(linespacing, other);
LyXText * text(lv_->view()->getLyXText());
text->setParagraph(lv_->view(), line_top, line_bottom, pagebreak_top,