]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathHull.cpp
Fix creationCode() of GuiPrintNomencl
[lyx.git] / src / mathed / InsetMathHull.cpp
index 01501929c642f5b3d5078a715292cfd3f5ecc46a..0a7ddd6d005858caa476ba2c5e7dea6899f102bf 100644 (file)
@@ -126,14 +126,14 @@ namespace {
                if (os.strikeoutMath()) {
                        if (os.ulemCmd() == WriteStream::UNDERLINE)
                                os << "\\raisebox{-\\belowdisplayshortskip}{"
-                                     "\\lyxmathsout{\\parbox[b]{\\columnwidth}{";
+                                     "\\lyxmathsout{\\parbox[b]{\\linewidth}{";
                        else
-                               os << "\\lyxmathsout{\\parbox{\\columnwidth}{";
+                               os << "\\lyxmathsout{\\parbox{\\linewidth}{";
                } else if (os.ulemCmd() == WriteStream::UNDERLINE)
                        os << "\\raisebox{-\\belowdisplayshortskip}{"
-                             "\\parbox[b]{\\columnwidth}{";
+                             "\\parbox[b]{\\linewidth}{";
                else if (os.ulemCmd() == WriteStream::STRIKEOUT)
-                       os << "\\parbox{\\columnwidth}{";
+                       os << "\\parbox{\\linewidth}{";
        }
 
 
@@ -570,13 +570,6 @@ void InsetMathHull::metrics(MetricsInfo & mi, Dimension & dim) const
 
        // reserve some space for marker.
        dim.wid += 2;
-
-       // make it at least as high as the current font
-       int asc = 0;
-       int des = 0;
-       math_font_max_dim(mi.base.font, asc, des);
-       dim.asc = max(dim.asc, asc);
-       dim.des = max(dim.des, des);
 }
 
 
@@ -599,6 +592,25 @@ ColorCode InsetMathHull::backgroundColor(PainterInfo const & pi) const
 }
 
 
+void InsetMathHull::drawMarkers(PainterInfo & pi, int x, int y) const
+{
+       ColorCode pen_color = mouseHovered(pi.base.bv) || editing(pi.base.bv)?
+               Color_mathframe : Color_mathcorners;
+       // If the corners have the same color as the background, do not paint them.
+       if (lcolor.getX11Name(Color_mathbg) == lcolor.getX11Name(pen_color))
+               return;
+
+       Inset::drawMarkers(pi, x, y);
+       Dimension const dim = dimension(*pi.base.bv);
+       int const t = x + dim.width() - 1;
+       int const a = y - dim.ascent();
+       pi.pain.line(x, a + 3, x, a, pen_color);
+       pi.pain.line(t, a + 3, t, a, pen_color);
+       pi.pain.line(x, a, x + 3, a, pen_color);
+       pi.pain.line(t - 3, a, t, a, pen_color);
+}
+
+
 void InsetMathHull::drawBackground(PainterInfo & pi, int x, int y) const
 {
        Dimension const dim = dimension(*pi.base.bv);
@@ -659,7 +671,7 @@ void InsetMathHull::draw(PainterInfo & pi, int x, int y) const
        }
 
        InsetMathGrid::draw(pi, xmath + 1, y);
-       drawMarkers2(pi, x, y);
+       drawMarkers(pi, x, y);
 
        if (numberedType()) {
                Changer dummy = pi.base.changeFontSet("mathrm");
@@ -1026,7 +1038,7 @@ int InsetMathHull::indent(BufferView const & bv) const
 {
        // FIXME: set this in the textclass. This value is what the article class uses.
        static Length default_indent(2.5, Length::EM);
-       if (buffer().params().is_math_indent) {
+       if (display() != Inline && buffer().params().is_math_indent) {
                Length const & len = buffer().params().getMathIndent();
                if (len.empty())
                        return bv.inPixels(default_indent);
@@ -2248,7 +2260,7 @@ void InsetMathHull::revealCodes(Cursor & cur) const
        if (!cur.inMathed())
                return;
        odocstringstream os;
-       cur.info(os);
+       cur.info(os, false);
        cur.message(os.str());
 /*
        // write something to the minibuffer