mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
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:
parent
df9798bec7
commit
a5d37d9a44
@ -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>
|
2003-02-26 Alfredo Braunstein <abraunst@libero.it>
|
||||||
|
|
||||||
* GraphicsLoader.[Ch],
|
* GraphicsLoader.[Ch],
|
||||||
|
@ -36,6 +36,12 @@ bool PreviewedInset::activated()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BufferView * PreviewedInset::view() const
|
||||||
|
{
|
||||||
|
return inset_.view();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void PreviewedInset::generatePreview()
|
void PreviewedInset::generatePreview()
|
||||||
{
|
{
|
||||||
if (!Previews::activated() || !previewWanted() ||
|
if (!Previews::activated() || !previewWanted() ||
|
||||||
@ -55,8 +61,6 @@ void PreviewedInset::addPreview(grfx::PreviewLoader & ploader)
|
|||||||
if (!Previews::activated() || !previewWanted())
|
if (!Previews::activated() || !previewWanted())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
setView(ploader.buffer().getUser());
|
|
||||||
|
|
||||||
snippet_ = trim(latexString());
|
snippet_ = trim(latexString());
|
||||||
if (snippet_.empty())
|
if (snippet_.empty())
|
||||||
return;
|
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
|
void PreviewedInset::imageReady(grfx::PreviewImage const & pimage) const
|
||||||
{
|
{
|
||||||
// Check snippet against the Inset's current contents
|
// Check snippet against the Inset's current contents
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
#define PREVIEWEDINSET_H
|
#define PREVIEWEDINSET_H
|
||||||
|
|
||||||
#include "LString.h"
|
#include "LString.h"
|
||||||
#include <boost/weak_ptr.hpp>
|
|
||||||
#include <boost/signals/trackable.hpp>
|
#include <boost/signals/trackable.hpp>
|
||||||
#include <boost/signals/connection.hpp>
|
#include <boost/signals/connection.hpp>
|
||||||
|
|
||||||
@ -60,14 +59,11 @@ public:
|
|||||||
/// If !previewReady() returns 0.
|
/// If !previewReady() returns 0.
|
||||||
PreviewImage const * pimage() const { return pimage_; }
|
PreviewImage const * pimage() const { return pimage_; }
|
||||||
|
|
||||||
///
|
|
||||||
void setView(BufferView *);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/// Allow the daughter classes to cast up to the parent inset.
|
/// Allow the daughter classes to cast up to the parent inset.
|
||||||
Inset * inset() const { return &inset_; }
|
Inset * inset() const { return &inset_; }
|
||||||
///
|
///
|
||||||
BufferView * view() const { return view_.get(); }
|
BufferView * view() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/** This method is connected to the grfx::PreviewLoader::imageReady
|
/** This method is connected to the grfx::PreviewLoader::imageReady
|
||||||
@ -84,8 +80,6 @@ private:
|
|||||||
Inset & inset_;
|
Inset & inset_;
|
||||||
///
|
///
|
||||||
string snippet_;
|
string snippet_;
|
||||||
///
|
|
||||||
boost::weak_ptr<BufferView> view_;
|
|
||||||
|
|
||||||
/// We don't own this. Cached for efficiency reasons.
|
/// We don't own this. Cached for efficiency reasons.
|
||||||
mutable PreviewImage const * pimage_;
|
mutable PreviewImage const * pimage_;
|
||||||
|
@ -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>
|
2003-02-26 Alfredo Braunstein <abraunst@libero.it>
|
||||||
|
|
||||||
* insetgraphics.C (draw)
|
* insetgraphics.C (draw)
|
||||||
|
@ -518,7 +518,7 @@ int InsetInclude::width(BufferView * bv, LyXFont const & font) const
|
|||||||
void InsetInclude::draw(BufferView * bv, LyXFont const & font, int y,
|
void InsetInclude::draw(BufferView * bv, LyXFont const & font, int y,
|
||||||
float & xx, bool b) const
|
float & xx, bool b) const
|
||||||
{
|
{
|
||||||
preview_->setView(bv);
|
cache(bv);
|
||||||
if (!preview_->previewReady()) {
|
if (!preview_->previewReady()) {
|
||||||
InsetButton::draw(bv, font, y, xx, b);
|
InsetButton::draw(bv, font, y, xx, b);
|
||||||
return;
|
return;
|
||||||
|
@ -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>
|
2003-02-26 Alfredo Braunstein <abraunst@libero.it>
|
||||||
|
|
||||||
* formula.C (draw): strip also the other argument (the owner inset) in
|
* formula.C (draw): strip also the other argument (the owner inset) in
|
||||||
|
@ -196,9 +196,9 @@ void InsetFormula::read(Buffer const *, LyXLex & lex)
|
|||||||
void InsetFormula::draw(BufferView * bv, LyXFont const & font,
|
void InsetFormula::draw(BufferView * bv, LyXFont const & font,
|
||||||
int y, float & xx, bool) const
|
int y, float & xx, bool) const
|
||||||
{
|
{
|
||||||
|
cache(bv);
|
||||||
// This initiates the loading of the preview, so should come
|
// This initiates the loading of the preview, so should come
|
||||||
// before the metrics are computed.
|
// before the metrics are computed.
|
||||||
preview_->setView(bv);
|
|
||||||
bool const use_preview = preview_->previewReady();
|
bool const use_preview = preview_->previewReady();
|
||||||
|
|
||||||
int const x = int(xx);
|
int const x = int(xx);
|
||||||
|
Loading…
Reference in New Issue
Block a user