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).
This commit is contained in:
@@ -194,6 +194,11 @@ class USERPREF_PT_interface(Panel):
|
||||
sub.prop(view, "pie_menu_confirm")
|
||||
col.separator()
|
||||
|
||||
col.label(text="Header:")
|
||||
sub = col.split()
|
||||
sub.label(text="Default Position")
|
||||
sub.row().prop(view, "header_align_default", expand=True)
|
||||
|
||||
col.prop(view, "show_splash")
|
||||
|
||||
col.label(text="Warnings:")
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user