Improve nutexb context menus

This commit is contained in:
KillzXGaming 2019-08-16 17:18:44 -04:00
parent 655cdff142
commit de84563377
5 changed files with 49 additions and 64 deletions

Binary file not shown.

View file

@ -173,7 +173,7 @@ namespace FirstPlugin
editor.LoadImage(this);
}
private void UseSizeRestrictions(object sender, EventArgs args)
private void UseSizeRestrictionsAction(object sender, EventArgs args)
{
if (sender is STToolStripItem)
{
@ -313,17 +313,11 @@ namespace FirstPlugin
public override string ExportFilter => FileFilters.NUTEXB;
public override string ReplaceFilter => FileFilters.NUTEXB;
private void Replace(object sender, EventArgs args)
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = FileFilters.NUTEXB;
ofd.Multiselect = false;
if (ofd.ShowDialog() == DialogResult.OK)
public override void Replace(string FileName)
{
var bntxFile = new BNTX();
var tex = new TextureData();
tex.Replace(ofd.FileName, MipCount,0, Format);
tex.Replace(FileName, MipCount, 0, Format);
//If it's null, the operation is cancelled
if (tex.Texture == null)
@ -368,15 +362,8 @@ namespace FirstPlugin
UpdateEditor();
}
}
private void Export(object sender, EventArgs args)
{
ExportImage();
}
private void Save(object sender, EventArgs args)
private void SaveAction(object sender, EventArgs args)
{
SaveFileDialog sfd = new SaveFileDialog();
sfd.Filter = Utils.GetAllFilters(this);
@ -591,14 +578,15 @@ namespace FirstPlugin
return TegraX1Swizzle.GetImageData(this, ImageData, ArrayLevel, MipLevel, 1);
}
ToolStripMenuItem save = new ToolStripMenuItem("Save");
ToolStripMenuItem export = new ToolStripMenuItem("Export");
ToolStripMenuItem replace = new ToolStripMenuItem("Replace");
ToolStripMenuItem useSizeRestrictions = new ToolStripMenuItem("UseSizeRestrictions");
public void Load(System.IO.Stream stream)
{
Text = FileName;
CanSave = true;
CanReplace = true;
CanRename = true;
CanDelete = true;
Read(new FileReader(stream));
@ -607,18 +595,15 @@ namespace FirstPlugin
useSizeRestrictions.Checked = true;
save.Click += Save;
replace.Click += Replace;
export.Click += Export;
save.Click += SaveAction;
}
public ToolStripItem[] GetContextMenuItems()
{
List<ToolStripItem> Items = new List<ToolStripItem>();
Items.Add(save);
Items.Add(useSizeRestrictions);
Items.Add(export);
Items.Add(replace);
Items.Add(new STToolStipMenuItem("Save", null, SaveAction, Keys.Control | Keys.S));
Items.AddRange(base.GetContextMenuItems());
return Items.ToArray();
}

View file

@ -311,7 +311,7 @@ namespace Toolbox.Library.Forms
{
foreach (var item in ((IContextMenuNode)e.Node).GetContextMenuItems())
{
if (item.Text != "Delete" || item.Text != "Remove")
if (item.Text != "Delete" && item.Text != "Remove")
treeNodeContextMenu.Items.Add(item);
}
treeNodeContextMenu.Items.Add(new ToolStripMenuItem("Delete", null, DeleteAction, Keys.Control | Keys.Delete));