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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2011-11-20 18:31:01 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2011-11-20 18:31:01 +0400
commitd4c400b940f862f28d7af5bd7e59ce7f14025735 (patch)
tree545a9d68173a99dceaf6d783dd51db064f428b7a /source/blender/editors/interface
parent17b113c784aa30cf7ea06f0970a4427620fef4dc (diff)
UI: fix issue with part of panels going offscreen after recent commit.
The code here was tricky, with ED_region_panels trying to match the complex logic in uiAlignPanelStep, now refactored the code so it's avoided.
Diffstat (limited to 'source/blender/editors/interface')
-rw-r--r--source/blender/editors/interface/interface_panel.c39
1 files changed, 38 insertions, 1 deletions
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index ad79e550575..d66e6852f1d 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -779,6 +779,35 @@ static int uiAlignPanelStep(ScrArea *sa, ARegion *ar, float fac, int drag)
return done;
}
+static void ui_panels_size(ScrArea *sa, ARegion *ar, int *x, int *y)
+{
+ Panel *pa;
+ int align= panel_aligned(sa, ar);
+ int sizex = UI_PANEL_WIDTH;
+ int sizey = UI_PANEL_WIDTH;
+
+ /* compute size taken up by panels, for setting in view2d */
+ for(pa= ar->panels.first; pa; pa= pa->next) {
+ if(pa->runtime_flag & PNL_ACTIVE) {
+ int pa_sizex, pa_sizey;
+
+ if(align==BUT_VERTICAL) {
+ pa_sizex= pa->ofsx + pa->sizex;
+ pa_sizey= get_panel_real_ofsy(pa);
+ }
+ else {
+ pa_sizex= get_panel_real_ofsx(pa) + pa->sizex;
+ pa_sizey= pa->ofsy + get_panel_size_y(pa);
+ }
+
+ sizex= MAX2(sizex, pa_sizex);
+ sizey= MIN2(sizey, pa_sizey);
+ }
+ }
+
+ *x= sizex;
+ *y= sizey;
+}
static void ui_do_animate(const bContext *C, Panel *panel)
{
@@ -818,7 +847,7 @@ void uiBeginPanels(const bContext *UNUSED(C), ARegion *ar)
}
/* only draws blocks with panels */
-void uiEndPanels(const bContext *C, ARegion *ar)
+void uiEndPanels(const bContext *C, ARegion *ar, int *x, int *y)
{
ScrArea *sa= CTX_wm_area(C);
uiBlock *block;
@@ -871,6 +900,14 @@ void uiEndPanels(const bContext *C, ARegion *ar)
if(firstpa)
firstpa->runtime_flag |= PNL_FIRST;
+
+ /* compute size taken up by panel */
+ ui_panels_size(sa, ar, x, y);
+}
+
+void uiDrawPanels(const bContext *C, ARegion *ar)
+{
+ uiBlock *block;
UI_ThemeClearColor(TH_BACK);