diff --git a/ChatTwo/Configuration.cs b/ChatTwo/Configuration.cs
index 768ed2d..65f3434 100755
--- a/ChatTwo/Configuration.cs
+++ b/ChatTwo/Configuration.cs
@@ -2,12 +2,15 @@
using ChatTwo.Resources;
using ChatTwo.Ui;
using Dalamud.Configuration;
+using Dalamud.Logging;
namespace ChatTwo;
[Serializable]
internal class Configuration : IPluginConfiguration {
- public int Version { get; set; } = 2;
+ private const int LatestVersion = 3;
+
+ public int Version { get; set; } = LatestVersion;
public bool HideChat = true;
public bool HideDuringCutscenes = true;
@@ -21,6 +24,8 @@ internal class Configuration : IPluginConfiguration {
public bool ShowTitleBar;
public float FontSize = 17f;
+ public float JapaneseFontSize = 17f;
+ public float SymbolsFontSize = 17f;
public string GlobalFont = Fonts.GlobalFonts[0].Name;
public string JapaneseFont = Fonts.JapaneseFonts[0].Item1;
@@ -40,6 +45,8 @@ internal class Configuration : IPluginConfiguration {
this.CanResize = other.CanResize;
this.ShowTitleBar = other.ShowTitleBar;
this.FontSize = other.FontSize;
+ this.JapaneseFontSize = other.JapaneseFontSize;
+ this.SymbolsFontSize = other.SymbolsFontSize;
this.GlobalFont = other.GlobalFont;
this.JapaneseFont = other.JapaneseFont;
this.WindowAlpha = other.WindowAlpha;
@@ -48,13 +55,28 @@ internal class Configuration : IPluginConfiguration {
}
public void Migrate() {
- if (this.Version == 1) {
- this.Version = 2;
+ while (this.Version < LatestVersion) {
+ switch (this.Version) {
+ case 1: {
+ this.Version = 2;
- foreach (var tab in this.Tabs) {
- #pragma warning disable CS0618
- tab.UnreadMode = tab.DisplayUnread ? UnreadMode.Unseen : UnreadMode.None;
- #pragma warning restore CS0618
+ foreach (var tab in this.Tabs) {
+ #pragma warning disable CS0618
+ tab.UnreadMode = tab.DisplayUnread ? UnreadMode.Unseen : UnreadMode.None;
+ #pragma warning restore CS0618
+ }
+
+ break;
+ }
+ case 2:
+ this.Version = 3;
+
+ this.JapaneseFontSize = this.FontSize;
+ this.SymbolsFontSize = this.FontSize;
+ break;
+ default:
+ PluginLog.Warning($"Couldn't migrate config version {this.Version}");
+ break;
}
}
}
diff --git a/ChatTwo/PluginUi.cs b/ChatTwo/PluginUi.cs
index 5b9f3d0..dc13fca 100755
--- a/ChatTwo/PluginUi.cs
+++ b/ChatTwo/PluginUi.cs
@@ -243,7 +243,7 @@ internal sealed class PluginUi : IDisposable {
ImGui.GetIO().Fonts.AddFontFromMemoryTTF(
this._jpFont.Item1.AddrOfPinnedObject(),
this._jpFont.Item2,
- this.Plugin.Config.FontSize,
+ this.Plugin.Config.JapaneseFontSize,
this._fontCfgMerge,
this._jpRange.AddrOfPinnedObject()
);
@@ -251,7 +251,7 @@ internal sealed class PluginUi : IDisposable {
ImGui.GetIO().Fonts.AddFontFromMemoryTTF(
this._gameSymFont.Item1.AddrOfPinnedObject(),
this._gameSymFont.Item2,
- this.Plugin.Config.FontSize,
+ this.Plugin.Config.SymbolsFontSize,
this._fontCfgMerge,
this._symRange.AddrOfPinnedObject()
);
@@ -268,7 +268,7 @@ internal sealed class PluginUi : IDisposable {
ImGui.GetIO().Fonts.AddFontFromMemoryTTF(
this._jpFont.Item1.AddrOfPinnedObject(),
this._jpFont.Item2,
- this.Plugin.Config.FontSize,
+ this.Plugin.Config.JapaneseFontSize,
this._fontCfgMerge,
this._jpRange.AddrOfPinnedObject()
);
@@ -276,7 +276,7 @@ internal sealed class PluginUi : IDisposable {
ImGui.GetIO().Fonts.AddFontFromMemoryTTF(
this._gameSymFont.Item1.AddrOfPinnedObject(),
this._gameSymFont.Item2,
- this.Plugin.Config.FontSize,
+ this.Plugin.Config.SymbolsFontSize,
this._fontCfgMerge,
this._symRange.AddrOfPinnedObject()
);
diff --git a/ChatTwo/Resources/Language.Designer.cs b/ChatTwo/Resources/Language.Designer.cs
index 02f0b53..0596099 100755
--- a/ChatTwo/Resources/Language.Designer.cs
+++ b/ChatTwo/Resources/Language.Designer.cs
@@ -294,6 +294,15 @@ namespace ChatTwo.Resources {
}
}
+ ///
+ /// Looks up a localized string similar to Fonts.
+ ///
+ internal static string Options_Fonts_Tab {
+ get {
+ return ResourceManager.GetString("Options_Fonts_Tab", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Font size.
///
@@ -357,6 +366,15 @@ namespace ChatTwo.Resources {
}
}
+ ///
+ /// Looks up a localized string similar to Japanese font size.
+ ///
+ internal static string Options_JapaneseFontSize_Name {
+ get {
+ return ResourceManager.GetString("Options_JapaneseFontSize_Name", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Reduce the spacing between messages..
///
@@ -456,6 +474,24 @@ namespace ChatTwo.Resources {
}
}
+ ///
+ /// Looks up a localized string similar to The font size to use for game symbols..
+ ///
+ internal static string Options_SymbolsFontSize_Description {
+ get {
+ return ResourceManager.GetString("Options_SymbolsFontSize_Description", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Symbols font size.
+ ///
+ internal static string Options_SymbolsFontSize_Name {
+ get {
+ return ResourceManager.GetString("Options_SymbolsFontSize_Name", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Add.
///
diff --git a/ChatTwo/Resources/Language.resx b/ChatTwo/Resources/Language.resx
index 1fe6ad0..3c1f6ff 100755
--- a/ChatTwo/Resources/Language.resx
+++ b/ChatTwo/Resources/Language.resx
@@ -338,4 +338,16 @@
Special
+
+ Fonts
+
+
+ Symbols font size
+
+
+ Japanese font size
+
+
+ The font size to use for game symbols.
+
diff --git a/ChatTwo/Ui/Settings.cs b/ChatTwo/Ui/Settings.cs
index caae27c..463de6e 100755
--- a/ChatTwo/Ui/Settings.cs
+++ b/ChatTwo/Ui/Settings.cs
@@ -21,6 +21,7 @@ internal sealed class Settings : IUiComponent {
this.Tabs = new List {
new Display(this.Mutable),
+ new Ui.SettingsTabs.Fonts(this.Mutable),
new ChatColours(this.Mutable, this.Ui.Plugin),
new Tabs(this.Mutable),
};
@@ -125,7 +126,9 @@ internal sealed class Settings : IUiComponent {
var hideChatChanged = this.Mutable.HideChat != this.Ui.Plugin.Config.HideChat;
var fontChanged = this.Mutable.GlobalFont != this.Ui.Plugin.Config.GlobalFont
|| this.Mutable.JapaneseFont != this.Ui.Plugin.Config.JapaneseFont;
- var fontSizeChanged = Math.Abs(this.Mutable.FontSize - this.Ui.Plugin.Config.FontSize) > 0.001;
+ var fontSizeChanged = Math.Abs(this.Mutable.FontSize - this.Ui.Plugin.Config.FontSize) > 0.001
+ || Math.Abs(this.Mutable.JapaneseFontSize - this.Ui.Plugin.Config.JapaneseFontSize) > 0.001
+ || Math.Abs(this.Mutable.SymbolsFontSize - this.Ui.Plugin.Config.SymbolsFontSize) > 0.001;
config.UpdateFrom(this.Mutable);
diff --git a/ChatTwo/Ui/SettingsTabs/Display.cs b/ChatTwo/Ui/SettingsTabs/Display.cs
index bd9e49d..ff4c618 100755
--- a/ChatTwo/Ui/SettingsTabs/Display.cs
+++ b/ChatTwo/Ui/SettingsTabs/Display.cs
@@ -6,26 +6,14 @@ namespace ChatTwo.Ui.SettingsTabs;
internal sealed class Display : ISettingsTab {
private Configuration Mutable { get; }
- private List Fonts { get; set; } = new();
- private List JpFonts { get; set; } = new();
public string Name => Language.Options_Display_Tab + "###tabs-display";
internal Display(Configuration mutable) {
this.Mutable = mutable;
- this.UpdateFonts();
- }
-
- private void UpdateFonts() {
- this.Fonts = Ui.Fonts.GetFonts();
- this.JpFonts = Ui.Fonts.GetJpFonts();
}
public void Draw() {
- if (ImGui.IsWindowAppearing()) {
- this.UpdateFonts();
- }
-
ImGui.PushTextWrapPos();
ImGuiUtil.OptionCheckbox(ref this.Mutable.HideChat, Language.Options_HideChat_Name, Language.Options_HideChat_Description);
@@ -53,66 +41,6 @@ internal sealed class Display : ISettingsTab {
ImGuiUtil.OptionCheckbox(ref this.Mutable.ShowNoviceNetwork, Language.Options_ShowNoviceNetwork_Name, Language.Options_ShowNoviceNetwork_Description);
ImGui.Spacing();
- if (ImGui.BeginCombo(Language.Options_Font_Name, this.Mutable.GlobalFont)) {
- foreach (var font in Ui.Fonts.GlobalFonts) {
- if (ImGui.Selectable(font.Name, this.Mutable.GlobalFont == font.Name)) {
- this.Mutable.GlobalFont = font.Name;
- }
-
- if (ImGui.IsWindowAppearing() && this.Mutable.GlobalFont == font.Name) {
- ImGui.SetScrollHereY(0.5f);
- }
- }
-
- ImGui.Separator();
-
- foreach (var name in this.Fonts) {
- if (ImGui.Selectable(name, this.Mutable.GlobalFont == name)) {
- this.Mutable.GlobalFont = name;
- }
-
- if (ImGui.IsWindowAppearing() && this.Mutable.GlobalFont == name) {
- ImGui.SetScrollHereY(0.5f);
- }
- }
-
- ImGui.EndCombo();
- }
-
- ImGuiUtil.HelpText(Language.Options_Font_Description);
- ImGuiUtil.WarningText(Language.Options_Font_Warning);
- ImGui.Spacing();
-
- if (ImGui.BeginCombo(Language.Options_JapaneseFont_Name, this.Mutable.JapaneseFont)) {
- foreach (var (name, _) in Ui.Fonts.JapaneseFonts) {
- if (ImGui.Selectable(name, this.Mutable.JapaneseFont == name)) {
- this.Mutable.JapaneseFont = name;
- }
-
- if (ImGui.IsWindowAppearing() && this.Mutable.JapaneseFont == name) {
- ImGui.SetScrollHereY(0.5f);
- }
- }
-
- // ImGui.Separator();
- //
- // foreach (var family in this.JpFonts) {
- // if (ImGui.Selectable(family, this.Mutable.JapaneseFont == family)) {
- // this.Mutable.JapaneseFont = family;
- // }
- //
- // if (ImGui.IsWindowAppearing() && this.Mutable.JapaneseFont == family) {
- // ImGui.SetScrollHereY(0.5f);
- // }
- // }
-
- ImGui.EndCombo();
- }
-
- ImGuiUtil.HelpText(Language.Options_JapaneseFont_Description);
- ImGui.Spacing();
-
- ImGui.DragFloat(Language.Options_FontSize_Name, ref this.Mutable.FontSize, .0125f, 12f, 36f, $"{this.Mutable.FontSize:N1}");
if (ImGui.DragFloat(Language.Options_WindowOpacity_Name, ref this.Mutable.WindowAlpha, .0025f, 0f, 1f, $"{this.Mutable.WindowAlpha * 100f:N2}%%")) {
switch (this.Mutable.WindowAlpha) {
case > 1f and <= 100f:
@@ -124,8 +52,6 @@ internal sealed class Display : ISettingsTab {
}
}
- ImGui.Spacing();
-
ImGuiUtil.OptionCheckbox(ref this.Mutable.CanMove, Language.Options_CanMove_Name);
ImGui.Spacing();
diff --git a/ChatTwo/Ui/SettingsTabs/Fonts.cs b/ChatTwo/Ui/SettingsTabs/Fonts.cs
new file mode 100755
index 0000000..48067c8
--- /dev/null
+++ b/ChatTwo/Ui/SettingsTabs/Fonts.cs
@@ -0,0 +1,100 @@
+using ChatTwo.Resources;
+using ChatTwo.Util;
+using ImGuiNET;
+
+namespace ChatTwo.Ui.SettingsTabs;
+
+public class Fonts : ISettingsTab {
+ private Configuration Mutable { get; }
+
+ public string Name => Language.Options_Fonts_Tab + "###tabs-fonts";
+ private List GlobalFonts { get; set; } = new();
+ private List JpFonts { get; set; } = new();
+
+ internal Fonts(Configuration mutable) {
+ this.Mutable = mutable;
+ this.UpdateFonts();
+ }
+
+ private void UpdateFonts() {
+ this.GlobalFonts = Ui.Fonts.GetFonts();
+ this.JpFonts = Ui.Fonts.GetJpFonts();
+ }
+
+ public void Draw() {
+ if (ImGui.IsWindowAppearing()) {
+ this.UpdateFonts();
+ }
+
+ ImGui.PushTextWrapPos();
+
+ if (ImGui.BeginCombo(Language.Options_Font_Name, this.Mutable.GlobalFont)) {
+ foreach (var font in Ui.Fonts.GlobalFonts) {
+ if (ImGui.Selectable(font.Name, this.Mutable.GlobalFont == font.Name)) {
+ this.Mutable.GlobalFont = font.Name;
+ }
+
+ if (ImGui.IsWindowAppearing() && this.Mutable.GlobalFont == font.Name) {
+ ImGui.SetScrollHereY(0.5f);
+ }
+ }
+
+ ImGui.Separator();
+
+ foreach (var name in this.GlobalFonts) {
+ if (ImGui.Selectable(name, this.Mutable.GlobalFont == name)) {
+ this.Mutable.GlobalFont = name;
+ }
+
+ if (ImGui.IsWindowAppearing() && this.Mutable.GlobalFont == name) {
+ ImGui.SetScrollHereY(0.5f);
+ }
+ }
+
+ ImGui.EndCombo();
+ }
+
+ ImGuiUtil.HelpText(Language.Options_Font_Description);
+ ImGuiUtil.WarningText(Language.Options_Font_Warning);
+ ImGui.Spacing();
+
+ if (ImGui.BeginCombo(Language.Options_JapaneseFont_Name, this.Mutable.JapaneseFont)) {
+ foreach (var (name, _) in Ui.Fonts.JapaneseFonts) {
+ if (ImGui.Selectable(name, this.Mutable.JapaneseFont == name)) {
+ this.Mutable.JapaneseFont = name;
+ }
+
+ if (ImGui.IsWindowAppearing() && this.Mutable.JapaneseFont == name) {
+ ImGui.SetScrollHereY(0.5f);
+ }
+ }
+
+ // ImGui.Separator();
+ //
+ // foreach (var family in this.JpFonts) {
+ // if (ImGui.Selectable(family, this.Mutable.JapaneseFont == family)) {
+ // this.Mutable.JapaneseFont = family;
+ // }
+ //
+ // if (ImGui.IsWindowAppearing() && this.Mutable.JapaneseFont == family) {
+ // ImGui.SetScrollHereY(0.5f);
+ // }
+ // }
+
+ ImGui.EndCombo();
+ }
+
+ ImGuiUtil.HelpText(Language.Options_JapaneseFont_Description);
+ ImGui.Spacing();
+
+ const float speed = .0125f;
+ const float min = 8f;
+ const float max = 36f;
+ ImGui.DragFloat(Language.Options_FontSize_Name, ref this.Mutable.FontSize, speed, min, max, $"{this.Mutable.FontSize:N1}");
+ ImGui.DragFloat(Language.Options_JapaneseFontSize_Name, ref this.Mutable.JapaneseFontSize, speed, min, max, $"{this.Mutable.JapaneseFontSize:N1}");
+ ImGui.DragFloat(Language.Options_SymbolsFontSize_Name, ref this.Mutable.SymbolsFontSize, speed, min, max, $"{this.Mutable.SymbolsFontSize:N1}");
+ ImGuiUtil.HelpText(Language.Options_SymbolsFontSize_Description);
+
+ ImGui.PopTextWrapPos();
+ }
+}