]> git.lyx.org Git - features.git/commitdiff
Remove some spacing above InsetColapsible when possible
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Wed, 15 Jan 2020 10:12:47 +0000 (11:12 +0100)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Wed, 15 Jan 2020 10:13:54 +0000 (11:13 +0100)
src/insets/InsetCollapsible.cpp
src/insets/InsetCollapsible.h

index f0b32c8a3f21f0f9a2356c8d64dbcb024c43a476..09e5f3d9a98751653716ee3d491f4220ec21b95c 100644 (file)
@@ -157,6 +157,27 @@ 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:
+               return InsetText::topOffset(bv) / 4;
+       default:
+               return InsetText::topOffset(bv);
+       }
+}
+
 
 Dimension InsetCollapsible::dimensionCollapsed(BufferView const & bv) const
 {
@@ -185,8 +206,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 +338,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()
index 423f2349872246f2c1d1c0e1b6f4a4cad8c69314..95a8e1f52c9830f369a6e85c993a4e3cd38897c0 100644 (file)
@@ -54,6 +54,12 @@ public:
        void read(Lexer &);
        ///
        void write(std::ostream &) const;
+
+       ///
+       int topOffset(BufferView const * bv) const;
+       ///
+       int bottomOffset(BufferView const * bv) const;
+
        ///
        void metrics(MetricsInfo &, Dimension &) const;
        ///