This is Alfredo's old 'textcache removal' patch. With it, buffer cycling between two copies of the UserGuide is significantly faster than I can access the View->1/2 menu by mouse and about as fast as I can type M-v 1 or M-v 2.
So even if this is a AMD 1700+ it should be usable on PIII 500. If nobody comes up with real numbers in the 'several seconds' range I'll commit that as this is an important itermediate step towards the single cursor. Andre' -- 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...)
? .BufferView_pimpl.C.swp ? 1.diff ? 2.diff ? 3.diff ? ?t ? fullredraw.diff ? par-row.diff ? textcache.diff ? undo_funcs.C ? undo_funcs.h ? insets/1.diff ? mathed/cursor.diff Index: BufferView_pimpl.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/BufferView_pimpl.C,v retrieving revision 1.444 diff -u -p -r1.444 BufferView_pimpl.C --- BufferView_pimpl.C 14 Oct 2003 21:30:18 -0000 1.444 +++ BufferView_pimpl.C 16 Oct 2003 08:05:37 -0000 @@ -41,7 +41,6 @@ #include "paragraph.h" #include "paragraph_funcs.h" #include "ParagraphParameters.h" -#include "TextCache.h" #include "undo.h" #include "vspace.h" @@ -297,14 +296,6 @@ void BufferView::Pimpl::buffer(Buffer * << b << ')' << endl; if (buffer_) { disconnectBuffer(); - // Put the old text into the TextCache, but - // only if the buffer is still loaded. - // Also set the owner of the test to 0 - // bv_->text->owner(0); - textcache.add(buffer_, workarea().workWidth(), bv_->text); - if (lyxerr.debugging()) - textcache.show(lyxerr, "BufferView::buffer"); - bv_->text = 0; } @@ -339,13 +330,6 @@ void BufferView::Pimpl::buffer(Buffer * } else { lyxerr[Debug::INFO] << " No Buffer!" << endl; owner_->getDialogs().hideBufferDependent(); - - // Also remove all remaining text's from the testcache. - // (there should not be any!) (if there is any it is a - // bug!) - if (lyxerr.debugging()) - textcache.show(lyxerr, "buffer delete all"); - textcache.clear(); } update(); @@ -430,33 +414,11 @@ void BufferView::Pimpl::resizeCurrentBuf mark_set = bv_->text->selection.mark(); the_locking_inset = bv_->theLockingInset(); bv_->text->fullRebreak(); - update(); } else { - lyxerr << "text not available!" << endl; - // See if we have a text in TextCache that fits - // the new buffer_ with the correct width. - bv_->text = textcache.findFit(buffer_, workarea().workWidth()); - if (bv_->text) { - lyxerr << "text in cache!" << endl; - if (lyxerr.debugging()) { - lyxerr << "Found a LyXText that fits:" << endl; - textcache.show(lyxerr, make_pair(buffer_, make_pair(workarea().workWidth(), bv_->text))); - } - // Set the owner of the newly found text - // bv_->text->owner(bv_); - if (lyxerr.debugging()) - textcache.show(lyxerr, "resizeCurrentBuffer"); - } else { - lyxerr << "no text in cache!" << endl; - bv_->text = new LyXText(bv_, 0, false, bv_->buffer()->paragraphs()); - bv_->text->init(bv_); - } + bv_->text = new LyXText(bv_, 0, false, bv_->buffer()->paragraphs()); + bv_->text->init(bv_); } -#warning does not help much - //bv_->text->redoParagraphs(bv_->text->ownerParagraphs().begin(), - // bv_->text->ownerParagraphs().end()); - if (par != -1) { bv_->text->selection.set(true); // At this point just to avoid the Delete-Empty-Paragraph- @@ -625,22 +587,9 @@ void BufferView::Pimpl::workAreaResize() work_area_width = workarea().workWidth(); work_area_height = workarea().workHeight(); - if (buffer_ != 0) { - if (widthChange) { - // The visible LyXView need a resize - resizeCurrentBuffer(); - - // Remove all texts from the textcache - // This is not _really_ what we want to do. What - // we really want to do is to delete in textcache - // that does not have a BufferView with matching - // width, but as long as we have only one BufferView - // deleting all gives the same result. - if (lyxerr.debugging()) - textcache.show(lyxerr, "Expose delete all"); - textcache.clear(); - } - } + // The visible LyXView need a resize + if (buffer_ && widthChange) + resizeCurrentBuffer(); if (widthChange || heightChange) update(); Index: bufferlist.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/bufferlist.C,v retrieving revision 1.136 diff -u -p -r1.136 bufferlist.C --- bufferlist.C 14 Oct 2003 21:30:19 -0000 1.136 +++ bufferlist.C 16 Oct 2003 08:05:38 -0000 @@ -21,7 +21,6 @@ #include "lyx_cb.h" #include "lyx_main.h" #include "paragraph.h" -#include "TextCache.h" #include "frontends/Alert.h" @@ -119,12 +118,8 @@ void BufferList::release(Buffer * buf) BOOST_ASSERT(buf); BufferStorage::iterator it = find(bstore.begin(), bstore.end(), buf); if (it != bstore.end()) { - // Make sure that we don't store a LyXText in - // the textcache that points to the buffer - // we just deleted. - Buffer * tmp = (*it); + Buffer * tmp = *it; bstore.erase(it); - textcache.removeAllWithBuffer(tmp); delete tmp; } } @@ -143,13 +138,8 @@ Buffer * BufferList::newBuffer(string co void BufferList::closeAll() { - // Since we are closing we can just as well delete all - // in the textcache this will also speed the closing/quiting up a bit. - textcache.clear(); - - while (!bstore.empty()) { + while (!bstore.empty()) close(bstore.front(), false); - } } Index: lyxcursor.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxcursor.C,v retrieving revision 1.26 diff -u -p -r1.26 lyxcursor.C --- lyxcursor.C 9 Oct 2003 10:52:07 -0000 1.26 +++ lyxcursor.C 16 Oct 2003 08:05:38 -0000 @@ -17,7 +17,7 @@ LyXCursor::LyXCursor() - : par_(-1), pos_(0), boundary_(false), x_(0), x_fix_(0), y_(0) + : par_(0), pos_(0), boundary_(false), x_(0), x_fix_(0), y_(0) {} Index: lyxfunc.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxfunc.C,v retrieving revision 1.515 diff -u -p -r1.515 lyxfunc.C --- lyxfunc.C 14 Oct 2003 13:01:39 -0000 1.515 +++ lyxfunc.C 16 Oct 2003 08:05:38 -0000 @@ -48,7 +48,6 @@ #include "lyxvc.h" #include "paragraph.h" #include "ParagraphParameters.h" -#include "TextCache.h" #include "undo.h" #include "insets/insetcommand.h" @@ -1582,12 +1581,6 @@ void LyXFunc::dispatch(FuncRequest const // handle the screen font changes. lyxrc.set_font_norm_type(); lyx_gui::update_fonts(); - // We also need to empty the textcache so that - // the buffer will be formatted correctly after - // a zoom change. - textcache.clear(); - // Of course we should only do the resize and the textcache.clear - // if values really changed...but not very important right now. (Lgb) // All visible buffers will need resize view()->resize(); view()->update();