mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-10 20:04:46 +00:00
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:
parent
293a38272a
commit
9d5ac82f16
@ -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>
|
2002-03-20 Angus Leeming <a.leeming@ic.ac.uk>
|
||||||
|
|
||||||
* xforms_helpers.C (setCursorColor):
|
* xforms_helpers.C (setCursorColor):
|
||||||
|
@ -116,14 +116,14 @@ void FormParagraph::build()
|
|||||||
setMessageWidget(dialog_->text_warning);
|
setMessageWidget(dialog_->text_warning);
|
||||||
|
|
||||||
fl_addto_choice(dialog_->choice_space_above,
|
fl_addto_choice(dialog_->choice_space_above,
|
||||||
_(" None | Defskip | Smallskip "
|
_(" None | Defskip | Smallskip "
|
||||||
"| Medskip | Bigskip | VFill | Length "));
|
"| Medskip | Bigskip | VFill | Length "));
|
||||||
fl_addto_choice(dialog_->choice_space_below,
|
fl_addto_choice(dialog_->choice_space_below,
|
||||||
_(" None | Defskip | Smallskip "
|
_(" None | Defskip | Smallskip "
|
||||||
"| Medskip | Bigskip | VFill | Length "));
|
"| Medskip | Bigskip | VFill | Length "));
|
||||||
|
|
||||||
fl_addto_choice(dialog_->choice_linespacing,
|
fl_addto_choice(dialog_->choice_linespacing,
|
||||||
_(" Default | Single | OneHalf | Double | Other "));
|
_(" Default | Single | OneHalf | Double | Other "));
|
||||||
|
|
||||||
fl_set_input_return(dialog_->input_space_above, FL_RETURN_CHANGED);
|
fl_set_input_return(dialog_->input_space_above, FL_RETURN_CHANGED);
|
||||||
fl_set_input_return(dialog_->input_space_below, FL_RETURN_CHANGED);
|
fl_set_input_return(dialog_->input_space_below, FL_RETURN_CHANGED);
|
||||||
@ -141,7 +141,7 @@ void FormParagraph::build()
|
|||||||
vector<string> units_vec = getLatexUnits();
|
vector<string> units_vec = getLatexUnits();
|
||||||
#if 0
|
#if 0
|
||||||
for (vector<string>::iterator it = units_vec.begin();
|
for (vector<string>::iterator it = units_vec.begin();
|
||||||
it != units_vec.end(); ++it) {
|
it != units_vec.end(); ++it) {
|
||||||
if (contains(*it, "%"))
|
if (contains(*it, "%"))
|
||||||
it = units_vec.erase(it, it+1) - 1;
|
it = units_vec.erase(it, it+1) - 1;
|
||||||
}
|
}
|
||||||
@ -149,7 +149,7 @@ void FormParagraph::build()
|
|||||||
// Something similar to this is a better way to erase
|
// Something similar to this is a better way to erase
|
||||||
vector<string>::iterator del =
|
vector<string>::iterator del =
|
||||||
remove_if(units_vec.begin(), units_vec.end(),
|
remove_if(units_vec.begin(), units_vec.end(),
|
||||||
bind2nd(contains_functor(), "%"));
|
bind2nd(contains_functor(), "%"));
|
||||||
units_vec.erase(del, units_vec.end());
|
units_vec.erase(del, units_vec.end());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -197,7 +197,7 @@ VSpace setVSpaceFromWidgets(FL_OBJECT * choice_type,
|
|||||||
input_length && input_length->objclass == FL_INPUT &&
|
input_length && input_length->objclass == FL_INPUT &&
|
||||||
choice_length && choice_length->objclass == FL_CHOICE &&
|
choice_length && choice_length->objclass == FL_CHOICE &&
|
||||||
check_keep && check_keep->objclass == FL_CHECKBUTTON);
|
check_keep && check_keep->objclass == FL_CHECKBUTTON);
|
||||||
|
|
||||||
VSpace space;
|
VSpace space;
|
||||||
|
|
||||||
switch (fl_get_choice(choice_type)) {
|
switch (fl_get_choice(choice_type)) {
|
||||||
@ -234,6 +234,23 @@ VSpace setVSpaceFromWidgets(FL_OBJECT * choice_type,
|
|||||||
return space;
|
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
|
} // namespace anon
|
||||||
|
|
||||||
|
|
||||||
@ -243,18 +260,11 @@ void FormParagraph::apply()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// If a vspace kind is "Length" but there's no text in
|
// If a vspace kind is "Length" but there's no text in
|
||||||
// the input field, reset the kind to "None".
|
// the input field, reset the kind to "None".
|
||||||
if ((fl_get_choice(dialog_->choice_space_above) == 7) &&
|
validateVSpaceWidgets(dialog_->choice_space_above,
|
||||||
!*(fl_get_input(dialog_->input_space_above)))
|
dialog_->input_space_above);
|
||||||
{
|
validateVSpaceWidgets(dialog_->choice_space_below,
|
||||||
fl_set_choice(dialog_->choice_space_above, 1);
|
dialog_->input_space_below);
|
||||||
}
|
|
||||||
|
|
||||||
if ((fl_get_choice (dialog_->choice_space_below) == 7) &&
|
|
||||||
!*(fl_get_input (dialog_->input_space_below)))
|
|
||||||
{
|
|
||||||
fl_set_choice(dialog_->choice_space_below, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool const line_top = fl_get_button(dialog_->check_lines_top);
|
bool const line_top = fl_get_button(dialog_->check_lines_top);
|
||||||
bool const line_bottom = fl_get_button(dialog_->check_lines_bottom);
|
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);
|
bool const noindent = fl_get_button(dialog_->check_noindent);
|
||||||
|
|
||||||
Spacing::Space linespacing = Spacing::Default;
|
Spacing::Space linespacing = Spacing::Default;
|
||||||
string other_linespacing;
|
string other;
|
||||||
switch (fl_get_choice(dialog_->choice_linespacing)) {
|
switch (fl_get_choice(dialog_->choice_linespacing)) {
|
||||||
case 1: linespacing = Spacing::Default; break;
|
case 1:
|
||||||
case 2: linespacing = Spacing::Single; break;
|
linespacing = Spacing::Default;
|
||||||
case 3: linespacing = Spacing::Onehalf; break;
|
break;
|
||||||
case 4: linespacing = Spacing::Double; break;
|
case 2:
|
||||||
case 5:
|
linespacing = Spacing::Single;
|
||||||
linespacing = Spacing::Other;
|
break;
|
||||||
other_linespacing = fl_get_input(dialog_->input_linespacing);
|
case 3:
|
||||||
break;
|
linespacing = Spacing::Onehalf;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
linespacing = Spacing::Double;
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
linespacing = Spacing::Other;
|
||||||
|
other = getStringFromInput(dialog_->input_linespacing);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Spacing const spacing(linespacing, other_linespacing);
|
Spacing const spacing(linespacing, other);
|
||||||
|
|
||||||
LyXText * text(lv_->view()->getLyXText());
|
LyXText * text(lv_->view()->getLyXText());
|
||||||
text->setParagraph(lv_->view(), line_top, line_bottom, pagebreak_top,
|
text->setParagraph(lv_->view(), line_top, line_bottom, pagebreak_top,
|
||||||
@ -310,7 +328,7 @@ void FormParagraph::apply()
|
|||||||
|
|
||||||
// Actually apply these settings
|
// Actually apply these settings
|
||||||
lv_->view()->update(text,
|
lv_->view()->update(text,
|
||||||
BufferView::SELECT | BufferView::FITCUR | BufferView::CHANGE);
|
BufferView::SELECT | BufferView::FITCUR | BufferView::CHANGE);
|
||||||
lv_->buffer()->markDirty();
|
lv_->buffer()->markDirty();
|
||||||
setMinibuffer(lv_, _("Paragraph layout set"));
|
setMinibuffer(lv_, _("Paragraph layout set"));
|
||||||
}
|
}
|
||||||
@ -405,18 +423,18 @@ void FormParagraph::update()
|
|||||||
align = tclass[par_->layout()].align;
|
align = tclass[par_->layout()].align;
|
||||||
|
|
||||||
switch (align) {
|
switch (align) {
|
||||||
case LYX_ALIGN_RIGHT:
|
case LYX_ALIGN_RIGHT:
|
||||||
fl_set_button(dialog_->radio_align_right, 1);
|
fl_set_button(dialog_->radio_align_right, 1);
|
||||||
break;
|
break;
|
||||||
case LYX_ALIGN_LEFT:
|
case LYX_ALIGN_LEFT:
|
||||||
fl_set_button(dialog_->radio_align_left, 1);
|
fl_set_button(dialog_->radio_align_left, 1);
|
||||||
break;
|
break;
|
||||||
case LYX_ALIGN_CENTER:
|
case LYX_ALIGN_CENTER:
|
||||||
fl_set_button(dialog_->radio_align_center, 1);
|
fl_set_button(dialog_->radio_align_center, 1);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fl_set_button(dialog_->radio_align_block, 1);
|
fl_set_button(dialog_->radio_align_block, 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
LyXAlignment alignpos = tclass[par_->layout()].alignpossible;
|
LyXAlignment alignpos = tclass[par_->layout()].alignpossible;
|
||||||
@ -445,11 +463,11 @@ void FormParagraph::update()
|
|||||||
Spacing const space = par_->params().spacing();
|
Spacing const space = par_->params().spacing();
|
||||||
|
|
||||||
switch (space.getSpace()) {
|
switch (space.getSpace()) {
|
||||||
default: linespacing = 1; break;
|
default: linespacing = 1; break;
|
||||||
case Spacing::Single: linespacing = 2; break;
|
case Spacing::Single: linespacing = 2; break;
|
||||||
case Spacing::Onehalf: linespacing = 3; break;
|
case Spacing::Onehalf: linespacing = 3; break;
|
||||||
case Spacing::Double: linespacing = 4; break;
|
case Spacing::Double: linespacing = 4; break;
|
||||||
case Spacing::Other: linespacing = 5; break;
|
case Spacing::Other: linespacing = 5; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
fl_set_choice(dialog_->choice_linespacing, linespacing);
|
fl_set_choice(dialog_->choice_linespacing, linespacing);
|
||||||
|
Loading…
Reference in New Issue
Block a user