On 12/01/2011 06:08 PM, Jean-Marc Lasgouttes wrote:
> Le 29/11/2011 21:40, Richard Heck a écrit :
>> So I investigated this a bit. There really isn't any way to do what
>> JMarc suggested in InsetBranch. The branch itself may (and usually will)
>> be held in the master, and that may not even be open in a view, so there
>> is no hope of getting a cursor so we can call recordUndoFullDocument()
>> on the correct document.
>
> I never said this should be done in InsetBranch. It is the main
> branch_activate thing that does the work. We should make sure that all
> branch activation goes this way, probably.
>
Sorry, what I meant was: LFUN_BRANCH_ACTIVATE is handled in InsetBranch,
as well as in Buffer (in the current code). We get there when it's
called from the context menu. (You can (de)activate a branch by
right-clicking on the inset and choosing a menu item.) In that code, we
have a problem which we do not have in the corresponding code in
BufferView, namely, that the Buffer whose BufferParams are being altered
may (and usually will) be the master Buffer of the one where the inset
lives, and that Buffer may not even be visible (i.e., it may have no
BufferView associated with it). If we mark it dirty---it doesn't matter
how we do so---then LyX gets unhappy if you try to shut down without
making this Buffer visible. Of course, we could force the Buffer to
become visible, but that seems kind of drastic. Another option is to
rework the shutdown code so that we ask to save even non-visible
Buffers. I do not know how hard that would be.

>> That said, it isn't obvious we should mark a document not open in a view
>> dirty.
>
> If you change the activation of a branch, only the bufferparams of the
> buffer is changed. Therefore, one only has to do what you propose in
> the patch. THe ideq is: mark dirty (or record undo) only when the .lyx
> file would be changed on disk.
>
Again, this is fine in BufferView, but no fine in InsetBranch.

>> So I'm a little confused now about what to do. Maybe we simply shouldn't
>> try to mark the master dirty in this case.
>
>> Anyway, a patch is attached that deals with the Document>Settings issue,
>> but not with the context menu issue (which is handled at InsetBranch).
>
> Can you just dispatch(LFUN_BRANCH_ACTIVATE) in these cases?
>
We'd have to dispatch it to a different Buffer. I'm not sure we know how
to do that---without, again, first making that Buffer visible. The
problem is worse if the relevant code has been moved to BufferView,
since then of course we need the Buffer to be visible.

Richard

Reply via email to