mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-10 18:58:10 +00:00
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 git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31419 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
f10a5043a9
commit
53797b653a
@ -1095,6 +1095,8 @@ bool BufferView::dispatch(FuncRequest const & cmd)
|
||||
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 @@ bool BufferView::dispatch(FuncRequest const & cmd)
|
||||
}
|
||||
|
||||
case LFUN_LAYOUT_MODULES_CLEAR: {
|
||||
if (buffer_.isInternal())
|
||||
return false;
|
||||
DocumentClass const * const oldClass =
|
||||
buffer_.params().documentClassPtr();
|
||||
cur.recordUndoFullDocument();
|
||||
@ -1127,6 +1131,8 @@ bool BufferView::dispatch(FuncRequest const & cmd)
|
||||
}
|
||||
|
||||
case LFUN_LAYOUT_MODULE_ADD: {
|
||||
if (buffer_.isInternal())
|
||||
return false;
|
||||
BufferParams const & params = buffer_.params();
|
||||
if (!params.moduleCanBeAdded(argument)) {
|
||||
LYXERR0("Module `" << argument <<
|
||||
@ -1144,6 +1150,8 @@ bool BufferView::dispatch(FuncRequest const & cmd)
|
||||
}
|
||||
|
||||
case LFUN_TEXTCLASS_APPLY: {
|
||||
if (buffer_.isInternal())
|
||||
return false;
|
||||
if (!LayoutFileList::get().load(argument, buffer_.temppath()) &&
|
||||
!LayoutFileList::get().load(argument, buffer_.filePath()))
|
||||
break;
|
||||
@ -1167,11 +1175,15 @@ bool BufferView::dispatch(FuncRequest const & cmd)
|
||||
}
|
||||
|
||||
case LFUN_TEXTCLASS_LOAD:
|
||||
if (buffer_.isInternal())
|
||||
return false;
|
||||
LayoutFileList::get().load(argument, buffer_.temppath()) ||
|
||||
LayoutFileList::get().load(argument, buffer_.filePath());
|
||||
break;
|
||||
|
||||
case LFUN_LAYOUT_RELOAD: {
|
||||
if (buffer_.isInternal())
|
||||
return false;
|
||||
DocumentClass const * const oldClass = buffer_.params().documentClassPtr();
|
||||
LayoutFileIndex bc = buffer_.params().baseClassID();
|
||||
LayoutFileList::get().reset(bc);
|
||||
|
@ -1091,6 +1091,9 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
if (lyx_view_ == 0)
|
||||
break;
|
||||
|
||||
BufferView * bv = lyx_view_->documentBufferView();
|
||||
BufferView * doc_bv = lyx_view_->documentBufferView();
|
||||
|
||||
// Start an undo group. This may be needed for
|
||||
// some stuff like inset-apply on labels.
|
||||
if (theBufferList().isLoaded(buffer))
|
||||
@ -1098,38 +1101,44 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
|
||||
// Let the current LyXView dispatch its own actions.
|
||||
if (lyx_view_->dispatch(cmd)) {
|
||||
if (lyx_view_->currentBufferView()) {
|
||||
updateFlags = lyx_view_->currentBufferView()->cursor().result().update();
|
||||
if (bv) {
|
||||
updateFlags = bv->cursor().result().update();
|
||||
if (theBufferList().isLoaded(buffer))
|
||||
buffer->undo().endUndoGroup();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
LASSERT(lyx_view_->currentBufferView(), /**/);
|
||||
LASSERT(bv, /**/);
|
||||
|
||||
// Let the current BufferView dispatch its own actions.
|
||||
if (lyx_view_->currentBufferView()->dispatch(cmd)) {
|
||||
if (bv->dispatch(cmd)) {
|
||||
// The BufferView took care of its own updates if needed.
|
||||
updateFlags = Update::None;
|
||||
if (theBufferList().isLoaded(buffer))
|
||||
buffer->undo().endUndoGroup();
|
||||
break;
|
||||
}
|
||||
// Try with the document BufferView dispatch if any.
|
||||
if (doc_bv && doc_bv->dispatch(cmd)) {
|
||||
// The BufferView took care of its own updates if needed.
|
||||
buffer = &(doc_bv->buffer());
|
||||
updateFlags = Update::None;
|
||||
if (theBufferList().isLoaded(buffer))
|
||||
buffer->undo().endUndoGroup();
|
||||
break;
|
||||
}
|
||||
|
||||
// OK, so try the Buffer itself
|
||||
// OK, so try the current Buffer itself...
|
||||
DispatchResult dr;
|
||||
BufferView * bv = lyx_view_->currentBufferView();
|
||||
bv->buffer().dispatch(cmd, dr);
|
||||
if (dr.dispatched()) {
|
||||
updateFlags = dr.update();
|
||||
break;
|
||||
}
|
||||
// OK, so try with the document Buffer.
|
||||
BufferView * doc_bv = lyx_view_->documentBufferView();
|
||||
// and with the document Buffer.
|
||||
if (doc_bv) {
|
||||
buffer = &(doc_bv->buffer());
|
||||
buffer->dispatch(cmd, dr);
|
||||
doc_bv->buffer().dispatch(cmd, dr);
|
||||
if (dr.dispatched()) {
|
||||
updateFlags = dr.update();
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user