]> git.lyx.org Git - lyx.git/blobdiff - src/Buffer.cpp
Hebrew translation updates by Ran
[lyx.git] / src / Buffer.cpp
index 63f578f03b5fdb152b5923ee00a2b0abdc70beff..69462370447b2f01b75a9acf04d7a5c8b57a878a 100644 (file)
@@ -115,7 +115,7 @@ namespace os = support::os;
 
 namespace {
 
-int const LYX_FORMAT = 338; //Uwe: support for polytonic Greek
+int const LYX_FORMAT = 339; //rgh: removed modules
 
 typedef map<string, bool> DepClean;
 typedef map<docstring, pair<InsetLabel const *, Buffer::References> > RefCache;
@@ -275,6 +275,13 @@ Buffer::~Buffer()
        // GuiView already destroyed
        gui_ = 0;
 
+
+       // loop over children
+       Impl::BufferPositionMap::iterator it = d->children_positions.begin();
+       Impl::BufferPositionMap::iterator end = d->children_positions.end();
+       for (; it != end; ++it)
+               theBufferList().releaseChild(this, const_cast<Buffer *>(it->first));
+
        // clear references to children in macro tables
        d->children_positions.clear();
        d->position_to_children.clear();
@@ -464,6 +471,7 @@ int Buffer::readHeader(Lexer & lex)
        params().fontsCJK.erase();
        params().listings_params.clear();
        params().clearLayoutModules();
+       params().clearRemovedModules();
        params().pdfoptions().clear();
        
        for (int i = 0; i < 4; ++i) {
@@ -641,7 +649,7 @@ bool Buffer::readString(string const & s)
        Lexer lex;
        istringstream is(s);
        lex.setStream(is);
-       FileName const name = FileName::tempName();
+       FileName const name = FileName::tempName("Buffer_readString");
        switch (readFile(lex, name, true)) {
        case failure:
                return false;
@@ -730,7 +738,7 @@ Buffer::ReadStatus Buffer::readFile(Lexer & lex, FileName const & filename,
                        // lyx2lyx would fail
                        return wrongversion;
 
-               FileName const tmpfile = FileName::tempName();
+               FileName const tmpfile = FileName::tempName("Buffer_readFile");
                if (tmpfile.empty()) {
                        Alert::error(_("Conversion failed"),
                                     bformat(_("%1$s is from a different"
@@ -1674,6 +1682,12 @@ Buffer const * Buffer::masterBuffer() const
 }
 
 
+bool Buffer::isChild(Buffer * child) const
+{
+       return d->children_positions.find(child) != d->children_positions.end();
+}
+
+
 template<typename M>
 typename M::iterator greatest_below(M & m, typename M::key_type const & x)
 {