Fix T46998: Console zoom doesn't update scrollbars
authorCampbell Barton <ideasman42@gmail.com>
Fri, 18 Dec 2015 05:02:31 +0000 (16:02 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 18 Dec 2015 05:02:31 +0000 (16:02 +1100)
source/blender/editors/space_console/console_intern.h
source/blender/editors/space_console/console_ops.c
source/blender/editors/space_console/space_console.c
source/blender/makesrna/intern/rna_space.c

index d8a4a6fd2bb504235393ef69f4ff25ca0ff6597d..5b016b77e9fd528aced4966a80c8ec1039d3069e 100644 (file)
@@ -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);
index 92731c2f1357a4c200d10b540fe0ce117987391b..2b99c4dfa3deb6cd1661e934637f6fd8762ab134 100644 (file)
@@ -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;
 
index cf235d0fc02715ea9f777b95bca76f9b3b2b9051..182f2bd2e80885ed01946025d5163bc66b829463 100644 (file)
@@ -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;
+               }
        }
 }
 
index ad26891c96ae263c48edec7f4ee07d3e722a02a3..82d331042eda6442607cf8d920bb20d88b18cc76 100644 (file)
@@ -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 */