Abdelrazak Younes wrote:
Abdelrazak Younes wrote:
rgheck wrote:
On 09/20/2009 05:41 PM, you...@lyx.org wrote:
Author: younes
Date: Sun Sep 20 23:41:21 2009
New Revision: 31419
URL: http://www.lyx.org/trac/changeset/31419
Log:
Try to dispatch to document BufferView in case dispatch to current
BufferView fails. This is needed for the LFUNs introduced in r31412
URL: http://www.lyx.org/trac/changeset/31412
Modified:
lyx-devel/trunk/src/BufferView.cpp
lyx-devel/trunk/src/LyXFunc.cpp
Modified: lyx-devel/trunk/src/BufferView.cpp
==============================================================================
--- lyx-devel/trunk/src/BufferView.cpp Sun Sep 20 21:37:26
2009 (r31418)
+++ lyx-devel/trunk/src/BufferView.cpp Sun Sep 20 23:41:21
2009 (r31419)
@@ -1095,6 +1095,8 @@
switch (cmd.action) {
case LFUN_BUFFER_PARAMS_APPLY: {
+ if (buffer_.isInternal())
+ return false;
DocumentClass const * const oldClass =
buffer_.params().documentClassPtr();
cur.recordUndoFullDocument();
istringstream ss(to_utf8(cmd.argument()));
@@ -1116,6 +1118,8 @@
}
case LFUN_LAYOUT_MODULES_CLEAR: {
+ if (buffer_.isInternal())
+ return false;
DocumentClass const * const oldClass =
buffer_.params().documentClassPtr();
cur.recordUndoFullDocument();
I didn't look, so maybe the answer is no, but is there some way this
could be done in one centralized location? It seems bad if we have
to have this same code in several places. But maybe there are only
some LFUNs for which it is needed?
Yes, this is only for the LFUNs that should go to Buffer ideally.
Another option would be to have a switch statement only for that:
if (buffer_.isInternal())
switch (cmd.action) {
The other option is to create an LFUN flag for that, as JMarc
suggested. I have no time for that right now so if someone would like
to give it a try...
To give an indication, that would be something like this:
Index: LyXAction.h
===================================================================
--- LyXAction.h (revision 31425)
+++ LyXAction.h (working copy)
@@ -70,6 +70,7 @@
NoUpdate = 8, //< Does not (usually) require update
SingleParUpdate = 16, //< Usually only requires this par
updated
AtPoint = 32, //< dispatch first to inset at cursor if
there is one
+ Document = 64, //< Can be used only for a proper
document buffer, not an interal one
};
LyXAction();
And then all LFUNs should be updated in LyXAction.cpp.
Abdel.