Alfredo's patch to get rid of insets in the graphics code.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6277 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2003-02-26 11:41:23 +00:00
parent 7058c66b10
commit a67816b728
11 changed files with 32 additions and 36 deletions

View File

@ -1,3 +1,9 @@
2003-02-26 Alfredo Braunstein <abraunst@libero.it>
* GraphicsLoader.[Ch],
* PreviewImage.[Ch],
* PreviewedInset.C: Removed unneeded list of owner insets
2003-02-25 Alfredo Braunstein <abraunst@libero.it>
* GraphicsConverter (startConversion): add the call to

View File

@ -40,7 +40,7 @@ struct Loader::Impl : boost::signals::trackable {
void createPixmap();
///
void startLoading(Inset const &);
void startLoading();
/// The loading status of the image.
ImageStatus status_;
@ -62,10 +62,6 @@ private:
///
Params params_;
// Multiple Insets can share the same image
typedef std::list<Inset const *> InsetList;
///
InsetList insets;
};
@ -122,15 +118,7 @@ void Loader::startLoading() const
{
if (pimpl_->status_ != WaitingToLoad || !pimpl_->cached_item_.get())
return;
pimpl_->cached_item_->startLoading();
}
void Loader::startLoading(Inset const & inset) const
{
if (pimpl_->status_ != WaitingToLoad || !pimpl_->cached_item_.get())
return;
pimpl_->startLoading(inset);
pimpl_->startLoading();
}
@ -281,17 +269,11 @@ void Loader::Impl::createPixmap()
}
void Loader::Impl::startLoading(Inset const & inset)
void Loader::Impl::startLoading()
{
if (status_ != WaitingToLoad)
return;
InsetList::const_iterator it = insets.begin();
InsetList::const_iterator end = insets.end();
it = std::find(it, end, &inset);
if (it == end)
insets.push_back(&inset);
LoaderQueue::get().touch(cached_item_);
}

View File

@ -63,13 +63,10 @@ public:
///
bool empty() const { return filename().empty(); }
/// We are explicit about when we begin the loading process.
void startLoading() const;
/** starting loading of the image is done by a urgency-based
* decision. Here we only call LoaderQueue::touch to request it.
*/
void startLoading(Inset const &) const;
void startLoading() const;
/** Monitor any changes to the file.
* There is no point monitoring the file before startLoading() is

View File

@ -30,7 +30,7 @@ struct PreviewImage::Impl : public boost::signals::trackable {
///
~Impl();
///
Image const * image(Inset const &);
Image const * image();
///
void statusChanged();
@ -93,9 +93,9 @@ int PreviewImage::width() const
}
Image const * PreviewImage::image(Inset const & inset) const
Image const * PreviewImage::image() const
{
return pimpl_->image(inset);
return pimpl_->image();
}
@ -116,10 +116,10 @@ PreviewImage::Impl::~Impl()
}
Image const * PreviewImage::Impl::image(Inset const & inset)
Image const * PreviewImage::Impl::image()
{
if (iloader_.status() == WaitingToLoad)
iloader_.startLoading(inset);
iloader_.startLoading();
return iloader_.image();
}

View File

@ -47,7 +47,7 @@ public:
/** If the image is not yet loaded (WaitingToLoad), then this method
* triggers that.
*/
Image const * image(Inset const & inset) const;
Image const * image() const;
private:
/// Use the Pimpl idiom to hide the internals.

View File

@ -105,7 +105,7 @@ bool PreviewedInset::previewReady() const
if (!pimage_)
return false;
return pimage_->image(inset_);
return pimage_->image();
}

View File

@ -1,3 +1,9 @@
2003-02-26 Alfredo Braunstein <abraunst@libero.it>
* insetgraphics.C (draw)
* insetinclude.C (draw): Eliminate also the other argument (owner
inset inset) in the call to PreviewImage::image
2003-02-25 Alfredo Braunstein <abraunst@libero.it>
* insetgraphics.C (draw)

View File

@ -348,7 +348,7 @@ void InsetGraphics::draw(BufferView * bv, LyXFont const & font,
if (gparams.display != grfx::NoDisplay
&& cache_->loader.status() == grfx::WaitingToLoad)
cache_->loader.startLoading(*this);
cache_->loader.startLoading();
if (!cache_->loader.monitoring())
cache_->loader.startMonitoring();

View File

@ -534,7 +534,7 @@ void InsetInclude::draw(BufferView * bv, LyXFont const & font, int y,
int const h = a + d;
bv->painter().image(x, y - a, w, h,
*(preview_->pimage()->image(*this)));
*(preview_->pimage()->image()));
xx += w;
}

View File

@ -1,4 +1,9 @@
003-02-26 Angus Leeming <leeming@lyx.org>
2003-02-26 Alfredo Braunstein <abraunst@libero.it>
* formula.C (draw): strip also the other argument (the owner inset) in
the call to PreviewImage::image
2003-02-26 Angus Leeming <leeming@lyx.org>
* ref_inset.[Ch]: add a localDispatch method to RefInset.
add a string2RefInset function to 'translate' the string passed to the

View File

@ -211,7 +211,7 @@ void InsetFormula::draw(BufferView * bv, LyXFont const & font,
if (use_preview) {
pi.pain.image(x + 1, y - a, w, h, // one pixel gap in front
*(preview_->pimage()->image(*this)));
*(preview_->pimage()->image()));
} else {
pi.base.style = LM_ST_TEXT;
pi.base.font = font;