2001-09-04 Angus Leeming <a.leeming@ic.ac.uk>
+ * ControlCharacter.C: fix Michael's bug: In the "Character layout"
+ dialog, set all options to "reset", close the dialog, re-open it ->
+ the options are set incorrectly.
+
* ControlButtons.[Ch]: add an is_closing_ variable and isClosing method.
When Applying it's useful to know whether the dialog is about to close
or not (no point refreshing the display for example).
LyXFont::FONT_FAMILY ControlCharacter::getFamily() const
{
- if (font_.get())
- return font_->family();
- return LyXFont::IGNORE_FAMILY;
+ if (!font_.get())
+ return LyXFont::IGNORE_FAMILY;
+ return font_->family();
}
LyXFont::FONT_SERIES ControlCharacter::getSeries() const
{
- if (font_.get())
- return font_->series();
- return LyXFont::IGNORE_SERIES;
+ if (!font_.get())
+ return LyXFont::IGNORE_SERIES;
+ return font_->series();
}
LyXFont::FONT_SHAPE ControlCharacter::getShape() const
{
- if (font_.get())
- return font_->shape();
- return LyXFont::IGNORE_SHAPE;
+ if (!font_.get())
+ return LyXFont::IGNORE_SHAPE;
+ return font_->shape();
}
LyXFont::FONT_SIZE ControlCharacter::getSize() const
{
- if (font_.get())
- return font_->size();
- return LyXFont::IGNORE_SIZE;
+ if (!font_.get())
+ return LyXFont::IGNORE_SIZE;
+ return font_->size();
}
character::FONT_STATE ControlCharacter::getBar() const
{
- if (font_.get()) {
- if (font_->emph() != LyXFont::IGNORE)
- return character::EMPH_TOGGLE;
+ if (!font_.get())
+ return character::IGNORE;
- else if (font_->underbar() != LyXFont::IGNORE)
- return character::UNDERBAR_TOGGLE;
+ if (font_->emph() == LyXFont::TOGGLE)
+ return character::EMPH_TOGGLE;
- else if (font_->noun() != LyXFont::IGNORE)
- return character::NOUN_TOGGLE;
- }
- return character::IGNORE;
+ if (font_->underbar() == LyXFont::TOGGLE)
+ return character::UNDERBAR_TOGGLE;
+
+ if (font_->noun() == LyXFont::TOGGLE)
+ return character::NOUN_TOGGLE;
+
+ if (font_->emph() == LyXFont::IGNORE &&
+ font_->underbar() == LyXFont::IGNORE &&
+ font_->noun() == LyXFont::IGNORE)
+ return character::IGNORE;
+
+ return character::INHERIT;
}
LColor::color ControlCharacter::getColor() const
{
- LColor::color col = LColor::ignore;
-
- if (font_.get()) {
- switch (font_->color()) {
- case LColor::ignore:
- case LColor::none:
- case LColor::black:
- case LColor::white:
- case LColor::red:
- case LColor::green:
- case LColor::blue:
- case LColor::cyan:
- case LColor::magenta:
- case LColor::yellow:
- case LColor::inherit:
- break;
- default:
- col = font_->color();
- break;
- }
- }
+ if (!font_.get())
+ return LColor::ignore;
- return col;
+ return font_->color();
}