[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [22512] branches/blender2.5/blender/source /blender/editors: 2.5

Ton Roosendaal ton at blender.org
Sun Aug 16 15:01:40 CEST 2009


Revision: 22512
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=22512
Author:   ton
Date:     2009-08-16 15:01:40 +0200 (Sun, 16 Aug 2009)

Log Message:
-----------
2.5

Flaw in python UI for headers: code missing to correctly set the total
width of header, plus obsolete call in view3d header template to set width.

Now MMB scroll of view3d header works again.

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/editors/include/UI_interface.h
    branches/blender2.5/blender/source/blender/editors/interface/interface_layout.c
    branches/blender2.5/blender/source/blender/editors/screen/area.c
    branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_header.c

Modified: branches/blender2.5/blender/source/blender/editors/include/UI_interface.h
===================================================================
--- branches/blender2.5/blender/source/blender/editors/include/UI_interface.h	2009-08-16 12:52:57 UTC (rev 22511)
+++ branches/blender2.5/blender/source/blender/editors/include/UI_interface.h	2009-08-16 13:01:40 UTC (rev 22512)
@@ -608,6 +608,7 @@
 int uiLayoutGetRedAlert(uiLayout *layout);
 int uiLayoutGetAlignment(uiLayout *layout);
 int uiLayoutGetKeepAspect(uiLayout *layout);
+int uiLayoutGetWidth(uiLayout *layout);
 float uiLayoutGetScaleX(uiLayout *layout);
 float uiLayoutGetScaleY(uiLayout *layout);
 ListBase *uiLayoutBoxGetList(uiLayout *layout);

Modified: branches/blender2.5/blender/source/blender/editors/interface/interface_layout.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/interface/interface_layout.c	2009-08-16 12:52:57 UTC (rev 22511)
+++ branches/blender2.5/blender/source/blender/editors/interface/interface_layout.c	2009-08-16 13:01:40 UTC (rev 22512)
@@ -1973,6 +1973,11 @@
 	return layout->alignment;
 }
 
+int uiLayoutGetWidth(uiLayout *layout)
+{
+	return layout->w;
+}
+
 float uiLayoutGetScaleX(uiLayout *layout)
 {
 	return layout->scale[0];

Modified: branches/blender2.5/blender/source/blender/editors/screen/area.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/screen/area.c	2009-08-16 12:52:57 UTC (rev 22511)
+++ branches/blender2.5/blender/source/blender/editors/screen/area.c	2009-08-16 13:01:40 UTC (rev 22512)
@@ -1309,7 +1309,7 @@
 	HeaderType *ht;
 	Header header = {0};
 	float col[3];
-	int xco, yco;
+	int maxco, xco, yco;
 
 	/* clear */
 	if(ED_screen_area_active(C))
@@ -1323,7 +1323,7 @@
 	/* set view2d view matrix for scrolling (without scrollers) */
 	UI_view2d_view_ortho(C, &ar->v2d);
 
-	xco= 8;
+	xco= maxco= 8;
 	yco= HEADERY-3;
 
 	/* draw all headers types */
@@ -1335,15 +1335,25 @@
 			header.type= ht;
 			header.layout= layout;
 			ht->draw(C, &header);
+			
+			/* for view2d */
+			xco= uiLayoutGetWidth(layout);
+			if(xco > maxco)
+				maxco= xco;
 		}
 
 		uiBlockLayoutResolve(C, block, &xco, &yco);
+		
+		/* for view2d */
+		if(xco > maxco)
+			maxco= xco;
+		
 		uiEndBlock(C, block);
 		uiDrawBlock(C, block);
 	}
 
 	/* always as last  */
-	UI_view2d_totRect_set(&ar->v2d, xco+XIC+80, ar->v2d.tot.ymax-ar->v2d.tot.ymin);
+	UI_view2d_totRect_set(&ar->v2d, maxco+XIC+80, ar->v2d.tot.ymax-ar->v2d.tot.ymin);
 
 	/* restore view matrix? */
 	UI_view2d_view_restore(C);

Modified: branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_header.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_header.c	2009-08-16 12:52:57 UTC (rev 22511)
+++ branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_header.c	2009-08-16 13:01:40 UTC (rev 22512)
@@ -3809,10 +3809,9 @@
 
 		}
 	}
-
-	/* always as last  */
-	UI_view2d_totRect_set(&ar->v2d, maxco+XIC+80, ar->v2d.tot.ymax-ar->v2d.tot.ymin);
 	
+	/* do not do view2d totrect set here, it's now a template */
+	
 	uiEndBlock(C, block);
 	uiDrawBlock(C, block);
 }





More information about the Bf-blender-cvs mailing list