]> git.lyx.org Git - features.git/commitdiff
Add accept/reject change to the edit context menu.
authorVincent van Ravesteijn <vfr@lyx.org>
Fri, 1 May 2009 17:06:36 +0000 (17:06 +0000)
committerVincent van Ravesteijn <vfr@lyx.org>
Fri, 1 May 2009 17:06:36 +0000 (17:06 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29478 a592a061-630c-0410-9148-cb99ea01b6c8

lib/ui/stdcontext.inc
src/Text.cpp
src/Text3.cpp

index bf7e30d4db8580fd40fe647640c0c969667765ab..0513d062d016c3eded963ec8bc26c6cda5f7ac93 100644 (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"
index b9bc20f621e511a487565e6c7c3df9a5eb21378d..7f1861efb2e35649797c38ae95c6f568a4a4f116 100644 (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())
-               return;
+       if (!cur.selection()) {
+               Change const & change = cur.paragraph().lookupChange(cur.pos());
+               if (!(change.changed() && findNextChange(&cur.bv())))
+                       return;
+       }
 
        cur.recordUndoSelection();
 
index 0cbef5f727826fbff20770ebfb2cd052f6d1e6a7..38e435ca7e0464ca95038ca1f986dc525e0f9ac2 100644 (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,13 +2270,18 @@ 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.
-               enable = true;
+               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;
 
        case LFUN_OUTLINE_UP: