mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-10-02 03:28:57 -05:00
Show summary tooltip on mouse enter
Thanks SadisticMystic for the suggestion!
This commit is contained in:
@@ -580,7 +580,7 @@ private static string GetCryPath(PKM pk, string cryFolder)
|
||||
return path;
|
||||
}
|
||||
|
||||
private static string GetLocalizedPreviewText(PKM pk, string language)
|
||||
public static string GetLocalizedPreviewText(PKM pk, string language)
|
||||
{
|
||||
var set = new ShowdownSet(pk);
|
||||
if (pk.Format <= 2) // Nature preview from IVs
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
using PKHeX.Core;
|
||||
using PKHeX.Core.Searching;
|
||||
using PKHeX.WinForms.Controls;
|
||||
using PKHeX.WinForms.Properties;
|
||||
using static PKHeX.Core.MessageStrings;
|
||||
|
||||
namespace PKHeX.WinForms
|
||||
@@ -68,6 +69,26 @@ public SAV_Database(PKMEditor f1, SAVEditor saveditor)
|
||||
else if (ModifierKeys == Keys.Shift)
|
||||
ClickSet(sender, e);
|
||||
};
|
||||
|
||||
if (Settings.Default.HoverSlotShowText)
|
||||
{
|
||||
slot.MouseEnter += (sender, e) =>
|
||||
{
|
||||
int index = Array.IndexOf(PKXBOXES, slot);
|
||||
if (!GetShiftedIndex(ref index))
|
||||
return;
|
||||
|
||||
var pk = Results[index];
|
||||
if (pk.Species == 0)
|
||||
{
|
||||
ShowSet.RemoveAll();
|
||||
return;
|
||||
}
|
||||
|
||||
var text = SlotChangeManager.GetLocalizedPreviewText(pk, Settings.Default.Language);
|
||||
ShowSet.SetToolTip(slot, text);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Counter = L_Count.Text;
|
||||
@@ -113,19 +134,14 @@ public SAV_Database(PKMEditor f1, SAVEditor saveditor)
|
||||
private readonly string Viewed;
|
||||
private const int MAXFORMAT = PKX.Generation;
|
||||
private readonly string EXTERNAL_SAV = new DirectoryInfo(Main.BackupPath).Name + Path.DirectorySeparatorChar;
|
||||
private readonly ToolTip ShowSet = new ToolTip {InitialDelay = 200, IsBalloon = false};
|
||||
|
||||
// Important Events
|
||||
private void ClickView(object sender, EventArgs e)
|
||||
{
|
||||
sender = WinFormsUtil.GetUnderlyingControl(sender);
|
||||
int index = Array.IndexOf(PKXBOXES, sender);
|
||||
if (index >= RES_MAX)
|
||||
{
|
||||
System.Media.SystemSounds.Exclamation.Play();
|
||||
return;
|
||||
}
|
||||
index += SCR_Box.Value * RES_MIN;
|
||||
if (index >= Results.Count)
|
||||
if (!GetShiftedIndex(ref index))
|
||||
{
|
||||
System.Media.SystemSounds.Exclamation.Play();
|
||||
return;
|
||||
@@ -142,13 +158,7 @@ private void ClickDelete(object sender, EventArgs e)
|
||||
{
|
||||
sender = WinFormsUtil.GetUnderlyingControl(sender);
|
||||
int index = Array.IndexOf(PKXBOXES, sender);
|
||||
if (index >= RES_MAX)
|
||||
{
|
||||
System.Media.SystemSounds.Exclamation.Play();
|
||||
return;
|
||||
}
|
||||
index += SCR_Box.Value * RES_MIN;
|
||||
if (index >= Results.Count)
|
||||
if (!GetShiftedIndex(ref index))
|
||||
{
|
||||
System.Media.SystemSounds.Exclamation.Play();
|
||||
return;
|
||||
@@ -235,6 +245,14 @@ private void ClickSet(object sender, EventArgs e)
|
||||
WinFormsUtil.Alert(MsgDBAddFromTabsSuccess);
|
||||
}
|
||||
|
||||
private bool GetShiftedIndex(ref int index)
|
||||
{
|
||||
if (index >= RES_MAX)
|
||||
return false;
|
||||
index += SCR_Box.Value * RES_MIN;
|
||||
return index < Results?.Count;
|
||||
}
|
||||
|
||||
private void PopulateComboBoxes()
|
||||
{
|
||||
// Set the Text
|
||||
|
||||
Reference in New Issue
Block a user