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
This commit is contained in:
Martin Vermeer 2006-07-17 05:30:36 +00:00
parent 921f1144cc
commit 20a9acdece
2 changed files with 9 additions and 2 deletions

View File

@ -138,7 +138,8 @@ void InsetCollapsable::metrics(MetricsInfo & mi, Dimension & dim) const
dim = dimensionCollapsed(); dim = dimensionCollapsed();
if (status() == Open) { if (status() == Open) {
InsetText::metrics(mi, textdim_); 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_) { if (openinlined_) {
// Correct for button width, and re-fit // Correct for button width, and re-fit
mi.base.textwidth -= dim.wid; mi.base.textwidth -= dim.wid;

View File

@ -274,9 +274,15 @@ void InsetTabular::metrics(MetricsInfo & mi, Dimension & dim) const
tabular.getCellInset(cell)->metrics(m, dim); tabular.getCellInset(cell)->metrics(m, dim);
if (!p_width.zero()) if (!p_width.zero())
dim.wid = m.base.textwidth; 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); maxAsc = max(maxAsc, dim.asc);
maxDesc = max(maxDesc, dim.des); maxDesc = max(maxDesc, dim.des);
tabular.setWidthOfCell(cell, dim.wid);
++cell; ++cell;
} }
int const top_space = tabular.row_info[i].top_space_default ? int const top_space = tabular.row_info[i].top_space_default ?