Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/screen/area.c
| Show First 20 Lines • Show All 2,098 Lines • ▼ Show 20 Lines | if (area->spacetype != type) { | ||||
| * | * | ||||
| * However, add-on install for example, forces the header to the top which shouldn't | * However, add-on install for example, forces the header to the top which shouldn't | ||||
| * be applied back to the previous space type when closing - see: T57724 | * be applied back to the previous space type when closing - see: T57724 | ||||
| * | * | ||||
| * Newly created windows wont have any space data, use the alignment | * Newly created windows wont have any space data, use the alignment | ||||
| * the space type defaults to in this case instead | * the space type defaults to in this case instead | ||||
| * (needed for preferences to have space-type on bottom). | * (needed for preferences to have space-type on bottom). | ||||
| */ | */ | ||||
| int header_alignment = ED_area_header_alignment_or_fallback(area, -1); | const int header_alignment = ED_area_header_alignment_or_fallback(area, -1); | ||||
| const bool sync_header_alignment = ((header_alignment != -1) && | const bool sync_header_alignment = ((header_alignment != -1) && | ||||
| ((slold->link_flag & SPACE_FLAG_TYPE_TEMPORARY) == 0)); | ((slold->link_flag & SPACE_FLAG_TYPE_TEMPORARY) == 0)); | ||||
| /* in some cases (opening temp space) we don't want to | /* in some cases (opening temp space) we don't want to | ||||
| * call area exit callback, so we temporarily unset it */ | * call area exit callback, so we temporarily unset it */ | ||||
| if (skip_region_exit && area->type) { | if (skip_region_exit && area->type) { | ||||
| area->type->exit = NULL; | area->type->exit = NULL; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 77 Lines • ▼ Show 20 Lines | if (sync_header_alignment) { | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| LISTBASE_FOREACH (ARegion *, region, &area->regionbase) { | LISTBASE_FOREACH (ARegion *, region, &area->regionbase) { | ||||
| if (ELEM(region->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER)) { | if (ELEM(region->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER)) { | ||||
| region->alignment = header_alignment; | region->alignment = header_alignment; | ||||
| break; | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| ED_area_initialize(CTX_wm_manager(C), win, area); | ED_area_initialize(CTX_wm_manager(C), win, area); | ||||
| /* tell WM to refresh, cursor types etc */ | /* tell WM to refresh, cursor types etc */ | ||||
| ▲ Show 20 Lines • Show All 729 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| /* Accommodate widget and padding. */ | /* Accommodate widget and padding. */ | ||||
| return U.widget_unit + (int)(UI_DPI_FAC * HEADER_PADDING_Y); | return U.widget_unit + (int)(UI_DPI_FAC * HEADER_PADDING_Y); | ||||
| } | } | ||||
| int ED_area_header_alignment_or_fallback(const ScrArea *area, int fallback) | int ED_area_header_alignment_or_fallback(const ScrArea *area, int fallback) | ||||
| { | { | ||||
| LISTBASE_FOREACH (ARegion *, region, &area->regionbase) { | LISTBASE_FOREACH (ARegion *, region, &area->regionbase) { | ||||
| if (region->regiontype == RGN_TYPE_HEADER) { | if (ELEM(region->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER) && | ||||
| !(region->flag & RGN_FLAG_HIDDEN)) { | |||||
| return region->alignment; | return region->alignment; | ||||
| } | } | ||||
| } | } | ||||
| return fallback; | return fallback; | ||||
| } | } | ||||
| int ED_area_header_alignment(const ScrArea *area) | int ED_area_header_alignment(const ScrArea *area) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 762 Lines • Show Last 20 Lines | |||||