]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetlatexaccent.C
Don't remove cell selections after fontchange.
[lyx.git] / src / insets / insetlatexaccent.C
index e5ef5cba393525238a57e0726dbb127a51888bf2..a7cc82eb0a2061db79a51636950434e99e42336f 100644 (file)
@@ -4,7 +4,7 @@
  *           LyX, The Document Processor
  *      
  *         Copyright 1995 Matthias Ettrich
- *          Copyright 1995-2000 The LyX Team.
+ *          Copyright 1995-2001 The LyX Team.
  *
  * ====================================================== */
 
@@ -47,7 +47,10 @@ void InsetLatexAccent::checkContents()
 {
         candisp = false;
 
-       if (contents.empty() || contents.length() < 2) return;
+       if (contents.empty() || contents.length() < 2) {
+               lyxerr[Debug::KEY] << "Cannot decode: " << contents << endl;
+               return;
+       }
 
        // REMOVE IN 0.13
        // Dirty Hack for backward compability. remove in 0.13 (Lgb)
@@ -87,7 +90,10 @@ void InsetLatexAccent::checkContents()
                        contents = tmp;
                }
        }
-        if (contents[0] != '\\') return; // demand that first char is a '\\'
+        if (contents[0] != '\\') { // demand that first char is a '\\'
+               lyxerr[Debug::KEY] << "Cannot decode: " << contents << endl;
+               return;
+       }
 
        lyxerr[Debug::KEY] << "Decode: " << contents << endl;
 
@@ -300,19 +306,19 @@ int InsetLatexAccent::width(BufferView *, LyXFont const & font) const
 }
 
 
-int InsetLatexAccent::Lbearing(LyXFont const & font) const
+int InsetLatexAccent::lbearing(LyXFont const & font) const
 {
        return lyxfont::lbearing(ic, font);
 }
 
 
-int InsetLatexAccent::Rbearing(LyXFont const & font) const
+int InsetLatexAccent::rbearing(LyXFont const & font) const
 {
        return lyxfont::rbearing(ic, font);
 }
 
 
-bool InsetLatexAccent::DisplayISO8859_9(BufferView * bv, LyXFont const & font,
+bool InsetLatexAccent::displayISO8859_9(BufferView * bv, LyXFont const & font,
                                        int baseline, 
                                        float & x) const
 {
@@ -361,7 +367,7 @@ void InsetLatexAccent::draw(BufferView * bv, LyXFont const & font0,
        Painter & pain = bv->painter();
 
        if (lyxrc.font_norm_type == LyXRC::ISO_8859_9)
-               if (DisplayISO8859_9(bv, font0, baseline, x))   
+               if (displayISO8859_9(bv, font0, baseline, x))   
                        return;
        
        /* draw it! */ 
@@ -377,7 +383,7 @@ void InsetLatexAccent::draw(BufferView * bv, LyXFont const & font0,
                int asc = ascent(bv, font);
                int desc = descent(bv, font);
                int wid = width(bv, font);
-               float x2 = x + (Rbearing(font) - Lbearing(font)) / 2.0;
+               float x2 = x + (rbearing(font) - lbearing(font)) / 2.0;
                float hg;
                int y;
                if (plusasc) {
@@ -409,7 +415,7 @@ void InsetLatexAccent::draw(BufferView * bv, LyXFont const & font0,
                        pain.fillRectangle(int(x + tmpx), tmpvar, wid,
                                           lyxfont::ascent('i', font) -
                                           lyxfont::ascent('x', font) - 1,
-                                          LColor::background);
+                                          backgroundColor());
                        // the five lines below is a simple hack to
                        // make the display of accent 'i' and 'j'
                        // better. It makes the accent be written
@@ -542,7 +548,7 @@ void InsetLatexAccent::draw(BufferView * bv, LyXFont const & font0,
                case UMLAUT:    // umlaut
                {
                        pain.text(int(x2 - (lyxfont::rbearing('¨', font) - lyxfont::lbearing('¨', font)) / 2),
-                                 baseline - lyxfont::ascent(ic, font) - lyxfont::descent('¨', font) - ( lyxfont::ascent('¨', font) + lyxfont::descent('¨', font)) / 2,
+                                 baseline - lyxfont::ascent(ic, font) - lyxfont::descent('¨', font) - (lyxfont::ascent('¨', font) + lyxfont::descent('¨', font)) / 2,
                                  '¨', font);
                        break;
                }
@@ -602,7 +608,8 @@ void InsetLatexAccent::draw(BufferView * bv, LyXFont const & font0,
                                   baseline - ascent(bv, font) + 1,
                                   width(bv, font) - 2,
                                   ascent(bv, font)
-                                  + descent(bv, font) - 2);
+                                  + descent(bv, font) - 2,
+                                  backgroundColor());
                pain.rectangle(int(x + 1), baseline - ascent(bv, font) + 1,
                               width(bv, font) - 2,
                               ascent(bv, font) + descent(bv, font) - 2);
@@ -612,21 +619,21 @@ void InsetLatexAccent::draw(BufferView * bv, LyXFont const & font0,
 }
 
 
-void InsetLatexAccent::Write(Buffer const *, ostream & os) const
+void InsetLatexAccent::write(Buffer const *, ostream & os) const
 {
        os << "\\i " << contents << "\n";
 }
 
 
-void InsetLatexAccent::Read(Buffer const *, LyXLex & lex)
+void InsetLatexAccent::read(Buffer const *, LyXLex & lex)
 {
-       lex.EatLine();
-       contents = lex.GetString();
+       lex.eatLine();
+       contents = lex.getString();
        checkContents();
 }
 
 
-int InsetLatexAccent::Latex(Buffer const *, ostream & os,
+int InsetLatexAccent::latex(Buffer const *, ostream & os,
                            bool /*fragile*/, bool/*fs*/) const
 {
        os << contents;
@@ -634,46 +641,46 @@ int InsetLatexAccent::Latex(Buffer const *, ostream & os,
 }
 
 
-int InsetLatexAccent::Ascii(Buffer const *, ostream & os, int) const
+int InsetLatexAccent::ascii(Buffer const *, ostream & os, int) const
 {
        os << contents;
        return 0;
 }
 
 
-int InsetLatexAccent::Linuxdoc(Buffer const *, ostream & os) const
+int InsetLatexAccent::linuxdoc(Buffer const *, ostream & os) const
 {
        os << contents;
        return 0;
 }
 
 
-int InsetLatexAccent::DocBook(Buffer const *, ostream & os) const
+int InsetLatexAccent::docbook(Buffer const *, ostream & os) const
 {
        os << contents;
        return 0;
 }
 
 
-bool InsetLatexAccent::Deletable() const
+bool InsetLatexAccent::deletable() const
 {
        return true;
 }
 
 
-bool InsetLatexAccent::DirectWrite() const
+bool InsetLatexAccent::directWrite() const
 {
        return true;
 }
 
 
-Inset * InsetLatexAccent::Clone(Buffer const &) const
+Inset * InsetLatexAccent::clone(Buffer const &, bool) const
 {
        return new InsetLatexAccent(contents);
 }
 
 
-Inset::Code InsetLatexAccent::LyxCode() const
+Inset::Code InsetLatexAccent::lyxCode() const
 {
        return Inset::ACCENT_CODE;
 }