v...@lyx.org wrote:
Author: vfr
Date: Thu Mar 26 01:48:32 2009
New Revision: 28919
URL: http://lyx.lyx.org/trac/changeset/28919

Log:
Some cleanup in InsetInclude:
* use the UpdateScope, introduced recently, to prevent the 'strange' calls to 
setParent which also causes the update mechanism to run,
* remove the buffer parameter of loadIfNeeded and all function,
* remove doubled code from getChildBuffer.

This looks good. I think the Buffer& arguments were a remnant of the time before we had buffer().

There's one bit that isn't just cleanup. I think it's good, but it does constitute a change, so I thought I'd ask about it.

Modified: lyx-devel/trunk/src/insets/InsetInclude.cpp
==============================================================================
--- lyx-devel/trunk/src/insets/InsetInclude.cpp Thu Mar 26 01:22:19 2009        
(r28918)
+++ lyx-devel/trunk/src/insets/InsetInclude.cpp Thu Mar 26 01:48:32 2009        
(r28919)
-Buffer * InsetInclude::loadIfNeeded(Buffer const & parent) const
+Buffer * InsetInclude::loadIfNeeded() const
 {
        // Don't try to load it again if we failed before.
        if (failedtoload_)
@@ -400,7 +392,7 @@
        if (isVerbatim(p) || isListings(p))
                return 0;
- string const parent_filename = parent.absFileName();
+       string const parent_filename = buffer().absFileName();
FileName const included_file = makeAbsPath(to_utf8(p["filename"]), onlyPath(parent_filename));
That one.

@@ -429,7 +421,7 @@
                        // FIXME: Do something.
                }
        }
-       child->setParent(&parent);
+       child->setParent(&buffer());
        // Cache the child buffer.
        child_buffer_ = child;
        return child;

And that one.

This makes a certain amount of sense, but it is a change. The old code basically would have set the "parent" as the ultimate master, whereas this sets the "parent" as the immediate parent. I doubt that this will make any difference in the end, since recursion should get us where we need to go. But, that said, it could allow you to compile one child, which had its own children, without ever having to reference the "ultimate master". So maybe it's an improvement, even. Yes?

rh

Reply via email to