]> git.lyx.org Git - features.git/commitdiff
Introduce LFUN_SCROLL.
authorAbdelrazak Younes <younes@lyx.org>
Thu, 27 Dec 2007 11:37:07 +0000 (11:37 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Thu, 27 Dec 2007 11:37:07 +0000 (11:37 +0000)
Santa-clauss.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22324 a592a061-630c-0410-9148-cb99ea01b6c8

lib/bind/cua.bind
src/BufferView.cpp
src/BufferView.h
src/LyXAction.cpp
src/lfuns.h

index d8dc27084a2c9b28be139d823b3c2b51817b724e..ba1ea0048a5ec959e088edf37b4df299396533b9 100644 (file)
 \bind "C-F4"                   "buffer-close"
 \bind "M-F4"                   "lyx-quit"
 \bind "F5"                     "screen-recenter"
+\bind "C-M-Up"                 "scroll line up"
+\bind "C-M-Down"               "scroll line down"
+\bind "C-M-Prior"              "scroll page up"
+\bind "C-M-Next"               "scroll page down"
 \bind "C-F6"                   "buffer-next"
 \bind "C-S-F6"                 "buffer-previous"
 \bind "F7"                     "dialog-show spellchecker"
index b160285c1326b8ddbe1a9c1d25918ccb8136fb43..7afe959d586557692b90f6d9e9b566d758bd633d 100644 (file)
@@ -830,6 +830,7 @@ FuncStatus BufferView::getStatus(FuncRequest const & cmd)
 
        case LFUN_SCREEN_UP:
        case LFUN_SCREEN_DOWN:
+       case LFUN_SCROLL:
                flag.enabled(true);
                break;
 
@@ -1218,6 +1219,10 @@ bool BufferView::dispatch(FuncRequest const & cmd)
                break;
        }
 
+       case LFUN_SCROLL:
+               lfunScroll(cmd);
+               break;
+
        case LFUN_SCREEN_UP_SELECT:
        case LFUN_SCREEN_DOWN_SELECT: {
                // Those two are not ready yet for consumption.
@@ -1408,6 +1413,27 @@ void BufferView::mouseEventDispatch(FuncRequest const & cmd0)
 }
 
 
+void BufferView::lfunScroll(FuncRequest const & cmd)
+{
+       string const scroll_type = cmd.getArg(0);
+       int const scroll_step = 
+               (scroll_type == "line")? d->scrollbarParameters_.lineScrollHeight
+               : (scroll_type == "page")? height_ : 0;
+       if (scroll_step == 0)
+               return;
+       string const scroll_quantity = cmd.getArg(1);
+       if (scroll_quantity == "up")
+               scrollUp(scroll_step);
+       else if (scroll_quantity == "down")
+               scrollDown(scroll_step);
+       else {
+               int const scroll_value = convert<int>(scroll_quantity);
+               if (scroll_value)
+                       scroll(scroll_step * scroll_value);
+       }
+}
+
+
 void BufferView::scroll(int y)
 {
        if (y > 0)
index f1897cb96449ddb3c9cdeaba07afe070a80b0c92..765267b421b0aaa68a9ea3b33ad8f8a926d85a15 100644 (file)
@@ -134,6 +134,8 @@ public:
        /// This method will automatically scroll and update the BufferView and updated 
        /// if needed.
        void showCursor();
+       /// LFUN_SCROLL Helper.
+       void lfunScroll(FuncRequest const & cmd);
        /// scroll down document by the given number of pixels.
        void scrollDown(int pixels);
        /// scroll up document by the given number of pixels.
index c1222ff06d97e615005ad708f8627440597fed07..de2d41e7a3a72a10c3f8c56a4cadbda937bdf6dc 100644 (file)
@@ -276,6 +276,7 @@ void LyXAction::init()
                { LFUN_SCREEN_DOWN, "screen-down", ReadOnly, Edit },
                { LFUN_SCREEN_DOWN_SELECT, "screen-down-select", ReadOnly, Edit },
                { LFUN_SCREEN_FONT_UPDATE, "screen-font-update", NoBuffer, Layout },
+               { LFUN_SCROLL, "scroll", ReadOnly, Edit },
                { LFUN_SCREEN_RECENTER, "screen-recenter", ReadOnly, Edit },
                { LFUN_SCREEN_UP, "screen-up", ReadOnly, Edit },
                { LFUN_SCREEN_UP_SELECT, "screen-up-select", ReadOnly, Edit },
index add94e5c28ca05a085e7ec94c773ce84049caa0f..8f9686fdefd92bed63d1692e11f2714b94eca720 100644 (file)
@@ -476,6 +476,15 @@ enum kb_action {
        // 315
        LFUN_MATH_MACRO_ADD_GREEDY_OPTIONAL_PARAM,
        LFUN_IN_MATHMACROTEMPLATE,
+/** LFUN_SCROLL
+ * \li Action: scroll the buffer view.
+ * \li Notion: Only about scrolling up or down; do not modify the cursor.
+ * \li Syntax: scroll [TYPE] [QUANTITY]
+ * \li Params: TYPE:  line|page\n
+               QUANTITY: up|down|<number>\n
+ * \li Origin: Abdelrazak Younes, Dec 27 2007
+*/
+       LFUN_SCROLL,
        LFUN_LASTACTION                  // end of the table
 };