diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-12-18 08:02:31 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-12-18 08:02:31 +0300 |
commit | 4644f08685aac74e9173c704e74f4d6f8cbbf5e3 (patch) | |
tree | 6b6be2dc0ec17b44a132969ad0e0207b44a99d48 | |
parent | df6264f528ea589fc2d09d70a0e65e47f3cb2ae7 (diff) |
Fix T46998: Console zoom doesn't update scrollbars
4 files changed, 25 insertions, 5 deletions
diff --git a/source/blender/editors/space_console/console_intern.h b/source/blender/editors/space_console/console_intern.h index d8a4a6fd2bb..5b016b77e9f 100644 --- a/source/blender/editors/space_console/console_intern.h +++ b/source/blender/editors/space_console/console_intern.h @@ -49,6 +49,8 @@ ConsoleLine *console_scrollback_add_str(struct SpaceConsole *sc, char *str, bool ConsoleLine *console_history_verify(const struct bContext *C); +void console_textview_update_rect(SpaceConsole *sc, ARegion *ar); + void CONSOLE_OT_move(struct wmOperatorType *ot); void CONSOLE_OT_delete(struct wmOperatorType *ot); void CONSOLE_OT_insert(struct wmOperatorType *ot); diff --git a/source/blender/editors/space_console/console_ops.c b/source/blender/editors/space_console/console_ops.c index 92731c2f135..2b99c4dfa3d 100644 --- a/source/blender/editors/space_console/console_ops.c +++ b/source/blender/editors/space_console/console_ops.c @@ -63,7 +63,7 @@ static void console_scroll_bottom(ARegion *ar) v2d->cur.ymax = (float)v2d->winy; } -static void console_textview_update_rect(SpaceConsole *sc, ARegion *ar) +void console_textview_update_rect(SpaceConsole *sc, ARegion *ar) { View2D *v2d = &ar->v2d; diff --git a/source/blender/editors/space_console/space_console.c b/source/blender/editors/space_console/space_console.c index cf235d0fc02..182f2bd2e80 100644 --- a/source/blender/editors/space_console/space_console.c +++ b/source/blender/editors/space_console/space_console.c @@ -372,17 +372,29 @@ static void console_header_region_draw(const bContext *C, ARegion *ar) ED_region_header(C, ar); } -static void console_main_region_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), ARegion *ar, wmNotifier *wmn) +static void console_main_region_listener(bScreen *UNUSED(sc), ScrArea *sa, ARegion *ar, wmNotifier *wmn) { // SpaceInfo *sinfo = sa->spacedata.first; /* context changes */ switch (wmn->category) { case NC_SPACE: - if (wmn->data == ND_SPACE_CONSOLE) { /* generic redraw request */ - ED_region_tag_redraw(ar); + { + if (wmn->data == ND_SPACE_CONSOLE) { + if (wmn->action == NA_EDITED) { + if ((wmn->reference && sa) && (wmn->reference == sa->spacedata.first)) { + /* we've modified the geometry (font size), re-calculate rect */ + console_textview_update_rect(wmn->reference, ar); + ED_region_tag_redraw(ar); + } + } + else { + /* generic redraw request */ + ED_region_tag_redraw(ar); + } } break; + } } } diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index ad26891c96a..82d331042ed 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -1353,6 +1353,12 @@ static int rna_SpaceGraphEditor_has_ghost_curves_get(PointerRNA *ptr) return (BLI_listbase_is_empty(&sipo->ghostCurves) == false); } +static void rna_SpaceConsole_rect_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) +{ + SpaceConsole *sc = ptr->data; + WM_main_add_notifier(NC_SPACE | ND_SPACE_CONSOLE | NA_EDITED, sc); +} + static void rna_Sequencer_view_type_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { ScrArea *sa = rna_area_from_space(ptr); @@ -3713,7 +3719,7 @@ static void rna_def_space_console(BlenderRNA *brna) RNA_def_property_int_sdna(prop, NULL, "lheight"); RNA_def_property_range(prop, 8, 32); RNA_def_property_ui_text(prop, "Font Size", "Font size to use for displaying the text"); - RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CONSOLE, NULL); + RNA_def_property_update(prop, 0, "rna_SpaceConsole_rect_update"); prop = RNA_def_property(srna, "select_start", PROP_INT, PROP_UNSIGNED); /* copied from text editor */ |