Strip out the caching of the BufferView by PreviewedInset. Use the cache

of the parent inset instead.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6279 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2003-02-26 13:10:16 +00:00
parent df9798bec7
commit a5d37d9a44
7 changed files with 24 additions and 19 deletions

View File

@ -1,3 +1,8 @@
2003-02-26 Angus Leeming <leeming@lyx.org>
* PreviewedInset.[Ch]: strip out the caching of the BufferView and
use the cache of the parent inset instead.
2003-02-26 Alfredo Braunstein <abraunst@libero.it>
* GraphicsLoader.[Ch],

View File

@ -36,6 +36,12 @@ bool PreviewedInset::activated()
}
BufferView * PreviewedInset::view() const
{
return inset_.view();
}
void PreviewedInset::generatePreview()
{
if (!Previews::activated() || !previewWanted() ||
@ -55,8 +61,6 @@ void PreviewedInset::addPreview(grfx::PreviewLoader & ploader)
if (!Previews::activated() || !previewWanted())
return;
setView(ploader.buffer().getUser());
snippet_ = trim(latexString());
if (snippet_.empty())
return;
@ -109,14 +113,6 @@ bool PreviewedInset::previewReady() const
}
void PreviewedInset::setView(BufferView * bv)
{
if (!bv)
return;
view_ = bv->owner()->view();
}
void PreviewedInset::imageReady(grfx::PreviewImage const & pimage) const
{
// Check snippet against the Inset's current contents

View File

@ -17,7 +17,6 @@
#define PREVIEWEDINSET_H
#include "LString.h"
#include <boost/weak_ptr.hpp>
#include <boost/signals/trackable.hpp>
#include <boost/signals/connection.hpp>
@ -60,14 +59,11 @@ public:
/// If !previewReady() returns 0.
PreviewImage const * pimage() const { return pimage_; }
///
void setView(BufferView *);
protected:
/// Allow the daughter classes to cast up to the parent inset.
Inset * inset() const { return &inset_; }
///
BufferView * view() const { return view_.get(); }
BufferView * view() const;
private:
/** This method is connected to the grfx::PreviewLoader::imageReady
@ -84,8 +80,6 @@ private:
Inset & inset_;
///
string snippet_;
///
boost::weak_ptr<BufferView> view_;
/// We don't own this. Cached for efficiency reasons.
mutable PreviewImage const * pimage_;

View File

@ -1,3 +1,8 @@
2003-02-26 Angus Leeming <leeming@lyx.org>
* insetinclude.C (draw): cache the BufferView* using cache not
PreviewImpl::setView
2003-02-26 Alfredo Braunstein <abraunst@libero.it>
* insetgraphics.C (draw)

View File

@ -518,7 +518,7 @@ int InsetInclude::width(BufferView * bv, LyXFont const & font) const
void InsetInclude::draw(BufferView * bv, LyXFont const & font, int y,
float & xx, bool b) const
{
preview_->setView(bv);
cache(bv);
if (!preview_->previewReady()) {
InsetButton::draw(bv, font, y, xx, b);
return;

View File

@ -1,3 +1,8 @@
2003-02-26 Angus Leeming <leeming@lyx.org>
* formula.C (draw): cache the BufferView* using cache not
PreviewImpl::setView
2003-02-26 Alfredo Braunstein <abraunst@libero.it>
* formula.C (draw): strip also the other argument (the owner inset) in

View File

@ -196,9 +196,9 @@ void InsetFormula::read(Buffer const *, LyXLex & lex)
void InsetFormula::draw(BufferView * bv, LyXFont const & font,
int y, float & xx, bool) const
{
cache(bv);
// This initiates the loading of the preview, so should come
// before the metrics are computed.
preview_->setView(bv);
bool const use_preview = preview_->previewReady();
int const x = int(xx);