diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-06-13 12:40:32 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-06-13 12:43:10 +0300 |
commit | 0bce173bc7e9bb6d6cac099d16a8b0f4471d3f63 (patch) | |
tree | 5219725a03b9baac1e4e2b40464c13c9a6f14e6f /source | |
parent | dcf70dc1819caf08d2cedfadd568364cdf556eb8 (diff) |
UI: remove empty space at the end of headers, tweak start/end spacing.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/include/UI_interface.h | 2 | ||||
-rw-r--r-- | source/blender/editors/interface/interface.c | 2 | ||||
-rw-r--r-- | source/blender/editors/screen/area.c | 11 |
3 files changed, 9 insertions, 6 deletions
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 547cfc65c09..e90286ed624 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -906,7 +906,7 @@ void UI_exit(void); #define UI_ITEM_O_DEPRESS (1 << 9) #define UI_ITEM_R_COMPACT (1 << 10) -#define UI_HEADER_OFFSET_START ((void)0, 0.4f * UI_UNIT_X) +#define UI_HEADER_OFFSET ((void)0, 0.2f * UI_UNIT_X) /* uiLayoutOperatorButs flags */ enum { diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 811bd4457d8..d321cbbb89e 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -243,7 +243,7 @@ static void ui_update_flexible_spacing(const ARegion *region, uiBlock *block) rcti rect; ui_but_to_pixelrect(&rect, region, block, block->buttons.last); - const float buttons_width = (float)rect.xmax + UI_HEADER_OFFSET_START; + const float buttons_width = (float)rect.xmax + 2 * UI_HEADER_OFFSET; const float region_width = (float)region->sizex * U.dpi_fac; if (region_width <= buttons_width) { diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index dafd8990a6e..478afa64939 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -2193,13 +2193,12 @@ void ED_region_header_layout(const bContext *C, ARegion *ar) Header header = {NULL}; int maxco, xco, yco; int headery = ED_area_headersize(); - const int start_ofs = UI_HEADER_OFFSET_START; bool region_layout_based = ar->flag & RGN_FLAG_DYNAMIC_SIZE; /* set view2d view matrix for scrolling (without scrollers) */ UI_view2d_view_ortho(&ar->v2d); - xco = maxco = start_ofs; + xco = maxco = UI_HEADER_OFFSET; yco = headery + (ar->winy - headery) / 2 - floor(0.2f * UI_UNIT_Y); /* XXX workaround for 1 px alignment issue. Not sure what causes it... Would prefer a proper fix - Julian */ @@ -2230,7 +2229,7 @@ void ED_region_header_layout(const bContext *C, ARegion *ar) if (xco > maxco) maxco = xco; - int new_sizex = (maxco + start_ofs) / UI_DPI_FAC; + int new_sizex = (maxco + UI_HEADER_OFFSET) / UI_DPI_FAC; if (region_layout_based && (ar->sizex != new_sizex)) { /* region size is layout based and needs to be updated */ @@ -2243,8 +2242,12 @@ void ED_region_header_layout(const bContext *C, ARegion *ar) UI_block_end(C, block); } + if (!region_layout_based) { + maxco += UI_HEADER_OFFSET; + } + /* always as last */ - UI_view2d_totRect_set(&ar->v2d, maxco + (region_layout_based ? 0 : UI_UNIT_X + 80), headery); + UI_view2d_totRect_set(&ar->v2d, maxco, headery); /* restore view matrix */ UI_view2d_view_restore(C); |