diff options
author | Ton Roosendaal <ton@blender.org> | 2012-12-26 17:05:39 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2012-12-26 17:05:39 +0400 |
commit | fa28e50ac2a79e4aa481f659b1457e99f2f17557 (patch) | |
tree | c7633940e05de1a1296aa72c9c941518c7ecddcc /source/blender/editors/interface/interface_panel.c | |
parent | 4e604642de11603ad1cff1b5b0e679e8a7c13bd9 (diff) |
Region scrollbar fix!
Now scrollbars correctly hide and show, making space for the actual contents
in a region. It solves several old hacks, and puts view2d code a bit more
back in control as well.
Implementation notes:
- The view2d mask feature is working again
- The #define V2D_SCROLL_HORIZONTAL_HIDE means: "turn on hiding".
- Code for UI_view2d_region_reinit() is enforcing better standard view settings
But... two hack/patches needed to be added:
- Region panel drawing: if after generating the button panels it appears
a scroller hides or reveils, it calls all the generating code again.
(a simple scale doesn't work due to rounding differences in layout code)
- View2d code that maps 'tot' and 'cur' rects: if this code detects that
the mask changes, it calcs the map code again.
Also a bugfix (issue in 2.65)
- The left/bottom area split widget was drawing 1 pixel too large sometimes,
leaving bad trails on moving area dividers.
Diffstat (limited to 'source/blender/editors/interface/interface_panel.c')
-rw-r--r-- | source/blender/editors/interface/interface_panel.c | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index 5b6a609e4d2..9fbf2fe8898 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -112,7 +112,7 @@ static int panel_aligned(ScrArea *sa, ARegion *ar) else if (sa->spacetype == SPACE_FILE && ar->regiontype == RGN_TYPE_CHANNELS) return BUT_VERTICAL; else if (sa->spacetype == SPACE_IMAGE && ar->regiontype == RGN_TYPE_PREVIEW) - return BUT_VERTICAL; + return BUT_VERTICAL; else if (ELEM3(ar->regiontype, RGN_TYPE_UI, RGN_TYPE_TOOLS, RGN_TYPE_TOOL_PROPS)) return BUT_VERTICAL; @@ -812,8 +812,8 @@ 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; + int sizex = 0; + int sizey = 0; /* compute size taken up by panels, for setting in view2d */ for (pa = ar->panels.first; pa; pa = pa->next) { @@ -834,6 +834,11 @@ static void ui_panels_size(ScrArea *sa, ARegion *ar, int *x, int *y) } } + if (sizex == 0) + sizex = UI_PANEL_WIDTH; + if (sizey == 0) + sizey = -UI_PANEL_WIDTH; + *x = sizex; *y = sizey; } @@ -956,6 +961,25 @@ void uiDrawPanels(const bContext *C, ARegion *ar) } } +void uiScalePanels(ARegion *ar, float new_width) +{ + uiBlock *block; + uiBut *but; + + for (block = ar->uiblocks.first; block; block = block->next) { + if (block->panel) { + float fac = new_width / (float)block->panel->sizex; + printf("scaled %f\n", fac); + block->panel->sizex = new_width; + + for (but = block->buttons.first; but; but = but->next) { + but->rect.xmin *= fac; + but->rect.xmax *= fac; + } + } + } +} + /* ------------ panel merging ---------------- */ static void check_panel_overlap(ARegion *ar, Panel *panel) |