]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetlatexaccent.C
prevent crash when inserting minipage in table cell,
[lyx.git] / src / insets / insetlatexaccent.C
index 62af3e8be67e55b7f8049c196e465ab9068cb6b4..d12c85ba60bcb3445226baebf86f87a8af089b9a 100644 (file)
 #include "lyxlex.h"
 #include "metricsinfo.h"
 
+using namespace lyx::support;
+
 using std::ostream;
 using std::endl;
+using std::auto_ptr;
 
 
 /* LatexAccent. Proper handling of accented characters */
@@ -357,7 +360,6 @@ void InsetLatexAccent::draw(PainterInfo & pi, int x, int baseline) const
        // overhaul. Different ways of drawing (what metrics to use)
        // should also be considered.
 
-       BufferView * bv = pi.base.bv;
        LyXFont font = pi.base.font;
        if (lyxrc.font_norm_type == LyXRC::ISO_10646_1)
                font.setLanguage(english_language);
@@ -402,7 +404,8 @@ void InsetLatexAccent::draw(PainterInfo & pi, int x, int baseline) const
                        // closer to the top of the dot-less 'i' or 'j'.
                        char tmpic = ic; // store the ic when we
                        ic = 'x';        // calculates the ascent of
-                       int asc = ascent(bv, font); // the dot-less version (here: 'x')
+#warning metrics?
+                       int asc = ascent(); // the dot-less version (here: 'x')
                        ic = tmpic;      // set the orig ic back
                        y = baseline - asc; // update to new y coord.
                }
@@ -471,7 +474,7 @@ void InsetLatexAccent::draw(PainterInfo & pi, int x, int baseline) const
 
                case CIRCLE:     // circle
                {
-                       LyXFont tmpf(font);
+                       LyXFont tmpf = font;
                        tmpf.decSize().decSize();
                        pi.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),
@@ -647,15 +650,15 @@ bool InsetLatexAccent::directWrite() const
 }
 
 
-Inset * InsetLatexAccent::clone() const
+auto_ptr<InsetBase> InsetLatexAccent::clone() const
 {
-       return new InsetLatexAccent(contents);
+       return auto_ptr<InsetBase>(new InsetLatexAccent(contents));
 }
 
 
-Inset::Code InsetLatexAccent::lyxCode() const
+InsetOld::Code InsetLatexAccent::lyxCode() const
 {
-       return Inset::ACCENT_CODE;
+       return InsetOld::ACCENT_CODE;
 }