]> git.lyx.org Git - features.git/commitdiff
implement new lfuns inset-begin/end and their -select versions
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Mon, 16 Mar 2009 13:33:27 +0000 (13:33 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Mon, 16 Mar 2009 13:33:27 +0000 (13:33 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@28814 a592a061-630c-0410-9148-cb99ea01b6c8

lib/bind/cua.bind
src/FuncCode.h
src/LyXAction.cpp
src/Text3.cpp

index e87b96ab81ed00fa253eee58ee39c4111020353b..5bf17c4042b2cdebc8afc8d57e4a31812c3a4df7 100644 (file)
 \bind "C-Down"                 "paragraph-down"
 \bind "C-Home"                 "buffer-begin"
 \bind "C-End"                  "buffer-end"
+\bind "M-C-Home"               "inset-begin"
+\bind "M-C-End"                        "inset-end"
 
 \bind "C-~S-greater"           "label-goto"
 \bind "C-~S-less"              "bookmark-goto 0"
 \bind "S-Next"                 "screen-down-select"
 \bind "S-C-Home"               "buffer-begin-select"
 \bind "S-C-End"                        "buffer-end-select"
+\bind "S-M-C-Home"             "inset-begin-select"
+\bind "S-M-C-End"              "inset-end-select"
 \bind "C-Insert"               "copy"
 \bind "S-Insert"               "paste"
 \bind "S-Delete"               "cut"
index 503f30f5a4b3a0ca58753d438abb2d0915a54043..1d6428a33174b08ad08edcd8ac85356d4a1aee05 100644 (file)
@@ -418,6 +418,12 @@ enum FuncCode
        LFUN_VC_COMMAND,
        LFUN_MATH_FONT_STYLE,
        LFUN_PHANTOM_INSERT,            // uwestoehr, 20090130
+       LFUN_INSET_BEGIN,               // JMarc, 20090316
+       // 325
+       LFUN_INSET_END,                 // JMarc, 20090316
+       LFUN_INSET_BEGIN_SELECT,        // JMarc, 20090316
+       LFUN_INSET_END_SELECT,          // JMarc, 20090316
+
 
        LFUN_LASTACTION                 // end of the table
 };
index ffbf8dc75b9c9003e3a223ce764b38837f6fabe5..1edf499ea92144d4276c77ccabfa1ecb97433569 100644 (file)
@@ -1009,6 +1009,49 @@ void LyXAction::init()
  */
                { LFUN_BUFFER_END_SELECT, "buffer-end-select", ReadOnly, Edit },
 
+/*!
+ * \var lyx::FuncCode lyx::LFUN_INSET_BEGIN
+ * \li Action: Move the cursor to the beginning of the current inset 
+               if it is not already there, or at the beginning of the 
+               enclosing inset otherwise
+ * \li Syntax: inset-begin
+ * \li Origin: JMarc, 2009/03/16
+ * \endvar
+ */
+               { LFUN_INSET_BEGIN, "inset-begin", ReadOnly, Edit },
+/*!
+ * \var lyx::FuncCode lyx::LFUN_INSET_BEGIN_SELECT
+ * \li Action: Move the cursor to the beginning of the current inset 
+               if it is not already there, or at the beginning of the 
+               enclosing inset otherwise (adding the
+               traversed text to the selection).
+ * \li Syntax: inset-begin-select
+ * \li Origin: JMarc, 2009/03/16
+ * \endvar
+ */
+               { LFUN_INSET_BEGIN_SELECT, "inset-begin-select", ReadOnly, Edit },
+/*!
+ * \var lyx::FuncCode lyx::LFUN_INSET_END
+ * \li Action: Move the cursor to the end of the current inset 
+               if it is not already there, or at the end of the 
+               enclosing inset otherwise
+ * \li Syntax: inset-end
+ * \li Origin: JMarc, 2009/03/16
+ * \endvar
+ */
+               { LFUN_INSET_END, "inset-end", ReadOnly, Edit },
+/*!
+ * \var lyx::FuncCode lyx::LFUN_INSET_END_SELECT
+ * \li Action: Move the cursor to the end of the current inset 
+               if it is not already there, or at the end of the 
+               enclosing inset otherwise (adding the
+               traversed text to the selection).
+ * \li Syntax: inset-end-select
+ * \li Origin: JMarc, 2009/03/16
+ * \endvar
+ */
+               { LFUN_INSET_END_SELECT, "inset-end-select", ReadOnly, Edit },
+
 /*!
  * \var lyx::FuncCode lyx::LFUN_LINE_BEGIN
  * \li Action: Move the cursor to the begining of the (screen) line.
index c212f156f1bccdb58ed80566da4be5212c5d1cd0..50dcf34f7ca15df2500844654e69a00a5cd69df4 100644 (file)
@@ -561,6 +561,26 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                cur.updateFlags(Update::FitCursor);
                break;
 
+       case LFUN_INSET_BEGIN:
+       case LFUN_INSET_BEGIN_SELECT:
+               needsUpdate |= cur.selHandle(cmd.action == LFUN_INSET_BEGIN_SELECT);
+               if (cur.depth() == 1 || cur.pos() > 0)
+                       needsUpdate |= cursorTop(cur);
+               else
+                       cur.undispatched();
+               cur.updateFlags(Update::FitCursor);
+               break;
+
+       case LFUN_INSET_END:
+       case LFUN_INSET_END_SELECT:
+               needsUpdate |= cur.selHandle(cmd.action == LFUN_INSET_END_SELECT);
+               if (cur.depth() == 1 || cur.pos() < cur.lastpos())
+                       needsUpdate |= cursorBottom(cur);
+               else
+                       cur.undispatched();
+               cur.updateFlags(Update::FitCursor);
+               break;
+
        case LFUN_CHAR_FORWARD:
        case LFUN_CHAR_FORWARD_SELECT:
                //LYXERR0(" LFUN_CHAR_FORWARD[SEL]:\n" << cur);
@@ -2378,10 +2398,14 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
        case LFUN_PARAGRAPH_PARAMS_APPLY:
        case LFUN_PARAGRAPH_PARAMS:
        case LFUN_ESCAPE:
-       case LFUN_BUFFER_END:
        case LFUN_BUFFER_BEGIN:
+       case LFUN_BUFFER_END:
        case LFUN_BUFFER_BEGIN_SELECT:
        case LFUN_BUFFER_END_SELECT:
+       case LFUN_INSET_BEGIN:
+       case LFUN_INSET_END:
+       case LFUN_INSET_BEGIN_SELECT:
+       case LFUN_INSET_END_SELECT:
        case LFUN_UNICODE_INSERT:
                // these are handled in our dispatch()
                enable = true;