]> git.lyx.org Git - features.git/commitdiff
Alfredo's patch to get rid of insets in the graphics code.
authorAngus Leeming <leeming@lyx.org>
Wed, 26 Feb 2003 11:41:23 +0000 (11:41 +0000)
committerAngus Leeming <leeming@lyx.org>
Wed, 26 Feb 2003 11:41:23 +0000 (11:41 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6277 a592a061-630c-0410-9148-cb99ea01b6c8

src/graphics/ChangeLog
src/graphics/GraphicsLoader.C
src/graphics/GraphicsLoader.h
src/graphics/PreviewImage.C
src/graphics/PreviewImage.h
src/graphics/PreviewedInset.C
src/insets/ChangeLog
src/insets/insetgraphics.C
src/insets/insetinclude.C
src/mathed/ChangeLog
src/mathed/formula.C

index c7605830e7726967fd14c041f5e1b78dfbfcbfda..0fb4207ad2ad8a43096cc1d0335d76cfcb3e7eee 100644 (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
index 02f99da7498c13dcb4eb34bcf107e36d57f522e4..5da53f9b84f787e3dd576c2c1ebc0cb5c89a67a2 100644 (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_);
 }
 
index 2fcd23a2622afd46c35eb8c4b32579185e07577d..893070919a9232bd9ddd564d0d5030f787e29729 100644 (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
index 2dde30b979ed855e5298c1adb30cd9ddc9e9ca92..bd96232e734e89bed30c7fba1aa3bd209ecbf017 100644 (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();
 }
index bc12bfb81ba9acc74fddf50bcffcdc6c8a363a1f..4c459756d01b7a8e61a8c5751c447dc9b25cf1f2 100644 (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.
index 89604d6747c010a908b8dc992c6013ed4cf960c3..fca6369910d0631d1a3e729c095aadba3d1cd177 100644 (file)
@@ -105,7 +105,7 @@ bool PreviewedInset::previewReady() const
        if (!pimage_)
                return false;
 
-       return pimage_->image(inset_);
+       return pimage_->image();
 }
 
 
index 92953044f3a786e9f42d7872f0a6472c202a172e..74b82a4239a64c93307067a0be8da4b2dc8f25fa 100644 (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)
index f344ead2a4ff1a0405e252781da07d3f537af54b..68cca4efef01068fbb35ecc533107a93acc81c2d 100644 (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();
index 93efb6d10f405d910212e8262339dca42adc53fb..ba360a63d8d9a47b9d1dd69f14e98cf2b3b71db3 100644 (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;
 }
index d08cf4d442b4d3887070b7a90dfcc8508272d811..c7498033a877dc618fa370e72683c278a1f44056 100644 (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
index be88b35c58c96c17b0a772f794bcfe1d3efc2116..3ce28a819eadc5e9c9e013924b4fe37d2d8b08aa 100644 (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;