]> git.lyx.org Git - lyx.git/blobdiff - src/graphics/GraphicsCache.cpp
Remove unused variables
[lyx.git] / src / graphics / GraphicsCache.cpp
index 5ed905252d71343d9571aea74b975eb2c4d88e3b..bf1b3fceff8476590772c89246ec0d1625576b4f 100644 (file)
@@ -13,7 +13,6 @@
 
 #include "GraphicsCache.h"
 #include "GraphicsCacheItem.h"
-#include "GraphicsImage.h"
 
 #include "Format.h"
 
@@ -21,7 +20,6 @@
 
 #include "support/debug.h"
 #include "support/FileName.h"
-#include "support/filetools.h"
 
 #include <map>
 
@@ -44,7 +42,6 @@ public:
 };
 
 
-// FIXME THREAD
 Cache & Cache::get()
 {
        // Now return the cache
@@ -71,18 +68,10 @@ vector<string> const & Cache::loadableFormats() const
        if (!fmts.empty())
                return fmts;
 
-       // The formats recognised by LyX
-       Formats::const_iterator begin = formats.begin();
-       Formats::const_iterator end   = formats.end();
-
-       // The formats natively loadable.
-       vector<string> nformat = frontend::loadableImageFormats();
-       
-       vector<string>::const_iterator it = nformat.begin();
-       for (; it != nformat.end(); ++it) {
-               for (Formats::const_iterator fit = begin; fit != end; ++fit) {
-                       if (fit->extension() == *it) {
-                               fmts.push_back(fit->name());
+       for (string const & native_extension : frontend::loadableImageFormats()) {
+               for (Format const & format : theFormats()) {
+                       if (format.extension() == native_extension) {
+                               fmts.push_back(format.name());
                                break;
                        }
                }
@@ -90,11 +79,8 @@ vector<string> const & Cache::loadableFormats() const
 
        if (lyxerr.debugging()) {
                LYXERR(Debug::GRAPHICS, "LyX recognises the following image formats:");
-
-               vector<string>::const_iterator fbegin = fmts.begin();
-               vector<string>::const_iterator fend = fmts.end();
-               for (vector<string>::const_iterator fit = fbegin; fit != fend; ++fit) {
-                       LYXERR(Debug::GRAPHICS, *fit << ',');
+               for (string const & format : fmts) {
+                       LYXERR(Debug::GRAPHICS, format << ',');
                }
        }
 
@@ -102,7 +88,7 @@ vector<string> const & Cache::loadableFormats() const
 }
 
 
-void Cache::add(FileName const & file) const
+void Cache::add(FileName const & file, FileName const & doc_file) const
 {
        // Is the file in the cache already?
        if (inCache(file)) {
@@ -111,7 +97,7 @@ void Cache::add(FileName const & file) const
                return;
        }
 
-       pimpl_->cache[file] = ItemPtr(new CacheItem(file));
+       pimpl_->cache[file] = ItemPtr(new CacheItem(file, doc_file));
 }