Waiting for bug reports...

-- 
Those who desire to give up Freedom in order to gain Security, will not have,
nor do they deserve, either one.     (T. Jefferson or B. Franklin or both...)
Index: lyxtext.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxtext.h,v
retrieving revision 1.190
diff -u -p -r1.190 lyxtext.h
--- lyxtext.h   16 Jul 2003 08:42:24 -0000      1.190
+++ lyxtext.h   16 Jul 2003 11:53:45 -0000
@@ -163,6 +163,8 @@ public:
        void partialRebreak();
        /// a full rebreak of the whole text
        void fullRebreak();
+       /// rebuild RowList cache
+       void rebuild();
 
        ///
        RowList::iterator need_break_row;
Index: rowpainter.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/rowpainter.C,v
retrieving revision 1.23
diff -u -p -r1.23 rowpainter.C
--- rowpainter.C        15 Jul 2003 11:08:00 -0000      1.23
+++ rowpainter.C        16 Jul 2003 11:53:45 -0000
@@ -179,7 +179,7 @@ void RowPainter::paintInset(pos_type con
        Assert(inset);
 
 #warning inset->update FIXME
-       inset->update(perv(bv_), false);
+       //inset->update(perv(bv_), false);
 
        PainterInfo pi(perv(bv_));
        pi.base.font = getFont(pos);
Index: text2.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text2.C,v
retrieving revision 1.389
diff -u -p -r1.389 text2.C
--- text2.C     16 Jul 2003 08:42:26 -0000      1.389
+++ text2.C     16 Jul 2003 11:53:46 -0000
@@ -692,6 +692,32 @@ void LyXText::fullRebreak()
 }
 
 
+void LyXText::rebuild()
+{
+       rowlist_.clear();
+       need_break_row = rows().end();
+       width = height = 0;
+
+       anchor_row_ = rows().end();
+       anchor_row_offset_ = 0;
+
+       ParagraphList::iterator pit = ownerParagraphs().begin();
+       ParagraphList::iterator end = ownerParagraphs().end();
+
+       //current_font = getFont(bview->buffer(), pit, 0);
+
+       for (; pit != end; ++pit)
+               insertParagraph(pit, rowlist_.end());
+
+       //setCursorIntern(rowlist_.begin()->par(), 0);
+       //selection.cursor = cursor;
+
+       //updateCounters();
+
+       //setCursorIntern(cursor.par(), cursor.pos());
+}
+
+
 void LyXText::partialRebreak()
 {
        if (rows().empty()) {
@@ -1516,6 +1542,8 @@ void LyXText::setCursor(LyXCursor & cur,
        cur.par(pit);
        cur.pos(pos);
        cur.boundary(boundary);
+       if (rows().empty())
+               return;
 
        // get the cursor y position in text
        int y = 0;
Index: insets/insetcollapsable.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetcollapsable.C,v
retrieving revision 1.151
diff -u -p -r1.151 insetcollapsable.C
--- insets/insetcollapsable.C   14 Jul 2003 15:17:39 -0000      1.151
+++ insets/insetcollapsable.C   16 Jul 2003 11:53:46 -0000
@@ -308,13 +308,15 @@ void InsetCollapsable::update(BufferView
 
 Inset::RESULT InsetCollapsable::localDispatch(FuncRequest const & cmd)
 {
-       //lyxerr << "InsetCollapsable::localDispatch: " << cmd.action << "\n";
+       lyxerr << "InsetCollapsable::localDispatch: "
+               << cmd.action << " '" << cmd.argument << "'\n";
        BufferView * bv = cmd.view();
        switch (cmd.action) {
                case LFUN_INSET_EDIT: {
                        if (!cmd.argument.empty()) {
                                UpdatableInset::localDispatch(cmd);
                                if (collapsed_) {
+                                       lyxerr << "branch collapsed_\n";
                                        collapsed_ = false;
                                        if (bv->lockInset(this)) {
                                                inset.setUpdateStatus(InsetText::FULL);
@@ -324,6 +326,7 @@ Inset::RESULT InsetCollapsable::localDis
                                                first_after_edit = true;
                                        }
                                } else {
+                                       lyxerr << "branch not collapsed_\n";
                                        if (bv->lockInset(this))
                                                inset.localDispatch(cmd);
                                }
Index: insets/insettabular.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insettabular.C,v
retrieving revision 1.297
diff -u -p -r1.297 insettabular.C
--- insets/insettabular.C       15 Jul 2003 16:25:02 -0000      1.297
+++ insets/insettabular.C       16 Jul 2003 11:53:46 -0000
@@ -259,6 +259,7 @@ void InsetTabular::read(Buffer const * b
 void InsetTabular::metrics(MetricsInfo & mi, Dimension & dim) const
 {
        if (mi.base.bv) {
+               calculate_dimensions_of_cells(mi.base.bv, true);
                //lyxerr << "InsetTabular::metrics, bv: " << mi.base.bv << endl;
                for (int i = 0; i < tabular.getNumberOfCells(); ++i) {
                        tabular.cellinfo_of_cell(i)->inset.text_.bv_owner = mi.base.bv;
@@ -411,6 +412,7 @@ void InsetTabular::drawCellSelection(Pai
 
 void InsetTabular::update(BufferView * bv, bool reinit)
 {
+/*
        if (in_update) {
                if (reinit) {
                        resetPos(bv);
@@ -447,6 +449,7 @@ void InsetTabular::update(BufferView * b
                break;
        }
        in_update = false;
+*/
 }
 
 
Index: insets/insettext.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insettext.C,v
retrieving revision 1.431
diff -u -p -r1.431 insettext.C
--- insets/insettext.C  16 Jul 2003 07:15:10 -0000      1.431
+++ insets/insettext.C  16 Jul 2003 11:53:46 -0000
@@ -277,6 +277,7 @@ void InsetText::metrics(MetricsInfo & mi
 {
        BufferView * bv = mi.base.bv;
        setViewCache(bv);
+       text_.rebuild();
        dim.asc = text_.rows().begin()->ascent_of_text() + TEXT_TO_INSET_OFFSET;
        dim.des = text_.height - dim.asc + TEXT_TO_INSET_OFFSET;
        dim.wid = max(textWidth(bv), int(text_.width)) + 2 * TEXT_TO_INSET_OFFSET;
@@ -406,6 +407,7 @@ void InsetText::update(BufferView * bv, 
 {
        setViewCache(bv);
 
+/*
        if (in_update) {
                if (reinit && owner()) {
                        reinitLyXText();
@@ -455,6 +457,7 @@ void InsetText::update(BufferView * bv, 
                need_update |= INIT;
                old_max_width = nw;
        }
+*/
 }
 
 
@@ -476,6 +479,9 @@ void InsetText::setUpdateStatus(int what
 
 void InsetText::updateLocal(BufferView * bv, int what, bool mark_dirty)
 {
+       if (!bv)
+               return;
+
        if (!autoBreakRows && paragraphs.size() > 1)
                collapseParagraphs(bv);
 
@@ -555,7 +561,7 @@ void InsetText::lockInset(BufferView * b
        inset_boundary = false;
        inset_par = paragraphs.end();
        old_par = paragraphs.end();
-       text_.setCursor(paragraphs.begin(), 0);
+       text_.setCursorIntern(paragraphs.begin(), 0);
        text_.clearSelection();
        finishUndo();
        // If the inset is empty set the language of the current font to the
@@ -581,7 +587,7 @@ void InsetText::lockInset(BufferView * b
        inset_pos = cpos();
        inset_par = cpar();
        inset_boundary = cboundary();
-       updateLocal(bv, CURSOR, false);
+       //updateLocal(bv, CURSOR, false);
 }
 
 
@@ -597,30 +603,36 @@ bool InsetText::lockInsetInInset(BufferV
 
                int const id = inset->id();
                for (; pit != pend; ++pit) {
-                       InsetList::iterator it =
-                               pit->insetlist.begin();
-                       InsetList::iterator const end =
-                               pit->insetlist.end();
+                       InsetList::iterator it = pit->insetlist.begin();
+                       InsetList::iterator const end = pit->insetlist.end();
                        for (; it != end; ++it) {
                                if (it->inset == inset) {
-                                       getLyXText(bv)->setCursorIntern(pit, it->pos);
+                                       lyxerr << "InsetText::lockInsetInInset: 1 a\n";
+                                       text_.setCursorIntern(pit, it->pos);
+                                       lyxerr << "InsetText::lockInsetInInset: 1 b\n";
+                                       lyxerr << "bv: " << bv << " inset: " << inset 
<< "\n";
                                        lockInset(bv, inset);
+                                       lyxerr << "InsetText::lockInsetInInset: 1 c" 
<< endl;
                                        return true;
                                }
                                if (it->inset->getInsetFromID(id)) {
-                                       getLyXText(bv)->setCursorIntern(pit, it->pos);
+                                       lyxerr << "InsetText::lockInsetInInset: 2\n";
+                                       text_.setCursorIntern(pit, it->pos);
                                        it->inset->localDispatch(FuncRequest(bv, 
LFUN_INSET_EDIT));
                                        return the_locking_inset->lockInsetInInset(bv, 
inset);
                                }
                        }
                }
+               lyxerr << "InsetText::lockInsetInInset: 3\n";
                return false;
        }
        if (inset == cpar()->getInset(cpos())) {
                lyxerr[Debug::INSETS] << "OK" << endl;
                lockInset(bv, inset);
                return true;
-       } else if (the_locking_inset && (the_locking_inset == inset)) {
+       }
+
+       if (the_locking_inset && the_locking_inset == inset) {
                if (cpar() == inset_par && cpos() == inset_pos) {
                        lyxerr[Debug::INSETS] << "OK" << endl;
                        inset_x = cix(bv) - top_x + drawTextXOffset;
@@ -884,7 +896,7 @@ Inset::RESULT InsetText::localDispatch(F
 
                if (cmd.argument.size()) {
                        if (cmd.argument == "left")
-                               text_.setCursor(paragraphs.begin(), 0);
+                               text_.setCursorIntern(paragraphs.begin(), 0);
                        else {
                                ParagraphList::iterator it = paragraphs.begin();
                                ParagraphList::iterator end = paragraphs.end();

Reply via email to