]> git.lyx.org Git - features.git/commitdiff
Fix "inset in tabular cell sticks out over cell border" bug
authorMartin Vermeer <martin.vermeer@hut.fi>
Mon, 17 Jul 2006 05:30:36 +0000 (05:30 +0000)
committerMartin Vermeer <martin.vermeer@hut.fi>
Mon, 17 Jul 2006 05:30:36 +0000 (05:30 +0000)
* 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
src/insets/insettabular.C

index 1c9da8cc521edab220ca81e89ea733db5e1ab08c..5c2b3dee169dceeed6fe8c5e2f2aa1b34eefd23d 100644 (file)
@@ -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;
index 3f9fabe9ba03285bb70acfd7368c8789d6058e2b..25dc58b66458cc7eed6e4ee8463a91ac2f0ea261 100644 (file)
@@ -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 ?