]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetlatexaccent.C
fix #832
[lyx.git] / src / insets / insetlatexaccent.C
index ccd8401ebf742bf3a83ec07e1fae42676881fe40..da4bbe4375143929aab8585eb8387e7ef748248d 100644 (file)
@@ -1,31 +1,30 @@
-/* This file is part of
- * ====================================================== 
- * 
- *           LyX, The Document Processor
- *      
- *         Copyright 1995 Matthias Ettrich
- *          Copyright 1995-2001 The LyX Team.
+/**
+ * \file insetlatexaccent.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
- * ====================================================== */
+ * \author Lars Gullik Bjønnes
+ *
+ * Full author contact details are available in file CREDITS
+ */
 
 #include <config.h>
 
-#ifdef __GNUG__
-#pragma implementation
-#endif
-
 #include "insetlatexaccent.h"
+
 #include "debug.h"
 #include "lyxrc.h"
 #include "support/lstrings.h"
 #include "BufferView.h"
-#include "Painter.h"
-#include "font.h"
+#include "frontends/Painter.h"
+#include "frontends/font_metrics.h"
 #include "language.h"
+#include "lyxlex.h"
 
 using std::ostream;
 using std::endl;
 
+
 /* LatexAccent. Proper handling of accented characters */
 /* This part is done by Ivan Schreter, schreter@ccsun.tuke.sk */
 /* Later modified by Lars G. Bjønnes, larsbj@lyx.org */
@@ -43,15 +42,18 @@ InsetLatexAccent::InsetLatexAccent(string const & str)
 
 
 void InsetLatexAccent::checkContents()
-        // check, if we know the modifier and can display it ok on screen
+       // check, if we know the modifier and can display it ok on screen
 {
-        candisp = false;
+       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)
-       contents = frontStrip(strip(contents));
+       contents = trim(contents);
        if (!contains(contents, "{") && !contains(contents, "}")) {
                if (contents.length() == 2) {
                        string tmp;
@@ -87,77 +89,82 @@ 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;
 
-        remdot = false; plusasc = false; plusdesc = false;
+       remdot = false;
+       plusasc = false;
+       plusdesc = false;
 
-        switch (contents[1]) { // second char should be one of these
+       switch (contents[1]) { // second char should be one of these
        case '\'':  // acute
-                modtype = ACUTE;    // acute
-                plusasc = true;    // at the top of character
-                break;
+               modtype = ACUTE;    // acute
+               plusasc = true;    // at the top of character
+               break;
        case '`':   // grave
-                modtype = GRAVE;    // grave
-                plusasc = true;    // at the top
-                break;
+               modtype = GRAVE;    // grave
+               plusasc = true;    // at the top
+               break;
        case '=':   // macron
-                modtype = MACRON;    // macron
-                plusasc = true;    // at the top
-                break;
+               modtype = MACRON;    // macron
+               plusasc = true;    // at the top
+               break;
        case '~':   // tilde
-                modtype = TILDE;    // tilde
-                plusasc = true;    // at the top
-                break;
+               modtype = TILDE;    // tilde
+               plusasc = true;    // at the top
+               break;
        case 'b':   // underbar
-                modtype = UNDERBAR;    // underbar
-                plusdesc = true;   // at the bottom
-                break;
+               modtype = UNDERBAR;    // underbar
+               plusdesc = true;   // at the bottom
+               break;
        case 'c':   // cedilla
-                modtype = CEDILLA;    // cedilla
-                plusdesc = true;   // at the bottom
-                break;
+               modtype = CEDILLA;    // cedilla
+               plusdesc = true;   // at the bottom
+               break;
        case 'd':   // underdot
-                modtype = UNDERDOT;    // underdot
-                plusdesc = true;   // at the bottom
-                break;
+               modtype = UNDERDOT;    // underdot
+               plusdesc = true;   // at the bottom
+               break;
        case 'r':   // circle
-                modtype = CIRCLE;    // circle
-                plusasc = true;    // at the top
-                break;
+               modtype = CIRCLE;    // circle
+               plusasc = true;    // at the top
+               break;
        case 't':   // tie
-                modtype = TIE;    // tie
-                plusasc = true;    // at the top
-                break;
+               modtype = TIE;    // tie
+               plusasc = true;    // at the top
+               break;
        case 'u':   // breve
-                modtype = BREVE;    // breve
-                plusasc = true;    // at the top
-                break;
+               modtype = BREVE;    // breve
+               plusasc = true;    // at the top
+               break;
        case 'v':   // caron
-                modtype = CARON;   // caron
-                plusasc = true;    // at the top
-                break;
+               modtype = CARON;   // caron
+               plusasc = true;    // at the top
+               break;
        case 'q':   // special caron
-                modtype = SPECIAL_CARON;   // special caron
-                plusasc = true;    // at the top
-                break;
+               modtype = SPECIAL_CARON;   // special caron
+               plusasc = true;    // at the top
+               break;
        case 'H':   // hungarian umlaut
-                modtype = HUNGARIAN_UMLAUT;   // hungarian umlaut
-                plusasc = true;    // at the top
-                break;
+               modtype = HUNGARIAN_UMLAUT;   // hungarian umlaut
+               plusasc = true;    // at the top
+               break;
        case '"':   // umlaut
-                modtype = UMLAUT;   // umlaut
-                plusasc = true;    // at the top
-                break;
+               modtype = UMLAUT;   // umlaut
+               plusasc = true;    // at the top
+               break;
        case '.':   // dot
-                modtype = DOT;   // dot
-                plusasc = true;    // at the top
-                break;
+               modtype = DOT;   // dot
+               plusasc = true;    // at the top
+               break;
        case '^':   // circumflex
-                modtype = CIRCUMFLEX;   // circumflex
-                plusasc = true;    // at the top
-                break;
+               modtype = CIRCUMFLEX;   // circumflex
+               plusasc = true;    // at the top
+               break;
        case 'k':   // ogonek
                modtype = OGONEK;  // ogonek
                plusdesc = true;
@@ -172,19 +179,19 @@ void InsetLatexAccent::checkContents()
                plusasc = true; // at the top (not really needed)
                remdot = true;
                break;
-       case 'l': // lslash
-               modtype = lSLASH;
-               plusasc = true; // at the top (not really needed)
-               break;
-       case 'L': // lslash
-               modtype = LSLASH;
-               plusasc = true; // at the top (not really needed)
-               break;
+       case 'l': // lslash
+               modtype = lSLASH;
+               plusasc = true; // at the top (not really needed)
+               break;
+       case 'L': // lslash
+               modtype = LSLASH;
+               plusasc = true; // at the top (not really needed)
+               break;
        default:
                lyxerr[Debug::KEY] << "Default" << endl;
                // unknow accent (or something else)
-                return;
-        }
+               return;
+       }
 
        // we demand that third char is a '{' (Lgb)
        if (contents[2] != '{') return;
@@ -204,18 +211,18 @@ void InsetLatexAccent::checkContents()
                        break;
                }
                //ic = (modtype == DOT_LESS_J ? 'j' : 'i');
-               lyxerr[Debug::KEY] << "Contents: [" << contents << "]"
-                                  << ", ic: " << ic 
-                                  << ", top: " << plusasc 
-                                  << ", bot: " << plusdesc 
-                                  << ", dot: " << remdot 
+               lyxerr[Debug::KEY] << "Contents: [" << contents << ']'
+                                  << ", ic: " << ic
+                                  << ", top: " << plusasc
+                                  << ", bot: " << plusdesc
+                                  << ", dot: " << remdot
                                   << ", mod: " << modtype << endl;
                // Special case for space
        } else if (contents[3] == '}') {
                ic = ' ';
        } else {
                int i = 3;
-               
+
                // now get the char
                ic = contents[3]; // i will always be 3 here
 
@@ -238,20 +245,20 @@ void InsetLatexAccent::checkContents()
                        contents= temp;
                        ++i;
                        remdot = true;
-               }    
+               }
 
                // demand a '}' at the end
                if (contents[++i] != '}' && contents[++i]) return;
-                                          
+
                // fine, the char is properly decoded now (hopefully)
-               lyxerr[Debug::KEY] << "Contents: [" << contents << "]"
+               lyxerr[Debug::KEY] << "Contents: [" << contents << ']'
                                   << ", ic: " << ic
-                                  << ", top: " << plusasc 
-                                  << ", bot: " << plusdesc 
+                                  << ", top: " << plusasc
+                                  << ", bot: " << plusdesc
                                   << ", dot: " << remdot
                                   << ", mod: " << modtype << endl;
        }
-        candisp = true;
+       candisp = true;
 }
 
 
@@ -264,13 +271,13 @@ int InsetLatexAccent::ascent(BufferView *, LyXFont const & font) const
        int max;
        if (candisp) {
                if (ic == ' ')
-                       max = lyxfont::ascent('a', font);
+                       max = font_metrics::ascent('a', font);
                else
-                       max = lyxfont::ascent(ic, font);
-               if (plusasc) 
-                       max += (lyxfont::maxAscent(font) + 3) / 3;
+                       max = font_metrics::ascent(ic, font);
+               if (plusasc)
+                       max += (font_metrics::maxAscent(font) + 3) / 3;
        } else
-               max = lyxfont::maxAscent(font) + 4;
+               max = font_metrics::maxAscent(font) + 4;
        return max;
 }
 
@@ -279,14 +286,14 @@ int InsetLatexAccent::descent(BufferView *, LyXFont const & font) const
 {
        int max;
        if (candisp) {
-               if (ic == ' ') 
-                       max = lyxfont::descent('a', font);
-                else
-                       max = lyxfont::descent(ic, font);
-                if (plusdesc)
-                       max += 3;
+               if (ic == ' ')
+                       max = font_metrics::descent('a', font);
+               else
+               max = font_metrics::descent(ic, font);
+               if (plusdesc)
+               max += 3;
        } else
-               max = lyxfont::maxDescent(font) + 4;
+               max = font_metrics::maxDescent(font) + 4;
        return max;
 }
 
@@ -294,30 +301,30 @@ int InsetLatexAccent::descent(BufferView *, LyXFont const & font) const
 int InsetLatexAccent::width(BufferView *, LyXFont const & font) const
 {
        if (candisp)
-               return lyxfont::width(ic, font);
-        else
-                return lyxfont::width(contents, font) + 4;
+               return font_metrics::width(ic, font);
+       else
+               return font_metrics::width(contents, font) + 4;
 }
 
 
 int InsetLatexAccent::lbearing(LyXFont const & font) const
 {
-       return lyxfont::lbearing(ic, font);
+       return font_metrics::lbearing(ic, font);
 }
 
 
 int InsetLatexAccent::rbearing(LyXFont const & font) const
 {
-       return lyxfont::rbearing(ic, font);
+       return font_metrics::rbearing(ic, font);
 }
 
 
 bool InsetLatexAccent::displayISO8859_9(BufferView * bv, LyXFont const & font,
-                                       int baseline, 
+                                       int baseline,
                                        float & x) const
 {
        unsigned char tmpic = ic;
-       
+
        switch (modtype) {
        case CEDILLA:
        {
@@ -340,7 +347,7 @@ bool InsetLatexAccent::displayISO8859_9(BufferView * bv, LyXFont const & font,
                if (ic == 'U') tmpic = 0xdc;
                break;
        }
-       case DOT:        if (ic == 'I') tmpic = 0xdd; break;
+       case DOT:        if (ic == 'I') tmpic = 0xdd; break;
        case DOT_LESS_I: tmpic = 0xfd; break;
        default:         return false;
        }
@@ -356,15 +363,15 @@ bool InsetLatexAccent::displayISO8859_9(BufferView * bv, LyXFont const & font,
 
 
 void InsetLatexAccent::draw(BufferView * bv, LyXFont const & font0,
-                           int baseline, float & x, bool) const
+                           int baseline, float & x) const
 {
        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! */ 
+
+       /* draw it! */
        // All the manually drawn accents in this function could use an
        // overhaul. Different ways of drawing (what metrics to use)
        // should also be considered.
@@ -372,7 +379,7 @@ void InsetLatexAccent::draw(BufferView * bv, LyXFont const & font0,
        LyXFont font(font0);
        if (lyxrc.font_norm_type == LyXRC::ISO_10646_1)
                font.setLanguage(english_language);
-       
+
        if (candisp) {
                int asc = ascent(bv, font);
                int desc = descent(bv, font);
@@ -382,7 +389,7 @@ void InsetLatexAccent::draw(BufferView * bv, LyXFont const & font0,
                int y;
                if (plusasc) {
                        // mark at the top
-                       hg = lyxfont::maxDescent(font);
+                       hg = font_metrics::maxDescent(font);
                        y = baseline - asc;
 
                        if (font.shape() == LyXFont::ITALIC_SHAPE)
@@ -400,16 +407,16 @@ void InsetLatexAccent::draw(BufferView * bv, LyXFont const & font0,
                pain.text(int(x), baseline, ic, font);
 
                if (remdot) {
-                       int tmpvar = baseline - lyxfont::ascent('i', font);
+                       int tmpvar = baseline - font_metrics::ascent('i', font);
                        float tmpx = 0;
                        if (font.shape() == LyXFont::ITALIC_SHAPE)
                                tmpx += (8.0 * hg) / 10.0; // italic
                        lyxerr[Debug::KEY] << "Removing dot." << endl;
                        // remove the dot first
                        pain.fillRectangle(int(x + tmpx), tmpvar, wid,
-                                          lyxfont::ascent('i', font) -
-                                          lyxfont::ascent('x', font) - 1,
-                                          LColor::background);
+                                          font_metrics::ascent('i', font) -
+                                          font_metrics::ascent('x', font) - 1,
+                                          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
@@ -423,58 +430,58 @@ void InsetLatexAccent::draw(BufferView * bv, LyXFont const & font0,
                // now the rest - draw within (x, y, x+wid, y+hg)
                switch (modtype) {
                case ACUTE:     // acute 0xB4
-               {
-                       pain.text(int(x2 - (lyxfont::rbearing(0xB4, font) - lyxfont::lbearing(0xB4, font)) / 2),
-                                 baseline - lyxfont::ascent(ic, font) - lyxfont::descent(0xB4, font) - (lyxfont::ascent(0xB4, font) + lyxfont::descent(0xB4, font)) / 2,
+               {
+                       pain.text(int(x2 - (font_metrics::rbearing(0xB4, font) - font_metrics::lbearing(0xB4, font)) / 2),
+                                 baseline - font_metrics::ascent(ic, font) - font_metrics::descent(0xB4, font) - (font_metrics::ascent(0xB4, font) + font_metrics::descent(0xB4, font)) / 2,
                                  char(0xB4), font);
                        break;
                }
                case GRAVE:     // grave 0x60
                {
-                       pain.text(int(x2 - (lyxfont::rbearing(0x60, font) - lyxfont::lbearing(0x60, font)) / 2),
-                                 int(baseline - lyxfont::ascent(ic, font) - lyxfont::descent(0x60, font) - (lyxfont::ascent(0x60, font) + lyxfont::descent(0x60, font)) / 2.0),
+                       pain.text(int(x2 - (font_metrics::rbearing(0x60, font) - font_metrics::lbearing(0x60, font)) / 2),
+                                 int(baseline - font_metrics::ascent(ic, font) - font_metrics::descent(0x60, font) - (font_metrics::ascent(0x60, font) + font_metrics::descent(0x60, font)) / 2.0),
                                  char(0x60), font);
                        break;
                }
                case MACRON:     // macron
                {
-                       pain.text(int(x2 - (lyxfont::rbearing(0xAF, font) - lyxfont::lbearing(0xAF, font)) / 2),
-                                 baseline - lyxfont::ascent(ic, font) - lyxfont::descent(0xAF, font) - (lyxfont::ascent(0xAF, font) + lyxfont::descent(0xAF, font)),
+                       pain.text(int(x2 - (font_metrics::rbearing(0xAF, font) - font_metrics::lbearing(0xAF, font)) / 2),
+                                 baseline - font_metrics::ascent(ic, font) - font_metrics::descent(0xAF, font) - (font_metrics::ascent(0xAF, font) + font_metrics::descent(0xAF, font)),
                                  char(0xAF), font);
                        break;
                }
                case TILDE:     // tilde
                {
-                       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,
+                       pain.text(int(x2 - (font_metrics::rbearing('~', font) - font_metrics::lbearing('~', font)) / 2),
+                                 baseline - font_metrics::ascent(ic, font) - font_metrics::descent('~', font) - (font_metrics::ascent('~', font) + font_metrics::descent('~', font)) / 2,
                                  '~', font);
                        break;
                }
                case UNDERBAR:     // underbar 0x5F
                {
-                       pain.text(int(x2 - (lyxfont::rbearing(0x5F, font) - lyxfont::lbearing(0x5F, font)) / 2), baseline,
+                       pain.text(int(x2 - (font_metrics::rbearing(0x5F, font) - font_metrics::lbearing(0x5F, font)) / 2), baseline,
                                  char(0x5F), font);
                        break;
                }
                case CEDILLA:     // cedilla
                {
-                       pain.text(int(x2 - (lyxfont::rbearing(0xB8, font) - lyxfont::lbearing(0xB8, font)) / 2), baseline,
+                       pain.text(int(x2 - (font_metrics::rbearing(0xB8, font) - font_metrics::lbearing(0xB8, font)) / 2), baseline,
                                  char(0xB8), font);
-                       
+
                        break;
                }
                case UNDERDOT:     // underdot
                {
-                       pain.text(int(x2 - (lyxfont::rbearing('.', font) - lyxfont::lbearing('.', font)) / 2.0),
-                                 int(baseline + 3.0 / 2.0 * (lyxfont::ascent('.', font) + lyxfont::descent('.', font))),
+                       pain.text(int(x2 - (font_metrics::rbearing('.', font) - font_metrics::lbearing('.', font)) / 2.0),
+                                 int(baseline + 3.0 / 2.0 * (font_metrics::ascent('.', font) + font_metrics::descent('.', font))),
                                  '.', font);
                        break;
                }
 
                case DOT:    // dot
                {
-                       pain.text(int(x2 - (lyxfont::rbearing('.', font) - lyxfont::lbearing('.', font)) / 2.0),
-                                 baseline - lyxfont::ascent(ic, font) - lyxfont::descent('.', font) - (lyxfont::ascent('.', font) + lyxfont::descent('.', font)) / 2,
+                       pain.text(int(x2 - (font_metrics::rbearing('.', font) - font_metrics::lbearing('.', font)) / 2.0),
+                                 baseline - font_metrics::ascent(ic, font) - font_metrics::descent('.', font) - (font_metrics::ascent('.', font) + font_metrics::descent('.', font)) / 2,
                                  '.', font);
                        break;
                }
@@ -483,8 +490,8 @@ void InsetLatexAccent::draw(BufferView * bv, LyXFont const & font0,
                {
                        LyXFont tmpf(font);
                        tmpf.decSize().decSize();
-                       pain.text(int(x2 - (lyxfont::rbearing(0xB0, tmpf) - lyxfont::lbearing(0xB0, tmpf)) / 2.0),
-                                 int(baseline - lyxfont::ascent(ic, font) - lyxfont::descent(0xB0, tmpf) - (lyxfont::ascent(0xB0, tmpf) + lyxfont::descent(0xB0, tmpf)) / 3.0),
+                       pain.text(int(x2 - (font_metrics::rbearing(0xB0, tmpf) - font_metrics::lbearing(0xB0, tmpf)) / 2.0),
+                                 int(baseline - font_metrics::ascent(ic, font) - font_metrics::descent(0xB0, tmpf) - (font_metrics::ascent(0xB0, tmpf) + font_metrics::descent(0xB0, tmpf)) / 3.0),
                                  char(0xB0), tmpf);
                        break;
                }
@@ -503,7 +510,7 @@ void InsetLatexAccent::draw(BufferView * bv, LyXFont const & font0,
                case CARON:    // caron
                {
                        int xp[3], yp[3];
-                       
+
                        xp[0] = int(x2 - hg35); yp[0] = int(y + hg35);
                        xp[1] = int(x2);        yp[1] = int(y + hg);
                        xp[2] = int(x2 + hg35); yp[2] = int(y + hg35);
@@ -519,10 +526,10 @@ void InsetLatexAccent::draw(BufferView * bv, LyXFont const & font0,
                        int xp[3], yp[3];
                        xp[0] = int(x + wid);
                        yp[0] = int(y + hg35 + hg);
-                       
+
                        xp[1] = int(x + wid + (hg35 / 2.0));
                        yp[1] = int(y + hg + (hg35 / 2.0));
-                       
+
                        xp[2] = int(x + wid + (hg35 / 2.0));
                        yp[2] = y + int(hg);
 
@@ -531,18 +538,18 @@ void InsetLatexAccent::draw(BufferView * bv, LyXFont const & font0,
                }
                case HUNGARIAN_UMLAUT:    // hung. umlaut
                {
-                       pain.text(int(x2 - (lyxfont::rbearing('´', font) - lyxfont::lbearing('´', font))),
-                                 baseline - lyxfont::ascent(ic, font) - lyxfont::descent('´', font) - (lyxfont::ascent('´', font) + lyxfont::descent('´', font)) / 2,
+                       pain.text(int(x2 - (font_metrics::rbearing('´', font) - font_metrics::lbearing('´', font))),
+                                 baseline - font_metrics::ascent(ic, font) - font_metrics::descent('´', font) - (font_metrics::ascent('´', font) + font_metrics::descent('´', font)) / 2,
                                  '´', font);
                        pain.text(int(x2),
-                                 baseline - lyxfont::ascent(ic, font) - lyxfont::descent('´', font) - (lyxfont::ascent('´', font) + lyxfont::descent('´', font)) / 2,
+                                 baseline - font_metrics::ascent(ic, font) - font_metrics::descent('´', font) - (font_metrics::ascent('´', font) + font_metrics::descent('´', font)) / 2,
                                  '´', font);
                        break;
                }
                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,
+                       pain.text(int(x2 - (font_metrics::rbearing('¨', font) - font_metrics::lbearing('¨', font)) / 2),
+                                 baseline - font_metrics::ascent(ic, font) - font_metrics::descent('¨', font) - (font_metrics::ascent('¨', font) + font_metrics::descent('¨', font)) / 2,
                                  '¨', font);
                        break;
                }
@@ -550,8 +557,8 @@ void InsetLatexAccent::draw(BufferView * bv, LyXFont const & font0,
                {
                        LyXFont tmpf(font);
                        tmpf.decSize().decSize().decSize();
-                       pain.text(int(x2 - (lyxfont::rbearing(0x5E, tmpf) - lyxfont::lbearing(0x5E, tmpf)) / 2),
-                                 int(baseline - lyxfont::ascent(ic, font) - lyxfont::descent(0x5E, tmpf) - (lyxfont::ascent(0x5E, tmpf) + lyxfont::descent(0x5E, tmpf)) / 3.0),
+                       pain.text(int(x2 - (font_metrics::rbearing(0x5E, tmpf) - font_metrics::lbearing(0x5E, tmpf)) / 2),
+                                 int(baseline - font_metrics::ascent(ic, font) - font_metrics::descent(0x5E, tmpf) - (font_metrics::ascent(0x5E, tmpf) + font_metrics::descent(0x5E, tmpf)) / 3.0),
                                  char(0x5E), tmpf);
                        break;
                }
@@ -560,16 +567,16 @@ void InsetLatexAccent::draw(BufferView * bv, LyXFont const & font0,
                        // this does probably not look like an ogonek, so
                        // it should certainly be refined
                        int xp[4], yp[4];
-                       
+
                        xp[0] = int(x2);
                        yp[0] = y;
-                       
+
                        xp[1] = int(x2);
                        yp[1] = y + int(hg35);
-                       
+
                        xp[2] = int(x2 - hg35);
                        yp[2] = y + int(hg / 2.0);
-                       
+
                        xp[3] = int(x2 + hg / 4.0);
                        yp[3] = y + int(hg);
 
@@ -580,15 +587,15 @@ void InsetLatexAccent::draw(BufferView * bv, LyXFont const & font0,
                case LSLASH:
                {
                        int xp[2], yp[2];
-                       
-                       xp[0] = int(x);
+
+                       xp[0] = int(x);
                        yp[0] = y + int(3.0 * hg);
-                       
-                       xp[1] = int(x + float(wid) * 0.75);
+
+                       xp[1] = int(x + float(wid) * 0.75);
                        yp[1] = y + int(hg);
-                       
-                       pain.lines(xp, yp, 2);
-                       break;
+
+                       pain.lines(xp, yp, 2);
+                       break;
                }
                case DOT_LESS_I: // dotless-i
                case DOT_LESS_J: // dotless-j
@@ -602,7 +609,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);
@@ -620,8 +628,8 @@ void InsetLatexAccent::write(Buffer const *, ostream & os) const
 
 void InsetLatexAccent::read(Buffer const *, LyXLex & lex)
 {
-       lex.EatLine();
-       contents = lex.GetString();
+       lex.eatLine();
+       contents = lex.getString();
        checkContents();
 }
 
@@ -648,19 +656,13 @@ int InsetLatexAccent::linuxdoc(Buffer const *, ostream & os) const
 }
 
 
-int InsetLatexAccent::docBook(Buffer const *, ostream & os) const
+int InsetLatexAccent::docbook(Buffer const *, ostream & os, bool) const
 {
        os << contents;
        return 0;
 }
 
 
-bool InsetLatexAccent::deletable() const
-{
-       return true;
-}
-
-
 bool InsetLatexAccent::directWrite() const
 {
        return true;