From 20a9acdecee424657b39ddc72c82a49ac86ef59a Mon Sep 17 00:00:00 2001 From: Martin Vermeer Date: Mon, 17 Jul 2006 05:30:36 +0000 Subject: [PATCH] Fix "inset in tabular cell sticks out over cell border" bug * insetcollapsable.C (InsetCollapsable::metrics): make sure openinlined_ does not contain mi.base.textwidth * insettabular.C (InsetTabular::metrics): modify m.base.textwidth calculation git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14472 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/insets/insetcollapsable.C | 3 ++- src/insets/insettabular.C | 8 +++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/insets/insetcollapsable.C b/src/insets/insetcollapsable.C index 1c9da8cc52..5c2b3dee16 100644 --- a/src/insets/insetcollapsable.C +++ b/src/insets/insetcollapsable.C @@ -138,7 +138,8 @@ void InsetCollapsable::metrics(MetricsInfo & mi, Dimension & dim) const dim = dimensionCollapsed(); if (status() == Open) { InsetText::metrics(mi, textdim_); - openinlined_ = textdim_.wid + 2 * dim.wid <= mi.base.textwidth; + // This expression should not contain mi.base.texwidth + openinlined_ = textdim_.wid < 0.5 * mi.base.bv->workWidth(); if (openinlined_) { // Correct for button width, and re-fit mi.base.textwidth -= dim.wid; diff --git a/src/insets/insettabular.C b/src/insets/insettabular.C index 3f9fabe9ba..25dc58b664 100644 --- a/src/insets/insettabular.C +++ b/src/insets/insettabular.C @@ -274,9 +274,15 @@ void InsetTabular::metrics(MetricsInfo & mi, Dimension & dim) const tabular.getCellInset(cell)->metrics(m, dim); if (!p_width.zero()) dim.wid = m.base.textwidth; + tabular.setWidthOfCell(cell, dim.wid); + if (p_width.zero()) { + m.base.textwidth = dim.wid + 2 * ADD_TO_TABULAR_WIDTH; + // FIXME there must be a way to get rid of + // the second metrics call + tabular.getCellInset(cell)->metrics(m, dim); + } maxAsc = max(maxAsc, dim.asc); maxDesc = max(maxDesc, dim.des); - tabular.setWidthOfCell(cell, dim.wid); ++cell; } int const top_space = tabular.row_info[i].top_space_default ?