@@ -18,6 +18,7 @@ Public Class HexViewForm
1818 Private _IgnoreEvent As Boolean = False
1919 Private WithEvents NumericSector As ToolStripNumericUpDown
2020 Private WithEvents NumericCluster As ToolStripNumericUpDown
21+ Private WithEvents ComboTrack As ToolStripComboBox
2122
2223 Public Sub New (HexViewSectorData As HexViewSectorData, Caption As String , SectorNavigator As Boolean , ClusterNavigator As Boolean )
2324 ' This call is required by the designer.
@@ -42,12 +43,16 @@ Public Class HexViewForm
4243 CmbGroups.Visible = Not SectorNavigator And Not ClusterNavigator
4344
4445 If ClusterNavigator Then
45- InitializeClusterNavigator ()
46+ InitializeTrackNavigator ()
4647 End If
4748
4849 If SectorNavigator Then
4950 InitializeSectorNavigator()
5051 End If
52+
53+ If ClusterNavigator Then
54+ InitializeClusterNavigator()
55+ End If
5156 End Sub
5257
5358 Private Sub InitializeSectorNavigator()
@@ -56,7 +61,8 @@ Public Class HexViewForm
5661 }
5762
5863 Dim LabelSector = New ToolStripLabel( "Sector" ) With {
59- .Alignment = ToolStripItemAlignment.Right
64+ .Alignment = ToolStripItemAlignment.Right,
65+ .Padding = New Padding( 12 , 0 , 0 , 0 )
6066 }
6167
6268 ToolStripMain.Items.Add(NumericSector)
@@ -77,6 +83,24 @@ Public Class HexViewForm
7783 ToolStripMain.Items.Add(LabelCluster)
7884 End Sub
7985
86+ Private Sub InitializeTrackNavigator()
87+ ComboTrack = New ToolStripComboBox() With {
88+ .Alignment = ToolStripItemAlignment.Right,
89+ .DropDownStyle = ComboBoxStyle.DropDownList,
90+ .AutoSize = False ,
91+ .FlatStyle = FlatStyle.Popup,
92+ .Size = New Drawing.Size( 50 , 23 )
93+ }
94+
95+ Dim LabelTrack = New ToolStripLabel( "Track" ) With {
96+ .Alignment = ToolStripItemAlignment.Right,
97+ .Padding = New Padding( 12 , 0 , 0 , 0 )
98+ }
99+
100+ ToolStripMain.Items.Add(ComboTrack)
101+ ToolStripMain.Items.Add(LabelTrack)
102+ End Sub
103+
80104 Public ReadOnly Property Modified As Boolean
81105 Get
82106 Return _Modified
@@ -289,6 +313,24 @@ Public Class HexViewForm
289313 End If
290314 End Sub
291315
316+ Private Sub JumpToTrack(TrackValue As String )
317+ Dim TrackSet = TrackValue.Split( "." )
318+ Dim Track As UShort = TrackSet( 0 )
319+ Dim Side As UShort = TrackSet( 1 )
320+
321+ Dim SectorStart = _CurrentHexViewData.SectorBlock.SectorStart
322+ Dim SectorEnd = SectorStart + _CurrentHexViewData.SectorBlock.SectorCount - 1
323+ Dim TrackStart = _HexViewSectorData.Disk.BootSector.SectorToTrack(SectorStart)
324+ Dim TrackEnd = _HexViewSectorData.Disk.BootSector.SectorToTrack(SectorEnd)
325+ Dim Sector = _HexViewSectorData.Disk.BootSector.TrackToSector(Track, Side)
326+
327+ If Track >= TrackStart And Track <= TrackEnd Then
328+ Dim Offset = SectorToBytes(Sector) - HexBox1.LineInfoOffset
329+ Dim Line = Offset \ HexBox1.BytesPerLine
330+ HexBox1.PerformScrollToLine(Line)
331+ End If
332+ End Sub
333+
292334 Private Sub PasteHex()
293335 Dim HexBytes = ConvertHexToBytes(Clipboard.GetText)
294336 Dim Offset = HexBox1.SelectionStart
@@ -467,6 +509,8 @@ Public Class HexViewForm
467509 ToolStripStatusLength.Visible = False
468510 ToolStripStatusSector.Visible = False
469511 ToolStripStatusCluster.Visible = False
512+ ToolStripStatusTrack.Visible = False
513+ ToolStripStatusSide.Visible = False
470514 ToolStripStatusFile.Visible = False
471515 ToolStripStatusDescription.Visible = False
472516 BtnSelectSector.Text = "Select &Sector"
@@ -520,6 +564,20 @@ Public Class HexViewForm
520564 End If
521565 End If
522566
567+ If Disk.IsValidImage Then
568+ ToolStripStatusTrack.Visible = Not OutOfRange
569+ ToolStripStatusTrack.Text = "Track: " & Disk.BootSector.SectorToTrack(Sector)
570+
571+ ToolStripStatusSide.Visible = Not OutOfRange
572+ ToolStripStatusSide.Text = "Side: " & Disk.BootSector.SectorToSide(Sector)
573+ Else
574+ ToolStripStatusTrack.Visible = False
575+ ToolStripStatusTrack.Text = ""
576+
577+ ToolStripStatusSide.Visible = False
578+ ToolStripStatusSide.Text = ""
579+ End If
580+
523581 If FileName.Length = 0 Then
524582 ToolStripStatusFile.Visible = False
525583 ToolStripStatusFile.Text = ""
@@ -605,6 +663,8 @@ Public Class HexViewForm
605663 Dim SectorStart As UInteger = 0
606664 Dim SectorEnd As UInteger = 0
607665
666+ _IgnoreEvent = True
667+
608668 If _CurrentHexViewData.SectorBlock.Size > 0 Then
609669 If _SectorNavigator Or _ClusterNavigator Then
610670 SectorStart = _CurrentHexViewData.SectorBlock.SectorStart
@@ -621,8 +681,21 @@ Public Class HexViewForm
621681 NumericCluster.Minimum = _HexViewSectorData.Disk.BootSector.SectorToCluster(SectorStart)
622682 NumericCluster.Maximum = _HexViewSectorData.Disk.BootSector.SectorToCluster(SectorEnd)
623683 NumericCluster.Enabled = True
684+
685+ ComboTrack.Items.Clear()
686+ Dim TrackStart = _HexViewSectorData.Disk.BootSector.SectorToTrack(SectorStart)
687+ Dim TrackEnd = _HexViewSectorData.Disk.BootSector.SectorToTrack(SectorEnd)
688+ For i = TrackStart To TrackEnd
689+ For j = 0 To _HexViewSectorData.Disk.BootSector.NumberOfHeads - 1
690+ ComboTrack.Items.Add(i & "." & j)
691+ Next
692+ Next
693+ ComboTrack.SelectedIndex = 0
694+ ComboTrack.Enabled = True
624695 End If
625696 End If
697+
698+ _IgnoreEvent = False
626699 End Sub
627700
628701 Private Sub RefresSelectorValues()
@@ -647,6 +720,13 @@ Public Class HexViewForm
647720 If Cluster <> NumericCluster.Value Then
648721 NumericCluster.Value = Cluster
649722 End If
723+
724+ Dim Track = _CurrentHexViewData.Disk.BootSector.SectorToTrack(Sector)
725+ Dim Side = _CurrentHexViewData.Disk.BootSector.SectorToSide(Sector)
726+ Dim Value = Track.ToString & "." & Side.ToString
727+ If Value <> ComboTrack.Text Then
728+ ComboTrack.Text = Value
729+ End If
650730 End If
651731
652732 _IgnoreEvent = False
@@ -810,11 +890,21 @@ Public Class HexViewForm
810890 End Sub
811891
812892 Private Sub NumericSector_KeyDown(sender As Object , e As KeyEventArgs) Handles NumericSector.KeyDown, NumericCluster.KeyDown
813- Debug.Print(e.KeyCode)
814893 If e.KeyCode = Keys.Return Then
815894 e.SuppressKeyPress = True
816895 End If
817896 End Sub
897+
898+ Private Sub ComboTrack_SelectedIndexChanged(sender As Object , e As EventArgs) Handles ComboTrack.SelectedIndexChanged
899+ If _IgnoreEvent Then
900+ Exit Sub
901+ End If
902+
903+ If _ClusterNavigator Then
904+ JumpToTrack(ComboTrack.Text)
905+ End If
906+ End Sub
907+
818908# End Region
819909
820910 Private Class HexChange
0 commit comments