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>2012-10-31 15:31:30 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2012-10-31 15:31:30 +0400
commit3406586d8829c60a420b26977e160ab53b26a833 (patch)
tree487c69d97098e6c3e09f6d5afff61e9cc39563fe /source/blender/editors/interface/interface_regions.c
parentebdc9056af48279884c3d014821cb4f75738beed (diff)
UI: fix for menu scrolling when window is too small. It was not working well
with arbitrary button layouts like multi column menus, because it was making assumptions about position of previous/next buttons which doesn't work in general.
Diffstat (limited to 'source/blender/editors/interface/interface_regions.c')
-rw-r--r--source/blender/editors/interface/interface_regions.c30
1 files changed, 13 insertions, 17 deletions
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index f522af51c42..c0a8f6582f6 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -1570,8 +1570,6 @@ static void ui_popup_block_clip(wmWindow *window, uiBlock *block)
void ui_popup_block_scrolltest(uiBlock *block)
{
uiBut *bt;
- /* Knowing direction is necessary for multi-column menus... */
- int is_flip = (block->direction & UI_TOP) && !(block->flag & UI_BLOCK_NO_FLIP);
block->flag &= ~(UI_BLOCK_CLIPBOTTOM | UI_BLOCK_CLIPTOP);
@@ -1581,29 +1579,27 @@ void ui_popup_block_scrolltest(uiBlock *block)
if (block->buttons.first == block->buttons.last)
return;
- /* mark buttons that are outside boundary and the ones next to it for arrow(s) */
+ /* mark buttons that are outside boundary */
for (bt = block->buttons.first; bt; bt = bt->next) {
if (bt->rect.ymin < block->rect.ymin) {
bt->flag |= UI_SCROLLED;
block->flag |= UI_BLOCK_CLIPBOTTOM;
- /* make space for arrow */
- if (bt->rect.ymax < block->rect.ymin + 10) {
- if (is_flip && bt->next && bt->next->rect.ymin > bt->rect.ymin)
- bt->next->flag |= UI_SCROLLED;
- else if (!is_flip && bt->prev && bt->prev->rect.ymin > bt->rect.ymin)
- bt->prev->flag |= UI_SCROLLED;
- }
}
if (bt->rect.ymax > block->rect.ymax) {
bt->flag |= UI_SCROLLED;
block->flag |= UI_BLOCK_CLIPTOP;
- /* make space for arrow */
- if (bt->rect.ymin > block->rect.ymax - 10) {
- if (!is_flip && bt->next && bt->next->rect.ymax < bt->rect.ymax)
- bt->next->flag |= UI_SCROLLED;
- else if (is_flip && bt->prev && bt->prev->rect.ymax < bt->rect.ymax)
- bt->prev->flag |= UI_SCROLLED;
- }
+ }
+ }
+
+ /* mark buttons overlapping arrows, if we have them */
+ for (bt = block->buttons.first; bt; bt = bt->next) {
+ if(block->flag & UI_BLOCK_CLIPBOTTOM) {
+ if (bt->rect.ymin < block->rect.ymin + 12)
+ bt->flag |= UI_SCROLLED;
+ }
+ if(block->flag & UI_BLOCK_CLIPTOP) {
+ if (bt->rect.ymax > block->rect.ymax - 12)
+ bt->flag |= UI_SCROLLED;
}
}
}