On 10/30/2009 12:52 PM, Vincent van Ravesteijn wrote:
Abdelrazak Younes schreef:
v...@lyx.org wrote:
Author: vfr
Date: Fri Oct 30 16:24:35 2009
New Revision: 31809
URL: http://www.lyx.org/trac/changeset/31809

Log:
Issue a warning if a document has two parents. We should do something smart then, but what?

- Do we want to ask the user which of the parents he would like to be the document's parent ? - Do we want to disable any functionality related to parents ? Like references, bibliography, document outline etc.

Modified:
   lyx-devel/trunk/src/Buffer.cpp

Modified: lyx-devel/trunk/src/Buffer.cpp
============================================================================== --- lyx-devel/trunk/src/Buffer.cpp Fri Oct 30 16:14:36 2009 (r31808) +++ lyx-devel/trunk/src/Buffer.cpp Fri Oct 30 16:24:35 2009 (r31809)
@@ -253,7 +253,11 @@
         return parent_buffer;      }
     ///
-    void setParent(Buffer const * pb) { parent_buffer = pb; }
+    void setParent(Buffer const * pb) {
+        if (parent_buffer != pb)
+            LYXERR0("Warning: a buffer should not have two parents!");
+        parent_buffer = pb;
+    }

That's wrong. It's perfectly OK to have two documents using the same child. That's an important use case for me actually.

It might be a valid use case, but LyX is not yet designed to handle this. Until we can properly handle this, I vote for issuing a warning that strange things might happen.

Unexpected things, anyway, such as not getting the counters numbered properly. And you could add a reference and have it not work right later, because the parent had changed. So some kind of warning might be in order, but I'd make it more explicit, e.g.: "File <filename>, which was already open as a child document of file <filename>, has been re-assigned as a child of <filename>. Counters, references, and the like may have been invalidated." Or something like that.

This should also be disable-able, via that new checkbox thingy.

Richard

Reply via email to