commit 5e689ba81d8f35fb4bd2328eb2ee806290ae5e5b Author: Campbell Barton Date: Wed Feb 6 13:36:23 2019 +1100 Preferences: switch header alignment when setting the option This was only used for newly created windows, however it's more useful when the existing window is edited. diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 2b06ae06dea..551b625843d 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -160,6 +160,24 @@ static void rna_userdef_language_update(Main *UNUSED(bmain), Scene *UNUSED(scene UI_reinit_font(); } +static void rna_userdef_update_header_default(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + int alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP; + for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) { + for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) { + if (ELEM(sa->spacetype, SPACE_FILE, SPACE_USERPREF, SPACE_OUTLINER, SPACE_BUTS)) { + continue; + } + for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) { + if (ar->regiontype == RGN_TYPE_HEADER) { + ar->alignment = alignment; + } + } + } + } + rna_userdef_update_ui(bmain, scene, ptr); +} + static void rna_userdef_script_autoexec_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { UserDef *userdef = (UserDef *)ptr->data; @@ -3867,7 +3885,7 @@ static void rna_def_userdef_view(BlenderRNA *brna) RNA_def_property_enum_items(prop, header_align_default_items); RNA_def_property_enum_bitflag_sdna(prop, NULL, "uiflag"); RNA_def_property_ui_text(prop, "Header Position", "Default header position for new space-types"); - RNA_def_property_update(prop, 0, "rna_userdef_update"); + RNA_def_property_update(prop, 0, "rna_userdef_update_header_default"); static const EnumPropertyItem text_hinting_items[] = { {0, "AUTO", 0, "Auto", ""},