Skip to content

Commit cb92b70

Browse files
committed
Improve drag-and-drop checks for loaded disk images
Refined drag-and-drop event logic in MainForm.vb to check for an actually loaded image and disk, replacing the previous _ImagesLoaded flag with a more precise HasLoadedImage condition. This ensures drag-and-drop actions on PanelFiles only proceed when a valid image is loaded. Also incremented application revision and file version.
1 parent 0824145 commit cb92b70

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

DiskImageTool/DiskImageTool.vbproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
<TargetCulture>en-US</TargetCulture>
3131
<ProductName>DiskImageTool</ProductName>
3232
<PublisherName>Digitoxin</PublisherName>
33-
<ApplicationRevision>1</ApplicationRevision>
33+
<ApplicationRevision>2</ApplicationRevision>
3434
<ApplicationVersion>2.37.0.%2a</ApplicationVersion>
3535
<UseApplicationTrust>false</UseApplicationTrust>
3636
<PublishWizardCompleted>true</PublishWizardCompleted>

DiskImageTool/MainForm.vb

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1764,7 +1764,9 @@ Public Class MainForm
17641764
End Sub
17651765

17661766
Private Sub File_DragDrop(sender As Object, e As DragEventArgs) Handles ImageCombo.DragDrop, PanelFiles.DragDrop, ListViewSummary.DragDrop, HashPanel1.DragDrop
1767-
If sender Is PanelFiles AndAlso _ImagesLoaded Then
1767+
Dim HasLoadedImage = FilePanelMain.CurrentImage IsNot Nothing AndAlso FilePanelMain.CurrentImage.Disk IsNot Nothing
1768+
1769+
If sender Is PanelFiles AndAlso HasLoadedImage Then
17681770
PanelOverlay.Visible = False
17691771
SetDropHighlight(Nothing)
17701772
End If
@@ -1780,7 +1782,7 @@ Public Class MainForm
17801782
End If
17811783

17821784
Dim DoImport As Boolean = False
1783-
If sender Is PanelFiles AndAlso _ImagesLoaded Then
1785+
If sender Is PanelFiles AndAlso HasLoadedImage Then
17841786
DoImport = IsImportDrop(e)
17851787
End If
17861788

@@ -1802,9 +1804,11 @@ Public Class MainForm
18021804
Debug.Print("MainForm.File_DragEnter fired")
18031805

18041806
If e.Data.GetDataPresent(DataFormats.FileDrop) Then
1807+
Dim HasLoadedImage = FilePanelMain.CurrentImage IsNot Nothing AndAlso FilePanelMain.CurrentImage.Disk IsNot Nothing
1808+
18051809
e.Effect = DragDropEffects.Copy
18061810

1807-
If sender Is PanelFiles AndAlso _ImagesLoaded Then
1811+
If sender Is PanelFiles AndAlso HasLoadedImage Then
18081812
PanelOverlay.Visible = True
18091813
End If
18101814
End If
@@ -1817,7 +1821,9 @@ Public Class MainForm
18171821

18181822
Debug.Print("MainForm.File_DragLeave fired")
18191823

1820-
If sender Is PanelFiles AndAlso _ImagesLoaded Then
1824+
Dim HasLoadedImage = FilePanelMain.CurrentImage IsNot Nothing AndAlso FilePanelMain.CurrentImage.Disk IsNot Nothing
1825+
1826+
If sender Is PanelFiles AndAlso HasLoadedImage Then
18211827
PanelOverlay.Visible = False
18221828
SetDropHighlight(Nothing)
18231829
End If
@@ -1828,7 +1834,9 @@ Public Class MainForm
18281834
Exit Sub
18291835
End If
18301836

1831-
If sender Is PanelFiles AndAlso _ImagesLoaded Then
1837+
Dim HasLoadedImage = FilePanelMain.CurrentImage IsNot Nothing AndAlso FilePanelMain.CurrentImage.Disk IsNot Nothing
1838+
1839+
If sender Is PanelFiles AndAlso HasLoadedImage Then
18321840
Dim DoImport = IsImportDrop(e)
18331841
SetDropHighlight(If(DoImport, PanelOverlayBottomZone, PanelOverlayTopZone))
18341842
End If

DiskImageTool/My Project/AssemblyInfo.vb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ Imports System.Runtime.InteropServices
3131
' <Assembly: AssemblyVersion("1.0.*")>
3232

3333
<Assembly: AssemblyVersion("1.0.0.0")>
34-
<Assembly: AssemblyFileVersion("2.37.0.1")>
34+
<Assembly: AssemblyFileVersion("2.37.0.2")>

0 commit comments

Comments
 (0)