mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-26 22:10:21 +00:00
Simplify font logic
dont bother trycatching stuff that shouldn't fail
This commit is contained in:
parent
46640d48a3
commit
39d11f5f2f
12 changed files with 29 additions and 46 deletions
|
@ -22,7 +22,7 @@ namespace PKHeX.WinForms.Controls
|
|||
GB_CurrentMoves.Click += ClickMoves;
|
||||
GB_RelearnMoves.Click += ClickMoves;
|
||||
|
||||
TB_Nickname.Font = FontUtil.GetPKXFont(11);
|
||||
TB_Nickname.Font = FontUtil.GetPKXFont();
|
||||
TB_OT.Font = (Font)TB_Nickname.Font.Clone();
|
||||
TB_OTt2.Font = (Font)TB_Nickname.Font.Clone();
|
||||
|
||||
|
@ -312,7 +312,7 @@ namespace PKHeX.WinForms.Controls
|
|||
else
|
||||
{
|
||||
BTN_Shinytize.Text = Draw.ShinyUnicode;
|
||||
TB_Nickname.Font = TB_OT.Font = TB_OTt2.Font = FontUtil.GetPKXFont(11);
|
||||
TB_Nickname.Font = TB_OT.Font = TB_OTt2.Font = FontUtil.GetPKXFont();
|
||||
}
|
||||
|
||||
// Switch active gender labels to new if they are active.
|
||||
|
|
|
@ -62,7 +62,7 @@ namespace PKHeX.WinForms
|
|||
{
|
||||
SuspendLayout();
|
||||
ResumeLayout();
|
||||
Font font = !Main.Unicode ? Font : FontUtil.GetPKXFont((float)8.25);
|
||||
Font font = !Main.Unicode ? Font : FontUtil.GetPKXFont(8.25f);
|
||||
PB_QR.BackgroundImage = QRImageUtil.GetQRImageExtended(font, qr, icon, PB_QR.Width, PB_QR.Height, Lines, extraText);
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace PKHeX.WinForms
|
|||
if (raw != null)
|
||||
AddTrashEditing(raw.Length);
|
||||
|
||||
var f = FontUtil.GetPKXFont(12F);
|
||||
var f = FontUtil.GetPKXFont();
|
||||
AddCharEditing(f);
|
||||
TB_Text.MaxLength = TB_NN.MaxLength;
|
||||
TB_Text.Text = TB_NN.Text;
|
||||
|
|
|
@ -353,32 +353,24 @@ namespace PKHeX.WinForms
|
|||
|
||||
private static void TryAddPKMsFromSaveFilePath(ConcurrentBag<PKM> dbTemp, string file, string externalFilePrefix)
|
||||
{
|
||||
try
|
||||
var sav = SaveUtil.GetVariantSAV(file);
|
||||
if (sav == null)
|
||||
{
|
||||
var sav = SaveUtil.GetVariantSAV(file);
|
||||
if (sav == null)
|
||||
{
|
||||
Console.WriteLine("Unable to load SaveFile: " + file);
|
||||
return;
|
||||
}
|
||||
|
||||
var path = externalFilePrefix + Path.GetFileName(file);
|
||||
if (sav.HasBox)
|
||||
{
|
||||
foreach (var pk in sav.BoxData)
|
||||
addPKM(pk);
|
||||
}
|
||||
|
||||
void addPKM(PKM pk)
|
||||
{
|
||||
pk.Identifier = Path.Combine(path, pk.Identifier);
|
||||
dbTemp.Add(pk);
|
||||
}
|
||||
Console.WriteLine("Unable to load SaveFile: " + file);
|
||||
return;
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
var path = externalFilePrefix + Path.GetFileName(file);
|
||||
if (sav.HasBox)
|
||||
{
|
||||
Console.WriteLine("ERROR: Unable to load SaveFile: " + file);
|
||||
Console.WriteLine(ex.Message);
|
||||
foreach (var pk in sav.BoxData)
|
||||
addPKM(pk);
|
||||
}
|
||||
|
||||
void addPKM(PKM pk)
|
||||
{
|
||||
pk.Identifier = Path.Combine(path, pk.Identifier);
|
||||
dbTemp.Add(pk);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,8 +24,7 @@ namespace PKHeX.WinForms
|
|||
Setup();
|
||||
LB_DataEntry.SelectedIndex = 0;
|
||||
NUP_PartyIndex_ValueChanged(null, EventArgs.Empty);
|
||||
try { TB_Nickname.Font = TB_OT.Font = FontUtil.GetPKXFont(11); }
|
||||
catch (Exception e) { WinFormsUtil.Alert("Font loading failed...", e.ToString()); }
|
||||
TB_Nickname.Font = TB_OT.Font = FontUtil.GetPKXFont();
|
||||
editing = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace PKHeX.WinForms
|
|||
SetupComboBoxes();
|
||||
PopFavorite();
|
||||
PopFavorite();
|
||||
TB_FOT.Font = TB_FT1.Font = TB_FT2.Font = TB_FSay1.Font = TB_FSay2.Font = TB_FSay3.Font = TB_FSay4.Font = LB_Favorite.Font = FontUtil.GetPKXFont(11);
|
||||
TB_FOT.Font = TB_FT1.Font = TB_FT2.Font = TB_FSay1.Font = TB_FSay2.Font = TB_FSay3.Font = TB_FSay4.Font = LB_Favorite.Font = FontUtil.GetPKXFont();
|
||||
CB_Ability.InitializeBinding();
|
||||
|
||||
LB_Favorite.SelectedIndex = 0;
|
||||
|
|
|
@ -18,13 +18,9 @@ namespace PKHeX.WinForms
|
|||
SAV = (SAV6)(Origin = sav).Clone();
|
||||
if (Main.Unicode)
|
||||
{
|
||||
try
|
||||
{
|
||||
TB_OTName.Font = FontUtil.GetPKXFont(11);
|
||||
if (SAV is SAV6XY)
|
||||
TB_TRNick.Font = TB_OTName.Font;
|
||||
}
|
||||
catch (Exception e) { WinFormsUtil.Alert("Font loading failed...", e.ToString()); }
|
||||
TB_OTName.Font = FontUtil.GetPKXFont();
|
||||
if (SAV is SAV6XY)
|
||||
TB_TRNick.Font = TB_OTName.Font;
|
||||
}
|
||||
|
||||
B_MaxCash.Click += (sender, e) => MT_Money.Text = "9,999,999";
|
||||
|
|
|
@ -33,8 +33,7 @@ namespace PKHeX.WinForms
|
|||
|
||||
if (Main.Unicode)
|
||||
{
|
||||
try { TB_OTName.Font = FontUtil.GetPKXFont(11); }
|
||||
catch (Exception e) { WinFormsUtil.Alert("Font loading failed...", e.ToString()); }
|
||||
TB_OTName.Font = FontUtil.GetPKXFont();
|
||||
}
|
||||
|
||||
var cc = SAV.Festa.FestaCoins;
|
||||
|
|
|
@ -19,8 +19,7 @@ namespace PKHeX.WinForms
|
|||
Loading = true;
|
||||
if (Main.Unicode)
|
||||
{
|
||||
try { TB_OTName.Font = FontUtil.GetPKXFont(11); }
|
||||
catch (Exception e) { WinFormsUtil.Alert("Font loading failed...", e.ToString()); }
|
||||
TB_OTName.Font = FontUtil.GetPKXFont();
|
||||
}
|
||||
|
||||
B_MaxCash.Click += (sender, e) => MT_Money.Text = "9,999,999";
|
||||
|
|
|
@ -23,8 +23,7 @@ namespace PKHeX.WinForms
|
|||
|
||||
if (Main.Unicode)
|
||||
{
|
||||
try { TB_OTName.Font = TB_RivalName.Font = FontUtil.GetPKXFont(11); }
|
||||
catch (Exception e) { WinFormsUtil.Alert("Font loading failed...", e.ToString()); }
|
||||
TB_OTName.Font = TB_RivalName.Font = FontUtil.GetPKXFont();
|
||||
}
|
||||
|
||||
B_MaxCash.Click += (sender, e) => MT_Money.Text = "9,999,999";
|
||||
|
|
|
@ -18,8 +18,7 @@ namespace PKHeX.WinForms
|
|||
Loading = true;
|
||||
if (Main.Unicode)
|
||||
{
|
||||
try { TB_OTName.Font = FontUtil.GetPKXFont(11); }
|
||||
catch (Exception e) { WinFormsUtil.Alert("Font loading failed...", e.ToString()); }
|
||||
TB_OTName.Font = FontUtil.GetPKXFont();
|
||||
}
|
||||
|
||||
B_MaxCash.Click += (sender, e) => MT_Money.Text = SAV.MaxMoney.ToString();
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace PKHeX.WinForms
|
|||
CustomFonts.AddFontFile(g6path);
|
||||
}
|
||||
|
||||
public static Font GetPKXFont(float size)
|
||||
public static Font GetPKXFont(float size = 11f)
|
||||
{
|
||||
if (GeneratedFonts.TryGetValue(size, out var f))
|
||||
return f;
|
||||
|
|
Loading…
Reference in a new issue