<commit_before>// Copyright (c) ppy Pty Ltd <<EMAIL>>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Game.Overlays;
using osu.Game.Overlays.Settings;
using osu.Game.Rulesets.Edit.Checks.Components;

namespace osu.Game.Screens.Edit.Verify
{
    internal class VisibilitySection : EditorRoundedScreenSettingsSection
    {
        [Resolved]
        private VerifyScreen verify { get; set; }

        private readonly IssueType[] configurableIssueTypes =
        {
            IssueType.Warning,
            IssueType.Error,
            IssueType.Negligible
        };

        private BindableList<IssueType> hiddenIssueTypes;

        protected override string Header => "Visibility";

        [BackgroundDependencyLoader]
        private void load(OverlayColourProvider colours)
        {
            hiddenIssueTypes = verify.HiddenIssueTypes.GetBoundCopy();

            foreach (IssueType issueType in configurableIssueTypes)
            {
                var checkbox = new SettingsCheckbox
                {
                    Anchor = Anchor.CentreLeft,
                    Origin = Anchor.CentreLeft,
                    LabelText = issueType.ToString()
                };

                checkbox.Current.Default = !hiddenIssueTypes.Contains(issueType);
                checkbox.Current.SetDefault();
                checkbox.Current.BindValueChanged(state =>
                {
                    if (!state.NewValue)
                        hiddenIssueTypes.Add(issueType);
                    else
                        hiddenIssueTypes.Remove(issueType);
                });

                Flow.Add(checkbox);
            }
        }
    }
}
<commit_msg>Set default for bindable in object initializer<commit_after>// Copyright (c) ppy Pty Ltd <<EMAIL>>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Game.Overlays;
using osu.Game.Overlays.Settings;
using osu.Game.Rulesets.Edit.Checks.Components;

namespace osu.Game.Screens.Edit.Verify
{
    internal class VisibilitySection : EditorRoundedScreenSettingsSection
    {
        [Resolved]
        private VerifyScreen verify { get; set; }

        private readonly IssueType[] configurableIssueTypes =
        {
            IssueType.Warning,
            IssueType.Error,
            IssueType.Negligible
        };

        private BindableList<IssueType> hiddenIssueTypes;

        protected override string Header => "Visibility";

        [BackgroundDependencyLoader]
        private void load(OverlayColourProvider colours)
        {
            hiddenIssueTypes = verify.HiddenIssueTypes.GetBoundCopy();

            foreach (IssueType issueType in configurableIssueTypes)
            {
                var checkbox = new SettingsCheckbox
                {
                    Anchor = Anchor.CentreLeft,
                    Origin = Anchor.CentreLeft,
                    LabelText = issueType.ToString(),
                    Current = { Default = !hiddenIssueTypes.Contains(issueType) }
                };

                checkbox.Current.SetDefault();
                checkbox.Current.BindValueChanged(state =>
                {
                    if (!state.NewValue)
                        hiddenIssueTypes.Add(issueType);
                    else
                        hiddenIssueTypes.Remove(issueType);
                });

                Flow.Add(checkbox);
            }
        }
    }
}

{'fraction_non_alphanumeric': 0.07598702001081666, 'fraction_numerical': 0.0, 'mean_word_length': 1.8043972706595905, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2884199', 'n_tokens_mistral': 958, 'n_tokens_neox': 884, 'n_words': 197}