New gift to LyX community. I've create bindings only for cua. I don't know about the others. Someone please volunteer for Mac.

Abdel.

-------- Original Message --------
Subject: r22324 - in /lyx-devel/trunk: lib/bind/cua.bind src/Buffe...
Date: Thu, 27 Dec 2007 11:37:08 -0000
From: [EMAIL PROTECTED]
Reply-To: lyx-devel@lists.lyx.org
To: [EMAIL PROTECTED]
Newsgroups: gmane.editors.lyx.cvs
Followup-To: gmane.editors.lyx.devel

Author: younes
Date: Thu Dec 27 12:37:07 2007
New Revision: 22324

URL: http://www.lyx.org/trac/changeset/22324
Log:
Introduce LFUN_SCROLL.

Santa-clauss.


Modified:
    lyx-devel/trunk/lib/bind/cua.bind
    lyx-devel/trunk/src/BufferView.cpp
    lyx-devel/trunk/src/BufferView.h
    lyx-devel/trunk/src/LyXAction.cpp
    lyx-devel/trunk/src/lfuns.h

Modified: lyx-devel/trunk/lib/bind/cua.bind
URL: http://www.lyx.org/trac/file/lyx-devel/trunk/lib/bind/cua.bind?rev=22324
==============================================================================
--- lyx-devel/trunk/lib/bind/cua.bind (original)
+++ lyx-devel/trunk/lib/bind/cua.bind Thu Dec 27 12:37:07 2007
@@ -100,6 +100,10 @@
 \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"

Modified: lyx-devel/trunk/src/BufferView.cpp
URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/BufferView.cpp?rev=22324
==============================================================================
--- lyx-devel/trunk/src/BufferView.cpp (original)
+++ lyx-devel/trunk/src/BufferView.cpp Thu Dec 27 12:37:07 2007
@@ -830,6 +830,7 @@

        case LFUN_SCREEN_UP:
        case LFUN_SCREEN_DOWN:
+       case LFUN_SCROLL:
                flag.enabled(true);
                break;

@@ -1218,6 +1219,10 @@
                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.
@@ -1405,6 +1410,27 @@
                // an update is asked,
                && cur.result().update())
                processUpdateFlags(cur.result().update());
+}
+
+
+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);
+       }
 }



Modified: lyx-devel/trunk/src/BufferView.h
URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/BufferView.h?rev=22324
==============================================================================
--- lyx-devel/trunk/src/BufferView.h (original)
+++ lyx-devel/trunk/src/BufferView.h Thu Dec 27 12:37:07 2007
@@ -134,6 +134,8 @@
/// 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.

Modified: lyx-devel/trunk/src/LyXAction.cpp
URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/LyXAction.cpp?rev=22324
==============================================================================
--- lyx-devel/trunk/src/LyXAction.cpp (original)
+++ lyx-devel/trunk/src/LyXAction.cpp Thu Dec 27 12:37:07 2007
@@ -276,6 +276,7 @@
                { 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 },

Modified: lyx-devel/trunk/src/lfuns.h
URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/lfuns.h?rev=22324
==============================================================================
--- lyx-devel/trunk/src/lfuns.h (original)
+++ lyx-devel/trunk/src/lfuns.h Thu Dec 27 12:37:07 2007
@@ -476,6 +476,15 @@
        // 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
 };




Reply via email to