Beispiel #1
0
    /// <inheritdoc />
    public override void Draw()
    {
        var config = Service <DalamudConfiguration> .Get();

        var renameModalTitle = Loc.Localize("RenameStyleModalTitle", "Rename Style");

        var workStyle = config.SavedStyles[this.currentSel];

        workStyle.BuiltInColors ??= StyleModelV1.DalamudStandard.BuiltInColors;

        var appliedThisFrame = false;

        var styleAry = config.SavedStyles.Select(x => x.Name).ToArray();

        ImGui.Text(Loc.Localize("StyleEditorChooseStyle", "Choose Style:"));
        if (ImGui.Combo("###styleChooserCombo", ref this.currentSel, styleAry, styleAry.Length))
        {
            var newStyle = config.SavedStyles[this.currentSel];
            newStyle.Apply();
            appliedThisFrame = true;
        }

        if (ImGui.Button(Loc.Localize("StyleEditorAddNew", "Add new style")))
        {
            this.SaveStyle();

            var newStyle = StyleModelV1.DalamudStandard;
            newStyle.Name = GetRandomName();
            config.SavedStyles.Add(newStyle);

            this.currentSel = config.SavedStyles.Count - 1;

            newStyle.Apply();
            appliedThisFrame = true;

            config.Save();
        }

        ImGui.SameLine();

        if (ImGuiComponents.IconButton(FontAwesomeIcon.Trash) && this.currentSel != 0)
        {
            this.currentSel--;
            var newStyle = config.SavedStyles[this.currentSel];
            newStyle.Apply();
            appliedThisFrame = true;

            config.SavedStyles.RemoveAt(this.currentSel + 1);

            config.Save();
        }

        if (ImGui.IsItemHovered())
        {
            ImGui.SetTooltip(Loc.Localize("StyleEditorDeleteStyle", "Delete current style"));
        }

        ImGui.SameLine();

        if (ImGuiComponents.IconButton(FontAwesomeIcon.Pen) && this.currentSel != 0)
        {
            var newStyle = config.SavedStyles[this.currentSel];
            this.renameText = newStyle.Name;

            this.renameModalDrawing = true;
            ImGui.OpenPopup(renameModalTitle);
        }

        if (ImGui.IsItemHovered())
        {
            ImGui.SetTooltip(Loc.Localize("StyleEditorRenameStyle", "Rename style"));
        }

        ImGui.SameLine();

        ImGuiHelpers.ScaledDummy(5);
        ImGui.SameLine();

        if (ImGuiComponents.IconButton(FontAwesomeIcon.FileExport))
        {
            var selectedStyle = config.SavedStyles[this.currentSel];
            var newStyle      = StyleModelV1.Get();
            newStyle.Name = selectedStyle.Name;
            ImGui.SetClipboardText(newStyle.Serialize());
        }

        if (ImGui.IsItemHovered())
        {
            ImGui.SetTooltip(Loc.Localize("StyleEditorCopy", "Copy style to clipboard for sharing"));
        }

        ImGui.SameLine();

        if (ImGuiComponents.IconButton(FontAwesomeIcon.FileImport))
        {
            this.SaveStyle();

            var styleJson = ImGui.GetClipboardText();

            try
            {
                var newStyle = StyleModel.Deserialize(styleJson);

                newStyle.Name ??= GetRandomName();

                if (config.SavedStyles.Any(x => x.Name == newStyle.Name))
                {
                    newStyle.Name = $"{newStyle.Name} ({GetRandomName()} Mix)";
                }

                config.SavedStyles.Add(newStyle);
                newStyle.Apply();
                appliedThisFrame = true;

                this.currentSel = config.SavedStyles.Count - 1;

                config.Save();
            }
            catch (Exception ex)
            {
                Log.Error(ex, "Could not import style");
            }
        }

        if (ImGui.IsItemHovered())
        {
            ImGui.SetTooltip(Loc.Localize("StyleEditorImport", "Import style from clipboard"));
        }

        ImGui.Separator();

        ImGui.PushItemWidth(ImGui.GetWindowWidth() * 0.50f);

        if (this.currentSel < 2)
        {
            ImGui.TextColored(ImGuiColors.DalamudRed, Loc.Localize("StyleEditorNotAllowed", "You cannot edit built-in styles. Please add a new style first."));
        }
        else if (appliedThisFrame)
        {
            ImGui.Text(Loc.Localize("StyleEditorApplying", "Applying style..."));
        }
        else if (ImGui.BeginTabBar("StyleEditorTabs"))
        {
            var style = ImGui.GetStyle();

            if (ImGui.BeginTabItem(Loc.Localize("StyleEditorVariables", "Variables")))
            {
                ImGui.BeginChild($"ScrollingVars", ImGuiHelpers.ScaledVector2(0, -32), true, ImGuiWindowFlags.HorizontalScrollbar | ImGuiWindowFlags.NoBackground);

                ImGui.SetCursorPosY(ImGui.GetCursorPosY() - 5);

                ImGui.SliderFloat2("WindowPadding", ref style.WindowPadding, 0.0f, 20.0f, "%.0f");
                ImGui.SliderFloat2("FramePadding", ref style.FramePadding, 0.0f, 20.0f, "%.0f");
                ImGui.SliderFloat2("CellPadding", ref style.CellPadding, 0.0f, 20.0f, "%.0f");
                ImGui.SliderFloat2("ItemSpacing", ref style.ItemSpacing, 0.0f, 20.0f, "%.0f");
                ImGui.SliderFloat2("ItemInnerSpacing", ref style.ItemInnerSpacing, 0.0f, 20.0f, "%.0f");
                ImGui.SliderFloat2("TouchExtraPadding", ref style.TouchExtraPadding, 0.0f, 10.0f, "%.0f");
                ImGui.SliderFloat("IndentSpacing", ref style.IndentSpacing, 0.0f, 30.0f, "%.0f");
                ImGui.SliderFloat("ScrollbarSize", ref style.ScrollbarSize, 1.0f, 20.0f, "%.0f");
                ImGui.SliderFloat("GrabMinSize", ref style.GrabMinSize, 1.0f, 20.0f, "%.0f");
                ImGui.Text("Borders");
                ImGui.SliderFloat("WindowBorderSize", ref style.WindowBorderSize, 0.0f, 1.0f, "%.0f");
                ImGui.SliderFloat("ChildBorderSize", ref style.ChildBorderSize, 0.0f, 1.0f, "%.0f");
                ImGui.SliderFloat("PopupBorderSize", ref style.PopupBorderSize, 0.0f, 1.0f, "%.0f");
                ImGui.SliderFloat("FrameBorderSize", ref style.FrameBorderSize, 0.0f, 1.0f, "%.0f");
                ImGui.SliderFloat("TabBorderSize", ref style.TabBorderSize, 0.0f, 1.0f, "%.0f");
                ImGui.Text("Rounding");
                ImGui.SliderFloat("WindowRounding", ref style.WindowRounding, 0.0f, 12.0f, "%.0f");
                ImGui.SliderFloat("ChildRounding", ref style.ChildRounding, 0.0f, 12.0f, "%.0f");
                ImGui.SliderFloat("FrameRounding", ref style.FrameRounding, 0.0f, 12.0f, "%.0f");
                ImGui.SliderFloat("PopupRounding", ref style.PopupRounding, 0.0f, 12.0f, "%.0f");
                ImGui.SliderFloat("ScrollbarRounding", ref style.ScrollbarRounding, 0.0f, 12.0f, "%.0f");
                ImGui.SliderFloat("GrabRounding", ref style.GrabRounding, 0.0f, 12.0f, "%.0f");
                ImGui.SliderFloat("LogSliderDeadzone", ref style.LogSliderDeadzone, 0.0f, 12.0f, "%.0f");
                ImGui.SliderFloat("TabRounding", ref style.TabRounding, 0.0f, 12.0f, "%.0f");
                ImGui.Text("Alignment");
                ImGui.SliderFloat2("WindowTitleAlign", ref style.WindowTitleAlign, 0.0f, 1.0f, "%.2f");
                var windowMenuButtonPosition = (int)style.WindowMenuButtonPosition + 1;
                if (ImGui.Combo("WindowMenuButtonPosition", ref windowMenuButtonPosition, "None\0Left\0Right\0"))
                {
                    style.WindowMenuButtonPosition = (ImGuiDir)(windowMenuButtonPosition - 1);
                }
                ImGui.SliderFloat2("ButtonTextAlign", ref style.ButtonTextAlign, 0.0f, 1.0f, "%.2f");
                ImGui.SameLine();
                ImGuiComponents.HelpMarker("Alignment applies when a button is larger than its text content.");
                ImGui.SliderFloat2("SelectableTextAlign", ref style.SelectableTextAlign, 0.0f, 1.0f, "%.2f");
                ImGui.SameLine();
                ImGuiComponents.HelpMarker("Alignment applies when a selectable is larger than its text content.");
                ImGui.SliderFloat2("DisplaySafeAreaPadding", ref style.DisplaySafeAreaPadding, 0.0f, 30.0f, "%.0f");
                ImGui.SameLine();
                ImGuiComponents.HelpMarker(
                    "Adjust if you cannot see the edges of your screen (e.g. on a TV where scaling has not been configured).");
                ImGui.EndTabItem();

                ImGui.EndChild();

                ImGui.EndTabItem();
            }

            if (ImGui.BeginTabItem(Loc.Localize("StyleEditorColors", "Colors")))
            {
                ImGui.BeginChild("ScrollingColors", ImGuiHelpers.ScaledVector2(0, -30), true, ImGuiWindowFlags.HorizontalScrollbar | ImGuiWindowFlags.NoBackground);

                ImGui.SetCursorPosY(ImGui.GetCursorPosY() - 5);

                if (ImGui.RadioButton("Opaque", this.alphaFlags == ImGuiColorEditFlags.None))
                {
                    this.alphaFlags = ImGuiColorEditFlags.None;
                }
                ImGui.SameLine();
                if (ImGui.RadioButton("Alpha", this.alphaFlags == ImGuiColorEditFlags.AlphaPreview))
                {
                    this.alphaFlags = ImGuiColorEditFlags.AlphaPreview;
                }
                ImGui.SameLine();
                if (ImGui.RadioButton("Both", this.alphaFlags == ImGuiColorEditFlags.AlphaPreviewHalf))
                {
                    this.alphaFlags = ImGuiColorEditFlags.AlphaPreviewHalf;
                }
                ImGui.SameLine();

                ImGuiComponents.HelpMarker(
                    "In the color list:\n" +
                    "Left-click on color square to open color picker,\n" +
                    "Right-click to open edit options menu.");

                foreach (var imGuiCol in Enum.GetValues <ImGuiCol>())
                {
                    if (imGuiCol == ImGuiCol.COUNT)
                    {
                        continue;
                    }

                    ImGui.PushID(imGuiCol.ToString());

                    ImGui.ColorEdit4("##color", ref style.Colors[(int)imGuiCol], ImGuiColorEditFlags.AlphaBar | this.alphaFlags);

                    ImGui.SameLine(0.0f, style.ItemInnerSpacing.X);
                    ImGui.TextUnformatted(imGuiCol.ToString());

                    ImGui.PopID();
                }

                ImGui.Separator();

                foreach (var property in typeof(DalamudColors).GetProperties(BindingFlags.Public | BindingFlags.Instance))
                {
                    ImGui.PushID(property.Name);

                    var colorVal = property.GetValue(workStyle.BuiltInColors);
                    if (colorVal == null)
                    {
                        colorVal = property.GetValue(StyleModelV1.DalamudStandard.BuiltInColors);
                        property.SetValue(workStyle.BuiltInColors, colorVal);
                    }

                    var color = (Vector4)colorVal;

                    if (ImGui.ColorEdit4("##color", ref color, ImGuiColorEditFlags.AlphaBar | this.alphaFlags))
                    {
                        property.SetValue(workStyle.BuiltInColors, color);
                        workStyle.BuiltInColors?.Apply();
                    }

                    ImGui.SameLine(0.0f, style.ItemInnerSpacing.X);
                    ImGui.TextUnformatted(property.Name);

                    ImGui.PopID();
                }

                ImGui.EndChild();

                ImGui.EndTabItem();
            }

            ImGui.EndTabBar();
        }

        ImGui.PopItemWidth();

        ImGui.Separator();

        if (ImGui.Button(Loc.Localize("Close", "Close")))
        {
            this.IsOpen = false;
        }

        ImGui.SameLine();

        if (ImGui.Button(Loc.Localize("SaveAndClose", "Save and Close")))
        {
            this.SaveStyle();

            config.ChosenStyle = config.SavedStyles[this.currentSel].Name;
            Log.Verbose("ChosenStyle = {ChosenStyle}", config.ChosenStyle);

            this.didSave = true;

            this.IsOpen = false;
        }

        if (ImGui.BeginPopupModal(renameModalTitle, ref this.renameModalDrawing, ImGuiWindowFlags.AlwaysAutoResize | ImGuiWindowFlags.NoScrollbar))
        {
            ImGui.Text(Loc.Localize("StyleEditorEnterName", "Please enter the new name for this style."));
            ImGui.Spacing();

            ImGui.InputText("###renameModalInput", ref this.renameText, 255);

            const float buttonWidth = 120f;
            ImGui.SetCursorPosX((ImGui.GetWindowWidth() - buttonWidth) / 2);

            if (ImGui.Button("OK", new Vector2(buttonWidth, 40)))
            {
                config.SavedStyles[this.currentSel].Name = this.renameText;
                config.Save();

                ImGui.CloseCurrentPopup();
            }

            ImGui.EndPopup();
        }
    }
        private void CategoryConfig()
        {
            // get sorted categories
            var categories = this.Plugin.CategoryService.GetSortedCategories().ToList();

            // don't display if no categories (shouldn't happen in theory)
            if (!categories.Any())
            {
                return;
            }

            // add category
            if (ImGui.SmallButton(Loc.Localize("AddCategory", "Add Category") + "###PlayerTrack_CategoryAdd_Button"))
            {
                this.Plugin.CategoryService.AddCategory();
            }

            // setup category table
            ImGui.Separator();
            ImGui.Columns(8, "###PlayerTrack_CategoryTable_Columns", true);
            var baseWidth = ImGui.GetWindowSize().X / 4 * ImGuiHelpers.GlobalScale;

            ImGui.SetColumnWidth(0, baseWidth + 20f);                 // name
            ImGui.SetColumnWidth(1, ImGuiHelpers.GlobalScale * 70f);  // isDefault
            ImGui.SetColumnWidth(2, ImGuiHelpers.GlobalScale * 100f); // alerts
            ImGui.SetColumnWidth(3, baseWidth + 80f);                 // list
            ImGui.SetColumnWidth(4, ImGuiHelpers.GlobalScale * 110f); // nameplates
            ImGui.SetColumnWidth(5, ImGuiHelpers.GlobalScale * 100f); // visibility
            ImGui.SetColumnWidth(6, ImGuiHelpers.GlobalScale * 90f);  // fcnamecolor
            ImGui.SetColumnWidth(7, baseWidth + 200f);                // controls

            // add table headings
            ImGui.Text(Loc.Localize("CategoryName", "Name"));
            ImGui.NextColumn();
            ImGui.Text(Loc.Localize("CategoryDefault", "IsDefault"));
            ImGui.NextColumn();
            ImGui.Text(Loc.Localize("CategoryAlerts", "Alerts"));
            ImGui.NextColumn();
            ImGui.Text(Loc.Localize("CategoryList", "List Color/Icon"));
            ImGui.NextColumn();
            ImGui.Text(Loc.Localize("CategoryNamePlates", "NamePlate"));
            ImGui.NextColumn();
            ImGui.Text(Loc.Localize("CategoryVisibility", "Visibility"));
            ImGui.NextColumn();
            ImGui.Text(Loc.Localize("CategoryFCNameColor", "FCNameColor"));
            ImGui.NextColumn();
            ImGui.Text(Loc.Localize("CategoryAction", "Actions"));
            ImGui.NextColumn();
            ImGui.Separator();

            // loop through categories
            for (var i = 0; i < categories.Count; i++)
            {
                var category = categories[i].Value;

                // category name
                var categoryName = category.Name;
                ImGui.SetNextItemWidth(baseWidth);
                if (ImGui.InputText("###PlayerTrack_CategoryName_Input" + i, ref categoryName, 20))
                {
                    category.Name = categoryName;
                    this.Plugin.CategoryService.SaveCategory(category);
                }

                // category default
                ImGui.NextColumn();
                var isDefault = category.IsDefault;
                if (isDefault)
                {
                    ImGui.PushFont(UiBuilder.IconFont);
                    ImGui.Text(FontAwesomeIcon.Check.ToIconString());
                    ImGui.PopFont();
                }
                else
                {
                    if (ImGui.Checkbox(
                            "###PlayerTrack_CategoryDefault_Checkbox" + i,
                            ref isDefault))
                    {
                        var oldDefaultCategory = this.Plugin.CategoryService.GetDefaultCategory();
                        category.IsDefault = isDefault;
                        this.Plugin.CategoryService.SaveCategory(category);
                        oldDefaultCategory.IsDefault = false;
                        this.Plugin.CategoryService.SaveCategory(oldDefaultCategory);
                    }
                }

                // category alerts
                ImGui.NextColumn();
                var lastSeenAlerts = category.IsAlertEnabled;
                if (ImGui.Checkbox(
                        "###PlayerTrack_EnableCategoryAlerts_Checkbox" + i,
                        ref lastSeenAlerts))
                {
                    category.IsAlertEnabled = lastSeenAlerts;
                    this.Plugin.CategoryService.SaveCategory(category);
                }

                if (ImGui.IsItemHovered())
                {
                    ImGui.BeginTooltip();
                    ImGui.PushTextWrapPos(ImGui.GetFontSize() * 35f);
                    ImGui.TextUnformatted(Loc.Localize("CategorySendLastSeenAlert", "send alert with when and where you last saw the player"));
                    ImGui.PopTextWrapPos();
                    ImGui.EndTooltip();
                }

                ImGui.SameLine();
                var sendNameChangeAlert = category.IsNameChangeAlertEnabled;
                if (ImGui.Checkbox(
                        "###PlayerTrack_SendNameChangeAlert_Checkbox" + i,
                        ref sendNameChangeAlert))
                {
                    category.IsNameChangeAlertEnabled = sendNameChangeAlert;
                    this.Plugin.CategoryService.SaveCategory(category);
                }

                if (ImGui.IsItemHovered())
                {
                    ImGui.BeginTooltip();
                    ImGui.PushTextWrapPos(ImGui.GetFontSize() * 35f);
                    ImGui.TextUnformatted(Loc.Localize("CategorySendNameChangeAlert", "send name change alert in chat when detected from lodestone lookup"));
                    ImGui.PopTextWrapPos();
                    ImGui.EndTooltip();
                }

                ImGui.SameLine();
                var sendWorldTransferAlert = category.IsWorldTransferAlertEnabled;
                if (ImGui.Checkbox(
                        "###PlayerTrack_SendWorldTransferAlert_Checkbox" + i,
                        ref sendWorldTransferAlert))
                {
                    category.IsWorldTransferAlertEnabled = sendWorldTransferAlert;
                    this.Plugin.CategoryService.SaveCategory(category);
                }

                if (ImGui.IsItemHovered())
                {
                    ImGui.BeginTooltip();
                    ImGui.PushTextWrapPos(ImGui.GetFontSize() * 35f);
                    ImGui.TextUnformatted(Loc.Localize("CategorySendWorldTransferAlert", "send world transfer alert in chat when detected from lodestone lookup"));
                    ImGui.PopTextWrapPos();
                    ImGui.EndTooltip();
                }

                // category list color
                ImGui.NextColumn();
                var categoryListColor = category.EffectiveListColor();
                if (ImGui.ColorButton("List Color###PlayerTrack_CategoryListColor_Button" + i, categoryListColor))
                {
                    ImGui.OpenPopup("###PlayerTrack_CategoryListColor_Popup" + i);
                }
                if (ImGui.BeginPopup("###PlayerTrack_CategoryListColor_Popup" + i))
                {
                    if (ImGui.ColorPicker4("List Color###PlayerTrack_CategoryListColor_ColorPicker" + i, ref categoryListColor))
                    {
                        category.ListColor = categoryListColor;
                        if (this.plugin.Configuration.DefaultNamePlateColorToListColor)
                        {
                            category.NamePlateColor = categoryListColor;
                        }

                        this.Plugin.CategoryService.SaveCategory(category);
                    }

                    this.CategoryListColorSwatchRow(category, category.Id, 0, 8);
                    this.CategoryListColorSwatchRow(category, category.Id, 8, 16);
                    this.CategoryListColorSwatchRow(category, category.Id, 16, 24);
                    this.CategoryListColorSwatchRow(category, category.Id, 24, 32);
                    ImGui.EndPopup();
                }

                // category icon
                ImGui.SameLine();
                var categoryIcon = category.Icon;
                var namesList    = new List <string> {
                    Loc.Localize("Default", "Default")
                };
                namesList.AddRange(this.Plugin.Configuration.EnabledIcons.ToList()
                                   .Select(icon => icon.ToString()));
                var names     = namesList.ToArray();
                var codesList = new List <int>
                {
                    0,
                };
                codesList.AddRange(this.Plugin.Configuration.EnabledIcons.ToList().Select(icon => (int)icon));
                var codes     = codesList.ToArray();
                var iconIndex = Array.IndexOf(codes, categoryIcon);
                ImGui.SetNextItemWidth(baseWidth);
                if (ImGui.Combo("###PlayerTrack_SelectCategoryIcon_Combo" + i, ref iconIndex, names, names.Length))
                {
                    category.Icon = codes[iconIndex];
                    this.Plugin.CategoryService.SaveCategory(category);
                }

                ImGui.SameLine();
                ImGui.PushFont(UiBuilder.IconFont);
                ImGui.Text(categoryIcon != 0
                               ? ((FontAwesomeIcon)categoryIcon).ToIconString()
                               : FontAwesomeIcon.User.ToIconString());
                ImGui.PopFont();

                // category color nameplates
                ImGui.NextColumn();
                var enableNamePlatesTitle = category.IsNamePlateTitleEnabled;
                if (ImGui.Checkbox(
                        "###PlayerTrack_EnableNamePlatesTitle_Checkbox" + i,
                        ref enableNamePlatesTitle))
                {
                    category.IsNamePlateTitleEnabled = enableNamePlatesTitle;
                    this.Plugin.CategoryService.SaveCategory(category);
                }

                if (ImGui.IsItemHovered())
                {
                    ImGui.BeginTooltip();
                    ImGui.PushTextWrapPos(ImGui.GetFontSize() * 35f);
                    ImGui.TextUnformatted(Loc.Localize("CategoryNamePlateTitleEnabled", "Enable nameplate titles"));
                    ImGui.PopTextWrapPos();
                    ImGui.EndTooltip();
                }

                // category color nameplates
                ImGui.SameLine();
                var enableNamePlatesColor = category.IsNamePlateColorEnabled;
                if (ImGui.Checkbox(
                        "###PlayerTrack_EnableNamePlatesColor_Checkbox" + i,
                        ref enableNamePlatesColor))
                {
                    category.IsNamePlateColorEnabled = enableNamePlatesColor;
                    this.Plugin.CategoryService.SaveCategory(category);
                }

                if (ImGui.IsItemHovered())
                {
                    ImGui.BeginTooltip();
                    ImGui.PushTextWrapPos(ImGui.GetFontSize() * 35f);
                    ImGui.TextUnformatted(Loc.Localize("CategoryNamePlateColor", "Set nameplate color"));
                    ImGui.PopTextWrapPos();
                    ImGui.EndTooltip();
                }

                // category nameplate color
                ImGui.SameLine();
                var categoryNamePlateColor = category.EffectiveNamePlateColor();
                if (ImGui.ColorButton("NamePlate Color###PlayerTrack_CategoryNamePlateColor_Button" + i, categoryNamePlateColor))
                {
                    ImGui.OpenPopup("###PlayerTrack_CategoryNamePlateColor_Popup" + i);
                }
                if (ImGui.BeginPopup("###PlayerTrack_CategoryNamePlateColor_Popup" + i))
                {
                    if (ImGui.ColorPicker4("NamePlate Color###PlayerTrack_CategoryNamePlateColor_ColorPicker" + i, ref categoryNamePlateColor))
                    {
                        category.NamePlateColor = categoryNamePlateColor;
                        this.Plugin.CategoryService.SaveCategory(category);
                        this.plugin.NamePlateManager.ForceRedraw();
                    }

                    this.CategoryNamePlateColorSwatchRow(category, category.Id, 0, 8);
                    this.CategoryNamePlateColorSwatchRow(category, category.Id, 8, 16);
                    this.CategoryNamePlateColorSwatchRow(category, category.Id, 16, 24);
                    this.CategoryNamePlateColorSwatchRow(category, category.Id, 24, 32);
                    ImGui.EndPopup();
                }

                // visibility
                ImGui.NextColumn();
                if (!category.IsDefault)
                {
                    var visibilityType = (int)category.VisibilityType;
                    ImGui.SetNextItemWidth(-1);
                    if (ImGui.Combo(
                            "###PlayerTrack_SelectCategoryVisibilityType_Combo" + i,
                            ref visibilityType,
                            Enum.GetNames(typeof(VisibilityType)),
                            Enum.GetNames(typeof(VisibilityType)).Length))
                    {
                        category.VisibilityType = (VisibilityType)visibilityType;
                        this.Plugin.CategoryService.SaveCategory(category);
                        this.plugin.VisibilityService.SyncWithVisibility();
                    }

                    if (ImGui.IsItemHovered())
                    {
                        ImGui.BeginTooltip();
                        ImGui.PushTextWrapPos(ImGui.GetFontSize() * 35f);
                        ImGui.TextUnformatted(Loc.Localize("IsHiddenInVisibility", "void or whitelist players with visibility"));
                        ImGui.PopTextWrapPos();
                        ImGui.EndTooltip();
                    }
                }

                // category fcnamecolor
                ImGui.NextColumn();
                var overrideFCNameColor = category.OverrideFCNameColor;
                if (ImGui.Checkbox(
                        "###PlayerTrack_CategoryOverrideFCNameColor_Checkbox" + i,
                        ref overrideFCNameColor))
                {
                    category.OverrideFCNameColor = overrideFCNameColor;
                    this.Plugin.CategoryService.SaveCategory(category);
                    this.plugin.FCNameColorService.SyncWithFCNameColor();
                }

                if (ImGui.IsItemHovered())
                {
                    ImGui.BeginTooltip();
                    ImGui.PushTextWrapPos(ImGui.GetFontSize() * 35f);
                    ImGui.TextUnformatted(Loc.Localize(
                                              "CategoryFCNameColorOverride",
                                              "override fcnamecolor nameplate settings for this category by adding players to ignore list"));
                    ImGui.PopTextWrapPos();
                    ImGui.EndTooltip();
                }

                // category actions
                ImGui.NextColumn();
                if (category.Rank != 0)
                {
                    if (ImGuiComponents.IconButton(category.Id + 1, FontAwesomeIcon.ArrowUp))
                    {
                        this.Plugin.CategoryService.IncreaseCategoryRank(category.Id);
                    }

                    ImGui.SameLine();
                }

                if (category.Rank != this.Plugin.CategoryService.MaxRank())
                {
                    if (ImGuiComponents.IconButton(category.Id + 2, FontAwesomeIcon.ArrowDown))
                    {
                        this.Plugin.CategoryService.DecreaseCategoryRank(category.Id);
                    }

                    ImGui.SameLine();
                }

                if (ImGuiComponents.IconButton(category.Id, FontAwesomeIcon.Redo))
                {
                    category.Reset();
                    this.Plugin.CategoryService.SaveCategory(category);
                }

                ImGui.SameLine();

                if (!category.IsDefault)
                {
                    if (ImGuiComponents.IconButton(category.Id + 3, FontAwesomeIcon.Trash))
                    {
                        this.Plugin.CategoryService.DeleteCategory(category.Id);
                    }
                }

                ImGui.NextColumn();
            }

            ImGui.Separator();
        }