]> git.lyx.org Git - lyx.git/commitdiff
Fix for Michael's bug: In the "Character layout"dialog,
authorAngus Leeming <leeming@lyx.org>
Tue, 4 Sep 2001 16:11:24 +0000 (16:11 +0000)
committerAngus Leeming <leeming@lyx.org>
Tue, 4 Sep 2001 16:11:24 +0000 (16:11 +0000)
set all options to "reset", close the dialog, re-open it ->
the options are set incorrectly.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2687 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/controllers/ChangeLog
src/frontends/controllers/ControlCharacter.C

index a900c535bb2f0c904e6c75f1e660112eb2ed87ca..b9ca141ad06805fbc78d9e1673e88786f7e3d54f 100644 (file)
@@ -1,5 +1,9 @@
 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).
index 39a4cba3132e79397244c61ce7d2b581790b06ed..e9514593587fe0112f635e20bb189339b3975b30 100644 (file)
@@ -78,9 +78,9 @@ void ControlCharacter::apply()
 
 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();
 }
 
 
@@ -92,9 +92,9 @@ void ControlCharacter::setFamily(LyXFont::FONT_FAMILY val)
 
 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();
 }
 
 
@@ -106,9 +106,9 @@ void ControlCharacter::setSeries(LyXFont::FONT_SERIES val)
 
 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();
 }
 
 
@@ -120,9 +120,9 @@ void ControlCharacter::setShape(LyXFont::FONT_SHAPE val)
 
 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();
 }
 
 
@@ -134,17 +134,24 @@ void ControlCharacter::setSize(LyXFont::FONT_SIZE val)
 
 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;
 }
 
 
@@ -180,29 +187,10 @@ void ControlCharacter::setBar(character::FONT_STATE val)
 
 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();
 }