Dear all, 
Georg Baum has prepared a patch that goes someway (maybe all the way) towards 
squashing Bug 546 "Subdocuments lose BiBTex database entered in master doc". 
The patch is against 13x and looks reasonable to me. However, what do I know?

Regards,
Angus


----------  Forwarded Message  ----------

Subject: LyX Bug 546
Date: Mon, 15 Sep 2003 22:28:00 +0200
From: Georg Baum <[EMAIL PROTECTED]>
To: Angus Leeming <[EMAIL PROTECTED]>

Dear Angus,

Sorry to bother you personally, but I have problems writing to the lyx-devel
mailing list. I used to be able to write to the list, but recently a mail
bounced with a confirm message. I confirmed, but the mail never appeared on
the list. Is this "fetaure" of the list documented somewhere?

I have a partial fix for http://bugzilla.lyx.org/show_bug.cgi?id=546,
although I don't know wether it is the right one.
Buffer::getBibkeyList() and Buffer::getLabelList() search their keys also in
the parent document, if they were invoked from a child doc. Unfortunately,
the parent is never found, because params.parentname is never set. My
solution is to set it in LFUN_CHILDOPEN.
The remaining problem: If the child doc is not opened via LFUN_CHILDOPEN,
the keys are still not found. But I know no solution for this problem,
because the child doc is a full LyX doc and does not know anything about
its parent.

I hope that this is an acceptable solution to the problem. The patch is
against 1.3 (1.4 should be similar). Please tell me if ssomething else is
needed to get it into LyX.

Georg

-------------------------------------------------------

> > the keys are still not found. But I know no solution for this problem,
> > because the child doc is a full LyX doc and does not know anything about
> > its parent.
>
> This sounds entirely reasonable. Moreover, we gradually move more and more
> to handling everything through the dispatch() mechanism, so utlimately all
> child docs should be opened via LFUN_CHILDOPEN. Do you know off hand what
> cases don't do this?

No (but I know almost nothing about LyX internals). I was thinking about 
opening child and parent independantly, but I think in this case the user is 
on his own anyway. Opening the child doc via the "Open" button goes trough 
LFUN_CHILDOPEN. In some cases children are opened automatically (for 
searching labels or bibitems), but I don't know what happens in this case.

Georg

Index: src/lyxfunc.C
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/lyxfunc.C,v
retrieving revision 1.394.2.2
diff -u -p -r1.394.2.2 lyxfunc.C
--- src/lyxfunc.C	2003/03/12 06:25:55	1.394.2.2
+++ src/lyxfunc.C	2003/09/15 20:22:18
@@ -1400,10 +1400,15 @@ void LyXFunc::dispatch(FuncRequest const
 		setMessage(N_("Opening child document ") +
 			   MakeDisplayPath(filename) + "...");
 		view()->savePosition(0);
+		string const parentfilename = owner->buffer()->fileName();
 		if (bufferlist.exists(filename))
 			view()->buffer(bufferlist.getBuffer(filename));
 		else
 			view()->buffer(bufferlist.loadLyXFile(filename));
+		// Set the parent name of the child document.
+		// This makes insertion of citations and references in the child work,
+		// when the target is in the parent or another child document.
+		owner->buffer()->setParentName(parentfilename);
 	}
 	break;
 

Reply via email to