Add accept/reject change to the edit context menu.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29478 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Vincent van Ravesteijn 2009-05-01 17:06:36 +00:00
parent 61e32e1c25
commit 7108b8e463
3 changed files with 17 additions and 4 deletions

View File

@ -292,6 +292,9 @@ Menuset
OptItem "Move Section up|u" "outline-up"
OptItem "Insert Short Title|T" "optional-insert"
Separator
OptItem "Accept Change|C" "change-accept"
OptItem "Reject Change|R" "change-reject"
Separator
Item "Apply Last Text Style|A" "textstyle-apply"
Submenu "Text Style|S" "edit_textstyles"
Item "Paragraph Settings...|P" "layout-paragraph"

View File

@ -37,6 +37,7 @@
#include "Language.h"
#include "Length.h"
#include "Lexer.h"
#include "lyxfind.h"
#include "LyXRC.h"
#include "Paragraph.h"
#include "paragraph_funcs.h"
@ -792,8 +793,11 @@ void Text::acceptOrRejectChanges(Cursor & cur, ChangeOp op)
{
LASSERT(this == cur.text(), /**/);
if (!cur.selection())
if (!cur.selection()) {
Change const & change = cur.paragraph().lookupChange(cur.pos());
if (!(change.changed() && findNextChange(&cur.bv())))
return;
}
cur.recordUndoSelection();

View File

@ -25,6 +25,7 @@
#include "buffer_funcs.h"
#include "BufferParams.h"
#include "BufferView.h"
#include "Changes.h"
#include "Cursor.h"
#include "CutAndPaste.h"
#include "DispatchResult.h"
@ -2269,12 +2270,17 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
case LFUN_CHANGE_ACCEPT:
case LFUN_CHANGE_REJECT:
// TODO: context-sensitive enabling of LFUN_CHANGE_ACCEPT/REJECT
// In principle, these LFUNs should only be enabled if there
// is a change at the current position/in the current selection.
// However, without proper optimizations, this will inevitably
// result in unacceptable performance - just imagine a user who
// wants to select the complete content of a long document.
if (!cur.selection()) {
Change const & change = cur.paragraph().lookupChange(cur.pos());
enable = change.changed();
} else
// TODO: context-sensitive enabling of LFUN_CHANGE_ACCEPT/REJECT
// for selections.
enable = true;
break;