mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-24 05:40:59 +00:00
Remove buggy and redundant BufferView::update() calls.
* BufferView::dispatch() now returns an Update::flags. * lyx_cb.C::insertPlaintextFile(): delete redundant BufferView::update() call. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16844 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
e4c489376c
commit
c347f0467b
@ -690,7 +690,7 @@ FuncStatus BufferView::getStatus(FuncRequest const & cmd)
|
||||
}
|
||||
|
||||
|
||||
bool BufferView::dispatch(FuncRequest const & cmd)
|
||||
Update::flags BufferView::dispatch(FuncRequest const & cmd)
|
||||
{
|
||||
//lyxerr << BOOST_CURRENT_FUNCTION
|
||||
// << [ cmd = " << cmd << "]" << endl;
|
||||
@ -704,30 +704,34 @@ bool BufferView::dispatch(FuncRequest const & cmd)
|
||||
<< " button[" << cmd.button() << ']'
|
||||
<< endl;
|
||||
|
||||
// FIXME: this should not be possible.
|
||||
if (!buffer_)
|
||||
return Update::None;
|
||||
|
||||
LCursor & cur = cursor_;
|
||||
// Default Update flags.
|
||||
Update::flags updateFlags = Update::Force | Update::FitCursor;
|
||||
|
||||
switch (cmd.action) {
|
||||
|
||||
case LFUN_UNDO:
|
||||
if (buffer_) {
|
||||
cur.message(_("Undo"));
|
||||
cur.clearSelection();
|
||||
if (!textUndo(*this))
|
||||
if (!textUndo(*this)) {
|
||||
cur.message(_("No further undo information"));
|
||||
update();
|
||||
switchKeyMap();
|
||||
updateFlags = Update::None;
|
||||
}
|
||||
switchKeyMap();
|
||||
break;
|
||||
|
||||
case LFUN_REDO:
|
||||
if (buffer_) {
|
||||
cur.message(_("Redo"));
|
||||
cur.clearSelection();
|
||||
if (!textRedo(*this))
|
||||
if (!textRedo(*this)) {
|
||||
cur.message(_("No further redo information"));
|
||||
update();
|
||||
switchKeyMap();
|
||||
updateFlags = Update::None;
|
||||
}
|
||||
switchKeyMap();
|
||||
break;
|
||||
|
||||
case LFUN_FILE_INSERT:
|
||||
@ -789,13 +793,13 @@ bool BufferView::dispatch(FuncRequest const & cmd)
|
||||
if (b == buffer_) {
|
||||
// Set the cursor
|
||||
setCursor(makeDocIterator(par, 0));
|
||||
update();
|
||||
switchKeyMap();
|
||||
} else {
|
||||
// Switch to other buffer view and resend cmd
|
||||
theLyXFunc().dispatch(FuncRequest(
|
||||
LFUN_BUFFER_SWITCH, b->fileName()));
|
||||
theLyXFunc().dispatch(cmd);
|
||||
updateFlags = Update::None;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -839,10 +843,9 @@ bool BufferView::dispatch(FuncRequest const & cmd)
|
||||
buffer_->params().trackChanges = !buffer_->params().trackChanges;
|
||||
break;
|
||||
|
||||
case LFUN_CHANGES_OUTPUT: {
|
||||
case LFUN_CHANGES_OUTPUT:
|
||||
buffer_->params().outputChanges = !buffer_->params().outputChanges;
|
||||
break;
|
||||
}
|
||||
|
||||
case LFUN_CHANGE_NEXT:
|
||||
findNextChange(this);
|
||||
@ -860,7 +863,6 @@ bool BufferView::dispatch(FuncRequest const & cmd)
|
||||
#endif
|
||||
while (findNextChange(this))
|
||||
getLyXText()->acceptOrRejectChange(cursor_, true);
|
||||
update();
|
||||
break;
|
||||
}
|
||||
|
||||
@ -995,10 +997,10 @@ bool BufferView::dispatch(FuncRequest const & cmd)
|
||||
}
|
||||
|
||||
default:
|
||||
return false;
|
||||
updateFlags = Update::None;
|
||||
}
|
||||
|
||||
return true;
|
||||
return updateFlags;
|
||||
}
|
||||
|
||||
|
||||
|
@ -157,7 +157,8 @@ public:
|
||||
/// return true for events that will handle.
|
||||
FuncStatus getStatus(FuncRequest const & cmd);
|
||||
/// execute the given function.
|
||||
bool dispatch(FuncRequest const & argument);
|
||||
/// \return the Update::flags for further metrics update.
|
||||
Update::flags dispatch(FuncRequest const & argument);
|
||||
|
||||
/// request an X11 selection.
|
||||
/// \return the selected string.
|
||||
|
@ -337,7 +337,6 @@ void insertPlaintextFile(BufferView * bv, string const & f, bool asParagraph)
|
||||
bv->getLyXText()->insertStringAsParagraphs(bv->cursor(), tmpstr);
|
||||
else
|
||||
bv->getLyXText()->insertStringAsLines(bv->cursor(), tmpstr);
|
||||
bv->update();
|
||||
}
|
||||
|
||||
|
||||
|
@ -1739,8 +1739,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
view()->cursor().dispatch(cmd);
|
||||
updateFlags = view()->cursor().result().update();
|
||||
if (!view()->cursor().result().dispatched())
|
||||
if (view()->dispatch(cmd))
|
||||
updateFlags = Update::Force | Update::FitCursor;
|
||||
updateFlags = view()->dispatch(cmd);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user