[LyX/master] Remove some spacing above InsetColapsible when possible
Jean-Marc Lasgouttes
lasgouttes at lyx.org
Wed Jan 15 10:08:36 UTC 2020
commit eeb4187a281b9a5b4bfe8a0576f80f28334b3c90
Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
Date: Wed Jan 15 11:12:47 2020 +0100
Remove some spacing above InsetColapsible when possible
---
src/insets/InsetCollapsible.cpp | 25 +++++++++++++++++++++----
src/insets/InsetCollapsible.h | 6 ++++++
2 files changed, 27 insertions(+), 4 deletions(-)
diff --git a/src/insets/InsetCollapsible.cpp b/src/insets/InsetCollapsible.cpp
index f0b32c8..09e5f3d 100644
--- a/src/insets/InsetCollapsible.cpp
+++ b/src/insets/InsetCollapsible.cpp
@@ -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()
diff --git a/src/insets/InsetCollapsible.h b/src/insets/InsetCollapsible.h
index 423f234..95a8e1f 100644
--- a/src/insets/InsetCollapsible.h
+++ b/src/insets/InsetCollapsible.h
@@ -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;
///
More information about the lyx-cvs
mailing list