2.5
authorTon Roosendaal <ton@blender.org>
Sun, 16 Aug 2009 13:01:40 +0000 (13:01 +0000)
committerTon Roosendaal <ton@blender.org>
Sun, 16 Aug 2009 13:01:40 +0000 (13:01 +0000)
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.

source/blender/editors/include/UI_interface.h
source/blender/editors/interface/interface_layout.c
source/blender/editors/screen/area.c
source/blender/editors/space_view3d/view3d_header.c

index 7fc2d62af29edcedbb1003ed28e7b082c4a06d33..cc3b243d38d37e60bef25c6a699d37af5bd81158 100644 (file)
@@ -608,6 +608,7 @@ int uiLayoutGetEnabled(uiLayout *layout);
 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);
index dc6d921bee15087c74b9670530b1e30756d8c36c..dee486b6b93379f95e0bdd5f9cf2830803626bd2 100644 (file)
@@ -1973,6 +1973,11 @@ int uiLayoutGetAlignment(uiLayout *layout)
        return layout->alignment;
 }
 
+int uiLayoutGetWidth(uiLayout *layout)
+{
+       return layout->w;
+}
+
 float uiLayoutGetScaleX(uiLayout *layout)
 {
        return layout->scale[0];
index 79ba11a5c55269e472e6a6d881765342ec5c940d..96ad9039dc1044341893ef3eea3dc402f9dbe820 100644 (file)
@@ -1309,7 +1309,7 @@ void ED_region_header(const bContext *C, ARegion *ar)
        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 @@ void ED_region_header(const bContext *C, ARegion *ar)
        /* 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 @@ void ED_region_header(const bContext *C, ARegion *ar)
                        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);
index e8a6f1b36ae29f4447ffdade4f1d6716f0a5ab33..4768b66bc2a69ee79fb8bd8e31b566b06cb93688 100644 (file)
@@ -3809,9 +3809,8 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
 
                }
        }
-
-       /* 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);