From c15da7721a219da3a45069a4f68c337984bebe79 Mon Sep 17 00:00:00 2001 From: Anna Clemens Date: Sun, 6 Feb 2022 16:45:19 -0500 Subject: [PATCH] feat: add vanilla presets --- ChatTwo/Resources/Language.Designer.cs | 36 +++++++++++++ ChatTwo/Resources/Language.resx | 12 +++++ ChatTwo/Ui/SettingsTabs/Tabs.cs | 22 +++++++- ChatTwo/Util/TabsUtil.cs | 75 ++++++++++++++++++++++++++ 4 files changed, 144 insertions(+), 1 deletion(-) create mode 100755 ChatTwo/Util/TabsUtil.cs diff --git a/ChatTwo/Resources/Language.Designer.cs b/ChatTwo/Resources/Language.Designer.cs index a769ad2..3a79a33 100755 --- a/ChatTwo/Resources/Language.Designer.cs +++ b/ChatTwo/Resources/Language.Designer.cs @@ -618,6 +618,15 @@ namespace ChatTwo.Resources { } } + /// + /// Looks up a localized string similar to New tab. + /// + internal static string Options_Tabs_NewTab { + get { + return ResourceManager.GetString("Options_Tabs_NewTab", resourceCulture); + } + } + /// /// Looks up a localized string similar to <None>. /// @@ -627,6 +636,15 @@ namespace ChatTwo.Resources { } } + /// + /// Looks up a localized string similar to Preset: {0}. + /// + internal static string Options_Tabs_Preset { + get { + return ResourceManager.GetString("Options_Tabs_Preset", resourceCulture); + } + } + /// /// Looks up a localized string similar to Show timestamps. /// @@ -717,6 +735,24 @@ namespace ChatTwo.Resources { } } + /// + /// Looks up a localized string similar to Event. + /// + internal static string Tabs_Presets_Event { + get { + return ResourceManager.GetString("Tabs_Presets_Event", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to General. + /// + internal static string Tabs_Presets_General { + get { + return ResourceManager.GetString("Tabs_Presets_General", resourceCulture); + } + } + /// /// Looks up a localized string similar to All. /// diff --git a/ChatTwo/Resources/Language.resx b/ChatTwo/Resources/Language.resx index 83c455e..99a83b7 100755 --- a/ChatTwo/Resources/Language.resx +++ b/ChatTwo/Resources/Language.resx @@ -359,4 +359,16 @@ Hide {0} when you are not logged in to a character. + + General + + + Preset: {0} + + + Event + + + New tab + diff --git a/ChatTwo/Ui/SettingsTabs/Tabs.cs b/ChatTwo/Ui/SettingsTabs/Tabs.cs index 73b238f..cb4a9ad 100755 --- a/ChatTwo/Ui/SettingsTabs/Tabs.cs +++ b/ChatTwo/Ui/SettingsTabs/Tabs.cs @@ -16,8 +16,28 @@ internal sealed class Tabs : ISettingsTab { } public void Draw() { + const string addTabPopup = "add-tab-popup"; + if (ImGuiUtil.IconButton(FontAwesomeIcon.Plus, tooltip: Language.Options_Tabs_Add)) { - this.Mutable.Tabs.Add(new Tab()); + ImGui.OpenPopup(addTabPopup); + } + + if (ImGui.BeginPopup(addTabPopup)) { + if (ImGui.Selectable(Language.Options_Tabs_NewTab)) { + this.Mutable.Tabs.Add(new Tab()); + } + + ImGui.Separator(); + + if (ImGui.Selectable(string.Format(Language.Options_Tabs_Preset, Language.Tabs_Presets_General))) { + this.Mutable.Tabs.Add(TabsUtil.VanillaGeneral); + } + + if (ImGui.Selectable(string.Format(Language.Options_Tabs_Preset, Language.Tabs_Presets_Event))) { + this.Mutable.Tabs.Add(TabsUtil.VanillaEvent); + } + + ImGui.EndPopup(); } var toRemove = -1; diff --git a/ChatTwo/Util/TabsUtil.cs b/ChatTwo/Util/TabsUtil.cs new file mode 100755 index 0000000..01ee4d0 --- /dev/null +++ b/ChatTwo/Util/TabsUtil.cs @@ -0,0 +1,75 @@ +using ChatTwo.Code; + +namespace ChatTwo.Util; + +internal static class TabsUtil { + internal static Tab VanillaGeneral => new() { + Name = "General", + ChatCodes = new Dictionary { + // Special + [ChatType.Debug] = ChatSourceExt.All, + [ChatType.Urgent] = ChatSourceExt.All, + [ChatType.Notice] = ChatSourceExt.All, + // Chat + [ChatType.Say] = ChatSourceExt.All, + [ChatType.Yell] = ChatSourceExt.All, + [ChatType.Shout] = ChatSourceExt.All, + [ChatType.TellIncoming] = ChatSourceExt.All, + [ChatType.TellOutgoing] = ChatSourceExt.All, + [ChatType.Party] = ChatSourceExt.All, + [ChatType.CrossParty] = ChatSourceExt.All, + [ChatType.Alliance] = ChatSourceExt.All, + [ChatType.FreeCompany] = ChatSourceExt.All, + [ChatType.PvpTeam] = ChatSourceExt.All, + [ChatType.CrossLinkshell1] = ChatSourceExt.All, + [ChatType.CrossLinkshell2] = ChatSourceExt.All, + [ChatType.CrossLinkshell3] = ChatSourceExt.All, + [ChatType.CrossLinkshell4] = ChatSourceExt.All, + [ChatType.CrossLinkshell5] = ChatSourceExt.All, + [ChatType.CrossLinkshell6] = ChatSourceExt.All, + [ChatType.CrossLinkshell7] = ChatSourceExt.All, + [ChatType.CrossLinkshell8] = ChatSourceExt.All, + [ChatType.Linkshell1] = ChatSourceExt.All, + [ChatType.Linkshell2] = ChatSourceExt.All, + [ChatType.Linkshell3] = ChatSourceExt.All, + [ChatType.Linkshell4] = ChatSourceExt.All, + [ChatType.Linkshell5] = ChatSourceExt.All, + [ChatType.Linkshell6] = ChatSourceExt.All, + [ChatType.Linkshell7] = ChatSourceExt.All, + [ChatType.Linkshell8] = ChatSourceExt.All, + [ChatType.NoviceNetwork] = ChatSourceExt.All, + [ChatType.StandardEmote] = ChatSourceExt.All, + [ChatType.CustomEmote] = ChatSourceExt.All, + // Announcements + [ChatType.System] = ChatSourceExt.All, + [ChatType.GatheringSystem] = ChatSourceExt.All, + [ChatType.Error] = ChatSourceExt.All, + [ChatType.Echo] = ChatSourceExt.All, + [ChatType.NoviceNetworkSystem] = ChatSourceExt.All, + [ChatType.FreeCompanyAnnouncement] = ChatSourceExt.All, + [ChatType.PvpTeamAnnouncement] = ChatSourceExt.All, + [ChatType.FreeCompanyLoginLogout] = ChatSourceExt.All, + [ChatType.PvpTeamLoginLogout] = ChatSourceExt.All, + [ChatType.RetainerSale] = ChatSourceExt.All, + [ChatType.NpcAnnouncement] = ChatSourceExt.All, + [ChatType.LootNotice] = ChatSourceExt.All, + [ChatType.Progress] = ChatSourceExt.All, + [ChatType.LootRoll] = ChatSourceExt.All, + [ChatType.Crafting] = ChatSourceExt.All, + [ChatType.Gathering] = ChatSource.Self, + [ChatType.PeriodicRecruitmentNotification] = ChatSourceExt.All, + [ChatType.Sign] = ChatSourceExt.All, + [ChatType.RandomNumber] = ChatSourceExt.All, + [ChatType.Orchestrion] = ChatSourceExt.All, + [ChatType.MessageBook] = ChatSourceExt.All, + [ChatType.Alarm] = ChatSourceExt.All, + }, + }; + + internal static Tab VanillaEvent => new() { + Name = "Event", + ChatCodes = new Dictionary { + [ChatType.NpcDialogue] = ChatSourceExt.All, + }, + }; +}