mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-05-22 01:06:35 +00:00
MainForm - Focus app when draging files over it
This commit is contained in:
@@ -1236,26 +1236,30 @@ namespace PckStudio
|
||||
|
||||
if ((node.TryGetTagData(out PckAsset asset) && currentPCK.Contains(asset.Filename, asset.Type)) || node.Parent is TreeNode)
|
||||
{
|
||||
treeViewMain.DoDragDrop(node, DragDropEffects.Move);
|
||||
}
|
||||
}
|
||||
// TODO: add (mouse) scrolling while dragging item(s)
|
||||
treeViewMain.DoDragDrop(node, DragDropEffects.Scroll | DragDropEffects.Move);
|
||||
}
|
||||
}
|
||||
|
||||
private void treeViewMain_DragOver(object sender, DragEventArgs e)
|
||||
private void treeViewMain_DragOver(object sender, DragEventArgs e)
|
||||
{
|
||||
Point dragLocation = new Point(e.X, e.Y);
|
||||
TreeNode node = treeViewMain.GetNodeAt(treeViewMain.PointToClient(dragLocation));
|
||||
treeViewMain.SelectedNode = node.IsTagOfType<PckAsset>() ? null : node;
|
||||
}
|
||||
}
|
||||
|
||||
private void treeViewMain_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
e.Effect = e.Data.GetDataPresent(DataFormats.FileDrop) ? DragDropEffects.Copy : e.AllowedEffect;
|
||||
}
|
||||
BringToFront();
|
||||
FocusMe();
|
||||
treeViewMain.Focus();
|
||||
}
|
||||
|
||||
private void treeViewMain_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
// Retrieve the client coordinates of the drop location.
|
||||
Point dragLocation = new Point(e.X, e.Y);
|
||||
// Retrieve the client coordinates of the drop location.
|
||||
Point dragLocation = new Point(e.X, e.Y);
|
||||
Point targetPoint = treeViewMain.PointToClient(dragLocation);
|
||||
|
||||
if (!treeViewMain.ClientRectangle.Contains(targetPoint))
|
||||
@@ -1383,12 +1387,12 @@ namespace PckStudio
|
||||
if (askForAssetType)
|
||||
{
|
||||
using AddFilePrompt addFile = new AddFilePrompt(assetPath);
|
||||
if (addFile.ShowDialog(this) != DialogResult.OK)
|
||||
if (addFile.ShowDialog(this) != DialogResult.OK)
|
||||
{
|
||||
skippedFiles++;
|
||||
skipAttempts--;
|
||||
if (skipAttempts > 0)
|
||||
continue;
|
||||
continue;
|
||||
|
||||
int remainingFileCount = fileCount - addedCount - skippedFiles;
|
||||
DialogResult abortFurtherImport = MessageBox.Show($"Do you wan't to abort further file imports?\n{remainingFileCount} file(s) left.", "Abort further import", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
|
||||
@@ -1411,7 +1415,7 @@ namespace PckStudio
|
||||
{
|
||||
DialogResult useSameTypeForRest = MessageBox.Show($"Do you want to import all remaining files as {lastSelectedAssetType}?", "Import all as", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
|
||||
if (useSameTypeForRest == DialogResult.Yes)
|
||||
{
|
||||
{
|
||||
askForAssetType = false;
|
||||
}
|
||||
}
|
||||
@@ -1437,8 +1441,8 @@ namespace PckStudio
|
||||
if (addedCount > 0)
|
||||
{
|
||||
wasModified = true;
|
||||
BuildMainTreeView();
|
||||
}
|
||||
BuildMainTreeView();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -1518,7 +1522,7 @@ namespace PckStudio
|
||||
{
|
||||
currentPCK = InitializePack(new Random().Next(8000, int.MaxValue), 0, namePrompt.NewText, true);
|
||||
MarkTemplateFile();
|
||||
LoadEditorTab();
|
||||
LoadEditorTab();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1527,14 +1531,14 @@ namespace PckStudio
|
||||
CheckSaveState();
|
||||
CreateTexturePackPrompt packPrompt = new CreateTexturePackPrompt();
|
||||
if (packPrompt.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
currentPCK = InitializeTexturePack(new Random().Next(8000, int.MaxValue), 0, packPrompt.PackName, packPrompt.PackRes, packPrompt.CreateSkinsPck);
|
||||
{
|
||||
currentPCK = InitializeTexturePack(new Random().Next(8000, int.MaxValue), 0, packPrompt.PackName, packPrompt.PackRes, packPrompt.CreateSkinsPck);
|
||||
MarkTemplateFile();
|
||||
LoadEditorTab();
|
||||
}
|
||||
}
|
||||
LoadEditorTab();
|
||||
}
|
||||
}
|
||||
|
||||
private void mashUpPackToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
private void mashUpPackToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
CheckSaveState();
|
||||
CreateTexturePackPrompt packPrompt = new CreateTexturePackPrompt();
|
||||
@@ -1542,7 +1546,7 @@ namespace PckStudio
|
||||
{
|
||||
currentPCK = InitializeMashUpPack(new Random().Next(8000, int.MaxValue), 0, packPrompt.PackName, packPrompt.PackRes);
|
||||
MarkTemplateFile();
|
||||
LoadEditorTab();
|
||||
LoadEditorTab();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1551,7 +1555,7 @@ namespace PckStudio
|
||||
isTemplateFile = true;
|
||||
wasModified = true;
|
||||
saveLocation = string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
private void quickChangeToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user