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>2011-09-18 05:34:53 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-09-18 05:34:53 +0400
commit5db33d11bd569f4040fd58e4f39cf97ed94fec29 (patch)
treeed4b47e9481fc731fabeedac778af76e60816954 /source/blender/editors/space_console/console_ops.c
parent198295e9caf72e2523138817427179b44f5790d5 (diff)
Console Scrolling - reset while typing.
patch from Damir Prebeg with some edits. Also made it so resizing the console view keeps the lower part of the text in view (could be annoying when you needed to scroll because of a resized view).
Diffstat (limited to 'source/blender/editors/space_console/console_ops.c')
-rw-r--r--source/blender/editors/space_console/console_ops.c30
1 files changed, 27 insertions, 3 deletions
diff --git a/source/blender/editors/space_console/console_ops.c b/source/blender/editors/space_console/console_ops.c
index 85cf30dfeba..51e2679e8c2 100644
--- a/source/blender/editors/space_console/console_ops.c
+++ b/source/blender/editors/space_console/console_ops.c
@@ -54,6 +54,14 @@
#include "console_intern.h"
+/* so when we type - the view scrolls to the bottom */
+static void console_scroll_bottom(ARegion *ar)
+{
+ View2D *v2d= &ar->v2d;
+ v2d->cur.ymin = 0.0;
+ v2d->cur.ymax =(float)v2d->winy;
+}
+
static void console_textview_update_rect(SpaceConsole *sc, ARegion *ar)
{
View2D *v2d= &ar->v2d;
@@ -339,9 +347,14 @@ static int move_exec(bContext *C, wmOperator *op)
}
if(done) {
- ED_area_tag_redraw(CTX_wm_area(C));
+ ScrArea *sa= CTX_wm_area(C);
+ ARegion *ar= CTX_wm_region(C);
+
+ ED_area_tag_redraw(sa);
+ console_scroll_bottom(ar);
}
-
+
+
return OPERATOR_FINISHED;
}
@@ -391,7 +404,9 @@ static int insert_exec(bContext *C, wmOperator *op)
console_textview_update_rect(sc, ar);
ED_area_tag_redraw(CTX_wm_area(C));
-
+
+ console_scroll_bottom(ar);
+
return OPERATOR_FINISHED;
}
@@ -478,6 +493,8 @@ static int delete_exec(bContext *C, wmOperator *op)
console_textview_update_rect(sc, ar);
ED_area_tag_redraw(CTX_wm_area(C));
+
+ console_scroll_bottom(ar);
return OPERATOR_FINISHED;
}
@@ -589,6 +606,8 @@ static int history_cycle_exec(bContext *C, wmOperator *op)
console_textview_update_rect(sc, ar);
ED_area_tag_redraw(CTX_wm_area(C));
+ console_scroll_bottom(ar);
+
return OPERATOR_FINISHED;
}
@@ -612,6 +631,7 @@ void CONSOLE_OT_history_cycle(wmOperatorType *ot)
static int history_append_exec(bContext *C, wmOperator *op)
{
SpaceConsole *sc= CTX_wm_space_console(C);
+ ARegion *ar= CTX_wm_region(C);
ScrArea *sa= CTX_wm_area(C);
ConsoleLine *ci= console_history_verify(C);
char *str= RNA_string_get_alloc(op->ptr, "text", NULL, 0); /* own this text in the new line, dont free */
@@ -637,6 +657,8 @@ static int history_append_exec(bContext *C, wmOperator *op)
ED_area_tag_redraw(sa);
+ console_scroll_bottom(ar);
+
return OPERATOR_FINISHED;
}
@@ -825,6 +847,8 @@ static int paste_exec(bContext *C, wmOperator *UNUSED(op))
console_textview_update_rect(sc, ar);
ED_area_tag_redraw(CTX_wm_area(C));
+ console_scroll_bottom(ar);
+
return OPERATOR_FINISHED;
}