Example #1
0
        private void Localize()
        {
            Text = LText.TagsFilterBox.TitleText;

            IncludeAllLabel.Text = LText.TagsFilterBox.IncludeAll;
            IncludeAnyLabel.Text = LText.TagsFilterBox.IncludeAny;
            ExcludeLabel.Text    = LText.TagsFilterBox.Exclude;

            for (int i = 0; i < 3; i++)
            {
                #region Set i-dependent values

                Button c1b = i switch { 0 => RemoveSelectedAndButton, 1 => RemoveSelectedOrButton, _ => RemoveSelectedNotButton };
                Button cab = i switch { 0 => RemoveAllAndButton, 1 => RemoveAllOrButton, _ => RemoveAllNotButton };

                #endregion

                MainToolTip.SetToolTip(c1b, LText.TagsFilterBox.ClearSelectedToolTip);
                MainToolTip.SetToolTip(cab, LText.TagsFilterBox.ClearAllToolTip);
            }

            // PERF_TODO: Lots of wasted time and duplicate sizing here
            AndButton.SetTextAutoSize(LText.TagsFilterBox.MoveToAll, AndButton.Width);
            OrButton.SetTextAutoSize(LText.TagsFilterBox.MoveToAny, OrButton.Width);
            NotButton.SetTextAutoSize(LText.TagsFilterBox.MoveToExclude, NotButton.Width);
            int newWidthAll = Math.Max(Math.Max(AndButton.Width, OrButton.Width), NotButton.Width);
            for (int i = 0; i < 3; i++)
            {
                Button button = i switch { 0 => AndButton, 1 => OrButton, _ => NotButton };

                button.Width = newWidthAll;
                button.CenterH(MoveButtonsPanel);
            }

            ResetButton.SetTextAutoSize(LText.TagsFilterBox.Reset, ResetButton.Width);
            OKButton.SetTextAutoSize(LText.Global.OK, OKButton.Width);
            Cancel_Button.SetTextAutoSize(LText.Global.Cancel, Cancel_Button.Width);
        }