mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-10 20:04:46 +00:00
* LyXFunc::dispatch(): invert BufferView::dispatch() and cursor::dispatch() calling.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22227 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
b8be6be268
commit
96d2d6fc50
@ -862,7 +862,7 @@ FuncStatus BufferView::getStatus(FuncRequest const & cmd)
|
||||
}
|
||||
|
||||
|
||||
Update::flags BufferView::dispatch(FuncRequest const & cmd)
|
||||
bool BufferView::dispatch(FuncRequest const & cmd)
|
||||
{
|
||||
//lyxerr << [ cmd = " << cmd << "]" << endl;
|
||||
|
||||
@ -874,27 +874,21 @@ Update::flags BufferView::dispatch(FuncRequest const & cmd)
|
||||
<< " button[" << cmd.button() << ']');
|
||||
|
||||
Cursor & cur = d->cursor_;
|
||||
// Default Update flags.
|
||||
Update::flags updateFlags = Update::Force | Update::FitCursor;
|
||||
|
||||
switch (cmd.action) {
|
||||
|
||||
case LFUN_UNDO:
|
||||
cur.message(_("Undo"));
|
||||
cur.clearSelection();
|
||||
if (!cur.textUndo()) {
|
||||
if (!cur.textUndo())
|
||||
cur.message(_("No further undo information"));
|
||||
updateFlags = Update::None;
|
||||
}
|
||||
break;
|
||||
|
||||
case LFUN_REDO:
|
||||
cur.message(_("Redo"));
|
||||
cur.clearSelection();
|
||||
if (!cur.textRedo()) {
|
||||
if (!cur.textRedo())
|
||||
cur.message(_("No further redo information"));
|
||||
updateFlags = Update::None;
|
||||
}
|
||||
break;
|
||||
|
||||
case LFUN_FONT_STATE:
|
||||
@ -945,7 +939,6 @@ Update::flags BufferView::dispatch(FuncRequest const & cmd)
|
||||
theLyXFunc().dispatch(FuncRequest(
|
||||
LFUN_BUFFER_SWITCH, b->absFileName()));
|
||||
theLyXFunc().dispatch(cmd);
|
||||
updateFlags = Update::None;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -1175,13 +1168,14 @@ Update::flags BufferView::dispatch(FuncRequest const & cmd)
|
||||
d->text_metrics_[&buffer_.text()].editXY(cur, p.x_, p.y_);
|
||||
//FIXME: what to do with cur.x_target()?
|
||||
cur.finishUndo();
|
||||
// The metrics are already up to date. see scroll()
|
||||
updateFlags = Update::None;
|
||||
break;
|
||||
}
|
||||
|
||||
case LFUN_SCREEN_UP_SELECT:
|
||||
case LFUN_SCREEN_DOWN_SELECT: {
|
||||
// Those two are not ready yet for consumption.
|
||||
return false;
|
||||
|
||||
cur.selHandle(true);
|
||||
size_t initial_depth = cur.depth();
|
||||
Point const p = getPos(cur, cur.boundary());
|
||||
@ -1197,15 +1191,14 @@ Update::flags BufferView::dispatch(FuncRequest const & cmd)
|
||||
// But no screen update is needed.
|
||||
d->update_strategy_ = NoScreenUpdate;
|
||||
buffer_.changed();
|
||||
updateFlags = Update::Force | Update::FitCursor;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
updateFlags = Update::None;
|
||||
return false;
|
||||
}
|
||||
|
||||
return updateFlags;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
@ -151,8 +151,8 @@ public:
|
||||
/// return true for events that will handle.
|
||||
FuncStatus getStatus(FuncRequest const & cmd);
|
||||
/// execute the given function.
|
||||
/// \return the Update::flags for further metrics update.
|
||||
Update::flags dispatch(FuncRequest const & argument);
|
||||
/// \return true if the function has been processed.
|
||||
bool dispatch(FuncRequest const & argument);
|
||||
|
||||
/// request an X11 selection.
|
||||
/// \return the selected string.
|
||||
|
@ -1744,7 +1744,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
LyX::ref().session().bookmarks().clear();
|
||||
break;
|
||||
|
||||
default: {
|
||||
default:
|
||||
BOOST_ASSERT(theApp());
|
||||
// Let the frontend dispatch its own actions.
|
||||
if (theApp()->dispatch(cmd))
|
||||
@ -1759,20 +1759,21 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
break;
|
||||
}
|
||||
|
||||
// FIXME: Probably a good idea to inverse the Cursor and BufferView
|
||||
// dispatching.
|
||||
BOOST_ASSERT(lyx_view_->view());
|
||||
// Let the current BufferView dispatch its own actions.
|
||||
if (view()->dispatch(cmd)) {
|
||||
// The BufferView took care of its own updates if needed.
|
||||
updateFlags = Update::None;
|
||||
break;
|
||||
}
|
||||
|
||||
// Let the current Cursor dispatch its own actions.
|
||||
BOOST_ASSERT(lyx_view_->view());
|
||||
view()->cursor().getPos(cursorPosBeforeDispatchX_,
|
||||
cursorPosBeforeDispatchY_);
|
||||
view()->cursor().dispatch(cmd);
|
||||
updateFlags = view()->cursor().result().update();
|
||||
if (!view()->cursor().result().dispatched())
|
||||
// Let the current BufferView dispatch its own actions.
|
||||
updateFlags = view()->dispatch(cmd);
|
||||
break;
|
||||
}
|
||||
// Verify that the action has been dispatched.
|
||||
BOOST_ASSERT(view()->cursor().result().dispatched());
|
||||
}
|
||||
|
||||
if (lyx_view_ && lyx_view_->buffer()) {
|
||||
|
@ -486,6 +486,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
||||
} else {
|
||||
cur.undispatched();
|
||||
}
|
||||
cur.updateFlags(Update::FitCursor);
|
||||
break;
|
||||
|
||||
case LFUN_BUFFER_END:
|
||||
@ -496,6 +497,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
||||
} else {
|
||||
cur.undispatched();
|
||||
}
|
||||
cur.updateFlags(Update::FitCursor);
|
||||
break;
|
||||
|
||||
case LFUN_CHAR_FORWARD:
|
||||
|
Loading…
Reference in New Issue
Block a user