Uwe Stöhr wrote: > Uwe Stöhr schrieb: > >> OK, I'll implement this and send a new patch. > > Here is the patch.
i hoped that fixing this bug i would be able to set the whole document paragraph indent to 0. but this didn't happened, when i set 0 it remains as it was, adding negative number is of no effect. intuitively i would expect these are absolute numbers not onle adding to already defined indent. is this all intended? > To be able to set a default value, I introduced a new unit for Length. I > cannot think of another solution because using a real length to mark that > the user wants the default is not possible, since every set width might be > desired by the user. another solution is to put bool indent_set into bufferparams and let Length as it was. will "default" appear in another dialogues where Length is used? won't it break something? > @@ -566,6 +579,13 @@ > string parsep; > lex >> parsep; > paragraph_separation = parseptranslator().find(parsep); > + } else if (token == "\\paragraph_indentation") { > + lex.next(); > + string indentation = lex.getString(); > + if (indentation == "default") > + pimpl_->indentation = Length(Length::DEFAULT); > + else > + pimpl_->indentation = Length(indentation); if we make default part of Length shouldn't Length("default") works as all another Length values? i would expect such switches are done by the Length class for cleaner code elsewhere. > + } else { > + // when separation by indentation > + // only output something when a indetn width is given > + if (getIndentation().value() > 0) { > + os << "\\setlength{\\parindent}{" i think this is probably why my attempt in the first comment doesn't work, right? would be possible to allow reseting parindent to zero? > +void GuiDocument::setIndent(int item) > +{ > + bool const enable = (item == 1); > + textLayoutModule->indentLE->setEnabled(enable); > + textLayoutModule->indentLengthCO->setEnabled(enable); > + textLayoutModule->skipLE->setEnabled(false); > + textLayoutModule->skipLengthCO->setEnabled(false); > + // clear values, otherwise one would get for a new document the > + // same settings as default as for a currently opened document > + textLayoutModule->skipLE->clear(); this looks wrong on the first glance. doesn't we have separate function for clear values elsewhere? > void GuiDocument::setSkip(int item) > { > bool const enable = (item == 3); > textLayoutModule->skipLE->setEnabled(enable); > textLayoutModule->skipLengthCO->setEnabled(enable); > + // clear values, otherwise one would get for a new document the > + // same settings as default as for a currently opened document > + textLayoutModule->indentLE->clear(); > + isValid(); > } ditto > string const Length::asString() const > { > ostringstream os; > - os << val_ << unit_name[unit_]; // setw? > + if (unit_ != Length::DEFAULT) > + os << val_ << unit_name[unit_]; // setw? > + else > + os << "default"; > return os.str(); > } > > @@ -75,7 +83,10 @@ > docstring const Length::asDocstring() const > { > odocstringstream os; > - os << val_ << unit_name[unit_]; // setw? > + if (unit_ != Length::DEFAULT) > + os << val_ << unit_name[unit_]; // setw? > + else > + os << from_ascii("default"); > return os.str(); > } now you do the switch for default inside, not outside, this is not consistent. i would move both inside. what about moving default directly into unit_name? pavel