iteration 11 attached...

opinions?
Index: src/LyXAction.C
===================================================================
--- src/LyXAction.C     (revision 13679)
+++ src/LyXAction.C     (working copy)
@@ -353,6 +353,8 @@
                { LFUN_MOUSE_RELEASE, "", ReadOnly },
                { LFUN_MOUSE_DOUBLE, "", ReadOnly },
                { LFUN_MOUSE_TRIPLE, "", ReadOnly },
+               { LFUN_PARAGRAPH_MOVE_DOWN, "paragraph-move-down", Noop },
+               { LFUN_PARAGRAPH_MOVE_UP, "paragraph-move-up", Noop },
                { LFUN_NOACTION, "", Noop }
        };
 
Index: src/text3.C
===================================================================
--- src/text3.C (revision 13679)
+++ src/text3.C (working copy)
@@ -44,6 +44,7 @@
 #include "ParagraphParameters.h"
 #include "undo.h"
 #include "vspace.h"
+#include "pariterator.h"
 
 #include "frontends/Dialogs.h"
 #include "frontends/LyXView.h"
@@ -321,6 +322,36 @@
 
        switch (cmd.action) {
 
+       case LFUN_PARAGRAPH_MOVE_DOWN: {
+               pit_type const pit = cur.pit();
+               recUndo(pit, pit + 1);
+               finishUndo();
+               std::swap(pars_[pit], pars_[pit + 1]);
+               ++cur.pit();
+
+               ParIterator parit(cur);
+               if (needsUpdateCounters(cur.buffer(), parit))
+                       updateCounters(cur.buffer());
+
+               needsUpdate = true;
+               break;
+       }
+
+       case LFUN_PARAGRAPH_MOVE_UP: {
+               pit_type const pit = cur.pit();
+               recUndo(pit - 1, pit);
+               finishUndo();
+               std::swap(pars_[pit], pars_[pit - 1]);
+               --cur.pit();
+
+               ParIterator parit(cur);
+               if (needsUpdateCounters(cur.buffer(), parit))
+                       updateCounters(cur.buffer());
+
+               needsUpdate = true;
+               break;
+       }
+
        case LFUN_APPENDIX: {
                Paragraph & par = cur.paragraph();
                bool start = !par.params().startOfAppendix();
@@ -1779,6 +1810,16 @@
                enable = lyx::cap::numberOfSelections() > 0;
                break;
 
+       case LFUN_PARAGRAPH_MOVE_UP: {
+               enable = cur.pit() > 0 && !cur.selection();
+               break;
+       }
+
+       case LFUN_PARAGRAPH_MOVE_DOWN: {
+               enable = cur.pit() < cur.lastpit() && !cur.selection();
+               break;
+       }
+
        case LFUN_DELETE_WORD_FORWARD:
        case LFUN_DELETE_WORD_BACKWARD:
        case LFUN_DELETE_LINE_FORWARD:
Index: src/lfuns.h
===================================================================
--- src/lfuns.h (revision 13679)
+++ src/lfuns.h (working copy)
@@ -358,6 +358,9 @@
        LFUN_BIBDB_DEL,
        LFUN_INSERT_CITATION,
        LFUN_OUTLINE,                   // Vermeer 20060323
+       // 275
+       LFUN_PARAGRAPH_MOVE_DOWN,                // Edwin 20060408
+       LFUN_PARAGRAPH_MOVE_UP,                  // Edwin 20060408
 
        LFUN_LASTACTION                  // end of the table
 };
Index: lib/bind/cua.bind
===================================================================
--- lib/bind/cua.bind   (revision 13679)
+++ lib/bind/cua.bind   (working copy)
@@ -102,6 +102,8 @@
 # Motion group
 #
 
+\bind "M-Up"                   "paragraph-move-up"
+\bind "M-Down"                 "paragraph-move-down"
 \bind "C-Right"                        "word-forward"
 \bind "C-Left"                 "word-backward"
 \bind "C-Up"                   "paragraph-up"
Index: lib/bind/emacs.bind
===================================================================
--- lib/bind/emacs.bind (revision 13679)
+++ lib/bind/emacs.bind (working copy)
@@ -139,6 +139,8 @@
 # Motion group
 #
 
+\bind "M-Up"                   "paragraph-move-up"
+\bind "M-Down"                 "paragraph-move-down"
 \bind "C-Right"                        "word-forward"
 \bind "C-Left"                 "word-backward"
 \bind "C-Up"                   "paragraph-up"

Reply via email to