]> git.lyx.org Git - lyx.git/blobdiff - src/graphics/GraphicsCache.C
fix typo that put too many include paths for most people
[lyx.git] / src / graphics / GraphicsCache.C
index d6b9b20dc0a641dd9a439f2f8c15ad6af162a20e..9e37111ec99d72084ceb80357c8c3985693dc8b7 100644 (file)
 #include "GraphicsImage.h"
 #include "GraphicsParams.h"
 #include "insets/insetgraphics.h"
+#include "frontends/GUIRunTime.h"
 
-// I think that graphicsInit should become Dialogs::graphicsInit.
-// These #includes would then be moved there.
-// Angus 25 Feb 2002
-#include "GraphicsImageXPM.h"
-//#include "xformsGraphicsImage.h"
-
-namespace {
-
-void graphicsInit() 
-{
-       using namespace grfx;
-       using SigC::slot;
-    
-       // connect the image loader based on the XPM library
-       GImage::newImage.connect(slot(&GImageXPM::newImage));
-       GImage::loadableFormats.connect(slot(&GImageXPM::loadableFormats));
-       // connect the image loader based on the xforms library
-//     GImage::newImage.connect(slot(&xformsGImage::newImage));
-//     GImage::loadableFormats.connect(slot(&xformsGImage::loadableFormats));
-}
-    
-} // namespace anon
 
 namespace grfx {
 
@@ -50,7 +28,7 @@ GCache & GCache::get()
        static bool start = true;
        if (start) {
                start = false;
-               graphicsInit();
+               GUIRunTime::initialiseGraphics();
        }
 
        // Now return the cache
@@ -72,12 +50,12 @@ GCache::~GCache()
 }
 
 
-void GCache::update(InsetGraphics const & inset)
+void GCache::update(InsetGraphics const & inset, string const & filepath)
 {
        // A subset only of InsetGraphicsParams is needed for display purposes.
        // The GraphicsParams c-tor also interrogates lyxrc to ascertain whether
        // to display or not.
-       GParams params(inset.params());
+       GParams params(inset.params(), filepath);
 
        // Each inset can reference only one file, so check the cache for any
        // graphics files referenced by inset. If the name of this file is
@@ -163,12 +141,13 @@ void GCache::changeDisplay(bool changed_background)
 GCache::CacheType::iterator
 GCache::find(InsetGraphics const & inset)
 {
-       CacheType::iterator it = cache->begin();
-       for (; it != cache->end(); ++it) {
+       CacheType::iterator it  = cache->begin();
+       CacheType::iterator end = cache->end();
+       for (; it != end; ++it) {
                if (it->second->referencedBy(inset))
                        return it;
        }
-       
+
        return cache->end();
 }
 
@@ -176,12 +155,13 @@ GCache::find(InsetGraphics const & inset)
 GCache::CacheType::const_iterator
 GCache::find(InsetGraphics const & inset) const
 {
-       CacheType::const_iterator it = cache->begin();
-       for (; it != cache->end(); ++it) {
+       CacheType::const_iterator it  = cache->begin();
+       CacheType::const_iterator end = cache->end();
+       for (; it != end; ++it) {
                if (it->second->referencedBy(inset))
                        return it;
        }
-       
+
        return cache->end();
 }