diff --git a/src/graphics/ChangeLog b/src/graphics/ChangeLog index 0fb4207ad2..a2713e705e 100644 --- a/src/graphics/ChangeLog +++ b/src/graphics/ChangeLog @@ -1,3 +1,8 @@ +2003-02-26 Angus Leeming + + * PreviewedInset.[Ch]: strip out the caching of the BufferView and + use the cache of the parent inset instead. + 2003-02-26 Alfredo Braunstein * GraphicsLoader.[Ch], diff --git a/src/graphics/PreviewedInset.C b/src/graphics/PreviewedInset.C index fca6369910..2ee8774738 100644 --- a/src/graphics/PreviewedInset.C +++ b/src/graphics/PreviewedInset.C @@ -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 diff --git a/src/graphics/PreviewedInset.h b/src/graphics/PreviewedInset.h index fc50017aeb..5e40090860 100644 --- a/src/graphics/PreviewedInset.h +++ b/src/graphics/PreviewedInset.h @@ -17,7 +17,6 @@ #define PREVIEWEDINSET_H #include "LString.h" -#include #include #include @@ -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 view_; /// We don't own this. Cached for efficiency reasons. mutable PreviewImage const * pimage_; diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index 74b82a4239..f4ef416f30 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,8 @@ +2003-02-26 Angus Leeming + + * insetinclude.C (draw): cache the BufferView* using cache not + PreviewImpl::setView + 2003-02-26 Alfredo Braunstein * insetgraphics.C (draw) diff --git a/src/insets/insetinclude.C b/src/insets/insetinclude.C index ba360a63d8..ae777b330a 100644 --- a/src/insets/insetinclude.C +++ b/src/insets/insetinclude.C @@ -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; diff --git a/src/mathed/ChangeLog b/src/mathed/ChangeLog index c7498033a8..209447659e 100644 --- a/src/mathed/ChangeLog +++ b/src/mathed/ChangeLog @@ -1,3 +1,8 @@ +2003-02-26 Angus Leeming + + * formula.C (draw): cache the BufferView* using cache not + PreviewImpl::setView + 2003-02-26 Alfredo Braunstein * formula.C (draw): strip also the other argument (the owner inset) in diff --git a/src/mathed/formula.C b/src/mathed/formula.C index 3ce28a819e..d8a90be293 100644 --- a/src/mathed/formula.C +++ b/src/mathed/formula.C @@ -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);