]> git.lyx.org Git - lyx.git/blobdiff - src/BufferList.cpp
support to load the mathdots package via the document settings; fixes #5373; fileform...
[lyx.git] / src / BufferList.cpp
index 422457d0bb20d091bb8fb7a58252e53f3f302756..17b7aea9fa361129615b74e25178f0c4bfed78c3 100644 (file)
 #include "support/Package.h"
 
 #include "support/lassert.h"
-#include <boost/bind.hpp>
+#include "support/bind.h"
 
 #include <algorithm>
 #include <functional>
-
-using boost::bind;
+#include <iterator>
+#include <memory>
 
 using namespace std;
 using namespace lyx::support;
@@ -142,7 +142,7 @@ FileNameList const & BufferList::fileNames() const
        nvec.clear();
        transform(bstore.begin(), bstore.end(),
                  back_inserter(nvec),
-                 boost::bind(&Buffer::fileName, _1));
+                 bind(&Buffer::fileName, _1));
        return nvec;
 }
 
@@ -232,8 +232,10 @@ bool BufferList::exists(FileName const & fname) const
 }
 
 
-bool BufferList::isLoaded(Buffer const * b) const
+ bool BufferList::isLoaded(Buffer const * b) const
 {
+       if (!b)
+               return false;
        BufferStorage::const_iterator cit =
                find(bstore.begin(), bstore.end(), b);
        return cit != bstore.end();
@@ -253,12 +255,12 @@ Buffer * BufferList::getBuffer(support::FileName const & fname) const
 {
        // 1) cheap test, using string comparison of file names
        BufferStorage::const_iterator it = find_if(bstore.begin(), bstore.end(),
-               bind(equal_to<FileName>(), bind(&Buffer::fileName, _1), fname));
+               lyx::bind(equal_to<FileName>(), lyx::bind(&Buffer::fileName, _1), fname));
        if (it != bstore.end())
                        return *it;
        // 2) possibly expensive test, using equivalence test of file names
        it = find_if(bstore.begin(), bstore.end(),
-               bind(equivalent_to(), bind(&Buffer::fileName, _1), fname));
+               lyx::bind(equivalent_to(), lyx::bind(&Buffer::fileName, _1), fname));
        return it != bstore.end() ? (*it) : 0;
 }
 
@@ -270,8 +272,7 @@ Buffer * BufferList::getBufferFromTmp(string const & s)
        for (; it < end; ++it) {
                if (prefixIs(s, (*it)->temppath())) {
                        // check whether the filename matches the master
-                       string const master_name = changeExtension(onlyFilename(
-                                               (*it)->absFileName()), ".tex");
+                       string const master_name = (*it)->latexName();
                        if (suffixIs(s, master_name))
                                return *it;
                        // if not, try with the children
@@ -281,7 +282,7 @@ Buffer * BufferList::getBufferFromTmp(string const & s)
                        for (; cit < cend; ++cit) {
                                string const mangled_child_name = DocFileName(
                                        changeExtension((*cit)->absFileName(),
-                                               ".tex")).mangledFilename();
+                                               ".tex")).mangledFileName();
                                if (suffixIs(s, mangled_child_name))
                                        return *cit;
                        }
@@ -336,4 +337,17 @@ bool BufferList::releaseChild(Buffer * parent, Buffer * child)
 }
 
 
+void BufferList::changed(bool update_metrics) const
+{
+       BufferStorage::const_iterator it = bstore.begin();
+       BufferStorage::const_iterator end = bstore.end();
+       for (; it != end; ++it)
+               (*it)->changed(update_metrics);
+       it = binternal.begin();
+       end = binternal.end();
+       for (; it != end; ++it)
+               (*it)->changed(update_metrics);
+}
+
+
 } // namespace lyx