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@gmail.com>2014-01-17 03:23:00 +0400
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2014-01-17 20:06:11 +0400
commit8b6b42b694322c374f4cc9eebd3760b742826eca (patch)
treebae4917614f2c3e1c02c02e7dc6216a16712fa6c /source/blender/editors/interface/interface_layout.c
parentac74718e6f525429165664bcf30be5ff8db59581 (diff)
UI: tweak menu padding and make separator line more visible.
Adds some padding to the left of the icon, adds more space around the separator line and make it more visible, and add some spacing at the top and bottom of the menu. Ref T37794 Reviewed By: dingto, billrey Differential Revision: https://developer.blender.org/D223
Diffstat (limited to 'source/blender/editors/interface/interface_layout.c')
-rw-r--r--source/blender/editors/interface/interface_layout.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index c884235c219..34c124b293e 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -83,6 +83,7 @@ typedef struct uiLayoutRoot {
int opcontext;
int emw, emh;
+ int padding;
uiMenuHandleFunc handlefunc;
void *argv;
@@ -1751,9 +1752,11 @@ void uiItemV(uiLayout *layout, const char *name, int icon, int argval)
void uiItemS(uiLayout *layout)
{
uiBlock *block = layout->root->block;
+ bool is_menu = ui_block_is_menu(block);
+ int space = (is_menu) ? 0.45f * UI_UNIT_X : 0.3f * UI_UNIT_X;
uiBlockSetCurLayout(block, layout);
- uiDefBut(block, SEPR, 0, "", 0, 0, 0.3f * UI_UNIT_X, 0.3f * UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
+ uiDefBut(block, (is_menu) ? SEPRLINE : SEPR, 0, "", 0, 0, space, space, NULL, 0.0, 0.0, 0, 0, "");
}
/* level items */
@@ -2851,7 +2854,20 @@ static void ui_layout_free(uiLayout *layout)
MEM_freeN(layout);
}
-uiLayout *uiBlockLayout(uiBlock *block, int dir, int type, int x, int y, int size, int em, uiStyle *style)
+static void ui_layout_add_padding_button(uiLayoutRoot *root)
+{
+ if (root->padding) {
+ /* add an invisible button for padding */
+ uiBlock *block = root->block;
+ uiLayout *prev_layout = block->curlayout;
+
+ block->curlayout = root->layout;
+ uiDefBut(block, SEPR, 0, "", 0, 0, root->padding, root->padding, NULL, 0.0, 0.0, 0, 0, "");
+ block->curlayout = prev_layout;
+ }
+}
+
+uiLayout *uiBlockLayout(uiBlock *block, int dir, int type, int x, int y, int size, int em, int padding, uiStyle *style)
{
uiLayout *layout;
uiLayoutRoot *root;
@@ -2860,6 +2876,7 @@ uiLayout *uiBlockLayout(uiBlock *block, int dir, int type, int x, int y, int siz
root->type = type;
root->style = style;
root->block = block;
+ root->padding = padding;
root->opcontext = WM_OP_INVOKE_REGION_WIN;
layout = MEM_callocN(sizeof(uiLayout), "uiLayout");
@@ -2888,6 +2905,8 @@ uiLayout *uiBlockLayout(uiBlock *block, int dir, int type, int x, int y, int siz
block->curlayout = layout;
root->layout = layout;
BLI_addtail(&block->layouts, root);
+
+ ui_layout_add_padding_button(root);
return layout;
}
@@ -2944,6 +2963,8 @@ void uiBlockLayoutResolve(uiBlock *block, int *x, int *y)
block->curlayout = NULL;
for (root = block->layouts.first; root; root = root->next) {
+ ui_layout_add_padding_button(root);
+
/* NULL in advance so we don't interfere when adding button */
ui_layout_end(block, root->layout, x, y);
ui_layout_free(root->layout);