Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2009-08-16 17:01:40 +0400
committerTon Roosendaal <ton@blender.org>2009-08-16 17:01:40 +0400
commitd823172d6d7121ceac9fd34d7f4a974675253706 (patch)
tree71c33f5fe1ab1d42def3eae0fc61a2710794a09c /source/blender/editors
parente3b2cdc8eab9f6077c2b32b5798a1c6810f8a030 (diff)
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.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/include/UI_interface.h1
-rw-r--r--source/blender/editors/interface/interface_layout.c5
-rw-r--r--source/blender/editors/screen/area.c16
-rw-r--r--source/blender/editors/space_view3d/view3d_header.c5
4 files changed, 21 insertions, 6 deletions
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index 7fc2d62af29..cc3b243d38d 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -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);
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index dc6d921bee1..dee486b6b93 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -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];
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index 79ba11a5c55..96ad9039dc1 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -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);
diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c
index e8a6f1b36ae..4768b66bc2a 100644
--- a/source/blender/editors/space_view3d/view3d_header.c
+++ b/source/blender/editors/space_view3d/view3d_header.c
@@ -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);