2016-08-26 01:50:51 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Windows.Forms;
|
2017-05-23 04:55:05 +00:00
|
|
|
|
using PKHeX.WinForms.Controls;
|
2016-08-26 01:50:51 +00:00
|
|
|
|
|
2017-01-08 07:54:09 +00:00
|
|
|
|
namespace PKHeX.WinForms
|
2016-08-26 01:50:51 +00:00
|
|
|
|
{
|
2018-04-11 00:00:28 +00:00
|
|
|
|
public sealed partial class SAV_BoxViewer : Form
|
2016-08-26 01:50:51 +00:00
|
|
|
|
{
|
2017-05-23 04:55:05 +00:00
|
|
|
|
private readonly SAVEditor parent;
|
|
|
|
|
public SAV_BoxViewer(SAVEditor p, SlotChangeManager m)
|
2016-08-26 01:50:51 +00:00
|
|
|
|
{
|
|
|
|
|
parent = p;
|
2017-05-23 04:55:05 +00:00
|
|
|
|
InitializeComponent();
|
|
|
|
|
Box.Setup(m);
|
2016-08-26 01:50:51 +00:00
|
|
|
|
CenterToParent();
|
|
|
|
|
|
|
|
|
|
AllowDrop = true;
|
2017-07-06 06:05:49 +00:00
|
|
|
|
GiveFeedback += (sender, e) => e.UseDefaultCursors = false;
|
2017-06-18 01:37:19 +00:00
|
|
|
|
DragEnter += Main_DragEnter;
|
2016-08-26 01:50:51 +00:00
|
|
|
|
DragDrop += (sender, e) =>
|
|
|
|
|
{
|
|
|
|
|
Cursor = DefaultCursor;
|
|
|
|
|
System.Media.SystemSounds.Asterisk.Play();
|
|
|
|
|
};
|
2018-01-23 06:39:12 +00:00
|
|
|
|
Owner = p.ParentForm;
|
2016-08-26 01:50:51 +00:00
|
|
|
|
|
2017-05-23 04:55:05 +00:00
|
|
|
|
foreach (PictureBox pb in Box.SlotPictureBoxes)
|
|
|
|
|
pb.ContextMenuStrip = parent.SlotPictureBoxes[0].ContextMenuStrip;
|
2016-08-26 01:50:51 +00:00
|
|
|
|
}
|
2017-05-23 04:55:05 +00:00
|
|
|
|
public int CurrentBox => Box.CurrentBox;
|
2017-06-18 01:37:19 +00:00
|
|
|
|
private void PB_BoxSwap_Click(object sender, EventArgs e) => Box.CurrentBox = parent.SwapBoxesViewer(Box.CurrentBox);
|
|
|
|
|
public void SetPKMBoxes() => Box.ResetSlots();
|
2016-08-26 01:50:51 +00:00
|
|
|
|
|
2017-06-18 01:37:19 +00:00
|
|
|
|
private static void Main_DragEnter(object sender, DragEventArgs e)
|
2016-08-26 01:50:51 +00:00
|
|
|
|
{
|
|
|
|
|
if (e.AllowedEffect == (DragDropEffects.Copy | DragDropEffects.Link)) // external file
|
|
|
|
|
e.Effect = DragDropEffects.Copy;
|
|
|
|
|
else if (e.Data != null) // within
|
|
|
|
|
e.Effect = DragDropEffects.Move;
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-23 04:55:05 +00:00
|
|
|
|
private void SAV_BoxViewer_FormClosing(object sender, FormClosingEventArgs e)
|
2016-08-26 01:50:51 +00:00
|
|
|
|
{
|
2017-05-23 04:55:05 +00:00
|
|
|
|
// Remove viewer from manager list
|
|
|
|
|
Box.M.Boxes.Remove(Box);
|
2016-08-26 01:50:51 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|