mirror of
https://github.com/KillzXGaming/Switch-Toolbox
synced 2025-02-16 22:08:26 +00:00
Fixup image menus for bffnt
This commit is contained in:
parent
f37fe42728
commit
25bac056b4
2 changed files with 53 additions and 42 deletions
|
@ -505,20 +505,6 @@
|
|||
this.imageMenuStrip.Name = "stContextMenuStrip1";
|
||||
this.imageMenuStrip.Size = new System.Drawing.Size(108, 48);
|
||||
//
|
||||
// exportToolStripMenuItem
|
||||
//
|
||||
this.exportToolStripMenuItem.Name = "exportToolStripMenuItem";
|
||||
this.exportToolStripMenuItem.Size = new System.Drawing.Size(107, 22);
|
||||
this.exportToolStripMenuItem.Text = "Export";
|
||||
this.exportToolStripMenuItem.Click += new System.EventHandler(this.exportToolStripMenuItem_Click);
|
||||
//
|
||||
// copyToolStripMenuItem
|
||||
//
|
||||
this.copyToolStripMenuItem.Name = "copyToolStripMenuItem";
|
||||
this.copyToolStripMenuItem.Size = new System.Drawing.Size(107, 22);
|
||||
this.copyToolStripMenuItem.Text = "Copy";
|
||||
this.copyToolStripMenuItem.Click += new System.EventHandler(this.copyToolStripMenuItem_Click);
|
||||
//
|
||||
// stPanel4
|
||||
//
|
||||
this.stPanel4.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
|
|
|
@ -89,16 +89,16 @@ namespace FirstPlugin.Forms
|
|||
if (ActiveFile == null) return;
|
||||
|
||||
int ImageIndex = imagesCB.SelectedIndex;
|
||||
if (e.Button == MouseButtons.Right && ImageIndex != -1)
|
||||
{
|
||||
var image = ActiveFile.FontSection.TextureGlyph.GetImageSheet(ImageIndex);
|
||||
|
||||
if (image is IContextMenuNode)
|
||||
if (e.Button == MouseButtons.Right && ImageIndex != -1)
|
||||
{
|
||||
imageMenuStrip.Items.Clear();
|
||||
imageMenuStrip.Items.AddRange(((IContextMenuNode)image).GetContextMenuItems());
|
||||
imageMenuStrip.Show(Cursor.Position);
|
||||
}
|
||||
var image = ActiveFile.FontSection.TextureGlyph.GetImageSheet(ImageIndex);
|
||||
|
||||
imageMenuStrip.Items.Clear();
|
||||
imageMenuStrip.Items.Add(new ToolStripMenuItem("Export", null, ExportImageAction, Keys.Control | Keys.E));
|
||||
imageMenuStrip.Items.Add(new ToolStripMenuItem("Replace", null, ReplaceImageAction, Keys.Control | Keys.R));
|
||||
imageMenuStrip.Items.Add(new ToolStripMenuItem("Copy", null, CopyImageAction, Keys.Control | Keys.C));
|
||||
imageMenuStrip.Show(Cursor.Position);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -106,26 +106,29 @@ namespace FirstPlugin.Forms
|
|||
{
|
||||
int ImageIndex = imagesCB.SelectedIndex;
|
||||
if (ImageIndex != -1)
|
||||
UpdateImagePanel(ImageIndex);
|
||||
}
|
||||
|
||||
private void UpdateImagePanel(int ImageIndex)
|
||||
{
|
||||
var image = ActiveFile.FontSection.TextureGlyph.GetImageSheet(ImageIndex);
|
||||
bool IsBntx = ActiveFile.FontSection.TextureGlyph.BinaryTextureFile != null;
|
||||
|
||||
if (IsBntx)
|
||||
{
|
||||
var image = ActiveFile.FontSection.TextureGlyph.GetImageSheet(ImageIndex);
|
||||
bool IsBntx = ActiveFile.FontSection.TextureGlyph.BinaryTextureFile != null;
|
||||
|
||||
if (IsBntx)
|
||||
{
|
||||
PanelImage = image.GetBitmap(ImageIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
PanelImage = image.GetBitmap();
|
||||
}
|
||||
|
||||
if (PanelImage != null)
|
||||
{
|
||||
PanelImage.RotateFlip(RotateFlipType.RotateNoneFlipY);
|
||||
}
|
||||
|
||||
FillCells();
|
||||
PanelImage = image.GetBitmap(ImageIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
PanelImage = image.GetBitmap();
|
||||
}
|
||||
|
||||
if (PanelImage != null)
|
||||
{
|
||||
PanelImage.RotateFlip(RotateFlipType.RotateNoneFlipY);
|
||||
}
|
||||
|
||||
FillCells();
|
||||
|
||||
imagePanel.Refresh();
|
||||
}
|
||||
|
@ -139,7 +142,29 @@ namespace FirstPlugin.Forms
|
|||
}
|
||||
}
|
||||
|
||||
private void exportToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
|
||||
private void ReplaceImageAction(object sender, EventArgs e)
|
||||
{
|
||||
int ImageIndex = imagesCB.SelectedIndex;
|
||||
if (ImageIndex != -1)
|
||||
{
|
||||
var image = ActiveFile.FontSection.TextureGlyph.GetImageSheet(ImageIndex);
|
||||
bool IsBntx = ActiveFile.FontSection.TextureGlyph.BinaryTextureFile != null;
|
||||
|
||||
OpenFileDialog ofd = new OpenFileDialog();
|
||||
ofd.Filter = image.ReplaceFilter;
|
||||
ofd.Multiselect = false;
|
||||
|
||||
if (ofd.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
image.Replace(ofd.FileName);
|
||||
}
|
||||
|
||||
UpdateImagePanel(ImageIndex);
|
||||
}
|
||||
}
|
||||
|
||||
private void ExportImageAction(object sender, EventArgs e)
|
||||
{
|
||||
int ImageIndex = imagesCB.SelectedIndex;
|
||||
if (ImageIndex != -1)
|
||||
|
@ -294,7 +319,7 @@ namespace FirstPlugin.Forms
|
|||
graphics.ScaleTransform(textureGlyph.SheetWidth, textureGlyph.SheetHeight);
|
||||
}
|
||||
|
||||
private void copyToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
private void CopyImageAction(object sender, EventArgs e)
|
||||
{
|
||||
if (PanelImage != null)
|
||||
Clipboard.SetImage(PanelImage);
|
||||
|
|
Loading…
Add table
Reference in a new issue