diff options
author | Severin <eiseljulian@gmail.com> | 2018-06-30 17:51:31 +0300 |
---|---|---|
committer | Severin <eiseljulian@gmail.com> | 2018-06-30 18:01:03 +0300 |
commit | b08fa7a6d981d8fa28a03a288b89bba909fb5092 (patch) | |
tree | ea722c86bef632ce91fccc9108ee4f371105e008 /source | |
parent | eb47ac45698fff46bf3cfb26f16223ff49ccf1d0 (diff) |
UI: Support status-bar hiding
Just like the top-bar, the status-bar can now be hidden/collapsed by dragging
its edge. We display a small line with the editor outline color then, so there
is something that can be dragged up to un-collapse the area again.
This collapsed state is not written to files yet.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/screen/area.c | 20 | ||||
-rw-r--r-- | source/blender/editors/screen/screen_edit.c | 2 | ||||
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 14 |
3 files changed, 29 insertions, 7 deletions
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index e96580855d3..207047c2ad3 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -421,6 +421,17 @@ void ED_area_do_msg_notify_tag_refresh( ED_area_tag_refresh(sa); } +/** + * Although there's no general support for minimizing areas, the status-bar can + * be snapped to be only a few pixels high. A few pixels rather than 0 so it + * can be un-minimized again. We consider it pseudo-minimalized and don't draw + * it then. + */ +static bool area_is_pseudo_minimized(const ScrArea *area) +{ + return (area->winx < 3) || (area->winy < 3); +} + /* only exported for WM */ void ED_region_do_layout(bContext *C, ARegion *ar) { @@ -432,7 +443,7 @@ void ED_region_do_layout(bContext *C, ARegion *ar) return; } - if (at->do_lock) { + if (at->do_lock || (sa && area_is_pseudo_minimized(sa))) { return; } @@ -462,8 +473,13 @@ void ED_region_do_draw(bContext *C, ARegion *ar) UI_SetTheme(sa ? sa->spacetype : 0, at->regionid); + if (sa && area_is_pseudo_minimized(sa)) { + UI_ThemeClearColor(TH_EDITOR_OUTLINE); + glClear(GL_COLOR_BUFFER_BIT); + return; + } /* optional header info instead? */ - if (ar->headerstr) { + else if (ar->headerstr) { UI_ThemeClearColor(TH_HEADER); glClear(GL_COLOR_BUFFER_BIT); diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index 1b2908104f5..6bc8a6c10cf 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -787,7 +787,7 @@ static void screen_global_statusbar_area_create(wmWindow *win) BLI_rcti_init(&rect, 0, WM_window_pixels_x(win) - 1, 0, WM_window_pixels_y(win) - 1); rect.ymax = rect.ymin + size_y; - screen_global_area_create(win, SPACE_STATUSBAR, GLOBAL_AREA_ALIGN_BOTTOM, &rect, size_y, size_y, size_y); + screen_global_area_create(win, SPACE_STATUSBAR, GLOBAL_AREA_ALIGN_BOTTOM, &rect, size_y, 0, size_y); } void ED_screen_global_areas_create(wmWindow *win) diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 0c124f6c9a4..ad64018929c 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -1235,8 +1235,11 @@ static void area_move_set_limits( if (use_bigger_smaller_snap != NULL) { *use_bigger_smaller_snap = false; for (ScrArea *area = win->global_areas.areabase.first; area; area = area->next) { - const int size_min = ED_area_global_min_size_y(area) - 1; - const int size_max = ED_area_global_max_size_y(area) - 1; + int size_min = ED_area_global_min_size_y(area) - 1; + int size_max = ED_area_global_max_size_y(area) - 1; + + size_min = MAX2(size_min, 0); + BLI_assert(size_min < size_max); /* logic here is only tested for lower edge :) */ /* left edge */ @@ -1412,7 +1415,8 @@ static int area_snap_calc_location( break; } - BLI_assert(IN_RANGE_INCL(final_loc, origval - smaller, origval + bigger)); + BLI_assert(ELEM(snap_type, SNAP_BIGGER_SMALLER_ONLY) || + IN_RANGE_INCL(final_loc, origval - smaller, origval + bigger)); return final_loc; } @@ -1429,7 +1433,9 @@ static void area_move_apply_do( short final_loc = -1; bool doredraw = false; - CLAMP(delta, -smaller, bigger); + if (snap_type != SNAP_BIGGER_SMALLER_ONLY) { + CLAMP(delta, -smaller, bigger); + } if (snap_type == SNAP_NONE) { final_loc = origval + delta; |