Reviewers: bf-codereview_blender.org, bf-committers_blender.org,

Description:
Problem:
If one scrolls console up, and starts to type, input line isn't visible
untill one scrolls console manually dowb.

This patch solves the problem and returns console input line on keyboard
press or paste.

Please review this at http://codereview.appspot.com/5036048/

Affected files:
   source/blender/editors/interface/view2d_ops.c
   source/blender/editors/space_console/console_intern.h
   source/blender/editors/space_console/console_ops.c


Index: source/blender/editors/interface/view2d_ops.c
===================================================================
--- source/blender/editors/interface/view2d_ops.c       (revision 40290)
+++ source/blender/editors/interface/view2d_ops.c       (working copy)
@@ -423,6 +423,11 @@
                ARegion *ar= CTX_wm_region(C);
                RNA_int_set(op->ptr, "deltay", ar->v2d.mask.ymin - 
ar->v2d.mask.ymax);
        }
+
+       if(RNA_boolean_get(op->ptr, "bottom")) {
+               ARegion *ar= CTX_wm_region(C);
+               RNA_int_set(op->ptr, "deltay", -ar->v2d.tot.ymax);
+       }
        
        /* apply movement, then we're done */
        view_pan_apply(op);
@@ -445,6 +450,7 @@
        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.");
+       RNA_def_boolean(ot->srna, "bottom", 0, "Bottom", "Scroll down to the  
bottom");
  }


@@ -474,6 +480,12 @@
                RNA_int_set(op->ptr, "deltay", ar->v2d.mask.ymax - 
ar->v2d.mask.ymin);
        }
        
+       //Scroll region to top. Currently unused but prepared for some future 
use
+       if(RNA_boolean_get(op->ptr, "top")) {
+               ARegion *ar= CTX_wm_region(C);
+               RNA_int_set(op->ptr, "deltay", ar->v2d.tot.ymax);
+       }
+       
        /* apply movement, then we're done */
        view_pan_apply(op);
        view_pan_exit(op);
@@ -495,6 +507,8 @@
        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.");
+       //Scroll region to top. Currently unused but prepared for some future 
use
+       RNA_def_boolean(ot->srna, "top", 0, "Top", "Scroll up to the top");
  }

  /* ********************************************************* */
Index: source/blender/editors/space_console/console_intern.h
===================================================================
--- source/blender/editors/space_console/console_intern.h       (revision 40290)
+++ source/blender/editors/space_console/console_intern.h       (working copy)
@@ -54,6 +54,7 @@

  int console_report_mask(SpaceConsole *sc);

+void console_scroll_bottom(struct bContext *C);

  void CONSOLE_OT_move(struct wmOperatorType *ot);
  void CONSOLE_OT_delete(struct wmOperatorType *ot);
Index: source/blender/editors/space_console/console_ops.c
===================================================================
--- source/blender/editors/space_console/console_ops.c  (revision 40290)
+++ source/blender/editors/space_console/console_ops.c  (working copy)
@@ -285,6 +285,15 @@
        {NEXT_WORD, "NEXT_WORD", 0, "Next Word", ""},
        {0, NULL, 0, NULL, NULL}};

+void console_scroll_bottom(bContext *C){
+               PointerRNA ptr;
+
+               WM_operator_properties_create(&ptr, "VIEW2D_OT_scroll_down");
+               RNA_boolean_set(&ptr, "bottom", 1);
+               WM_operator_name_call(C, "VIEW2D_OT_scroll_down", 
WM_OP_EXEC_DEFAULT,  
&ptr);
+               WM_operator_properties_free(&ptr);
+}
+
  static int move_exec(bContext *C, wmOperator *op)
  {
        ConsoleLine *ci= console_history_verify(C);
@@ -342,6 +351,8 @@
                ED_area_tag_redraw(CTX_wm_area(C));
        }
        
+       console_scroll_bottom(C);
+       
        return OPERATOR_FINISHED;
  }

@@ -392,6 +403,8 @@
        console_textview_update_rect(sc, ar);
        ED_area_tag_redraw(CTX_wm_area(C));
        
+       console_scroll_bottom(C);
+       
        return OPERATOR_FINISHED;
  }

@@ -479,6 +492,8 @@
        console_textview_update_rect(sc, ar);
        ED_area_tag_redraw(CTX_wm_area(C));
        
+       console_scroll_bottom(C);
+
        return OPERATOR_FINISHED;
  }

@@ -588,6 +603,8 @@
        /* could be wrapped so update scroll rect */
        console_textview_update_rect(sc, ar);
        ED_area_tag_redraw(CTX_wm_area(C));
+       
+       console_scroll_bottom(C);

        return OPERATOR_FINISHED;
  }
@@ -682,6 +699,8 @@
        }

        ED_area_tag_redraw(CTX_wm_area(C));
+
+       console_scroll_bottom(C);
        
        return OPERATOR_FINISHED;
  }
@@ -824,6 +843,8 @@

        console_textview_update_rect(sc, ar);
        ED_area_tag_redraw(CTX_wm_area(C));
+       
+       console_scroll_bottom(C);

        return OPERATOR_FINISHED;
  }


_______________________________________________
Bf-committers mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-committers

Reply via email to