From 9ea645862cfb967376bb7ae2c7f7ef8a5fe90637 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 14 Dec 2018 09:47:10 +1100 Subject: Preferences: add option for header position Sets the header position for newly created windows with few exceptions (preferences is always bottom, file-selector is always top). --- source/blender/blenloader/intern/versioning_userdef.c | 2 +- source/blender/editors/screen/area.c | 3 ++- source/blender/editors/space_action/space_action.c | 2 +- source/blender/editors/space_buttons/space_buttons.c | 2 +- source/blender/editors/space_clip/space_clip.c | 2 +- source/blender/editors/space_console/space_console.c | 2 +- source/blender/editors/space_file/space_file.c | 1 + source/blender/editors/space_graph/space_graph.c | 2 +- source/blender/editors/space_image/space_image.c | 2 +- source/blender/editors/space_info/space_info.c | 2 +- source/blender/editors/space_nla/space_nla.c | 2 +- source/blender/editors/space_node/space_node.c | 2 +- source/blender/editors/space_outliner/space_outliner.c | 2 +- source/blender/editors/space_script/space_script.c | 2 +- source/blender/editors/space_sequencer/space_sequencer.c | 2 +- source/blender/editors/space_text/space_text.c | 2 +- source/blender/editors/space_userpref/space_userpref.c | 1 + source/blender/editors/space_view3d/space_view3d.c | 2 +- source/blender/makesdna/DNA_userdef_types.h | 4 +--- source/blender/makesrna/intern/rna_userdef.c | 11 +++++++++++ 20 files changed, 31 insertions(+), 19 deletions(-) (limited to 'source/blender') diff --git a/source/blender/blenloader/intern/versioning_userdef.c b/source/blender/blenloader/intern/versioning_userdef.c index 8e8f42bdf10..e43ed4af437 100644 --- a/source/blender/blenloader/intern/versioning_userdef.c +++ b/source/blender/blenloader/intern/versioning_userdef.c @@ -360,7 +360,7 @@ void BLO_version_defaults_userpref_blend(Main *bmain, UserDef *userdef) USER_FLAG_DEPRECATED_6 | USER_FLAG_DEPRECATED_7 | USER_FLAG_DEPRECATED_9 | USER_DEVELOPER_UI); userdef->uiflag &= ~( - USER_UIFLAG_DEPRECATED_7); + USER_HEADER_BOTTOM); userdef->transopts &= ~( USER_TR_DEPRECATED_2 | USER_TR_DEPRECATED_3 | USER_TR_DEPRECATED_4 | USER_TR_DEPRECATED_6 | USER_TR_DEPRECATED_7); diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index dd7b6fe5ce1..aae135977cb 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -2515,7 +2515,8 @@ int ED_area_header_alignment_or_fallback(const ScrArea *area, int fallback) int ED_area_header_alignment(const ScrArea *area) { - return ED_area_header_alignment_or_fallback(area, RGN_ALIGN_TOP); + return ED_area_header_alignment_or_fallback( + area, (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP); } /** diff --git a/source/blender/editors/space_action/space_action.c b/source/blender/editors/space_action/space_action.c index 0a7db803acc..b41b97923e2 100644 --- a/source/blender/editors/space_action/space_action.c +++ b/source/blender/editors/space_action/space_action.c @@ -120,7 +120,7 @@ static SpaceLink *action_new(const ScrArea *sa, const Scene *scene) BLI_addtail(&saction->regionbase, ar); ar->regiontype = RGN_TYPE_HEADER; - ar->alignment = RGN_ALIGN_TOP; + ar->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP; /* channel list region */ ar = MEM_callocN(sizeof(ARegion), "channel region for action"); diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c index 159757139fa..4520f837a0a 100644 --- a/source/blender/editors/space_buttons/space_buttons.c +++ b/source/blender/editors/space_buttons/space_buttons.c @@ -73,7 +73,7 @@ static SpaceLink *buttons_new(const ScrArea *UNUSED(area), const Scene *UNUSED(s BLI_addtail(&sbuts->regionbase, ar); ar->regiontype = RGN_TYPE_HEADER; - ar->alignment = RGN_ALIGN_TOP; + ar->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP; /* navigation bar */ ar = MEM_callocN(sizeof(ARegion), "navigation bar for buts"); diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c index 83b4f0aa6ce..af7843a01a5 100644 --- a/source/blender/editors/space_clip/space_clip.c +++ b/source/blender/editors/space_clip/space_clip.c @@ -248,7 +248,7 @@ static SpaceLink *clip_new(const ScrArea *sa, const Scene *scene) BLI_addtail(&sc->regionbase, ar); ar->regiontype = RGN_TYPE_HEADER; - ar->alignment = RGN_ALIGN_TOP; + ar->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP; /* tools view */ ar = MEM_callocN(sizeof(ARegion), "tools for clip"); diff --git a/source/blender/editors/space_console/space_console.c b/source/blender/editors/space_console/space_console.c index 596d66da9a6..ece29bcd721 100644 --- a/source/blender/editors/space_console/space_console.c +++ b/source/blender/editors/space_console/space_console.c @@ -68,7 +68,7 @@ static SpaceLink *console_new(const ScrArea *UNUSED(area), const Scene *UNUSED(s BLI_addtail(&sconsole->regionbase, ar); ar->regiontype = RGN_TYPE_HEADER; - ar->alignment = RGN_ALIGN_TOP; + ar->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP; /* main region */ diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c index e0413e48346..fb6dfdad4db 100644 --- a/source/blender/editors/space_file/space_file.c +++ b/source/blender/editors/space_file/space_file.c @@ -81,6 +81,7 @@ static SpaceLink *file_new(const ScrArea *UNUSED(area), const Scene *UNUSED(scen ar = MEM_callocN(sizeof(ARegion), "header for file"); BLI_addtail(&sfile->regionbase, ar); ar->regiontype = RGN_TYPE_HEADER; + /* Ignore user preference "USER_HEADER_BOTTOM" here (always show top for new types). */ ar->alignment = RGN_ALIGN_TOP; /* Tools region */ diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c index 9a825715e18..27e401c8948 100644 --- a/source/blender/editors/space_graph/space_graph.c +++ b/source/blender/editors/space_graph/space_graph.c @@ -123,7 +123,7 @@ static SpaceLink *graph_new(const ScrArea *UNUSED(sa), const Scene *scene) BLI_addtail(&sipo->regionbase, ar); ar->regiontype = RGN_TYPE_HEADER; - ar->alignment = RGN_ALIGN_TOP; + ar->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP; /* channels */ ar = MEM_callocN(sizeof(ARegion), "channels region for graphedit"); diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index b5c7657d890..3c850ae1689 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -190,7 +190,7 @@ static SpaceLink *image_new(const ScrArea *UNUSED(area), const Scene *UNUSED(sce BLI_addtail(&simage->regionbase, ar); ar->regiontype = RGN_TYPE_HEADER; - ar->alignment = RGN_ALIGN_TOP; + ar->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP; /* buttons/list view */ ar = MEM_callocN(sizeof(ARegion), "buttons for image"); diff --git a/source/blender/editors/space_info/space_info.c b/source/blender/editors/space_info/space_info.c index d2b6d07541e..076b66ef012 100644 --- a/source/blender/editors/space_info/space_info.c +++ b/source/blender/editors/space_info/space_info.c @@ -79,7 +79,7 @@ static SpaceLink *info_new(const ScrArea *UNUSED(area), const Scene *UNUSED(scen BLI_addtail(&sinfo->regionbase, ar); ar->regiontype = RGN_TYPE_HEADER; - ar->alignment = RGN_ALIGN_TOP; + ar->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP; /* main region */ ar = MEM_callocN(sizeof(ARegion), "main region for info"); diff --git a/source/blender/editors/space_nla/space_nla.c b/source/blender/editors/space_nla/space_nla.c index d72014901a6..1a7793fadb9 100644 --- a/source/blender/editors/space_nla/space_nla.c +++ b/source/blender/editors/space_nla/space_nla.c @@ -115,7 +115,7 @@ static SpaceLink *nla_new(const ScrArea *sa, const Scene *scene) BLI_addtail(&snla->regionbase, ar); ar->regiontype = RGN_TYPE_HEADER; - ar->alignment = RGN_ALIGN_TOP; + ar->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP; /* channel list region */ ar = MEM_callocN(sizeof(ARegion), "channel list for nla"); diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c index 8af5fe1b3a1..cbd67bfb722 100644 --- a/source/blender/editors/space_node/space_node.c +++ b/source/blender/editors/space_node/space_node.c @@ -319,7 +319,7 @@ static SpaceLink *node_new(const ScrArea *UNUSED(area), const Scene *UNUSED(scen BLI_addtail(&snode->regionbase, ar); ar->regiontype = RGN_TYPE_HEADER; - ar->alignment = RGN_ALIGN_TOP; + ar->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP; /* buttons/list view */ ar = MEM_callocN(sizeof(ARegion), "buttons for node"); diff --git a/source/blender/editors/space_outliner/space_outliner.c b/source/blender/editors/space_outliner/space_outliner.c index 57b13749f2b..95225774ddf 100644 --- a/source/blender/editors/space_outliner/space_outliner.c +++ b/source/blender/editors/space_outliner/space_outliner.c @@ -301,7 +301,7 @@ static SpaceLink *outliner_new(const ScrArea *UNUSED(area), const Scene *UNUSED( BLI_addtail(&soutliner->regionbase, ar); ar->regiontype = RGN_TYPE_HEADER; - ar->alignment = RGN_ALIGN_TOP; + ar->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP; /* main region */ ar = MEM_callocN(sizeof(ARegion), "main region for outliner"); diff --git a/source/blender/editors/space_script/space_script.c b/source/blender/editors/space_script/space_script.c index 65c489e8409..e3ae8accb67 100644 --- a/source/blender/editors/space_script/space_script.c +++ b/source/blender/editors/space_script/space_script.c @@ -77,7 +77,7 @@ static SpaceLink *script_new(const ScrArea *UNUSED(area), const Scene *UNUSED(sc BLI_addtail(&sscript->regionbase, ar); ar->regiontype = RGN_TYPE_HEADER; - ar->alignment = RGN_ALIGN_TOP; + ar->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP; /* main region */ ar = MEM_callocN(sizeof(ARegion), "main region for script"); diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c index 092911cb7c2..4e10ed62366 100644 --- a/source/blender/editors/space_sequencer/space_sequencer.c +++ b/source/blender/editors/space_sequencer/space_sequencer.c @@ -130,7 +130,7 @@ static SpaceLink *sequencer_new(const ScrArea *UNUSED(sa), const Scene *scene) BLI_addtail(&sseq->regionbase, ar); ar->regiontype = RGN_TYPE_HEADER; - ar->alignment = RGN_ALIGN_TOP; + ar->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP; /* buttons/list view */ ar = MEM_callocN(sizeof(ARegion), "buttons for sequencer"); diff --git a/source/blender/editors/space_text/space_text.c b/source/blender/editors/space_text/space_text.c index 27b75f49b44..8e04cd83fc5 100644 --- a/source/blender/editors/space_text/space_text.c +++ b/source/blender/editors/space_text/space_text.c @@ -80,7 +80,7 @@ static SpaceLink *text_new(const ScrArea *UNUSED(area), const Scene *UNUSED(scen BLI_addtail(&stext->regionbase, ar); ar->regiontype = RGN_TYPE_HEADER; - ar->alignment = RGN_ALIGN_TOP; + ar->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP; /* properties region */ ar = MEM_callocN(sizeof(ARegion), "properties region for text"); diff --git a/source/blender/editors/space_userpref/space_userpref.c b/source/blender/editors/space_userpref/space_userpref.c index 87da461f269..9a876f9d925 100644 --- a/source/blender/editors/space_userpref/space_userpref.c +++ b/source/blender/editors/space_userpref/space_userpref.c @@ -73,6 +73,7 @@ static SpaceLink *userpref_new(const ScrArea *UNUSED(area), const Scene *UNUSED( BLI_addtail(&spref->regionbase, ar); ar->regiontype = RGN_TYPE_HEADER; + /* Ignore user preference "USER_HEADER_BOTTOM" here (always show bottom for new types). */ ar->alignment = RGN_ALIGN_BOTTOM; /* main region */ diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index 0e8e5e1ee22..354d27bd293 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -370,7 +370,7 @@ static SpaceLink *view3d_new(const ScrArea *UNUSED(sa), const Scene *scene) BLI_addtail(&v3d->regionbase, ar); ar->regiontype = RGN_TYPE_HEADER; - ar->alignment = RGN_ALIGN_TOP; + ar->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP; /* tool shelf */ ar = MEM_callocN(sizeof(ARegion), "toolshelf for view3d"); diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index a846e8f6468..929cb5b36a9 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -784,9 +784,7 @@ typedef enum eUserpref_UI_Flag { USER_DRAWVIEWINFO = (1 << 4), USER_PLAINMENUS = (1 << 5), USER_LOCK_CURSOR_ADJUST = (1 << 6), - /* Avoid accidentally adjusting the layout - * (exact behavior may change based on what's considered reasonable to lock down). */ - USER_UIFLAG_DEPRECATED_7 = (1 << 7), + USER_HEADER_BOTTOM = (1 << 7), USER_ALLWINCODECS = (1 << 8), USER_MENUOPENAUTO = (1 << 9), USER_DEPTH_CURSOR = (1 << 10), diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 84ce946ce19..24e6424effd 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -3796,6 +3796,17 @@ static void rna_def_userdef_view(BlenderRNA *brna) "Otherwise menus, etc will always be top to bottom, left to right, " "no matter opening direction"); + static const EnumPropertyItem header_align_default_items[] = { + {0, "TOP", 0, "Top", ""}, + {USER_HEADER_BOTTOM, "BOTTOM", 0, "Bottom", ""}, + {0, NULL, 0, NULL, NULL} + }; + prop = RNA_def_property(srna, "header_align_default", PROP_ENUM, PROP_NONE); + 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"); + prop = RNA_def_property(srna, "use_mouse_depth_navigate", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_DEPTH_NAVIGATE); RNA_def_property_ui_text(prop, "Auto Depth", -- cgit v1.2.3