From e59110cd2b931d7bc4beabe0f18684aba87c1a19 Mon Sep 17 00:00:00 2001 From: ksh Date: Sat, 19 Jun 2021 21:07:01 +0900 Subject: [PATCH] UI font setting (#18) * UI font setting * Fix detecting Bozja & Zadnor SK & CE * update languages --- Data/DcLang-Japanese.txt | 3 + Data/DcLang-Korean(Actoz).txt | 3 + Data/DcLang-Korean(Test).txt | 3 + DcConfig.cs | 11 +++- DcContent.cs | 9 +++ DcControl.cs | 2 + DutyContent.csproj | 1 + Resources/mesg.txt | 3 + Tab/ConfigForm.Designer.cs | 90 ++++++++++++++++++++--------- Tab/ConfigForm.cs | 33 +++++++++++ Tab/DutyForm.cs | 105 ++++++++++++++++++++++++---------- ThirdParty/FontUtilities.cs | 29 ++++++++++ 12 files changed, 234 insertions(+), 58 deletions(-) create mode 100644 ThirdParty/FontUtilities.cs diff --git a/Data/DcLang-Japanese.txt b/Data/DcLang-Japanese.txt index c21b917..811c643 100644 --- a/Data/DcLang-Japanese.txt +++ b/Data/DcLang-Japanese.txt @@ -48,6 +48,8 @@ LANG=日本語 207=新たなアップデートがあります! {0} → {1} 208=プラグインのウェブサイトでダウンロードしてください 209=https://github.com/kshman/DutyContent/releases/latest +210=UIフォント +211=バージョン: {0} / {1} 300=コンテンツ 301=コンテンツ @@ -112,3 +114,4 @@ LANG=日本語 10022=このパゲットデータを使いますか?セーブします 10023=選択 10024=コッピー +10025=地役: {0} diff --git a/Data/DcLang-Korean(Actoz).txt b/Data/DcLang-Korean(Actoz).txt index b02ec9d..b3afab2 100644 --- a/Data/DcLang-Korean(Actoz).txt +++ b/Data/DcLang-Korean(Actoz).txt @@ -48,6 +48,8 @@ LANG=한국어(액토즈) 207=새 업데이트가 있습니다! {0} -> {1} 208=플러그인 웹사이트에서 받으세요. 209=https://github.com/kshman/DutyContent/releases/latest +210=UI 글꼴 +211=버전: {0} / {1} 300=임무 301=콘텐츠 @@ -112,3 +114,4 @@ LANG=한국어(액토즈) 10022=패킷 데이터를 적용하고 덮어쓰실거예요? 10023=선택함 10024=복사함 +10025=지역: {0} diff --git a/Data/DcLang-Korean(Test).txt b/Data/DcLang-Korean(Test).txt index b82a0f5..dca189a 100644 --- a/Data/DcLang-Korean(Test).txt +++ b/Data/DcLang-Korean(Test).txt @@ -48,6 +48,8 @@ LANG=한국어 207=새 업데이트가 있습니다! {0} -> {1} 208=플러그인 웹사이트에서 받으세요. 209=https://github.com/kshman/DutyContent/releases/latest +210=UI 글꼴 +211=버전: {0} / {1} 300=듀티 301=콘텐츠 @@ -112,3 +114,4 @@ LANG=한국어 10022=패킷 데이터를 적용하고 덮어쓰실거예요? 10023=선택함 10024=카피함 +10025=지역: {0} diff --git a/DcConfig.cs b/DcConfig.cs index 66dc4b0..59a72a5 100644 --- a/DcConfig.cs +++ b/DcConfig.cs @@ -3,18 +3,16 @@ using System.Collections.Generic; using System.Diagnostics; using System.Drawing; using System.IO; -using System.Linq; using System.Net; using System.Net.Sockets; using System.Runtime.InteropServices; using System.Text; -using System.Threading.Tasks; namespace DutyContent { class DcConfig { - public static int PluginTag => 10; + public static int PluginTag => 11; public static Version PluginVersion => System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; public static bool PluginEnable { get; set; } @@ -32,7 +30,12 @@ namespace DutyContent // public static string Language { get; set; } = ""; public static bool DataRemoteUpdate { get; set; } = true; // true = use remote update + public static string UiFontFamily { get; set; } = "Microsoft Sans Serif"; + // Microsoft Sans Serif / SegoUI + // GoyangIlsan R / Dotum / Malgun + // Bitstream Vera Sans Mono / Consolas + // public static string BuildDataFileName(string header, string context, string ext) { return Path.Combine(DataPath, $"{header}-{context}.{ext}"); @@ -70,6 +73,7 @@ namespace DutyContent sw.WriteLine("# config"); sw.WriteLine("Language={0}", Language); sw.WriteLine("DataRemoteUpdate={0}", DataRemoteUpdate); + sw.WriteLine("UiFontFamily={0}", UiFontFamily); sw.WriteLine(); Duty.InternalSaveStream(sw); @@ -89,6 +93,7 @@ namespace DutyContent Language = db["Language"]; DataRemoteUpdate = ThirdParty.Converter.ToBool(db["DataRemoteUpdate"], DataRemoteUpdate); + UiFontFamily = db.Get("UiFontFamily", UiFontFamily); Duty.InternalReadFromDb(db); } diff --git a/DcContent.cs b/DcContent.cs index 39db283..5ee26f4 100644 --- a/DcContent.cs +++ b/DcContent.cs @@ -257,5 +257,14 @@ namespace DutyContent Delubrum, Zadnor, } + + // + public static int SaveTheQueenTypeToCeBase(SaveTheQueenType stq) + { + return + stq == SaveTheQueenType.Bozja ? 30000 : + stq == SaveTheQueenType.Zadnor ? 30100 : + 30100; // fail safe + } } } diff --git a/DcControl.cs b/DcControl.cs index fd52aeb..4910e58 100644 --- a/DcControl.cs +++ b/DcControl.cs @@ -346,6 +346,8 @@ namespace DutyContent // public void UpdateUiLocale() { + ThirdParty.FontUtilities.SimpleChangeFont(this, DcConfig.UiFontFamily, true); + _act_label.Text = MesgLog.Text(1); // Duty ready _act_tab.Text = MesgLog.Text(0); // FFXIV dc diff --git a/DutyContent.csproj b/DutyContent.csproj index a7800d9..90f347d 100644 --- a/DutyContent.csproj +++ b/DutyContent.csproj @@ -108,6 +108,7 @@ UpdateNotifyForm.cs + diff --git a/Resources/mesg.txt b/Resources/mesg.txt index f339554..e25f5b8 100644 --- a/Resources/mesg.txt +++ b/Resources/mesg.txt @@ -48,6 +48,8 @@ LANG=English 207=New update found! {0} -> {1} 208=Visit DutyContent plugin repository for download. 209=https://github.com/kshman/DutyContent/releases/latest +210=UI Font +211=Version: {0} / {1} 300=Duty 301=Contents @@ -112,3 +114,4 @@ LANG=English 10022=Apply and overwrite packet data? 10023=Selected 10024=Copied +10025=Area: {0} diff --git a/Tab/ConfigForm.Designer.cs b/Tab/ConfigForm.Designer.cs index 84ba458..99000d0 100644 --- a/Tab/ConfigForm.Designer.cs +++ b/Tab/ConfigForm.Designer.cs @@ -29,37 +29,63 @@ namespace DutyContent.Tab /// private void InitializeComponent() { - this.panel1 = new System.Windows.Forms.Panel(); + this.pnlBase = new System.Windows.Forms.Panel(); + this.btnUiFont = new System.Windows.Forms.Button(); + this.lblUiFont = new System.Windows.Forms.Label(); this.rdoDataUpdateRemote = new System.Windows.Forms.RadioButton(); this.rdoDataUpdateLocal = new System.Windows.Forms.RadioButton(); this.lblDataUpdate = new System.Windows.Forms.Label(); this.lblCurrentLang = new System.Windows.Forms.Label(); this.cboDispLang = new System.Windows.Forms.ComboBox(); this.lblDispLang = new System.Windows.Forms.Label(); - this.panel1.SuspendLayout(); + this.lblTag = new System.Windows.Forms.Label(); + this.pnlBase.SuspendLayout(); this.SuspendLayout(); // - // panel1 + // pnlBase // - this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + this.pnlBase.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.panel1.Controls.Add(this.rdoDataUpdateRemote); - this.panel1.Controls.Add(this.rdoDataUpdateLocal); - this.panel1.Controls.Add(this.lblDataUpdate); - this.panel1.Controls.Add(this.lblCurrentLang); - this.panel1.Controls.Add(this.cboDispLang); - this.panel1.Controls.Add(this.lblDispLang); - this.panel1.Location = new System.Drawing.Point(12, 12); - this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(776, 158); - this.panel1.TabIndex = 0; + this.pnlBase.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.pnlBase.Controls.Add(this.lblTag); + this.pnlBase.Controls.Add(this.btnUiFont); + this.pnlBase.Controls.Add(this.lblUiFont); + this.pnlBase.Controls.Add(this.rdoDataUpdateRemote); + this.pnlBase.Controls.Add(this.rdoDataUpdateLocal); + this.pnlBase.Controls.Add(this.lblDataUpdate); + this.pnlBase.Controls.Add(this.lblCurrentLang); + this.pnlBase.Controls.Add(this.cboDispLang); + this.pnlBase.Controls.Add(this.lblDispLang); + this.pnlBase.Location = new System.Drawing.Point(12, 12); + this.pnlBase.Name = "pnlBase"; + this.pnlBase.Size = new System.Drawing.Size(776, 296); + this.pnlBase.TabIndex = 0; + // + // btnUiFont + // + this.btnUiFont.Location = new System.Drawing.Point(251, 165); + this.btnUiFont.Name = "btnUiFont"; + this.btnUiFont.Size = new System.Drawing.Size(217, 38); + this.btnUiFont.TabIndex = 9; + this.btnUiFont.Text = "button1"; + this.btnUiFont.UseVisualStyleBackColor = true; + this.btnUiFont.Click += new System.EventHandler(this.BtnUiFont_Click); + // + // lblUiFont + // + this.lblUiFont.AutoSize = true; + this.lblUiFont.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblUiFont.Location = new System.Drawing.Point(12, 165); + this.lblUiFont.Name = "lblUiFont"; + this.lblUiFont.Size = new System.Drawing.Size(39, 20); + this.lblUiFont.TabIndex = 8; + this.lblUiFont.Text = "210"; // // rdoDataUpdateRemote // this.rdoDataUpdateRemote.AutoSize = true; this.rdoDataUpdateRemote.Checked = true; - this.rdoDataUpdateRemote.Location = new System.Drawing.Point(251, 80); + this.rdoDataUpdateRemote.Location = new System.Drawing.Point(251, 110); this.rdoDataUpdateRemote.Name = "rdoDataUpdateRemote"; this.rdoDataUpdateRemote.Size = new System.Drawing.Size(43, 17); this.rdoDataUpdateRemote.TabIndex = 7; @@ -71,7 +97,7 @@ namespace DutyContent.Tab // rdoDataUpdateLocal // this.rdoDataUpdateLocal.AutoSize = true; - this.rdoDataUpdateLocal.Location = new System.Drawing.Point(251, 57); + this.rdoDataUpdateLocal.Location = new System.Drawing.Point(251, 87); this.rdoDataUpdateLocal.Name = "rdoDataUpdateLocal"; this.rdoDataUpdateLocal.Size = new System.Drawing.Size(43, 17); this.rdoDataUpdateLocal.TabIndex = 6; @@ -83,15 +109,15 @@ namespace DutyContent.Tab // this.lblDataUpdate.AutoSize = true; this.lblDataUpdate.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lblDataUpdate.Location = new System.Drawing.Point(12, 54); + this.lblDataUpdate.Location = new System.Drawing.Point(12, 84); this.lblDataUpdate.Name = "lblDataUpdate"; this.lblDataUpdate.Size = new System.Drawing.Size(39, 20); this.lblDataUpdate.TabIndex = 5; - this.lblDataUpdate.Text = "201"; + this.lblDataUpdate.Text = "203"; // // lblCurrentLang // - this.lblCurrentLang.Location = new System.Drawing.Point(318, 37); + this.lblCurrentLang.Location = new System.Drawing.Point(318, 67); this.lblCurrentLang.Name = "lblCurrentLang"; this.lblCurrentLang.Size = new System.Drawing.Size(150, 15); this.lblCurrentLang.TabIndex = 4; @@ -102,7 +128,7 @@ namespace DutyContent.Tab // this.cboDispLang.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cboDispLang.FormattingEnabled = true; - this.cboDispLang.Location = new System.Drawing.Point(251, 13); + this.cboDispLang.Location = new System.Drawing.Point(251, 43); this.cboDispLang.Name = "cboDispLang"; this.cboDispLang.Size = new System.Drawing.Size(217, 21); this.cboDispLang.TabIndex = 1; @@ -112,35 +138,47 @@ namespace DutyContent.Tab // this.lblDispLang.AutoSize = true; this.lblDispLang.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lblDispLang.Location = new System.Drawing.Point(12, 11); + this.lblDispLang.Location = new System.Drawing.Point(12, 41); this.lblDispLang.Name = "lblDispLang"; this.lblDispLang.Size = new System.Drawing.Size(39, 20); this.lblDispLang.TabIndex = 0; this.lblDispLang.Text = "201"; // + // lblTag + // + this.lblTag.AutoSize = true; + this.lblTag.Location = new System.Drawing.Point(27, 4); + this.lblTag.Name = "lblTag"; + this.lblTag.Size = new System.Drawing.Size(35, 13); + this.lblTag.TabIndex = 10; + this.lblTag.Text = "label1"; + // // ConfigForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScroll = true; this.ClientSize = new System.Drawing.Size(800, 450); - this.Controls.Add(this.panel1); + this.Controls.Add(this.pnlBase); this.Name = "ConfigForm"; this.Text = "Config"; - this.panel1.ResumeLayout(false); - this.panel1.PerformLayout(); + this.pnlBase.ResumeLayout(false); + this.pnlBase.PerformLayout(); this.ResumeLayout(false); } #endregion - private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.Panel pnlBase; private System.Windows.Forms.Label lblDispLang; private System.Windows.Forms.ComboBox cboDispLang; private System.Windows.Forms.Label lblCurrentLang; private System.Windows.Forms.RadioButton rdoDataUpdateRemote; private System.Windows.Forms.RadioButton rdoDataUpdateLocal; private System.Windows.Forms.Label lblDataUpdate; + private System.Windows.Forms.Button btnUiFont; + private System.Windows.Forms.Label lblUiFont; + private System.Windows.Forms.Label lblTag; } } \ No newline at end of file diff --git a/Tab/ConfigForm.cs b/Tab/ConfigForm.cs index a0b1a0e..160102f 100644 --- a/Tab/ConfigForm.cs +++ b/Tab/ConfigForm.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Drawing; using System.IO; using System.Threading; using System.Threading.Tasks; @@ -64,6 +65,11 @@ namespace DutyContent.Tab lblDataUpdate.Text = MesgLog.Text(203); rdoDataUpdateLocal.Text = MesgLog.Text(204); rdoDataUpdateRemote.Text = MesgLog.Text(205); + + lblUiFont.Text = MesgLog.Text(210); + btnUiFont.Text = DcConfig.UiFontFamily; + + lblTag.Text = MesgLog.Text(211, DcConfig.PluginTag, DcConfig.PluginVersion); } public static List MakeConfigLangList() @@ -134,5 +140,32 @@ namespace DutyContent.Tab { InternalDataUpdate(true); } + + private void BtnUiFont_Click(object sender, EventArgs e) + { + Font ret = (Font)WorkerAct.Invoker(new WorkerAct.ObjectReturnerDelegate(() => + { + FontDialog dg = new FontDialog + { + Font = btnUiFont.Font, + FontMustExist = true, + AllowVerticalFonts = false, + AllowVectorFonts = false, + ShowColor = false, + ShowEffects = false, + MaxSize = 12, + MinSize = 12, + }; + + return dg.ShowDialog() == DialogResult.OK ? dg.Font : null; + })); + + if (ret != null) + { + DcConfig.UiFontFamily = ret.Name; + DcControl.Self.UpdateUiLocale(); + DcConfig.SaveConfig(); + } + } } } diff --git a/Tab/DutyForm.cs b/Tab/DutyForm.cs index 50d4a04..651993c 100644 --- a/Tab/DutyForm.cs +++ b/Tab/DutyForm.cs @@ -9,8 +9,6 @@ using System.Net; using System.Net.Http; using System.Text; using System.IO; -using System.Runtime.InteropServices; -using System.Collections.Specialized; namespace DutyContent.Tab { @@ -21,12 +19,16 @@ namespace DutyContent.Tab // private bool _is_lock_fate; + + private short _last_fate = 0; + + // private bool _is_packet_finder; private DcContent.SaveTheQueenType _stq_type = DcContent.SaveTheQueenType.No; private DcConfig.PacketConfig _new_packet; - + + // private Dictionary _packet_list = new Dictionary(); - //private OrderedDictionary _packet_list = new OrderedDictionary(); // private Overlay.DutyOvForm _overlay; @@ -54,10 +56,6 @@ namespace DutyContent.Tab RefreshDatasetList(); RefreshPacketList(); - // - var font = new Font(DcConfig.Duty.LogFontFamily, DcConfig.Duty.LogFontSize, FontStyle.Regular, GraphicsUnit.Point); - txtContentLog.Font = font; - btnLogFont.Font = font; btnLogFont.Text = $"{DcConfig.Duty.LogFontFamily}, {DcConfig.Duty.LogFontSize}"; // @@ -179,6 +177,11 @@ namespace DutyContent.Tab btnPacketStart.Text = MesgLog.Text(10007); btnPacketApply.Text = MesgLog.Text(10009); + + // + var logfont = new Font(DcConfig.Duty.LogFontFamily, DcConfig.Duty.LogFontSize, FontStyle.Regular); + txtContentLog.Font = logfont; + btnLogFont.Font = logfont; } public void PacketHandler(string pid, byte[] message) @@ -220,6 +223,8 @@ namespace DutyContent.Tab NotifyFate(fate); _overlay.PlayFate(fate); } + + _last_fate = (short)fcode; } } else if (chkShowDebug.Checked && data[0] == 62 && data[8] > 0) // more than 0% @@ -231,6 +236,8 @@ namespace DutyContent.Tab var fate = DcContent.TryFate(fcode); if (fate == null) LogDebug("unknown fate {0}% \"{1}\"", data[8], fcode); + + _last_fate = (short)fcode; } } } @@ -328,12 +335,17 @@ namespace DutyContent.Tab // 10[1] status 0=end, 1=register, 2=entry, 3=progress // 12[1] progress percentage - var stq = - _stq_type == DcContent.SaveTheQueenType.Bozja ? 30000 : - _stq_type == DcContent.SaveTheQueenType.Zadnor ? 30100 : - 30100; // temporary + if (_stq_type == DcContent.SaveTheQueenType.No) + { + if (IsFateForSouthernBozja(_last_fate)) + _stq_type = DcContent.SaveTheQueenType.Bozja; + else if (IsFateForZadnor(_last_fate)) + _stq_type = DcContent.SaveTheQueenType.Zadnor; + else + _stq_type = DcContent.SaveTheQueenType.Zadnor; + } - var ce = stq + data[8]; + var ce = data[8] + DcContent.SaveTheQueenTypeToCeBase(_stq_type); var stat = data[10]; if (stat == 0 /* || data[10] == 3 */) @@ -381,8 +393,10 @@ namespace DutyContent.Tab (zone_id == 921) ? DcContent.SaveTheQueenType.Zadnor : DcContent.SaveTheQueenType.No; + LogInstance(10025, zone_name); + if (chkShowDebug.Checked) - LogDebug("Zone: {0} \"{1}\"", zone_id, zone_name); + LogDebug("Zone: {0}", zone_id); } // @@ -1099,9 +1113,9 @@ namespace DutyContent.Tab _is_packet_finder = false; PacketFinderResetUi(false); - // is this good idea? - // no bad idea - //cboPacketset.SelectedIndex = 0; + // select custom + DcConfig.Duty.PacketSet = DcConfig.PacketConfig.DefaultSetNameCustom; + RefreshPacketList(); } } @@ -1130,8 +1144,6 @@ namespace DutyContent.Tab if (lstPacketInfo.SelectedIndices.Count != 1) return; - //MesgLog.Write("double clicked: {0}", lstPacketInfo.SelectedIndices[0]); - var v = int.MaxValue; switch (lstPacketInfo.SelectedIndices[0]) @@ -1182,25 +1194,52 @@ namespace DutyContent.Tab } - private static readonly short[] _packet_target_fates = + // middle la noscea + private static readonly short[] _fates_middle_la_noscea = { - // middle la noscea 553, 649, 687, 688, 693, 717, 220, 221, 222, 223, 225, 226, 227, 229, 231, 233, 235, 237, 238, 239, 240, 1387, + }; - // southern bozja front + // southern bozja front + private static readonly short[] _fates_southern_bojza = + { 1597, 1598, 1599, 1600, 1601, 1602, 1603, 1604, 1605, 1606, 1607, 1608, 1609, 1610, 1611, 1612, 1613, 1614, 1615, 1616, 1617, 1618, 1619, 1620, 1621, 1622, 1623, 1624, 1625, 1626, 1627, 1628, + }; - // zadnor + // zadnor + private static readonly short[] _fates_zadnor = + { 1717, 1718, 1719, 1720, 1721, 1722, 1723, 1724, 1725, 1726, 1727, 1728, 1729, 1730, 1731, 1732, 1733, 1734, 1735, 1736, 1737, 1738, 1739, 1740, 1741, 1742, }; + // + private bool IsFateInFindList(short code) + { + return + _fates_middle_la_noscea.Contains(code) || + _fates_southern_bojza.Contains(code) || + _fates_zadnor.Contains(code); + } + + // + private bool IsFateForSouthernBozja(short code) + { + return _fates_southern_bojza.Contains(code); + } + + // + private bool IsFateForZadnor(short code) + { + return _fates_zadnor.Contains(code); + } + // private void PacketFinderHandler(byte[] message) { @@ -1211,7 +1250,7 @@ namespace DutyContent.Tab if (_new_packet.OpFate == 0 && data.Length > 4 && data[0] == 0x3E) { var cc = BitConverter.ToInt16(data, 4); - if (_packet_target_fates.Contains(cc) && _new_packet.OpFate != opcode) + if (IsFateInFindList(cc) && _new_packet.OpFate != opcode) { _new_packet.OpFate = opcode; @@ -1221,6 +1260,8 @@ namespace DutyContent.Tab lstPacketInfo.Items[0].SubItems[3].Text = _new_packet.OpFate.ToString(); }); + _last_fate = cc; + return; } } @@ -1343,11 +1384,17 @@ namespace DutyContent.Tab if (ok) { - var stq = - _stq_type == DcContent.SaveTheQueenType.Bozja ? 30000 : - _stq_type == DcContent.SaveTheQueenType.Zadnor ? 30100 : - 30100; // temporary - var ce = DcContent.GetFate(code + stq); + if (_stq_type == DcContent.SaveTheQueenType.No) + { + if (IsFateForSouthernBozja(_last_fate)) + _stq_type = DcContent.SaveTheQueenType.Bozja; + else if (IsFateForZadnor(_last_fate)) + _stq_type = DcContent.SaveTheQueenType.Zadnor; + else + _stq_type = DcContent.SaveTheQueenType.Zadnor; + } + + var ce = DcContent.GetFate(code + DcContent.SaveTheQueenTypeToCeBase(_stq_type)); var li = new ListViewItem(new string[] { diff --git a/ThirdParty/FontUtilities.cs b/ThirdParty/FontUtilities.cs new file mode 100644 index 0000000..5ecb1e4 --- /dev/null +++ b/ThirdParty/FontUtilities.cs @@ -0,0 +1,29 @@ +using System.Drawing; +using System.Windows.Forms; + +namespace DutyContent.ThirdParty +{ + // https://www.codeproject.com/Questions/1080006/How-can-change-application-font-in-runtime + + public static class FontUtilities + { + public static void SimpleChangeFont(Control ctrl, string fontname, bool recursive = false) + { + ctrl.Font = new Font(fontname, ctrl.Font.Size, ctrl.Font.Style, GraphicsUnit.Point); + + if (recursive) + InternalRecursiveChangeFont(fontname, ctrl.Controls); + } + + private static void InternalRecursiveChangeFont(string fontname, Control.ControlCollection ctrls) + { + foreach (Control c in ctrls) + { + c.Font = new Font(fontname, c.Font.Size, c.Font.Style, GraphicsUnit.Point); + + if (c.Controls.Count > 0) + InternalRecursiveChangeFont(fontname, c.Controls); + } + } + } +}