looks like resize text if trimmed is finally working

This commit is contained in:
Asval
2019-11-05 22:37:21 +01:00
parent 83f7a38e43
commit 214952c2b9
4 changed files with 42 additions and 20 deletions

View File

@@ -178,7 +178,7 @@ namespace FModel.Forms
if (restart)
{
DarkMessageBox.Show("Please, restart FModel to apply your new path", "FModel Path Changed", MessageBoxButton.OK, MessageBoxImage.Information);
DarkMessageBox.Show("Please, restart FModel to apply your new path(s)", "FModel Path(s) Changed", MessageBoxButton.OK, MessageBoxImage.Information);
}
}

View File

@@ -4,6 +4,7 @@ using System;
using System.Globalization;
using System.IO;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using FProp = FModel.Properties.Settings;
@@ -259,20 +260,27 @@ namespace FModel.Methods.Assets.IconCreator.ChallengeID
#region DESCRIPTION
new UpdateMyConsole(entry.TheQuestDescription, CColors.ChallengeDescription).Append();
double size = 27;
FormattedText formattedText =
new FormattedText(
entry.TheQuestDescription,
CultureInfo.CurrentUICulture,
FlowDirection.LeftToRight,
typeface,
27,
size,
Brushes.White,
IconCreator.PPD
);
formattedText.TextAlignment = TextAlignment.Left;
formattedText.MaxTextWidth = 800;
formattedText.MaxLineCount = 1;
Point textLocation = new Point(60, y + 15);
while (formattedText.Width > 800)
{
size -= 1;
formattedText.SetFontSize(size);
}
IconCreator.ICDrawingContext.DrawText(formattedText, textLocation);
#endregion

View File

@@ -183,6 +183,7 @@ namespace FModel.Methods.Assets.IconCreator
private static void DrawDisplayName(string DisplayName)
{
Typeface typeface = new Typeface(TextsUtility.FBurbank, FontStyles.Normal, string.Equals(FProp.Default.FLanguage, "Japanese") ? FontWeights.Black : FontWeights.Normal, FontStretches.Normal);
double size = string.Equals(FProp.Default.FRarity_Design, "Flat") || string.Equals(FProp.Default.FRarity_Design, "Minimalist") ? 50 : 45;
FormattedText formattedText =
new FormattedText(
@@ -190,27 +191,31 @@ namespace FModel.Methods.Assets.IconCreator
CultureInfo.CurrentUICulture,
FlowDirection.LeftToRight,
typeface,
string.Equals(FProp.Default.FRarity_Design, "Flat") || string.Equals(FProp.Default.FRarity_Design, "Minimalist") ? 50 : 45,
size,
Brushes.White,
IconCreator.PPD
);
if (string.Equals(FProp.Default.FRarity_Design, "Flat"))
{
formattedText.TextAlignment = TextAlignment.Right;
formattedText.MaxTextWidth = 515;
formattedText.MaxLineCount = 1;
}
else
{
formattedText.TextAlignment = TextAlignment.Center;
formattedText.MaxTextWidth = 515;
formattedText.MaxLineCount = 1;
}
while (formattedText.Width > 515)
{
size -= 1;
formattedText.SetFontSize(size);
}
Point textLocation =
string.Equals(FProp.Default.FRarity_Design, "Flat") ? new Point(-5, 450 - formattedText.Height) :
string.Equals(FProp.Default.FRarity_Design, "Minimalist") ? new Point(0, 445 - formattedText.Height) :
new Point(0, 435 - formattedText.Height);
string.Equals(FProp.Default.FRarity_Design, "Flat") ? new Point(510, 450 - formattedText.Height) :
string.Equals(FProp.Default.FRarity_Design, "Minimalist") ? new Point(515, 445 - formattedText.Height) :
new Point(515, 435 - formattedText.Height);
IconCreator.ICDrawingContext.DrawText(formattedText, textLocation);
}
@@ -254,7 +259,7 @@ namespace FModel.Methods.Assets.IconCreator
{
if (!string.Equals(FProp.Default.FRarity_Design, "Minimalist"))
{
Typeface typeface = new Typeface(TextsUtility.FBurbank, FontStyles.Normal, FontWeights.Normal, FontStretches.Normal);
Typeface typeface = new Typeface(TextsUtility.FBurbank, FontStyles.Normal, string.Equals(FProp.Default.FLanguage, "Japanese") ? FontWeights.Black : FontWeights.Normal, FontStretches.Normal);
FormattedText formattedText =
new FormattedText(

View File

@@ -1,4 +1,5 @@
using FModel.Methods.SyntaxHighlighter;
using Microsoft.Win32;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PakReader;
@@ -393,19 +394,27 @@ namespace FModel.Methods.Utilities
public static void SaveAssetProperties()
{
string prop = FWindow.FMain.AssetPropertiesBox_Main.Text;
string path = FProp.Default.FOutput_Path + "\\JSONs\\" + FWindow.FCurrentAsset + ".json";
if (!string.IsNullOrEmpty(prop))
{
File.WriteAllText(path, prop);
if (File.Exists(path))
SaveFileDialog saveFileDialog = new SaveFileDialog();
saveFileDialog.Title = "Save Asset Properties";
saveFileDialog.FileName = FWindow.FCurrentAsset;
saveFileDialog.InitialDirectory = FProp.Default.FOutput_Path + "\\JSONs\\";
saveFileDialog.Filter = "JSON Files (*.json)|*.json";
if (saveFileDialog.ShowDialog() == true)
{
new UpdateMyConsole(FWindow.FCurrentAsset, CColors.Blue).Append();
new UpdateMyConsole("'s Json data successfully saved", CColors.White, true).Append();
}
else //just in case
{
new UpdateMyConsole("Bruh moment\nCouldn't export ", CColors.White).Append();
new UpdateMyConsole(FWindow.FCurrentAsset, CColors.Blue, true).Append();
string path = saveFileDialog.FileName;
File.WriteAllText(path, prop);
if (File.Exists(path))
{
new UpdateMyConsole(FWindow.FCurrentAsset, CColors.Blue).Append();
new UpdateMyConsole("'s Json data successfully saved", CColors.White, true).Append();
}
else //just in case
{
new UpdateMyConsole("Bruh moment\nCouldn't export ", CColors.White).Append();
new UpdateMyConsole(FWindow.FCurrentAsset, CColors.Blue, true).Append();
}
}
}
}