]> git.lyx.org Git - features.git/commitdiff
remove the spurious metrics() (ex-update()) call from setRowHeight()
authorAndré Pönitz <poenitz@gmx.net>
Fri, 22 Aug 2003 11:54:02 +0000 (11:54 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Fri, 22 Aug 2003 11:54:02 +0000 (11:54 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7590 a592a061-630c-0410-9148-cb99ea01b6c8

src/text.C
src/text2.C
src/text3.C

index acb3710d0034614b808343875a238cf96be5557e..ba76a8a2510f9b19091df0e05879048f8adc86b6 100644 (file)
@@ -999,21 +999,9 @@ void LyXText::setHeightOfRow(ParagraphList::iterator pit, RowList::iterator rit)
                                if (par.isInset(pos)) {
                                        InsetOld const * tmpinset = par.getInset(pos);
                                        if (tmpinset) {
-#if 1 // this is needed for deep update on initialitation
-#warning inset->update FIXME
-                                               //tmpinset->update(bv());
-                                               LyXFont const tmpfont = getFont(pit, pos);
-                                               Dimension dim;
-                                               MetricsInfo mi(bv(), tmpfont, workWidth());
-                                               tmpinset->metrics(mi, dim);
-                                               maxwidth += dim.wid;
-                                               maxasc = max(maxasc, dim.asc);
-                                               maxdesc = max(maxdesc, dim.des);
-#else
                                                maxwidth += tmpinset->width();
                                                maxasc = max(maxasc, tmpinset->ascent());
                                                maxdesc = max(maxdesc, tmpinset->descent());
-#endif
                                        }
                                } else {
                                        // Fall-back to normal case
@@ -1985,9 +1973,7 @@ void LyXText::backspace()
                                }
 
                                cursorLeft(bv());
-
-                               // the layout things can change the height of a row !
-                               setHeightOfRow(cursor.par(), cursorRow());
+                               redoParagraph(cursor.par());
                                return;
                        }
                }
index e16a58724e4d687530231931322546893d641545..865329529ad7bf541df5dc9b7c0627a67f7a49ce 100644 (file)
@@ -555,6 +555,15 @@ void LyXText::redoParagraph(ParagraphList::iterator pit)
                height -= rit->height();
        pit->rows.clear();
 
+       // redo insets
+       InsetList::iterator ii = pit->insetlist.begin();
+       InsetList::iterator iend = pit->insetlist.end();
+       for (; ii != iend; ++ii) {
+               Dimension dim;
+               MetricsInfo mi(bv(), getFont(pit, ii->pos), 0);
+               ii->inset->metrics(mi, dim);
+       }
+
        // rebreak the paragraph
        for (pos_type z = 0; z < pit->size() + 1; ) {
                Row row(z);
@@ -593,25 +602,7 @@ void LyXText::metrics(MetricsInfo & mi, Dimension & dim)
        height = 0;
 
        //anchor_y_ = 0;
-
-       ParagraphList::iterator pit = ownerParagraphs().begin();
-       ParagraphList::iterator end = ownerParagraphs().end();
-
-       for (; pit != end; ++pit) {
-               pit->rows.clear();
-
-               InsetList::iterator ii = pit->insetlist.begin();
-               InsetList::iterator iend = pit->insetlist.end();
-               for (; ii != iend; ++ii) {
-                       Dimension dim;
-                       MetricsInfo m = mi;
-#warning FIXME: pos != 0
-                       m.base.font = getFont(pit, 0);
-                       ii->inset->metrics(m, dim);
-               }
-
-               redoParagraph(pit);
-       }
+       redoParagraphs(ownerParagraphs().begin(), ownerParagraphs().end());
 
        // final dimension
        dim.asc = firstRow()->ascent_of_text();
index 09b84dd5a051410c51c2b26a4eb2e98341c75b6b..ebaf72a142aff10771476c06626c9667fd424103 100644 (file)
@@ -402,7 +402,7 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
                        if (tmp->params().startOfAppendix()) {
                                recordUndo(bv, Undo::ATOMIC, tmp);
                                tmp->params().startOfAppendix(false);
-                               setHeightOfRow(tmp, getRow(tmp, 0));
+                               redoParagraph(tmp);
                                break;
                        }
                }