Vincent van Ravesteijn wrote:
My guess is that you wanted to refer to the LyXView.{h,cpp} patch
which introduces
LyXView::documentBufferView()
where I actually violated the protocol, apologies.
Actually, I was probably mislead by a comment from Vincent, I thought
he was talking about this GuiRef patch.
The comment was about r31219. I really don't like that commit because:
1) I don't want to spoil the code with an infinite amount of
if (buffer().fileName().extension() == "internal")
constructions,
2) there are still a zillion of bugs related to this issue, and we
can't solve them all one-by-one whenever we see one. We need to think
about a real solution,
3) setting the screen_label should not be a task of addToToc(), but of
updateLabels(),
4) this patch is useless, because we shouldn't call addToToc for any
inset in an embedded workarea,
5) there is a large comment which could have been discussed.
You are right (I didn't see this commit up until now).
Can you confirm, please, if you want me to revert Changeset 31203 ?
http://www.lyx.org/trac/changeset/31203/lyx-devel/trunk/src/frontends/LyXView.h
No, it's too late now, but don't do it again! just kidding :-)
Why would it be too late ?
As also said above, there are zillion of places where this should be
fixed.
Most of all, I don't like the randomness with which this is done. All
LFUNs handled in LyXFunc should relate to the documentBuffer(). Now
some LFUNs are corrected and others are not. At least the following
should all be related to the documentBuffer():
LFUN_BUFFER_TOGGLE_READ_ONLY,
LFUN_BUFFER_CLOSE,
LFUN_BUFFER_CLOSE_ALL,
LFUN_BUFFER_RELOAD,
LFUN_BUILD_PROGRAM,
LFUN_BUFFER_CHKTEX,
LFUN_BUFFER_EXPORT,
LFUN_BUFFER_EXPORT_CUSTOM,
LFUN_BUFFER_AUTO_SAVE,
LFUN_VC_REGISTER,
LFUN_VC_CHECK_IN,
LFUN_VC_CHECK_OUT,
LFUN_VC_LOCKING_TOGGLE,
LFUN_VC_REVERT,
LFUN_VC_UNDO_LAST,
LFUN_SERVER_GET_FILENAME,
LFUN_BUFFER_CHILD_OPEN,
LFUN_BUFFER_LANGUAGE,
LFUN_BUFFER_SAVE_AS_DEFAULT,
LFUN_BUFFER_PARAMS_APPLY,
LFUN_LAYOUT_MODULES_CLEAR,
LFUN_LAYOUT_MODULE_ADD,
LFUN_TEXTCLASS_APPLY,
LFUN_LAYOUT_RELOAD,
LFUN_TEXTCLASS_LOAD,
LFUN_VC_COMMAND
I really don't want to alter all these LFUNs with code to retrieve the
documentBuffer over and over again. I made this remark, but there was
no reaction.
The idea if we stay with current architecture is that
LyXFunc::dispatch() set the local variable 'buf' to documentBuffer() at
the top of the method and to currentBuffer() otherwise.
I agree but this is an interim solution.
I feel that it is taking us the wrong way.
The real solution IMHO is to get rid of LyXFunc dispatch and let the
Qt based classes handle the whole thing. Basically that means:
1) GuiApplication::dispatch(): handles what it can or delegate to
GuiView::dispatch() onto the current window that has the focus.
2) GuiView::dispatch(): handles what it can or delegate selectively
to either the current document workarea or the current embedded
workarea that has the focus depending on the LFUN.
3) GuiWorkArea::dispatch() will then it handles what it can or
delegate to BufferView::dispatch().
4) BufferView::dispatch() will then it handles what it can or
delegate to Inset::dispatch() if this is involving the current or to
Buffer::dispatch() if this is a pure Buffer LFUN.
I agree, but I think this is more or less how the design was intended
to be, or not ?
No, JMarc always resisted going that path... He wants
LyXFunc::dispatch() to be the central thing while I want each class to
take care of its children. The current approach is the main reason for a
LyXView virtual interface, which will go away with my proposed approach.
Abdel.