J�rgen S's activation of intelligent code rather than my dumb attempt.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3524 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2002-02-11 18:57:30 +00:00
parent f2e66a940a
commit 1c3b68bf4b
3 changed files with 25 additions and 14 deletions

View File

@ -3,6 +3,14 @@
* FormMinipage.C: return SMI_VALID on other form changes
2002-02-10 Rob Lahaye <lahaye@users.sourceforge.net>
2002-02-11 Juergen Spitzmueller <j.spitzmueller@gmx.de>
* FormParagraph.C (update): [VSpace:] Delete the special method
for gluelengths...
* xforms_helpers.C: ...and move it here.
Activate JMarcs new (shorter) code for updateWidgetsFromLengthString
and updateWidgetsFromLength.
* forms/form_external.fd:
* form_external.C: change color2 of a few buttons into the

View File

@ -412,14 +412,9 @@ void FormParagraph::update()
bool const metric = lyxrc.default_papersize > 3;
string const default_unit = metric ? "cm" : "in";
string const length = par_->params().spaceTop().length().asString();
//check if there's a stretch or shrink factor
if (!isValidLength(length) && !isStrDbl(length))
fl_set_input(dialog_->input_space_above, length.c_str());
else {
updateWidgetsFromLengthString(dialog_->input_space_above,
updateWidgetsFromLengthString(dialog_->input_space_above,
dialog_->choice_value_space_above,
length, default_unit);
}
break;
}
}
@ -458,14 +453,9 @@ void FormParagraph::update()
string const default_unit = metric ? "cm" : "in";
string const length =
par_->params().spaceBottom().length().asString();
//check if there's a stretch or shrink factor
if (!isValidLength(length) && !isStrDbl(length))
fl_set_input(dialog_->input_space_below, length.c_str());
else {
updateWidgetsFromLengthString(dialog_->input_space_below,
updateWidgetsFromLengthString(dialog_->input_space_below,
dialog_->choice_value_space_below,
length, default_unit);
}
break;
}
}

View File

@ -170,7 +170,9 @@ string getLengthFromWidgets(FL_OBJECT * input, FL_OBJECT * choice)
}
#if 1
#if 0
// old code which can be deleted if the new one, now enabled,
// works satisfyingly (JSpitzm, 11/02/2002)
// this should definitely be the other way around!!!
void updateWidgetsFromLength(FL_OBJECT * input, FL_OBJECT * choice,
LyXLength const & len,
@ -179,6 +181,11 @@ void updateWidgetsFromLength(FL_OBJECT * input, FL_OBJECT * choice,
if (len.zero())
updateWidgetsFromLengthString(input, choice,
string(), default_unit);
// use input field only for gluelengths
else if (!isValidLength(len) && !isStrDbl(len)) {
fl_set_input(input, len.c_str());
fl_set_choice_text(choice, default_unit.c_str());
}
else
updateWidgetsFromLengthString(input, choice,
len.asString(), default_unit);
@ -252,8 +259,14 @@ void updateWidgetsFromLengthString(FL_OBJECT * input, FL_OBJECT * choice,
string const & str,
string const & default_unit)
{
updateWidgetsFromLength(input, choice,
// use input field only for gluelengths
if (!isValidLength(str) && !isStrDbl(str)) {
fl_set_input(input, str.c_str());
fl_set_choice_text(choice, default_unit.c_str());
} else {
updateWidgetsFromLength(input, choice,
LyXLength(str), default_unit);
}
}