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:
authorPablo Vazquez <pablo@blender.org>2021-08-28 03:21:07 +0300
committerPablo Vazquez <pablo@blender.org>2021-08-28 03:21:07 +0300
commit870404455bb74ef0c1eb9bdd504be919d95f54c7 (patch)
treed546e988f9d7672f4b60c3a470b1dfe683433c7e /source/blender/editors/screen
parent323997ace3911d1a8d6888d303345075d2d29948 (diff)
UI: Add margin to panels
Add some breathing space between the panel boundaries and properties/regions. Make use of the style->panelouter property that hasn't been used in a while. Also slight tweaks to boxspace and templatespace style properties so they are multiples of 2 and operations on them round better.
Diffstat (limited to 'source/blender/editors/screen')
-rw-r--r--source/blender/editors/screen/area.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index e08a4e946f6..aba43ddc1a3 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -2720,6 +2720,10 @@ static void ed_panel_draw(const bContext *C,
if (open || search_filter_active) {
short panelContext;
+ /* Extra offset and panel width adjustment to accomodate sides margin (style->panelouter). */
+ const int xofs = (pt->flag & PANEL_TYPE_NO_HEADER) ? 0 : style->panelouter;
+ const int wofs = (pt->flag & PANEL_TYPE_NO_HEADER) ? style->panelouter : 0;
+
/* panel context can either be toolbar region or normal panels region */
if (pt->flag & PANEL_TYPE_LAYOUT_VERT_BAR) {
panelContext = UI_LAYOUT_VERT_BAR;
@@ -2735,9 +2739,9 @@ static void ed_panel_draw(const bContext *C,
block,
UI_LAYOUT_VERTICAL,
panelContext,
- (pt->flag & PANEL_TYPE_LAYOUT_VERT_BAR) ? 0 : style->panelspace,
+ (pt->flag & PANEL_TYPE_LAYOUT_VERT_BAR) ? 0 : style->panelspace + xofs,
0,
- (pt->flag & PANEL_TYPE_LAYOUT_VERT_BAR) ? 0 : w - 2 * style->panelspace,
+ (pt->flag & PANEL_TYPE_LAYOUT_VERT_BAR) ? 0 : (w - 2 * style->panelspace + wofs - xofs),
em,
0,
style);
@@ -2877,12 +2881,13 @@ void ED_region_panels_layout_ex(const bContext *C,
ScrArea *area = CTX_wm_area(C);
View2D *v2d = &region->v2d;
+ const uiStyle *style = UI_style_get_dpi();
bool use_category_tabs = (category_override == NULL) && region_uses_category_tabs(area, region);
/* offset panels for small vertical tab area */
const char *category = NULL;
const int category_tabs_width = UI_PANEL_CATEGORY_MARGIN_WIDTH;
- int margin_x = 0;
+ int margin_x = style->panelouter;
const bool region_layout_based = region->flag & RGN_FLAG_DYNAMIC_SIZE;
bool update_tot_size = true;
@@ -2897,7 +2902,7 @@ void ED_region_panels_layout_ex(const bContext *C,
category = region_panels_collect_categories(region, panel_types_stack, &use_category_tabs);
}
if (use_category_tabs) {
- margin_x = category_tabs_width;
+ margin_x = category_tabs_width + style->panelouter;
}
const int w = BLI_rctf_size_x(&v2d->cur) - margin_x;