Abdelrazak Younes wrote:
Richard Heck wrote:
Idea for fix: Since the buffer_func.cpp version of loadLyXFile() is
called from LyXView::loadLyXFile(), anyway, all the child doc stuff
could be moved there. But I don't know this code terribly well. Abdel?
Very good analysis Richard! The solution is to use the LFUN instead of
using loadLyXFile from buffer_funcs.cpp. This should fix the problem.
Do you mean to call LFUN_BUFFER_CHILD_OPEN from InsetInclude? The
problem with doing it that way, and a more general problem,
actually---you'd get the same problem if you could somehow call
LyXFunc::loadLyXFile() directly---is that this will reset the buffer.
I.e., focus will switch to the new buffer, which is not what we want for
these automatic loads. I think that's basically why loadLyXFile() is
being called directly: to skip all that stuff. But we end up skipping
too much. But it still seems right to call the LyXView version one way
or another.
I don't know what to do here. One option would be to add another flag to
LyXView::loadLyXFile() and in BufferView::loadLyXFile(), something like
"bool setFocus = true", and then we'd do something like this in the latter:
if (setFocus)
setBuffer(b);
and in the former:
bool const loaded =
work_area_->bufferView().loadLyXFile(filename, setFocus);
But then if we're calling this via an LFUN, we'll need a new LFUN to do
it with, or else add a flag somehow to LFUN_BUFFER_CHILD_OPEN and make
appropriate changes there. Is there a style for such flags? We can't
use, say, "|" as a separator, because that could occur in a filename. So
could anything else. So I'm not sure how to proceed there. So maybe a
new LFUN, LFUN_BUFFER_CHILD_AUTO_OPEN (?) is needed.
Thoughts?
Richard
--
==================================================================
Richard G Heck, Jr
Professor of Philosophy
Brown University
http://frege.brown.edu/heck/
==================================================================
Get my public key from http://sks.keyserver.penguin.de
Hash: 0x1DE91F1E66FFBDEC
Learn how to sign your email using Thunderbird and GnuPG at:
http://dudu.dyn.2-h.org/nist/gpg-enigmail-howto