middle mouse jump scrolling for text window.
authorCampbell Barton <ideasman42@gmail.com>
Mon, 16 Jan 2012 10:48:52 +0000 (10:48 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 16 Jan 2012 10:48:52 +0000 (10:48 +0000)
source/blender/editors/space_text/space_text.c
source/blender/editors/space_text/text_ops.c
source/blender/python/mathutils/mathutils_Matrix.c

index 23d1238..441a5ea 100644 (file)
@@ -357,9 +357,11 @@ static void text_keymap(struct wmKeyConfig *keyconf)
        
        WM_keymap_add_item(keymap, "TEXT_OT_overwrite_toggle", INSERTKEY, KM_PRESS, 0, 0);
 
+       WM_keymap_add_item(keymap, "TEXT_OT_scroll_bar", LEFTMOUSE, KM_PRESS, 0, 0);
+       WM_keymap_add_item(keymap, "TEXT_OT_scroll_bar", MIDDLEMOUSE, KM_PRESS, 0, 0);
+
        WM_keymap_add_item(keymap, "TEXT_OT_scroll", MIDDLEMOUSE, KM_PRESS, 0, 0);
        WM_keymap_add_item(keymap, "TEXT_OT_scroll", MOUSEPAN, 0, 0, 0);
-       WM_keymap_add_item(keymap, "TEXT_OT_scroll_bar", LEFTMOUSE, KM_PRESS, 0, 0);
        WM_keymap_add_item(keymap, "TEXT_OT_selection_set", EVT_TWEAK_L, KM_ANY, 0, 0);
        WM_keymap_add_item(keymap, "TEXT_OT_cursor_set", LEFTMOUSE, KM_PRESS, 0, 0);
        RNA_boolean_set(WM_keymap_add_item(keymap, "TEXT_OT_selection_set", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "select", 1);
index e8ad6e1..19f0c9b 100644 (file)
@@ -2232,8 +2232,8 @@ static int text_scroll_invoke(bContext *C, wmOperator *op, wmEvent *event)
                text_scroll_apply(C, op, event);
                scroll_exit(C, op);
                return OPERATOR_FINISHED;
-       }       
-       
+       }
+
        WM_event_add_modal_handler(C, op);
        
        return OPERATOR_RUNNING_MODAL;
@@ -2314,9 +2314,20 @@ static int text_scroll_bar_invoke(bContext *C, wmOperator *op, wmEvent *event)
        tsc->scrollbar= 1;
        tsc->zone= zone;
        op->customdata= tsc;
-       
        st->flags|= ST_SCROLL_SELECT;
 
+       /* jump scroll, works in v2d but needs to be added here too :S */
+       if (event->type == MIDDLEMOUSE) {
+               tsc->old[0] = ar->winrct.xmin + (st->txtbar.xmax + st->txtbar.xmin) / 2;
+               tsc->old[1] = ar->winrct.ymin + (st->txtbar.ymax + st->txtbar.ymin) / 2;
+
+               tsc->delta[0] = 0;
+               tsc->delta[1] = 0;
+               tsc->first = 0;
+               tsc->zone= SCROLLHANDLE_BAR;
+               text_scroll_apply(C, op, event);
+       }
+
        WM_event_add_modal_handler(C, op);
 
        return OPERATOR_RUNNING_MODAL;
index e588389..7fe4b5b 100644 (file)
@@ -1939,13 +1939,6 @@ static PyObject *Matrix_mul(PyObject *m1, PyObject *m2)
                     Py_TYPE(m1)->tp_name, Py_TYPE(m2)->tp_name);
        return NULL;
 }
-static PyObject *Matrix_inv(MatrixObject *self)
-{
-       if (BaseMath_ReadCallback(self) == -1)
-               return NULL;
-
-       return Matrix_invert(self);
-}
 
 /*-----------------PROTOCOL DECLARATIONS--------------------------*/
 static PySequenceMethods Matrix_SeqMethods = {