[Bf-blender-cvs] [4644f08] master: Fix T46998: Console zoom doesn't update scrollbars

Campbell Barton noreply at git.blender.org
Fri Dec 18 06:11:10 CET 2015


Commit: 4644f08685aac74e9173c704e74f4d6f8cbbf5e3
Author: Campbell Barton
Date:   Fri Dec 18 16:02:31 2015 +1100
Branches: master
https://developer.blender.org/rB4644f08685aac74e9173c704e74f4d6f8cbbf5e3

Fix T46998: Console zoom doesn't update scrollbars

===================================================================

M	source/blender/editors/space_console/console_intern.h
M	source/blender/editors/space_console/console_ops.c
M	source/blender/editors/space_console/space_console.c
M	source/blender/makesrna/intern/rna_space.c

===================================================================

diff --git a/source/blender/editors/space_console/console_intern.h b/source/blender/editors/space_console/console_intern.h
index d8a4a6f..5b016b7 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 92731c2..2b99c4d 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 cf235d0..182f2bd 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 ad26891..82d3310 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 */




More information about the Bf-blender-cvs mailing list