mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-06-24 06:05:56 +00:00
Add 'Validate Skin Dimension' setting
This commit is contained in:
@@ -80,6 +80,9 @@
|
||||
<setting name="UseComboBoxForGRFParameter" serializeAs="String">
|
||||
<value>False</value>
|
||||
</setting>
|
||||
<setting name="ValidateImageDimension" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
</PckStudio.Properties.Settings>
|
||||
</userSettings>
|
||||
</configuration>
|
||||
|
||||
17
PCK-Studio/Forms/AppSettingsForm.Designer.cs
generated
17
PCK-Studio/Forms/AppSettingsForm.Designer.cs
generated
@@ -37,6 +37,7 @@
|
||||
this.showPresenceCheckBox = new MetroFramework.Controls.MetroCheckBox();
|
||||
this.grf_paramKeyComboBoxCheckBox = new MetroFramework.Controls.MetroCheckBox();
|
||||
this.usePrereleaseCheckBox = new MetroFramework.Controls.MetroCheckBox();
|
||||
this.validateSkinDimenssionCheckBox = new MetroFramework.Controls.MetroCheckBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// autoSaveCheckBox
|
||||
@@ -144,11 +145,26 @@
|
||||
this.usePrereleaseCheckBox.UseSelectable = true;
|
||||
this.usePrereleaseCheckBox.Visible = false;
|
||||
//
|
||||
// validateSkinDimenssionCheckBox
|
||||
//
|
||||
this.validateSkinDimenssionCheckBox.AutoSize = true;
|
||||
this.validateSkinDimenssionCheckBox.Location = new System.Drawing.Point(23, 190);
|
||||
this.validateSkinDimenssionCheckBox.Name = "validateSkinDimenssionCheckBox";
|
||||
this.validateSkinDimenssionCheckBox.Size = new System.Drawing.Size(149, 15);
|
||||
this.validateSkinDimenssionCheckBox.Style = MetroFramework.MetroColorStyle.White;
|
||||
this.validateSkinDimenssionCheckBox.TabIndex = 7;
|
||||
this.validateSkinDimenssionCheckBox.Text = "Validate Skin Dimension";
|
||||
this.validateSkinDimenssionCheckBox.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.SettingToolTip.SetToolTip(this.validateSkinDimenssionCheckBox, "Use a combobox instead of typing the parameter key name");
|
||||
this.validateSkinDimenssionCheckBox.UseSelectable = true;
|
||||
this.validateSkinDimenssionCheckBox.CheckedChanged += new System.EventHandler(this.validateSkinDimenssionCheckBox_CheckedChanged);
|
||||
//
|
||||
// AppSettingsForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(527, 270);
|
||||
this.Controls.Add(this.validateSkinDimenssionCheckBox);
|
||||
this.Controls.Add(this.usePrereleaseCheckBox);
|
||||
this.Controls.Add(this.grf_paramKeyComboBoxCheckBox);
|
||||
this.Controls.Add(this.showPresenceCheckBox);
|
||||
@@ -181,5 +197,6 @@
|
||||
private MetroFramework.Controls.MetroCheckBox showPresenceCheckBox;
|
||||
private MetroFramework.Controls.MetroCheckBox grf_paramKeyComboBoxCheckBox;
|
||||
private MetroFramework.Controls.MetroCheckBox usePrereleaseCheckBox;
|
||||
private MetroFramework.Controls.MetroCheckBox validateSkinDimenssionCheckBox;
|
||||
}
|
||||
}
|
||||
@@ -55,6 +55,11 @@ namespace PckStudio.Forms
|
||||
Settings.Default.UsePrerelease = usePrereleaseCheckBox.Checked;
|
||||
}
|
||||
|
||||
private void validateSkinDimenssionCheckBox_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
Settings.Default.ValidateImageDimension = validateSkinDimenssionCheckBox.Checked;
|
||||
}
|
||||
|
||||
private void LoadCheckboxState(CheckBox checkBox, EventHandler eventHandler, bool state)
|
||||
{
|
||||
checkBox.CheckedChanged -= eventHandler;
|
||||
@@ -71,6 +76,7 @@ namespace PckStudio.Forms
|
||||
LoadCheckboxState(autoUpdateCheckBox, autoUpdateCheckBox_CheckedChanged, Settings.Default.AutoUpdate);
|
||||
LoadCheckboxState(usePrereleaseCheckBox, usePrereleaseCheckBox_CheckedChanged, Settings.Default.UsePrerelease);
|
||||
LoadCheckboxState(grf_paramKeyComboBoxCheckBox, grf_paramKeyComboBoxCheckBox_CheckedChanged, Settings.Default.UseComboBoxForGRFParameter);
|
||||
LoadCheckboxState(validateSkinDimenssionCheckBox, validateSkinDimenssionCheckBox_CheckedChanged, Settings.Default.ValidateImageDimension);
|
||||
}
|
||||
|
||||
private void AppBehaviorSettingsForm_FormClosing(object sender, FormClosingEventArgs e)
|
||||
|
||||
@@ -11,6 +11,7 @@ using PckStudio.Internal;
|
||||
using PckStudio.Extensions;
|
||||
using PckStudio.Internal.Skin;
|
||||
using PckStudio.Forms.Additional_Popups;
|
||||
using PckStudio.Properties;
|
||||
|
||||
namespace PckStudio.Forms.Editor
|
||||
{
|
||||
@@ -239,7 +240,7 @@ namespace PckStudio.Forms.Editor
|
||||
{
|
||||
var img = e.NewTexture;
|
||||
// Skins can only be a 1:1 ratio (base 64x64) or a 2:1 ratio (base 64x32)
|
||||
if (img.Width != img.Height && img.Height != img.Width / 2)
|
||||
if (Settings.Default.ValidateImageDimension && img.Width != img.Height && img.Height != img.Width / 2)
|
||||
{
|
||||
e.Cancel = true;
|
||||
MessageBox.Show("The selected image does not suit a skin texture.", "Invalid image dimensions.", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
|
||||
12
PCK-Studio/Properties/Settings.Designer.cs
generated
12
PCK-Studio/Properties/Settings.Designer.cs
generated
@@ -126,5 +126,17 @@ namespace PckStudio.Properties {
|
||||
this["RecentFiles"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||
public bool ValidateImageDimension {
|
||||
get {
|
||||
return ((bool)(this["ValidateImageDimension"]));
|
||||
}
|
||||
set {
|
||||
this["ValidateImageDimension"] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,5 +29,8 @@
|
||||
<Setting Name="RecentFiles" Type="System.Collections.Specialized.StringCollection" Scope="User">
|
||||
<Value Profile="(Default)" />
|
||||
</Setting>
|
||||
<Setting Name="ValidateImageDimension" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
Reference in New Issue
Block a user