]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetIPAMacro.cpp
Change tracking cue: for instant preview
[lyx.git] / src / insets / InsetIPAMacro.cpp
index f5c07e33b2d9e9ce2a98bda1204a16bd3eb1b637..fd96a19e746e6a6d93b331a3da92c4e94fcc3aa4 100644 (file)
@@ -59,14 +59,16 @@ IPADecoTranslatorLoc const init_ipadecotranslator_loc()
 
 IPADecoTranslator const & ipadecotranslator()
 {
-       static IPADecoTranslator decotranslator = init_ipadecotranslator();
+       static IPADecoTranslator const decotranslator =
+                       init_ipadecotranslator();
        return decotranslator;
 }
 
 
 IPADecoTranslatorLoc const & ipadecotranslator_loc()
 {
-       static IPADecoTranslatorLoc translator = init_ipadecotranslator_loc();
+       static IPADecoTranslatorLoc const translator =
+           init_ipadecotranslator_loc();
        return translator;
 }
 
@@ -86,7 +88,8 @@ IPACharTranslator const init_ipachartranslator()
 
 IPACharTranslator const & ipachartranslator()
 {
-       static IPACharTranslator chartranslator = init_ipachartranslator();
+       static IPACharTranslator const chartranslator =
+           init_ipachartranslator();
        return chartranslator;
 }
 
@@ -154,7 +157,7 @@ void InsetIPADeco::metrics(MetricsInfo & mi, Dimension & dim) const
                int d = 0;
                docstring const label(1, char_type(0x2040));
                theFontMetrics(font).rectText(label, w, a, d);
-               dim.asc += a * 0.5;
+               dim.asc += int(a * 0.5);
        }
        if (params_.type == InsetIPADecoParams::Bottomtiebar) {
                // consider width of the inset label
@@ -167,7 +170,7 @@ void InsetIPADeco::metrics(MetricsInfo & mi, Dimension & dim) const
                int d = 0;
                docstring const label(1, char_type(0x203f));
                theFontMetrics(font).rectText(label, w, a, d);
-               dim.des += d * 1.5;
+               dim.des += int(d * 1.5);
        }
 
        // cache the inset dimension
@@ -197,7 +200,7 @@ void InsetIPADeco::draw(PainterInfo & pi, int x, int y) const
                docstring const label(1, char_type(0x2040));
                theFontMetrics(font).rectText(label, w, a, d);
                int const ww = max(dim.wid, w);
-               pi.pain.rectText(x + (ww - w) / 2, y - (asc / 2.5),
+               pi.pain.rectText(x + (ww - w) / 2, y - int(asc / 2.5),
                        label, font, Color_none, Color_none);
        }
 
@@ -213,7 +216,7 @@ void InsetIPADeco::draw(PainterInfo & pi, int x, int y) const
                docstring const label(1, char_type(0x203f));
                theFontMetrics(font).rectText(label, w, a, d);
                int const ww = max(dim.wid, w);
-               pi.pain.rectText(x + (ww - w) / 2, y + (desc / 1.5),
+               pi.pain.rectText(x + (ww - w) / 2, y + int(desc / 1.5),
                        label, font, Color_none, Color_none);
        }
 }
@@ -281,11 +284,11 @@ void InsetIPADeco::latex(otexstream & os, OutputParams const & runparams) const
 }
 
 
-int InsetIPADeco::plaintext(odocstream & os,
-                           OutputParams const & runparams) const
+int InsetIPADeco::plaintext(odocstringstream & os,
+                           OutputParams const & runparams, size_t max_length) const
 {
        odocstringstream ods;
-       int h = (int)(InsetCollapsable::plaintext(ods, runparams) / 2);
+       int h = (int)(InsetCollapsable::plaintext(ods, runparams, max_length) / 2);
        docstring result = ods.str();
        docstring const before = result.substr(0, h);
        docstring const after = result.substr(h, result.size());
@@ -354,8 +357,7 @@ void InsetIPADeco::string2params(string const & in, InsetIPADecoParams & params)
 
 void InsetIPADeco::validate(LaTeXFeatures & features) const
 {
-       if (!buffer_->params().useNonTeXFonts)
-               features.require("tipa");
+       features.require("tipa");
        InsetText::validate(features);
 }
 
@@ -449,7 +451,7 @@ void InsetIPAChar::draw(PainterInfo & pi, int x, int y) const
                int h = fm.ascent(char_type('M'));
                int x2 = x + w;
                int y2 = y - h;
-               int y3 = y - (h * 0.75);
+               int y3 = y - int(h * 0.75);
 
                pi.pain.line(x2, y, x2, y2, Color_foreground);
                pi.pain.line(x2, y2, x, y3, Color_foreground);
@@ -461,7 +463,7 @@ void InsetIPAChar::draw(PainterInfo & pi, int x, int y) const
                int h = fm.ascent(char_type('M'));
                int x2 = x + w;
                int y2 = y - h;
-               int y3 = y - (h * 0.25);
+               int y3 = y - int(h * 0.25);
 
                pi.pain.line(x2, y, x2, y2, Color_foreground);
                pi.pain.line(x2, y3, x, y, Color_foreground);
@@ -473,8 +475,8 @@ void InsetIPAChar::draw(PainterInfo & pi, int x, int y) const
                int h = fm.ascent(char_type('M'));
                int x2 = x + w;
                int y2 = y - h;
-               int x3 = x + (w * 0.5);
-               int y3 = y - (h * 0.75);
+               int x3 = x + int(w * 0.5);
+               int y3 = y - int(h * 0.75);
 
                pi.pain.line(x2, y, x2, y2, Color_foreground);
                pi.pain.line(x2, y3, x3, y2, Color_foreground);
@@ -512,7 +514,7 @@ void InsetIPAChar::latex(otexstream & os,
 }
 
 
-int InsetIPAChar::plaintext(odocstream & os, OutputParams const &) const
+int InsetIPAChar::plaintext(odocstringstream & os, OutputParams const &, size_t) const
 {
        switch (kind_) {
        case TONE_FALLING:
@@ -588,11 +590,13 @@ docstring InsetIPAChar::xhtml(XHTMLStream & xs, OutputParams const &) const
 
 void InsetIPAChar::toString(odocstream & os) const
 {
-       plaintext(os, OutputParams(0));
+       odocstringstream ods;
+       plaintext(ods, OutputParams(0));
+       os << ods.str();
 }
 
 
-void InsetIPAChar::forToc(docstring & os, size_t) const
+void InsetIPAChar::forOutliner(docstring & os, size_t const, bool const) const
 {
        odocstringstream ods;
        plaintext(ods, OutputParams(0));
@@ -608,8 +612,7 @@ void InsetIPAChar::validate(LaTeXFeatures & features) const
        case TONE_HIGH_RISING:
        case TONE_LOW_RISING:
        case TONE_HIGH_RISING_FALLING:
-               if (!buffer_->params().useNonTeXFonts)
-                       features.require("tone");
+               features.require("tone");
                break;
        default:
                break;
@@ -617,16 +620,4 @@ void InsetIPAChar::validate(LaTeXFeatures & features) const
 }
 
 
-bool InsetIPAChar::isLetter() const
-{
-       return true;
-}
-
-
-bool InsetIPAChar::isLineSeparator() const
-{
-       return false;
-}
-
-
 } // namespace lyx