]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetCollapsible.cpp
Run codespell on tex2lyx/, client/, convert/ and graphics/
[lyx.git] / src / insets / InsetCollapsible.cpp
index f0b32c8a3f21f0f9a2356c8d64dbcb024c43a476..20e595ff32e22ed0371a58e913afc4969e75e9eb 100644 (file)
@@ -157,6 +157,28 @@ void InsetCollapsible::read(Lexer & lex)
        setButtonLabel();
 }
 
+int InsetCollapsible::topOffset(BufferView const * bv) const
+{
+       switch (geometry(*bv)) {
+       case Corners:
+       case SubLabel:
+               return 0;
+       default:
+               return InsetText::topOffset(bv);
+       }
+}
+
+int InsetCollapsible::bottomOffset(BufferView const * bv) const
+{
+       switch (geometry(*bv)) {
+       case Corners:
+       case SubLabel:
+               return InsetText::bottomOffset(bv) / 4;
+       default:
+               return InsetText::bottomOffset(bv);
+       }
+}
+
 
 Dimension InsetCollapsible::dimensionCollapsed(BufferView const & bv) const
 {
@@ -185,8 +207,6 @@ void InsetCollapsible::metrics(MetricsInfo & mi, Dimension & dim) const
                break;
        case Corners:
                InsetText::metrics(mi, dim);
-               dim.des -= 3;
-               dim.asc -= 1;
                break;
        case SubLabel: {
                InsetText::metrics(mi, dim);
@@ -319,8 +339,6 @@ void InsetCollapsible::draw(PainterInfo & pi, int x, int y) const
                }
 
                int desc = textdim.descent();
-               if (g == Corners)
-                       desc -= 3;
 
                // Colour the frame according to the change type. (Like for tables.)
                Color colour = pi.change.changed() ? pi.change.color()
@@ -353,7 +371,7 @@ void InsetCollapsible::draw(PainterInfo & pi, int x, int y) const
                        int w = 0;
                        int a = 0;
                        int d = 0;
-                       Color const col = pi.full_repaint ? Color_none : pi.backgroundColor(this);
+                       Color const col = pi.full_repaint ? Color_none : pi.backgroundColor();
                        theFontMetrics(font).rectText(buttonLabel(bv), w, a, d);
                        int const ww = max(textdim.wid, w);
                        pi.pain.rectText(x + (ww - w) / 2, y + desc + a,