]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetcollapsable.C
* In the process of fixing the math background color bug, this commit transfer backgr...
[lyx.git] / src / insets / insetcollapsable.C
index 5c8738c589327b4486f0ac9ed663a43b89822c81..0c480765c7af010bc22a93af0a9ce36a13356b55 100644 (file)
@@ -152,7 +152,7 @@ Dimension InsetCollapsable::dimensionCollapsed() const
 bool InsetCollapsable::metrics(MetricsInfo & mi, Dimension & dim) const
 {
        autoOpen_ = mi.base.bv->cursor().isInside(this);
-       mi.base.textwidth -= 2 * TEXT_TO_INSET_OFFSET;
+       mi.base.textwidth -= (int) (1.5 * TEXT_TO_INSET_OFFSET);
 
        if (status() == Inlined) {
                InsetText::metrics(mi, dim);
@@ -173,13 +173,15 @@ bool InsetCollapsable::metrics(MetricsInfo & mi, Dimension & dim) const
                        } else {
                                dim.des += textdim_.height() + TEXT_TO_BOTTOM_OFFSET;
                                dim.wid = max(dim.wid, textdim_.wid);
+                               if (hasFixedWidth())
+                                       dim.wid = max(dim.wid, mi.base.textwidth);
                        }
                }
        }
        dim.asc += TEXT_TO_INSET_OFFSET;
        dim.des += TEXT_TO_INSET_OFFSET;
-       dim.wid += (int) 1.25 * TEXT_TO_INSET_OFFSET;
-       mi.base.textwidth += 2 * TEXT_TO_INSET_OFFSET;
+       dim.wid += (int) (1.5 * TEXT_TO_INSET_OFFSET);
+       mi.base.textwidth += (int) (1.5 * TEXT_TO_INSET_OFFSET);
        bool const changed = dim_ != dim;
        dim_ = dim;
        return changed;
@@ -441,6 +443,9 @@ void InsetCollapsable::setStatus(LCursor & cur, CollapseStatus status)
        setButtonLabel();
        if (status_ == Collapsed)
                cur.leaveInset(*this);
+       // Because we save CollapseStatus in lyx file, change of status
+       // should lead to a dirty buffer. (This fixes bug 2993).
+       cur.bv().buffer()->markDirty();
 }
 
 
@@ -449,7 +454,7 @@ void InsetCollapsable::setLabelFont(LyXFont & font)
        labelfont_ = font;
 }
 
-docstring InsetCollapsable::floatName(string const & type, BufferParams const & bp)
+docstring InsetCollapsable::floatName(string const & type, BufferParams const & bp) const
 {
        FloatList const & floats = bp.getLyXTextClass().floats();
        FloatList::const_iterator it = floats[type];