diff options
Diffstat (limited to 'source/blender')
4 files changed, 58 insertions, 2 deletions
diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c index fa4b039bb62..fcc72cba321 100644 --- a/source/blender/editors/interface/view2d_ops.c +++ b/source/blender/editors/interface/view2d_ops.c @@ -410,6 +410,11 @@ static int view_scrolldown_exec(bContext *C, wmOperator *op) RNA_int_set(op->ptr, "deltax", 0); RNA_int_set(op->ptr, "deltay", -40); + if(RNA_boolean_get(op->ptr, "page")) { + ARegion *ar= CTX_wm_region(C); + RNA_int_set(op->ptr, "deltay", ar->v2d.mask.ymin - ar->v2d.mask.ymax); + } + /* apply movement, then we're done */ view_pan_apply(op); view_pan_exit(op); @@ -430,6 +435,7 @@ void VIEW2D_OT_scroll_down(wmOperatorType *ot) /* rna - must keep these in sync with the other operators */ RNA_def_int(ot->srna, "deltax", 0, INT_MIN, INT_MAX, "Delta X", "", INT_MIN, INT_MAX); RNA_def_int(ot->srna, "deltay", 0, INT_MIN, INT_MAX, "Delta Y", "", INT_MIN, INT_MAX); + RNA_def_boolean(ot->srna, "page", 0, "Page", "Scroll down one page."); } @@ -454,6 +460,11 @@ static int view_scrollup_exec(bContext *C, wmOperator *op) RNA_int_set(op->ptr, "deltax", 0); RNA_int_set(op->ptr, "deltay", 40); + if(RNA_boolean_get(op->ptr, "page")) { + ARegion *ar= CTX_wm_region(C); + RNA_int_set(op->ptr, "deltay", ar->v2d.mask.ymax - ar->v2d.mask.ymin); + } + /* apply movement, then we're done */ view_pan_apply(op); view_pan_exit(op); @@ -474,6 +485,7 @@ void VIEW2D_OT_scroll_up(wmOperatorType *ot) /* rna - must keep these in sync with the other operators */ RNA_def_int(ot->srna, "deltax", 0, INT_MIN, INT_MAX, "Delta X", "", INT_MIN, INT_MAX); RNA_def_int(ot->srna, "deltay", 0, INT_MIN, INT_MAX, "Delta Y", "", INT_MIN, INT_MAX); + RNA_def_boolean(ot->srna, "page", 0, "Page", "Scroll up one page."); } /* ********************************************************* */ @@ -1684,8 +1696,10 @@ void UI_view2d_keymap(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "VIEW2D_OT_pan", MOUSEPAN, 0, 0, 0); WM_keymap_add_item(keymap, "VIEW2D_OT_scroll_down", WHEELDOWNMOUSE, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "VIEW2D_OT_scroll_up", WHEELUPMOUSE, KM_PRESS, 0, 0); - WM_keymap_add_item(keymap, "VIEW2D_OT_scroll_down", PAGEDOWNKEY, KM_PRESS, 0, 0); - WM_keymap_add_item(keymap, "VIEW2D_OT_scroll_up", PAGEUPKEY, KM_PRESS, 0, 0); + + RNA_boolean_set(WM_keymap_add_item(keymap, "VIEW2D_OT_scroll_down", PAGEDOWNKEY, KM_PRESS, 0, 0)->ptr, "page", 1); + RNA_boolean_set(WM_keymap_add_item(keymap, "VIEW2D_OT_scroll_up", PAGEUPKEY, KM_PRESS, 0, 0)->ptr, "page", 1); + WM_keymap_add_item(keymap, "VIEW2D_OT_zoom", MIDDLEMOUSE, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "VIEW2D_OT_zoom", MOUSEZOOM, 0, 0, 0); WM_keymap_add_item(keymap, "VIEW2D_OT_zoom_out", PADMINUS, KM_PRESS, 0, 0); diff --git a/source/blender/editors/space_outliner/outliner.c b/source/blender/editors/space_outliner/outliner.c index 354643b565c..24451912f89 100644 --- a/source/blender/editors/space_outliner/outliner.c +++ b/source/blender/editors/space_outliner/outliner.c @@ -1510,6 +1510,42 @@ static void outliner_build_tree(Main *mainvar, Scene *scene, SpaceOops *soops) /* **************** INTERACTIVE ************* */ + +static int outliner_scroll_page_exec(bContext *C, wmOperator *op) +{ + ARegion *ar= CTX_wm_region(C); + int dy= ar->v2d.mask.ymax - ar->v2d.mask.ymin; + int up= 0; + + if(RNA_boolean_get(op->ptr, "up")) + up= 1; + + if(up == 0) dy= -dy; + ar->v2d.cur.ymin+= dy; + ar->v2d.cur.ymax+= dy; + + ED_region_tag_redraw(ar); + + return OPERATOR_FINISHED; +} + + +void OUTLINER_OT_scroll_page(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Scroll Page"; + ot->idname= "OUTLINER_OT_scroll_page"; + ot->description= "Scroll page up or down"; + + /* callbacks */ + ot->exec= outliner_scroll_page_exec; + ot->poll= ED_operator_outliner_active; + + /* properties */ + RNA_def_boolean(ot->srna, "up", 0, "Up", "Scroll up one page."); +} + + static int outliner_count_levels(SpaceOops *soops, ListBase *lb, int curlevel) { TreeElement *te; diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h index 256bf3f936b..cf29bfb4371 100644 --- a/source/blender/editors/space_outliner/outliner_intern.h +++ b/source/blender/editors/space_outliner/outliner_intern.h @@ -131,6 +131,8 @@ void OUTLINER_OT_show_hierarchy(struct wmOperatorType *ot); void OUTLINER_OT_selected_toggle(struct wmOperatorType *ot); void OUTLINER_OT_expanded_toggle(struct wmOperatorType *ot); +void OUTLINER_OT_scroll_page(struct wmOperatorType *ot); + void OUTLINER_OT_renderability_toggle(struct wmOperatorType *ot); void OUTLINER_OT_selectability_toggle(struct wmOperatorType *ot); void OUTLINER_OT_visibility_toggle(struct wmOperatorType *ot); diff --git a/source/blender/editors/space_outliner/outliner_ops.c b/source/blender/editors/space_outliner/outliner_ops.c index 8b2c288e400..f7dd03ec545 100644 --- a/source/blender/editors/space_outliner/outliner_ops.c +++ b/source/blender/editors/space_outliner/outliner_ops.c @@ -56,6 +56,7 @@ void outliner_operatortypes(void) WM_operatortype_append(OUTLINER_OT_show_one_level); WM_operatortype_append(OUTLINER_OT_show_active); WM_operatortype_append(OUTLINER_OT_show_hierarchy); + WM_operatortype_append(OUTLINER_OT_scroll_page); WM_operatortype_append(OUTLINER_OT_selected_toggle); WM_operatortype_append(OUTLINER_OT_expanded_toggle); @@ -91,6 +92,9 @@ void outliner_keymap(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "OUTLINER_OT_show_active", PERIODKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "OUTLINER_OT_show_active", PADPERIOD, KM_PRESS, 0, 0); + WM_keymap_add_item(keymap, "OUTLINER_OT_scroll_page", PAGEDOWNKEY, KM_PRESS, 0, 0); + RNA_boolean_set(WM_keymap_add_item(keymap, "OUTLINER_OT_scroll_page", PAGEUPKEY, KM_PRESS, 0, 0)->ptr, "up", 1); + WM_keymap_add_item(keymap, "OUTLINER_OT_show_one_level", PADPLUSKEY, KM_PRESS, 0, 0); /* open */ RNA_boolean_set(WM_keymap_add_item(keymap, "OUTLINER_OT_show_one_level", PADMINUS, KM_PRESS, 0, 0)->ptr, "open", 0); /* close */ |