10/04/2013 00:01, Uwe Stöhr:
I can use an empty length (see attached patch) but this results in "0pt"
as length when the length is read. But "0pt" is a valid length. I can
change from 99.9col% to 0pt as length for the case that no length is
given if you like. But is this a better solution than mine? The problem
I see is that "0pt" is used as length if you want to have a box with the
height of its contents but not width, this is a case that I would not
allow anymore if I would handle 0pt as no length.
But maybe I only make a mistake and there is a way to prevent that an
empty length is read as 0pt?
Look for some comments below. I am not sure that what I propose will be
enough to make things work, but it should be a good first step. What is
missing is some code to detect in the InsetBox dialog that the length
value is empty and to use an empty length in this case.
Hope this helps.
JMarc
- // "-999col%" is the code for no width
- if ((params.width).asString() == "-999col%")
+ // an empty length is the code for no width
+ if ((params.width).asString().empty())
Use:
if(params.width.empty())
Note that Length::asString/asDocString/asLatexString should be changed
to output a null string for an empty length. I can do that if you want.
params.special = "none";
- params.width = Length("-999col%");
+ params.width = Length();
This is OK.
diff --git a/src/insets/InsetBox.cpp b/src/insets/InsetBox.cpp
bool InsetBox::hasFixedWidth() const
{
- return from_ascii(params_.width.asLatexString()) !=
"-9.99\\columnwidth";
+ return from_ascii(params_.width.asLatexString()) != "";
}
Use:
return !params_width.empty();
case Boxed:
- // "-999col%" is the code for no width
- if (from_ascii(width_string) != "-9.99\\columnwidth") {
+ // an empty length is the code for no width
+ if (from_ascii(width_string) != "") {
Use:
if (!params_.width.empty()) {
- // "-999col%" is the code for no width
- if (from_ascii(width_string) != "-9.99\\columnwidth") {
+ // an empty length is the code for no width
+ if (from_ascii(width_string) != "") {
Use:
return !params_width.empty();