#490 closed defect (fixed)
Confusing page settings
Reported by: | Owned by: | Juergen Spitzmueller | |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | frontend-xforms | Version: | 1.2.1 |
Severity: | normal | Keywords: | patch VERIFIED |
Cc: | voss@… |
Description
There is a problem with "Layout/Document/Paper" settings:
If I leave the headheight, headsep, footskip empty, I would assume they are
zero. But they are by default NOT! I do not know the default values.
If I put "0" in there, and generate the ps, the result is correct. But if I
revisit the dialog, the "0" is not displayed there any more!
If I open up the lyx file in a text editor, sometimes there is stuff like
"\headsep 0in". That's after I put "0" "unsucessfully" in the dialog!
Therefore, for empty fields, two different results may appear!
Suggestions for fix:
- Display the "0" when zero is specified.
- Display "Package/Latex default" when it is not specified.
Attachments (2)
Change History (11)
comment:1 by , 22 years ago
Cc: | added |
---|
comment:2 by , 22 years ago
Severity: | major → normal |
---|---|
Version: | 1.2.0 → 1.2.1 |
From: juergen.sp@… (Juergen Spitzmueller)
This is a bug. It applies also to the custom margins. If the fields are empty,
then the default margins from geometry are used, which are not "0", but "0"
will be read in as empty field. So it's a rather grave bug.
AFAICS, the bug is in xforms_helpers.C (void updateWidgetsFromLength), line
155 (len.zero()):
if (len.zero()) {
fl_set_input(input, "");
fl_set_choice_text(choice, default_unit.c_str());
} else {
ostringstream buffer;
buffer << len.value();
fl_set_input(input, buffer.str().c_str());
Set the choice to the desired unit, if present in the choice.
Else set the choice to the default unit.
string const unit = subst(stringFromUnit(len.unit()),"%","%%");
vector<string> const vec = getVector(choice);
vector<string>::const_iterator it =
std::find(vec.begin(), vec.end(), unit);
if (it != vec.end()) {
fl_set_choice_text(choice, unit.c_str());
} else {
fl_set_choice_text(choice, default_unit.c_str());
}
}
Obviously, len.zero() does not make a difference between values with "0" and
empty values. This has to be changed. I'm shure it is easy, but I don't know
how. Any hints?
comment:3 by , 22 years ago
I guess "empty value" is default to "0". It can be fixed by adding another
variable and function to that LyxLength class.
bool isDefault;
bool isDefault;
If we treat empty fields as defaults, this problem can be avoided. Since only
the default value displays as empty field. zero field is displayed as "0" with
arbitrary unit, in, cm, mm...
if (len.isDefault()) {
fl_set_input(input, "");
fl_set_choice_text(choice, default_unit.c_str());
} else {
.....
Display zero as "0"
....
}
Is this ok?
by , 21 years ago
Attachment: | bug490.diff added |
---|
fix. parking it here since there's no feedback on lyx-devel
by , 21 years ago
Attachment: | bug490-qt.diff added |
---|
Fix qt too (probably won't apply to current cvs)
comment:4 by , 21 years ago
Keywords: | patch added |
---|---|
Owner: | changed from | to
comment:5 by , 21 years ago
Why is it not possible to have a behaviour like:
empty textfield -> nothing is passed to the inset
and vice versa. _Every_ other not empty textfield
is saved in the usual way. Means "0pt" too.
comment:6 by , 21 years ago
Why is it not possible to have a behaviour like:
empty textfield -> nothing is passed to the inset
This is the case IMHO. The problem is that a missing lyxlength is interpreted as
"0pt" length by now. The null case is just not possible. You see this when you
load a document with no margin values into LyX: they appear as "0pt"-margins in
the doc dialog. My patch changes this.
and vice versa. _Every_ other not empty textfield
is saved in the usual way. Means "0pt" too.
And this happens now too. "0pt" is of course saved as "0pt", that does not change.
Maybe I miss something. Send a patch then please.
comment:7 by , 21 years ago
Your Qt patch is fine with me, with two changes :
1) don't start functions with uppercase letter
2) leave two empty lines between functions
Your other patch also seems fine to me. Update and send
them to lyx-devel again and I'll apply them (and I'll
take the heat if others whine)
Sorry for taking so long to get to this.
Ping our resident latex expert ...