revert previous commit, it did not compile of course...

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36723 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2010-12-04 22:19:53 +00:00
parent 7916b0dc68
commit 28896d1bdd

View File

@ -1605,91 +1605,90 @@ void GuiApplication::dispatch(FuncRequest const & cmd, DispatchResult & dr)
default:
// Everything below is only for active window
if (current_view_)
if (current_view_ == 0)
break;
return;
}
// Let the current GuiView dispatch its own actions.
current_view_->dispatch(cmd, dr);
// Let the current GuiView dispatch its own actions.
current_view_->dispatch(cmd, dr);
if (dr.dispatched())
break;
BufferView * bv = current_view_->currentBufferView();
LASSERT(bv, /**/);
// Avoid a screen redraw in the middle of a dispatch operation just
// because a warning or an error was displayed.
current_view_->setBusy(true);
// Let the current BufferView dispatch its own actions.
bv->dispatch(cmd, dr);
if (dr.dispatched())
break;
BufferView * doc_bv = current_view_->documentBufferView();
// Try with the document BufferView dispatch if any.
if (doc_bv) {
doc_bv->dispatch(cmd, dr);
if (dr.dispatched())
break;
}
// OK, so try the current Buffer itself...
bv->buffer().dispatch(cmd, dr);
if (dr.dispatched())
break;
BufferView * bv = current_view_->currentBufferView();
LASSERT(bv, /**/);
// and with the document Buffer.
if (doc_bv) {
doc_bv->buffer().dispatch(cmd, dr);
// Avoid a screen redraw in the middle of a dispatch operation just
// because a warning or an error was displayed.
current_view_->setBusy(true);
// Let the current BufferView dispatch its own actions.
bv->dispatch(cmd, dr);
if (dr.dispatched())
break;
}
// Let the current Cursor dispatch its own actions.
Cursor old = bv->cursor();
bv->cursor().dispatch(cmd);
// notify insets we just left
// FIXME: move this code to Cursor::dispatch
if (bv->cursor() != old) {
old.beginUndoGroup();
old.fixIfBroken();
bool badcursor = notifyCursorLeavesOrEnters(old, bv->cursor());
if (badcursor) {
bv->cursor().fixIfBroken();
bv->fixInlineCompletionPos();
BufferView * doc_bv = current_view_->documentBufferView();
// Try with the document BufferView dispatch if any.
if (doc_bv) {
doc_bv->dispatch(cmd, dr);
if (dr.dispatched())
break;
}
old.endUndoGroup();
}
// update completion. We do it here and not in
// processKeySym to avoid another redraw just for a
// changed inline completion
if (cmd.origin() == FuncRequest::KEYBOARD) {
if (cmd.action() == LFUN_SELF_INSERT
|| (cmd.action() == LFUN_ERT_INSERT && bv->cursor().inMathed()))
current_view_->updateCompletion(bv->cursor(), true, true);
else if (cmd.action() == LFUN_CHAR_DELETE_BACKWARD)
current_view_->updateCompletion(bv->cursor(), false, true);
else
current_view_->updateCompletion(bv->cursor(), false, false);
}
// OK, so try the current Buffer itself...
bv->buffer().dispatch(cmd, dr);
if (dr.dispatched())
break;
dr = bv->cursor().result();
// and with the document Buffer.
if (doc_bv) {
doc_bv->buffer().dispatch(cmd, dr);
if (dr.dispatched())
break;
}
// Let the current Cursor dispatch its own actions.
Cursor old = bv->cursor();
bv->cursor().dispatch(cmd);
// notify insets we just left
// FIXME: move this code to Cursor::dispatch
if (bv->cursor() != old) {
old.beginUndoGroup();
old.fixIfBroken();
bool badcursor = notifyCursorLeavesOrEnters(old, bv->cursor());
if (badcursor) {
bv->cursor().fixIfBroken();
bv->fixInlineCompletionPos();
}
old.endUndoGroup();
}
// update completion. We do it here and not in
// processKeySym to avoid another redraw just for a
// changed inline completion
if (cmd.origin() == FuncRequest::KEYBOARD) {
if (cmd.action() == LFUN_SELF_INSERT
|| (cmd.action() == LFUN_ERT_INSERT && bv->cursor().inMathed()))
current_view_->updateCompletion(bv->cursor(), true, true);
else if (cmd.action() == LFUN_CHAR_DELETE_BACKWARD)
current_view_->updateCompletion(bv->cursor(), false, true);
else
current_view_->updateCompletion(bv->cursor(), false, false);
}
dr = bv->cursor().result();
current_view_->setBusy(false);
}
// if we executed a mutating lfun, mark the buffer as dirty
Buffer * doc_buffer = (current_view_->documentBufferView())
Buffer * doc_buffer = (current_view_ && current_view_->documentBufferView())
? &(current_view_->documentBufferView()->buffer()) : 0;
if (doc_buffer && theBufferList().isLoaded(doc_buffer)
&& flag.enabled()
&& !lyxaction.funcHasFlag(action, LyXAction::NoBuffer)
&& !lyxaction.funcHasFlag(action, LyXAction::ReadOnly))
current_view_->currentBufferView()->buffer().markDirty();
current_view_->setBusy(false);
}