Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-01-16 14:48:52 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-01-16 14:48:52 +0400
commit3123ad12a395031a1bf5a964582762a3831e9b1c (patch)
treecd5c4a013a061fab0310c7e833009cc7b391910d /source/blender/editors/space_text
parentdb2a453f32f1c7ee5317f199a198c9d070fb4a06 (diff)
middle mouse jump scrolling for text window.
Diffstat (limited to 'source/blender/editors/space_text')
-rw-r--r--source/blender/editors/space_text/space_text.c4
-rw-r--r--source/blender/editors/space_text/text_ops.c17
2 files changed, 17 insertions, 4 deletions
diff --git a/source/blender/editors/space_text/space_text.c b/source/blender/editors/space_text/space_text.c
index 23d12385625..441a5eab976 100644
--- a/source/blender/editors/space_text/space_text.c
+++ b/source/blender/editors/space_text/space_text.c
@@ -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);
diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c
index e8ad6e19fd4..19f0c9bba61 100644
--- a/source/blender/editors/space_text/text_ops.c
+++ b/source/blender/editors/space_text/text_ops.c
@@ -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;