mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-24 04:53:08 +00:00
43e8b08ba8
Gen1/2 INT: 20 slots => 4 wide x 5 high Gen7lgpe: 25 slots => 5x5 otherwise: 6x5 (maintain 5 rows) Database(s): 6x11 Could probably wrap the initialization logic (grabbing savefile, etc) but works for now This is all in prep for box sprite resizing (56x68 as evident by lgpe sprites); figured I'd add some display flexibility to handle prior games with non-30/box layouts. shave off a couple pixels for popup box view to make the edges of the box directly at the edge (-2 bot, -1 right side)
64 lines
2.2 KiB
C#
64 lines
2.2 KiB
C#
using System;
|
|
using System.Windows.Forms;
|
|
using PKHeX.Core;
|
|
using PKHeX.WinForms.Controls;
|
|
|
|
namespace PKHeX.WinForms
|
|
{
|
|
public sealed partial class SAV_BoxViewer : Form
|
|
{
|
|
private readonly SAVEditor parent;
|
|
|
|
public SAV_BoxViewer(SAVEditor p, SlotChangeManager m)
|
|
{
|
|
parent = p;
|
|
InitializeComponent();
|
|
Box.Editor = new BoxEdit(m.SE.SAV);
|
|
Box.Setup(m);
|
|
Box.InitializeGrid();
|
|
Box.Reset();
|
|
CenterToParent();
|
|
|
|
AllowDrop = true;
|
|
GiveFeedback += (sender, e) => e.UseDefaultCursors = false;
|
|
DragEnter += Main_DragEnter;
|
|
DragDrop += (sender, e) =>
|
|
{
|
|
Cursor = DefaultCursor;
|
|
System.Media.SystemSounds.Asterisk.Play();
|
|
};
|
|
Owner = p.ParentForm;
|
|
|
|
MouseWheel += (s, e) =>
|
|
{
|
|
if (parent.menu.mnuVSD.Visible)
|
|
return;
|
|
Box.CurrentBox = e.Delta > 1 ? Box.Editor.MoveLeft() : Box.Editor.MoveRight();
|
|
};
|
|
|
|
foreach (PictureBox pb in Box.SlotPictureBoxes)
|
|
pb.ContextMenuStrip = parent.SlotPictureBoxes[0].ContextMenuStrip;
|
|
Box.ResetBoxNames(); // fix box names
|
|
Box.ResetSlots(); // refresh box background
|
|
p.EditEnv.Slots.Publisher.Subscribers.Add(Box);
|
|
}
|
|
|
|
public int CurrentBox => Box.CurrentBox;
|
|
private void PB_BoxSwap_Click(object sender, EventArgs e) => Box.CurrentBox = parent.SwapBoxesViewer(Box.CurrentBox);
|
|
|
|
private static void Main_DragEnter(object sender, DragEventArgs e)
|
|
{
|
|
if (e.AllowedEffect == (DragDropEffects.Copy | DragDropEffects.Link)) // external file
|
|
e.Effect = DragDropEffects.Copy;
|
|
else if (e.Data != null) // within
|
|
e.Effect = DragDropEffects.Move;
|
|
}
|
|
|
|
private void SAV_BoxViewer_FormClosing(object sender, FormClosingEventArgs e)
|
|
{
|
|
// Remove viewer from manager list
|
|
Box.M.Boxes.Remove(Box);
|
|
parent.EditEnv.Slots.Publisher.Subscribers.Remove(Box);
|
|
}
|
|
}
|
|
}
|