1
0
mirror of synced 2025-01-19 01:14:08 +01:00

Automatically apply changes when resized in image editor

This commit is contained in:
KillzXGaming 2019-05-18 12:24:03 -04:00
parent 6c38b46ad4
commit 387e8685fd
8 changed files with 43 additions and 1 deletions

Binary file not shown.

View File

@ -743,6 +743,9 @@ namespace Switch_Toolbox.Library.Forms
if (resizeEditor.ShowDialog() == DialogResult.OK)
{
UpdateEditCached(resizeEditor.newImage);
ApplyEdit(resizeEditor.newImage);
UpdateImage(ActiveTexture);
}
}

View File

@ -93,7 +93,7 @@ namespace Switch_Toolbox.Library.Forms
ObjectTree.Dock = DockStyle.Fill;
stPanel1.Controls.Add(ObjectTree);
TreeNode FileRoot = new TreeNode(FileFormat.FileName);
TreeNode FileRoot = new ArchiveRootNodeWrapper(FileFormat.FileName, (IArchiveFile)FileFormat);
FillTreeNodes(FileRoot, (IArchiveFile)FileFormat);
AddNode(FileRoot);
}

View File

@ -64,6 +64,44 @@ namespace Switch_Toolbox.Library
public ArchiveFileState State { get; set; } = ArchiveFileState.Empty;
}
//Wrapper for the archive file itself
public class ArchiveRootNodeWrapper : TreeNodeCustom
{
IArchiveFile ArchiveFile;
public ArchiveRootNodeWrapper(string text, IArchiveFile archiveFile)
{
Text = text;
ArchiveFile = archiveFile;
ContextMenuStrip = new STContextMenuStrip();
ContextMenuStrip.Items.Add(new STToolStripItem("Save", SaveAction));
if (!((IFileFormat)archiveFile).CanSave)
ContextMenuStrip.Items[0].Enabled = false;
}
private void SaveAction(object sender, EventArgs args)
{
//Archive files are IFIleFormats
var FileFormat = ((IFileFormat)ArchiveFile);
Cursor.Current = Cursors.WaitCursor;
List<IFileFormat> formats = new List<IFileFormat>();
formats.Add(FileFormat);
SaveFileDialog sfd = new SaveFileDialog();
sfd.Filter = Utils.GetAllFilters(formats);
sfd.FileName = FileFormat.FileName;
if (sfd.ShowDialog() == DialogResult.OK)
{
STFileSaver.SaveFileFormat(FileFormat, sfd.FileName);
}
GC.Collect();
}
}
//Wrapper for folders
public class ArchiveFolderNodeWrapper : TreeNodeCustom
{
public bool CanReplace
@ -173,6 +211,7 @@ namespace Switch_Toolbox.Library
}
}
//Wrapper for files
public class ArchiveNodeWrapper : TreeNodeCustom
{
public bool CanReplace