More preview archive fixes and additions
This commit is contained in:
parent
e724fdc66b
commit
62f35684ed
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -30,6 +30,7 @@
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.stPanel1 = new Switch_Toolbox.Library.Forms.STPanel();
|
||||
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
|
||||
this.listViewCustom1 = new Switch_Toolbox.Library.Forms.ListViewCustom();
|
||||
this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
@ -37,9 +38,15 @@
|
||||
this.stMenuStrip1 = new Switch_Toolbox.Library.Forms.STMenuStrip();
|
||||
this.viewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.stContextMenuStrip1 = new Switch_Toolbox.Library.Forms.STContextMenuStrip(this.components);
|
||||
this.exportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.replaceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.contentContainer.SuspendLayout();
|
||||
this.stPanel1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
|
||||
this.splitContainer1.Panel1.SuspendLayout();
|
||||
this.splitContainer1.SuspendLayout();
|
||||
this.stMenuStrip1.SuspendLayout();
|
||||
this.stContextMenuStrip1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// contentContainer
|
||||
@ -50,7 +57,7 @@
|
||||
//
|
||||
// stPanel1
|
||||
//
|
||||
this.stPanel1.Controls.Add(this.listViewCustom1);
|
||||
this.stPanel1.Controls.Add(this.splitContainer1);
|
||||
this.stPanel1.Controls.Add(this.stMenuStrip1);
|
||||
this.stPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.stPanel1.Location = new System.Drawing.Point(0, 25);
|
||||
@ -58,6 +65,19 @@
|
||||
this.stPanel1.Size = new System.Drawing.Size(842, 472);
|
||||
this.stPanel1.TabIndex = 11;
|
||||
//
|
||||
// splitContainer1
|
||||
//
|
||||
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.splitContainer1.Location = new System.Drawing.Point(0, 24);
|
||||
this.splitContainer1.Name = "splitContainer1";
|
||||
//
|
||||
// splitContainer1.Panel1
|
||||
//
|
||||
this.splitContainer1.Panel1.Controls.Add(this.listViewCustom1);
|
||||
this.splitContainer1.Size = new System.Drawing.Size(842, 448);
|
||||
this.splitContainer1.SplitterDistance = 280;
|
||||
this.splitContainer1.TabIndex = 2;
|
||||
//
|
||||
// listViewCustom1
|
||||
//
|
||||
this.listViewCustom1.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
@ -66,12 +86,13 @@
|
||||
this.columnHeader2,
|
||||
this.columnHeader3});
|
||||
this.listViewCustom1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.listViewCustom1.Location = new System.Drawing.Point(0, 24);
|
||||
this.listViewCustom1.Location = new System.Drawing.Point(0, 0);
|
||||
this.listViewCustom1.Name = "listViewCustom1";
|
||||
this.listViewCustom1.OwnerDraw = true;
|
||||
this.listViewCustom1.Size = new System.Drawing.Size(842, 448);
|
||||
this.listViewCustom1.Size = new System.Drawing.Size(280, 448);
|
||||
this.listViewCustom1.TabIndex = 1;
|
||||
this.listViewCustom1.UseCompatibleStateImageBehavior = false;
|
||||
this.listViewCustom1.SelectedIndexChanged += new System.EventHandler(this.listViewCustom1_SelectedIndexChanged);
|
||||
this.listViewCustom1.DoubleClick += new System.EventHandler(this.listViewCustom1_DoubleClick);
|
||||
this.listViewCustom1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.listViewCustom1_MouseClick);
|
||||
//
|
||||
@ -98,6 +119,7 @@
|
||||
this.stMenuStrip1.Size = new System.Drawing.Size(842, 24);
|
||||
this.stMenuStrip1.TabIndex = 0;
|
||||
this.stMenuStrip1.Text = "stMenuStrip1";
|
||||
this.stMenuStrip1.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.stMenuStrip1_ItemClicked);
|
||||
//
|
||||
// viewToolStripMenuItem
|
||||
//
|
||||
@ -107,8 +129,24 @@
|
||||
//
|
||||
// stContextMenuStrip1
|
||||
//
|
||||
this.stContextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.exportToolStripMenuItem,
|
||||
this.replaceToolStripMenuItem});
|
||||
this.stContextMenuStrip1.Name = "stContextMenuStrip1";
|
||||
this.stContextMenuStrip1.Size = new System.Drawing.Size(61, 4);
|
||||
this.stContextMenuStrip1.Size = new System.Drawing.Size(181, 70);
|
||||
//
|
||||
// exportToolStripMenuItem
|
||||
//
|
||||
this.exportToolStripMenuItem.Name = "exportToolStripMenuItem";
|
||||
this.exportToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
this.exportToolStripMenuItem.Text = "Export";
|
||||
//
|
||||
// replaceToolStripMenuItem
|
||||
//
|
||||
this.replaceToolStripMenuItem.Name = "replaceToolStripMenuItem";
|
||||
this.replaceToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
this.replaceToolStripMenuItem.Text = "Replace";
|
||||
this.replaceToolStripMenuItem.Click += new System.EventHandler(this.replaceToolStripMenuItem_Click);
|
||||
//
|
||||
// ArchiveListPreviewForm
|
||||
//
|
||||
@ -122,8 +160,12 @@
|
||||
this.contentContainer.ResumeLayout(false);
|
||||
this.stPanel1.ResumeLayout(false);
|
||||
this.stPanel1.PerformLayout();
|
||||
this.splitContainer1.Panel1.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
|
||||
this.splitContainer1.ResumeLayout(false);
|
||||
this.stMenuStrip1.ResumeLayout(false);
|
||||
this.stMenuStrip1.PerformLayout();
|
||||
this.stContextMenuStrip1.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
@ -138,5 +180,8 @@
|
||||
private System.Windows.Forms.ColumnHeader columnHeader2;
|
||||
private System.Windows.Forms.ColumnHeader columnHeader3;
|
||||
private STContextMenuStrip stContextMenuStrip1;
|
||||
private System.Windows.Forms.SplitContainer splitContainer1;
|
||||
private System.Windows.Forms.ToolStripMenuItem exportToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem replaceToolStripMenuItem;
|
||||
}
|
||||
}
|
@ -24,10 +24,10 @@ namespace Switch_Toolbox.Library.Forms
|
||||
{
|
||||
ImageList.ColorDepth = ColorDepth.Depth32Bit;
|
||||
ImageList.ImageSize = new Size(40,40);
|
||||
listViewCustom1.LargeImageList = ImageList;
|
||||
|
||||
var Files = OpenFileFormats(ArchiveFile);
|
||||
|
||||
|
||||
for (int i = 0; i < Files.Count; i++)
|
||||
{
|
||||
if (Files[i].FileFormat.FileType == FileType.Image)
|
||||
@ -87,6 +87,37 @@ namespace Switch_Toolbox.Library.Forms
|
||||
Thread.Start();
|
||||
}
|
||||
|
||||
private void ReloadTexture(STGenericTexture tex, ListViewItem listItem)
|
||||
{
|
||||
Thread Thread = new Thread((ThreadStart)(() =>
|
||||
{
|
||||
Bitmap temp = tex.GetBitmap();
|
||||
if (temp == null)
|
||||
return;
|
||||
|
||||
if (listViewCustom1.InvokeRequired)
|
||||
{
|
||||
listViewCustom1.Invoke((MethodInvoker)delegate {
|
||||
ImageList.Images[listItem.ImageIndex] = temp;
|
||||
// Running on the UI thread
|
||||
var dummy = ImageList.Handle;
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
ListViewItem item = new ListViewItem(tex.Text, ImageList.Images.Count);
|
||||
item.Tag = tex;
|
||||
|
||||
listViewCustom1.Items.Add(item);
|
||||
ImageList.Images.Add(temp);
|
||||
var dummy = ImageList.Handle;
|
||||
}
|
||||
|
||||
temp.Dispose();
|
||||
}));
|
||||
Thread.Start();
|
||||
}
|
||||
|
||||
private List<STGenericTexture> GetTextures(IFileFormat Format)
|
||||
{
|
||||
var Textures = new List<STGenericTexture>();
|
||||
@ -132,45 +163,66 @@ namespace Switch_Toolbox.Library.Forms
|
||||
{
|
||||
if (listViewCustom1.SelectedItems.Count > 0 && e.Button == MouseButtons.Right)
|
||||
{
|
||||
var item = listViewCustom1.SelectedItems[0];
|
||||
if (item.Tag != null && item.Tag is TreeNode)
|
||||
Point pt = listViewCustom1.PointToScreen(e.Location);
|
||||
stContextMenuStrip1.Show(pt);
|
||||
}
|
||||
}
|
||||
|
||||
private void replaceToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var item = listViewCustom1.SelectedItems[0];
|
||||
if (item.Tag != null && item.Tag is TreeNode)
|
||||
{
|
||||
foreach (ToolStripItem ctx in ((TreeNode)item.Tag).ContextMenuStrip.Items)
|
||||
{
|
||||
Point pt = listViewCustom1.PointToScreen(e.Location);
|
||||
((TreeNode)item.Tag).ContextMenuStrip.ItemClicked += new ToolStripItemClickedEventHandler(OnContextMenuClick);
|
||||
((TreeNode)item.Tag).ContextMenuStrip.Show(pt);
|
||||
if (ctx.Text == "Replace")
|
||||
{
|
||||
ctx.PerformClick();
|
||||
ReloadTexture(GetActiveTexture(), item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnContextMenuClick(object sender, ToolStripItemClickedEventArgs e)
|
||||
private STGenericTexture GetActiveTexture()
|
||||
{
|
||||
ToolStripItem item = e.ClickedItem;
|
||||
if (item.Text.Contains("Replace"))
|
||||
ReloadTextures();
|
||||
var item = listViewCustom1.SelectedItems[0];
|
||||
if (item.Tag is STGenericTexture)
|
||||
{
|
||||
return (STGenericTexture)item.Tag;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
ImageEditorForm imageEditorForm;
|
||||
ImageEditorBase imageEditorForm;
|
||||
private void LoadImageEditor(STGenericTexture texture, object Properties)
|
||||
{
|
||||
if (imageEditorForm == null || imageEditorForm.IsDisposed)
|
||||
{
|
||||
imageEditorForm = new ImageEditorForm(false);
|
||||
imageEditorForm.Show(this);
|
||||
imageEditorForm = new ImageEditorBase();
|
||||
|
||||
splitContainer1.Panel2.Controls.Clear();
|
||||
splitContainer1.Panel2.Controls.Add(imageEditorForm);
|
||||
imageEditorForm.Dock = DockStyle.Fill;
|
||||
}
|
||||
|
||||
imageEditorForm.editorBase.Text = Text;
|
||||
imageEditorForm.editorBase.Dock = DockStyle.Fill;
|
||||
imageEditorForm.editorBase.LoadProperties(Properties);
|
||||
imageEditorForm.editorBase.LoadImage(texture);
|
||||
imageEditorForm.FormClosed += OnEditorClosed;
|
||||
}
|
||||
|
||||
private void OnEditorClosed(object sender, EventArgs e)
|
||||
{
|
||||
ReloadTextures();
|
||||
imageEditorForm.Text = Text;
|
||||
imageEditorForm.LoadProperties(Properties);
|
||||
imageEditorForm.LoadImage(texture);
|
||||
}
|
||||
|
||||
private void listViewCustom1_DoubleClick(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void stMenuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void listViewCustom1_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (listViewCustom1.SelectedItems.Count > 0)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user