From 68beae3351159f75e691ddc26212fe3dee2da388 Mon Sep 17 00:00:00 2001 From: ReBiliBin Date: Sat, 16 Nov 2024 17:13:24 +0800 Subject: [PATCH] Upgrade to dotnet9 --- Directory.Packages.props | 15 + iBMSC/ApplicationEvents.vb | 62 +- iBMSC/Audio.vb | 250 +- iBMSC/BMS.vb | 40 +- iBMSC/BMSONFormat.vb | 272 +- iBMSC/ChartIO.vb | 2986 ++++----- iBMSC/Column.vb | 218 +- iBMSC/Dialogs/AboutBox1.vb | 340 +- iBMSC/Dialogs/ColorPicker.vb | 1232 ++-- iBMSC/Dialogs/SplashScreen1.vb | 20 +- iBMSC/Dialogs/dgImportSM.vb | 48 +- iBMSC/Dialogs/dgMyO2.vb | 126 +- iBMSC/Dialogs/dgStatistics.vb | 84 +- iBMSC/Dialogs/diagFind.vb | 636 +- iBMSC/Dialogs/fLoadFileProgress.vb | 66 +- iBMSC/EditorColumns.vb | 806 +-- iBMSC/EditorPersistent.vb | 2630 ++++---- iBMSC/EditorRecent.vb | 162 +- iBMSC/EditorUndoRedo.vb | 860 +-- iBMSC/Extensions.vb | 8 +- iBMSC/MainWindow.vb | 9738 ++++++++++++++-------------- iBMSC/MyO2.vb | 580 +- iBMSC/Option Windows/Note.vb | 152 +- iBMSC/Option Windows/OpGeneral.vb | 716 +- iBMSC/Option Windows/OpPlayer.vb | 404 +- iBMSC/Option Windows/OpVisual.vb | 1540 ++--- iBMSC/PanelDraw.vb | 1458 ++--- iBMSC/PanelEvents.vb | 3500 +++++----- iBMSC/PanelKeyStates.vb | 30 +- iBMSC/Strings.vb | 454 +- iBMSC/TimeSelectionOps.vb | 1318 ++-- iBMSC/UndoRedo.vb | 882 +-- iBMSC/Utilities.vb | 460 +- iBMSC/VisualSettings.vb | 182 +- iBMSC/Waveform.vb | 100 +- iBMSC/XMLUtil.vb | 114 +- iBMSC/chartinfo.vb | 26 +- iBMSC/iBMSC.vbproj | 14 +- 38 files changed, 16270 insertions(+), 16259 deletions(-) create mode 100644 Directory.Packages.props diff --git a/Directory.Packages.props b/Directory.Packages.props new file mode 100644 index 000000000..aa7d06856 --- /dev/null +++ b/Directory.Packages.props @@ -0,0 +1,15 @@ + + + true + true + $(NoWarn);NU1507 + + + + + + + + + + \ No newline at end of file diff --git a/iBMSC/ApplicationEvents.vb b/iBMSC/ApplicationEvents.vb index e56d76980..d2b836964 100644 --- a/iBMSC/ApplicationEvents.vb +++ b/iBMSC/ApplicationEvents.vb @@ -1,36 +1,36 @@ Namespace My - Partial Friend Class MyApplication - - Private Sub MyApplication_Shutdown(sender As Object, e As EventArgs) Handles Me.Shutdown - - End Sub - - Private Sub MyApplication_Startup(sender As Object, e As ApplicationServices.StartupEventArgs) Handles Me.Startup - - End Sub - - Private Sub MyApplication_UnhandledException(sender As Object, e As ApplicationServices.UnhandledExceptionEventArgs) Handles Me.UnhandledException - Dim xRes As MsgBoxResult = MsgBox("An unhandled exception has occurred in the application: " & vbCrLf & - e.Exception.Message & vbCrLf & - vbCrLf & - "Click Yes to save a back-up, click No otherwise, or click Cancel to ignore this exception and continue.", - MsgBoxStyle.YesNoCancel + MsgBoxStyle.Critical, - "Unhandled Exception") - If xRes = MsgBoxResult.Cancel Then e.ExitApplication = False - If xRes = MsgBoxResult.Yes Then - Dim xFN As String - Dim xDate As Date = Date.Now - With xDate - xFN = "\AutoSave_" & .Year & "_" & .Month & "_" & .Day & "_" & .Hour & "_" & .Minute & "_" & .Second & "_" & .Millisecond & ".IBMSC" - End With - - 'My.Computer.FileSystem.WriteAllText(My.Application.Info.DirectoryPath & xFN, Form1.ExceptionSave, False) - MainWindow.ExceptionSave(Application.Info.DirectoryPath & xFN) - Dim unused = MsgBox("A back-up has been saved to " & Application.Info.DirectoryPath & xFN, MsgBoxStyle.Information) - End If - End Sub - End Class + Partial Friend Class MyApplication + + Private Sub MyApplication_Shutdown(sender As Object, e As EventArgs) Handles Me.Shutdown + + End Sub + + Private Sub MyApplication_Startup(sender As Object, e As ApplicationServices.StartupEventArgs) Handles Me.Startup + + End Sub + + Private Sub MyApplication_UnhandledException(sender As Object, e As ApplicationServices.UnhandledExceptionEventArgs) Handles Me.UnhandledException + Dim xRes As MsgBoxResult = MsgBox("An unhandled exception has occurred in the application: " & vbCrLf & + e.Exception.Message & vbCrLf & + vbCrLf & + "Click Yes to save a back-up, click No otherwise, or click Cancel to ignore this exception and continue.", + MsgBoxStyle.YesNoCancel + MsgBoxStyle.Critical, + "Unhandled Exception") + If xRes = MsgBoxResult.Cancel Then e.ExitApplication = False + If xRes = MsgBoxResult.Yes Then + Dim xFN As String + Dim xDate As Date = Date.Now + With xDate + xFN = "\AutoSave_" & .Year & "_" & .Month & "_" & .Day & "_" & .Hour & "_" & .Minute & "_" & .Second & "_" & .Millisecond & ".IBMSC" + End With + + 'My.Computer.FileSystem.WriteAllText(My.Application.Info.DirectoryPath & xFN, Form1.ExceptionSave, False) + MainWindow.ExceptionSave(Application.Info.DirectoryPath & xFN) + Dim unused = MsgBox("A back-up has been saved to " & Application.Info.DirectoryPath & xFN, MsgBoxStyle.Information) + End If + End Sub + End Class End Namespace diff --git a/iBMSC/Audio.vb b/iBMSC/Audio.vb index 55646d796..a62616085 100644 --- a/iBMSC/Audio.vb +++ b/iBMSC/Audio.vb @@ -4,133 +4,133 @@ Imports CSCore.SoundOut Imports NVorbis Friend Module Audio - Private Output As WasapiOut - Private Source As IWaveSource - - Public Sub Initialize() - Output = New WasapiOut() - CodecFactory.Instance.Register("ogg", New CodecFactoryEntry(Function(s) - Return New NVorbisSource(s).ToWaveSource() - End Function, ".ogg")) - End Sub - - Public Sub Finalize() - Output.Stop() - Output.Dispose() - Output = Nothing - End Sub - - Public Function CheckFilename(filename As String) As String - If File.Exists(filename) Then - Return filename - End If - Dim ext = Path.GetExtension(filename) - If String.Compare(ext, ".wav") = 0 OrElse String.Compare(ext, ".ogg") = 0 Then - Dim wpath = Path.ChangeExtension(filename, ".flac") - If File.Exists(wpath) Then - Return wpath - End If - End If - If String.Compare(ext, ".ogg") = 0 OrElse String.Compare(ext, ".flac") = 0 Then - Dim wpath = Path.ChangeExtension(filename, ".wav") - If File.Exists(wpath) Then - Return wpath - End If - End If - If String.Compare(ext, ".wav") = 0 OrElse String.Compare(ext, ".flac") = 0 Then - Dim wpath = Path.ChangeExtension(filename, ".ogg") - If File.Exists(wpath) Then - Return wpath - End If - End If - Return filename - End Function - - Public Sub Play(filename As String) - - If Source IsNot Nothing Then - Output.Stop() - Source.Dispose() - Source = Nothing - End If - - If filename Is String.Empty Then - Return - End If - - Dim fn = CheckFilename(filename) - - If Not File.Exists(fn) Then - Return - End If - - Source = CodecFactory.Instance.GetCodec(fn) - Output.Initialize(Source) - Output.Play() - End Sub - - Public Sub StopPlaying() - Output.Stop() - End Sub + Private Output As WasapiOut + Private Source As IWaveSource + + Public Sub Initialize() + Output = New WasapiOut() + CodecFactory.Instance.Register("ogg", New CodecFactoryEntry(Function(s) + Return New NVorbisSource(s).ToWaveSource() + End Function, ".ogg")) + End Sub + + Public Sub Finalize() + Output.Stop() + Output.Dispose() + Output = Nothing + End Sub + + Public Function CheckFilename(filename As String) As String + If File.Exists(filename) Then + Return filename + End If + Dim ext = Path.GetExtension(filename) + If String.Compare(ext, ".wav") = 0 OrElse String.Compare(ext, ".ogg") = 0 Then + Dim wpath = Path.ChangeExtension(filename, ".flac") + If File.Exists(wpath) Then + Return wpath + End If + End If + If String.Compare(ext, ".ogg") = 0 OrElse String.Compare(ext, ".flac") = 0 Then + Dim wpath = Path.ChangeExtension(filename, ".wav") + If File.Exists(wpath) Then + Return wpath + End If + End If + If String.Compare(ext, ".wav") = 0 OrElse String.Compare(ext, ".flac") = 0 Then + Dim wpath = Path.ChangeExtension(filename, ".ogg") + If File.Exists(wpath) Then + Return wpath + End If + End If + Return filename + End Function + + Public Sub Play(filename As String) + + If Source IsNot Nothing Then + Output.Stop() + Source.Dispose() + Source = Nothing + End If + + If filename Is String.Empty Then + Return + End If + + Dim fn = CheckFilename(filename) + + If Not File.Exists(fn) Then + Return + End If + + Source = CodecFactory.Instance.GetCodec(fn) + Output.Initialize(Source) + Output.Play() + End Sub + + Public Sub StopPlaying() + Output.Stop() + End Sub End Module Friend Class NVorbisSource - Implements ISampleSource - - Private ReadOnly _stream As Stream - Private ReadOnly _vorbisReader As VorbisReader - Private _disposed As Boolean - - Public Sub New(stream As Stream) - If stream Is Nothing Or Not stream.CanRead Then - Throw New ArgumentException(Nothing, NameOf(stream)) - End If - _stream = stream - _vorbisReader = New VorbisReader(stream, Nothing) - WaveFormat = New WaveFormat(_vorbisReader.SampleRate, 32, _vorbisReader.Channels, AudioEncoding.IeeeFloat) - End Sub - - Public ReadOnly Property CanSeek As Boolean Implements IAudioSource.CanSeek - Get - Return _stream.CanSeek - End Get - End Property - - Public ReadOnly Property WaveFormat As WaveFormat Implements IAudioSource.WaveFormat - - Public ReadOnly Property Length As Long Implements IAudioSource.Length - Get - Return IIf(CanSeek, _vorbisReader.TotalTime.TotalSeconds * WaveFormat.SampleRate * WaveFormat.Channels, 0) - End Get - End Property - - Public Property Position As Long Implements IAudioSource.Position - Get - Return IIf(CanSeek, _vorbisReader.TimePosition.TotalSeconds * _vorbisReader.SampleRate * _vorbisReader.Channels, 0) - End Get - Set(value As Long) - If Not CanSeek Then - Throw New InvalidOperationException("Can't seek this stream.") - End If - If value < 0 Or value >= Length Then - Throw New ArgumentOutOfRangeException(NameOf(value)) - End If - _vorbisReader.TimePosition = TimeSpan.FromSeconds(value / _vorbisReader.SampleRate / _vorbisReader.Channels) - End Set - End Property - - - Public Function Read(buffer As Single(), offset As Integer, count As Integer) As Integer Implements ISampleSource.Read - Return _vorbisReader.ReadSamples(buffer, offset, count) - End Function - - Public Sub Dispose() Implements IDisposable.Dispose - If Not _disposed Then - '_vorbisReader.Dispose() - Else - 'Throw New ObjectDisposedException("NVorbisSource") - End If - _disposed = True - End Sub + Implements ISampleSource + + Private ReadOnly _stream As Stream + Private ReadOnly _vorbisReader As VorbisReader + Private _disposed As Boolean + + Public Sub New(stream As Stream) + If stream Is Nothing Or Not stream.CanRead Then + Throw New ArgumentException(Nothing, NameOf(stream)) + End If + _stream = stream + _vorbisReader = New VorbisReader(stream, Nothing) + WaveFormat = New WaveFormat(_vorbisReader.SampleRate, 32, _vorbisReader.Channels, AudioEncoding.IeeeFloat) + End Sub + + Public ReadOnly Property CanSeek As Boolean Implements IAudioSource.CanSeek + Get + Return _stream.CanSeek + End Get + End Property + + Public ReadOnly Property WaveFormat As WaveFormat Implements IAudioSource.WaveFormat + + Public ReadOnly Property Length As Long Implements IAudioSource.Length + Get + Return IIf(CanSeek, _vorbisReader.TotalTime.TotalSeconds * WaveFormat.SampleRate * WaveFormat.Channels, 0) + End Get + End Property + + Public Property Position As Long Implements IAudioSource.Position + Get + Return IIf(CanSeek, _vorbisReader.TimePosition.TotalSeconds * _vorbisReader.SampleRate * _vorbisReader.Channels, 0) + End Get + Set(value As Long) + If Not CanSeek Then + Throw New InvalidOperationException("Can't seek this stream.") + End If + If value < 0 Or value >= Length Then + Throw New ArgumentOutOfRangeException(NameOf(value)) + End If + _vorbisReader.TimePosition = TimeSpan.FromSeconds(value / _vorbisReader.SampleRate / _vorbisReader.Channels) + End Set + End Property + + + Public Function Read(buffer As Single(), offset As Integer, count As Integer) As Integer Implements ISampleSource.Read + Return _vorbisReader.ReadSamples(buffer, offset, count) + End Function + + Public Sub Dispose() Implements IDisposable.Dispose + If Not _disposed Then + '_vorbisReader.Dispose() + Else + 'Throw New ObjectDisposedException("NVorbisSource") + End If + _disposed = True + End Sub End Class diff --git a/iBMSC/BMS.vb b/iBMSC/BMS.vb index 43d1c5916..d21553c62 100644 --- a/iBMSC/BMS.vb +++ b/iBMSC/BMS.vb @@ -1,32 +1,32 @@ Imports iBMSC.Editor Friend Module BMS - Public Function IsChannelLongNote(I As String) As Boolean - Dim LongStart = C36to10("50") - Dim LongEnd = C36to10("8Z") + Public Function IsChannelLongNote(I As String) As Boolean + Dim LongStart = C36to10("50") + Dim LongEnd = C36to10("8Z") - Dim xI As Integer = C36to10(I) + Dim xI As Integer = C36to10(I) - Return xI > LongStart And xI < LongEnd - End Function + Return xI > LongStart And xI < LongEnd + End Function - Public Function IsChannelHidden(I As String) As Boolean - Dim HiddenStart = C36to10("30") - Dim HiddenEnd = C36to10("4Z") - Dim OptionStart = C36to10("70") - Dim OptionEnd = C36to10("8Z") + Public Function IsChannelHidden(I As String) As Boolean + Dim HiddenStart = C36to10("30") + Dim HiddenEnd = C36to10("4Z") + Dim OptionStart = C36to10("70") + Dim OptionEnd = C36to10("8Z") - Dim xI As Integer = C36to10(I) + Dim xI As Integer = C36to10(I) - Return (xI > HiddenStart And xI < HiddenEnd) Or (xI > OptionStart And xI < OptionEnd) - End Function + Return (xI > HiddenStart And xI < HiddenEnd) Or (xI > OptionStart And xI < OptionEnd) + End Function - Public Function IsChannelLandmine(I As String) As Boolean - Dim LandmineStart = C36to10("D0") - Dim LandmineEnd = C36to10("EZ") + Public Function IsChannelLandmine(I As String) As Boolean + Dim LandmineStart = C36to10("D0") + Dim LandmineEnd = C36to10("EZ") - Dim xI As Integer = C36to10(I) + Dim xI As Integer = C36to10(I) - Return xI > LandmineStart And xI < LandmineEnd - End Function + Return xI > LandmineStart And xI < LandmineEnd + End Function End Module diff --git a/iBMSC/BMSONFormat.vb b/iBMSC/BMSONFormat.vb index 14520843c..30c381a2b 100644 --- a/iBMSC/BMSONFormat.vb +++ b/iBMSC/BMSONFormat.vb @@ -1,153 +1,153 @@ Namespace Editor - Public Class Bmson + Public Class Bmson - Public version As String = "1.0.0" - Public info As New BMSInfo() - Public lines As BarLine() = {} - Public bpm_events As BpmEvent() = {} - Public stop_events As StopEvent() = {} - Public scroll_events As ScrollEvent() = {} - Public sound_channels As SoundChannel() = {} - Public bga As New BGA() - Public mine_channels As MineChannel() = {} - Public key_channels As MineChannel() = {} - End Class - Public Class BMSInfo - Public title As String = String.Empty - Public subtitle As String = String.Empty - Public genre As String = String.Empty - Public artist As String = String.Empty - Public subartists As String() = {String.Empty} - Public mode_hint As String = "beat-7k" - Public chart_name As String = String.Empty - Public judge_rank As Integer = 80 - Public total As Double = 90.0R - Public init_bpm As Double = 120.0R - Public level As Integer + Public version As String = "1.0.0" + Public info As New BMSInfo() + Public lines As BarLine() = {} + Public bpm_events As BpmEvent() = {} + Public stop_events As StopEvent() = {} + Public scroll_events As ScrollEvent() = {} + Public sound_channels As SoundChannel() = {} + Public bga As New BGA() + Public mine_channels As MineChannel() = {} + Public key_channels As MineChannel() = {} + End Class + Public Class BMSInfo + Public title As String = String.Empty + Public subtitle As String = String.Empty + Public genre As String = String.Empty + Public artist As String = String.Empty + Public subartists As String() = {String.Empty} + Public mode_hint As String = "beat-7k" + Public chart_name As String = String.Empty + Public judge_rank As Integer = 80 + Public total As Double = 90.0R + Public init_bpm As Double = 120.0R + Public level As Integer - Public back_image As String = String.Empty - Public eyecatch_image As String = String.Empty - Public banner_image As String = String.Empty - Public preview_music As String = String.Empty - Public resolution As Integer = 48 + Public back_image As String = String.Empty + Public eyecatch_image As String = String.Empty + Public banner_image As String = String.Empty + Public preview_music As String = String.Empty + Public resolution As Integer = 48 - Public ln_type As Integer - End Class - Public Class BarLine - Public y As Integer - Public k As Integer = 0 - Public Sub New(position As Integer) - y = position - End Sub - End Class + Public ln_type As Integer + End Class + Public Class BarLine + Public y As Integer + Public k As Integer = 0 + Public Sub New(position As Integer) + y = position + End Sub + End Class - Public Class SoundChannel - Public name As String - Public notes As BmsonNote() = {} - Public Sub New(_name As String) - name = _name - End Sub - End Class + Public Class SoundChannel + Public name As String + Public notes As BmsonNote() = {} + Public Sub New(_name As String) + name = _name + End Sub + End Class - Public Class MineChannel - Public name As String - Public notes As MineNote() = {} - Public Sub New(_name As String) - name = _name - End Sub - End Class + Public Class MineChannel + Public name As String + Public notes As MineNote() = {} + Public Sub New(_name As String) + name = _name + End Sub + End Class - Public Class BGA - Public bga_header As BGAHeader() = {} - Public bga_sequence As BGASequence() = {} - Public bga_events As BGAEvent() = {} - Public layer_events As BGAEvent() = {} - Public poor_events As BGAEvent() = {} - End Class - Public Class BGAHeader - Public id As Integer - Public name As String - Public Sub New(_id As Integer, _name As String) - id = _id - name = _name - End Sub - End Class - Public Class BGASequence - Public id As Integer - Public sequence As Sequence() - End Class + Public Class BGA + Public bga_header As BGAHeader() = {} + Public bga_sequence As BGASequence() = {} + Public bga_events As BGAEvent() = {} + Public layer_events As BGAEvent() = {} + Public poor_events As BGAEvent() = {} + End Class + Public Class BGAHeader + Public id As Integer + Public name As String + Public Sub New(_id As Integer, _name As String) + id = _id + name = _name + End Sub + End Class + Public Class BGASequence + Public id As Integer + Public sequence As Sequence() + End Class - Public MustInherit Class BMSONEvent - Public y As Integer - End Class + Public MustInherit Class BMSONEvent + Public y As Integer + End Class - Public Class BmsonNote - Inherits BMSONEvent - Public x As Integer - Public l As Integer - Public c As Boolean = False - Public t As Integer = 0 - Public up As Boolean = False - Public Sub New(position As Integer, value As Integer, Optional length As Integer = 0) - y = position - x = value - l = length - End Sub - End Class + Public Class BmsonNote + Inherits BMSONEvent + Public x As Integer + Public l As Integer + Public c As Boolean = False + Public t As Integer = 0 + Public up As Boolean = False + Public Sub New(position As Integer, value As Integer, Optional length As Integer = 0) + y = position + x = value + l = length + End Sub + End Class - Public Class BpmEvent - Inherits BMSONEvent - Public bpm As Double - Public Sub New(position As Integer, value As Double) - y = position - bpm = value - End Sub - End Class + Public Class BpmEvent + Inherits BMSONEvent + Public bpm As Double + Public Sub New(position As Integer, value As Double) + y = position + bpm = value + End Sub + End Class - Public Class StopEvent - Inherits BMSONEvent - Public duration As Long - Public Sub New(position As Integer, value As Long) - y = position - duration = value - End Sub - End Class + Public Class StopEvent + Inherits BMSONEvent + Public duration As Long + Public Sub New(position As Integer, value As Long) + y = position + duration = value + End Sub + End Class - Public Class ScrollEvent - Inherits BMSONEvent - Public rate As Double - Public Sub New(position As Integer, value As Double) - y = position - rate = value - End Sub - End Class + Public Class ScrollEvent + Inherits BMSONEvent + Public rate As Double + Public Sub New(position As Integer, value As Double) + y = position + rate = value + End Sub + End Class - Public Class MineNote - Inherits BMSONEvent - Public x As Integer - Public damage As Double - Public Sub New(position As Integer, id As Integer, value As Double) - y = position - x = id - damage = value - End Sub - End Class + Public Class MineNote + Inherits BMSONEvent + Public x As Integer + Public damage As Double + Public Sub New(position As Integer, id As Integer, value As Double) + y = position + x = id + damage = value + End Sub + End Class - Public Class BGAEvent - Inherits BMSONEvent - Public id As Integer - Public id_set As Integer() = {} - Public condition As String = String.Empty - Public interval As Integer = 0 - Public Sub New(position As Integer, value As Double) - y = position - id = value - End Sub - End Class - Public Class Sequence - Public time As Long - Public id As Integer = Integer.MinValue - End Class + Public Class BGAEvent + Inherits BMSONEvent + Public id As Integer + Public id_set As Integer() = {} + Public condition As String = String.Empty + Public interval As Integer = 0 + Public Sub New(position As Integer, value As Double) + y = position + id = value + End Sub + End Class + Public Class Sequence + Public time As Long + Public id As Integer = Integer.MinValue + End Class End Namespace \ No newline at end of file diff --git a/iBMSC/ChartIO.vb b/iBMSC/ChartIO.vb index 31504dde1..021cfbfde 100644 --- a/iBMSC/ChartIO.vb +++ b/iBMSC/ChartIO.vb @@ -1,1513 +1,1513 @@ -Imports iBMSC.Editor -Imports System.Text +Imports System.Text Imports System.Text.Json +Imports iBMSC.Editor Partial Public Class MainWindow - Private Sub OpenBMS(xStrAll As String) - KMouseOver = -1 - - 'Line feed validation: will remove some empty lines - xStrAll = Replace(Replace(Replace(xStrAll, vbLf, vbCr), vbCr & vbCr, vbCr), vbCr, vbCrLf) - - Dim xStrLine() As String = Split(xStrAll, vbCrLf, , CompareMethod.Text) - Dim xI1 As Integer - Dim sLine As String - Dim xExpansion As String = String.Empty - ReDim Notes(0) - ReDim mColumn(999) - ReDim hWAV(1295) - ReDim hBPM(1295) 'x10000 - ReDim hSTOP(1295) - ReDim hBMSCROLL(1295) - InitializeNewBMS() - InitializeOpenBMS() - - With Notes(0) - .ColumnIndex = niBPM - .VPosition = -1 - '.LongNote = False - '.Selected = False - .Value = 1200000 - End With - - 'random, setRandom 0 - 'endRandom 0 - 'if +1 - 'else 0 - 'endif -1 - 'switch, setSwitch +1 - 'case, skip, def 0 - 'endSw -1 - Dim xStack As Integer = 0 - - For Each sLine In xStrLine - Dim sLineTrim As String = sLine.Trim - If xStack > 0 Then GoTo Expansion - - If sLineTrim.StartsWith("#") And Mid(sLineTrim, 5, 3) = "02:" Then - Dim xIndex As Integer = Val(Mid(sLineTrim, 2, 3)) - Dim xRatio As Double = Val(Mid(sLineTrim, 8)) - Dim xxD As Long = GetDenominator(xRatio) - MeasureLength(xIndex) = xRatio * 192.0R - LBeat.Items(xIndex) = Add3Zeros(xIndex) & ": " & xRatio & IIf(xxD > 10000, String.Empty, " ( " & (xRatio * xxD) & " / " & xxD & " ) ") - - ElseIf sLineTrim.StartsWith("#WAV", StringComparison.CurrentCultureIgnoreCase) Then - hWAV(C36to10(Mid(sLineTrim, Len("#WAV") + 1, 2))) = Mid(sLineTrim, Len("#WAV") + 4) - - ElseIf sLineTrim.StartsWith("#BMP", StringComparison.CurrentCultureIgnoreCase) Then - hBMP(C36to10(Mid(sLineTrim, Len("#BMP") + 1, 2))) = Mid(sLineTrim, Len("#BMP") + 4) - - ElseIf sLineTrim.StartsWith("#BPM", StringComparison.CurrentCultureIgnoreCase) And Not Mid(sLineTrim, Len("#BPM") + 1, 1).Trim = String.Empty Then 'If BPM## - ' zdr: No limits on BPM editing.. they don't make much sense. - hBPM(C36to10(Mid(sLineTrim, Len("#BPM") + 1, 2))) = Val(Mid(sLineTrim, Len("#BPM") + 4)) * 10000 - - 'No limits on STOPs either. - ElseIf sLineTrim.StartsWith("#STOP", StringComparison.CurrentCultureIgnoreCase) Then - hSTOP(C36to10(Mid(sLineTrim, Len("#STOP") + 1, 2))) = Val(Mid(sLineTrim, Len("#STOP") + 4)) * 10000 - - ElseIf sLineTrim.StartsWith("#SCROLL", StringComparison.CurrentCultureIgnoreCase) Then - hBMSCROLL(C36to10(Mid(sLineTrim, Len("#SCROLL") + 1, 2))) = Val(Mid(sLineTrim, Len("#SCROLL") + 4)) * 10000 - - - ElseIf sLineTrim.StartsWith("#TITLE", StringComparison.CurrentCultureIgnoreCase) Then - THTitle.Text = Mid(sLineTrim, Len("#TITLE") + 1).Trim - - ElseIf sLineTrim.StartsWith("#ARTIST", StringComparison.CurrentCultureIgnoreCase) Then - THArtist.Text = Mid(sLineTrim, Len("#ARTIST") + 1).Trim - - ElseIf sLineTrim.StartsWith("#GENRE", StringComparison.CurrentCultureIgnoreCase) Then - THGenre.Text = Mid(sLineTrim, Len("#GENRE") + 1).Trim - - ElseIf sLineTrim.StartsWith("#BPM", StringComparison.CurrentCultureIgnoreCase) Then 'If BPM #### - Notes(0).Value = Val(Mid(sLineTrim, Len("#BPM") + 1).Trim) * 10000 - THBPM.Value = Notes(0).Value / 10000 - - ElseIf sLineTrim.StartsWith("#PLAYER", StringComparison.CurrentCultureIgnoreCase) Then - Dim xInt As Integer = Val(Mid(sLineTrim, Len("#PLAYER") + 1).Trim) - If xInt >= 1 And xInt <= 4 Then _ - CHPlayer.SelectedIndex = xInt - 1 - - ElseIf sLineTrim.StartsWith("#RANK", StringComparison.CurrentCultureIgnoreCase) Then - Dim xInt As Integer = Val(Mid(sLineTrim, Len("#RANK") + 1).Trim) - If xInt >= 0 And xInt <= 4 Then _ - CHRank.SelectedIndex = xInt - - ElseIf sLineTrim.StartsWith("#PLAYLEVEL", StringComparison.CurrentCultureIgnoreCase) Then - THPlayLevel.Text = Mid(sLineTrim, Len("#PLAYLEVEL") + 1).Trim - - - ElseIf sLineTrim.StartsWith("#SUBTITLE", StringComparison.CurrentCultureIgnoreCase) Then - THSubTitle.Text = Mid(sLineTrim, Len("#SUBTITLE") + 1).Trim - - ElseIf sLineTrim.StartsWith("#SUBARTIST", StringComparison.CurrentCultureIgnoreCase) Then - THSubArtist.Text = Mid(sLineTrim, Len("#SUBARTIST") + 1).Trim - - ElseIf sLineTrim.StartsWith("#STAGEFILE", StringComparison.CurrentCultureIgnoreCase) Then - THStageFile.Text = Mid(sLineTrim, Len("#STAGEFILE") + 1).Trim - - ElseIf sLineTrim.StartsWith("#BANNER", StringComparison.CurrentCultureIgnoreCase) Then - THBanner.Text = Mid(sLineTrim, Len("#BANNER") + 1).Trim - - ElseIf sLineTrim.StartsWith("#BACKBMP", StringComparison.CurrentCultureIgnoreCase) Then - THBackBMP.Text = Mid(sLineTrim, Len("#BACKBMP") + 1).Trim - - ElseIf sLineTrim.StartsWith("#DIFFICULTY", StringComparison.CurrentCultureIgnoreCase) Then - Try - CHDifficulty.SelectedIndex = Integer.Parse(Mid(sLineTrim, Len("#DIFFICULTY") + 1).Trim) - Catch ex As Exception - End Try + Private Sub OpenBMS(xStrAll As String) + KMouseOver = -1 + + 'Line feed validation: will remove some empty lines + xStrAll = Replace(Replace(Replace(xStrAll, vbLf, vbCr), vbCr & vbCr, vbCr), vbCr, vbCrLf) + + Dim xStrLine() As String = Split(xStrAll, vbCrLf, , CompareMethod.Text) + Dim xI1 As Integer + Dim sLine As String + Dim xExpansion As String = String.Empty + ReDim Notes(0) + ReDim mColumn(999) + ReDim hWAV(1295) + ReDim hBPM(1295) 'x10000 + ReDim hSTOP(1295) + ReDim hBMSCROLL(1295) + InitializeNewBMS() + InitializeOpenBMS() + + With Notes(0) + .ColumnIndex = niBPM + .VPosition = -1 + '.LongNote = False + '.Selected = False + .Value = 1200000 + End With + + 'random, setRandom 0 + 'endRandom 0 + 'if +1 + 'else 0 + 'endif -1 + 'switch, setSwitch +1 + 'case, skip, def 0 + 'endSw -1 + Dim xStack As Integer = 0 + + For Each sLine In xStrLine + Dim sLineTrim As String = sLine.Trim + If xStack > 0 Then GoTo Expansion + + If sLineTrim.StartsWith("#") And Mid(sLineTrim, 5, 3) = "02:" Then + Dim xIndex As Integer = Val(Mid(sLineTrim, 2, 3)) + Dim xRatio As Double = Val(Mid(sLineTrim, 8)) + Dim xxD As Long = GetDenominator(xRatio) + MeasureLength(xIndex) = xRatio * 192.0R + LBeat.Items(xIndex) = Add3Zeros(xIndex) & ": " & xRatio & IIf(xxD > 10000, String.Empty, " ( " & (xRatio * xxD) & " / " & xxD & " ) ") + + ElseIf sLineTrim.StartsWith("#WAV", StringComparison.CurrentCultureIgnoreCase) Then + hWAV(C36to10(Mid(sLineTrim, Len("#WAV") + 1, 2))) = Mid(sLineTrim, Len("#WAV") + 4) + + ElseIf sLineTrim.StartsWith("#BMP", StringComparison.CurrentCultureIgnoreCase) Then + hBMP(C36to10(Mid(sLineTrim, Len("#BMP") + 1, 2))) = Mid(sLineTrim, Len("#BMP") + 4) + + ElseIf sLineTrim.StartsWith("#BPM", StringComparison.CurrentCultureIgnoreCase) And Not Mid(sLineTrim, Len("#BPM") + 1, 1).Trim = String.Empty Then 'If BPM## + ' zdr: No limits on BPM editing.. they don't make much sense. + hBPM(C36to10(Mid(sLineTrim, Len("#BPM") + 1, 2))) = Val(Mid(sLineTrim, Len("#BPM") + 4)) * 10000 + + 'No limits on STOPs either. + ElseIf sLineTrim.StartsWith("#STOP", StringComparison.CurrentCultureIgnoreCase) Then + hSTOP(C36to10(Mid(sLineTrim, Len("#STOP") + 1, 2))) = Val(Mid(sLineTrim, Len("#STOP") + 4)) * 10000 + + ElseIf sLineTrim.StartsWith("#SCROLL", StringComparison.CurrentCultureIgnoreCase) Then + hBMSCROLL(C36to10(Mid(sLineTrim, Len("#SCROLL") + 1, 2))) = Val(Mid(sLineTrim, Len("#SCROLL") + 4)) * 10000 + + + ElseIf sLineTrim.StartsWith("#TITLE", StringComparison.CurrentCultureIgnoreCase) Then + THTitle.Text = Mid(sLineTrim, Len("#TITLE") + 1).Trim + + ElseIf sLineTrim.StartsWith("#ARTIST", StringComparison.CurrentCultureIgnoreCase) Then + THArtist.Text = Mid(sLineTrim, Len("#ARTIST") + 1).Trim + + ElseIf sLineTrim.StartsWith("#GENRE", StringComparison.CurrentCultureIgnoreCase) Then + THGenre.Text = Mid(sLineTrim, Len("#GENRE") + 1).Trim + + ElseIf sLineTrim.StartsWith("#BPM", StringComparison.CurrentCultureIgnoreCase) Then 'If BPM #### + Notes(0).Value = Val(Mid(sLineTrim, Len("#BPM") + 1).Trim) * 10000 + THBPM.Value = Notes(0).Value / 10000 + + ElseIf sLineTrim.StartsWith("#PLAYER", StringComparison.CurrentCultureIgnoreCase) Then + Dim xInt As Integer = Val(Mid(sLineTrim, Len("#PLAYER") + 1).Trim) + If xInt >= 1 And xInt <= 4 Then _ + CHPlayer.SelectedIndex = xInt - 1 + + ElseIf sLineTrim.StartsWith("#RANK", StringComparison.CurrentCultureIgnoreCase) Then + Dim xInt As Integer = Val(Mid(sLineTrim, Len("#RANK") + 1).Trim) + If xInt >= 0 And xInt <= 4 Then _ + CHRank.SelectedIndex = xInt + + ElseIf sLineTrim.StartsWith("#PLAYLEVEL", StringComparison.CurrentCultureIgnoreCase) Then + THPlayLevel.Text = Mid(sLineTrim, Len("#PLAYLEVEL") + 1).Trim + + + ElseIf sLineTrim.StartsWith("#SUBTITLE", StringComparison.CurrentCultureIgnoreCase) Then + THSubTitle.Text = Mid(sLineTrim, Len("#SUBTITLE") + 1).Trim + + ElseIf sLineTrim.StartsWith("#SUBARTIST", StringComparison.CurrentCultureIgnoreCase) Then + THSubArtist.Text = Mid(sLineTrim, Len("#SUBARTIST") + 1).Trim + + ElseIf sLineTrim.StartsWith("#STAGEFILE", StringComparison.CurrentCultureIgnoreCase) Then + THStageFile.Text = Mid(sLineTrim, Len("#STAGEFILE") + 1).Trim + + ElseIf sLineTrim.StartsWith("#BANNER", StringComparison.CurrentCultureIgnoreCase) Then + THBanner.Text = Mid(sLineTrim, Len("#BANNER") + 1).Trim + + ElseIf sLineTrim.StartsWith("#BACKBMP", StringComparison.CurrentCultureIgnoreCase) Then + THBackBMP.Text = Mid(sLineTrim, Len("#BACKBMP") + 1).Trim + + ElseIf sLineTrim.StartsWith("#DIFFICULTY", StringComparison.CurrentCultureIgnoreCase) Then + Try + CHDifficulty.SelectedIndex = Integer.Parse(Mid(sLineTrim, Len("#DIFFICULTY") + 1).Trim) + Catch ex As Exception + End Try - ElseIf sLineTrim.StartsWith("#DEFEXRANK", StringComparison.CurrentCultureIgnoreCase) Then - THExRank.Text = Mid(sLineTrim, Len("#DEFEXRANK") + 1).Trim + ElseIf sLineTrim.StartsWith("#DEFEXRANK", StringComparison.CurrentCultureIgnoreCase) Then + THExRank.Text = Mid(sLineTrim, Len("#DEFEXRANK") + 1).Trim - ElseIf sLineTrim.StartsWith("#TOTAL", StringComparison.CurrentCultureIgnoreCase) Then - Dim xStr As String = Mid(sLineTrim, Len("#TOTAL") + 1).Trim - 'If xStr.EndsWith("%") Then xStr = Mid(xStr, 1, Len(xStr) - 1) - THTotal.Text = xStr + ElseIf sLineTrim.StartsWith("#TOTAL", StringComparison.CurrentCultureIgnoreCase) Then + Dim xStr As String = Mid(sLineTrim, Len("#TOTAL") + 1).Trim + 'If xStr.EndsWith("%") Then xStr = Mid(xStr, 1, Len(xStr) - 1) + THTotal.Text = xStr - ElseIf sLineTrim.StartsWith("#COMMENT", StringComparison.CurrentCultureIgnoreCase) Then - Dim xStr As String = Mid(sLineTrim, Len("#COMMENT") + 1).Trim - If xStr.StartsWith("""") Then xStr = Mid(xStr, 2) - If xStr.EndsWith("""") Then xStr = Mid(xStr, 1, Len(xStr) - 1) - THComment.Text = xStr + ElseIf sLineTrim.StartsWith("#COMMENT", StringComparison.CurrentCultureIgnoreCase) Then + Dim xStr As String = Mid(sLineTrim, Len("#COMMENT") + 1).Trim + If xStr.StartsWith("""") Then xStr = Mid(xStr, 2) + If xStr.EndsWith("""") Then xStr = Mid(xStr, 1, Len(xStr) - 1) + THComment.Text = xStr - ElseIf sLineTrim.StartsWith("#LNTYPE", StringComparison.CurrentCultureIgnoreCase) Then - 'THLnType.Text = Mid(sLineTrim, Len("#LNTYPE") + 1).Trim - If Val(Mid(sLineTrim, Len("#LNTYPE") + 1).Trim) = 1 Then CHLnObj.SelectedIndex = 0 + ElseIf sLineTrim.StartsWith("#LNTYPE", StringComparison.CurrentCultureIgnoreCase) Then + 'THLnType.Text = Mid(sLineTrim, Len("#LNTYPE") + 1).Trim + If Val(Mid(sLineTrim, Len("#LNTYPE") + 1).Trim) = 1 Then CHLnObj.SelectedIndex = 0 - ElseIf sLineTrim.StartsWith("#LNOBJ", StringComparison.CurrentCultureIgnoreCase) Then - Dim xValue As Integer = C36to10(Mid(sLineTrim, Len("#LNOBJ") + 1).Trim) - CHLnObj.SelectedIndex = xValue + ElseIf sLineTrim.StartsWith("#LNOBJ", StringComparison.CurrentCultureIgnoreCase) Then + Dim xValue As Integer = C36to10(Mid(sLineTrim, Len("#LNOBJ") + 1).Trim) + CHLnObj.SelectedIndex = xValue - 'TODO: LNOBJ value validation + 'TODO: LNOBJ value validation - 'ElseIf sLineTrim.StartsWith("#LNTYPE", StringComparison.CurrentCultureIgnoreCase) Then - ' CAdLNTYPE.Checked = True - ' If Mid(sLineTrim, 9) = "" Or Mid(sLineTrim, 9) = "1" Or Mid(sLineTrim, 9) = "01" Then CAdLNTYPEb.Text = "1" - ' CAdLNTYPEb.Text = Mid(sLineTrim, 9) + 'ElseIf sLineTrim.StartsWith("#LNTYPE", StringComparison.CurrentCultureIgnoreCase) Then + ' CAdLNTYPE.Checked = True + ' If Mid(sLineTrim, 9) = "" Or Mid(sLineTrim, 9) = "1" Or Mid(sLineTrim, 9) = "01" Then CAdLNTYPEb.Text = "1" + ' CAdLNTYPEb.Text = Mid(sLineTrim, 9) - ElseIf sLineTrim.StartsWith("#PREVIEW", StringComparison.CurrentCultureIgnoreCase) Then - THPreview.Text = Mid(sLineTrim, Len("#PREVIEW") + 1).Trim + ElseIf sLineTrim.StartsWith("#PREVIEW", StringComparison.CurrentCultureIgnoreCase) Then + THPreview.Text = Mid(sLineTrim, Len("#PREVIEW") + 1).Trim - ElseIf sLineTrim.StartsWith("#LNMODE", StringComparison.CurrentCultureIgnoreCase) Then - Dim xInt As Integer = Val(Mid(sLineTrim, Len("#LNMODE") + 1).Trim) - If xInt >= 1 And xInt <= 3 Then _ - CHLnmode.SelectedIndex = xInt + ElseIf sLineTrim.StartsWith("#LNMODE", StringComparison.CurrentCultureIgnoreCase) Then + Dim xInt As Integer = Val(Mid(sLineTrim, Len("#LNMODE") + 1).Trim) + If xInt >= 1 And xInt <= 3 Then _ + CHLnmode.SelectedIndex = xInt - ElseIf sLineTrim.StartsWith("#") And Mid(sLineTrim, 7, 1) = ":" Then 'If the line contains Ks - Dim xIdentifier As String = Mid(sLineTrim, 5, 2) - If BMSChannelToColumn(xIdentifier) = 0 Then GoTo AddExpansion + ElseIf sLineTrim.StartsWith("#") And Mid(sLineTrim, 7, 1) = ":" Then 'If the line contains Ks + Dim xIdentifier As String = Mid(sLineTrim, 5, 2) + If BMSChannelToColumn(xIdentifier) = 0 Then GoTo AddExpansion - Else + Else Expansion: If sLineTrim.StartsWith("#IF", StringComparison.CurrentCultureIgnoreCase) Then - xStack += 1 : GoTo AddExpansion - ElseIf sLineTrim.StartsWith("#ENDIF", StringComparison.CurrentCultureIgnoreCase) Then - xStack -= 1 : GoTo AddExpansion - ElseIf sLineTrim.StartsWith("#SWITCH", StringComparison.CurrentCultureIgnoreCase) Then - xStack += 1 : GoTo AddExpansion - ElseIf sLineTrim.StartsWith("#SETSWITCH", StringComparison.CurrentCultureIgnoreCase) Then - xStack += 1 : GoTo AddExpansion - ElseIf sLineTrim.StartsWith("#ENDSW", StringComparison.CurrentCultureIgnoreCase) Then - xStack -= 1 : GoTo AddExpansion - - ElseIf sLineTrim.StartsWith("#") Then + xStack += 1 : GoTo AddExpansion + ElseIf sLineTrim.StartsWith("#ENDIF", StringComparison.CurrentCultureIgnoreCase) Then + xStack -= 1 : GoTo AddExpansion + ElseIf sLineTrim.StartsWith("#SWITCH", StringComparison.CurrentCultureIgnoreCase) Then + xStack += 1 : GoTo AddExpansion + ElseIf sLineTrim.StartsWith("#SETSWITCH", StringComparison.CurrentCultureIgnoreCase) Then + xStack += 1 : GoTo AddExpansion + ElseIf sLineTrim.StartsWith("#ENDSW", StringComparison.CurrentCultureIgnoreCase) Then + xStack -= 1 : GoTo AddExpansion + + ElseIf sLineTrim.StartsWith("#") Then AddExpansion: xExpansion &= sLine & vbCrLf - End If - - End If - Next - - UpdateMeasureBottom() - - xStack = 0 - For Each sLine In xStrLine - Dim sLineTrim As String = sLine.Trim - If xStack > 0 Then Continue For - - If Not (sLineTrim.StartsWith("#") And Mid(sLineTrim, 7, 1) = ":") Then Continue For 'If the line contains Ks - - ' >> Measure = Mid(sLine, 2, 3) - ' >> Column Identifier = Mid(sLine, 5, 2) - ' >> K = Mid(sLine, xI1, 2) - Dim xMeasure As Integer = Val(Mid(sLineTrim, 2, 3)) - Dim Channel As String = Mid(sLineTrim, 5, 2) - If BMSChannelToColumn(Channel) = 0 Then Continue For - - If Channel = "01" Then mColumn(xMeasure) += 1 'If the identifier is 01 then add a B column in that measure - For xI1 = 8 To Len(sLineTrim) - 1 Step 2 'For all Ks within that line ( - 1 can be ommitted ) - If Mid(sLineTrim, xI1, 2) = "00" Then Continue For 'If the K is not 00 - - ReDim Preserve Notes(Notes.Length) - - With Notes(UBound(Notes)) - .ColumnIndex = BMSChannelToColumn(Channel) + - (IIf(Channel = "01", 1, 0) * (mColumn(xMeasure) - 1)) - .LongNote = IsChannelLongNote(Channel) - .Hidden = IsChannelHidden(Channel) - .Landmine = IsChannelLandmine(Channel) - .Selected = False - .VPosition = MeasureBottom(xMeasure) + (MeasureLength(xMeasure) * ((xI1 / 2) - 4) / ((Len(sLineTrim) - 7) / 2)) - .Value = C36to10(Mid(sLineTrim, xI1, 2)) * 10000 - - If Channel = "03" Then .Value = Convert.ToInt32(Mid(sLineTrim, xI1, 2), 16) * 10000 - If Channel = "08" Then .Value = hBPM(C36to10(Mid(sLineTrim, xI1, 2))) - If Channel = "09" Then .Value = hSTOP(C36to10(Mid(sLineTrim, xI1, 2))) - If Channel = "SC" Then .Value = hBMSCROLL(C36to10(Mid(sLineTrim, xI1, 2))) - End With - - Next - Next - - If NTInput Then ConvertBMSE2NT() - - LWAV.Visible = False - LWAV.Items.Clear() - LBMP.Visible = False - LBMP.Items.Clear() - For xI1 = 1 To 1295 - Dim unused1 = LWAV.Items.Add(C10to36(xI1) & ": " & hWAV(xI1)) - Dim unused = LBMP.Items.Add(C10to36(xI1) & ": " & hBMP(xI1)) - Next - LWAV.SelectedIndex = 0 - LWAV.Visible = True - LBMP.SelectedIndex = 0 - LBMP.Visible = True - THLandMine.Text = hWAV(0) - THMissBMP.Text = hBMP(0) - TExpansion.Text = xExpansion - Chartinfo.Fultitle = THTitle.Text + THSubTitle.Text - Chartinfo.Allartist = THArtist.Text + THSubArtist.Text - My.Forms.Chartinfo.Label1.Text = Chartinfo.Fultitle - My.Forms.Chartinfo.Label2.Text = Chartinfo.Allartist - SortByVPositionQuick(0, UBound(Notes)) - UpdatePairing() - CalculateTotalPlayableNotes() - CalculateGreatestVPosition() - RefreshPanelAll() - POStatusRefresh() - End Sub - - Private ReadOnly BMSChannelList() As String = {"01", "03", "04", "06", "07", "08", "09", - "11", "12", "13", "14", "15", "16", "17", "18", "19", "1A", "1B", "1C", "1D", "1E", "1F", "1G", "1H", "1I", "1J", "1K", "1L", "1M", "1N", "1O", "1P", "1Q", - "21", "22", "23", "24", "25", "26", "27", "28", "29", "2A", "2B", "2C", "2D", "2E", "2F", "2G", "2H", "2I", "2J", "2K", "2L", "2M", "2N", "2O", "2P", "2Q", - "31", "32", "33", "34", "35", "36", "37", "38", "39", "3A", "3B", "3C", "3D", "3E", "3F", "3G", "3H", "3I", "3J", "3K", "3L", "3M", "3N", "3O", "3P", "3Q", - "41", "42", "43", "44", "45", "46", "47", "48", "49", "4A", "4B", "4C", "4D", "4E", "4F", "4G", "4H", "4I", "4J", "4K", "4L", "4M", "4N", "4O", "4P", "4Q", - "51", "52", "53", "54", "55", "56", "57", "58", "59", "5A", "5B", "5C", "5D", "5E", "5F", "5G", "5H", "5I", "5J", "5K", "5L", "5M", "5N", "5O", "5P", "5Q", - "61", "62", "63", "64", "65", "66", "67", "68", "69", "6A", "6B", "6C", "6D", "6E", "6F", "6G", "6H", "6I", "6J", "6K", "6L", "6M", "6N", "6O", "6P", "6Q", - "D1", "D2", "D3", "D4", "D5", "D6", "D7", "D8", "D9", "DA", "DB", "DC", "DD", "DE", "DF", "DG", "DH", "DI", "DJ", "DK", "DL", "DM", "DN", "DO", "DP", "DQ", - "E1", "E2", "E3", "E4", "E5", "E6", "E7", "E8", "E9", "EA", "EB", "EC", "ED", "EE", "EF", "EG", "EH", "EI", "EJ", "EK", "EL", "EM", "EN", "EO", "EP", "EQ", - "SC"} - ' 71 through 89 are reserved - '"71", "72", "73", "74", "75", "76", "78", "79", - '"81", "82", "83", "84", "85", "86", "88", "89", - - - Private Function SaveBMS() As String - CalculateGreatestVPosition() - SortByVPositionInsertion() - UpdatePairing() - Dim MeasureIndex As Integer - Dim hasOverlapping As Boolean = False - 'Dim xStrAll As String = "" 'for all - Dim xStrMeasure(MeasureAtDisplacement(GreatestVPosition) + 1) As String - - ' We regenerate these when traversing the bms event list. - ReDim hBPM(0) - ReDim hSTOP(0) - ReDim hBMSCROLL(0) - - Dim xNTInput As Boolean = NTInput - Dim xKBackUp() As Note = Notes - If xNTInput Then - NTInput = False - ConvertNT2BMSE() - End If - - Dim tempNote As Note 'Temp K - - Dim xprevNotes(-1) As Note 'Notes too close to the next measure - - For MeasureIndex = 0 To MeasureAtDisplacement(GreatestVPosition) + 1 'For xI1 in each measure - xStrMeasure(MeasureIndex) = vbCrLf - - Dim consistentDecimalStr = WriteDecimalWithDot(MeasureLength(MeasureIndex) / 192.0R) - - ' Handle fractional measure - If MeasureLength(MeasureIndex) <> 192.0R Then xStrMeasure(MeasureIndex) &= "#" & Add3Zeros(MeasureIndex) & "02:" & consistentDecimalStr & vbCrLf - - ' Get note count in current measure - Dim LowerLimit As Integer = Nothing - Dim UpperLimit As Integer = Nothing - GetMeasureLimits(MeasureIndex, LowerLimit, UpperLimit) - - If UpperLimit - LowerLimit = 0 Then Continue For 'If there is no K in the current measure then end this loop - - ' Get notes from this measure - Dim xUPrevText As Integer = UBound(xprevNotes) - Dim NotesInMeasure(UpperLimit - LowerLimit + xUPrevText) As Note - - ' Copy notes from previous array - For i = 0 To xUPrevText - NotesInMeasure(i) = xprevNotes(i) - Next - - ' Copy notes in current measure - For i = LowerLimit To UpperLimit - 1 - NotesInMeasure(i - LowerLimit + xprevNotes.Length) = Notes(i) - Next - - ' Find greatest column. - ' Since background tracks have the highest column values - ' this - niB will yield the number of B columns. - Dim GreatestColumn = 0 - For Each tempNote In NotesInMeasure - GreatestColumn = Math.Max(tempNote.ColumnIndex, GreatestColumn) - Next - - ReDim xprevNotes(-1) - xStrMeasure(MeasureIndex) &= GenerateBackgroundTracks(MeasureIndex, hasOverlapping, NotesInMeasure, GreatestColumn, xprevNotes) - xStrMeasure(MeasureIndex) &= GenerateKeyTracks(MeasureIndex, hasOverlapping, NotesInMeasure, xprevNotes) - Next - - ' Warn about 255 limit if neccesary. - If hasOverlapping Then Dim unused3 = MsgBox(Strings.Messages.SaveWarning & vbCrLf & - Strings.Messages.NoteOverlapError & vbCrLf & - Strings.Messages.SavedFileWillContainErrors, MsgBoxStyle.Exclamation) - If UBound(hBPM) > IIf(BPMx1296, 1295, 255) Then Dim unused2 = MsgBox(Strings.Messages.SaveWarning & vbCrLf & - Strings.Messages.BPMOverflowError & UBound(hBPM) & " > " & IIf(BPMx1296, 1295, 255) & vbCrLf & - Strings.Messages.SavedFileWillContainErrors, MsgBoxStyle.Exclamation) - If UBound(hSTOP) > IIf(STOPx1296, 1295, 255) Then Dim unused1 = MsgBox(Strings.Messages.SaveWarning & vbCrLf & - Strings.Messages.STOPOverflowError & UBound(hSTOP) & " > " & IIf(STOPx1296, 1295, 255) & vbCrLf & - Strings.Messages.SavedFileWillContainErrors, MsgBoxStyle.Exclamation) - If UBound(hBMSCROLL) > 1295 Then Dim unused = MsgBox(Strings.Messages.SaveWarning & vbCrLf & - Strings.Messages.SCROLLOverflowError & UBound(hBMSCROLL) & " > " & 1295 & vbCrLf & - Strings.Messages.SavedFileWillContainErrors, MsgBoxStyle.Exclamation) - - ' Add expansion text - Dim xStrExp As String = vbCrLf & "*---------------------- EXPANSION FIELD" & vbCrLf & TExpansion.Text & vbCrLf & vbCrLf - If TExpansion.Text = String.Empty Then xStrExp = String.Empty - - ' Output main data field. - Dim xStrMain As String = "*---------------------- MAIN DATA FIELD" & vbCrLf & vbCrLf & Join(xStrMeasure, String.Empty) & vbCrLf - - If xNTInput Then - Notes = xKBackUp - NTInput = True - End If - - ' Generate headers now, since we have the unique BPM/STOP/etc declarations. - Dim xStrHeader As String = GenerateHeaderMeta() - xStrHeader &= GenerateHeaderIndexedData() - - Dim xStrAll As String = xStrHeader & vbCrLf & xStrExp & vbCrLf & xStrMain - Return xStrAll - End Function - - Private Function GenerateHeaderMeta() As String - Dim headerBuilder As New System.Text.StringBuilder() - - ' Append the header start marker - headerBuilder.AppendLine().AppendLine("*-------------------- HEADER FIELD").AppendLine() - - ' Append common header fields - headerBuilder.AppendLine($"#PLAYER {CHPlayer.SelectedIndex + 1}") - headerBuilder.AppendLine($"#GENRE {THGenre.Text}") - headerBuilder.AppendLine($"#TITLE {THTitle.Text}") - headerBuilder.AppendLine($"#ARTIST {THArtist.Text}") - headerBuilder.AppendLine($"#BPM {WriteDecimalWithDot(Notes(0).Value / 10000)}") - headerBuilder.AppendLine($"#PLAYLEVEL {THPlayLevel.Text}") - headerBuilder.AppendLine($"#RANK {CHRank.SelectedIndex}").AppendLine() - - ' Append optional header fields if they are not empty - If Not String.IsNullOrEmpty(THSubTitle.Text) Then headerBuilder.AppendLine($"#SUBTITLE {THSubTitle.Text}") - If Not String.IsNullOrEmpty(THSubArtist.Text) Then headerBuilder.AppendLine($"#SUBARTIST {THSubArtist.Text}") - If Not String.IsNullOrEmpty(THStageFile.Text) Then headerBuilder.AppendLine($"#STAGEFILE {THStageFile.Text}") - If Not String.IsNullOrEmpty(THBanner.Text) Then headerBuilder.AppendLine($"#BANNER {THBanner.Text}") - If Not String.IsNullOrEmpty(THBackBMP.Text) Then headerBuilder.AppendLine($"#BACKBMP {THBackBMP.Text}").AppendLine() - - ' Append more optional header fields if specified - If CHDifficulty.SelectedIndex > 0 Then headerBuilder.AppendLine($"#DIFFICULTY {CHDifficulty.SelectedIndex}") - If Not String.IsNullOrEmpty(THExRank.Text) Then headerBuilder.AppendLine($"#DEFEXRANK {THExRank.Text}") - If Not String.IsNullOrEmpty(THTotal.Text) Then headerBuilder.AppendLine($"#TOTAL {THTotal.Text}") - If Not String.IsNullOrEmpty(THComment.Text) Then headerBuilder.AppendLine($"#COMMENT ""{THComment.Text}""") - ' Uncomment the following line if THLnType is used - ' If Not String.IsNullOrEmpty(THLnType.Text) Then headerBuilder.AppendLine($"#LNTYPE {THLnType.Text}") - If CHLnObj.SelectedIndex > 0 Then headerBuilder.AppendLine($"#LNOBJ {C10to36(CHLnObj.SelectedIndex)}") _ - Else headerBuilder.AppendLine("#LNTYPE 1") - If Not String.IsNullOrEmpty(THPreview.Text) Then headerBuilder.AppendLine($"#PREVIEW {THPreview.Text}") - If CHLnmode.SelectedIndex > 0 Then headerBuilder.AppendLine($"#LNMODE {CHLnmode.SelectedIndex}").AppendLine() - - ' Return the completed header string - Return headerBuilder.ToString() - End Function - - - Private Function GenerateHeaderIndexedData() As String - Dim xStrHeader As New StringBuilder - - For i = 0 To UBound(hWAV) - If hWAV(i) <> String.Empty Then - xStrHeader.AppendFormat("#WAV{0} {1}{2}", C10to36(i), hWAV(i), vbCrLf) - End If - Next - - For i = 0 To UBound(hBMP) - If hBMP(i) <> String.Empty Then - xStrHeader.AppendFormat("#BMP{0} {1}{2}", C10to36(i), hBMP(i), vbCrLf) - End If - Next - - For i = 1 To UBound(hBPM) - xStrHeader.AppendFormat("#BPM{0} {1}{2}", - IIf(BPMx1296, C10to36(i), Mid("0" & Hex(i), Len(Hex(i)))), - WriteDecimalWithDot(hBPM(i) / 10000), vbCrLf) - Next - - For i = 1 To UBound(hSTOP) - xStrHeader.AppendFormat("#STOP{0} {1}{2}", - IIf(STOPx1296, C10to36(i), Mid("0" & Hex(i), Len(Hex(i)))), - WriteDecimalWithDot(hSTOP(i) / 10000), vbCrLf) - Next - - For i = 1 To UBound(hBMSCROLL) - xStrHeader.AppendFormat("#SCROLL{0} {1}{2}", - C10to36(i), WriteDecimalWithDot(hBMSCROLL(i) / 10000), vbCrLf) - Next - - Return xStrHeader.ToString() - End Function - - - Private Sub GetMeasureLimits(MeasureIndex As Integer, ByRef LowerLimit As Integer, ByRef UpperLimit As Integer) - Dim NoteCount = UBound(Notes) - LowerLimit = 0 - - For i = 1 To NoteCount 'Collect Ks in the same measure - If MeasureAtDisplacement(Notes(i).VPosition) >= MeasureIndex Then - LowerLimit = i - Exit For - End If 'Lower limit found - Next - - UpperLimit = 0 - - For i = LowerLimit To NoteCount - If MeasureAtDisplacement(Notes(i).VPosition) > MeasureIndex Then - UpperLimit = i - Exit For 'Upper limit found - End If - Next - - If UpperLimit < LowerLimit Then UpperLimit = NoteCount + 1 - End Sub - - Private Function GenerateKeyTracks(MeasureIndex As Integer, ByRef hasOverlapping As Boolean, NotesInMeasure() As Note, ByRef xprevNotes() As Note) As String - Dim CurrentBMSChannel As String - Dim Ret As String = String.Empty - - For Each CurrentBMSChannel In BMSChannelList 'Start rendering other notes - Dim relativeMeasurePos(-1) 'Ks in the same column - Dim NoteStrings(-1) 'Ks in the same column - - ' Background tracks take care of this. - If CurrentBMSChannel = "01" Then Continue For - - - For NoteIndex = 0 To UBound(NotesInMeasure) 'Find Ks in the same column (xI4 is TK index) - - Dim currentNote As Note = NotesInMeasure(NoteIndex) - If GetBMSChannelBy(currentNote) = CurrentBMSChannel Then - - ReDim Preserve relativeMeasurePos(UBound(relativeMeasurePos) + 1) - ReDim Preserve NoteStrings(UBound(NoteStrings) + 1) - relativeMeasurePos(UBound(relativeMeasurePos)) = currentNote.VPosition - MeasureBottom(MeasureAtDisplacement(currentNote.VPosition)) - If relativeMeasurePos(UBound(relativeMeasurePos)) < 0 Then relativeMeasurePos(UBound(relativeMeasurePos)) = 0 - - If CurrentBMSChannel = "03" Then 'If integer bpm - NoteStrings(UBound(NoteStrings)) = Mid("0" & Hex(currentNote.Value \ 10000), Len(Hex(currentNote.Value \ 10000))) - ElseIf CurrentBMSChannel = "08" Then 'If bpm requires declaration - Dim BpmIndex - For BpmIndex = 1 To UBound(hBPM) ' find BPM value in existing array - If currentNote.Value = hBPM(BpmIndex) Then Exit For - Next - If BpmIndex > UBound(hBPM) Then ' Didn't find it, add it - ReDim Preserve hBPM(UBound(hBPM) + 1) - hBPM(UBound(hBPM)) = currentNote.Value - End If - NoteStrings(UBound(NoteStrings)) = IIf(BPMx1296, C10to36(BpmIndex), Mid("0" & Hex(BpmIndex), Len(Hex(BpmIndex)))) - ElseIf CurrentBMSChannel = "09" Then 'If STOP - Dim StopIndex - For StopIndex = 1 To UBound(hSTOP) ' find STOP value in existing array - If currentNote.Value = hSTOP(StopIndex) Then Exit For - Next - - If StopIndex > UBound(hSTOP) Then ' Didn't find it, add it - ReDim Preserve hSTOP(UBound(hSTOP) + 1) - hSTOP(UBound(hSTOP)) = currentNote.Value - End If - NoteStrings(UBound(NoteStrings)) = IIf(STOPx1296, C10to36(StopIndex), Mid("0" & Hex(StopIndex), Len(Hex(StopIndex)))) - ElseIf CurrentBMSChannel = "SC" Then 'If SCROLL - Dim ScrollIndex - For ScrollIndex = 1 To UBound(hBMSCROLL) ' find SCROLL value in existing array - If currentNote.Value = hBMSCROLL(ScrollIndex) Then Exit For - Next - - If ScrollIndex > UBound(hBMSCROLL) Then ' Didn't find it, add it - ReDim Preserve hBMSCROLL(UBound(hBMSCROLL) + 1) - hBMSCROLL(UBound(hBMSCROLL)) = currentNote.Value - End If - NoteStrings(UBound(NoteStrings)) = C10to36(ScrollIndex) - Else - NoteStrings(UBound(NoteStrings)) = C10to36(currentNote.Value \ 10000) - End If - End If - Next - - If relativeMeasurePos.Length = 0 Then Continue For - - Dim xGCD As Double = MeasureLength(MeasureIndex) - For i = 0 To UBound(relativeMeasurePos) 'find greatest common divisor - If relativeMeasurePos(i) > 0 Then xGCD = GCD(xGCD, relativeMeasurePos(i)) - Next - - Dim xStrKey() As String - ReDim xStrKey(CInt(MeasureLength(MeasureIndex) / xGCD) - 1) - For i = 0 To UBound(xStrKey) 'assign 00 to all keys - xStrKey(i) = "00" - Next - - For i = 0 To UBound(relativeMeasurePos) 'assign K texts - If CInt(relativeMeasurePos(i) / xGCD) > UBound(xStrKey) Then - ReDim Preserve xprevNotes(UBound(xprevNotes) + 1) - With xprevNotes(UBound(xprevNotes)) - .ColumnIndex = BMSChannelToColumn(BMSChannelList(CurrentBMSChannel)) - .LongNote = IsChannelLongNote(BMSChannelList(CurrentBMSChannel)) - .Hidden = IsChannelHidden(BMSChannelList(CurrentBMSChannel)) - .VPosition = MeasureBottom(MeasureIndex) - .Value = C36to10(NoteStrings(i)) - End With - If BMSChannelList(CurrentBMSChannel) = "08" Then _ - xprevNotes(UBound(xprevNotes)).Value = IIf(BPMx1296, hBPM(C36to10(NoteStrings(i))), hBPM(Convert.ToInt32(NoteStrings(i), 16))) - If BMSChannelList(CurrentBMSChannel) = "09" Then _ - xprevNotes(UBound(xprevNotes)).Value = IIf(STOPx1296, hSTOP(C36to10(NoteStrings(i))), hSTOP(Convert.ToInt32(NoteStrings(i), 16))) - If BMSChannelList(CurrentBMSChannel) = "SC" Then _ - xprevNotes(UBound(xprevNotes)).Value = hBMSCROLL(C36to10(NoteStrings(i))) - Continue For - End If - If xStrKey(relativeMeasurePos(i) / xGCD) <> "00" Then - hasOverlapping = True - End If - - xStrKey(relativeMeasurePos(i) / xGCD) = NoteStrings(i) - Next - - Ret &= "#" & Add3Zeros(MeasureIndex) & CurrentBMSChannel & ":" & Join(xStrKey, String.Empty) & vbCrLf - Next - - Return Ret - End Function - - Private Function GenerateBackgroundTracks(MeasureIndex As Integer, ByRef hasOverlapping As Boolean, NotesInMeasure() As Note, GreatestColumn As Integer, ByRef xprevNotes() As Note) As String - Dim relativeNotePositions() As Double 'Ks in the same column - Dim noteStrings() As String 'Ks in the same column - Dim Ret As String = String.Empty - - For ColIndex = niB To GreatestColumn 'Start rendering B notes (xI3 is columnindex) - ReDim relativeNotePositions(-1) 'Ks in the same column - ReDim noteStrings(-1) 'Ks in the same column - - For I = 0 To UBound(NotesInMeasure) 'Find Ks in the same column (xI4 is TK index) - If NotesInMeasure(I).ColumnIndex = ColIndex Then - - ReDim Preserve relativeNotePositions(UBound(relativeNotePositions) + 1) - ReDim Preserve noteStrings(UBound(noteStrings) + 1) - - relativeNotePositions(UBound(relativeNotePositions)) = NotesInMeasure(I).VPosition - MeasureBottom(MeasureAtDisplacement(NotesInMeasure(I).VPosition)) - If relativeNotePositions(UBound(relativeNotePositions)) < 0 Then relativeNotePositions(UBound(relativeNotePositions)) = 0 - - noteStrings(UBound(noteStrings)) = C10to36(NotesInMeasure(I).Value \ 10000) - End If - Next - - Dim xGCD As Double = MeasureLength(MeasureIndex) - For i = 0 To UBound(relativeNotePositions) 'find greatest common divisor - If relativeNotePositions(i) > 0 Then xGCD = GCD(xGCD, relativeNotePositions(i)) - Next - - Dim xStrKey(CInt(MeasureLength(MeasureIndex) / xGCD) - 1) As String - For i = 0 To UBound(xStrKey) 'assign 00 to all keys - xStrKey(i) = "00" - Next - - For i = 0 To UBound(relativeNotePositions) 'assign K texts - If CInt(relativeNotePositions(i) / xGCD) > UBound(xStrKey) Then - - ReDim Preserve xprevNotes(UBound(xprevNotes) + 1) - - With xprevNotes(UBound(xprevNotes)) - .ColumnIndex = ColIndex - .VPosition = MeasureBottom(MeasureIndex) - .Value = C36to10(noteStrings(i)) - End With - - Continue For - End If - If xStrKey(relativeNotePositions(i) / xGCD) <> "00" Then hasOverlapping = True - xStrKey(relativeNotePositions(i) / xGCD) = noteStrings(i) - Next - - Ret &= "#" & Add3Zeros(MeasureIndex) & "01:" & Join(xStrKey, String.Empty) & vbCrLf - Next - - Return Ret - End Function - - Private Function OpenSM(xStrAll As String) As Boolean - KMouseOver = -1 - - Dim xStrLine() As String = Split(xStrAll, vbCrLf) - 'Remove comments starting with "//" - For xI1 As Integer = 0 To UBound(xStrLine) - If xStrLine(xI1).Contains("//") Then xStrLine(xI1) = Mid(xStrLine(xI1), 1, InStr(xStrLine(xI1), "//") - 1) - Next - - xStrAll = Join(xStrLine, String.Empty) - xStrLine = Split(xStrAll, ";") - - Dim iDiff As Integer = 0 - Dim iCurrentDiff As Integer = 0 - Dim xTempSplit() As String = Split(xStrAll, "#NOTES:") - Dim xTempStr() As String = {} - If xTempSplit.Length > 2 Then - ReDim Preserve xTempStr(UBound(xTempSplit) - 1) - For xI1 As Integer = 1 To UBound(xTempSplit) - xTempSplit(xI1) = Mid(xTempSplit(xI1), InStr(xTempSplit(xI1), ":") + 1) - xTempSplit(xI1) = Mid(xTempSplit(xI1), InStr(xTempSplit(xI1), ":") + 1).Trim - xTempStr(xI1 - 1) = Mid(xTempSplit(xI1), 1, InStr(xTempSplit(xI1), ":") - 1) - xTempSplit(xI1) = Mid(xTempSplit(xI1), InStr(xTempSplit(xI1), ":") + 1).Trim - xTempStr(xI1 - 1) &= " : " & Mid(xTempSplit(xI1), 1, InStr(xTempSplit(xI1), ":") - 1) - Next - - Dim xDiag As New dgImportSM(xTempStr) - If xDiag.ShowDialog() = Forms.DialogResult.Cancel Then Return True - iDiff = xDiag.iResult - End If - - Dim sL As String - ReDim Notes(0) - ReDim mColumn(999) - ReDim hWAV(1295) - ReDim hBMP(1295) - ReDim hBPM(1295) 'x10000 - ReDim hSTOP(1295) - ReDim hBMSCROLL(1295) - InitializeNewBMS() - - With Notes(0) - .ColumnIndex = niBPM - .VPosition = -1 - '.LongNote = False - '.Selected = False - .Value = 1200000 - End With - - For Each sL In xStrLine - If UCase(sL).StartsWith("#TITLE:") Then - THTitle.Text = Mid(sL, Len("#TITLE:") + 1) - - ElseIf UCase(sL).StartsWith("#SUBTITLE:") Then - If Not UCase(sL).EndsWith("#SUBTITLE:") Then THTitle.Text &= " " & Mid(sL, Len("#SUBTITLE:") + 1) - - ElseIf UCase(sL).StartsWith("#ARTIST:") Then - THArtist.Text = Mid(sL, Len("#ARTIST:") + 1) - - ElseIf UCase(sL).StartsWith("#GENRE:") Then - THGenre.Text = Mid(sL, Len("#GENRE:") + 1) - - ElseIf UCase(sL).StartsWith("#BPMS:") Then - Dim xLine As String = Mid(sL, Len("#BPMS:") + 1) - Dim xItem() As String = Split(xLine, ",") - - Dim xVal1 As Double - Dim xVal2 As Double - - For xI1 As Integer = 0 To UBound(xItem) - xVal1 = Mid(xItem(xI1), 1, InStr(xItem(xI1), "=") - 1) - xVal2 = Mid(xItem(xI1), InStr(xItem(xI1), "=") + 1) - - If xVal1 <> 0 Then - ReDim Preserve Notes(Notes.Length) - With Notes(UBound(Notes)) - .ColumnIndex = niBPM - '.LongNote = False - '.Hidden = False - '.Selected = False - .VPosition = xVal1 * 48 - .Value = xVal2 * 10000 - End With - Else - Notes(0).Value = xVal2 * 10000 - End If - Next - - ElseIf UCase(sL).StartsWith("#NOTES:") Then - If iCurrentDiff <> iDiff Then iCurrentDiff += 1 : GoTo Jump1 - - iCurrentDiff += 1 - Dim xLine As String = Mid(sL, Len("#NOTES:") + 1) - Dim xItem() As String = Split(xLine, ":") - For xI1 As Integer = 0 To UBound(xItem) - xItem(xI1) = xItem(xI1).Trim - Next - - If xItem.Length <> 6 Then GoTo Jump1 - - THPlayLevel.Text = xItem(3) - - Dim xM() As String = Split(xItem(5), ",") - For xI1 As Integer = 0 To UBound(xM) - xM(xI1) = xM(xI1).Trim - Next - - For xI1 As Integer = 0 To UBound(xM) - For xI2 As Integer = 0 To Len(xM(xI1)) - 1 Step 4 - If xM(xI1)(xI2) <> "0" Then - ReDim Preserve Notes(Notes.Length) - With Notes(UBound(Notes)) - .ColumnIndex = niA1 - .LongNote = xM(xI1)(xI2) = "2" Or xM(xI1)(xI2) = "3" - '.Hidden = False - '.Selected = False - .VPosition = (((192 \ (Len(xM(xI1)) \ 4)) * xI2) \ 4) + (xI1 * 192) - .Value = 10000 - End With - End If - If xM(xI1)(xI2 + 1) <> "0" Then - ReDim Preserve Notes(Notes.Length) - With Notes(UBound(Notes)) - .ColumnIndex = niA2 - .LongNote = xM(xI1)(xI2 + 1) = "2" Or xM(xI1)(xI2 + 1) = "3" - '.Hidden = False - '.Selected = False - .VPosition = (((192 \ (Len(xM(xI1)) \ 4)) * xI2) \ 4) + (xI1 * 192) - .Value = 10000 - End With - End If - If xM(xI1)(xI2 + 2) <> "0" Then - ReDim Preserve Notes(Notes.Length) - With Notes(UBound(Notes)) - .ColumnIndex = niA3 - .LongNote = xM(xI1)(xI2 + 2) = "2" Or xM(xI1)(xI2 + 2) = "3" - '.Hidden = False - '.Selected = False - .VPosition = (((192 \ (Len(xM(xI1)) \ 4)) * xI2) \ 4) + (xI1 * 192) - .Value = 10000 - End With - End If - If xM(xI1)(xI2 + 3) <> "0" Then - ReDim Preserve Notes(Notes.Length) - With Notes(UBound(Notes)) - .ColumnIndex = niA4 - .LongNote = xM(xI1)(xI2 + 3) = "2" Or xM(xI1)(xI2 + 3) = "3" - '.Hidden = False - '.Selected = False - .VPosition = (((192 \ (Len(xM(xI1)) \ 4)) * xI2) \ 4) + (xI1 * 192) - .Value = 10000 - End With - End If - Next - Next + End If + + End If + Next + + UpdateMeasureBottom() + + xStack = 0 + For Each sLine In xStrLine + Dim sLineTrim As String = sLine.Trim + If xStack > 0 Then Continue For + + If Not (sLineTrim.StartsWith("#") And Mid(sLineTrim, 7, 1) = ":") Then Continue For 'If the line contains Ks + + ' >> Measure = Mid(sLine, 2, 3) + ' >> Column Identifier = Mid(sLine, 5, 2) + ' >> K = Mid(sLine, xI1, 2) + Dim xMeasure As Integer = Val(Mid(sLineTrim, 2, 3)) + Dim Channel As String = Mid(sLineTrim, 5, 2) + If BMSChannelToColumn(Channel) = 0 Then Continue For + + If Channel = "01" Then mColumn(xMeasure) += 1 'If the identifier is 01 then add a B column in that measure + For xI1 = 8 To Len(sLineTrim) - 1 Step 2 'For all Ks within that line ( - 1 can be ommitted ) + If Mid(sLineTrim, xI1, 2) = "00" Then Continue For 'If the K is not 00 + + ReDim Preserve Notes(Notes.Length) + + With Notes(UBound(Notes)) + .ColumnIndex = BMSChannelToColumn(Channel) + + (IIf(Channel = "01", 1, 0) * (mColumn(xMeasure) - 1)) + .LongNote = IsChannelLongNote(Channel) + .Hidden = IsChannelHidden(Channel) + .Landmine = IsChannelLandmine(Channel) + .Selected = False + .VPosition = MeasureBottom(xMeasure) + (MeasureLength(xMeasure) * ((xI1 / 2) - 4) / ((Len(sLineTrim) - 7) / 2)) + .Value = C36to10(Mid(sLineTrim, xI1, 2)) * 10000 + + If Channel = "03" Then .Value = Convert.ToInt32(Mid(sLineTrim, xI1, 2), 16) * 10000 + If Channel = "08" Then .Value = hBPM(C36to10(Mid(sLineTrim, xI1, 2))) + If Channel = "09" Then .Value = hSTOP(C36to10(Mid(sLineTrim, xI1, 2))) + If Channel = "SC" Then .Value = hBMSCROLL(C36to10(Mid(sLineTrim, xI1, 2))) + End With + + Next + Next + + If NTInput Then ConvertBMSE2NT() + + LWAV.Visible = False + LWAV.Items.Clear() + LBMP.Visible = False + LBMP.Items.Clear() + For xI1 = 1 To 1295 + Dim unused1 = LWAV.Items.Add(C10to36(xI1) & ": " & hWAV(xI1)) + Dim unused = LBMP.Items.Add(C10to36(xI1) & ": " & hBMP(xI1)) + Next + LWAV.SelectedIndex = 0 + LWAV.Visible = True + LBMP.SelectedIndex = 0 + LBMP.Visible = True + THLandMine.Text = hWAV(0) + THMissBMP.Text = hBMP(0) + TExpansion.Text = xExpansion + Chartinfo.Fultitle = THTitle.Text + THSubTitle.Text + Chartinfo.Allartist = THArtist.Text + THSubArtist.Text + My.Forms.Chartinfo.Label1.Text = Chartinfo.Fultitle + My.Forms.Chartinfo.Label2.Text = Chartinfo.Allartist + SortByVPositionQuick(0, UBound(Notes)) + UpdatePairing() + CalculateTotalPlayableNotes() + CalculateGreatestVPosition() + RefreshPanelAll() + POStatusRefresh() + End Sub + + Private ReadOnly BMSChannelList() As String = {"01", "03", "04", "06", "07", "08", "09", + "11", "12", "13", "14", "15", "16", "17", "18", "19", "1A", "1B", "1C", "1D", "1E", "1F", "1G", "1H", "1I", "1J", "1K", "1L", "1M", "1N", "1O", "1P", "1Q", + "21", "22", "23", "24", "25", "26", "27", "28", "29", "2A", "2B", "2C", "2D", "2E", "2F", "2G", "2H", "2I", "2J", "2K", "2L", "2M", "2N", "2O", "2P", "2Q", + "31", "32", "33", "34", "35", "36", "37", "38", "39", "3A", "3B", "3C", "3D", "3E", "3F", "3G", "3H", "3I", "3J", "3K", "3L", "3M", "3N", "3O", "3P", "3Q", + "41", "42", "43", "44", "45", "46", "47", "48", "49", "4A", "4B", "4C", "4D", "4E", "4F", "4G", "4H", "4I", "4J", "4K", "4L", "4M", "4N", "4O", "4P", "4Q", + "51", "52", "53", "54", "55", "56", "57", "58", "59", "5A", "5B", "5C", "5D", "5E", "5F", "5G", "5H", "5I", "5J", "5K", "5L", "5M", "5N", "5O", "5P", "5Q", + "61", "62", "63", "64", "65", "66", "67", "68", "69", "6A", "6B", "6C", "6D", "6E", "6F", "6G", "6H", "6I", "6J", "6K", "6L", "6M", "6N", "6O", "6P", "6Q", + "D1", "D2", "D3", "D4", "D5", "D6", "D7", "D8", "D9", "DA", "DB", "DC", "DD", "DE", "DF", "DG", "DH", "DI", "DJ", "DK", "DL", "DM", "DN", "DO", "DP", "DQ", + "E1", "E2", "E3", "E4", "E5", "E6", "E7", "E8", "E9", "EA", "EB", "EC", "ED", "EE", "EF", "EG", "EH", "EI", "EJ", "EK", "EL", "EM", "EN", "EO", "EP", "EQ", + "SC"} + ' 71 through 89 are reserved + '"71", "72", "73", "74", "75", "76", "78", "79", + '"81", "82", "83", "84", "85", "86", "88", "89", + + + Private Function SaveBMS() As String + CalculateGreatestVPosition() + SortByVPositionInsertion() + UpdatePairing() + Dim MeasureIndex As Integer + Dim hasOverlapping As Boolean = False + 'Dim xStrAll As String = "" 'for all + Dim xStrMeasure(MeasureAtDisplacement(GreatestVPosition) + 1) As String + + ' We regenerate these when traversing the bms event list. + ReDim hBPM(0) + ReDim hSTOP(0) + ReDim hBMSCROLL(0) + + Dim xNTInput As Boolean = NTInput + Dim xKBackUp() As Note = Notes + If xNTInput Then + NTInput = False + ConvertNT2BMSE() + End If + + Dim tempNote As Note 'Temp K + + Dim xprevNotes(-1) As Note 'Notes too close to the next measure + + For MeasureIndex = 0 To MeasureAtDisplacement(GreatestVPosition) + 1 'For xI1 in each measure + xStrMeasure(MeasureIndex) = vbCrLf + + Dim consistentDecimalStr = WriteDecimalWithDot(MeasureLength(MeasureIndex) / 192.0R) + + ' Handle fractional measure + If MeasureLength(MeasureIndex) <> 192.0R Then xStrMeasure(MeasureIndex) &= "#" & Add3Zeros(MeasureIndex) & "02:" & consistentDecimalStr & vbCrLf + + ' Get note count in current measure + Dim LowerLimit As Integer = Nothing + Dim UpperLimit As Integer = Nothing + GetMeasureLimits(MeasureIndex, LowerLimit, UpperLimit) + + If UpperLimit - LowerLimit = 0 Then Continue For 'If there is no K in the current measure then end this loop + + ' Get notes from this measure + Dim xUPrevText As Integer = UBound(xprevNotes) + Dim NotesInMeasure(UpperLimit - LowerLimit + xUPrevText) As Note + + ' Copy notes from previous array + For i = 0 To xUPrevText + NotesInMeasure(i) = xprevNotes(i) + Next + + ' Copy notes in current measure + For i = LowerLimit To UpperLimit - 1 + NotesInMeasure(i - LowerLimit + xprevNotes.Length) = Notes(i) + Next + + ' Find greatest column. + ' Since background tracks have the highest column values + ' this - niB will yield the number of B columns. + Dim GreatestColumn = 0 + For Each tempNote In NotesInMeasure + GreatestColumn = Math.Max(tempNote.ColumnIndex, GreatestColumn) + Next + + ReDim xprevNotes(-1) + xStrMeasure(MeasureIndex) &= GenerateBackgroundTracks(MeasureIndex, hasOverlapping, NotesInMeasure, GreatestColumn, xprevNotes) + xStrMeasure(MeasureIndex) &= GenerateKeyTracks(MeasureIndex, hasOverlapping, NotesInMeasure, xprevNotes) + Next + + ' Warn about 255 limit if neccesary. + If hasOverlapping Then Dim unused3 = MsgBox(Strings.Messages.SaveWarning & vbCrLf & + Strings.Messages.NoteOverlapError & vbCrLf & + Strings.Messages.SavedFileWillContainErrors, MsgBoxStyle.Exclamation) + If UBound(hBPM) > IIf(BPMx1296, 1295, 255) Then Dim unused2 = MsgBox(Strings.Messages.SaveWarning & vbCrLf & + Strings.Messages.BPMOverflowError & UBound(hBPM) & " > " & IIf(BPMx1296, 1295, 255) & vbCrLf & + Strings.Messages.SavedFileWillContainErrors, MsgBoxStyle.Exclamation) + If UBound(hSTOP) > IIf(STOPx1296, 1295, 255) Then Dim unused1 = MsgBox(Strings.Messages.SaveWarning & vbCrLf & + Strings.Messages.STOPOverflowError & UBound(hSTOP) & " > " & IIf(STOPx1296, 1295, 255) & vbCrLf & + Strings.Messages.SavedFileWillContainErrors, MsgBoxStyle.Exclamation) + If UBound(hBMSCROLL) > 1295 Then Dim unused = MsgBox(Strings.Messages.SaveWarning & vbCrLf & + Strings.Messages.SCROLLOverflowError & UBound(hBMSCROLL) & " > " & 1295 & vbCrLf & + Strings.Messages.SavedFileWillContainErrors, MsgBoxStyle.Exclamation) + + ' Add expansion text + Dim xStrExp As String = vbCrLf & "*---------------------- EXPANSION FIELD" & vbCrLf & TExpansion.Text & vbCrLf & vbCrLf + If TExpansion.Text = String.Empty Then xStrExp = String.Empty + + ' Output main data field. + Dim xStrMain As String = "*---------------------- MAIN DATA FIELD" & vbCrLf & vbCrLf & Join(xStrMeasure, String.Empty) & vbCrLf + + If xNTInput Then + Notes = xKBackUp + NTInput = True + End If + + ' Generate headers now, since we have the unique BPM/STOP/etc declarations. + Dim xStrHeader As String = GenerateHeaderMeta() + xStrHeader &= GenerateHeaderIndexedData() + + Dim xStrAll As String = xStrHeader & vbCrLf & xStrExp & vbCrLf & xStrMain + Return xStrAll + End Function + + Private Function GenerateHeaderMeta() As String + Dim headerBuilder As New System.Text.StringBuilder() + + ' Append the header start marker + headerBuilder.AppendLine().AppendLine("*-------------------- HEADER FIELD").AppendLine() + + ' Append common header fields + headerBuilder.AppendLine($"#PLAYER {CHPlayer.SelectedIndex + 1}") + headerBuilder.AppendLine($"#GENRE {THGenre.Text}") + headerBuilder.AppendLine($"#TITLE {THTitle.Text}") + headerBuilder.AppendLine($"#ARTIST {THArtist.Text}") + headerBuilder.AppendLine($"#BPM {WriteDecimalWithDot(Notes(0).Value / 10000)}") + headerBuilder.AppendLine($"#PLAYLEVEL {THPlayLevel.Text}") + headerBuilder.AppendLine($"#RANK {CHRank.SelectedIndex}").AppendLine() + + ' Append optional header fields if they are not empty + If Not String.IsNullOrEmpty(THSubTitle.Text) Then headerBuilder.AppendLine($"#SUBTITLE {THSubTitle.Text}") + If Not String.IsNullOrEmpty(THSubArtist.Text) Then headerBuilder.AppendLine($"#SUBARTIST {THSubArtist.Text}") + If Not String.IsNullOrEmpty(THStageFile.Text) Then headerBuilder.AppendLine($"#STAGEFILE {THStageFile.Text}") + If Not String.IsNullOrEmpty(THBanner.Text) Then headerBuilder.AppendLine($"#BANNER {THBanner.Text}") + If Not String.IsNullOrEmpty(THBackBMP.Text) Then headerBuilder.AppendLine($"#BACKBMP {THBackBMP.Text}").AppendLine() + + ' Append more optional header fields if specified + If CHDifficulty.SelectedIndex > 0 Then headerBuilder.AppendLine($"#DIFFICULTY {CHDifficulty.SelectedIndex}") + If Not String.IsNullOrEmpty(THExRank.Text) Then headerBuilder.AppendLine($"#DEFEXRANK {THExRank.Text}") + If Not String.IsNullOrEmpty(THTotal.Text) Then headerBuilder.AppendLine($"#TOTAL {THTotal.Text}") + If Not String.IsNullOrEmpty(THComment.Text) Then headerBuilder.AppendLine($"#COMMENT ""{THComment.Text}""") + ' Uncomment the following line if THLnType is used + ' If Not String.IsNullOrEmpty(THLnType.Text) Then headerBuilder.AppendLine($"#LNTYPE {THLnType.Text}") + If CHLnObj.SelectedIndex > 0 Then headerBuilder.AppendLine($"#LNOBJ {C10to36(CHLnObj.SelectedIndex)}") _ + Else headerBuilder.AppendLine("#LNTYPE 1") + If Not String.IsNullOrEmpty(THPreview.Text) Then headerBuilder.AppendLine($"#PREVIEW {THPreview.Text}") + If CHLnmode.SelectedIndex > 0 Then headerBuilder.AppendLine($"#LNMODE {CHLnmode.SelectedIndex}").AppendLine() + + ' Return the completed header string + Return headerBuilder.ToString() + End Function + + + Private Function GenerateHeaderIndexedData() As String + Dim xStrHeader As New StringBuilder + + For i = 0 To UBound(hWAV) + If hWAV(i) <> String.Empty Then + xStrHeader.AppendFormat("#WAV{0} {1}{2}", C10to36(i), hWAV(i), vbCrLf) + End If + Next + + For i = 0 To UBound(hBMP) + If hBMP(i) <> String.Empty Then + xStrHeader.AppendFormat("#BMP{0} {1}{2}", C10to36(i), hBMP(i), vbCrLf) + End If + Next + + For i = 1 To UBound(hBPM) + xStrHeader.AppendFormat("#BPM{0} {1}{2}", + IIf(BPMx1296, C10to36(i), Mid("0" & Hex(i), Len(Hex(i)))), + WriteDecimalWithDot(hBPM(i) / 10000), vbCrLf) + Next + + For i = 1 To UBound(hSTOP) + xStrHeader.AppendFormat("#STOP{0} {1}{2}", + IIf(STOPx1296, C10to36(i), Mid("0" & Hex(i), Len(Hex(i)))), + WriteDecimalWithDot(hSTOP(i) / 10000), vbCrLf) + Next + + For i = 1 To UBound(hBMSCROLL) + xStrHeader.AppendFormat("#SCROLL{0} {1}{2}", + C10to36(i), WriteDecimalWithDot(hBMSCROLL(i) / 10000), vbCrLf) + Next + + Return xStrHeader.ToString() + End Function + + + Private Sub GetMeasureLimits(MeasureIndex As Integer, ByRef LowerLimit As Integer, ByRef UpperLimit As Integer) + Dim NoteCount = UBound(Notes) + LowerLimit = 0 + + For i = 1 To NoteCount 'Collect Ks in the same measure + If MeasureAtDisplacement(Notes(i).VPosition) >= MeasureIndex Then + LowerLimit = i + Exit For + End If 'Lower limit found + Next + + UpperLimit = 0 + + For i = LowerLimit To NoteCount + If MeasureAtDisplacement(Notes(i).VPosition) > MeasureIndex Then + UpperLimit = i + Exit For 'Upper limit found + End If + Next + + If UpperLimit < LowerLimit Then UpperLimit = NoteCount + 1 + End Sub + + Private Function GenerateKeyTracks(MeasureIndex As Integer, ByRef hasOverlapping As Boolean, NotesInMeasure() As Note, ByRef xprevNotes() As Note) As String + Dim CurrentBMSChannel As String + Dim Ret As String = String.Empty + + For Each CurrentBMSChannel In BMSChannelList 'Start rendering other notes + Dim relativeMeasurePos(-1) 'Ks in the same column + Dim NoteStrings(-1) 'Ks in the same column + + ' Background tracks take care of this. + If CurrentBMSChannel = "01" Then Continue For + + + For NoteIndex = 0 To UBound(NotesInMeasure) 'Find Ks in the same column (xI4 is TK index) + + Dim currentNote As Note = NotesInMeasure(NoteIndex) + If GetBMSChannelBy(currentNote) = CurrentBMSChannel Then + + ReDim Preserve relativeMeasurePos(UBound(relativeMeasurePos) + 1) + ReDim Preserve NoteStrings(UBound(NoteStrings) + 1) + relativeMeasurePos(UBound(relativeMeasurePos)) = currentNote.VPosition - MeasureBottom(MeasureAtDisplacement(currentNote.VPosition)) + If relativeMeasurePos(UBound(relativeMeasurePos)) < 0 Then relativeMeasurePos(UBound(relativeMeasurePos)) = 0 + + If CurrentBMSChannel = "03" Then 'If integer bpm + NoteStrings(UBound(NoteStrings)) = Mid("0" & Hex(currentNote.Value \ 10000), Len(Hex(currentNote.Value \ 10000))) + ElseIf CurrentBMSChannel = "08" Then 'If bpm requires declaration + Dim BpmIndex + For BpmIndex = 1 To UBound(hBPM) ' find BPM value in existing array + If currentNote.Value = hBPM(BpmIndex) Then Exit For + Next + If BpmIndex > UBound(hBPM) Then ' Didn't find it, add it + ReDim Preserve hBPM(UBound(hBPM) + 1) + hBPM(UBound(hBPM)) = currentNote.Value + End If + NoteStrings(UBound(NoteStrings)) = IIf(BPMx1296, C10to36(BpmIndex), Mid("0" & Hex(BpmIndex), Len(Hex(BpmIndex)))) + ElseIf CurrentBMSChannel = "09" Then 'If STOP + Dim StopIndex + For StopIndex = 1 To UBound(hSTOP) ' find STOP value in existing array + If currentNote.Value = hSTOP(StopIndex) Then Exit For + Next + + If StopIndex > UBound(hSTOP) Then ' Didn't find it, add it + ReDim Preserve hSTOP(UBound(hSTOP) + 1) + hSTOP(UBound(hSTOP)) = currentNote.Value + End If + NoteStrings(UBound(NoteStrings)) = IIf(STOPx1296, C10to36(StopIndex), Mid("0" & Hex(StopIndex), Len(Hex(StopIndex)))) + ElseIf CurrentBMSChannel = "SC" Then 'If SCROLL + Dim ScrollIndex + For ScrollIndex = 1 To UBound(hBMSCROLL) ' find SCROLL value in existing array + If currentNote.Value = hBMSCROLL(ScrollIndex) Then Exit For + Next + + If ScrollIndex > UBound(hBMSCROLL) Then ' Didn't find it, add it + ReDim Preserve hBMSCROLL(UBound(hBMSCROLL) + 1) + hBMSCROLL(UBound(hBMSCROLL)) = currentNote.Value + End If + NoteStrings(UBound(NoteStrings)) = C10to36(ScrollIndex) + Else + NoteStrings(UBound(NoteStrings)) = C10to36(currentNote.Value \ 10000) + End If + End If + Next + + If relativeMeasurePos.Length = 0 Then Continue For + + Dim xGCD As Double = MeasureLength(MeasureIndex) + For i = 0 To UBound(relativeMeasurePos) 'find greatest common divisor + If relativeMeasurePos(i) > 0 Then xGCD = GCD(xGCD, relativeMeasurePos(i)) + Next + + Dim xStrKey() As String + ReDim xStrKey(CInt(MeasureLength(MeasureIndex) / xGCD) - 1) + For i = 0 To UBound(xStrKey) 'assign 00 to all keys + xStrKey(i) = "00" + Next + + For i = 0 To UBound(relativeMeasurePos) 'assign K texts + If CInt(relativeMeasurePos(i) / xGCD) > UBound(xStrKey) Then + ReDim Preserve xprevNotes(UBound(xprevNotes) + 1) + With xprevNotes(UBound(xprevNotes)) + .ColumnIndex = BMSChannelToColumn(BMSChannelList(CurrentBMSChannel)) + .LongNote = IsChannelLongNote(BMSChannelList(CurrentBMSChannel)) + .Hidden = IsChannelHidden(BMSChannelList(CurrentBMSChannel)) + .VPosition = MeasureBottom(MeasureIndex) + .Value = C36to10(NoteStrings(i)) + End With + If BMSChannelList(CurrentBMSChannel) = "08" Then _ + xprevNotes(UBound(xprevNotes)).Value = IIf(BPMx1296, hBPM(C36to10(NoteStrings(i))), hBPM(Convert.ToInt32(NoteStrings(i), 16))) + If BMSChannelList(CurrentBMSChannel) = "09" Then _ + xprevNotes(UBound(xprevNotes)).Value = IIf(STOPx1296, hSTOP(C36to10(NoteStrings(i))), hSTOP(Convert.ToInt32(NoteStrings(i), 16))) + If BMSChannelList(CurrentBMSChannel) = "SC" Then _ + xprevNotes(UBound(xprevNotes)).Value = hBMSCROLL(C36to10(NoteStrings(i))) + Continue For + End If + If xStrKey(relativeMeasurePos(i) / xGCD) <> "00" Then + hasOverlapping = True + End If + + xStrKey(relativeMeasurePos(i) / xGCD) = NoteStrings(i) + Next + + Ret &= "#" & Add3Zeros(MeasureIndex) & CurrentBMSChannel & ":" & Join(xStrKey, String.Empty) & vbCrLf + Next + + Return Ret + End Function + + Private Function GenerateBackgroundTracks(MeasureIndex As Integer, ByRef hasOverlapping As Boolean, NotesInMeasure() As Note, GreatestColumn As Integer, ByRef xprevNotes() As Note) As String + Dim relativeNotePositions() As Double 'Ks in the same column + Dim noteStrings() As String 'Ks in the same column + Dim Ret As String = String.Empty + + For ColIndex = niB To GreatestColumn 'Start rendering B notes (xI3 is columnindex) + ReDim relativeNotePositions(-1) 'Ks in the same column + ReDim noteStrings(-1) 'Ks in the same column + + For I = 0 To UBound(NotesInMeasure) 'Find Ks in the same column (xI4 is TK index) + If NotesInMeasure(I).ColumnIndex = ColIndex Then + + ReDim Preserve relativeNotePositions(UBound(relativeNotePositions) + 1) + ReDim Preserve noteStrings(UBound(noteStrings) + 1) + + relativeNotePositions(UBound(relativeNotePositions)) = NotesInMeasure(I).VPosition - MeasureBottom(MeasureAtDisplacement(NotesInMeasure(I).VPosition)) + If relativeNotePositions(UBound(relativeNotePositions)) < 0 Then relativeNotePositions(UBound(relativeNotePositions)) = 0 + + noteStrings(UBound(noteStrings)) = C10to36(NotesInMeasure(I).Value \ 10000) + End If + Next + + Dim xGCD As Double = MeasureLength(MeasureIndex) + For i = 0 To UBound(relativeNotePositions) 'find greatest common divisor + If relativeNotePositions(i) > 0 Then xGCD = GCD(xGCD, relativeNotePositions(i)) + Next + + Dim xStrKey(CInt(MeasureLength(MeasureIndex) / xGCD) - 1) As String + For i = 0 To UBound(xStrKey) 'assign 00 to all keys + xStrKey(i) = "00" + Next + + For i = 0 To UBound(relativeNotePositions) 'assign K texts + If CInt(relativeNotePositions(i) / xGCD) > UBound(xStrKey) Then + + ReDim Preserve xprevNotes(UBound(xprevNotes) + 1) + + With xprevNotes(UBound(xprevNotes)) + .ColumnIndex = ColIndex + .VPosition = MeasureBottom(MeasureIndex) + .Value = C36to10(noteStrings(i)) + End With + + Continue For + End If + If xStrKey(relativeNotePositions(i) / xGCD) <> "00" Then hasOverlapping = True + xStrKey(relativeNotePositions(i) / xGCD) = noteStrings(i) + Next + + Ret &= "#" & Add3Zeros(MeasureIndex) & "01:" & Join(xStrKey, String.Empty) & vbCrLf + Next + + Return Ret + End Function + + Private Function OpenSM(xStrAll As String) As Boolean + KMouseOver = -1 + + Dim xStrLine() As String = Split(xStrAll, vbCrLf) + 'Remove comments starting with "//" + For xI1 As Integer = 0 To UBound(xStrLine) + If xStrLine(xI1).Contains("//") Then xStrLine(xI1) = Mid(xStrLine(xI1), 1, InStr(xStrLine(xI1), "//") - 1) + Next + + xStrAll = Join(xStrLine, String.Empty) + xStrLine = Split(xStrAll, ";") + + Dim iDiff As Integer = 0 + Dim iCurrentDiff As Integer = 0 + Dim xTempSplit() As String = Split(xStrAll, "#NOTES:") + Dim xTempStr() As String = {} + If xTempSplit.Length > 2 Then + ReDim Preserve xTempStr(UBound(xTempSplit) - 1) + For xI1 As Integer = 1 To UBound(xTempSplit) + xTempSplit(xI1) = Mid(xTempSplit(xI1), InStr(xTempSplit(xI1), ":") + 1) + xTempSplit(xI1) = Mid(xTempSplit(xI1), InStr(xTempSplit(xI1), ":") + 1).Trim + xTempStr(xI1 - 1) = Mid(xTempSplit(xI1), 1, InStr(xTempSplit(xI1), ":") - 1) + xTempSplit(xI1) = Mid(xTempSplit(xI1), InStr(xTempSplit(xI1), ":") + 1).Trim + xTempStr(xI1 - 1) &= " : " & Mid(xTempSplit(xI1), 1, InStr(xTempSplit(xI1), ":") - 1) + Next + + Dim xDiag As New dgImportSM(xTempStr) + If xDiag.ShowDialog() = Forms.DialogResult.Cancel Then Return True + iDiff = xDiag.iResult + End If + + Dim sL As String + ReDim Notes(0) + ReDim mColumn(999) + ReDim hWAV(1295) + ReDim hBMP(1295) + ReDim hBPM(1295) 'x10000 + ReDim hSTOP(1295) + ReDim hBMSCROLL(1295) + InitializeNewBMS() + + With Notes(0) + .ColumnIndex = niBPM + .VPosition = -1 + '.LongNote = False + '.Selected = False + .Value = 1200000 + End With + + For Each sL In xStrLine + If UCase(sL).StartsWith("#TITLE:") Then + THTitle.Text = Mid(sL, Len("#TITLE:") + 1) + + ElseIf UCase(sL).StartsWith("#SUBTITLE:") Then + If Not UCase(sL).EndsWith("#SUBTITLE:") Then THTitle.Text &= " " & Mid(sL, Len("#SUBTITLE:") + 1) + + ElseIf UCase(sL).StartsWith("#ARTIST:") Then + THArtist.Text = Mid(sL, Len("#ARTIST:") + 1) + + ElseIf UCase(sL).StartsWith("#GENRE:") Then + THGenre.Text = Mid(sL, Len("#GENRE:") + 1) + + ElseIf UCase(sL).StartsWith("#BPMS:") Then + Dim xLine As String = Mid(sL, Len("#BPMS:") + 1) + Dim xItem() As String = Split(xLine, ",") + + Dim xVal1 As Double + Dim xVal2 As Double + + For xI1 As Integer = 0 To UBound(xItem) + xVal1 = Mid(xItem(xI1), 1, InStr(xItem(xI1), "=") - 1) + xVal2 = Mid(xItem(xI1), InStr(xItem(xI1), "=") + 1) + + If xVal1 <> 0 Then + ReDim Preserve Notes(Notes.Length) + With Notes(UBound(Notes)) + .ColumnIndex = niBPM + '.LongNote = False + '.Hidden = False + '.Selected = False + .VPosition = xVal1 * 48 + .Value = xVal2 * 10000 + End With + Else + Notes(0).Value = xVal2 * 10000 + End If + Next + + ElseIf UCase(sL).StartsWith("#NOTES:") Then + If iCurrentDiff <> iDiff Then iCurrentDiff += 1 : GoTo Jump1 + + iCurrentDiff += 1 + Dim xLine As String = Mid(sL, Len("#NOTES:") + 1) + Dim xItem() As String = Split(xLine, ":") + For xI1 As Integer = 0 To UBound(xItem) + xItem(xI1) = xItem(xI1).Trim + Next + + If xItem.Length <> 6 Then GoTo Jump1 + + THPlayLevel.Text = xItem(3) + + Dim xM() As String = Split(xItem(5), ",") + For xI1 As Integer = 0 To UBound(xM) + xM(xI1) = xM(xI1).Trim + Next + + For xI1 As Integer = 0 To UBound(xM) + For xI2 As Integer = 0 To Len(xM(xI1)) - 1 Step 4 + If xM(xI1)(xI2) <> "0" Then + ReDim Preserve Notes(Notes.Length) + With Notes(UBound(Notes)) + .ColumnIndex = niA1 + .LongNote = xM(xI1)(xI2) = "2" Or xM(xI1)(xI2) = "3" + '.Hidden = False + '.Selected = False + .VPosition = (((192 \ (Len(xM(xI1)) \ 4)) * xI2) \ 4) + (xI1 * 192) + .Value = 10000 + End With + End If + If xM(xI1)(xI2 + 1) <> "0" Then + ReDim Preserve Notes(Notes.Length) + With Notes(UBound(Notes)) + .ColumnIndex = niA2 + .LongNote = xM(xI1)(xI2 + 1) = "2" Or xM(xI1)(xI2 + 1) = "3" + '.Hidden = False + '.Selected = False + .VPosition = (((192 \ (Len(xM(xI1)) \ 4)) * xI2) \ 4) + (xI1 * 192) + .Value = 10000 + End With + End If + If xM(xI1)(xI2 + 2) <> "0" Then + ReDim Preserve Notes(Notes.Length) + With Notes(UBound(Notes)) + .ColumnIndex = niA3 + .LongNote = xM(xI1)(xI2 + 2) = "2" Or xM(xI1)(xI2 + 2) = "3" + '.Hidden = False + '.Selected = False + .VPosition = (((192 \ (Len(xM(xI1)) \ 4)) * xI2) \ 4) + (xI1 * 192) + .Value = 10000 + End With + End If + If xM(xI1)(xI2 + 3) <> "0" Then + ReDim Preserve Notes(Notes.Length) + With Notes(UBound(Notes)) + .ColumnIndex = niA4 + .LongNote = xM(xI1)(xI2 + 3) = "2" Or xM(xI1)(xI2 + 3) = "3" + '.Hidden = False + '.Selected = False + .VPosition = (((192 \ (Len(xM(xI1)) \ 4)) * xI2) \ 4) + (xI1 * 192) + .Value = 10000 + End With + End If + Next + Next Jump1: - End If - Next - - If NTInput Then ConvertBMSE2NT() - - LWAV.Visible = False - LWAV.Items.Clear() - LBMP.Visible = False - LBMP.Items.Clear() - For xI1 As Integer = 1 To 1295 - Dim unused1 = LWAV.Items.Add(C10to36(xI1) & ": " & hWAV(xI1)) - Dim unused = LBMP.Items.Add(C10to36(xI1) & ": " & hBMP(xI1)) - Next - LWAV.SelectedIndex = 0 - LWAV.Visible = True - LBMP.SelectedIndex = 0 - LBMP.Visible = True - - THBPM.Value = Notes(0).Value / 10000 - SortByVPositionQuick(0, UBound(Notes)) - UpdatePairing() - CalculateTotalPlayableNotes() - CalculateGreatestVPosition() - RefreshPanelAll() - POStatusRefresh() - Return False - End Function - - ''' Do not clear Undo. - Private Sub OpeniBMSC(Path As String) - KMouseOver = -1 - - Dim br As New BinaryReader(New FileStream(Path, FileMode.Open, FileAccess.Read), System.Text.Encoding.Unicode) - - If br.ReadInt32 <> &H534D4269 Then GoTo EndOfSub - If br.ReadByte <> CByte(&H43) Then GoTo EndOfSub - Dim xMajor As Integer = br.ReadByte - Dim xMinor As Integer = br.ReadByte - Dim xBuild As Integer = br.ReadByte - - ClearUndo() - ReDim Notes(0) - ReDim mColumn(999) - ReDim hWAV(1295) - ReDim hBMP(1295) - InitializeNewBMS() - InitializeOpenBMS() - - Notes(0) = New Note - With Notes(0) - .ColumnIndex = niBPM - .VPosition = -1 - '.LongNote = False - '.Selected = False - .Value = 1200000 - End With - - Do Until br.BaseStream.Position >= br.BaseStream.Length - Dim BlockID As Integer = br.ReadInt32() - - Select Case BlockID - - Case &H66657250 'Preferences - Dim xPref As Integer = br.ReadInt32 - - NTInput = xPref And &H1 - TBNTInput.Checked = NTInput - mnNTInput.Checked = NTInput - POBLong.Enabled = Not NTInput - POBLongShort.Enabled = Not NTInput - - ErrorCheck = xPref And &H2 - TBErrorCheck.Checked = ErrorCheck - TBErrorCheck_Click(TBErrorCheck, New EventArgs) - - PreviewOnClick = xPref And &H4 - TBPreviewOnClick.Checked = PreviewOnClick - TBPreviewOnClick_Click(TBPreviewOnClick, New EventArgs) - - ShowFileName = xPref And &H8 - TBShowFileName.Checked = ShowFileName - TBShowFileName_Click(TBShowFileName, New EventArgs) - - Rscratch = xPref And &H10 - If TBChangePlaySide.Checked <> Rscratch Then - TBChangePlaySide.Checked = Rscratch - TBChangePlaySide_Click(TBChangePlaySide, New EventArgs) - Else - TBChangePlaySide.Checked = Rscratch - End If - - mnSMenu.Checked = xPref And &H100 - mnSTB.Checked = xPref And &H200 - mnSOP.Checked = xPref And &H400 - mnSStatus.Checked = xPref And &H800 - mnSLSplitter.Checked = xPref And &H1000 - mnSRSplitter.Checked = xPref And &H2000 - - CGShow.Checked = xPref And &H4000 - CGShowS.Checked = xPref And &H8000 - CGShowBG.Checked = xPref And &H10000 - CGShowM.Checked = xPref And &H20000 - CGShowMB.Checked = xPref And &H40000 - CGShowV.Checked = xPref And &H80000 - CGShowC.Checked = xPref And &H100000 - CGBLP.Checked = xPref And &H200000 - CGSTOP.Checked = xPref And &H400000 - CGSCROLL.Checked = xPref And &H20000000 - CGBPM.Checked = xPref And &H800000 - - CGSnap.Checked = xPref And &H1000000 - CGDisableVertical.Checked = xPref And &H2000000 - cVSLockL.Checked = xPref And &H4000000 - cVSLock.Checked = xPref And &H8000000 - cVSLockR.Checked = xPref And &H10000000 - - CGDivide.Value = br.ReadInt32 - CGSub.Value = br.ReadInt32 - gSlash = br.ReadInt32 - CGHeight.Value = br.ReadSingle - CGWidth.Value = br.ReadSingle - CGB.Value = br.ReadInt32 - - Case &H64616548 'Header - THTitle.Text = br.ReadString - THArtist.Text = br.ReadString - THGenre.Text = br.ReadString - Notes(0).Value = br.ReadInt64 - Dim xPlayerRank As Integer = br.ReadByte - THPlayLevel.Text = br.ReadString - - CHPlayer.SelectedIndex = xPlayerRank And &HF - CHRank.SelectedIndex = xPlayerRank >> 4 - - THSubTitle.Text = br.ReadString - THSubArtist.Text = br.ReadString - 'THMaker.Text = br.ReadString - THStageFile.Text = br.ReadString - THBanner.Text = br.ReadString - THBackBMP.Text = br.ReadString - 'THMidiFile.Text = br.ReadString - CHDifficulty.SelectedIndex = br.ReadByte - THExRank.Text = br.ReadString - THTotal.Text = br.ReadString - 'THVolWAV.Text = br.ReadString - THComment.Text = br.ReadString - 'THLnType.Text = br.ReadString - CHLnObj.SelectedIndex = br.ReadInt16 - THPreview.Text = br.ReadString - CHLnmode.SelectedIndex = br.ReadByte - - Case &H564157 'WAV List - Dim xWAVOptions As Integer = br.ReadByte - WAVMultiSelect = xWAVOptions And &H1 - CWAVMultiSelect.Checked = WAVMultiSelect - CWAVMultiSelect_CheckedChanged(CWAVMultiSelect, New EventArgs) - WAVChangeLabel = xWAVOptions And &H2 - CWAVChangeLabel.Checked = WAVChangeLabel - CWAVChangeLabel_CheckedChanged(CWAVChangeLabel, New EventArgs) - WAVEmptyfill = xWAVOptions And &H4 - CWAVEmptyfill.Checked = WAVEmptyfill - CWAVEmptyfill_CheckedChanged(CWAVEmptyfill, New EventArgs) - - Dim xWAVCount As Integer = br.ReadInt32 - For xxi As Integer = 1 To xWAVCount - Dim xI As Integer = br.ReadInt16 - hWAV(xI) = br.ReadString - Next - - Case &H504D42 'BMP List - - Dim xBMPCount As Integer = br.ReadInt32 - For xxi As Integer = 1 To xBMPCount - Dim xI As Integer = br.ReadInt16 - hBMP(xI) = br.ReadString - Next - - Case &H74616542 'Beat - nBeatN.Value = br.ReadInt16 - nBeatD.Value = br.ReadInt16 - 'nBeatD.SelectedIndex = br.ReadByte - - Dim xBeatChangeMode As Integer = br.ReadByte - Dim xBeatChangeList As RadioButton() = {CBeatPreserve, CBeatMeasure, CBeatCut, CBeatScale} - xBeatChangeList(xBeatChangeMode).Checked = True - CBeatPreserve_Click(xBeatChangeList(xBeatChangeMode), New EventArgs) - - Dim xBeatCount As Integer = br.ReadInt32 - For xxi As Integer = 1 To xBeatCount - Dim xIndex As Integer = br.ReadInt16 - MeasureLength(xIndex) = br.ReadDouble - Dim xRatio As Double = MeasureLength(xIndex) / 192.0R - Dim xxD As Long = GetDenominator(xRatio) - LBeat.Items(xIndex) = Add3Zeros(xIndex) & ": " & xRatio & IIf(xxD > 10000, String.Empty, " ( " & (xRatio * xxD) & " / " & xxD & " ) ") - Next - - Case &H6E707845 'Expansion Code - TExpansion.Text = br.ReadString - - Case &H65746F4E 'Note - Dim xNoteUbound As Integer = br.ReadInt32 - ReDim Preserve Notes(xNoteUbound) - For i As Integer = 1 To UBound(Notes) - Notes(i) = New Note - Notes(i).FromBinReader(br) - Next - - Case &H6F646E55 'Undo / Redo Commands - Dim URCount As Integer = br.ReadInt32 'Should be 100 - sI = br.ReadInt32 - - For xI As Integer = 0 To 99 - Dim xUndoCount As Integer = br.ReadInt32 - Dim xBaseUndo As New UndoRedo.Void - Dim xIteratorUndo As UndoRedo.LinkedURCmd = xBaseUndo - - For xxj As Integer = 1 To xUndoCount - Dim xByteLen As Integer = br.ReadInt32 - Dim xByte() As Byte = br.ReadBytes(xByteLen) - xIteratorUndo.Next = UndoRedo.fromBytes(xByte) - xIteratorUndo = xIteratorUndo.Next - Next - - sUndo(xI) = xBaseUndo.Next - - Dim xRedoCount As Integer = br.ReadInt32 - Dim xBaseRedo As New UndoRedo.Void - Dim xIteratorRedo As UndoRedo.LinkedURCmd = xBaseRedo - For xxj As Integer = 1 To xRedoCount - Dim xByteLen As Integer = br.ReadInt32 - Dim xByte() As Byte = br.ReadBytes(xByteLen) - xIteratorRedo.Next = UndoRedo.fromBytes(xByte) - xIteratorRedo = xIteratorRedo.Next - Next - sRedo(xI) = xBaseRedo.Next - Next - - End Select - Loop + End If + Next + + If NTInput Then ConvertBMSE2NT() + + LWAV.Visible = False + LWAV.Items.Clear() + LBMP.Visible = False + LBMP.Items.Clear() + For xI1 As Integer = 1 To 1295 + Dim unused1 = LWAV.Items.Add(C10to36(xI1) & ": " & hWAV(xI1)) + Dim unused = LBMP.Items.Add(C10to36(xI1) & ": " & hBMP(xI1)) + Next + LWAV.SelectedIndex = 0 + LWAV.Visible = True + LBMP.SelectedIndex = 0 + LBMP.Visible = True + + THBPM.Value = Notes(0).Value / 10000 + SortByVPositionQuick(0, UBound(Notes)) + UpdatePairing() + CalculateTotalPlayableNotes() + CalculateGreatestVPosition() + RefreshPanelAll() + POStatusRefresh() + Return False + End Function + + ''' Do not clear Undo. + Private Sub OpeniBMSC(Path As String) + KMouseOver = -1 + + Dim br As New BinaryReader(New FileStream(Path, FileMode.Open, FileAccess.Read), System.Text.Encoding.Unicode) + + If br.ReadInt32 <> &H534D4269 Then GoTo EndOfSub + If br.ReadByte <> CByte(&H43) Then GoTo EndOfSub + Dim xMajor As Integer = br.ReadByte + Dim xMinor As Integer = br.ReadByte + Dim xBuild As Integer = br.ReadByte + + ClearUndo() + ReDim Notes(0) + ReDim mColumn(999) + ReDim hWAV(1295) + ReDim hBMP(1295) + InitializeNewBMS() + InitializeOpenBMS() + + Notes(0) = New Note + With Notes(0) + .ColumnIndex = niBPM + .VPosition = -1 + '.LongNote = False + '.Selected = False + .Value = 1200000 + End With + + Do Until br.BaseStream.Position >= br.BaseStream.Length + Dim BlockID As Integer = br.ReadInt32() + + Select Case BlockID + + Case &H66657250 'Preferences + Dim xPref As Integer = br.ReadInt32 + + NTInput = xPref And &H1 + TBNTInput.Checked = NTInput + mnNTInput.Checked = NTInput + POBLong.Enabled = Not NTInput + POBLongShort.Enabled = Not NTInput + + ErrorCheck = xPref And &H2 + TBErrorCheck.Checked = ErrorCheck + TBErrorCheck_Click(TBErrorCheck, New EventArgs) + + PreviewOnClick = xPref And &H4 + TBPreviewOnClick.Checked = PreviewOnClick + TBPreviewOnClick_Click(TBPreviewOnClick, New EventArgs) + + ShowFileName = xPref And &H8 + TBShowFileName.Checked = ShowFileName + TBShowFileName_Click(TBShowFileName, New EventArgs) + + Rscratch = xPref And &H10 + If TBChangePlaySide.Checked <> Rscratch Then + TBChangePlaySide.Checked = Rscratch + TBChangePlaySide_Click(TBChangePlaySide, New EventArgs) + Else + TBChangePlaySide.Checked = Rscratch + End If + + mnSMenu.Checked = xPref And &H100 + mnSTB.Checked = xPref And &H200 + mnSOP.Checked = xPref And &H400 + mnSStatus.Checked = xPref And &H800 + mnSLSplitter.Checked = xPref And &H1000 + mnSRSplitter.Checked = xPref And &H2000 + + CGShow.Checked = xPref And &H4000 + CGShowS.Checked = xPref And &H8000 + CGShowBG.Checked = xPref And &H10000 + CGShowM.Checked = xPref And &H20000 + CGShowMB.Checked = xPref And &H40000 + CGShowV.Checked = xPref And &H80000 + CGShowC.Checked = xPref And &H100000 + CGBLP.Checked = xPref And &H200000 + CGSTOP.Checked = xPref And &H400000 + CGSCROLL.Checked = xPref And &H20000000 + CGBPM.Checked = xPref And &H800000 + + CGSnap.Checked = xPref And &H1000000 + CGDisableVertical.Checked = xPref And &H2000000 + cVSLockL.Checked = xPref And &H4000000 + cVSLock.Checked = xPref And &H8000000 + cVSLockR.Checked = xPref And &H10000000 + + CGDivide.Value = br.ReadInt32 + CGSub.Value = br.ReadInt32 + gSlash = br.ReadInt32 + CGHeight.Value = br.ReadSingle + CGWidth.Value = br.ReadSingle + CGB.Value = br.ReadInt32 + + Case &H64616548 'Header + THTitle.Text = br.ReadString + THArtist.Text = br.ReadString + THGenre.Text = br.ReadString + Notes(0).Value = br.ReadInt64 + Dim xPlayerRank As Integer = br.ReadByte + THPlayLevel.Text = br.ReadString + + CHPlayer.SelectedIndex = xPlayerRank And &HF + CHRank.SelectedIndex = xPlayerRank >> 4 + + THSubTitle.Text = br.ReadString + THSubArtist.Text = br.ReadString + 'THMaker.Text = br.ReadString + THStageFile.Text = br.ReadString + THBanner.Text = br.ReadString + THBackBMP.Text = br.ReadString + 'THMidiFile.Text = br.ReadString + CHDifficulty.SelectedIndex = br.ReadByte + THExRank.Text = br.ReadString + THTotal.Text = br.ReadString + 'THVolWAV.Text = br.ReadString + THComment.Text = br.ReadString + 'THLnType.Text = br.ReadString + CHLnObj.SelectedIndex = br.ReadInt16 + THPreview.Text = br.ReadString + CHLnmode.SelectedIndex = br.ReadByte + + Case &H564157 'WAV List + Dim xWAVOptions As Integer = br.ReadByte + WAVMultiSelect = xWAVOptions And &H1 + CWAVMultiSelect.Checked = WAVMultiSelect + CWAVMultiSelect_CheckedChanged(CWAVMultiSelect, New EventArgs) + WAVChangeLabel = xWAVOptions And &H2 + CWAVChangeLabel.Checked = WAVChangeLabel + CWAVChangeLabel_CheckedChanged(CWAVChangeLabel, New EventArgs) + WAVEmptyfill = xWAVOptions And &H4 + CWAVEmptyfill.Checked = WAVEmptyfill + CWAVEmptyfill_CheckedChanged(CWAVEmptyfill, New EventArgs) + + Dim xWAVCount As Integer = br.ReadInt32 + For xxi As Integer = 1 To xWAVCount + Dim xI As Integer = br.ReadInt16 + hWAV(xI) = br.ReadString + Next + + Case &H504D42 'BMP List + + Dim xBMPCount As Integer = br.ReadInt32 + For xxi As Integer = 1 To xBMPCount + Dim xI As Integer = br.ReadInt16 + hBMP(xI) = br.ReadString + Next + + Case &H74616542 'Beat + nBeatN.Value = br.ReadInt16 + nBeatD.Value = br.ReadInt16 + 'nBeatD.SelectedIndex = br.ReadByte + + Dim xBeatChangeMode As Integer = br.ReadByte + Dim xBeatChangeList As RadioButton() = {CBeatPreserve, CBeatMeasure, CBeatCut, CBeatScale} + xBeatChangeList(xBeatChangeMode).Checked = True + CBeatPreserve_Click(xBeatChangeList(xBeatChangeMode), New EventArgs) + + Dim xBeatCount As Integer = br.ReadInt32 + For xxi As Integer = 1 To xBeatCount + Dim xIndex As Integer = br.ReadInt16 + MeasureLength(xIndex) = br.ReadDouble + Dim xRatio As Double = MeasureLength(xIndex) / 192.0R + Dim xxD As Long = GetDenominator(xRatio) + LBeat.Items(xIndex) = Add3Zeros(xIndex) & ": " & xRatio & IIf(xxD > 10000, String.Empty, " ( " & (xRatio * xxD) & " / " & xxD & " ) ") + Next + + Case &H6E707845 'Expansion Code + TExpansion.Text = br.ReadString + + Case &H65746F4E 'Note + Dim xNoteUbound As Integer = br.ReadInt32 + ReDim Preserve Notes(xNoteUbound) + For i As Integer = 1 To UBound(Notes) + Notes(i) = New Note + Notes(i).FromBinReader(br) + Next + + Case &H6F646E55 'Undo / Redo Commands + Dim URCount As Integer = br.ReadInt32 'Should be 100 + sI = br.ReadInt32 + + For xI As Integer = 0 To 99 + Dim xUndoCount As Integer = br.ReadInt32 + Dim xBaseUndo As New UndoRedo.Void + Dim xIteratorUndo As UndoRedo.LinkedURCmd = xBaseUndo + + For xxj As Integer = 1 To xUndoCount + Dim xByteLen As Integer = br.ReadInt32 + Dim xByte() As Byte = br.ReadBytes(xByteLen) + xIteratorUndo.Next = UndoRedo.fromBytes(xByte) + xIteratorUndo = xIteratorUndo.Next + Next + + sUndo(xI) = xBaseUndo.Next + + Dim xRedoCount As Integer = br.ReadInt32 + Dim xBaseRedo As New UndoRedo.Void + Dim xIteratorRedo As UndoRedo.LinkedURCmd = xBaseRedo + For xxj As Integer = 1 To xRedoCount + Dim xByteLen As Integer = br.ReadInt32 + Dim xByte() As Byte = br.ReadBytes(xByteLen) + xIteratorRedo.Next = UndoRedo.fromBytes(xByte) + xIteratorRedo = xIteratorRedo.Next + Next + sRedo(xI) = xBaseRedo.Next + Next + + End Select + Loop EndOfSub: - br.Close() - - TBUndo.Enabled = sUndo(sI).ofType <> UndoRedo.opNoOperation - TBRedo.Enabled = sRedo(sIA).ofType <> UndoRedo.opNoOperation - mnUndo.Enabled = sUndo(sI).ofType <> UndoRedo.opNoOperation - mnRedo.Enabled = sRedo(sIA).ofType <> UndoRedo.opNoOperation - - LBMP.Visible = False - LBMP.Items.Clear() - LWAV.Visible = False - LWAV.Items.Clear() - For xI1 As Integer = 1 To 1295 - Dim unused1 = LWAV.Items.Add(C10to36(xI1) & ": " & hWAV(xI1)) - Dim unused = LBMP.Items.Add(C10to36(xI1) & ": " & hBMP(xI1)) - Next - LWAV.SelectedIndex = 0 - LWAV.Visible = True - LBMP.SelectedIndex = 0 - LBMP.Visible = True - - THLandMine.Text = hWAV(0) - THMissBMP.Text = hBMP(0) - - THBPM.Value = Notes(0).Value / 10000 - SortByVPositionQuick(0, UBound(Notes)) - UpdatePairing() - UpdateMeasureBottom() - CalculateTotalPlayableNotes() - CalculateGreatestVPosition() - RefreshPanelAll() - POStatusRefresh() - End Sub - - Private Sub SaveiBMSC(Path As String) - CalculateGreatestVPosition() - SortByVPositionInsertion() - UpdatePairing() - - Try - - Dim bw As New BinaryWriter(New FileStream(Path, FileMode.Create), System.Text.Encoding.Unicode) - - 'bw.Write("iBMSC".ToCharArray) - bw.Write(&H534D4269) - bw.Write(CByte(&H43)) - bw.Write(CByte(My.Application.Info.Version.Major)) - bw.Write(CByte(My.Application.Info.Version.Minor)) - bw.Write(CByte(My.Application.Info.Version.Build)) - - 'Preferences - 'bw.Write("Pref".ToCharArray) - bw.Write(&H66657250) - Dim xPref As Integer = 0 - If NTInput Then xPref = xPref Or &H1 - If ErrorCheck Then xPref = xPref Or &H2 - If PreviewOnClick Then xPref = xPref Or &H4 - If ShowFileName Then xPref = xPref Or &H8 - If Rscratch Then xPref = xPref Or &H10 - If mnSMenu.Checked Then xPref = xPref Or &H100 - If mnSTB.Checked Then xPref = xPref Or &H200 - If mnSOP.Checked Then xPref = xPref Or &H400 - If mnSStatus.Checked Then xPref = xPref Or &H800 - If mnSLSplitter.Checked Then xPref = xPref Or &H1000 - If mnSRSplitter.Checked Then xPref = xPref Or &H2000 - If gShowGrid Then xPref = xPref Or &H4000 - If gShowSubGrid Then xPref = xPref Or &H8000 - If gShowBG Then xPref = xPref Or &H10000 - If gShowMeasureNumber Then xPref = xPref Or &H20000 - If gShowMeasureBar Then xPref = xPref Or &H40000 - If gShowVerticalLine Then xPref = xPref Or &H80000 - If gShowC Then xPref = xPref Or &H100000 - If gDisplayBGAColumn Then xPref = xPref Or &H200000 - If gSTOP Then xPref = xPref Or &H400000 - If gBPM Then xPref = xPref Or &H800000 - If gSCROLL Then xPref = xPref Or &H20000000 - If gSnap Then xPref = xPref Or &H1000000 - If DisableVerticalMove Then xPref = xPref Or &H2000000 - If spLock(0) Then xPref = xPref Or &H4000000 - If spLock(1) Then xPref = xPref Or &H8000000 - If spLock(2) Then xPref = xPref Or &H10000000 - bw.Write(xPref) - bw.Write(BitConverter.GetBytes(gDivide)) - bw.Write(BitConverter.GetBytes(gSub)) - bw.Write(BitConverter.GetBytes(gSlash)) - bw.Write(BitConverter.GetBytes(gxHeight)) - bw.Write(BitConverter.GetBytes(gxWidth)) - bw.Write(BitConverter.GetBytes(gColumns)) - - 'Header - 'bw.Write("Head".ToCharArray) - bw.Write(&H64616548) - bw.Write(THTitle.Text) - bw.Write(THArtist.Text) - bw.Write(THGenre.Text) - bw.Write(Notes(0).Value) - Dim xPlayer As Integer = CHPlayer.SelectedIndex - Dim xRank As Integer = CHRank.SelectedIndex << 4 - bw.Write(CByte(xPlayer Or xRank)) - bw.Write(THPlayLevel.Text) - - bw.Write(THSubTitle.Text) - bw.Write(THSubArtist.Text) - 'bw.Write(THMaker.Text) - bw.Write(THStageFile.Text) - bw.Write(THBanner.Text) - bw.Write(THBackBMP.Text) - 'bw.Write(THMidiFile.Text) - bw.Write(CByte(CHDifficulty.SelectedIndex)) - bw.Write(THExRank.Text) - bw.Write(THTotal.Text) - 'bw.Write(THVolWAV.Text) - bw.Write(THComment.Text) - 'bw.Write(THLnType.Text) - bw.Write(CShort(CHLnObj.SelectedIndex)) - bw.Write(THPreview.Text) - bw.Write(CByte(CHLnmode.SelectedIndex)) - - 'Wav List - 'bw.Write(("WAV" & vbNullChar).ToCharArray) - bw.Write(&H564157) - - Dim xWAVOptions As Integer = 0 - If WAVMultiSelect Then xWAVOptions = xWAVOptions Or &H1 - If WAVChangeLabel Then xWAVOptions = xWAVOptions Or &H2 - If WAVEmptyfill Then xWAVOptions = xWAVOptions Or &H4 - bw.Write(CByte(xWAVOptions)) - - Dim xWAVCount As Integer = 0 - For i As Integer = 0 To UBound(hWAV) - If hWAV(i) <> String.Empty Then xWAVCount += 1 - Next - bw.Write(xWAVCount) - - For i As Integer = 0 To UBound(hWAV) - If hWAV(i) = String.Empty Then Continue For - bw.Write(CShort(i)) - bw.Write(hWAV(i)) - Next - - 'Bmp List - 'bw.Write(("BMP" & vbNullChar).ToCharArray) - bw.Write(&H504D42) - - Dim xBMPCount As Integer = 0 - For i As Integer = 0 To UBound(hBMP) - If hBMP(i) <> String.Empty Then xBMPCount += 1 - Next - bw.Write(xBMPCount) - - For i As Integer = 0 To UBound(hBMP) - If hBMP(i) = String.Empty Then Continue For - bw.Write(CShort(i)) - bw.Write(hBMP(i)) - Next - - 'Beat - 'bw.Write("Beat".ToCharArray) - bw.Write(&H74616542) - 'Dim xNumerator As Short = nBeatN.Value - 'Dim xDenominator As Short = nBeatD.Value - 'Dim xBeatChangeMode As Byte = BeatChangeMode - bw.Write(CShort(nBeatN.Value)) - bw.Write(CShort(nBeatD.Value)) - bw.Write(CByte(BeatChangeMode)) - - Dim xBeatCount As Integer = 0 - For i As Integer = 0 To UBound(MeasureLength) - If MeasureLength(i) <> 192.0R Then xBeatCount += 1 - Next - bw.Write(xBeatCount) - - For i As Integer = 0 To UBound(MeasureLength) - If MeasureLength(i) = 192.0R Then Continue For - bw.Write(CShort(i)) - bw.Write(MeasureLength(i)) - Next - - 'Expansion Code - 'bw.Write("Expn".ToCharArray) - bw.Write(&H6E707845) - bw.Write(TExpansion.Text) - - 'Note - 'bw.Write("Note".ToCharArray) - bw.Write(&H65746F4E) - bw.Write(UBound(Notes)) - For i As Integer = 1 To UBound(Notes) - Notes(i).WriteBinWriter(bw) - Next - - 'Undo / Redo Commands - 'bw.Write("Undo".ToCharArray) - bw.Write(&H6F646E55) - bw.Write(100) - bw.Write(sI) - - For i As Integer = 0 To 99 - 'UndoCommandsCount - Dim countUndo As Integer = 0 - Dim pUndo As UndoRedo.LinkedURCmd = sUndo(i) - While pUndo IsNot Nothing - countUndo += 1 - pUndo = pUndo.Next - End While - bw.Write(countUndo) - - 'UndoCommands - pUndo = sUndo(i) - For xxi As Integer = 1 To countUndo - Dim bUndo() As Byte = pUndo.toBytes - bw.Write(bUndo.Length) 'Length - bw.Write(bUndo) 'Command - pUndo = pUndo.Next - Next - - 'RedoCommandsCount - Dim countRedo As Integer = 0 - Dim pRedo As UndoRedo.LinkedURCmd = sRedo(i) - While pRedo IsNot Nothing - countRedo += 1 - pRedo = pRedo.Next - End While - bw.Write(countRedo) - - 'RedoCommands - pRedo = sRedo(i) - For xxi As Integer = 1 To countRedo - Dim bRedo() As Byte = pRedo.toBytes - bw.Write(bRedo.Length) - bw.Write(bRedo) - pRedo = pRedo.Next - Next - Next - - bw.Close() - - Catch ex As Exception - - Dim unused = MsgBox(ex.Message) - - End Try - - End Sub - - Private Sub SaveBMSON(Path As String) - CalculateGreatestVPosition() - SortByVPositionInsertion() - UpdatePairing() - - Try - Dim format = New Bmson - Dim options = New JsonSerializerOptions - - Dim bar_list = New List(Of BarLine)() - Dim wav_list = New Dictionary(Of Integer, SoundChannel)() - Dim note_list = New Dictionary(Of Integer, List(Of BmsonNote))() - Dim mine_list = New List(Of MineNote)() - Dim hidden_list = New Dictionary(Of Integer, MineChannel)() - Dim hidden_note_list = New Dictionary(Of Integer, List(Of MineNote))() - Dim bmp_list = New List(Of BGAHeader)() - Dim bga_list = New List(Of BGAEvent)() - Dim layer_list = New List(Of BGAEvent)() - Dim miss_list = New List(Of BGAEvent)() - Dim bpm_list = New List(Of BpmEvent)() - Dim stop_list = New List(Of StopEvent)() - Dim scroll_list = New List(Of ScrollEvent)() - - ' ヘッダ情報 - format.info.title = THTitle.Text - format.info.subtitle = THSubTitle.Text - format.info.artist = THArtist.Text - format.info.subartists(0) = THSubArtist.Text - format.info.genre = THGenre.Text - format.info.mode_hint = If(CHPlayer.SelectedIndex = 0, "beat-5k", "popn-9k") - format.info.chart_name = String.Empty - 'format.info.judge_rank = If(THExRank.Text <> "", DirectCast(CDbl(THExRank.Text), Integer), (CHRank.SelectedIndex + 1) * 25) - format.info.judge_rank = If(THExRank.Text <> String.Empty, CType(CDbl(THExRank.Text), Integer), (CHRank.SelectedIndex + 1) * 25) - format.info.total = If(THTotal.Text <> String.Empty, CalcBMSONTotal(THTotal.Text), CalcBMSONTotal(CalcBMSTotal())) - format.info.init_bpm = CDbl(THBPM.Text) - format.info.level = If(THPlayLevel.Text <> String.Empty, CInt(THPlayLevel.Text), 0) - format.info.back_image = THBackBMP.Text - format.info.eyecatch_image = THStageFile.Text - format.info.banner_image = THBanner.Text - format.info.preview_music = THPreview.Text - format.info.ln_type = CHLnmode.SelectedIndex - - ' 必要な分解能を計算 - Dim xGCD As Double = 192.0R - Dim i As Integer - For i = 0 To UBound(Notes) - xGCD = GCD(xGCD, Notes(i).VPosition, 1920000) - ' ついでにプレイモードを検出 - If format.info.mode_hint = "beat-5k" AndAlso - GetColumn(Notes(i).ColumnIndex).Identifier >= (36 + 8) AndAlso GetColumn(Notes(i).ColumnIndex).Identifier <= (36 + 9) Then - format.info.mode_hint = "beat-7k" - End If - If format.info.mode_hint = "beat-5k" AndAlso - GetColumn(Notes(i).ColumnIndex).Identifier >= 72 AndAlso GetColumn(Notes(i).ColumnIndex).Identifier <= (72 + 5) Then - format.info.mode_hint = "beat-10k" - End If - If format.info.mode_hint = "popn-9k" AndAlso - (GetColumn(Notes(i).ColumnIndex).Identifier Mod 36 = 6 OrElse GetColumn(Notes(i).ColumnIndex).Identifier = (72 + 1)) Then - format.info.mode_hint = "beat-10k" - End If - If (format.info.mode_hint = "beat-10k" OrElse format.info.mode_hint = "popn-9k") AndAlso - GetColumn(Notes(i).ColumnIndex).Identifier >= (36 + 8) AndAlso GetColumn(Notes(i).ColumnIndex).Identifier <= (36 + 8) Then - format.info.mode_hint = "beat-14k" - End If - If format.info.mode_hint <> "beat-14k" AndAlso format.info.mode_hint <> "keyboard-24k" AndAlso format.info.mode_hint <> "keyboard-24k-double" AndAlso - GetColumn(Notes(i).ColumnIndex).Identifier >= (72 + 8) AndAlso GetColumn(Notes(i).ColumnIndex).Identifier <= (72 + 9) Then - format.info.mode_hint = "beat-14k" - End If - If (format.info.mode_hint = "beat-5k" OrElse format.info.mode_hint = "beat-7k") AndAlso - (GetColumn(Notes(i).ColumnIndex).Identifier = (36 + 7) OrElse GetColumn(Notes(i).ColumnIndex).Identifier > (36 + 9)) AndAlso GetColumn(Notes(i).ColumnIndex).Identifier < 72 Then - format.info.mode_hint = "keyboard-24k" - End If - If (format.info.mode_hint = "popn-9k" OrElse format.info.mode_hint = "beat-10k" OrElse format.info.mode_hint = "beat-14k") AndAlso - (GetColumn(Notes(i).ColumnIndex).Identifier = (36 + 7) OrElse GetColumn(Notes(i).ColumnIndex).Identifier > (36 + 9)) AndAlso GetColumn(Notes(i).ColumnIndex).Identifier < 72 Then - format.info.mode_hint = "keyboard-24k-double" - End If - If format.info.mode_hint <> "keyboard-24k-double" AndAlso - (GetColumn(Notes(i).ColumnIndex).Identifier = (72 + 7) OrElse GetColumn(Notes(i).ColumnIndex).Identifier > (72 + 9)) AndAlso GetColumn(Notes(i).ColumnIndex).Identifier < 108 Then - format.info.mode_hint = "keyboard-24k-double" - End If - Next - Dim resolution = CInt(48.0R / xGCD) - format.info.resolution = resolution - ' 小節線定義 - Dim len As Double = 0 - For i = 0 To MeasureAtDisplacement(GreatestVPosition) + 1 - len += MeasureLength(i) * resolution / 48.0R - bar_list.Add(New BarLine(len)) - Next - ' Notes - For i = 1 To UBound(Notes) - Dim position = Notes(i).VPosition * resolution / 48.0R - If Notes(i).ColumnIndex = niSCROLL Then - scroll_list.Add(New ScrollEvent(position, Notes(i).Value / 10000.0R)) - ElseIf Notes(i).ColumnIndex = niBPM Then - bpm_list.Add(New BpmEvent(position, Notes(i).Value / 10000.0R)) - ElseIf Notes(i).ColumnIndex = niSTOP Then - stop_list.Add(New StopEvent(position, Notes(i).Value * resolution / 480000.0R)) - ElseIf Notes(i).ColumnIndex = niBGA Then - bga_list.Add(New BGAEvent(position, Notes(i).Value / 10000)) - ElseIf Notes(i).ColumnIndex = niLAYER Then - layer_list.Add(New BGAEvent(position, Notes(i).Value / 10000)) - ElseIf Notes(i).ColumnIndex = niPOOR Then - miss_list.Add(New BGAEvent(position, Notes(i).Value / 10000)) - ElseIf Notes(i).ColumnIndex >= niB Then - Dim value = Notes(i).Value / 10000 - If Not note_list.ContainsKey(value) Then - note_list(value) = New List(Of BmsonNote) - End If - note_list(value).Add(New BmsonNote(position, 0)) - Else - Dim lane = GetColumn(Notes(i).ColumnIndex).Identifier - 36 - Dim value = Notes(i).Value / 10000 - 'ノート定義を変換 - If format.info.mode_hint = "popn-9k" Then - If lane >= 36 Then - lane -= 32 - End If - ElseIf format.info.mode_hint = "keyboard-24k" OrElse format.info.mode_hint = "keyboard-24k-double" Then - If (lane Mod 36) = 6 OrElse (lane Mod 36) = 7 Then - lane += 19 - ElseIf (lane Mod 36) >= 8 Then - lane -= 2 - End If - If lane >= 36 Then - lane -= 10 - End If - Else - If (lane Mod 36) = 6 Then - lane += 2 - ElseIf (lane Mod 36) >= 8 Then - lane -= 2 - End If - If lane >= 36 Then - lane -= 28 - End If - End If - - If Notes(i).Landmine Then - mine_list.Add(New MineNote(position, lane, value)) - ElseIf Notes(i).Hidden Then - If Not hidden_note_list.ContainsKey(value) Then - hidden_note_list(value) = New List(Of MineNote) - End If - hidden_note_list(value).Add(New MineNote(position, lane, 0)) - ElseIf Notes(i).Length > 0 AndAlso NTInput Then - If Not note_list.ContainsKey(value) Then - note_list(value) = New List(Of BmsonNote) - End If - Dim length = Notes(i).Length * resolution / 48.0R - note_list(value).Add(New BmsonNote(position, lane, length)) - ElseIf Notes(i).LNPair > 0 Then - If i < Notes(i).LNPair Then - If Not note_list.ContainsKey(value) Then - note_list(value) = New List(Of BmsonNote) - End If - Dim length = (Notes(Notes(i).LNPair).VPosition - Notes(i).VPosition) * resolution / 48.0R - Dim note = New BmsonNote(position, lane, length) - note_list(value).Add(note) - Else - If Notes(i).Value \ 10000 <> LnObj AndAlso Notes(i).Value <> Notes(Notes(i).LNPair).Value Then - Dim note = New BmsonNote(position, lane) With { - .up = True - } - note_list(value).Add(note) - End If - End If - Else - If Not note_list.ContainsKey(value) Then - note_list(value) = New List(Of BmsonNote) - End If - note_list(value).Add(New BmsonNote(position, lane)) - End If - End If - Next - ' 音定義 - For i = 1 To UBound(hWAV) - If hWAV(i) <> String.Empty Then - If note_list.ContainsKey(i) Then - wav_list.Add(i, New SoundChannel(hWAV(i))) - End If - End If - If hidden_note_list.ContainsKey(i) Then - If hWAV(i) <> String.Empty Then - hidden_list.Add(i, New MineChannel(hWAV(i))) - Else - hidden_list.Add(i, New MineChannel(String.Empty)) - End If - End If - Next - ReDim format.mine_channels(0) - format.mine_channels(0) = If(hWAV(0) <> String.Empty, New MineChannel(hWAV(0)), New MineChannel(String.Empty)) - For i = 1 To UBound(hBMP) - If hBMP(i) <> String.Empty Then - bmp_list.Add(New BGAHeader(i, hBMP(i))) - End If - Next - ' 適用 - format.lines = bar_list.ToArray() - format.bpm_events = bpm_list.ToArray() - format.stop_events = stop_list.ToArray() - format.scroll_events = scroll_list.ToArray() - format.bga.bga_header = bmp_list.ToArray() - format.bga.bga_events = bga_list.ToArray() - format.bga.layer_events = layer_list.ToArray() - format.bga.poor_events = miss_list.ToArray() - format.mine_channels(0).notes = mine_list.ToArray() - - ReDim format.sound_channels(wav_list.Count() - 1) - ReDim format.key_channels(hidden_list.Count() - 1) - - i = 0 - For Each n In wav_list - format.sound_channels(i) = New SoundChannel(n.Value().name) - ReDim format.sound_channels(i).notes(note_list(n.Key()).Count() - 1) - format.sound_channels(i).notes = note_list(n.Key()).ToArray() - i += 1 - Next - - i = 0 - For Each n In hidden_list - format.key_channels(i) = New MineChannel(n.Value().name) - ReDim format.key_channels(i).notes(hidden_note_list(n.Key()).Count() - 1) - format.key_channels(i).notes = hidden_note_list(n.Key()).ToArray() - i += 1 - Next - - options.IncludeFields = True - options.WriteIndented = True - Dim bw As New BinaryWriter(New FileStream(Path, FileMode.Create), System.Text.Encoding.UTF8) - Dim str = JsonSerializer.SerializeToUtf8Bytes(format, options) - bw.Write(str) - bw.Close() - Catch ex As Exception - Dim unused = MsgBox(ex.Message) - End Try - End Sub - - Public Function CalcBMSTotal() As Double - Dim notes = CalculateTotalNotes() - Return Math.Max(720.0 / (800 + notes) * notes, 200.0) - End Function - - Public Function CalcBMSONTotal(total As Double) As Double - Dim notes = CalculateTotalNotes() - Return total / Math.Max(800.0 / (700 + notes) * notes, 250.0) * 100 - End Function + br.Close() + + TBUndo.Enabled = sUndo(sI).ofType <> UndoRedo.opNoOperation + TBRedo.Enabled = sRedo(sIA).ofType <> UndoRedo.opNoOperation + mnUndo.Enabled = sUndo(sI).ofType <> UndoRedo.opNoOperation + mnRedo.Enabled = sRedo(sIA).ofType <> UndoRedo.opNoOperation + + LBMP.Visible = False + LBMP.Items.Clear() + LWAV.Visible = False + LWAV.Items.Clear() + For xI1 As Integer = 1 To 1295 + Dim unused1 = LWAV.Items.Add(C10to36(xI1) & ": " & hWAV(xI1)) + Dim unused = LBMP.Items.Add(C10to36(xI1) & ": " & hBMP(xI1)) + Next + LWAV.SelectedIndex = 0 + LWAV.Visible = True + LBMP.SelectedIndex = 0 + LBMP.Visible = True + + THLandMine.Text = hWAV(0) + THMissBMP.Text = hBMP(0) + + THBPM.Value = Notes(0).Value / 10000 + SortByVPositionQuick(0, UBound(Notes)) + UpdatePairing() + UpdateMeasureBottom() + CalculateTotalPlayableNotes() + CalculateGreatestVPosition() + RefreshPanelAll() + POStatusRefresh() + End Sub + + Private Sub SaveiBMSC(Path As String) + CalculateGreatestVPosition() + SortByVPositionInsertion() + UpdatePairing() + + Try + + Dim bw As New BinaryWriter(New FileStream(Path, FileMode.Create), System.Text.Encoding.Unicode) + + 'bw.Write("iBMSC".ToCharArray) + bw.Write(&H534D4269) + bw.Write(CByte(&H43)) + bw.Write(CByte(My.Application.Info.Version.Major)) + bw.Write(CByte(My.Application.Info.Version.Minor)) + bw.Write(CByte(My.Application.Info.Version.Build)) + + 'Preferences + 'bw.Write("Pref".ToCharArray) + bw.Write(&H66657250) + Dim xPref As Integer = 0 + If NTInput Then xPref = xPref Or &H1 + If ErrorCheck Then xPref = xPref Or &H2 + If PreviewOnClick Then xPref = xPref Or &H4 + If ShowFileName Then xPref = xPref Or &H8 + If Rscratch Then xPref = xPref Or &H10 + If mnSMenu.Checked Then xPref = xPref Or &H100 + If mnSTB.Checked Then xPref = xPref Or &H200 + If mnSOP.Checked Then xPref = xPref Or &H400 + If mnSStatus.Checked Then xPref = xPref Or &H800 + If mnSLSplitter.Checked Then xPref = xPref Or &H1000 + If mnSRSplitter.Checked Then xPref = xPref Or &H2000 + If gShowGrid Then xPref = xPref Or &H4000 + If gShowSubGrid Then xPref = xPref Or &H8000 + If gShowBG Then xPref = xPref Or &H10000 + If gShowMeasureNumber Then xPref = xPref Or &H20000 + If gShowMeasureBar Then xPref = xPref Or &H40000 + If gShowVerticalLine Then xPref = xPref Or &H80000 + If gShowC Then xPref = xPref Or &H100000 + If gDisplayBGAColumn Then xPref = xPref Or &H200000 + If gSTOP Then xPref = xPref Or &H400000 + If gBPM Then xPref = xPref Or &H800000 + If gSCROLL Then xPref = xPref Or &H20000000 + If gSnap Then xPref = xPref Or &H1000000 + If DisableVerticalMove Then xPref = xPref Or &H2000000 + If spLock(0) Then xPref = xPref Or &H4000000 + If spLock(1) Then xPref = xPref Or &H8000000 + If spLock(2) Then xPref = xPref Or &H10000000 + bw.Write(xPref) + bw.Write(BitConverter.GetBytes(gDivide)) + bw.Write(BitConverter.GetBytes(gSub)) + bw.Write(BitConverter.GetBytes(gSlash)) + bw.Write(BitConverter.GetBytes(gxHeight)) + bw.Write(BitConverter.GetBytes(gxWidth)) + bw.Write(BitConverter.GetBytes(gColumns)) + + 'Header + 'bw.Write("Head".ToCharArray) + bw.Write(&H64616548) + bw.Write(THTitle.Text) + bw.Write(THArtist.Text) + bw.Write(THGenre.Text) + bw.Write(Notes(0).Value) + Dim xPlayer As Integer = CHPlayer.SelectedIndex + Dim xRank As Integer = CHRank.SelectedIndex << 4 + bw.Write(CByte(xPlayer Or xRank)) + bw.Write(THPlayLevel.Text) + + bw.Write(THSubTitle.Text) + bw.Write(THSubArtist.Text) + 'bw.Write(THMaker.Text) + bw.Write(THStageFile.Text) + bw.Write(THBanner.Text) + bw.Write(THBackBMP.Text) + 'bw.Write(THMidiFile.Text) + bw.Write(CByte(CHDifficulty.SelectedIndex)) + bw.Write(THExRank.Text) + bw.Write(THTotal.Text) + 'bw.Write(THVolWAV.Text) + bw.Write(THComment.Text) + 'bw.Write(THLnType.Text) + bw.Write(CShort(CHLnObj.SelectedIndex)) + bw.Write(THPreview.Text) + bw.Write(CByte(CHLnmode.SelectedIndex)) + + 'Wav List + 'bw.Write(("WAV" & vbNullChar).ToCharArray) + bw.Write(&H564157) + + Dim xWAVOptions As Integer = 0 + If WAVMultiSelect Then xWAVOptions = xWAVOptions Or &H1 + If WAVChangeLabel Then xWAVOptions = xWAVOptions Or &H2 + If WAVEmptyfill Then xWAVOptions = xWAVOptions Or &H4 + bw.Write(CByte(xWAVOptions)) + + Dim xWAVCount As Integer = 0 + For i As Integer = 0 To UBound(hWAV) + If hWAV(i) <> String.Empty Then xWAVCount += 1 + Next + bw.Write(xWAVCount) + + For i As Integer = 0 To UBound(hWAV) + If hWAV(i) = String.Empty Then Continue For + bw.Write(CShort(i)) + bw.Write(hWAV(i)) + Next + + 'Bmp List + 'bw.Write(("BMP" & vbNullChar).ToCharArray) + bw.Write(&H504D42) + + Dim xBMPCount As Integer = 0 + For i As Integer = 0 To UBound(hBMP) + If hBMP(i) <> String.Empty Then xBMPCount += 1 + Next + bw.Write(xBMPCount) + + For i As Integer = 0 To UBound(hBMP) + If hBMP(i) = String.Empty Then Continue For + bw.Write(CShort(i)) + bw.Write(hBMP(i)) + Next + + 'Beat + 'bw.Write("Beat".ToCharArray) + bw.Write(&H74616542) + 'Dim xNumerator As Short = nBeatN.Value + 'Dim xDenominator As Short = nBeatD.Value + 'Dim xBeatChangeMode As Byte = BeatChangeMode + bw.Write(CShort(nBeatN.Value)) + bw.Write(CShort(nBeatD.Value)) + bw.Write(CByte(BeatChangeMode)) + + Dim xBeatCount As Integer = 0 + For i As Integer = 0 To UBound(MeasureLength) + If MeasureLength(i) <> 192.0R Then xBeatCount += 1 + Next + bw.Write(xBeatCount) + + For i As Integer = 0 To UBound(MeasureLength) + If MeasureLength(i) = 192.0R Then Continue For + bw.Write(CShort(i)) + bw.Write(MeasureLength(i)) + Next + + 'Expansion Code + 'bw.Write("Expn".ToCharArray) + bw.Write(&H6E707845) + bw.Write(TExpansion.Text) + + 'Note + 'bw.Write("Note".ToCharArray) + bw.Write(&H65746F4E) + bw.Write(UBound(Notes)) + For i As Integer = 1 To UBound(Notes) + Notes(i).WriteBinWriter(bw) + Next + + 'Undo / Redo Commands + 'bw.Write("Undo".ToCharArray) + bw.Write(&H6F646E55) + bw.Write(100) + bw.Write(sI) + + For i As Integer = 0 To 99 + 'UndoCommandsCount + Dim countUndo As Integer = 0 + Dim pUndo As UndoRedo.LinkedURCmd = sUndo(i) + While pUndo IsNot Nothing + countUndo += 1 + pUndo = pUndo.Next + End While + bw.Write(countUndo) + + 'UndoCommands + pUndo = sUndo(i) + For xxi As Integer = 1 To countUndo + Dim bUndo() As Byte = pUndo.toBytes + bw.Write(bUndo.Length) 'Length + bw.Write(bUndo) 'Command + pUndo = pUndo.Next + Next + + 'RedoCommandsCount + Dim countRedo As Integer = 0 + Dim pRedo As UndoRedo.LinkedURCmd = sRedo(i) + While pRedo IsNot Nothing + countRedo += 1 + pRedo = pRedo.Next + End While + bw.Write(countRedo) + + 'RedoCommands + pRedo = sRedo(i) + For xxi As Integer = 1 To countRedo + Dim bRedo() As Byte = pRedo.toBytes + bw.Write(bRedo.Length) + bw.Write(bRedo) + pRedo = pRedo.Next + Next + Next + + bw.Close() + + Catch ex As Exception + + Dim unused = MsgBox(ex.Message) + + End Try + + End Sub + + Private Sub SaveBMSON(Path As String) + CalculateGreatestVPosition() + SortByVPositionInsertion() + UpdatePairing() + + Try + Dim format = New Bmson + Dim options = New JsonSerializerOptions + + Dim bar_list = New List(Of BarLine)() + Dim wav_list = New Dictionary(Of Integer, SoundChannel)() + Dim note_list = New Dictionary(Of Integer, List(Of BmsonNote))() + Dim mine_list = New List(Of MineNote)() + Dim hidden_list = New Dictionary(Of Integer, MineChannel)() + Dim hidden_note_list = New Dictionary(Of Integer, List(Of MineNote))() + Dim bmp_list = New List(Of BGAHeader)() + Dim bga_list = New List(Of BGAEvent)() + Dim layer_list = New List(Of BGAEvent)() + Dim miss_list = New List(Of BGAEvent)() + Dim bpm_list = New List(Of BpmEvent)() + Dim stop_list = New List(Of StopEvent)() + Dim scroll_list = New List(Of ScrollEvent)() + + ' ヘッダ情報 + format.info.title = THTitle.Text + format.info.subtitle = THSubTitle.Text + format.info.artist = THArtist.Text + format.info.subartists(0) = THSubArtist.Text + format.info.genre = THGenre.Text + format.info.mode_hint = If(CHPlayer.SelectedIndex = 0, "beat-5k", "popn-9k") + format.info.chart_name = String.Empty + 'format.info.judge_rank = If(THExRank.Text <> "", DirectCast(CDbl(THExRank.Text), Integer), (CHRank.SelectedIndex + 1) * 25) + format.info.judge_rank = If(THExRank.Text <> String.Empty, CType(CDbl(THExRank.Text), Integer), (CHRank.SelectedIndex + 1) * 25) + format.info.total = If(THTotal.Text <> String.Empty, CalcBMSONTotal(THTotal.Text), CalcBMSONTotal(CalcBMSTotal())) + format.info.init_bpm = CDbl(THBPM.Text) + format.info.level = If(THPlayLevel.Text <> String.Empty, CInt(THPlayLevel.Text), 0) + format.info.back_image = THBackBMP.Text + format.info.eyecatch_image = THStageFile.Text + format.info.banner_image = THBanner.Text + format.info.preview_music = THPreview.Text + format.info.ln_type = CHLnmode.SelectedIndex + + ' 必要な分解能を計算 + Dim xGCD As Double = 192.0R + Dim i As Integer + For i = 0 To UBound(Notes) + xGCD = GCD(xGCD, Notes(i).VPosition, 1920000) + ' ついでにプレイモードを検出 + If format.info.mode_hint = "beat-5k" AndAlso + GetColumn(Notes(i).ColumnIndex).Identifier >= (36 + 8) AndAlso GetColumn(Notes(i).ColumnIndex).Identifier <= (36 + 9) Then + format.info.mode_hint = "beat-7k" + End If + If format.info.mode_hint = "beat-5k" AndAlso + GetColumn(Notes(i).ColumnIndex).Identifier >= 72 AndAlso GetColumn(Notes(i).ColumnIndex).Identifier <= (72 + 5) Then + format.info.mode_hint = "beat-10k" + End If + If format.info.mode_hint = "popn-9k" AndAlso + (GetColumn(Notes(i).ColumnIndex).Identifier Mod 36 = 6 OrElse GetColumn(Notes(i).ColumnIndex).Identifier = (72 + 1)) Then + format.info.mode_hint = "beat-10k" + End If + If (format.info.mode_hint = "beat-10k" OrElse format.info.mode_hint = "popn-9k") AndAlso + GetColumn(Notes(i).ColumnIndex).Identifier >= (36 + 8) AndAlso GetColumn(Notes(i).ColumnIndex).Identifier <= (36 + 8) Then + format.info.mode_hint = "beat-14k" + End If + If format.info.mode_hint <> "beat-14k" AndAlso format.info.mode_hint <> "keyboard-24k" AndAlso format.info.mode_hint <> "keyboard-24k-double" AndAlso + GetColumn(Notes(i).ColumnIndex).Identifier >= (72 + 8) AndAlso GetColumn(Notes(i).ColumnIndex).Identifier <= (72 + 9) Then + format.info.mode_hint = "beat-14k" + End If + If (format.info.mode_hint = "beat-5k" OrElse format.info.mode_hint = "beat-7k") AndAlso + (GetColumn(Notes(i).ColumnIndex).Identifier = (36 + 7) OrElse GetColumn(Notes(i).ColumnIndex).Identifier > (36 + 9)) AndAlso GetColumn(Notes(i).ColumnIndex).Identifier < 72 Then + format.info.mode_hint = "keyboard-24k" + End If + If (format.info.mode_hint = "popn-9k" OrElse format.info.mode_hint = "beat-10k" OrElse format.info.mode_hint = "beat-14k") AndAlso + (GetColumn(Notes(i).ColumnIndex).Identifier = (36 + 7) OrElse GetColumn(Notes(i).ColumnIndex).Identifier > (36 + 9)) AndAlso GetColumn(Notes(i).ColumnIndex).Identifier < 72 Then + format.info.mode_hint = "keyboard-24k-double" + End If + If format.info.mode_hint <> "keyboard-24k-double" AndAlso + (GetColumn(Notes(i).ColumnIndex).Identifier = (72 + 7) OrElse GetColumn(Notes(i).ColumnIndex).Identifier > (72 + 9)) AndAlso GetColumn(Notes(i).ColumnIndex).Identifier < 108 Then + format.info.mode_hint = "keyboard-24k-double" + End If + Next + Dim resolution = CInt(48.0R / xGCD) + format.info.resolution = resolution + ' 小節線定義 + Dim len As Double = 0 + For i = 0 To MeasureAtDisplacement(GreatestVPosition) + 1 + len += MeasureLength(i) * resolution / 48.0R + bar_list.Add(New BarLine(len)) + Next + ' Notes + For i = 1 To UBound(Notes) + Dim position = Notes(i).VPosition * resolution / 48.0R + If Notes(i).ColumnIndex = niSCROLL Then + scroll_list.Add(New ScrollEvent(position, Notes(i).Value / 10000.0R)) + ElseIf Notes(i).ColumnIndex = niBPM Then + bpm_list.Add(New BpmEvent(position, Notes(i).Value / 10000.0R)) + ElseIf Notes(i).ColumnIndex = niSTOP Then + stop_list.Add(New StopEvent(position, Notes(i).Value * resolution / 480000.0R)) + ElseIf Notes(i).ColumnIndex = niBGA Then + bga_list.Add(New BGAEvent(position, Notes(i).Value / 10000)) + ElseIf Notes(i).ColumnIndex = niLAYER Then + layer_list.Add(New BGAEvent(position, Notes(i).Value / 10000)) + ElseIf Notes(i).ColumnIndex = niPOOR Then + miss_list.Add(New BGAEvent(position, Notes(i).Value / 10000)) + ElseIf Notes(i).ColumnIndex >= niB Then + Dim value = Notes(i).Value / 10000 + If Not note_list.ContainsKey(value) Then + note_list(value) = New List(Of BmsonNote) + End If + note_list(value).Add(New BmsonNote(position, 0)) + Else + Dim lane = GetColumn(Notes(i).ColumnIndex).Identifier - 36 + Dim value = Notes(i).Value / 10000 + 'ノート定義を変換 + If format.info.mode_hint = "popn-9k" Then + If lane >= 36 Then + lane -= 32 + End If + ElseIf format.info.mode_hint = "keyboard-24k" OrElse format.info.mode_hint = "keyboard-24k-double" Then + If (lane Mod 36) = 6 OrElse (lane Mod 36) = 7 Then + lane += 19 + ElseIf (lane Mod 36) >= 8 Then + lane -= 2 + End If + If lane >= 36 Then + lane -= 10 + End If + Else + If (lane Mod 36) = 6 Then + lane += 2 + ElseIf (lane Mod 36) >= 8 Then + lane -= 2 + End If + If lane >= 36 Then + lane -= 28 + End If + End If + + If Notes(i).Landmine Then + mine_list.Add(New MineNote(position, lane, value)) + ElseIf Notes(i).Hidden Then + If Not hidden_note_list.ContainsKey(value) Then + hidden_note_list(value) = New List(Of MineNote) + End If + hidden_note_list(value).Add(New MineNote(position, lane, 0)) + ElseIf Notes(i).Length > 0 AndAlso NTInput Then + If Not note_list.ContainsKey(value) Then + note_list(value) = New List(Of BmsonNote) + End If + Dim length = Notes(i).Length * resolution / 48.0R + note_list(value).Add(New BmsonNote(position, lane, length)) + ElseIf Notes(i).LNPair > 0 Then + If i < Notes(i).LNPair Then + If Not note_list.ContainsKey(value) Then + note_list(value) = New List(Of BmsonNote) + End If + Dim length = (Notes(Notes(i).LNPair).VPosition - Notes(i).VPosition) * resolution / 48.0R + Dim note = New BmsonNote(position, lane, length) + note_list(value).Add(note) + Else + If Notes(i).Value \ 10000 <> LnObj AndAlso Notes(i).Value <> Notes(Notes(i).LNPair).Value Then + Dim note = New BmsonNote(position, lane) With { + .up = True + } + note_list(value).Add(note) + End If + End If + Else + If Not note_list.ContainsKey(value) Then + note_list(value) = New List(Of BmsonNote) + End If + note_list(value).Add(New BmsonNote(position, lane)) + End If + End If + Next + ' 音定義 + For i = 1 To UBound(hWAV) + If hWAV(i) <> String.Empty Then + If note_list.ContainsKey(i) Then + wav_list.Add(i, New SoundChannel(hWAV(i))) + End If + End If + If hidden_note_list.ContainsKey(i) Then + If hWAV(i) <> String.Empty Then + hidden_list.Add(i, New MineChannel(hWAV(i))) + Else + hidden_list.Add(i, New MineChannel(String.Empty)) + End If + End If + Next + ReDim format.mine_channels(0) + format.mine_channels(0) = If(hWAV(0) <> String.Empty, New MineChannel(hWAV(0)), New MineChannel(String.Empty)) + For i = 1 To UBound(hBMP) + If hBMP(i) <> String.Empty Then + bmp_list.Add(New BGAHeader(i, hBMP(i))) + End If + Next + ' 適用 + format.lines = bar_list.ToArray() + format.bpm_events = bpm_list.ToArray() + format.stop_events = stop_list.ToArray() + format.scroll_events = scroll_list.ToArray() + format.bga.bga_header = bmp_list.ToArray() + format.bga.bga_events = bga_list.ToArray() + format.bga.layer_events = layer_list.ToArray() + format.bga.poor_events = miss_list.ToArray() + format.mine_channels(0).notes = mine_list.ToArray() + + ReDim format.sound_channels(wav_list.Count() - 1) + ReDim format.key_channels(hidden_list.Count() - 1) + + i = 0 + For Each n In wav_list + format.sound_channels(i) = New SoundChannel(n.Value().name) + ReDim format.sound_channels(i).notes(note_list(n.Key()).Count() - 1) + format.sound_channels(i).notes = note_list(n.Key()).ToArray() + i += 1 + Next + + i = 0 + For Each n In hidden_list + format.key_channels(i) = New MineChannel(n.Value().name) + ReDim format.key_channels(i).notes(hidden_note_list(n.Key()).Count() - 1) + format.key_channels(i).notes = hidden_note_list(n.Key()).ToArray() + i += 1 + Next + + options.IncludeFields = True + options.WriteIndented = True + Dim bw As New BinaryWriter(New FileStream(Path, FileMode.Create), System.Text.Encoding.UTF8) + Dim str = JsonSerializer.SerializeToUtf8Bytes(format, options) + bw.Write(str) + bw.Close() + Catch ex As Exception + Dim unused = MsgBox(ex.Message) + End Try + End Sub + + Public Function CalcBMSTotal() As Double + Dim notes = CalculateTotalNotes() + Return Math.Max(720.0 / (800 + notes) * notes, 200.0) + End Function + + Public Function CalcBMSONTotal(total As Double) As Double + Dim notes = CalculateTotalNotes() + Return total / Math.Max(800.0 / (700 + notes) * notes, 250.0) * 100 + End Function End Class diff --git a/iBMSC/Column.vb b/iBMSC/Column.vb index fd18bf711..686834a2c 100644 --- a/iBMSC/Column.vb +++ b/iBMSC/Column.vb @@ -1,124 +1,124 @@ Namespace Editor - Public Structure Column - Private _Width As Integer - Private _isNoteCol As Boolean - Private _isVisible As Boolean - Private _isEnabledAfterAll As Boolean + Public Structure Column + Private _Width As Integer + Private _isNoteCol As Boolean + Private _isVisible As Boolean + Private _isEnabledAfterAll As Boolean - Public Property Width() As Integer - Get - Return _Width - End Get - Set(value As Integer) - _Width = value - _isEnabledAfterAll = _isVisible And _isNoteCol And (_Width <> 0) - End Set - End Property + Public Property Width() As Integer + Get + Return _Width + End Get + Set(value As Integer) + _Width = value + _isEnabledAfterAll = _isVisible And _isNoteCol And (_Width <> 0) + End Set + End Property - Public Property isVisible() As Boolean - Get - Return _isVisible - End Get - Set(value As Boolean) - _isVisible = value - _isEnabledAfterAll = _isVisible And _isNoteCol And (_Width <> 0) - End Set - End Property + Public Property isVisible() As Boolean + Get + Return _isVisible + End Get + Set(value As Boolean) + _isVisible = value + _isEnabledAfterAll = _isVisible And _isNoteCol And (_Width <> 0) + End Set + End Property - Public Property isNoteCol() As Boolean - Get - Return _isNoteCol - End Get - Set(value As Boolean) - _isNoteCol = value - _isEnabledAfterAll = _isVisible And _isNoteCol And (_Width <> 0) - End Set - End Property + Public Property isNoteCol() As Boolean + Get + Return _isNoteCol + End Get + Set(value As Boolean) + _isNoteCol = value + _isEnabledAfterAll = _isVisible And _isNoteCol And (_Width <> 0) + End Set + End Property - Public ReadOnly Property isEnabledAfterAll() As Boolean - Get - Return _isEnabledAfterAll - End Get - End Property + Public ReadOnly Property isEnabledAfterAll() As Boolean + Get + Return _isEnabledAfterAll + End Get + End Property - 'Private Visibility As ColumnVisibility - 'Public Property Visible() As Boolean - ' Get - ' Return Not (Visibility And ColumnVisibility.Invisible) - ' End Get - ' Set( value As Boolean) - ' If value Then - ' Visibility = Visibility Or ColumnVisibility.Invisible - ' Else - ' Visibility = Visibility And (ColumnVisibility.Decorative Or ColumnVisibility.Zero_Width) - ' End If - ' End Set - 'End Property + 'Private Visibility As ColumnVisibility + 'Public Property Visible() As Boolean + ' Get + ' Return Not (Visibility And ColumnVisibility.Invisible) + ' End Get + ' Set( value As Boolean) + ' If value Then + ' Visibility = Visibility Or ColumnVisibility.Invisible + ' Else + ' Visibility = Visibility And (ColumnVisibility.Decorative Or ColumnVisibility.Zero_Width) + ' End If + ' End Set + 'End Property - Public Left As Integer - Public Title As String - Public isNumeric As Boolean - Public isSound As Boolean - Public Identifier As Integer + Public Left As Integer + Public Title As String + Public isNumeric As Boolean + Public isSound As Boolean + Public Identifier As Integer - Public cNote As Integer - Public cText As Color - Public cLNote As Integer - Public cLText As Color - Public cBG As Color + Public cNote As Integer + Public cText As Color + Public cLNote As Integer + Public cLText As Color + Public cBG As Color - Private cCacheB As Integer - Private cCacheD As Integer - Private cCacheLB As Integer - Private cCacheLD As Integer + Private cCacheB As Integer + Private cCacheD As Integer + Private cCacheLB As Integer + Private cCacheLD As Integer - Public Function getBright(opacity As Single) As Color - Return Color.FromArgb((CInt(((cCacheB >> 24) And &HFF) * opacity) << 24) Or (cCacheB And &HFFFFFF)) - End Function - Public Function getDark(opacity As Single) As Color - Return Color.FromArgb((CInt(((cCacheD >> 24) And &HFF) * opacity) << 24) Or (cCacheD And &HFFFFFF)) - End Function - Public Function getLongBright(opacity As Single) As Color - Return Color.FromArgb((CInt(((cCacheLB >> 24) And &HFF) * opacity) << 24) Or (cCacheLB And &HFFFFFF)) - End Function - Public Function getLongDark(opacity As Single) As Color - Return Color.FromArgb((CInt(((cCacheLD >> 24) And &HFF) * opacity) << 24) Or (cCacheLD And &HFFFFFF)) - End Function + Public Function getBright(opacity As Single) As Color + Return Color.FromArgb((CInt(((cCacheB >> 24) And &HFF) * opacity) << 24) Or (cCacheB And &HFFFFFF)) + End Function + Public Function getDark(opacity As Single) As Color + Return Color.FromArgb((CInt(((cCacheD >> 24) And &HFF) * opacity) << 24) Or (cCacheD And &HFFFFFF)) + End Function + Public Function getLongBright(opacity As Single) As Color + Return Color.FromArgb((CInt(((cCacheLB >> 24) And &HFF) * opacity) << 24) Or (cCacheLB And &HFFFFFF)) + End Function + Public Function getLongDark(opacity As Single) As Color + Return Color.FromArgb((CInt(((cCacheLD >> 24) And &HFF) * opacity) << 24) Or (cCacheLD And &HFFFFFF)) + End Function - Public Sub setNoteColor(c As Integer) - cNote = c - 'cCacheB = (c And &HFF000000) Or &H808080 Or ((c And &HFFFFFF) >> 1) - 'cCacheD = (c And &HFF000000) Or ((c And &HFEFEFE) >> 1) - cCacheB = AdjustBrightness(Color.FromArgb(c), 50, ((c >> 24) And &HFF) / 255).ToArgb - cCacheD = AdjustBrightness(Color.FromArgb(c), -25, ((c >> 24) And &HFF) / 255).ToArgb - End Sub - Public Sub setLNoteColor(c As Integer) - cLNote = c - 'cCacheLB = (c And &HFF000000) Or &H808080 Or ((c And &HFFFFFF) >> 1) - 'cCacheLD = (c And &HFF000000) Or ((c And &HFEFEFE) >> 1) - cCacheLB = AdjustBrightness(Color.FromArgb(c), 50, ((c >> 24) And &HFF) / 255).ToArgb - cCacheLD = AdjustBrightness(Color.FromArgb(c), -25, ((c >> 24) And &HFF) / 255).ToArgb - End Sub + Public Sub setNoteColor(c As Integer) + cNote = c + 'cCacheB = (c And &HFF000000) Or &H808080 Or ((c And &HFFFFFF) >> 1) + 'cCacheD = (c And &HFF000000) Or ((c And &HFEFEFE) >> 1) + cCacheB = AdjustBrightness(Color.FromArgb(c), 50, ((c >> 24) And &HFF) / 255).ToArgb + cCacheD = AdjustBrightness(Color.FromArgb(c), -25, ((c >> 24) And &HFF) / 255).ToArgb + End Sub + Public Sub setLNoteColor(c As Integer) + cLNote = c + 'cCacheLB = (c And &HFF000000) Or &H808080 Or ((c And &HFFFFFF) >> 1) + 'cCacheLD = (c And &HFF000000) Or ((c And &HFEFEFE) >> 1) + cCacheLB = AdjustBrightness(Color.FromArgb(c), 50, ((c >> 24) And &HFF) / 255).ToArgb + cCacheLD = AdjustBrightness(Color.FromArgb(c), -25, ((c >> 24) And &HFF) / 255).ToArgb + End Sub - Public Sub New(xLeft As Integer, xWidth As Integer, xTitle As String, - xNoteCol As Boolean, xisNumeric As Boolean, xisSound As Boolean, xVisible As Boolean, xIdentifier As Integer, - xcNote As Integer, xcText As Integer, xcLNote As Integer, xcLText As Integer, xcBG As Integer) - Left = xLeft - Title = xTitle - isNumeric = xisNumeric - isSound = xisSound - Identifier = xIdentifier + Public Sub New(xLeft As Integer, xWidth As Integer, xTitle As String, + xNoteCol As Boolean, xisNumeric As Boolean, xisSound As Boolean, xVisible As Boolean, xIdentifier As Integer, + xcNote As Integer, xcText As Integer, xcLNote As Integer, xcLText As Integer, xcBG As Integer) + Left = xLeft + Title = xTitle + isNumeric = xisNumeric + isSound = xisSound + Identifier = xIdentifier - _Width = xWidth - _isVisible = xVisible - _isNoteCol = xNoteCol - _isEnabledAfterAll = xVisible And xNoteCol And (xWidth <> 0) + _Width = xWidth + _isVisible = xVisible + _isNoteCol = xNoteCol + _isEnabledAfterAll = xVisible And xNoteCol And (xWidth <> 0) - setNoteColor(xcNote) - cText = Color.FromArgb(xcText) - setLNoteColor(xcLNote) - cLText = Color.FromArgb(xcLText) - cBG = Color.FromArgb(xcBG) - End Sub - End Structure + setNoteColor(xcNote) + cText = Color.FromArgb(xcText) + setLNoteColor(xcLNote) + cLText = Color.FromArgb(xcLText) + cBG = Color.FromArgb(xcBG) + End Sub + End Structure End Namespace diff --git a/iBMSC/Dialogs/AboutBox1.vb b/iBMSC/Dialogs/AboutBox1.vb index 22f7b4338..a1b2d397e 100644 --- a/iBMSC/Dialogs/AboutBox1.vb +++ b/iBMSC/Dialogs/AboutBox1.vb @@ -1,175 +1,175 @@ Public NotInheritable Class AboutBox1 - Public Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (hwnd As Integer, wMsg As Integer, wParam As Integer, lParam As Integer) As Integer - Public Declare Function ReleaseCapture Lib "user32.dll" Alias "ReleaseCapture" () As Integer - Private Const WM_SYSCOMMAND As Integer = &H112 - Private Const SC_MOVE As Integer = &HF010 - Private Const WM_NCLBUTTONDOWN As Integer = &HA1 - Private Const HTCAPTION As Integer = 2 - Public bBitmap As Bitmap = My.Resources.SplashScreenx - - Private Sub AboutBox1_KeyPress(sender As Object, e As KeyPressEventArgs) Handles Me.KeyPress - Close() - End Sub - - Private Sub AboutBox1_MouseDown(sender As Object, e As MouseEventArgs) Handles Me.MouseDown - Dim unused1 = ReleaseCapture() - Dim unused = SendMessage(Handle.ToInt32, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0) - End Sub - - Private Sub AboutBox1_MouseUp(sender As Object, e As MouseEventArgs) Handles Me.MouseUp - If e.Button = Forms.MouseButtons.Right Then Close() - End Sub - - Public Sub SelectBitmap() - ' Does this bitmap contain an alpha channel? - If bBitmap.PixelFormat <> PixelFormat.Format32bppArgb Then - Throw New ApplicationException("The bitmap must be 32bpp with alpha-channel.") - End If - - ' Get device contexts - Dim screenDc As IntPtr = APIHelp.GetDC(IntPtr.Zero) - Dim memDc As IntPtr = APIHelp.CreateCompatibleDC(screenDc) - Dim hBitmap As IntPtr = IntPtr.Zero - Dim hOldBitmap As IntPtr = IntPtr.Zero - - Try - ' Get handle to the new bitmap and select it into the current device context - hBitmap = bBitmap.GetHbitmap(Color.FromArgb(0)) - hOldBitmap = APIHelp.SelectObject(memDc, hBitmap) - - ' Set parameters for layered window update - Dim newSize As New APIHelp.Size(bBitmap.Width, bBitmap.Height) - ' Size window to match bitmap - Dim sourceLocation As New APIHelp.Point(0, 0) - Dim newLocation As New APIHelp.Point(Left, Top) - ' Same as this window - ' Only works with a 32bpp bitmap - ' Always 0 - ' Set to 255 for per-pixel alpha values - Dim blend As New APIHelp.BLENDFUNCTION With { - .BlendOp = APIHelp.AC_SRC_OVER, - .BlendFlags = 0, - .SourceConstantAlpha = 255, - .AlphaFormat = APIHelp.AC_SRC_ALPHA - } - ' Only works when the bitmap contains an alpha channel - ' Update the window - Dim unused4 = APIHelp.UpdateLayeredWindow(Handle, screenDc, newLocation, newSize, memDc, sourceLocation, - 0, blend, APIHelp.ULW_ALPHA) - Finally - ' Release device context - Dim unused3 = APIHelp.ReleaseDC(IntPtr.Zero, screenDc) - If hBitmap <> IntPtr.Zero Then - Dim unused2 = APIHelp.SelectObject(memDc, hOldBitmap) - ' Remove bitmap resources - Dim unused1 = APIHelp.DeleteObject(hBitmap) - End If - Dim unused = APIHelp.DeleteDC(memDc) - End Try - End Sub - - ' Let Windows drag this window for us (thinks its hitting the title bar of the window) - 'Protected Overrides Sub WndProc(ByRef message As Message) - ' If message.Msg = APIHelp.WM_NCHITTEST Then - ' ' Tell Windows that the user is on the title bar (caption) - ' message.Result = CType(APIHelp.HTCAPTION, IntPtr) - ' Else - ' MyBase.WndProc(message) - ' End If - 'End Sub - - Protected Overrides ReadOnly Property CreateParams() As CreateParams - Get - ' Add the layered extended style (WS_EX_LAYERED) to this window - Dim createParams__1 As CreateParams = MyBase.CreateParams - createParams__1.ExStyle = createParams__1.ExStyle Or APIHelp.WS_EX_LAYERED - Return createParams__1 - End Get - End Property - - Private Sub ClickToCopy_Click(sender As Object, e As EventArgs) Handles ClickToCopy.Click - Clipboard.Clear() - Clipboard.SetText("higan314doaz9@qq.com") - Beep() - End Sub - - Private Sub AboutBox1_Load(sender As Object, e As EventArgs) Handles MyBase.Load - SelectBitmap() - End Sub - - Public Sub New() - InitializeComponent() - End Sub + Public Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (hwnd As Integer, wMsg As Integer, wParam As Integer, lParam As Integer) As Integer + Public Declare Function ReleaseCapture Lib "user32.dll" Alias "ReleaseCapture" () As Integer + Private Const WM_SYSCOMMAND As Integer = &H112 + Private Const SC_MOVE As Integer = &HF010 + Private Const WM_NCLBUTTONDOWN As Integer = &HA1 + Private Const HTCAPTION As Integer = 2 + Public bBitmap As Bitmap = My.Resources.SplashScreenx + + Private Sub AboutBox1_KeyPress(sender As Object, e As KeyPressEventArgs) Handles Me.KeyPress + Close() + End Sub + + Private Sub AboutBox1_MouseDown(sender As Object, e As MouseEventArgs) Handles Me.MouseDown + Dim unused1 = ReleaseCapture() + Dim unused = SendMessage(Handle.ToInt32, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0) + End Sub + + Private Sub AboutBox1_MouseUp(sender As Object, e As MouseEventArgs) Handles Me.MouseUp + If e.Button = Forms.MouseButtons.Right Then Close() + End Sub + + Public Sub SelectBitmap() + ' Does this bitmap contain an alpha channel? + If bBitmap.PixelFormat <> PixelFormat.Format32bppArgb Then + Throw New ApplicationException("The bitmap must be 32bpp with alpha-channel.") + End If + + ' Get device contexts + Dim screenDc As IntPtr = APIHelp.GetDC(IntPtr.Zero) + Dim memDc As IntPtr = APIHelp.CreateCompatibleDC(screenDc) + Dim hBitmap As IntPtr = IntPtr.Zero + Dim hOldBitmap As IntPtr = IntPtr.Zero + + Try + ' Get handle to the new bitmap and select it into the current device context + hBitmap = bBitmap.GetHbitmap(Color.FromArgb(0)) + hOldBitmap = APIHelp.SelectObject(memDc, hBitmap) + + ' Set parameters for layered window update + Dim newSize As New APIHelp.Size(bBitmap.Width, bBitmap.Height) + ' Size window to match bitmap + Dim sourceLocation As New APIHelp.Point(0, 0) + Dim newLocation As New APIHelp.Point(Left, Top) + ' Same as this window + ' Only works with a 32bpp bitmap + ' Always 0 + ' Set to 255 for per-pixel alpha values + Dim blend As New APIHelp.BLENDFUNCTION With { + .BlendOp = APIHelp.AC_SRC_OVER, + .BlendFlags = 0, + .SourceConstantAlpha = 255, + .AlphaFormat = APIHelp.AC_SRC_ALPHA + } + ' Only works when the bitmap contains an alpha channel + ' Update the window + Dim unused4 = APIHelp.UpdateLayeredWindow(Handle, screenDc, newLocation, newSize, memDc, sourceLocation, + 0, blend, APIHelp.ULW_ALPHA) + Finally + ' Release device context + Dim unused3 = APIHelp.ReleaseDC(IntPtr.Zero, screenDc) + If hBitmap <> IntPtr.Zero Then + Dim unused2 = APIHelp.SelectObject(memDc, hOldBitmap) + ' Remove bitmap resources + Dim unused1 = APIHelp.DeleteObject(hBitmap) + End If + Dim unused = APIHelp.DeleteDC(memDc) + End Try + End Sub + + ' Let Windows drag this window for us (thinks its hitting the title bar of the window) + 'Protected Overrides Sub WndProc(ByRef message As Message) + ' If message.Msg = APIHelp.WM_NCHITTEST Then + ' ' Tell Windows that the user is on the title bar (caption) + ' message.Result = CType(APIHelp.HTCAPTION, IntPtr) + ' Else + ' MyBase.WndProc(message) + ' End If + 'End Sub + + Protected Overrides ReadOnly Property CreateParams() As CreateParams + Get + ' Add the layered extended style (WS_EX_LAYERED) to this window + Dim createParams__1 As CreateParams = MyBase.CreateParams + createParams__1.ExStyle = createParams__1.ExStyle Or APIHelp.WS_EX_LAYERED + Return createParams__1 + End Get + End Property + + Private Sub ClickToCopy_Click(sender As Object, e As EventArgs) Handles ClickToCopy.Click + Clipboard.Clear() + Clipboard.SetText("higan314doaz9@qq.com") + Beep() + End Sub + + Private Sub AboutBox1_Load(sender As Object, e As EventArgs) Handles MyBase.Load + SelectBitmap() + End Sub + + Public Sub New() + InitializeComponent() + End Sub End Class Friend Class APIHelp - ' Required constants - Public Const WS_EX_LAYERED As Integer = &H80000 - Public Const HTCAPTION As Integer = &H2 - Public Const WM_NCHITTEST As Integer = &H84 - Public Const ULW_ALPHA As Integer = &H2 - Public Const AC_SRC_OVER As Byte = &H0 - Public Const AC_SRC_ALPHA As Byte = &H1 - - Public Enum Bool - [False] = 0 - [True] = 1 - End Enum - - - Public Structure Point - Public x As Integer - Public y As Integer - - Public Sub New(x As Integer, y As Integer) - Me.x = x - Me.y = y - End Sub - End Structure - - - Public Structure Size - Public cx As Integer - Public cy As Integer - - Public Sub New(cx As Integer, cy As Integer) - Me.cx = cx - Me.cy = cy - End Sub - End Structure - - - Private Structure ARGB - Public Blue As Byte - Public Green As Byte - Public Red As Byte - Public Alpha As Byte - End Structure - - - Public Structure BLENDFUNCTION - Public BlendOp As Byte - Public BlendFlags As Byte - Public SourceConstantAlpha As Byte - Public AlphaFormat As Byte - End Structure - - Public Declare Auto Function UpdateLayeredWindow Lib "user32.dll" (hwnd As IntPtr, hdcDst As IntPtr, ByRef pptDst As Point, ByRef psize As Size, hdcSrc As IntPtr, ByRef pprSrc As Point, - crKey As Integer, ByRef pblend As BLENDFUNCTION, dwFlags As Integer) As Bool - - Public Declare Auto Function CreateCompatibleDC Lib "gdi32.dll" (hDC As IntPtr) As IntPtr - - Public Declare Auto Function GetDC Lib "user32.dll" (hWnd As IntPtr) As IntPtr - - - Public Shared Function ReleaseDC(hWnd As IntPtr, hDC As IntPtr) As Integer - End Function - - Public Declare Auto Function DeleteDC Lib "gdi32.dll" (hdc As IntPtr) As Bool - - - Public Shared Function SelectObject(hDC As IntPtr, hObject As IntPtr) As IntPtr - End Function - - Public Declare Auto Function DeleteObject Lib "gdi32.dll" (hObject As IntPtr) As Bool + ' Required constants + Public Const WS_EX_LAYERED As Integer = &H80000 + Public Const HTCAPTION As Integer = &H2 + Public Const WM_NCHITTEST As Integer = &H84 + Public Const ULW_ALPHA As Integer = &H2 + Public Const AC_SRC_OVER As Byte = &H0 + Public Const AC_SRC_ALPHA As Byte = &H1 + + Public Enum Bool + [False] = 0 + [True] = 1 + End Enum + + + Public Structure Point + Public x As Integer + Public y As Integer + + Public Sub New(x As Integer, y As Integer) + Me.x = x + Me.y = y + End Sub + End Structure + + + Public Structure Size + Public cx As Integer + Public cy As Integer + + Public Sub New(cx As Integer, cy As Integer) + Me.cx = cx + Me.cy = cy + End Sub + End Structure + + + Private Structure ARGB + Public Blue As Byte + Public Green As Byte + Public Red As Byte + Public Alpha As Byte + End Structure + + + Public Structure BLENDFUNCTION + Public BlendOp As Byte + Public BlendFlags As Byte + Public SourceConstantAlpha As Byte + Public AlphaFormat As Byte + End Structure + + Public Declare Auto Function UpdateLayeredWindow Lib "user32.dll" (hwnd As IntPtr, hdcDst As IntPtr, ByRef pptDst As Point, ByRef psize As Size, hdcSrc As IntPtr, ByRef pprSrc As Point, + crKey As Integer, ByRef pblend As BLENDFUNCTION, dwFlags As Integer) As Bool + + Public Declare Auto Function CreateCompatibleDC Lib "gdi32.dll" (hDC As IntPtr) As IntPtr + + Public Declare Auto Function GetDC Lib "user32.dll" (hWnd As IntPtr) As IntPtr + + + Public Shared Function ReleaseDC(hWnd As IntPtr, hDC As IntPtr) As Integer + End Function + + Public Declare Auto Function DeleteDC Lib "gdi32.dll" (hdc As IntPtr) As Bool + + + Public Shared Function SelectObject(hDC As IntPtr, hObject As IntPtr) As IntPtr + End Function + + Public Declare Auto Function DeleteObject Lib "gdi32.dll" (hObject As IntPtr) As Bool End Class diff --git a/iBMSC/Dialogs/ColorPicker.vb b/iBMSC/Dialogs/ColorPicker.vb index 0d1096b39..21572370d 100644 --- a/iBMSC/Dialogs/ColorPicker.vb +++ b/iBMSC/Dialogs/ColorPicker.vb @@ -1,618 +1,618 @@ Public Class ColorPicker - Public OrigColor As Color = Color.Black - Public NewColor As Color = Color.Black - Private DrawingIndex As Integer = 1 - Private PassiveValueChange As Boolean = False - - Private mMain As New Point(0, 255) - Private mAlpha As Integer = 255 - Private m1 As Integer = 255 - - Public Sub SetOrigColor(xColor As Color) - OrigColor = xColor - SetNewColor(xColor) - End Sub - - Private Sub OK_Button_Click(sender As Object, e As EventArgs) Handles OK_Button.Click - DialogResult = DialogResult.OK - Close() - End Sub - - Private Sub Cancel_Button_Click(sender As Object, e As EventArgs) Handles Cancel_Button.Click - DialogResult = DialogResult.Cancel - Close() - End Sub - - Private Sub SetNewColor(xColor As Color, Optional xSetText As Boolean = True) - NewColor = xColor - RefreshPrev(pPrev.DisplayRectangle) - If xSetText Then tStr.Text = Mid("0000000" & Hex(xColor.ToArgb), Len(Hex(xColor.ToArgb))) - End Sub - - Private Sub SetCursor() - Select Case DrawingIndex - Case 0 - mMain = New Point(inS.Value / 1000 * 255, (1000 - inL.Value) / 1000 * 255) - m1 = (360 - inH.Value) * 255 / 360 - Case 1 - mMain = New Point(inH.Value * 255 / 360, (1000 - inL.Value) / 1000 * 255) - m1 = (1000 - inS.Value) * 255 / 1000 - Case 2 - mMain = New Point(inH.Value * 255 / 360, (1000 - inS.Value) * 255 / 1000) - m1 = (1000 - inL.Value) * 255 / 1000 - Case 3 - mMain = New Point(inB.Value, 255 - inG.Value) - m1 = 255 - inR.Value - Case 4 - mMain = New Point(inB.Value, 255 - inR.Value) - m1 = 255 - inG.Value - Case 5 - mMain = New Point(inG.Value, 255 - inR.Value) - m1 = 255 - inB.Value - End Select - mAlpha = inA.Value - - End Sub - - ''' Hue (0-359) - ''' Saturation (0-1000) - ''' Lightness (0-1000) - ''' Alpha (0-255) - Private Function HSL2RGB(xH As Integer, xS As Integer, xL As Integer, Optional xA As Integer = 255) As Color - If xH > 360 Or xS > 1000 Or xL > 1000 Or xA > 255 Then Return Color.Black - - 'Dim xxH As Double = xH - Dim xxS As Double = xS / 1000 - Dim xxB As Double = (xL - 500) / 500 - Dim xR As Double - Dim xG As Double - Dim xB As Double - - If xH < 60 Then - xB = -1 : xR = 1 : xG = (xH - 30) / 30 - ElseIf xH < 120 Then - xB = -1 : xG = 1 : xR = (90 - xH) / 30 - ElseIf xH < 180 Then - xR = -1 : xG = 1 : xB = (xH - 150) / 30 - ElseIf xH < 240 Then - xR = -1 : xB = 1 : xG = (210 - xH) / 30 - ElseIf xH < 300 Then - xG = -1 : xB = 1 : xR = (xH - 270) / 30 - Else - xG = -1 : xR = 1 : xB = (330 - xH) / 30 - End If - - xR = ((xR * xxS * (1 - Math.Abs(xxB))) + xxB + 1) * 255 / 2 - xG = ((xG * xxS * (1 - Math.Abs(xxB))) + xxB + 1) * 255 / 2 - xB = ((xB * xxS * (1 - Math.Abs(xxB))) + xxB + 1) * 255 / 2 - - Return Color.FromArgb(xA, xR, xG, xB) - End Function - - Private Sub PCMain_MouseDown(sender As Object, e As MouseEventArgs) Handles PCMain.MouseDown - PCMain_MouseMove(sender, e) - End Sub - - Private Sub PCMain_MouseMove(sender As Object, e As MouseEventArgs) Handles PCMain.MouseMove - If Not e.Button = Forms.MouseButtons.Left Then Exit Sub - mMain = e.Location - If mMain.X < 0 Then mMain.X = 0 - If mMain.X > 255 Then mMain.X = 255 - If mMain.Y < 0 Then mMain.Y = 0 - If mMain.Y > 255 Then mMain.Y = 255 - - Select Case DrawingIndex - Case 0 - inL.Value = 1000 - (mMain.Y / 255 * 1000) - inS.Value = mMain.X / 255 * 1000 - Case 1 - inL.Value = 1000 - (mMain.Y / 255 * 1000) - inH.Value = mMain.X / 255 * 360 - Case 2 - inS.Value = 1000 - (mMain.Y / 255 * 1000) - inH.Value = mMain.X / 255 * 360 - Case 3 - inG.Value = 255 - mMain.Y - inB.Value = mMain.X - Case 4 - inR.Value = 255 - mMain.Y - inB.Value = mMain.X - Case 5 - inR.Value = 255 - mMain.Y - inG.Value = mMain.X - End Select - End Sub - - Private Sub PCMain_Paint(sender As Object, e As PaintEventArgs) Handles PCMain.Paint - RefreshMain(e.ClipRectangle) - End Sub - - Private Sub RefreshMain(xRegion As Rectangle) - Dim e1 As BufferedGraphics = BufferedGraphicsManager.Current.Allocate(PCMain.CreateGraphics, xRegion) - Dim xI1 As Integer - 'Dim xWidth As Integer = PCMain.DisplayRectangle.Width - 'Dim xHeight As Integer = PCMain.DisplayRectangle.Height - Dim xPrecision As Integer = tbPrecision.Value - - Select Case DrawingIndex - Case 0 - Dim xHue As Integer = inH.Value - For xI1 = 0 To 255 Step xPrecision - e1.Graphics.FillRectangle(New Drawing2D.LinearGradientBrush( - New Point(0, 0), - New Point(0, 128), - Color.White, - HSL2RGB(xHue, xI1 / 255 * 1000, 500)), - xI1, - 0, - xPrecision, - 128) - e1.Graphics.FillRectangle(New Drawing2D.LinearGradientBrush( - New Point(0, 128), - New Point(0, 256), - HSL2RGB(xHue, xI1 / 255 * 1000, 500), - Color.Black), - xI1, - 128, - xPrecision, - 128) - Next - Case 1 - Dim xSaturation As Integer = inS.Value - For xI1 = 0 To 255 Step xPrecision - e1.Graphics.FillRectangle(New Drawing2D.LinearGradientBrush( - New Point(0, 0), - New Point(0, 128), - Color.White, - HSL2RGB(xI1 / 255 * 360, xSaturation, 500)), - xI1, - 0, - xPrecision, - 128) - e1.Graphics.FillRectangle(New Drawing2D.LinearGradientBrush( - New Point(0, 128), - New Point(0, 256), - HSL2RGB(xI1 / 255 * 360, xSaturation, 500), - Color.Black), - xI1, - 128, - xPrecision, - 128) - Next - Case 2 - Dim xLightness As Integer = inL.Value - For xI1 = 0 To 255 Step xPrecision - e1.Graphics.FillRectangle(New Drawing2D.LinearGradientBrush( - New Point(0, 0), - New Point(0, 256), - HSL2RGB(xI1 / 255 * 360, 1000, xLightness), - HSL2RGB(xI1 / 255 * 360, 0, xLightness)), - xI1, - 0, - xPrecision, - 256) - Next - Case 3 - Dim xRed As Integer = inR.Value - For xI1 = 0 To 255 Step xPrecision - e1.Graphics.FillRectangle(New Drawing2D.LinearGradientBrush( - New Point(0, 0), - New Point(0, 256), - Color.FromArgb(xRed, 255, xI1), - Color.FromArgb(xRed, 0, xI1)), - xI1, - 0, - xPrecision, - 256) - Next - Case 4 - Dim xGreen As Integer = inG.Value - For xI1 = 0 To 255 Step xPrecision - e1.Graphics.FillRectangle(New Drawing2D.LinearGradientBrush( - New Point(0, 0), - New Point(0, 256), - Color.FromArgb(255, xGreen, xI1), - Color.FromArgb(0, xGreen, xI1)), - xI1, - 0, - xPrecision, - 256) - Next - Case 5 - Dim xBlue As Integer = inB.Value - For xI1 = 0 To 255 Step xPrecision - e1.Graphics.FillRectangle(New Drawing2D.LinearGradientBrush( - New Point(0, 0), - New Point(0, 256), - Color.FromArgb(255, xI1, xBlue), - Color.FromArgb(0, xI1, xBlue)), - xI1, - 0, - xPrecision, - 256) - Next - End Select - - e1.Graphics.SmoothingMode = Drawing2D.SmoothingMode.AntiAlias - Dim unused = e1.Graphics.DrawEllipse(IIf(inL.Value > 500, Pens.Black, Pens.White), mMain.X - 4, mMain.Y - 4, 8, 8) - - e1.Render(PCMain.CreateGraphics) - e1.Dispose() - End Sub - - Private Sub rbH_CheckedChanged(sender As Object, e As EventArgs) Handles rbH.CheckedChanged - If sender.Checked Then DrawingIndex = 0 : SetCursor() : RefreshMain(PCMain.DisplayRectangle) : Refresh1(PC1.DisplayRectangle) : RefreshA(PCA.DisplayRectangle) - End Sub - - Private Sub rbS_CheckedChanged(sender As Object, e As EventArgs) Handles rbS.CheckedChanged - If sender.Checked Then DrawingIndex = 1 : SetCursor() : RefreshMain(PCMain.DisplayRectangle) : Refresh1(PC1.DisplayRectangle) : RefreshA(PCA.DisplayRectangle) - End Sub - - Private Sub rbL_CheckedChanged(sender As Object, e As EventArgs) Handles rbL.CheckedChanged - If sender.Checked Then DrawingIndex = 2 : SetCursor() : RefreshMain(PCMain.DisplayRectangle) : Refresh1(PC1.DisplayRectangle) : RefreshA(PCA.DisplayRectangle) - End Sub - - Private Sub rbR_CheckedChanged(sender As Object, e As EventArgs) Handles rbR.CheckedChanged - If sender.Checked Then DrawingIndex = 3 : SetCursor() : RefreshMain(PCMain.DisplayRectangle) : Refresh1(PC1.DisplayRectangle) : RefreshA(PCA.DisplayRectangle) - End Sub - - Private Sub rbG_CheckedChanged(sender As Object, e As EventArgs) Handles rbG.CheckedChanged - If sender.Checked Then DrawingIndex = 4 : SetCursor() : RefreshMain(PCMain.DisplayRectangle) : Refresh1(PC1.DisplayRectangle) : RefreshA(PCA.DisplayRectangle) - End Sub - - Private Sub rbB_CheckedChanged(sender As Object, e As EventArgs) Handles rbB.CheckedChanged - If sender.Checked Then DrawingIndex = 5 : SetCursor() : RefreshMain(PCMain.DisplayRectangle) : Refresh1(PC1.DisplayRectangle) : RefreshA(PCA.DisplayRectangle) - End Sub - - Private Sub inH_ValueChanged(sender As Object, e As EventArgs) Handles inH.ValueChanged - If inH.Value = 360 Then inH.Value = 0 - - If PassiveValueChange Then Exit Sub - PassiveValueChange = True - SetNewColor(HSL2RGB(inH.Value, inS.Value, inL.Value, inA.Value)) - inR.Value = NewColor.R - inG.Value = NewColor.G - inB.Value = NewColor.B - - RefreshMain(PCMain.DisplayRectangle) - Refresh1(PC1.DisplayRectangle) - RefreshA(PCA.DisplayRectangle) - PassiveValueChange = False - End Sub - - Private Sub inS_ValueChanged(sender As Object, e As EventArgs) Handles inS.ValueChanged - If PassiveValueChange Then Exit Sub - PassiveValueChange = True - SetNewColor(HSL2RGB(inH.Value, inS.Value, inL.Value, inA.Value)) - inR.Value = NewColor.R - inG.Value = NewColor.G - inB.Value = NewColor.B - - RefreshMain(PCMain.DisplayRectangle) - Refresh1(PC1.DisplayRectangle) - RefreshA(PCA.DisplayRectangle) - PassiveValueChange = False - End Sub - - Private Sub inL_ValueChanged(sender As Object, e As EventArgs) Handles inL.ValueChanged - If PassiveValueChange Then Exit Sub - PassiveValueChange = True - SetNewColor(HSL2RGB(inH.Value, inS.Value, inL.Value, inA.Value)) - inR.Value = NewColor.R - inG.Value = NewColor.G - inB.Value = NewColor.B - - RefreshMain(PCMain.DisplayRectangle) - Refresh1(PC1.DisplayRectangle) - RefreshA(PCA.DisplayRectangle) - PassiveValueChange = False - End Sub - - Private Sub inR_ValueChanged(sender As Object, e As EventArgs) Handles inR.ValueChanged - If PassiveValueChange Then Exit Sub - PassiveValueChange = True - SetNewColor(Color.FromArgb(inA.Value, inR.Value, inG.Value, inB.Value)) - inH.Value = NewColor.GetHue - inS.Value = NewColor.GetSaturation * 1000 - inL.Value = NewColor.GetBrightness * 1000 - - RefreshMain(PCMain.DisplayRectangle) - Refresh1(PC1.DisplayRectangle) - RefreshA(PCA.DisplayRectangle) - PassiveValueChange = False - End Sub - - Private Sub inG_ValueChanged(sender As Object, e As EventArgs) Handles inG.ValueChanged - If PassiveValueChange Then Exit Sub - PassiveValueChange = True - SetNewColor(Color.FromArgb(inA.Value, inR.Value, inG.Value, inB.Value)) - inH.Value = NewColor.GetHue - inS.Value = NewColor.GetSaturation * 1000 - inL.Value = NewColor.GetBrightness * 1000 - - RefreshMain(PCMain.DisplayRectangle) - Refresh1(PC1.DisplayRectangle) - RefreshA(PCA.DisplayRectangle) - PassiveValueChange = False - End Sub - - Private Sub inB_ValueChanged(sender As Object, e As EventArgs) Handles inB.ValueChanged - If PassiveValueChange Then Exit Sub - PassiveValueChange = True - SetNewColor(Color.FromArgb(inA.Value, inR.Value, inG.Value, inB.Value)) - inH.Value = NewColor.GetHue - inS.Value = NewColor.GetSaturation * 1000 - inL.Value = NewColor.GetBrightness * 1000 - - RefreshMain(PCMain.DisplayRectangle) - Refresh1(PC1.DisplayRectangle) - RefreshA(PCA.DisplayRectangle) - PassiveValueChange = False - End Sub - - Private Sub inA_ValueChanged(sender As Object, e As EventArgs) Handles inA.ValueChanged - If PassiveValueChange Then Exit Sub - PassiveValueChange = True - SetNewColor(Color.FromArgb(inA.Value, inR.Value, inG.Value, inB.Value)) - - 'RefreshMain(PCMain.DisplayRectangle) - 'Refresh1(PC1.DisplayRectangle) - RefreshA(PCA.DisplayRectangle) - PassiveValueChange = False - End Sub - - Private Sub PC1_MouseDown(sender As Object, e As MouseEventArgs) Handles PC1.MouseDown - PC1_MouseMove(sender, e) - End Sub - - Private Sub PC1_MouseMove(sender As Object, e As MouseEventArgs) Handles PC1.MouseMove - If Not e.Button = Forms.MouseButtons.Left Then Exit Sub - m1 = e.Y - If m1 < 0 Then m1 = 0 - If m1 > 255 Then m1 = 255 - - Select Case DrawingIndex - Case 0 - inH.Value = 360 - (m1 / 255 * 360) - Case 1 - inS.Value = 1000 - (m1 / 255 * 1000) - Case 2 - inL.Value = 1000 - (m1 / 255 * 1000) - Case 3 - inR.Value = 255 - m1 - Case 4 - inG.Value = 255 - m1 - Case 5 - inB.Value = 255 - m1 - End Select - End Sub - - Private Sub PC1_Paint(sender As Object, e As PaintEventArgs) Handles PC1.Paint - Refresh1(e.ClipRectangle) - End Sub - - Private Sub Refresh1(xRegion As Rectangle) - Dim e1 As BufferedGraphics = BufferedGraphicsManager.Current.Allocate(PC1.CreateGraphics, xRegion) - Dim xI1 As Integer - Dim xWidth As Integer = PC1.DisplayRectangle.Width - Dim xPrecision As Integer = tbPrecision.Value - - Select Case DrawingIndex - Case 0 - Dim xxS As Integer = inS.Value - Dim xxL As Integer = inL.Value - For xI1 = 0 To 255 Step xPrecision - e1.Graphics.FillRectangle(New SolidBrush(HSL2RGB((255 - xI1) / 255 * 360, xxS, xxL)), 0, xI1, xWidth, xPrecision) - Next - Case 1 - Dim xxH As Integer = inH.Value - Dim xxL As Integer = inL.Value - e1.Graphics.FillRectangle(New Drawing2D.LinearGradientBrush( - New Point(0, 0), - New Point(0, 256), - HSL2RGB(xxH, 1000, xxL), - HSL2RGB(xxH, 0, xxL)), - 0, 0, xWidth, 256) - Case 2 - Dim xxH As Integer = inH.Value - Dim xxS As Integer = inS.Value - e1.Graphics.FillRectangle(New Drawing2D.LinearGradientBrush( - New Point(0, 0), - New Point(0, 128), - HSL2RGB(xxH, xxS, 1000), - HSL2RGB(xxH, xxS, 500)), - 0, 0, xWidth, 128) - e1.Graphics.FillRectangle(New Drawing2D.LinearGradientBrush( - New Point(0, 128), - New Point(0, 256), - HSL2RGB(xxH, xxS, 500), - HSL2RGB(xxH, xxS, 0)), - 0, 128, xWidth, 128) - Case 3 - Dim xxG As Integer = inG.Value - Dim xxB As Integer = inB.Value - e1.Graphics.FillRectangle(New Drawing2D.LinearGradientBrush( - New Point(0, 0), - New Point(0, 256), - Color.FromArgb(255, xxG, xxB), - Color.FromArgb(0, xxG, xxB)), - 0, 0, xWidth, 256) - Case 4 - Dim xxR As Integer = inR.Value - Dim xxB As Integer = inB.Value - e1.Graphics.FillRectangle(New Drawing2D.LinearGradientBrush( - New Point(0, 0), - New Point(0, 256), - Color.FromArgb(xxR, 255, xxB), - Color.FromArgb(xxR, 0, xxB)), - 0, 0, xWidth, 256) - Case 5 - Dim xxR As Integer = inR.Value - Dim xxG As Integer = inG.Value - e1.Graphics.FillRectangle(New Drawing2D.LinearGradientBrush( - New Point(0, 0), - New Point(0, 256), - Color.FromArgb(xxR, xxG, 255), - Color.FromArgb(xxR, xxG, 0)), - 0, 0, xWidth, 256) - End Select - - Dim xTri1() As Point = {New Point(4, m1), New Point(-1, m1 - 2), New Point(-1, m1 + 2)} - Dim xTri2() As Point = {New Point(xWidth - 5, m1), New Point(xWidth, m1 - 2), New Point(xWidth, m1 + 2)} - - e1.Graphics.SmoothingMode = Drawing2D.SmoothingMode.AntiAlias - e1.Graphics.FillPolygon(IIf(inL.Value > 500, Brushes.Black, Brushes.White), xTri1) - e1.Graphics.FillPolygon(IIf(inL.Value > 500, Brushes.Black, Brushes.White), xTri2) - - e1.Render(PC1.CreateGraphics) - e1.Dispose() - End Sub - - Private Sub PCA_MouseDown(sender As Object, e As MouseEventArgs) Handles PCA.MouseDown - PCA_MouseMove(sender, e) - End Sub - - Private Sub PCA_MouseMove(sender As Object, e As MouseEventArgs) Handles PCA.MouseMove - If Not e.Button = Forms.MouseButtons.Left Then Exit Sub - mAlpha = e.X - If mAlpha < 0 Then mAlpha = 0 - If mAlpha > 255 Then mAlpha = 255 - - inA.Value = mAlpha - End Sub - - Private Sub PCA_Paint(sender As Object, e As PaintEventArgs) Handles PCA.Paint - RefreshA(e.ClipRectangle) - End Sub - - Private Sub RefreshA(xRegion As Rectangle) - Dim e1 As BufferedGraphics = BufferedGraphicsManager.Current.Allocate(PCA.CreateGraphics, xRegion) - Dim xI1 As Integer - Dim xHeight As Integer = PCA.DisplayRectangle.Height - Dim xPrecision As Integer = tbPrecision.Value - Dim xColor As Color = Color.FromArgb(inR.Value, inG.Value, inB.Value) - 'Dim xAlphaRect(314) As Rectangle - - 'e1.Graphics.FillRectangle(Brushes.White, PCA.DisplayRectangle) - 'For xI1 = 0 To 62 - ' xAlphaRect(xI1 * 5) = New Rectangle(xI1 * 8, 0, 4, 4) - ' xAlphaRect(xI1 * 5 + 1) = New Rectangle(xI1 * 8 + 4, 4, 4, 4) - ' xAlphaRect(xI1 * 5 + 2) = New Rectangle(xI1 * 8, 8, 4, 4) - ' xAlphaRect(xI1 * 5 + 3) = New Rectangle(xI1 * 8 + 4, 12, 4, 4) - ' xAlphaRect(xI1 * 5 + 4) = New Rectangle(xI1 * 8, 16, 4, 4) - 'Next - 'e1.Graphics.FillRectangles(New Drawing.SolidBrush(Color.FromArgb(235, 235, 235)), xAlphaRect) - e1.Graphics.DrawImageUnscaledAndClipped(My.Resources.TransparentBG, xRegion) - - For xI1 = 0 To 255 Step xPrecision - e1.Graphics.FillRectangle(New SolidBrush(Color.FromArgb(xI1, xColor)), xI1, 0, xPrecision, xHeight) - Next - - Dim xTri1() As Point = {New Point(mAlpha, 4), New Point(mAlpha - 2, -1), New Point(mAlpha + 2, -1)} - Dim xTri2() As Point = {New Point(mAlpha, xHeight - 5), New Point(mAlpha - 2, xHeight), New Point(mAlpha + 2, xHeight)} - xI1 = inL.Value + ((255 - inA.Value) * 1000 / 255) - - e1.Graphics.SmoothingMode = Drawing2D.SmoothingMode.AntiAlias - e1.Graphics.FillPolygon(IIf(xI1 > 500, Brushes.Black, Brushes.White), xTri1) - e1.Graphics.FillPolygon(IIf(xI1 > 500, Brushes.Black, Brushes.White), xTri2) - - e1.Render(PCA.CreateGraphics) - e1.Dispose() - End Sub - - Private Sub tbPrecision_ValueChanged(sender As Object, e As EventArgs) Handles tbPrecision.ValueChanged - RefreshMain(PCMain.DisplayRectangle) - Refresh1(PC1.DisplayRectangle) - RefreshA(PCA.DisplayRectangle) - End Sub - - Private Sub pPrev_Paint(sender As Object, e As PaintEventArgs) Handles pPrev.Paint - RefreshPrev(e.ClipRectangle) - End Sub - - Private Sub RefreshPrev(xRegion As Rectangle) - Dim e1 As BufferedGraphics = BufferedGraphicsManager.Current.Allocate(pPrev.CreateGraphics, xRegion) - Dim xFont As Font = pPrev.Font - e1.Graphics.DrawImageUnscaledAndClipped(My.Resources.TransparentBG, xRegion) - - If xRegion.X < 62 Then - e1.Graphics.FillRectangle(New SolidBrush(OrigColor), 0, 0, 61, 28) - e1.Graphics.DrawLine(New Pen(Color.FromKnownColor(KnownColor.WindowFrame)), 61, 0, 61, 28) - Dim unused1 = e1.Graphics.DrawString("Orig", xFont, IIf(OrigColor.GetBrightness + ((255 - OrigColor.A) / 255) > 0.5, Brushes.Black, Brushes.White), - 31 - (e1.Graphics.MeasureString("Orig", xFont).Width / 2), - 14 - (e1.Graphics.MeasureString("Orig", xFont).Height / 2)) - End If - - e1.Graphics.FillRectangle(New SolidBrush(NewColor), 62, 0, 61, 28) - Dim unused = e1.Graphics.DrawString("New", xFont, IIf(NewColor.GetBrightness + ((255 - NewColor.A) / 255) > 0.5, Brushes.Black, Brushes.White), - 93 - (e1.Graphics.MeasureString("New", xFont).Width / 2), - 14 - (e1.Graphics.MeasureString("New", xFont).Height / 2)) - - e1.Render(pPrev.CreateGraphics) - e1.Dispose() - End Sub - - Private Sub tStr_GotFocus(sender As Object, e As EventArgs) Handles tStr.GotFocus - tStr.SelectAll() - End Sub - - Private Sub tStr_LostFocus(sender As Object, e As EventArgs) Handles tStr.LostFocus - Dim xI1 As Integer - - Try - xI1 = Convert.ToInt32(tStr.Text, 16) - SetNewColor(Color.FromArgb(xI1)) - - PassiveValueChange = True - inR.Value = NewColor.R - inG.Value = NewColor.G - inB.Value = NewColor.B - inH.Value = NewColor.GetHue - inS.Value = NewColor.GetSaturation * 1000 - inL.Value = NewColor.GetBrightness * 1000 - inA.Value = NewColor.A - SetCursor() - - RefreshMain(PCMain.DisplayRectangle) - Refresh1(PC1.DisplayRectangle) - RefreshA(PCA.DisplayRectangle) - PassiveValueChange = False - - Catch ex As Exception - Dim unused = MsgBox(ex.Message, MsgBoxStyle.Critical, "Error") - Finally - tStr.Text = Mid("0000000" & Hex(NewColor.ToArgb), Len(Hex(NewColor.ToArgb))) - End Try - - End Sub - - Private Sub tStr_TextChanged(sender As Object, e As EventArgs) Handles tStr.TextChanged - If PassiveValueChange Then Exit Sub - Dim xI1 As Integer - - Try - xI1 = Convert.ToInt32(tStr.Text, 16) - SetNewColor(Color.FromArgb(xI1), False) - - PassiveValueChange = True - inR.Value = NewColor.R - inG.Value = NewColor.G - inB.Value = NewColor.B - inH.Value = NewColor.GetHue - inS.Value = NewColor.GetSaturation * 1000 - inL.Value = NewColor.GetBrightness * 1000 - inA.Value = NewColor.A - SetCursor() - - RefreshMain(PCMain.DisplayRectangle) - Refresh1(PC1.DisplayRectangle) - RefreshA(PCA.DisplayRectangle) - PassiveValueChange = False - Catch ex As Exception - End Try - End Sub - - Private Sub ColorPicker_Load(sender As Object, e As EventArgs) Handles MyBase.Load - Font = MainWindow.Font - End Sub + Public OrigColor As Color = Color.Black + Public NewColor As Color = Color.Black + Private DrawingIndex As Integer = 1 + Private PassiveValueChange As Boolean = False + + Private mMain As New Point(0, 255) + Private mAlpha As Integer = 255 + Private m1 As Integer = 255 + + Public Sub SetOrigColor(xColor As Color) + OrigColor = xColor + SetNewColor(xColor) + End Sub + + Private Sub OK_Button_Click(sender As Object, e As EventArgs) Handles OK_Button.Click + DialogResult = DialogResult.OK + Close() + End Sub + + Private Sub Cancel_Button_Click(sender As Object, e As EventArgs) Handles Cancel_Button.Click + DialogResult = DialogResult.Cancel + Close() + End Sub + + Private Sub SetNewColor(xColor As Color, Optional xSetText As Boolean = True) + NewColor = xColor + RefreshPrev(pPrev.DisplayRectangle) + If xSetText Then tStr.Text = Mid("0000000" & Hex(xColor.ToArgb), Len(Hex(xColor.ToArgb))) + End Sub + + Private Sub SetCursor() + Select Case DrawingIndex + Case 0 + mMain = New Point(inS.Value / 1000 * 255, (1000 - inL.Value) / 1000 * 255) + m1 = (360 - inH.Value) * 255 / 360 + Case 1 + mMain = New Point(inH.Value * 255 / 360, (1000 - inL.Value) / 1000 * 255) + m1 = (1000 - inS.Value) * 255 / 1000 + Case 2 + mMain = New Point(inH.Value * 255 / 360, (1000 - inS.Value) * 255 / 1000) + m1 = (1000 - inL.Value) * 255 / 1000 + Case 3 + mMain = New Point(inB.Value, 255 - inG.Value) + m1 = 255 - inR.Value + Case 4 + mMain = New Point(inB.Value, 255 - inR.Value) + m1 = 255 - inG.Value + Case 5 + mMain = New Point(inG.Value, 255 - inR.Value) + m1 = 255 - inB.Value + End Select + mAlpha = inA.Value + + End Sub + + ''' Hue (0-359) + ''' Saturation (0-1000) + ''' Lightness (0-1000) + ''' Alpha (0-255) + Private Function HSL2RGB(xH As Integer, xS As Integer, xL As Integer, Optional xA As Integer = 255) As Color + If xH > 360 Or xS > 1000 Or xL > 1000 Or xA > 255 Then Return Color.Black + + 'Dim xxH As Double = xH + Dim xxS As Double = xS / 1000 + Dim xxB As Double = (xL - 500) / 500 + Dim xR As Double + Dim xG As Double + Dim xB As Double + + If xH < 60 Then + xB = -1 : xR = 1 : xG = (xH - 30) / 30 + ElseIf xH < 120 Then + xB = -1 : xG = 1 : xR = (90 - xH) / 30 + ElseIf xH < 180 Then + xR = -1 : xG = 1 : xB = (xH - 150) / 30 + ElseIf xH < 240 Then + xR = -1 : xB = 1 : xG = (210 - xH) / 30 + ElseIf xH < 300 Then + xG = -1 : xB = 1 : xR = (xH - 270) / 30 + Else + xG = -1 : xR = 1 : xB = (330 - xH) / 30 + End If + + xR = ((xR * xxS * (1 - Math.Abs(xxB))) + xxB + 1) * 255 / 2 + xG = ((xG * xxS * (1 - Math.Abs(xxB))) + xxB + 1) * 255 / 2 + xB = ((xB * xxS * (1 - Math.Abs(xxB))) + xxB + 1) * 255 / 2 + + Return Color.FromArgb(xA, xR, xG, xB) + End Function + + Private Sub PCMain_MouseDown(sender As Object, e As MouseEventArgs) Handles PCMain.MouseDown + PCMain_MouseMove(sender, e) + End Sub + + Private Sub PCMain_MouseMove(sender As Object, e As MouseEventArgs) Handles PCMain.MouseMove + If Not e.Button = Forms.MouseButtons.Left Then Exit Sub + mMain = e.Location + If mMain.X < 0 Then mMain.X = 0 + If mMain.X > 255 Then mMain.X = 255 + If mMain.Y < 0 Then mMain.Y = 0 + If mMain.Y > 255 Then mMain.Y = 255 + + Select Case DrawingIndex + Case 0 + inL.Value = 1000 - (mMain.Y / 255 * 1000) + inS.Value = mMain.X / 255 * 1000 + Case 1 + inL.Value = 1000 - (mMain.Y / 255 * 1000) + inH.Value = mMain.X / 255 * 360 + Case 2 + inS.Value = 1000 - (mMain.Y / 255 * 1000) + inH.Value = mMain.X / 255 * 360 + Case 3 + inG.Value = 255 - mMain.Y + inB.Value = mMain.X + Case 4 + inR.Value = 255 - mMain.Y + inB.Value = mMain.X + Case 5 + inR.Value = 255 - mMain.Y + inG.Value = mMain.X + End Select + End Sub + + Private Sub PCMain_Paint(sender As Object, e As PaintEventArgs) Handles PCMain.Paint + RefreshMain(e.ClipRectangle) + End Sub + + Private Sub RefreshMain(xRegion As Rectangle) + Dim e1 As BufferedGraphics = BufferedGraphicsManager.Current.Allocate(PCMain.CreateGraphics, xRegion) + Dim xI1 As Integer + 'Dim xWidth As Integer = PCMain.DisplayRectangle.Width + 'Dim xHeight As Integer = PCMain.DisplayRectangle.Height + Dim xPrecision As Integer = tbPrecision.Value + + Select Case DrawingIndex + Case 0 + Dim xHue As Integer = inH.Value + For xI1 = 0 To 255 Step xPrecision + e1.Graphics.FillRectangle(New Drawing2D.LinearGradientBrush( + New Point(0, 0), + New Point(0, 128), + Color.White, + HSL2RGB(xHue, xI1 / 255 * 1000, 500)), + xI1, + 0, + xPrecision, + 128) + e1.Graphics.FillRectangle(New Drawing2D.LinearGradientBrush( + New Point(0, 128), + New Point(0, 256), + HSL2RGB(xHue, xI1 / 255 * 1000, 500), + Color.Black), + xI1, + 128, + xPrecision, + 128) + Next + Case 1 + Dim xSaturation As Integer = inS.Value + For xI1 = 0 To 255 Step xPrecision + e1.Graphics.FillRectangle(New Drawing2D.LinearGradientBrush( + New Point(0, 0), + New Point(0, 128), + Color.White, + HSL2RGB(xI1 / 255 * 360, xSaturation, 500)), + xI1, + 0, + xPrecision, + 128) + e1.Graphics.FillRectangle(New Drawing2D.LinearGradientBrush( + New Point(0, 128), + New Point(0, 256), + HSL2RGB(xI1 / 255 * 360, xSaturation, 500), + Color.Black), + xI1, + 128, + xPrecision, + 128) + Next + Case 2 + Dim xLightness As Integer = inL.Value + For xI1 = 0 To 255 Step xPrecision + e1.Graphics.FillRectangle(New Drawing2D.LinearGradientBrush( + New Point(0, 0), + New Point(0, 256), + HSL2RGB(xI1 / 255 * 360, 1000, xLightness), + HSL2RGB(xI1 / 255 * 360, 0, xLightness)), + xI1, + 0, + xPrecision, + 256) + Next + Case 3 + Dim xRed As Integer = inR.Value + For xI1 = 0 To 255 Step xPrecision + e1.Graphics.FillRectangle(New Drawing2D.LinearGradientBrush( + New Point(0, 0), + New Point(0, 256), + Color.FromArgb(xRed, 255, xI1), + Color.FromArgb(xRed, 0, xI1)), + xI1, + 0, + xPrecision, + 256) + Next + Case 4 + Dim xGreen As Integer = inG.Value + For xI1 = 0 To 255 Step xPrecision + e1.Graphics.FillRectangle(New Drawing2D.LinearGradientBrush( + New Point(0, 0), + New Point(0, 256), + Color.FromArgb(255, xGreen, xI1), + Color.FromArgb(0, xGreen, xI1)), + xI1, + 0, + xPrecision, + 256) + Next + Case 5 + Dim xBlue As Integer = inB.Value + For xI1 = 0 To 255 Step xPrecision + e1.Graphics.FillRectangle(New Drawing2D.LinearGradientBrush( + New Point(0, 0), + New Point(0, 256), + Color.FromArgb(255, xI1, xBlue), + Color.FromArgb(0, xI1, xBlue)), + xI1, + 0, + xPrecision, + 256) + Next + End Select + + e1.Graphics.SmoothingMode = Drawing2D.SmoothingMode.AntiAlias + Dim unused = e1.Graphics.DrawEllipse(IIf(inL.Value > 500, Pens.Black, Pens.White), mMain.X - 4, mMain.Y - 4, 8, 8) + + e1.Render(PCMain.CreateGraphics) + e1.Dispose() + End Sub + + Private Sub rbH_CheckedChanged(sender As Object, e As EventArgs) Handles rbH.CheckedChanged + If sender.Checked Then DrawingIndex = 0 : SetCursor() : RefreshMain(PCMain.DisplayRectangle) : Refresh1(PC1.DisplayRectangle) : RefreshA(PCA.DisplayRectangle) + End Sub + + Private Sub rbS_CheckedChanged(sender As Object, e As EventArgs) Handles rbS.CheckedChanged + If sender.Checked Then DrawingIndex = 1 : SetCursor() : RefreshMain(PCMain.DisplayRectangle) : Refresh1(PC1.DisplayRectangle) : RefreshA(PCA.DisplayRectangle) + End Sub + + Private Sub rbL_CheckedChanged(sender As Object, e As EventArgs) Handles rbL.CheckedChanged + If sender.Checked Then DrawingIndex = 2 : SetCursor() : RefreshMain(PCMain.DisplayRectangle) : Refresh1(PC1.DisplayRectangle) : RefreshA(PCA.DisplayRectangle) + End Sub + + Private Sub rbR_CheckedChanged(sender As Object, e As EventArgs) Handles rbR.CheckedChanged + If sender.Checked Then DrawingIndex = 3 : SetCursor() : RefreshMain(PCMain.DisplayRectangle) : Refresh1(PC1.DisplayRectangle) : RefreshA(PCA.DisplayRectangle) + End Sub + + Private Sub rbG_CheckedChanged(sender As Object, e As EventArgs) Handles rbG.CheckedChanged + If sender.Checked Then DrawingIndex = 4 : SetCursor() : RefreshMain(PCMain.DisplayRectangle) : Refresh1(PC1.DisplayRectangle) : RefreshA(PCA.DisplayRectangle) + End Sub + + Private Sub rbB_CheckedChanged(sender As Object, e As EventArgs) Handles rbB.CheckedChanged + If sender.Checked Then DrawingIndex = 5 : SetCursor() : RefreshMain(PCMain.DisplayRectangle) : Refresh1(PC1.DisplayRectangle) : RefreshA(PCA.DisplayRectangle) + End Sub + + Private Sub inH_ValueChanged(sender As Object, e As EventArgs) Handles inH.ValueChanged + If inH.Value = 360 Then inH.Value = 0 + + If PassiveValueChange Then Exit Sub + PassiveValueChange = True + SetNewColor(HSL2RGB(inH.Value, inS.Value, inL.Value, inA.Value)) + inR.Value = NewColor.R + inG.Value = NewColor.G + inB.Value = NewColor.B + + RefreshMain(PCMain.DisplayRectangle) + Refresh1(PC1.DisplayRectangle) + RefreshA(PCA.DisplayRectangle) + PassiveValueChange = False + End Sub + + Private Sub inS_ValueChanged(sender As Object, e As EventArgs) Handles inS.ValueChanged + If PassiveValueChange Then Exit Sub + PassiveValueChange = True + SetNewColor(HSL2RGB(inH.Value, inS.Value, inL.Value, inA.Value)) + inR.Value = NewColor.R + inG.Value = NewColor.G + inB.Value = NewColor.B + + RefreshMain(PCMain.DisplayRectangle) + Refresh1(PC1.DisplayRectangle) + RefreshA(PCA.DisplayRectangle) + PassiveValueChange = False + End Sub + + Private Sub inL_ValueChanged(sender As Object, e As EventArgs) Handles inL.ValueChanged + If PassiveValueChange Then Exit Sub + PassiveValueChange = True + SetNewColor(HSL2RGB(inH.Value, inS.Value, inL.Value, inA.Value)) + inR.Value = NewColor.R + inG.Value = NewColor.G + inB.Value = NewColor.B + + RefreshMain(PCMain.DisplayRectangle) + Refresh1(PC1.DisplayRectangle) + RefreshA(PCA.DisplayRectangle) + PassiveValueChange = False + End Sub + + Private Sub inR_ValueChanged(sender As Object, e As EventArgs) Handles inR.ValueChanged + If PassiveValueChange Then Exit Sub + PassiveValueChange = True + SetNewColor(Color.FromArgb(inA.Value, inR.Value, inG.Value, inB.Value)) + inH.Value = NewColor.GetHue + inS.Value = NewColor.GetSaturation * 1000 + inL.Value = NewColor.GetBrightness * 1000 + + RefreshMain(PCMain.DisplayRectangle) + Refresh1(PC1.DisplayRectangle) + RefreshA(PCA.DisplayRectangle) + PassiveValueChange = False + End Sub + + Private Sub inG_ValueChanged(sender As Object, e As EventArgs) Handles inG.ValueChanged + If PassiveValueChange Then Exit Sub + PassiveValueChange = True + SetNewColor(Color.FromArgb(inA.Value, inR.Value, inG.Value, inB.Value)) + inH.Value = NewColor.GetHue + inS.Value = NewColor.GetSaturation * 1000 + inL.Value = NewColor.GetBrightness * 1000 + + RefreshMain(PCMain.DisplayRectangle) + Refresh1(PC1.DisplayRectangle) + RefreshA(PCA.DisplayRectangle) + PassiveValueChange = False + End Sub + + Private Sub inB_ValueChanged(sender As Object, e As EventArgs) Handles inB.ValueChanged + If PassiveValueChange Then Exit Sub + PassiveValueChange = True + SetNewColor(Color.FromArgb(inA.Value, inR.Value, inG.Value, inB.Value)) + inH.Value = NewColor.GetHue + inS.Value = NewColor.GetSaturation * 1000 + inL.Value = NewColor.GetBrightness * 1000 + + RefreshMain(PCMain.DisplayRectangle) + Refresh1(PC1.DisplayRectangle) + RefreshA(PCA.DisplayRectangle) + PassiveValueChange = False + End Sub + + Private Sub inA_ValueChanged(sender As Object, e As EventArgs) Handles inA.ValueChanged + If PassiveValueChange Then Exit Sub + PassiveValueChange = True + SetNewColor(Color.FromArgb(inA.Value, inR.Value, inG.Value, inB.Value)) + + 'RefreshMain(PCMain.DisplayRectangle) + 'Refresh1(PC1.DisplayRectangle) + RefreshA(PCA.DisplayRectangle) + PassiveValueChange = False + End Sub + + Private Sub PC1_MouseDown(sender As Object, e As MouseEventArgs) Handles PC1.MouseDown + PC1_MouseMove(sender, e) + End Sub + + Private Sub PC1_MouseMove(sender As Object, e As MouseEventArgs) Handles PC1.MouseMove + If Not e.Button = Forms.MouseButtons.Left Then Exit Sub + m1 = e.Y + If m1 < 0 Then m1 = 0 + If m1 > 255 Then m1 = 255 + + Select Case DrawingIndex + Case 0 + inH.Value = 360 - (m1 / 255 * 360) + Case 1 + inS.Value = 1000 - (m1 / 255 * 1000) + Case 2 + inL.Value = 1000 - (m1 / 255 * 1000) + Case 3 + inR.Value = 255 - m1 + Case 4 + inG.Value = 255 - m1 + Case 5 + inB.Value = 255 - m1 + End Select + End Sub + + Private Sub PC1_Paint(sender As Object, e As PaintEventArgs) Handles PC1.Paint + Refresh1(e.ClipRectangle) + End Sub + + Private Sub Refresh1(xRegion As Rectangle) + Dim e1 As BufferedGraphics = BufferedGraphicsManager.Current.Allocate(PC1.CreateGraphics, xRegion) + Dim xI1 As Integer + Dim xWidth As Integer = PC1.DisplayRectangle.Width + Dim xPrecision As Integer = tbPrecision.Value + + Select Case DrawingIndex + Case 0 + Dim xxS As Integer = inS.Value + Dim xxL As Integer = inL.Value + For xI1 = 0 To 255 Step xPrecision + e1.Graphics.FillRectangle(New SolidBrush(HSL2RGB((255 - xI1) / 255 * 360, xxS, xxL)), 0, xI1, xWidth, xPrecision) + Next + Case 1 + Dim xxH As Integer = inH.Value + Dim xxL As Integer = inL.Value + e1.Graphics.FillRectangle(New Drawing2D.LinearGradientBrush( + New Point(0, 0), + New Point(0, 256), + HSL2RGB(xxH, 1000, xxL), + HSL2RGB(xxH, 0, xxL)), + 0, 0, xWidth, 256) + Case 2 + Dim xxH As Integer = inH.Value + Dim xxS As Integer = inS.Value + e1.Graphics.FillRectangle(New Drawing2D.LinearGradientBrush( + New Point(0, 0), + New Point(0, 128), + HSL2RGB(xxH, xxS, 1000), + HSL2RGB(xxH, xxS, 500)), + 0, 0, xWidth, 128) + e1.Graphics.FillRectangle(New Drawing2D.LinearGradientBrush( + New Point(0, 128), + New Point(0, 256), + HSL2RGB(xxH, xxS, 500), + HSL2RGB(xxH, xxS, 0)), + 0, 128, xWidth, 128) + Case 3 + Dim xxG As Integer = inG.Value + Dim xxB As Integer = inB.Value + e1.Graphics.FillRectangle(New Drawing2D.LinearGradientBrush( + New Point(0, 0), + New Point(0, 256), + Color.FromArgb(255, xxG, xxB), + Color.FromArgb(0, xxG, xxB)), + 0, 0, xWidth, 256) + Case 4 + Dim xxR As Integer = inR.Value + Dim xxB As Integer = inB.Value + e1.Graphics.FillRectangle(New Drawing2D.LinearGradientBrush( + New Point(0, 0), + New Point(0, 256), + Color.FromArgb(xxR, 255, xxB), + Color.FromArgb(xxR, 0, xxB)), + 0, 0, xWidth, 256) + Case 5 + Dim xxR As Integer = inR.Value + Dim xxG As Integer = inG.Value + e1.Graphics.FillRectangle(New Drawing2D.LinearGradientBrush( + New Point(0, 0), + New Point(0, 256), + Color.FromArgb(xxR, xxG, 255), + Color.FromArgb(xxR, xxG, 0)), + 0, 0, xWidth, 256) + End Select + + Dim xTri1() As Point = {New Point(4, m1), New Point(-1, m1 - 2), New Point(-1, m1 + 2)} + Dim xTri2() As Point = {New Point(xWidth - 5, m1), New Point(xWidth, m1 - 2), New Point(xWidth, m1 + 2)} + + e1.Graphics.SmoothingMode = Drawing2D.SmoothingMode.AntiAlias + e1.Graphics.FillPolygon(IIf(inL.Value > 500, Brushes.Black, Brushes.White), xTri1) + e1.Graphics.FillPolygon(IIf(inL.Value > 500, Brushes.Black, Brushes.White), xTri2) + + e1.Render(PC1.CreateGraphics) + e1.Dispose() + End Sub + + Private Sub PCA_MouseDown(sender As Object, e As MouseEventArgs) Handles PCA.MouseDown + PCA_MouseMove(sender, e) + End Sub + + Private Sub PCA_MouseMove(sender As Object, e As MouseEventArgs) Handles PCA.MouseMove + If Not e.Button = Forms.MouseButtons.Left Then Exit Sub + mAlpha = e.X + If mAlpha < 0 Then mAlpha = 0 + If mAlpha > 255 Then mAlpha = 255 + + inA.Value = mAlpha + End Sub + + Private Sub PCA_Paint(sender As Object, e As PaintEventArgs) Handles PCA.Paint + RefreshA(e.ClipRectangle) + End Sub + + Private Sub RefreshA(xRegion As Rectangle) + Dim e1 As BufferedGraphics = BufferedGraphicsManager.Current.Allocate(PCA.CreateGraphics, xRegion) + Dim xI1 As Integer + Dim xHeight As Integer = PCA.DisplayRectangle.Height + Dim xPrecision As Integer = tbPrecision.Value + Dim xColor As Color = Color.FromArgb(inR.Value, inG.Value, inB.Value) + 'Dim xAlphaRect(314) As Rectangle + + 'e1.Graphics.FillRectangle(Brushes.White, PCA.DisplayRectangle) + 'For xI1 = 0 To 62 + ' xAlphaRect(xI1 * 5) = New Rectangle(xI1 * 8, 0, 4, 4) + ' xAlphaRect(xI1 * 5 + 1) = New Rectangle(xI1 * 8 + 4, 4, 4, 4) + ' xAlphaRect(xI1 * 5 + 2) = New Rectangle(xI1 * 8, 8, 4, 4) + ' xAlphaRect(xI1 * 5 + 3) = New Rectangle(xI1 * 8 + 4, 12, 4, 4) + ' xAlphaRect(xI1 * 5 + 4) = New Rectangle(xI1 * 8, 16, 4, 4) + 'Next + 'e1.Graphics.FillRectangles(New Drawing.SolidBrush(Color.FromArgb(235, 235, 235)), xAlphaRect) + e1.Graphics.DrawImageUnscaledAndClipped(My.Resources.TransparentBG, xRegion) + + For xI1 = 0 To 255 Step xPrecision + e1.Graphics.FillRectangle(New SolidBrush(Color.FromArgb(xI1, xColor)), xI1, 0, xPrecision, xHeight) + Next + + Dim xTri1() As Point = {New Point(mAlpha, 4), New Point(mAlpha - 2, -1), New Point(mAlpha + 2, -1)} + Dim xTri2() As Point = {New Point(mAlpha, xHeight - 5), New Point(mAlpha - 2, xHeight), New Point(mAlpha + 2, xHeight)} + xI1 = inL.Value + ((255 - inA.Value) * 1000 / 255) + + e1.Graphics.SmoothingMode = Drawing2D.SmoothingMode.AntiAlias + e1.Graphics.FillPolygon(IIf(xI1 > 500, Brushes.Black, Brushes.White), xTri1) + e1.Graphics.FillPolygon(IIf(xI1 > 500, Brushes.Black, Brushes.White), xTri2) + + e1.Render(PCA.CreateGraphics) + e1.Dispose() + End Sub + + Private Sub tbPrecision_ValueChanged(sender As Object, e As EventArgs) Handles tbPrecision.ValueChanged + RefreshMain(PCMain.DisplayRectangle) + Refresh1(PC1.DisplayRectangle) + RefreshA(PCA.DisplayRectangle) + End Sub + + Private Sub pPrev_Paint(sender As Object, e As PaintEventArgs) Handles pPrev.Paint + RefreshPrev(e.ClipRectangle) + End Sub + + Private Sub RefreshPrev(xRegion As Rectangle) + Dim e1 As BufferedGraphics = BufferedGraphicsManager.Current.Allocate(pPrev.CreateGraphics, xRegion) + Dim xFont As Font = pPrev.Font + e1.Graphics.DrawImageUnscaledAndClipped(My.Resources.TransparentBG, xRegion) + + If xRegion.X < 62 Then + e1.Graphics.FillRectangle(New SolidBrush(OrigColor), 0, 0, 61, 28) + e1.Graphics.DrawLine(New Pen(Color.FromKnownColor(KnownColor.WindowFrame)), 61, 0, 61, 28) + Dim unused1 = e1.Graphics.DrawString("Orig", xFont, IIf(OrigColor.GetBrightness + ((255 - OrigColor.A) / 255) > 0.5, Brushes.Black, Brushes.White), + 31 - (e1.Graphics.MeasureString("Orig", xFont).Width / 2), + 14 - (e1.Graphics.MeasureString("Orig", xFont).Height / 2)) + End If + + e1.Graphics.FillRectangle(New SolidBrush(NewColor), 62, 0, 61, 28) + Dim unused = e1.Graphics.DrawString("New", xFont, IIf(NewColor.GetBrightness + ((255 - NewColor.A) / 255) > 0.5, Brushes.Black, Brushes.White), + 93 - (e1.Graphics.MeasureString("New", xFont).Width / 2), + 14 - (e1.Graphics.MeasureString("New", xFont).Height / 2)) + + e1.Render(pPrev.CreateGraphics) + e1.Dispose() + End Sub + + Private Sub tStr_GotFocus(sender As Object, e As EventArgs) Handles tStr.GotFocus + tStr.SelectAll() + End Sub + + Private Sub tStr_LostFocus(sender As Object, e As EventArgs) Handles tStr.LostFocus + Dim xI1 As Integer + + Try + xI1 = Convert.ToInt32(tStr.Text, 16) + SetNewColor(Color.FromArgb(xI1)) + + PassiveValueChange = True + inR.Value = NewColor.R + inG.Value = NewColor.G + inB.Value = NewColor.B + inH.Value = NewColor.GetHue + inS.Value = NewColor.GetSaturation * 1000 + inL.Value = NewColor.GetBrightness * 1000 + inA.Value = NewColor.A + SetCursor() + + RefreshMain(PCMain.DisplayRectangle) + Refresh1(PC1.DisplayRectangle) + RefreshA(PCA.DisplayRectangle) + PassiveValueChange = False + + Catch ex As Exception + Dim unused = MsgBox(ex.Message, MsgBoxStyle.Critical, "Error") + Finally + tStr.Text = Mid("0000000" & Hex(NewColor.ToArgb), Len(Hex(NewColor.ToArgb))) + End Try + + End Sub + + Private Sub tStr_TextChanged(sender As Object, e As EventArgs) Handles tStr.TextChanged + If PassiveValueChange Then Exit Sub + Dim xI1 As Integer + + Try + xI1 = Convert.ToInt32(tStr.Text, 16) + SetNewColor(Color.FromArgb(xI1), False) + + PassiveValueChange = True + inR.Value = NewColor.R + inG.Value = NewColor.G + inB.Value = NewColor.B + inH.Value = NewColor.GetHue + inS.Value = NewColor.GetSaturation * 1000 + inL.Value = NewColor.GetBrightness * 1000 + inA.Value = NewColor.A + SetCursor() + + RefreshMain(PCMain.DisplayRectangle) + Refresh1(PC1.DisplayRectangle) + RefreshA(PCA.DisplayRectangle) + PassiveValueChange = False + Catch ex As Exception + End Try + End Sub + + Private Sub ColorPicker_Load(sender As Object, e As EventArgs) Handles MyBase.Load + Font = MainWindow.Font + End Sub End Class diff --git a/iBMSC/Dialogs/SplashScreen1.vb b/iBMSC/Dialogs/SplashScreen1.vb index 0a23e4544..bbb0c5a6e 100644 --- a/iBMSC/Dialogs/SplashScreen1.vb +++ b/iBMSC/Dialogs/SplashScreen1.vb @@ -1,16 +1,16 @@ Public NotInheritable Class SplashScreen1 - Protected Overrides Sub OnPaint(e As PaintEventArgs) - MyBase.OnPaint(e) - End Sub + Protected Overrides Sub OnPaint(e As PaintEventArgs) + MyBase.OnPaint(e) + End Sub - Protected Overrides Sub OnPaintBackground(e As PaintEventArgs) - SetStyle(ControlStyles.SupportsTransparentBackColor, True) - BackColor = Color.Transparent - Show() - MyBase.OnPaintBackground(e) - Dim rect As New Rectangle(0, 0, Width, Height) - End Sub + Protected Overrides Sub OnPaintBackground(e As PaintEventArgs) + SetStyle(ControlStyles.SupportsTransparentBackColor, True) + BackColor = Color.Transparent + Show() + MyBase.OnPaintBackground(e) + Dim rect As New Rectangle(0, 0, Width, Height) + End Sub End Class diff --git a/iBMSC/Dialogs/dgImportSM.vb b/iBMSC/Dialogs/dgImportSM.vb index c8cb622a9..c3b9466ef 100644 --- a/iBMSC/Dialogs/dgImportSM.vb +++ b/iBMSC/Dialogs/dgImportSM.vb @@ -1,34 +1,34 @@ Public Class dgImportSM - Public iResult As Integer = -1 + Public iResult As Integer = -1 - Public Sub New(sDiff() As String) - InitializeComponent() + Public Sub New(sDiff() As String) + InitializeComponent() - LDiff.Items.AddRange(sDiff) - LDiff.SelectedIndex = 0 - End Sub + LDiff.Items.AddRange(sDiff) + LDiff.SelectedIndex = 0 + End Sub - Private Sub OK_Button_Click(sender As Object, e As EventArgs) Handles OK_Button.Click - DialogResult = DialogResult.OK - iResult = LDiff.SelectedIndex - Close() - End Sub + Private Sub OK_Button_Click(sender As Object, e As EventArgs) Handles OK_Button.Click + DialogResult = DialogResult.OK + iResult = LDiff.SelectedIndex + Close() + End Sub - Private Sub Cancel_Button_Click(sender As Object, e As EventArgs) Handles Cancel_Button.Click - DialogResult = DialogResult.Cancel - Close() - End Sub + Private Sub Cancel_Button_Click(sender As Object, e As EventArgs) Handles Cancel_Button.Click + DialogResult = DialogResult.Cancel + Close() + End Sub - Private Sub dgImportSM_Load(sender As Object, e As EventArgs) Handles MyBase.Load - 'Dim xS() As String = Form1.lpimpSM + Private Sub dgImportSM_Load(sender As Object, e As EventArgs) Handles MyBase.Load + 'Dim xS() As String = Form1.lpimpSM - Font = MainWindow.Font + Font = MainWindow.Font - Text = Strings.fImportSM.Title - Label7.Text = Strings.fImportSM.Difficulty - Label5.Text = Strings.fImportSM.Note - OK_Button.Text = Strings.OK - Cancel_Button.Text = Strings.Cancel - End Sub + Text = Strings.fImportSM.Title + Label7.Text = Strings.fImportSM.Difficulty + Label5.Text = Strings.fImportSM.Note + OK_Button.Text = Strings.OK + Cancel_Button.Text = Strings.Cancel + End Sub End Class diff --git a/iBMSC/Dialogs/dgMyO2.vb b/iBMSC/Dialogs/dgMyO2.vb index 9ee1c0b32..72beecf81 100644 --- a/iBMSC/Dialogs/dgMyO2.vb +++ b/iBMSC/Dialogs/dgMyO2.vb @@ -1,75 +1,75 @@ Public Class dgMyO2 - Public Structure Adj - Public Measure As Integer - Public ColumnIndex As Integer - Public ColumnName As String - Public Grid As String - Public LongNote As Boolean - Public Hidden As Boolean - Public AdjTo64 As Boolean - Public D64 As Integer - Public D48 As Integer - End Structure + Public Structure Adj + Public Measure As Integer + Public ColumnIndex As Integer + Public ColumnName As String + Public Grid As String + Public LongNote As Boolean + Public Hidden As Boolean + Public AdjTo64 As Boolean + Public D64 As Integer + Public D48 As Integer + End Structure - Private Aj(-1) As Adj + Private Aj(-1) As Adj - Private Sub fMyO2_Load(sender As Object, e As EventArgs) Handles MyBase.Load - Font = MainWindow.Font - vBPM.Value = MainWindow.THBPM.Value - End Sub + Private Sub fMyO2_Load(sender As Object, e As EventArgs) Handles MyBase.Load + Font = MainWindow.Font + vBPM.Value = MainWindow.THBPM.Value + End Sub - Private Sub AddAdjItem(xAj As Adj, Index As Integer) - Dim unused = lResult.Rows.Add() - Dim xRow As Integer = lResult.Rows.Count - 1 - lResult.Item(0, xRow).Value = Index - lResult.Item(1, xRow).Value = xAj.Measure - lResult.Item(2, xRow).Value = xAj.ColumnName - lResult.Item(3, xRow).Value = xAj.Grid - lResult.Item(4, xRow).Value = xAj.LongNote - lResult.Item(5, xRow).Value = xAj.Hidden - lResult.Item(6, xRow).Value = xAj.AdjTo64 - lResult.Item(7, xRow).Value = xAj.D64 - lResult.Item(8, xRow).Value = xAj.D48 - End Sub + Private Sub AddAdjItem(xAj As Adj, Index As Integer) + Dim unused = lResult.Rows.Add() + Dim xRow As Integer = lResult.Rows.Count - 1 + lResult.Item(0, xRow).Value = Index + lResult.Item(1, xRow).Value = xAj.Measure + lResult.Item(2, xRow).Value = xAj.ColumnName + lResult.Item(3, xRow).Value = xAj.Grid + lResult.Item(4, xRow).Value = xAj.LongNote + lResult.Item(5, xRow).Value = xAj.Hidden + lResult.Item(6, xRow).Value = xAj.AdjTo64 + lResult.Item(7, xRow).Value = xAj.D64 + lResult.Item(8, xRow).Value = xAj.D48 + End Sub - Private Sub bApply1_Click(sender As Object, e As EventArgs) Handles bApply1.Click - MainWindow.MyO2ConstBPM(vBPM.Value * 10000) - End Sub + Private Sub bApply1_Click(sender As Object, e As EventArgs) Handles bApply1.Click + MainWindow.MyO2ConstBPM(vBPM.Value * 10000) + End Sub - Private Sub bApply2_Click(sender As Object, e As EventArgs) Handles bApply2.Click - Dim xStrItem() As String = MainWindow.MyO2GridCheck() - ReDim Aj(UBound(xStrItem)) + Private Sub bApply2_Click(sender As Object, e As EventArgs) Handles bApply2.Click + Dim xStrItem() As String = MainWindow.MyO2GridCheck() + ReDim Aj(UBound(xStrItem)) - lResult.Rows.Clear() - For xI1 As Integer = 0 To UBound(Aj) - Dim xW() As String = Split(xStrItem(xI1), "_") - With Aj(xI1) - .Measure = Val(xW(0)) - .ColumnIndex = Val(xW(1)) - .ColumnName = xW(2) - .Grid = xW(3) - .LongNote = Val(xW(4)) - .Hidden = Val(xW(5)) - .AdjTo64 = Val(xW(6)) - .D64 = Val(xW(7)) - .D48 = Val(xW(8)) - End With + lResult.Rows.Clear() + For xI1 As Integer = 0 To UBound(Aj) + Dim xW() As String = Split(xStrItem(xI1), "_") + With Aj(xI1) + .Measure = Val(xW(0)) + .ColumnIndex = Val(xW(1)) + .ColumnName = xW(2) + .Grid = xW(3) + .LongNote = Val(xW(4)) + .Hidden = Val(xW(5)) + .AdjTo64 = Val(xW(6)) + .D64 = Val(xW(7)) + .D48 = Val(xW(8)) + End With - AddAdjItem(Aj(xI1), xI1) - Next - End Sub + AddAdjItem(Aj(xI1), xI1) + Next + End Sub - Private Sub bApply3_Click(sender As Object, e As EventArgs) Handles bApply3.Click - MainWindow.MyO2GridAdjust(Aj) - End Sub + Private Sub bApply3_Click(sender As Object, e As EventArgs) Handles bApply3.Click + MainWindow.MyO2GridAdjust(Aj) + End Sub - Public Sub New() - InitializeComponent() - End Sub + Public Sub New() + InitializeComponent() + End Sub - Private Sub lResult_CellEndEdit(sender As Object, e As DataGridViewCellEventArgs) Handles lResult.CellEndEdit - If e.ColumnIndex <> 6 Then Return - If e.RowIndex < 0 Then Return - Aj(Val(lResult.Item(0, e.RowIndex).Value)).AdjTo64 = lResult.Item(6, e.RowIndex).Value - End Sub + Private Sub lResult_CellEndEdit(sender As Object, e As DataGridViewCellEventArgs) Handles lResult.CellEndEdit + If e.ColumnIndex <> 6 Then Return + If e.RowIndex < 0 Then Return + Aj(Val(lResult.Item(0, e.RowIndex).Value)).AdjTo64 = lResult.Item(6, e.RowIndex).Value + End Sub End Class diff --git a/iBMSC/Dialogs/dgStatistics.vb b/iBMSC/Dialogs/dgStatistics.vb index 636eb9687..8f738f6b0 100644 --- a/iBMSC/Dialogs/dgStatistics.vb +++ b/iBMSC/Dialogs/dgStatistics.vb @@ -1,50 +1,50 @@ Public Class dgStatistics - Private Sub OK_Button_Click(sender As Object, e As EventArgs) Handles OK_Button.Click - DialogResult = DialogResult.OK - Close() - End Sub + Private Sub OK_Button_Click(sender As Object, e As EventArgs) Handles OK_Button.Click + DialogResult = DialogResult.OK + Close() + End Sub - Private Sub Cancel_Button_Click(sender As Object, e As EventArgs) - DialogResult = DialogResult.Cancel - Close() - End Sub + Private Sub Cancel_Button_Click(sender As Object, e As EventArgs) + DialogResult = DialogResult.Cancel + Close() + End Sub - Private Sub dgStatistics_Load(sender As Object, e As EventArgs) Handles MyBase.Load - Font = MainWindow.Font + Private Sub dgStatistics_Load(sender As Object, e As EventArgs) Handles MyBase.Load + Font = MainWindow.Font - Text = Strings.fStatistics.Title - Label6.Text = Strings.fStatistics.lBPM - Label7.Text = Strings.fStatistics.lSTOP - Label8.Text = Strings.fStatistics.lSCROLL - Label9.Text = Strings.fStatistics.lA - Label10.Text = Strings.fStatistics.lD - Label11.Text = Strings.fStatistics.lBGM - Label1.Text = Strings.fStatistics.lTotal - Label12.Text = Strings.fStatistics.lShort - Label13.Text = Strings.fStatistics.lLong - Label14.Text = Strings.fStatistics.lHidden - Label15.Text = Strings.fStatistics.lLandMine - Label16.Text = Strings.fStatistics.lErrors - Label2.Text = Strings.fStatistics.lTotal - OK_Button.Text = Strings.OK - End Sub + Text = Strings.fStatistics.Title + Label6.Text = Strings.fStatistics.lBPM + Label7.Text = Strings.fStatistics.lSTOP + Label8.Text = Strings.fStatistics.lSCROLL + Label9.Text = Strings.fStatistics.lA + Label10.Text = Strings.fStatistics.lD + Label11.Text = Strings.fStatistics.lBGM + Label1.Text = Strings.fStatistics.lTotal + Label12.Text = Strings.fStatistics.lShort + Label13.Text = Strings.fStatistics.lLong + Label14.Text = Strings.fStatistics.lHidden + Label15.Text = Strings.fStatistics.lLandMine + Label16.Text = Strings.fStatistics.lErrors + Label2.Text = Strings.fStatistics.lTotal + OK_Button.Text = Strings.OK + End Sub - Public Sub New(data(,) As Integer) - InitializeComponent() + Public Sub New(data(,) As Integer) + InitializeComponent() - For row As Integer = 0 To 6 - For col As Integer = 0 To 5 - Dim xLabel As New Label With { - .Dock = DockStyle.Fill, - .TextAlign = ContentAlignment.MiddleCenter, - .Margin = New Padding(0), - .Font = New Font(Font, FontStyle.Bold) - } - If data(row, col) <> 0 Then xLabel.Text = data(row, col) - If row Mod 2 = 0 Then xLabel.BackColor = Color.FromArgb(&H10000000) - TableLayoutPanel1.Controls.Add(xLabel, col + 1, row + 1) - Next - Next - End Sub + For row As Integer = 0 To 6 + For col As Integer = 0 To 5 + Dim xLabel As New Label With { + .Dock = DockStyle.Fill, + .TextAlign = ContentAlignment.MiddleCenter, + .Margin = New Padding(0), + .Font = New Font(Font, FontStyle.Bold) + } + If data(row, col) <> 0 Then xLabel.Text = data(row, col) + If row Mod 2 = 0 Then xLabel.BackColor = Color.FromArgb(&H10000000) + TableLayoutPanel1.Controls.Add(xLabel, col + 1, row + 1) + Next + Next + End Sub End Class diff --git a/iBMSC/Dialogs/diagFind.vb b/iBMSC/Dialogs/diagFind.vb index 78a20b110..55c29b8a0 100644 --- a/iBMSC/Dialogs/diagFind.vb +++ b/iBMSC/Dialogs/diagFind.vb @@ -1,320 +1,320 @@ Public Class diagFind - Private bCol As Integer = 83 - Private msg1 As String = "Error" - Private msg2 As String = "Invalid label." - - Public Sub New(xbCol As Integer, xmsg1 As String, xmsg2 As String) - InitializeComponent() - bCol = xbCol - msg1 = xmsg1 - msg2 = xmsg2 - End Sub - - Private Sub CloseDialog(sender As Object, e As EventArgs) Handles TBClose.Click - Close() - End Sub - - Private Sub BSAll_Click(sender As Object, e As EventArgs) Handles BSAll.Click - For Each xCB As CheckBox In Panel1.Controls - xCB.Checked = True - Next - End Sub - Private Sub BSInv_Click(sender As Object, e As EventArgs) Handles BSInv.Click - For Each xCB As CheckBox In Panel1.Controls - xCB.Checked = Not xCB.Checked - Next - End Sub - Private Sub BSNone_Click(sender As Object, e As EventArgs) Handles BSNone.Click - For Each xCB As CheckBox In Panel1.Controls - xCB.Checked = False - Next - End Sub - - Private Sub diagFind_Load(sender As Object, e As EventArgs) Handles MyBase.Load - Font = MainWindow.Font - Dim xBold As New Font(Font, FontStyle.Bold) - - TBSelect.Font = xBold - Label8.Font = xBold - Label9.Font = xBold - - 'Dim xS() As String = Form1.lpfdr - Text = MainWindow.TBFind.Text - - Label1.Text = Strings.fFind.NoteRange - Label2.Text = Strings.fFind.MeasureRange - Label3.Text = Strings.fFind.LabelRange - Label4.Text = Strings.fFind.ValueRange - Label5.Text = Strings.fFind.to_ - Label6.Text = Strings.fFind.to_ - Label7.Text = Strings.fFind.to_ - - cbx1.Text = Strings.fFind.Selected - cbx2.Text = Strings.fFind.UnSelected - cbx3.Text = Strings.fFind.ShortNote - cbx4.Text = Strings.fFind.LongNote - cbx5.Text = Strings.fFind.Hidden - cbx6.Text = Strings.fFind.Visible - - Label8.Text = Strings.fFind.Column - BSAll.Text = Strings.fFind.SelectAll - BSInv.Text = Strings.fFind.SelectInverse - BSNone.Text = Strings.fFind.UnselectAll - - Label9.Text = Strings.fFind.Operation - TBrl.Text = Strings.fFind.ReplaceWithLabel - TBrv.Text = Strings.fFind.ReplaceWithValue - TBSelect.Text = Strings.fFind.Select_ - TBUnselect.Text = Strings.fFind.Unselect_ - TBDelete.Text = Strings.fFind.Delete_ - TBClose.Text = Strings.fFind.Close_ - - Panel1.Controls.Add(cb1) - Panel1.Controls.Add(cb2) - Panel1.Controls.Add(cb3) - - Dim xColumn = 1 - Dim xLow = 0 - For xI1 As Integer = 0 To 25 - Dim xCB As New CheckBox - If MainWindow.column(MainWindow.niA1 + xI1).isVisible Then - With xCB - .Appearance = Appearance.Button - .Checked = True - .FlatStyle = FlatStyle.System - .Location = New Point(((xLow Mod 8) * 35) + 3, (xColumn * 25) + 2) - .Size = New Size(35, 25) - .Tag = MainWindow.niA1 + xI1 - .Text = MainWindow.column(MainWindow.niA1 + xI1).Title - .TextAlign = ContentAlignment.MiddleCenter - .UseVisualStyleBackColor = True - End With - xLow += 1 - If xLow Mod 8 = 0 Then xColumn += 1 - Panel1.Controls.Add(xCB) - End If - Next - If xLow Mod 8 <> 0 Then xColumn += 1 - - xLow = 0 - For xI1 As Integer = 0 To 25 - Dim xCB As New CheckBox - If MainWindow.column(MainWindow.niD1 + xI1).isVisible Then - With xCB - .Appearance = Appearance.Button - .Checked = True - .FlatStyle = FlatStyle.System - .Location = New Point(((xLow Mod 8) * 35) + 3, (xColumn * 25) + 2) - .Size = New Size(35, 25) - .Tag = MainWindow.niD1 + xI1 - .Text = MainWindow.column(MainWindow.niD1 + xI1).Title - .TextAlign = ContentAlignment.MiddleCenter - .UseVisualStyleBackColor = True - End With - xLow += 1 - If xLow Mod 8 = 0 Then xColumn += 1 - Panel1.Controls.Add(xCB) - End If - Next - If xLow Mod 8 <> 0 Then xColumn += 1 - xLow = 0 - - Panel1.Controls.Add(cb4) - cb4.Location = New Point((0 * 55) + 3, (xColumn * 25) + 2) - Panel1.Controls.Add(cb5) - cb5.Location = New Point((1 * 55) + 3, (xColumn * 25) + 2) - Panel1.Controls.Add(cb6) - cb6.Location = New Point((2 * 55) + 3, (xColumn * 25) + 2) - - xColumn += 1 - For xI1 As Integer = 63 To bCol - Dim xCB As New CheckBox - With xCB - .Appearance = Appearance.Button - .Checked = True - .FlatStyle = FlatStyle.System - .Location = New Point(((xLow Mod 8) * 35) + 3, (xColumn * 25) + 2) - .Size = New Size(35, 25) - .Tag = xI1 - .Text = "B" & (xI1 - 62).ToString - .TextAlign = ContentAlignment.MiddleCenter - .UseVisualStyleBackColor = True - End With - xLow += 1 - If xLow Mod 8 = 0 Then xColumn += 1 - Panel1.Controls.Add(xCB) - Next - - AddHandler lr1.KeyDown, AddressOf lblKeyDown - AddHandler lr2.KeyDown, AddressOf lblKeyDown - AddHandler Ttl.KeyDown, AddressOf lblKeyDown - End Sub - - Private Function ValidLabel(xStr As String) As Boolean - xStr = UCase(Trim(xStr)) - - If Len(xStr) = 0 Then Return False - If xStr = "00" Or xStr = "0" Then Return False - If Not Len(xStr) = 1 And Not Len(xStr) = 2 Then Return False - - Dim xI3 As Integer = Asc(Mid(xStr, 1, 1)) - If Not ((xI3 >= 48 And xI3 <= 57) Or (xI3 >= 65 And xI3 <= 90)) Then Return False - If Len(xStr) = 2 Then - Dim xI4 As Integer = Asc(Mid(xStr, 2, 1)) - If Not ((xI4 >= 48 And xI4 <= 57) Or (xI4 >= 65 And xI4 <= 90)) Then Return False - End If - Return True - Dim unused = MsgBox(msg2, MsgBoxStyle.Critical, msg1) - End Function - - Private Sub lblKeyDown(sender As Object, e As KeyEventArgs) - If Not e.KeyCode = Keys.Enter Then Exit Sub - Dim unused = ValidateLabel(sender) - End Sub - - Private Function ValidateLabel(sender As Object) As Boolean - Dim xBool As Boolean = ValidLabel(sender.Text) - If Not xBool Then - Dim unused2 = MsgBox(msg2, MsgBoxStyle.Critical, msg1) - Dim unused1 = sender.Focus() - Dim unused = sender.SelectAll() - End If - ValidateLabel = xBool - End Function - - Private Sub TBSelect_Click(sender As Object, e As EventArgs) Handles TBSelect.Click - If Not ValidateLabel(lr1) Then Exit Sub - If Not ValidateLabel(lr2) Then Exit Sub - - Dim xCol() As Integer = {} - For Each xCB As CheckBox In Panel1.Controls - If xCB.Checked Then - ReDim Preserve xCol(UBound(xCol) + 1) - xCol(UBound(xCol)) = xCB.Tag - End If - Next - - Dim xRange As Integer = 1 - If cbx1.Checked Then xRange *= 2 - If cbx2.Checked Then xRange *= 3 - If cbx3.Checked Then xRange *= 5 - If cbx4.Checked Then xRange *= 7 - If cbx5.Checked Then xRange *= 11 - If cbx6.Checked Then xRange *= 13 - - MainWindow.fdrSelect(xRange, _ - mr1.Value, mr2.Value, _ - lr1.Text, lr2.Text, _ - vr1.Value * 10000, vr2.Value * 10000, _ - xCol) - End Sub - - Private Sub TBUnselect_Click(sender As Object, e As EventArgs) Handles TBUnselect.Click - If Not ValidateLabel(lr1) Then Exit Sub - If Not ValidateLabel(lr2) Then Exit Sub - - Dim xCol() As Integer = {} - For Each xCB As CheckBox In Panel1.Controls - If xCB.Checked Then - ReDim Preserve xCol(UBound(xCol) + 1) - xCol(UBound(xCol)) = xCB.Tag - End If - Next - - Dim xRange As Integer = 1 - If cbx1.Checked Then xRange *= 2 - If cbx2.Checked Then xRange *= 3 - If cbx3.Checked Then xRange *= 5 - If cbx4.Checked Then xRange *= 7 - If cbx5.Checked Then xRange *= 11 - If cbx6.Checked Then xRange *= 13 - - MainWindow.fdrUnselect(xRange, _ - mr1.Value, mr2.Value, _ - lr1.Text, lr2.Text, _ - vr1.Value * 10000, vr2.Value * 10000, _ - xCol) - End Sub - - Private Sub TBDelete_Click(sender As Object, e As EventArgs) Handles TBDelete.Click - If Not ValidateLabel(lr1) Then Exit Sub - If Not ValidateLabel(lr2) Then Exit Sub - - Dim xCol() As Integer = {} - For Each xCB As CheckBox In Panel1.Controls - If xCB.Checked Then - ReDim Preserve xCol(UBound(xCol) + 1) - xCol(UBound(xCol)) = xCB.Tag - End If - Next - - Dim xRange As Integer = 1 - If cbx1.Checked Then xRange *= 2 - If cbx2.Checked Then xRange *= 3 - If cbx3.Checked Then xRange *= 5 - If cbx4.Checked Then xRange *= 7 - If cbx5.Checked Then xRange *= 11 - If cbx6.Checked Then xRange *= 13 - - MainWindow.fdrDelete(xRange, _ - mr1.Value, mr2.Value, _ - lr1.Text, lr2.Text, _ - vr1.Value * 10000, vr2.Value * 10000, _ - xCol) - End Sub - - Private Sub TBrl_Click(sender As Object, e As EventArgs) Handles TBrl.Click - If Not ValidateLabel(lr1) Then Exit Sub - If Not ValidateLabel(lr2) Then Exit Sub - If Not ValidateLabel(Ttl) Then Exit Sub - - Dim xCol() As Integer = {} - For Each xCB As CheckBox In Panel1.Controls - If xCB.Checked Then - ReDim Preserve xCol(UBound(xCol) + 1) - xCol(UBound(xCol)) = xCB.Tag - End If - Next - - Dim xRange As Integer = 1 - If cbx1.Checked Then xRange *= 2 - If cbx2.Checked Then xRange *= 3 - If cbx3.Checked Then xRange *= 5 - If cbx4.Checked Then xRange *= 7 - If cbx5.Checked Then xRange *= 11 - If cbx6.Checked Then xRange *= 13 - - MainWindow.fdrReplaceL(xRange, _ - mr1.Value, mr2.Value, _ - lr1.Text, lr2.Text, _ - vr1.Value * 10000, vr2.Value * 10000, _ - xCol, Ttl.Text) - End Sub - - Private Sub TBrv_Click(sender As Object, e As EventArgs) Handles TBrv.Click - If Not ValidateLabel(lr1) Then Exit Sub - If Not ValidateLabel(lr2) Then Exit Sub - - Dim xCol() As Integer = {} - For Each xCB As CheckBox In Panel1.Controls - If xCB.Checked Then - ReDim Preserve xCol(UBound(xCol) + 1) - xCol(UBound(xCol)) = xCB.Tag - End If - Next - - Dim xRange As Integer = 1 - If cbx1.Checked Then xRange *= 2 - If cbx2.Checked Then xRange *= 3 - If cbx3.Checked Then xRange *= 5 - If cbx4.Checked Then xRange *= 7 - If cbx5.Checked Then xRange *= 11 - If cbx6.Checked Then xRange *= 13 - - MainWindow.fdrReplaceV(xRange, _ - mr1.Value, mr2.Value, _ - lr1.Text, lr2.Text, _ - vr1.Value * 10000, vr2.Value * 10000, _ - xCol, Ttv.Value * 10000) - End Sub + Private bCol As Integer = 83 + Private msg1 As String = "Error" + Private msg2 As String = "Invalid label." + + Public Sub New(xbCol As Integer, xmsg1 As String, xmsg2 As String) + InitializeComponent() + bCol = xbCol + msg1 = xmsg1 + msg2 = xmsg2 + End Sub + + Private Sub CloseDialog(sender As Object, e As EventArgs) Handles TBClose.Click + Close() + End Sub + + Private Sub BSAll_Click(sender As Object, e As EventArgs) Handles BSAll.Click + For Each xCB As CheckBox In Panel1.Controls + xCB.Checked = True + Next + End Sub + Private Sub BSInv_Click(sender As Object, e As EventArgs) Handles BSInv.Click + For Each xCB As CheckBox In Panel1.Controls + xCB.Checked = Not xCB.Checked + Next + End Sub + Private Sub BSNone_Click(sender As Object, e As EventArgs) Handles BSNone.Click + For Each xCB As CheckBox In Panel1.Controls + xCB.Checked = False + Next + End Sub + + Private Sub diagFind_Load(sender As Object, e As EventArgs) Handles MyBase.Load + Font = MainWindow.Font + Dim xBold As New Font(Font, FontStyle.Bold) + + TBSelect.Font = xBold + Label8.Font = xBold + Label9.Font = xBold + + 'Dim xS() As String = Form1.lpfdr + Text = MainWindow.TBFind.Text + + Label1.Text = Strings.fFind.NoteRange + Label2.Text = Strings.fFind.MeasureRange + Label3.Text = Strings.fFind.LabelRange + Label4.Text = Strings.fFind.ValueRange + Label5.Text = Strings.fFind.to_ + Label6.Text = Strings.fFind.to_ + Label7.Text = Strings.fFind.to_ + + cbx1.Text = Strings.fFind.Selected + cbx2.Text = Strings.fFind.UnSelected + cbx3.Text = Strings.fFind.ShortNote + cbx4.Text = Strings.fFind.LongNote + cbx5.Text = Strings.fFind.Hidden + cbx6.Text = Strings.fFind.Visible + + Label8.Text = Strings.fFind.Column + BSAll.Text = Strings.fFind.SelectAll + BSInv.Text = Strings.fFind.SelectInverse + BSNone.Text = Strings.fFind.UnselectAll + + Label9.Text = Strings.fFind.Operation + TBrl.Text = Strings.fFind.ReplaceWithLabel + TBrv.Text = Strings.fFind.ReplaceWithValue + TBSelect.Text = Strings.fFind.Select_ + TBUnselect.Text = Strings.fFind.Unselect_ + TBDelete.Text = Strings.fFind.Delete_ + TBClose.Text = Strings.fFind.Close_ + + Panel1.Controls.Add(cb1) + Panel1.Controls.Add(cb2) + Panel1.Controls.Add(cb3) + + Dim xColumn = 1 + Dim xLow = 0 + For xI1 As Integer = 0 To 25 + Dim xCB As New CheckBox + If MainWindow.column(MainWindow.niA1 + xI1).isVisible Then + With xCB + .Appearance = Appearance.Button + .Checked = True + .FlatStyle = FlatStyle.System + .Location = New Point(((xLow Mod 8) * 35) + 3, (xColumn * 25) + 2) + .Size = New Size(35, 25) + .Tag = MainWindow.niA1 + xI1 + .Text = MainWindow.column(MainWindow.niA1 + xI1).Title + .TextAlign = ContentAlignment.MiddleCenter + .UseVisualStyleBackColor = True + End With + xLow += 1 + If xLow Mod 8 = 0 Then xColumn += 1 + Panel1.Controls.Add(xCB) + End If + Next + If xLow Mod 8 <> 0 Then xColumn += 1 + + xLow = 0 + For xI1 As Integer = 0 To 25 + Dim xCB As New CheckBox + If MainWindow.column(MainWindow.niD1 + xI1).isVisible Then + With xCB + .Appearance = Appearance.Button + .Checked = True + .FlatStyle = FlatStyle.System + .Location = New Point(((xLow Mod 8) * 35) + 3, (xColumn * 25) + 2) + .Size = New Size(35, 25) + .Tag = MainWindow.niD1 + xI1 + .Text = MainWindow.column(MainWindow.niD1 + xI1).Title + .TextAlign = ContentAlignment.MiddleCenter + .UseVisualStyleBackColor = True + End With + xLow += 1 + If xLow Mod 8 = 0 Then xColumn += 1 + Panel1.Controls.Add(xCB) + End If + Next + If xLow Mod 8 <> 0 Then xColumn += 1 + xLow = 0 + + Panel1.Controls.Add(cb4) + cb4.Location = New Point((0 * 55) + 3, (xColumn * 25) + 2) + Panel1.Controls.Add(cb5) + cb5.Location = New Point((1 * 55) + 3, (xColumn * 25) + 2) + Panel1.Controls.Add(cb6) + cb6.Location = New Point((2 * 55) + 3, (xColumn * 25) + 2) + + xColumn += 1 + For xI1 As Integer = 63 To bCol + Dim xCB As New CheckBox + With xCB + .Appearance = Appearance.Button + .Checked = True + .FlatStyle = FlatStyle.System + .Location = New Point(((xLow Mod 8) * 35) + 3, (xColumn * 25) + 2) + .Size = New Size(35, 25) + .Tag = xI1 + .Text = "B" & (xI1 - 62).ToString + .TextAlign = ContentAlignment.MiddleCenter + .UseVisualStyleBackColor = True + End With + xLow += 1 + If xLow Mod 8 = 0 Then xColumn += 1 + Panel1.Controls.Add(xCB) + Next + + AddHandler lr1.KeyDown, AddressOf lblKeyDown + AddHandler lr2.KeyDown, AddressOf lblKeyDown + AddHandler Ttl.KeyDown, AddressOf lblKeyDown + End Sub + + Private Function ValidLabel(xStr As String) As Boolean + xStr = UCase(Trim(xStr)) + + If Len(xStr) = 0 Then Return False + If xStr = "00" Or xStr = "0" Then Return False + If Not Len(xStr) = 1 And Not Len(xStr) = 2 Then Return False + + Dim xI3 As Integer = Asc(Mid(xStr, 1, 1)) + If Not ((xI3 >= 48 And xI3 <= 57) Or (xI3 >= 65 And xI3 <= 90)) Then Return False + If Len(xStr) = 2 Then + Dim xI4 As Integer = Asc(Mid(xStr, 2, 1)) + If Not ((xI4 >= 48 And xI4 <= 57) Or (xI4 >= 65 And xI4 <= 90)) Then Return False + End If + Return True + Dim unused = MsgBox(msg2, MsgBoxStyle.Critical, msg1) + End Function + + Private Sub lblKeyDown(sender As Object, e As KeyEventArgs) + If Not e.KeyCode = Keys.Enter Then Exit Sub + Dim unused = ValidateLabel(sender) + End Sub + + Private Function ValidateLabel(sender As Object) As Boolean + Dim xBool As Boolean = ValidLabel(sender.Text) + If Not xBool Then + Dim unused2 = MsgBox(msg2, MsgBoxStyle.Critical, msg1) + Dim unused1 = sender.Focus() + Dim unused = sender.SelectAll() + End If + ValidateLabel = xBool + End Function + + Private Sub TBSelect_Click(sender As Object, e As EventArgs) Handles TBSelect.Click + If Not ValidateLabel(lr1) Then Exit Sub + If Not ValidateLabel(lr2) Then Exit Sub + + Dim xCol() As Integer = {} + For Each xCB As CheckBox In Panel1.Controls + If xCB.Checked Then + ReDim Preserve xCol(UBound(xCol) + 1) + xCol(UBound(xCol)) = xCB.Tag + End If + Next + + Dim xRange As Integer = 1 + If cbx1.Checked Then xRange *= 2 + If cbx2.Checked Then xRange *= 3 + If cbx3.Checked Then xRange *= 5 + If cbx4.Checked Then xRange *= 7 + If cbx5.Checked Then xRange *= 11 + If cbx6.Checked Then xRange *= 13 + + MainWindow.fdrSelect(xRange, _ + mr1.Value, mr2.Value, _ + lr1.Text, lr2.Text, _ + vr1.Value * 10000, vr2.Value * 10000, _ + xCol) + End Sub + + Private Sub TBUnselect_Click(sender As Object, e As EventArgs) Handles TBUnselect.Click + If Not ValidateLabel(lr1) Then Exit Sub + If Not ValidateLabel(lr2) Then Exit Sub + + Dim xCol() As Integer = {} + For Each xCB As CheckBox In Panel1.Controls + If xCB.Checked Then + ReDim Preserve xCol(UBound(xCol) + 1) + xCol(UBound(xCol)) = xCB.Tag + End If + Next + + Dim xRange As Integer = 1 + If cbx1.Checked Then xRange *= 2 + If cbx2.Checked Then xRange *= 3 + If cbx3.Checked Then xRange *= 5 + If cbx4.Checked Then xRange *= 7 + If cbx5.Checked Then xRange *= 11 + If cbx6.Checked Then xRange *= 13 + + MainWindow.fdrUnselect(xRange, _ + mr1.Value, mr2.Value, _ + lr1.Text, lr2.Text, _ + vr1.Value * 10000, vr2.Value * 10000, _ + xCol) + End Sub + + Private Sub TBDelete_Click(sender As Object, e As EventArgs) Handles TBDelete.Click + If Not ValidateLabel(lr1) Then Exit Sub + If Not ValidateLabel(lr2) Then Exit Sub + + Dim xCol() As Integer = {} + For Each xCB As CheckBox In Panel1.Controls + If xCB.Checked Then + ReDim Preserve xCol(UBound(xCol) + 1) + xCol(UBound(xCol)) = xCB.Tag + End If + Next + + Dim xRange As Integer = 1 + If cbx1.Checked Then xRange *= 2 + If cbx2.Checked Then xRange *= 3 + If cbx3.Checked Then xRange *= 5 + If cbx4.Checked Then xRange *= 7 + If cbx5.Checked Then xRange *= 11 + If cbx6.Checked Then xRange *= 13 + + MainWindow.fdrDelete(xRange, _ + mr1.Value, mr2.Value, _ + lr1.Text, lr2.Text, _ + vr1.Value * 10000, vr2.Value * 10000, _ + xCol) + End Sub + + Private Sub TBrl_Click(sender As Object, e As EventArgs) Handles TBrl.Click + If Not ValidateLabel(lr1) Then Exit Sub + If Not ValidateLabel(lr2) Then Exit Sub + If Not ValidateLabel(Ttl) Then Exit Sub + + Dim xCol() As Integer = {} + For Each xCB As CheckBox In Panel1.Controls + If xCB.Checked Then + ReDim Preserve xCol(UBound(xCol) + 1) + xCol(UBound(xCol)) = xCB.Tag + End If + Next + + Dim xRange As Integer = 1 + If cbx1.Checked Then xRange *= 2 + If cbx2.Checked Then xRange *= 3 + If cbx3.Checked Then xRange *= 5 + If cbx4.Checked Then xRange *= 7 + If cbx5.Checked Then xRange *= 11 + If cbx6.Checked Then xRange *= 13 + + MainWindow.fdrReplaceL(xRange, _ + mr1.Value, mr2.Value, _ + lr1.Text, lr2.Text, _ + vr1.Value * 10000, vr2.Value * 10000, _ + xCol, Ttl.Text) + End Sub + + Private Sub TBrv_Click(sender As Object, e As EventArgs) Handles TBrv.Click + If Not ValidateLabel(lr1) Then Exit Sub + If Not ValidateLabel(lr2) Then Exit Sub + + Dim xCol() As Integer = {} + For Each xCB As CheckBox In Panel1.Controls + If xCB.Checked Then + ReDim Preserve xCol(UBound(xCol) + 1) + xCol(UBound(xCol)) = xCB.Tag + End If + Next + + Dim xRange As Integer = 1 + If cbx1.Checked Then xRange *= 2 + If cbx2.Checked Then xRange *= 3 + If cbx3.Checked Then xRange *= 5 + If cbx4.Checked Then xRange *= 7 + If cbx5.Checked Then xRange *= 11 + If cbx6.Checked Then xRange *= 13 + + MainWindow.fdrReplaceV(xRange, _ + mr1.Value, mr2.Value, _ + lr1.Text, lr2.Text, _ + vr1.Value * 10000, vr2.Value * 10000, _ + xCol, Ttv.Value * 10000) + End Sub End Class diff --git a/iBMSC/Dialogs/fLoadFileProgress.vb b/iBMSC/Dialogs/fLoadFileProgress.vb index 39591077c..9e7ac7adf 100644 --- a/iBMSC/Dialogs/fLoadFileProgress.vb +++ b/iBMSC/Dialogs/fLoadFileProgress.vb @@ -1,40 +1,40 @@ Public Class fLoadFileProgress - Private xPath(-1) As String - Private CancelPressed As Boolean = False - Private IsSaved As Boolean = False + Private xPath(-1) As String + Private CancelPressed As Boolean = False + Private IsSaved As Boolean = False - Public Sub New(xxPath() As String, xIsSaved As Boolean, Optional TopMost As Boolean = True) - InitializeComponent() - prog.Maximum = UBound(xxPath) + 1 - xPath = xxPath - IsSaved = xIsSaved - Me.TopMost = TopMost - End Sub + Public Sub New(xxPath() As String, xIsSaved As Boolean, Optional TopMost As Boolean = True) + InitializeComponent() + prog.Maximum = UBound(xxPath) + 1 + xPath = xxPath + IsSaved = xIsSaved + Me.TopMost = TopMost + End Sub - Private Sub Cancel_Button_Click(sender As Object, e As EventArgs) Handles Cancel_Button.Click - DialogResult = DialogResult.Cancel - CancelPressed = True - Close() - End Sub + Private Sub Cancel_Button_Click(sender As Object, e As EventArgs) Handles Cancel_Button.Click + DialogResult = DialogResult.Cancel + CancelPressed = True + Close() + End Sub - Private Sub fLoadFileProgress_Shown(sender As Object, e As EventArgs) Handles MyBase.Shown - On Error GoTo 0 - For xI1 = 0 To UBound(xPath) - Label1.Text = "Currently loading ( " & (xI1 + 1) & " / " & (UBound(xPath) + 1) & " ): " & xPath(xI1) - Dim aa = prog.Maximum - Dim bb = prog.Value - prog.Value = xI1 - Application.DoEvents - If CancelPressed Then Exit For + Private Sub fLoadFileProgress_Shown(sender As Object, e As EventArgs) Handles MyBase.Shown + On Error GoTo 0 + For xI1 = 0 To UBound(xPath) + Label1.Text = "Currently loading ( " & (xI1 + 1) & " / " & (UBound(xPath) + 1) & " ): " & xPath(xI1) + Dim aa = prog.Maximum + Dim bb = prog.Value + prog.Value = xI1 + Application.DoEvents + If CancelPressed Then Exit For - If xI1 = 0 AndAlso IsSaved Then MainWindow.ReadFile(xPath(xI1)) _ - Else Dim unused = Process.Start(Application.ExecutablePath, """" & xPath(xI1) & """") 'Shell("""" & Application.ExecutablePath & """ """ & xPaths(xI1) & """") ' - Next - Close - End Sub + If xI1 = 0 AndAlso IsSaved Then MainWindow.ReadFile(xPath(xI1)) _ + Else Dim unused = Process.Start(Application.ExecutablePath, """" & xPath(xI1) & """") 'Shell("""" & Application.ExecutablePath & """ """ & xPaths(xI1) & """") ' + Next + Close + End Sub - Private Sub fLoadFileProgress_Load(sender As Object, e As EventArgs) Handles MyBase.Load - Font = MainWindow.Font - Cancel_Button.Text = Strings.Cancel - End Sub + Private Sub fLoadFileProgress_Load(sender As Object, e As EventArgs) Handles MyBase.Load + Font = MainWindow.Font + Cancel_Button.Text = Strings.Cancel + End Sub End Class diff --git a/iBMSC/EditorColumns.vb b/iBMSC/EditorColumns.vb index 7b2a7c084..b18e115be 100644 --- a/iBMSC/EditorColumns.vb +++ b/iBMSC/EditorColumns.vb @@ -2,429 +2,429 @@ Partial Public Class MainWindow - Public Const niMeasure As Integer = 0 - Public Const niSCROLL As Integer = 1 - Public Const niBPM As Integer = 2 - Public Const niSTOP As Integer = 3 - Public Const niS1 As Integer = 4 + Public Const niMeasure As Integer = 0 + Public Const niSCROLL As Integer = 1 + Public Const niBPM As Integer = 2 + Public Const niSTOP As Integer = 3 + Public Const niS1 As Integer = 4 - Public Const niA1 As Integer = 5 - Public Const niA2 As Integer = 6 - Public Const niA3 As Integer = 7 - Public Const niA4 As Integer = 8 - Public Const niA5 As Integer = 9 - Public Const niA6 As Integer = 10 - Public Const niA7 As Integer = 11 - Public Const niA8 As Integer = 12 - Public Const niA9 As Integer = 13 - Public Const niAA As Integer = 14 - Public Const niAB As Integer = 15 - Public Const niAC As Integer = 16 - Public Const niAD As Integer = 17 - Public Const niAE As Integer = 18 - Public Const niAF As Integer = 19 - Public Const niAG As Integer = 20 - Public Const niAH As Integer = 21 - Public Const niAI As Integer = 22 - Public Const niAJ As Integer = 23 - Public Const niAK As Integer = 24 - Public Const niAL As Integer = 25 - Public Const niAM As Integer = 26 - Public Const niAN As Integer = 27 - Public Const niAO As Integer = 28 - Public Const niAP As Integer = 29 - Public Const niAQ As Integer = 30 - Public Const niS2 As Integer = 31 + Public Const niA1 As Integer = 5 + Public Const niA2 As Integer = 6 + Public Const niA3 As Integer = 7 + Public Const niA4 As Integer = 8 + Public Const niA5 As Integer = 9 + Public Const niA6 As Integer = 10 + Public Const niA7 As Integer = 11 + Public Const niA8 As Integer = 12 + Public Const niA9 As Integer = 13 + Public Const niAA As Integer = 14 + Public Const niAB As Integer = 15 + Public Const niAC As Integer = 16 + Public Const niAD As Integer = 17 + Public Const niAE As Integer = 18 + Public Const niAF As Integer = 19 + Public Const niAG As Integer = 20 + Public Const niAH As Integer = 21 + Public Const niAI As Integer = 22 + Public Const niAJ As Integer = 23 + Public Const niAK As Integer = 24 + Public Const niAL As Integer = 25 + Public Const niAM As Integer = 26 + Public Const niAN As Integer = 27 + Public Const niAO As Integer = 28 + Public Const niAP As Integer = 29 + Public Const niAQ As Integer = 30 + Public Const niS2 As Integer = 31 - Public Const niD1 As Integer = 32 - Public Const niD2 As Integer = 33 - Public Const niD3 As Integer = 34 - Public Const niD4 As Integer = 35 - Public Const niD5 As Integer = 36 - Public Const niD6 As Integer = 37 - Public Const niD7 As Integer = 38 - Public Const niD8 As Integer = 39 - Public Const niD9 As Integer = 40 - Public Const niDA As Integer = 41 - Public Const niDB As Integer = 42 - Public Const niDC As Integer = 43 - Public Const niDD As Integer = 44 - Public Const niDE As Integer = 45 - Public Const niDF As Integer = 46 - Public Const niDG As Integer = 47 - Public Const niDH As Integer = 48 - Public Const niDI As Integer = 49 - Public Const niDJ As Integer = 50 - Public Const niDK As Integer = 51 - Public Const niDL As Integer = 52 - Public Const niDM As Integer = 53 - Public Const niDN As Integer = 54 - Public Const niDO As Integer = 55 - Public Const niDP As Integer = 56 - Public Const niDQ As Integer = 57 - Public Const niS3 As Integer = 58 + Public Const niD1 As Integer = 32 + Public Const niD2 As Integer = 33 + Public Const niD3 As Integer = 34 + Public Const niD4 As Integer = 35 + Public Const niD5 As Integer = 36 + Public Const niD6 As Integer = 37 + Public Const niD7 As Integer = 38 + Public Const niD8 As Integer = 39 + Public Const niD9 As Integer = 40 + Public Const niDA As Integer = 41 + Public Const niDB As Integer = 42 + Public Const niDC As Integer = 43 + Public Const niDD As Integer = 44 + Public Const niDE As Integer = 45 + Public Const niDF As Integer = 46 + Public Const niDG As Integer = 47 + Public Const niDH As Integer = 48 + Public Const niDI As Integer = 49 + Public Const niDJ As Integer = 50 + Public Const niDK As Integer = 51 + Public Const niDL As Integer = 52 + Public Const niDM As Integer = 53 + Public Const niDN As Integer = 54 + Public Const niDO As Integer = 55 + Public Const niDP As Integer = 56 + Public Const niDQ As Integer = 57 + Public Const niS3 As Integer = 58 - Public Const niBGA As Integer = 59 - Public Const niLAYER As Integer = 60 - Public Const niPOOR As Integer = 61 - Public Const niS4 As Integer = 62 - Public Const niB As Integer = 63 + Public Const niBGA As Integer = 59 + Public Const niLAYER As Integer = 60 + Public Const niPOOR As Integer = 61 + Public Const niS4 As Integer = 62 + Public Const niB As Integer = 63 - Public column() As Column = {New Column(0, 50, "Measure", False, True, False, True, 0, 0, &HFF00FFFF, 0, &HFF00FFFF, 0), - New Column(50, 60, "SCROLL", True, True, False, True, 99, 0, &HFFFF0000, 0, &HFFFF0000, 0), - New Column(110, 60, "BPM", True, True, False, True, 3, 0, &HFFFF0000, 0, &HFFFF0000, 0), - New Column(170, 50, "STOP", True, True, False, True, 9, 0, &HFFFF0000, 0, &HFFFF0000, 0), - New Column(220, 5, String.Empty, False, False, False, True, 0, 0, 0, 0, 0, 0), - New Column(225, 40, "AQ", True, False, True, False, 42, &HFFB0B0B0, &HFF000000, &HFF909090, &HFF000000, 0), - New Column(225, 40, "A1", True, False, True, True, 43, &HFF808080, &HFF000000, &HFF909090, &HFF000000, 0), - New Column(265, 42, "A2", True, False, True, True, 37, &HFFB0B0B0, &HFF000000, &HFFC0C0C0, &HFF000000, &H14FFFFFF), - New Column(307, 30, "A3", True, False, True, True, 38, &HFF62B0FF, &HFF000000, &HFF6AB0F7, &HFF000000, &H140033FF), - New Column(337, 42, "A4", True, False, True, True, 39, &HFFB0B0B0, &HFF000000, &HFFC0C0C0, &HFF000000, &H14FFFFFF), - New Column(379, 45, "A5", True, False, True, True, 40, &HFFFFC862, &HFF000000, &HFFF7C66A, &HFF000000, &H16F38B0C), - New Column(424, 42, "A6", True, False, True, True, 41, &HFFB0B0B0, &HFF000000, &HFFC0C0C0, &HFF000000, &H14FFFFFF), - New Column(466, 30, "A7", True, False, True, True, 44, &HFF62B0FF, &HFF000000, &HFF6AB0F7, &HFF000000, &H140033FF), - New Column(496, 42, "A8", True, False, True, True, 45, &HFFB0B0B0, &HFF000000, &HFFC0C0C0, &HFF000000, &H14FFFFFF), - New Column(496, 30, "A9", True, False, True, False, 46, &HFF62B0FF, &HFF000000, &HFF6AB0F7, &HFF000000, &H140033FF), - New Column(496, 42, "AA", True, False, True, False, 47, &HFFB0B0B0, &HFF000000, &HFFC0C0C0, &HFF000000, &H14FFFFFF), - New Column(496, 30, "AB", True, False, True, False, 48, &HFF62B0FF, &HFF000000, &HFF6AB0F7, &HFF000000, &H140033FF), - New Column(496, 42, "AC", True, False, True, False, 49, &HFFB0B0B0, &HFF000000, &HFFC0C0C0, &HFF000000, &H14FFFFFF), - New Column(496, 30, "AD", True, False, True, False, 50, &HFF62B0FF, &HFF000000, &HFF6AB0F7, &HFF000000, &H140033FF), - New Column(496, 42, "AE", True, False, True, False, 51, &HFFB0B0B0, &HFF000000, &HFFC0C0C0, &HFF000000, &H14FFFFFF), - New Column(496, 30, "AF", True, False, True, False, 52, &HFF62B0FF, &HFF000000, &HFF6AB0F7, &HFF000000, &H140033FF), - New Column(496, 42, "AG", True, False, True, False, 53, &HFFB0B0B0, &HFF000000, &HFFC0C0C0, &HFF000000, &H14FFFFFF), - New Column(496, 30, "AH", True, False, True, False, 54, &HFF62B0FF, &HFF000000, &HFF6AB0F7, &HFF000000, &H140033FF), - New Column(496, 42, "AI", True, False, True, False, 55, &HFFB0B0B0, &HFF000000, &HFFC0C0C0, &HFF000000, &H14FFFFFF), - New Column(496, 30, "AJ", True, False, True, False, 56, &HFF62B0FF, &HFF000000, &HFF6AB0F7, &HFF000000, &H140033FF), - New Column(496, 42, "AK", True, False, True, False, 57, &HFFB0B0B0, &HFF000000, &HFFC0C0C0, &HFF000000, &H14FFFFFF), - New Column(496, 30, "AL", True, False, True, False, 58, &HFF62B0FF, &HFF000000, &HFF6AB0F7, &HFF000000, &H140033FF), - New Column(496, 42, "AM", True, False, True, False, 59, &HFFB0B0B0, &HFF000000, &HFFC0C0C0, &HFF000000, &H14FFFFFF), - New Column(496, 30, "AN", True, False, True, False, 60, &HFF62B0FF, &HFF000000, &HFF6AB0F7, &HFF000000, &H140033FF), - New Column(496, 42, "AO", True, False, True, False, 61, &HFFB0B0B0, &HFF000000, &HFFC0C0C0, &HFF000000, &H14FFFFFF), - New Column(496, 30, "AP", True, False, True, False, 62, &HFF62B0FF, &HFF000000, &HFF6AB0F7, &HFF000000, &H140033FF), - New Column(496, 5, String.Empty, False, False, False, True, 0, 0, 0, 0, 0, 0), - New Column(503, 42, "D1", True, False, True, False, 73, &HFFB0B0B0, &HFF000000, &HFFC0C0C0, &HFF000000, &H14FFFFFF), - New Column(503, 30, "D2", True, False, True, False, 74, &HFF62B0FF, &HFF000000, &HFF6AB0F7, &HFF000000, &H140033FF), - New Column(503, 42, "D3", True, False, True, False, 75, &HFFB0B0B0, &HFF000000, &HFFC0C0C0, &HFF000000, &H14FFFFFF), - New Column(503, 45, "D4", True, False, True, False, 76, &HFFFFC862, &HFF000000, &HFFF7C66A, &HFF000000, &H16F38B0C), - New Column(503, 42, "D5", True, False, True, False, 77, &HFFB0B0B0, &HFF000000, &HFFC0C0C0, &HFF000000, &H14FFFFFF), - New Column(503, 30, "D6", True, False, True, False, 80, &HFF62B0FF, &HFF000000, &HFF6AB0F7, &HFF000000, &H140033FF), - New Column(503, 42, "D7", True, False, True, False, 81, &HFFB0B0B0, &HFF000000, &HFFC0C0C0, &HFF000000, &H14FFFFFF), - New Column(503, 30, "D9", True, False, True, False, 82, &HFF62B0FF, &HFF000000, &HFF6AB0F7, &HFF000000, &H140033FF), - New Column(503, 42, "DA", True, False, True, False, 83, &HFFB0B0B0, &HFF000000, &HFFC0C0C0, &HFF000000, &H14FFFFFF), - New Column(503, 30, "DB", True, False, True, False, 84, &HFF62B0FF, &HFF000000, &HFF6AB0F7, &HFF000000, &H140033FF), - New Column(503, 42, "DC", True, False, True, False, 85, &HFFB0B0B0, &HFF000000, &HFFC0C0C0, &HFF000000, &H14FFFFFF), - New Column(503, 30, "DD", True, False, True, False, 86, &HFF62B0FF, &HFF000000, &HFF6AB0F7, &HFF000000, &H140033FF), - New Column(503, 42, "DE", True, False, True, False, 87, &HFFB0B0B0, &HFF000000, &HFFC0C0C0, &HFF000000, &H14FFFFFF), - New Column(503, 30, "DF", True, False, True, False, 88, &HFF62B0FF, &HFF000000, &HFF6AB0F7, &HFF000000, &H140033FF), - New Column(503, 42, "DG", True, False, True, False, 89, &HFFB0B0B0, &HFF000000, &HFFC0C0C0, &HFF000000, &H14FFFFFF), - New Column(503, 30, "DH", True, False, True, False, 90, &HFF62B0FF, &HFF000000, &HFF6AB0F7, &HFF000000, &H140033FF), - New Column(503, 42, "DI", True, False, True, False, 91, &HFFB0B0B0, &HFF000000, &HFFC0C0C0, &HFF000000, &H14FFFFFF), - New Column(503, 30, "DJ", True, False, True, False, 92, &HFF62B0FF, &HFF000000, &HFF6AB0F7, &HFF000000, &H140033FF), - New Column(503, 42, "DK", True, False, True, False, 93, &HFFB0B0B0, &HFF000000, &HFFC0C0C0, &HFF000000, &H14FFFFFF), - New Column(503, 30, "DL", True, False, True, False, 94, &HFF62B0FF, &HFF000000, &HFF6AB0F7, &HFF000000, &H140033FF), - New Column(503, 42, "DM", True, False, True, False, 95, &HFFB0B0B0, &HFF000000, &HFFC0C0C0, &HFF000000, &H14FFFFFF), - New Column(503, 30, "DN", True, False, True, False, 96, &HFF62B0FF, &HFF000000, &HFF6AB0F7, &HFF000000, &H140033FF), - New Column(503, 42, "DO", True, False, True, False, 97, &HFFB0B0B0, &HFF000000, &HFFC0C0C0, &HFF000000, &H14FFFFFF), - New Column(503, 30, "DP", True, False, True, False, 98, &HFF62B0FF, &HFF000000, &HFF6AB0F7, &HFF000000, &H140033FF), - New Column(503, 40, "DQ", True, False, True, False, 78, &HFF808080, &HFF000000, &HFF909090, &HFF000000, 0), - New Column(503, 40, "D8", True, False, True, False, 79, &HFF808080, &HFF000000, &HFF909090, &HFF000000, 0), - New Column(503, 5, String.Empty, False, False, False, False, 0, 0, 0, 0, 0, 0), - New Column(503, 40, "BGA", True, False, False, False, 4, &HFF8CD78A, &HFF000000, &HFF90D38E, &HFF000000, 0), - New Column(503, 40, "LAYER", True, False, False, False, 7, &HFF8CD78A, &HFF000000, &HFF90D38E, &HFF000000, 0), - New Column(503, 40, "POOR", True, False, False, False, 6, &HFF8CD78A, &HFF000000, &HFF90D38E, &HFF000000, 0), - New Column(503, 5, String.Empty, False, False, False, False, 0, 0, 0, 0, 0, 0), - New Column(503, 40, "B", True, False, True, True, 1, &HFFE18080, &HFF000000, &HFFDC8585, &HFF000000, 0)} + Public column() As Column = {New Column(0, 50, "Measure", False, True, False, True, 0, 0, &HFF00FFFF, 0, &HFF00FFFF, 0), + New Column(50, 60, "SCROLL", True, True, False, True, 99, 0, &HFFFF0000, 0, &HFFFF0000, 0), + New Column(110, 60, "BPM", True, True, False, True, 3, 0, &HFFFF0000, 0, &HFFFF0000, 0), + New Column(170, 50, "STOP", True, True, False, True, 9, 0, &HFFFF0000, 0, &HFFFF0000, 0), + New Column(220, 5, String.Empty, False, False, False, True, 0, 0, 0, 0, 0, 0), + New Column(225, 40, "AQ", True, False, True, False, 42, &HFFB0B0B0, &HFF000000, &HFF909090, &HFF000000, 0), + New Column(225, 40, "A1", True, False, True, True, 43, &HFF808080, &HFF000000, &HFF909090, &HFF000000, 0), + New Column(265, 42, "A2", True, False, True, True, 37, &HFFB0B0B0, &HFF000000, &HFFC0C0C0, &HFF000000, &H14FFFFFF), + New Column(307, 30, "A3", True, False, True, True, 38, &HFF62B0FF, &HFF000000, &HFF6AB0F7, &HFF000000, &H140033FF), + New Column(337, 42, "A4", True, False, True, True, 39, &HFFB0B0B0, &HFF000000, &HFFC0C0C0, &HFF000000, &H14FFFFFF), + New Column(379, 45, "A5", True, False, True, True, 40, &HFFFFC862, &HFF000000, &HFFF7C66A, &HFF000000, &H16F38B0C), + New Column(424, 42, "A6", True, False, True, True, 41, &HFFB0B0B0, &HFF000000, &HFFC0C0C0, &HFF000000, &H14FFFFFF), + New Column(466, 30, "A7", True, False, True, True, 44, &HFF62B0FF, &HFF000000, &HFF6AB0F7, &HFF000000, &H140033FF), + New Column(496, 42, "A8", True, False, True, True, 45, &HFFB0B0B0, &HFF000000, &HFFC0C0C0, &HFF000000, &H14FFFFFF), + New Column(496, 30, "A9", True, False, True, False, 46, &HFF62B0FF, &HFF000000, &HFF6AB0F7, &HFF000000, &H140033FF), + New Column(496, 42, "AA", True, False, True, False, 47, &HFFB0B0B0, &HFF000000, &HFFC0C0C0, &HFF000000, &H14FFFFFF), + New Column(496, 30, "AB", True, False, True, False, 48, &HFF62B0FF, &HFF000000, &HFF6AB0F7, &HFF000000, &H140033FF), + New Column(496, 42, "AC", True, False, True, False, 49, &HFFB0B0B0, &HFF000000, &HFFC0C0C0, &HFF000000, &H14FFFFFF), + New Column(496, 30, "AD", True, False, True, False, 50, &HFF62B0FF, &HFF000000, &HFF6AB0F7, &HFF000000, &H140033FF), + New Column(496, 42, "AE", True, False, True, False, 51, &HFFB0B0B0, &HFF000000, &HFFC0C0C0, &HFF000000, &H14FFFFFF), + New Column(496, 30, "AF", True, False, True, False, 52, &HFF62B0FF, &HFF000000, &HFF6AB0F7, &HFF000000, &H140033FF), + New Column(496, 42, "AG", True, False, True, False, 53, &HFFB0B0B0, &HFF000000, &HFFC0C0C0, &HFF000000, &H14FFFFFF), + New Column(496, 30, "AH", True, False, True, False, 54, &HFF62B0FF, &HFF000000, &HFF6AB0F7, &HFF000000, &H140033FF), + New Column(496, 42, "AI", True, False, True, False, 55, &HFFB0B0B0, &HFF000000, &HFFC0C0C0, &HFF000000, &H14FFFFFF), + New Column(496, 30, "AJ", True, False, True, False, 56, &HFF62B0FF, &HFF000000, &HFF6AB0F7, &HFF000000, &H140033FF), + New Column(496, 42, "AK", True, False, True, False, 57, &HFFB0B0B0, &HFF000000, &HFFC0C0C0, &HFF000000, &H14FFFFFF), + New Column(496, 30, "AL", True, False, True, False, 58, &HFF62B0FF, &HFF000000, &HFF6AB0F7, &HFF000000, &H140033FF), + New Column(496, 42, "AM", True, False, True, False, 59, &HFFB0B0B0, &HFF000000, &HFFC0C0C0, &HFF000000, &H14FFFFFF), + New Column(496, 30, "AN", True, False, True, False, 60, &HFF62B0FF, &HFF000000, &HFF6AB0F7, &HFF000000, &H140033FF), + New Column(496, 42, "AO", True, False, True, False, 61, &HFFB0B0B0, &HFF000000, &HFFC0C0C0, &HFF000000, &H14FFFFFF), + New Column(496, 30, "AP", True, False, True, False, 62, &HFF62B0FF, &HFF000000, &HFF6AB0F7, &HFF000000, &H140033FF), + New Column(496, 5, String.Empty, False, False, False, True, 0, 0, 0, 0, 0, 0), + New Column(503, 42, "D1", True, False, True, False, 73, &HFFB0B0B0, &HFF000000, &HFFC0C0C0, &HFF000000, &H14FFFFFF), + New Column(503, 30, "D2", True, False, True, False, 74, &HFF62B0FF, &HFF000000, &HFF6AB0F7, &HFF000000, &H140033FF), + New Column(503, 42, "D3", True, False, True, False, 75, &HFFB0B0B0, &HFF000000, &HFFC0C0C0, &HFF000000, &H14FFFFFF), + New Column(503, 45, "D4", True, False, True, False, 76, &HFFFFC862, &HFF000000, &HFFF7C66A, &HFF000000, &H16F38B0C), + New Column(503, 42, "D5", True, False, True, False, 77, &HFFB0B0B0, &HFF000000, &HFFC0C0C0, &HFF000000, &H14FFFFFF), + New Column(503, 30, "D6", True, False, True, False, 80, &HFF62B0FF, &HFF000000, &HFF6AB0F7, &HFF000000, &H140033FF), + New Column(503, 42, "D7", True, False, True, False, 81, &HFFB0B0B0, &HFF000000, &HFFC0C0C0, &HFF000000, &H14FFFFFF), + New Column(503, 30, "D9", True, False, True, False, 82, &HFF62B0FF, &HFF000000, &HFF6AB0F7, &HFF000000, &H140033FF), + New Column(503, 42, "DA", True, False, True, False, 83, &HFFB0B0B0, &HFF000000, &HFFC0C0C0, &HFF000000, &H14FFFFFF), + New Column(503, 30, "DB", True, False, True, False, 84, &HFF62B0FF, &HFF000000, &HFF6AB0F7, &HFF000000, &H140033FF), + New Column(503, 42, "DC", True, False, True, False, 85, &HFFB0B0B0, &HFF000000, &HFFC0C0C0, &HFF000000, &H14FFFFFF), + New Column(503, 30, "DD", True, False, True, False, 86, &HFF62B0FF, &HFF000000, &HFF6AB0F7, &HFF000000, &H140033FF), + New Column(503, 42, "DE", True, False, True, False, 87, &HFFB0B0B0, &HFF000000, &HFFC0C0C0, &HFF000000, &H14FFFFFF), + New Column(503, 30, "DF", True, False, True, False, 88, &HFF62B0FF, &HFF000000, &HFF6AB0F7, &HFF000000, &H140033FF), + New Column(503, 42, "DG", True, False, True, False, 89, &HFFB0B0B0, &HFF000000, &HFFC0C0C0, &HFF000000, &H14FFFFFF), + New Column(503, 30, "DH", True, False, True, False, 90, &HFF62B0FF, &HFF000000, &HFF6AB0F7, &HFF000000, &H140033FF), + New Column(503, 42, "DI", True, False, True, False, 91, &HFFB0B0B0, &HFF000000, &HFFC0C0C0, &HFF000000, &H14FFFFFF), + New Column(503, 30, "DJ", True, False, True, False, 92, &HFF62B0FF, &HFF000000, &HFF6AB0F7, &HFF000000, &H140033FF), + New Column(503, 42, "DK", True, False, True, False, 93, &HFFB0B0B0, &HFF000000, &HFFC0C0C0, &HFF000000, &H14FFFFFF), + New Column(503, 30, "DL", True, False, True, False, 94, &HFF62B0FF, &HFF000000, &HFF6AB0F7, &HFF000000, &H140033FF), + New Column(503, 42, "DM", True, False, True, False, 95, &HFFB0B0B0, &HFF000000, &HFFC0C0C0, &HFF000000, &H14FFFFFF), + New Column(503, 30, "DN", True, False, True, False, 96, &HFF62B0FF, &HFF000000, &HFF6AB0F7, &HFF000000, &H140033FF), + New Column(503, 42, "DO", True, False, True, False, 97, &HFFB0B0B0, &HFF000000, &HFFC0C0C0, &HFF000000, &H14FFFFFF), + New Column(503, 30, "DP", True, False, True, False, 98, &HFF62B0FF, &HFF000000, &HFF6AB0F7, &HFF000000, &H140033FF), + New Column(503, 40, "DQ", True, False, True, False, 78, &HFF808080, &HFF000000, &HFF909090, &HFF000000, 0), + New Column(503, 40, "D8", True, False, True, False, 79, &HFF808080, &HFF000000, &HFF909090, &HFF000000, 0), + New Column(503, 5, String.Empty, False, False, False, False, 0, 0, 0, 0, 0, 0), + New Column(503, 40, "BGA", True, False, False, False, 4, &HFF8CD78A, &HFF000000, &HFF90D38E, &HFF000000, 0), + New Column(503, 40, "LAYER", True, False, False, False, 7, &HFF8CD78A, &HFF000000, &HFF90D38E, &HFF000000, 0), + New Column(503, 40, "POOR", True, False, False, False, 6, &HFF8CD78A, &HFF000000, &HFF90D38E, &HFF000000, 0), + New Column(503, 5, String.Empty, False, False, False, False, 0, 0, 0, 0, 0, 0), + New Column(503, 40, "B", True, False, True, True, 1, &HFFE18080, &HFF000000, &HFFDC8585, &HFF000000, 0)} - Public Const idflBPM As Integer = 5 + Public Const idflBPM As Integer = 5 - Private Function GetBMSChannelBy(note As Note) As String - Dim iCol = note.ColumnIndex - Dim xVal = note.Value - Dim xLong = note.LongNote - Dim xHidden = note.Hidden - Dim bmsBaseChannel As Integer = GetColumn(iCol).Identifier - Dim xLandmine = note.Landmine + Private Function GetBMSChannelBy(note As Note) As String + Dim iCol = note.ColumnIndex + Dim xVal = note.Value + Dim xLong = note.LongNote + Dim xHidden = note.Hidden + Dim bmsBaseChannel As Integer = GetColumn(iCol).Identifier + Dim xLandmine = note.Landmine - If iCol = niBPM AndAlso (xVal / 10000 <> xVal \ 10000 Or xVal >= 2560000 Or xVal < 0) Then bmsBaseChannel += idflBPM + If iCol = niBPM AndAlso (xVal / 10000 <> xVal \ 10000 Or xVal >= 2560000 Or xVal < 0) Then bmsBaseChannel += idflBPM - If iCol = niSCROLL Then Return "SC" + If iCol = niSCROLL Then Return "SC" - ' p1 side - If iCol >= niA1 And iCol <= niAQ Then - If xLong Then - Return C10to36(bmsBaseChannel + (&H5 * 36) - 36) - ElseIf xHidden Then - Return C10to36(bmsBaseChannel + (&H3 * 36) - 36) - ElseIf xLandmine Then - Return C10to36(bmsBaseChannel + (&HD * 36) - 36) - Else - Return C10to36(bmsBaseChannel + (&H1 * 36) - 36) - End If - End If + ' p1 side + If iCol >= niA1 And iCol <= niAQ Then + If xLong Then + Return C10to36(bmsBaseChannel + (&H5 * 36) - 36) + ElseIf xHidden Then + Return C10to36(bmsBaseChannel + (&H3 * 36) - 36) + ElseIf xLandmine Then + Return C10to36(bmsBaseChannel + (&HD * 36) - 36) + Else + Return C10to36(bmsBaseChannel + (&H1 * 36) - 36) + End If + End If - ' p2 side - If iCol >= niD1 And iCol <= niDQ Then - If xLong Then - Return C10to36(bmsBaseChannel + (&H6 * 36) - 72) - ElseIf xHidden Then - Return C10to36(bmsBaseChannel + (&H4 * 36) - 72) - ElseIf xLandmine Then - Return C10to36(bmsBaseChannel + (&HE * 36) - 72) - Else - Return C10to36(bmsBaseChannel + (&H2 * 36) - 72) - End If - End If + ' p2 side + If iCol >= niD1 And iCol <= niDQ Then + If xLong Then + Return C10to36(bmsBaseChannel + (&H6 * 36) - 72) + ElseIf xHidden Then + Return C10to36(bmsBaseChannel + (&H4 * 36) - 72) + ElseIf xLandmine Then + Return C10to36(bmsBaseChannel + (&HE * 36) - 72) + Else + Return C10to36(bmsBaseChannel + (&H2 * 36) - 72) + End If + End If - Return Add2Zeros(bmsBaseChannel) - End Function + Return Add2Zeros(bmsBaseChannel) + End Function - Private Function nLeft(iCol As Integer) As Integer - If iCol < niB Then Return column(iCol).Left Else Return column(niB).Left + ((iCol - niB) * column(niB).Width) - End Function - Private Function GetColumnWidth(iCol As Integer) As Integer - If Not GetColumn(iCol).isVisible Then Return 0 - If iCol < niB Then Return column(iCol).Width Else Return column(niB).Width - End Function - Private Function nTitle(iCol As Integer) As String - If iCol < niB Then Return column(iCol).Title Else Return column(niB).Title & (iCol - niB + 1).ToString - End Function - Private Function nEnabled(iCol As Integer) As Boolean - 'If iCol < niB Then Return col(iCol).Enabled And col(iCol).Visible Else Return col(niB).Enabled And col(niB).Visible - If iCol < niB Then Return column(iCol).isEnabledAfterAll Else Return column(niB).isEnabledAfterAll - End Function - Private Function IsColumnNumeric(iCol As Integer) As Boolean - If iCol < niB Then Return column(iCol).isNumeric Else Return column(niB).isNumeric - End Function - Private Function IsColumnSound(iCol As Integer) As Boolean - If iCol < niB Then Return column(iCol).isSound Else Return column(niB).isSound - End Function - Private Function IsColumnImage(iCol As Integer) As Boolean - If iCol < niB Then Return Not (column(iCol).isNumeric Or column(iCol).isSound) Else Return Not (column(niB).isNumeric Or column(niB).isSound) - End Function + Private Function nLeft(iCol As Integer) As Integer + If iCol < niB Then Return column(iCol).Left Else Return column(niB).Left + ((iCol - niB) * column(niB).Width) + End Function + Private Function GetColumnWidth(iCol As Integer) As Integer + If Not GetColumn(iCol).isVisible Then Return 0 + If iCol < niB Then Return column(iCol).Width Else Return column(niB).Width + End Function + Private Function nTitle(iCol As Integer) As String + If iCol < niB Then Return column(iCol).Title Else Return column(niB).Title & (iCol - niB + 1).ToString + End Function + Private Function nEnabled(iCol As Integer) As Boolean + 'If iCol < niB Then Return col(iCol).Enabled And col(iCol).Visible Else Return col(niB).Enabled And col(niB).Visible + If iCol < niB Then Return column(iCol).isEnabledAfterAll Else Return column(niB).isEnabledAfterAll + End Function + Private Function IsColumnNumeric(iCol As Integer) As Boolean + If iCol < niB Then Return column(iCol).isNumeric Else Return column(niB).isNumeric + End Function + Private Function IsColumnSound(iCol As Integer) As Boolean + If iCol < niB Then Return column(iCol).isSound Else Return column(niB).isSound + End Function + Private Function IsColumnImage(iCol As Integer) As Boolean + If iCol < niB Then Return Not (column(iCol).isNumeric Or column(iCol).isSound) Else Return Not (column(niB).isNumeric Or column(niB).isSound) + End Function - Private Sub ChangePlaySide(swap As Boolean) - If Rscratch Then - column(niA1).Identifier = 37 - column(niA2).Identifier = 38 - column(niA3).Identifier = 39 - column(niA4).Identifier = 40 - column(niA5).Identifier = 41 - column(niA6).Identifier = 44 - column(niA7).Identifier = 45 - column(niA8).Identifier = 42 - column(niA9).Identifier = 43 + Private Sub ChangePlaySide(swap As Boolean) + If Rscratch Then + column(niA1).Identifier = 37 + column(niA2).Identifier = 38 + column(niA3).Identifier = 39 + column(niA4).Identifier = 40 + column(niA5).Identifier = 41 + column(niA6).Identifier = 44 + column(niA7).Identifier = 45 + column(niA8).Identifier = 42 + column(niA9).Identifier = 43 - For i = 0 To UBound(Notes) Step 1 - If Notes(i).ColumnIndex = niA1 Then - Notes(i).ColumnIndex = niA8 - ElseIf Notes(i).ColumnIndex = niA2 Then - Notes(i).ColumnIndex = niA9 - ElseIf Notes(i).ColumnIndex >= niA3 AndAlso Notes(i).ColumnIndex <= niA9 Then - Notes(i).ColumnIndex -= 2 - End If - Next - ElseIf swap Then - column(niA1).Identifier = 42 - column(niA2).Identifier = 43 - column(niA3).Identifier = 37 - column(niA4).Identifier = 38 - column(niA5).Identifier = 39 - column(niA6).Identifier = 40 - column(niA7).Identifier = 41 - column(niA8).Identifier = 44 - column(niA9).Identifier = 45 - For i = 0 To UBound(Notes) Step 1 - If Notes(i).ColumnIndex = niA8 Then - Notes(i).ColumnIndex = niA1 - ElseIf Notes(i).ColumnIndex = niA9 Then - Notes(i).ColumnIndex = niA2 - ElseIf Notes(i).ColumnIndex >= niA1 AndAlso Notes(i).ColumnIndex <= niA7 Then - Notes(i).ColumnIndex += 2 - End If - Next - End If - ChangePlaySideSkin(swap) - End Sub + For i = 0 To UBound(Notes) Step 1 + If Notes(i).ColumnIndex = niA1 Then + Notes(i).ColumnIndex = niA8 + ElseIf Notes(i).ColumnIndex = niA2 Then + Notes(i).ColumnIndex = niA9 + ElseIf Notes(i).ColumnIndex >= niA3 AndAlso Notes(i).ColumnIndex <= niA9 Then + Notes(i).ColumnIndex -= 2 + End If + Next + ElseIf swap Then + column(niA1).Identifier = 42 + column(niA2).Identifier = 43 + column(niA3).Identifier = 37 + column(niA4).Identifier = 38 + column(niA5).Identifier = 39 + column(niA6).Identifier = 40 + column(niA7).Identifier = 41 + column(niA8).Identifier = 44 + column(niA9).Identifier = 45 + For i = 0 To UBound(Notes) Step 1 + If Notes(i).ColumnIndex = niA8 Then + Notes(i).ColumnIndex = niA1 + ElseIf Notes(i).ColumnIndex = niA9 Then + Notes(i).ColumnIndex = niA2 + ElseIf Notes(i).ColumnIndex >= niA1 AndAlso Notes(i).ColumnIndex <= niA7 Then + Notes(i).ColumnIndex += 2 + End If + Next + End If + ChangePlaySideSkin(swap) + End Sub - Private Sub ChangePlaySideSkin(swap As Boolean) - Dim tLeft(10) - For i = 0 To 8 Step 1 - tLeft(i) = column(niA1 + i + 1).Left - column(niA1 + i).Left - Next - If Rscratch Then - Dim tTitle = {column(niA1).Title, column(niA2).Title} - Dim tcBG = {column(niA1).cBG, column(niA2).cBG} - Dim tcNote = {column(niA1).cNote, column(niA2).cNote} - Dim tcLNote = {column(niA1).cLNote, column(niA2).cLNote} - Dim tcText = {column(niA1).cText, column(niA2).cText} - Dim tcLText = {column(niA1).cLText, column(niA2).cLText} - Dim tWidth = {column(niA1).Width, column(niA2).Width} - Dim tVisible = {column(niA1).isVisible, column(niA2).isVisible} - tLeft(9) = tLeft(0) - tLeft(10) = tLeft(1) - For i = 0 To 6 Step 1 - column(niA1 + i).Title = column(niA1 + i + 2).Title - column(niA1 + i).cBG = column(niA1 + i + 2).cBG - column(niA1 + i).cText = column(niA1 + i + 2).cText - column(niA1 + i).cLText = column(niA1 + i + 2).cLText - column(niA1 + i).setNoteColor(column(niA1 + i + 2).cNote) - column(niA1 + i).setLNoteColor(column(niA1 + i + 2).cLNote) - column(niA1 + i).isVisible = column(niA1 + i + 2).isVisible - column(niA1 + i).Width = column(niA1 + i + 2).Width - tLeft(i) = tLeft(i + 2) - Next - column(niA8).Title = tTitle(0) - column(niA8).cBG = tcBG(0) - column(niA8).cText = tcText(0) - column(niA8).cLText = tcLText(0) - column(niA8).setNoteColor(tcNote(0)) - column(niA8).setLNoteColor(tcLNote(0)) - column(niA8).isVisible = tVisible(0) - column(niA8).Width = tWidth(0) - column(niA9).Title = tTitle(1) - column(niA9).cBG = tcBG(1) - column(niA9).cText = tcText(1) - column(niA9).cLText = tcLText(1) - column(niA9).setNoteColor(tcNote(1)) - column(niA9).setLNoteColor(tcLNote(1)) - column(niA9).isVisible = tVisible(1) - column(niA9).Width = tWidth(1) - tLeft(7) = tLeft(9) - tLeft(8) = tLeft(10) - ElseIf swap Then - Dim tTitle = {column(niA8).Title, column(niA9).Title} - Dim tcBG = {column(niA8).cBG, column(niA9).cBG} - Dim tcNote = {column(niA8).cNote, column(niA9).cNote} - Dim tcLNote = {column(niA8).cLNote, column(niA9).cLNote} - Dim tcText = {column(niA8).cText, column(niA9).cText} - Dim tcLText = {column(niA8).cLText, column(niA9).cLText} - Dim tWidth = {column(niA8).Width, column(niA9).Width} - Dim tVisible = {column(niA8).isVisible, column(niA9).isVisible} - tLeft(9) = tLeft(7) - tLeft(10) = tLeft(8) - For i = 6 To 0 Step -1 - column(niA1 + i + 2).Title = column(niA1 + i).Title - column(niA1 + i + 2).cBG = column(niA1 + i).cBG - column(niA1 + i + 2).cText = column(niA1 + i).cText - column(niA1 + i + 2).cLText = column(niA1 + i).cLText - column(niA1 + i + 2).setNoteColor(column(niA1 + i).cNote) - column(niA1 + i + 2).setLNoteColor(column(niA1 + i).cLNote) - column(niA1 + i + 2).isVisible = column(niA1 + i).isVisible - column(niA1 + i + 2).Width = column(niA1 + i).Width - tLeft(i + 2) = tLeft(i) - Next - column(niA1).Title = tTitle(0) - column(niA1).cBG = tcBG(0) - column(niA1).cText = tcText(0) - column(niA1).cLText = tcLText(0) - column(niA1).setNoteColor(tcNote(0)) - column(niA1).setLNoteColor(tcLNote(0)) - column(niA1).isVisible = tVisible(0) - column(niA1).Width = tWidth(0) - column(niA2).Title = tTitle(1) - column(niA2).cBG = tcBG(1) - column(niA2).cText = tcText(1) - column(niA2).cLText = tcLText(1) - column(niA2).setNoteColor(tcNote(1)) - column(niA2).setLNoteColor(tcLNote(1)) - column(niA2).isVisible = tVisible(1) - column(niA2).Width = tWidth(1) - tLeft(0) = tLeft(9) - tLeft(1) = tLeft(10) - End If - For i = 0 To 8 Step 1 - column(niA1 + i + 1).Left = column(niA1 + i).Left + tLeft(i) - Next - End Sub + Private Sub ChangePlaySideSkin(swap As Boolean) + Dim tLeft(10) + For i = 0 To 8 Step 1 + tLeft(i) = column(niA1 + i + 1).Left - column(niA1 + i).Left + Next + If Rscratch Then + Dim tTitle = {column(niA1).Title, column(niA2).Title} + Dim tcBG = {column(niA1).cBG, column(niA2).cBG} + Dim tcNote = {column(niA1).cNote, column(niA2).cNote} + Dim tcLNote = {column(niA1).cLNote, column(niA2).cLNote} + Dim tcText = {column(niA1).cText, column(niA2).cText} + Dim tcLText = {column(niA1).cLText, column(niA2).cLText} + Dim tWidth = {column(niA1).Width, column(niA2).Width} + Dim tVisible = {column(niA1).isVisible, column(niA2).isVisible} + tLeft(9) = tLeft(0) + tLeft(10) = tLeft(1) + For i = 0 To 6 Step 1 + column(niA1 + i).Title = column(niA1 + i + 2).Title + column(niA1 + i).cBG = column(niA1 + i + 2).cBG + column(niA1 + i).cText = column(niA1 + i + 2).cText + column(niA1 + i).cLText = column(niA1 + i + 2).cLText + column(niA1 + i).setNoteColor(column(niA1 + i + 2).cNote) + column(niA1 + i).setLNoteColor(column(niA1 + i + 2).cLNote) + column(niA1 + i).isVisible = column(niA1 + i + 2).isVisible + column(niA1 + i).Width = column(niA1 + i + 2).Width + tLeft(i) = tLeft(i + 2) + Next + column(niA8).Title = tTitle(0) + column(niA8).cBG = tcBG(0) + column(niA8).cText = tcText(0) + column(niA8).cLText = tcLText(0) + column(niA8).setNoteColor(tcNote(0)) + column(niA8).setLNoteColor(tcLNote(0)) + column(niA8).isVisible = tVisible(0) + column(niA8).Width = tWidth(0) + column(niA9).Title = tTitle(1) + column(niA9).cBG = tcBG(1) + column(niA9).cText = tcText(1) + column(niA9).cLText = tcLText(1) + column(niA9).setNoteColor(tcNote(1)) + column(niA9).setLNoteColor(tcLNote(1)) + column(niA9).isVisible = tVisible(1) + column(niA9).Width = tWidth(1) + tLeft(7) = tLeft(9) + tLeft(8) = tLeft(10) + ElseIf swap Then + Dim tTitle = {column(niA8).Title, column(niA9).Title} + Dim tcBG = {column(niA8).cBG, column(niA9).cBG} + Dim tcNote = {column(niA8).cNote, column(niA9).cNote} + Dim tcLNote = {column(niA8).cLNote, column(niA9).cLNote} + Dim tcText = {column(niA8).cText, column(niA9).cText} + Dim tcLText = {column(niA8).cLText, column(niA9).cLText} + Dim tWidth = {column(niA8).Width, column(niA9).Width} + Dim tVisible = {column(niA8).isVisible, column(niA9).isVisible} + tLeft(9) = tLeft(7) + tLeft(10) = tLeft(8) + For i = 6 To 0 Step -1 + column(niA1 + i + 2).Title = column(niA1 + i).Title + column(niA1 + i + 2).cBG = column(niA1 + i).cBG + column(niA1 + i + 2).cText = column(niA1 + i).cText + column(niA1 + i + 2).cLText = column(niA1 + i).cLText + column(niA1 + i + 2).setNoteColor(column(niA1 + i).cNote) + column(niA1 + i + 2).setLNoteColor(column(niA1 + i).cLNote) + column(niA1 + i + 2).isVisible = column(niA1 + i).isVisible + column(niA1 + i + 2).Width = column(niA1 + i).Width + tLeft(i + 2) = tLeft(i) + Next + column(niA1).Title = tTitle(0) + column(niA1).cBG = tcBG(0) + column(niA1).cText = tcText(0) + column(niA1).cLText = tcLText(0) + column(niA1).setNoteColor(tcNote(0)) + column(niA1).setLNoteColor(tcLNote(0)) + column(niA1).isVisible = tVisible(0) + column(niA1).Width = tWidth(0) + column(niA2).Title = tTitle(1) + column(niA2).cBG = tcBG(1) + column(niA2).cText = tcText(1) + column(niA2).cLText = tcLText(1) + column(niA2).setNoteColor(tcNote(1)) + column(niA2).setLNoteColor(tcLNote(1)) + column(niA2).isVisible = tVisible(1) + column(niA2).Width = tWidth(1) + tLeft(0) = tLeft(9) + tLeft(1) = tLeft(10) + End If + For i = 0 To 8 Step 1 + column(niA1 + i + 1).Left = column(niA1 + i).Left + tLeft(i) + Next + End Sub - Private Function GetColumn(iCol As Integer) As Column - If iCol < niB Then Return column(iCol) Else Return column(niB) - End Function + Private Function GetColumn(iCol As Integer) As Column + If iCol < niB Then Return column(iCol) Else Return column(niB) + End Function - Private Function BMSEChannelToColumnIndex(I As String) - Dim Ivalue = Val(I) - If Ivalue > 100 Then - Return niB + Ivalue - 101 - ElseIf Ivalue < 100 And Ivalue > 0 Then - Return BMSChannelToColumn(Mid(I, 2, 2)) - End If - Return niB ' ??? how did a negative number get here? - End Function + Private Function BMSEChannelToColumnIndex(I As String) + Dim Ivalue = Val(I) + If Ivalue > 100 Then + Return niB + Ivalue - 101 + ElseIf Ivalue < 100 And Ivalue > 0 Then + Return BMSChannelToColumn(Mid(I, 2, 2)) + End If + Return niB ' ??? how did a negative number get here? + End Function - Private Function BMSChannelToColumn(I As String) As Integer - Dim result As Integer = 0 - Select Case I - Case "01" : Return niB - Case "03", "08" : Return niBPM - Case "09" : Return niSTOP - Case "SC" : Return niSCROLL - Case "04" : Return niBGA - Case "07" : Return niLAYER - Case "06" : Return niPOOR + Private Function BMSChannelToColumn(I As String) As Integer + Dim result As Integer = 0 + Select Case I + Case "01" : Return niB + Case "03", "08" : Return niBPM + Case "09" : Return niSTOP + Case "SC" : Return niSCROLL + Case "04" : Return niBGA + Case "07" : Return niLAYER + Case "06" : Return niPOOR - Case "11", "31", "51", "71", "D1" : result = niA3 - Case "12", "32", "52", "72", "D2" : result = niA4 - Case "13", "33", "53", "73", "D3" : result = niA5 - Case "14", "34", "54", "74", "D4" : result = niA6 - Case "15", "35", "55", "75", "D5" : result = niA7 - Case "16", "36", "56", "76", "D6" : result = niA1 - Case "17", "37", "57", "77", "D7" : result = niA2 - Case "18", "38", "58", "78", "D8" : result = niA8 - Case "19", "39", "59", "79", "D9" : result = niA9 - Case "1A", "3A", "5A", "7A", "DA" : result = niAA - Case "1B", "3B", "5B", "7B", "DB" : result = niAB - Case "1C", "3C", "5C", "7C", "DC" : result = niAC - Case "1D", "3D", "5D", "7D", "DD" : result = niAD - Case "1E", "3E", "5E", "7E", "DE" : result = niAE - Case "1F", "3F", "5F", "7F", "DF" : result = niAF - Case "1G", "3G", "5G", "7G", "DG" : result = niAG - Case "1H", "3H", "5H", "7H", "DH" : result = niAH - Case "1I", "3I", "5I", "7I", "DI" : result = niAI - Case "1J", "3J", "5J", "7J", "DJ" : result = niAJ - Case "1K", "3K", "5K", "7K", "DK" : result = niAK - Case "1L", "3L", "5L", "7L", "DL" : result = niAL - Case "1M", "3M", "5M", "7M", "DM" : result = niAM - Case "1N", "3N", "5N", "7N", "DN" : result = niAN - Case "1O", "3O", "5O", "7O", "DO" : result = niAO - Case "1P", "3P", "5P", "7P", "DP" : result = niAP - Case "1Q", "3Q", "5Q", "7Q", "DQ" : result = niAQ + Case "11", "31", "51", "71", "D1" : result = niA3 + Case "12", "32", "52", "72", "D2" : result = niA4 + Case "13", "33", "53", "73", "D3" : result = niA5 + Case "14", "34", "54", "74", "D4" : result = niA6 + Case "15", "35", "55", "75", "D5" : result = niA7 + Case "16", "36", "56", "76", "D6" : result = niA1 + Case "17", "37", "57", "77", "D7" : result = niA2 + Case "18", "38", "58", "78", "D8" : result = niA8 + Case "19", "39", "59", "79", "D9" : result = niA9 + Case "1A", "3A", "5A", "7A", "DA" : result = niAA + Case "1B", "3B", "5B", "7B", "DB" : result = niAB + Case "1C", "3C", "5C", "7C", "DC" : result = niAC + Case "1D", "3D", "5D", "7D", "DD" : result = niAD + Case "1E", "3E", "5E", "7E", "DE" : result = niAE + Case "1F", "3F", "5F", "7F", "DF" : result = niAF + Case "1G", "3G", "5G", "7G", "DG" : result = niAG + Case "1H", "3H", "5H", "7H", "DH" : result = niAH + Case "1I", "3I", "5I", "7I", "DI" : result = niAI + Case "1J", "3J", "5J", "7J", "DJ" : result = niAJ + Case "1K", "3K", "5K", "7K", "DK" : result = niAK + Case "1L", "3L", "5L", "7L", "DL" : result = niAL + Case "1M", "3M", "5M", "7M", "DM" : result = niAM + Case "1N", "3N", "5N", "7N", "DN" : result = niAN + Case "1O", "3O", "5O", "7O", "DO" : result = niAO + Case "1P", "3P", "5P", "7P", "DP" : result = niAP + Case "1Q", "3Q", "5Q", "7Q", "DQ" : result = niAQ - Case "21", "41", "61", "81", "E1" : result = niD1 - Case "22", "42", "62", "82", "E2" : result = niD2 - Case "23", "43", "63", "83", "E3" : result = niD3 - Case "24", "44", "64", "84", "E4" : result = niD4 - Case "25", "45", "65", "85", "E5" : result = niD5 - Case "26", "46", "66", "86", "E6" : result = niDP - Case "27", "47", "67", "87", "E7" : result = niDQ - Case "28", "48", "68", "88", "E8" : result = niD6 - Case "29", "49", "69", "89", "E9" : result = niD7 - Case "2A", "4A", "6A", "8A", "EA" : result = niD8 - Case "2B", "4B", "6B", "8B", "EB" : result = niD9 - Case "2C", "4C", "6C", "8C", "EC" : result = niDA - Case "2D", "4D", "6D", "8D", "ED" : result = niDB - Case "2E", "4E", "6E", "8E", "EE" : result = niDC - Case "2F", "4F", "6F", "8F", "EF" : result = niDD - Case "2G", "4G", "6G", "8G", "EG" : result = niDE - Case "2H", "4H", "6H", "8H", "EH" : result = niDF - Case "2I", "4I", "6I", "8I", "EI" : result = niDG - Case "2J", "4J", "6J", "8J", "EJ" : result = niDH - Case "2K", "4K", "6K", "8K", "EK" : result = niDI - Case "2L", "4L", "6L", "8L", "EL" : result = niDJ - Case "2M", "4M", "6M", "8M", "EM" : result = niDK - Case "2N", "4N", "6N", "8N", "EN" : result = niDL - Case "2O", "4O", "6O", "8O", "EO" : result = niDM - Case "2P", "4P", "6P", "8P", "EP" : result = niDN - Case "2Q", "4Q", "6Q", "8Q", "EQ" : result = niDO - End Select - If Rscratch Then - If result = niA2 Then - result = niA9 - ElseIf result >= niA3 AndAlso result <= niA9 Then - result -= 1 - End If - End If - Return result - End Function + Case "21", "41", "61", "81", "E1" : result = niD1 + Case "22", "42", "62", "82", "E2" : result = niD2 + Case "23", "43", "63", "83", "E3" : result = niD3 + Case "24", "44", "64", "84", "E4" : result = niD4 + Case "25", "45", "65", "85", "E5" : result = niD5 + Case "26", "46", "66", "86", "E6" : result = niDP + Case "27", "47", "67", "87", "E7" : result = niDQ + Case "28", "48", "68", "88", "E8" : result = niD6 + Case "29", "49", "69", "89", "E9" : result = niD7 + Case "2A", "4A", "6A", "8A", "EA" : result = niD8 + Case "2B", "4B", "6B", "8B", "EB" : result = niD9 + Case "2C", "4C", "6C", "8C", "EC" : result = niDA + Case "2D", "4D", "6D", "8D", "ED" : result = niDB + Case "2E", "4E", "6E", "8E", "EE" : result = niDC + Case "2F", "4F", "6F", "8F", "EF" : result = niDD + Case "2G", "4G", "6G", "8G", "EG" : result = niDE + Case "2H", "4H", "6H", "8H", "EH" : result = niDF + Case "2I", "4I", "6I", "8I", "EI" : result = niDG + Case "2J", "4J", "6J", "8J", "EJ" : result = niDH + Case "2K", "4K", "6K", "8K", "EK" : result = niDI + Case "2L", "4L", "6L", "8L", "EL" : result = niDJ + Case "2M", "4M", "6M", "8M", "EM" : result = niDK + Case "2N", "4N", "6N", "8N", "EN" : result = niDL + Case "2O", "4O", "6O", "8O", "EO" : result = niDM + Case "2P", "4P", "6P", "8P", "EP" : result = niDN + Case "2Q", "4Q", "6Q", "8Q", "EQ" : result = niDO + End Select + If Rscratch Then + If result = niA2 Then + result = niA9 + ElseIf result >= niA3 AndAlso result <= niA9 Then + result -= 1 + End If + End If + Return result + End Function End Class diff --git a/iBMSC/EditorPersistent.vb b/iBMSC/EditorPersistent.vb index 262be104d..0c9df35f2 100644 --- a/iBMSC/EditorPersistent.vb +++ b/iBMSC/EditorPersistent.vb @@ -2,1323 +2,1323 @@ Partial Public Class MainWindow - Private Sub XMLWriteColumn(w As XmlTextWriter, I As Integer) - w.WriteStartElement("Column") - w.WriteAttributeString("Index", I) - With column(I) - 'w.WriteAttributeString("Left", .Left) - w.WriteAttributeString("Width", .Width) - w.WriteAttributeString("Title", .Title) - w.WriteAttributeString("Display", .isVisible) - 'w.WriteAttributeString("Text", .Text) - 'w.WriteAttributeString("Enabled", .Enabled) - 'w.WriteAttributeString("isNumeric", .isNumeric) - 'w.WriteAttributeString("Visible", .Visible) - 'w.WriteAttributeString("Identifier", .Identifier) - w.WriteAttributeString("NoteColor", .cNote) - w.WriteAttributeString("TextColor", .cText.ToArgb) - w.WriteAttributeString("LongNoteColor", .cLNote) - w.WriteAttributeString("LongTextColor", .cLText.ToArgb) - w.WriteAttributeString("BG", .cBG.ToArgb) - End With - w.WriteEndElement() - End Sub - - Private Sub XMLWriteFont(w As XmlTextWriter, local As String, f As Font) - w.WriteStartElement(local) - w.WriteAttributeString("Name", f.FontFamily.Name) - w.WriteAttributeString("Size", f.SizeInPoints) - w.WriteAttributeString("Style", f.Style) - w.WriteEndElement() - End Sub - - Private Sub XMLWritePlayerArguments(w As XmlTextWriter, I As Integer) - w.WriteStartElement("Player") - w.WriteAttributeString("Index", I) - w.WriteAttributeString("Path", pArgs(I).Path) - w.WriteAttributeString("FromBeginning", pArgs(I).aBegin) - w.WriteAttributeString("FromHere", pArgs(I).aHere) - w.WriteAttributeString("Stop", pArgs(I).aStop) - w.WriteEndElement() - End Sub - - Private Sub SaveSettings(Path As String, ThemeOnly As Boolean) - Dim w As New XmlTextWriter(Path, System.Text.Encoding.Unicode) - With w - .WriteStartDocument() - .Formatting = Formatting.Indented - .Indentation = 4 - - .WriteStartElement("iBMSC") - .WriteAttributeString("Major", My.Application.Info.Version.Major) - .WriteAttributeString("Minor", My.Application.Info.Version.Minor) - .WriteAttributeString("Build", My.Application.Info.Version.Build) - - If ThemeOnly Then GoTo 5000 - - .WriteStartElement("Form") - .WriteAttributeString("WindowState", IIf(isFullScreen, previousWindowState, WindowState)) - .WriteAttributeString("Width", IIf(isFullScreen, previousWindowPosition.Width, Width)) - .WriteAttributeString("Height", IIf(isFullScreen, previousWindowPosition.Height, Height)) - .WriteAttributeString("Top", IIf(isFullScreen, previousWindowPosition.Top, Top)) - .WriteAttributeString("Left", IIf(isFullScreen, previousWindowPosition.Left, Left)) - .WriteEndElement() - - .WriteStartElement("Recent") - .WriteAttributeString("Recent0", Recent(0)) - .WriteAttributeString("Recent1", Recent(1)) - .WriteAttributeString("Recent2", Recent(2)) - .WriteAttributeString("Recent3", Recent(3)) - .WriteAttributeString("Recent4", Recent(4)) - .WriteEndElement() - - .WriteStartElement("Edit") - .WriteAttributeString("NTInput", NTInput) - .WriteAttributeString("Language", DispLang) - '.WriteAttributeString("SortingMethod", SortingMethod) - .WriteAttributeString("ErrorCheck", ErrorCheck) - .WriteAttributeString("AutoFocusMouseEnter", AutoFocusMouseEnter) - .WriteAttributeString("FirstClickDisabled", FirstClickDisabled) - .WriteAttributeString("ShowFileName", ShowFileName) - .WriteAttributeString("ChangePlaySide", Rscratch) - .WriteAttributeString("MiddleButtonMoveMethod", MiddleButtonMoveMethod) - .WriteAttributeString("AutoSaveInterval", AutoSaveInterval) - .WriteAttributeString("PreviewOnClick", PreviewOnClick) - '.WriteAttributeString("PreviewErrorCheck", PreviewErrorCheck) - .WriteAttributeString("ClickStopPreview", ClickStopPreview) - .WriteEndElement() - - .WriteStartElement("Save") - .WriteAttributeString("TextEncoding", EncodingToString(TextEncoding)) - .WriteAttributeString("BMSGridLimit", BMSGridLimit) - .WriteAttributeString("BeepWhileSaved", BeepWhileSaved) - .WriteAttributeString("BPMx1296", BPMx1296) - .WriteAttributeString("STOPx1296", STOPx1296) - .WriteEndElement() - - .WriteStartElement("WAV") - .WriteAttributeString("WAVMultiSelect", WAVMultiSelect) - .WriteAttributeString("WAVChangeLabel", WAVChangeLabel) - .WriteAttributeString("WAVEmptyfill", WAVEmptyfill) - .WriteAttributeString("BeatChangeMode", BeatChangeMode) - .WriteEndElement() - - .WriteStartElement("ShowHide") - .WriteAttributeString("showMenu", mnSMenu.Checked) - .WriteAttributeString("showTB", mnSTB.Checked) - .WriteAttributeString("showOpPanel", mnSOP.Checked) - .WriteAttributeString("showStatus", mnSStatus.Checked) - .WriteAttributeString("showLSplit", mnSLSplitter.Checked) - .WriteAttributeString("showRSplit", mnSRSplitter.Checked) - .WriteEndElement() - - .WriteStartElement("Grid") - .WriteAttributeString("gSnap", gSnap) - .WriteAttributeString("gDisableVertical", DisableVerticalMove) - .WriteAttributeString("gWheel", gWheel) - .WriteAttributeString("gPgUpDn", gPgUpDn) - .WriteAttributeString("gShow", gShowGrid) - .WriteAttributeString("gShowS", gShowSubGrid) - .WriteAttributeString("gShowBG", gShowBG) - .WriteAttributeString("gShowM", gShowMeasureNumber) - .WriteAttributeString("gShowV", gShowVerticalLine) - .WriteAttributeString("gShowMB", gShowMeasureBar) - .WriteAttributeString("gShowC", gShowC) - .WriteAttributeString("gBPM", gBPM) - .WriteAttributeString("gSTOP", gSTOP) - .WriteAttributeString("gSCROLL", gSCROLL) - .WriteAttributeString("gBLP", gDisplayBGAColumn) - .WriteAttributeString("gP2", CHPlayer.SelectedIndex) - .WriteAttributeString("gCol", CGB.Value) - .WriteAttributeString("gDivide", gDivide) - .WriteAttributeString("gSub", gSub) - .WriteAttributeString("gSlash", gSlash) - .WriteAttributeString("gxHeight", gxHeight) - .WriteAttributeString("gxWidth", gxWidth) - .WriteEndElement() - - .WriteStartElement("WaveForm") - .WriteAttributeString("wLock", wLock) - .WriteAttributeString("wPosition", wPosition) - .WriteAttributeString("wLeft", wLeft) - .WriteAttributeString("wWidth", wWidth) - .WriteAttributeString("wPrecision", wPrecision) - .WriteEndElement() - - .WriteStartElement("Player") - .WriteAttributeString("Count", pArgs.Length) - .WriteAttributeString("CurrentPlayer", CurrentPlayer) - For i As Integer = 0 To UBound(pArgs) - XMLWritePlayerArguments(w, i) : Next - .WriteEndElement() + Private Sub XMLWriteColumn(w As XmlTextWriter, I As Integer) + w.WriteStartElement("Column") + w.WriteAttributeString("Index", I) + With column(I) + 'w.WriteAttributeString("Left", .Left) + w.WriteAttributeString("Width", .Width) + w.WriteAttributeString("Title", .Title) + w.WriteAttributeString("Display", .isVisible) + 'w.WriteAttributeString("Text", .Text) + 'w.WriteAttributeString("Enabled", .Enabled) + 'w.WriteAttributeString("isNumeric", .isNumeric) + 'w.WriteAttributeString("Visible", .Visible) + 'w.WriteAttributeString("Identifier", .Identifier) + w.WriteAttributeString("NoteColor", .cNote) + w.WriteAttributeString("TextColor", .cText.ToArgb) + w.WriteAttributeString("LongNoteColor", .cLNote) + w.WriteAttributeString("LongTextColor", .cLText.ToArgb) + w.WriteAttributeString("BG", .cBG.ToArgb) + End With + w.WriteEndElement() + End Sub + + Private Sub XMLWriteFont(w As XmlTextWriter, local As String, f As Font) + w.WriteStartElement(local) + w.WriteAttributeString("Name", f.FontFamily.Name) + w.WriteAttributeString("Size", f.SizeInPoints) + w.WriteAttributeString("Style", f.Style) + w.WriteEndElement() + End Sub + + Private Sub XMLWritePlayerArguments(w As XmlTextWriter, I As Integer) + w.WriteStartElement("Player") + w.WriteAttributeString("Index", I) + w.WriteAttributeString("Path", pArgs(I).Path) + w.WriteAttributeString("FromBeginning", pArgs(I).aBegin) + w.WriteAttributeString("FromHere", pArgs(I).aHere) + w.WriteAttributeString("Stop", pArgs(I).aStop) + w.WriteEndElement() + End Sub + + Private Sub SaveSettings(Path As String, ThemeOnly As Boolean) + Dim w As New XmlTextWriter(Path, System.Text.Encoding.Unicode) + With w + .WriteStartDocument() + .Formatting = Formatting.Indented + .Indentation = 4 + + .WriteStartElement("iBMSC") + .WriteAttributeString("Major", My.Application.Info.Version.Major) + .WriteAttributeString("Minor", My.Application.Info.Version.Minor) + .WriteAttributeString("Build", My.Application.Info.Version.Build) + + If ThemeOnly Then GoTo 5000 + + .WriteStartElement("Form") + .WriteAttributeString("WindowState", IIf(isFullScreen, previousWindowState, WindowState)) + .WriteAttributeString("Width", IIf(isFullScreen, previousWindowPosition.Width, Width)) + .WriteAttributeString("Height", IIf(isFullScreen, previousWindowPosition.Height, Height)) + .WriteAttributeString("Top", IIf(isFullScreen, previousWindowPosition.Top, Top)) + .WriteAttributeString("Left", IIf(isFullScreen, previousWindowPosition.Left, Left)) + .WriteEndElement() + + .WriteStartElement("Recent") + .WriteAttributeString("Recent0", Recent(0)) + .WriteAttributeString("Recent1", Recent(1)) + .WriteAttributeString("Recent2", Recent(2)) + .WriteAttributeString("Recent3", Recent(3)) + .WriteAttributeString("Recent4", Recent(4)) + .WriteEndElement() + + .WriteStartElement("Edit") + .WriteAttributeString("NTInput", NTInput) + .WriteAttributeString("Language", DispLang) + '.WriteAttributeString("SortingMethod", SortingMethod) + .WriteAttributeString("ErrorCheck", ErrorCheck) + .WriteAttributeString("AutoFocusMouseEnter", AutoFocusMouseEnter) + .WriteAttributeString("FirstClickDisabled", FirstClickDisabled) + .WriteAttributeString("ShowFileName", ShowFileName) + .WriteAttributeString("ChangePlaySide", Rscratch) + .WriteAttributeString("MiddleButtonMoveMethod", MiddleButtonMoveMethod) + .WriteAttributeString("AutoSaveInterval", AutoSaveInterval) + .WriteAttributeString("PreviewOnClick", PreviewOnClick) + '.WriteAttributeString("PreviewErrorCheck", PreviewErrorCheck) + .WriteAttributeString("ClickStopPreview", ClickStopPreview) + .WriteEndElement() + + .WriteStartElement("Save") + .WriteAttributeString("TextEncoding", EncodingToString(TextEncoding)) + .WriteAttributeString("BMSGridLimit", BMSGridLimit) + .WriteAttributeString("BeepWhileSaved", BeepWhileSaved) + .WriteAttributeString("BPMx1296", BPMx1296) + .WriteAttributeString("STOPx1296", STOPx1296) + .WriteEndElement() + + .WriteStartElement("WAV") + .WriteAttributeString("WAVMultiSelect", WAVMultiSelect) + .WriteAttributeString("WAVChangeLabel", WAVChangeLabel) + .WriteAttributeString("WAVEmptyfill", WAVEmptyfill) + .WriteAttributeString("BeatChangeMode", BeatChangeMode) + .WriteEndElement() + + .WriteStartElement("ShowHide") + .WriteAttributeString("showMenu", mnSMenu.Checked) + .WriteAttributeString("showTB", mnSTB.Checked) + .WriteAttributeString("showOpPanel", mnSOP.Checked) + .WriteAttributeString("showStatus", mnSStatus.Checked) + .WriteAttributeString("showLSplit", mnSLSplitter.Checked) + .WriteAttributeString("showRSplit", mnSRSplitter.Checked) + .WriteEndElement() + + .WriteStartElement("Grid") + .WriteAttributeString("gSnap", gSnap) + .WriteAttributeString("gDisableVertical", DisableVerticalMove) + .WriteAttributeString("gWheel", gWheel) + .WriteAttributeString("gPgUpDn", gPgUpDn) + .WriteAttributeString("gShow", gShowGrid) + .WriteAttributeString("gShowS", gShowSubGrid) + .WriteAttributeString("gShowBG", gShowBG) + .WriteAttributeString("gShowM", gShowMeasureNumber) + .WriteAttributeString("gShowV", gShowVerticalLine) + .WriteAttributeString("gShowMB", gShowMeasureBar) + .WriteAttributeString("gShowC", gShowC) + .WriteAttributeString("gBPM", gBPM) + .WriteAttributeString("gSTOP", gSTOP) + .WriteAttributeString("gSCROLL", gSCROLL) + .WriteAttributeString("gBLP", gDisplayBGAColumn) + .WriteAttributeString("gP2", CHPlayer.SelectedIndex) + .WriteAttributeString("gCol", CGB.Value) + .WriteAttributeString("gDivide", gDivide) + .WriteAttributeString("gSub", gSub) + .WriteAttributeString("gSlash", gSlash) + .WriteAttributeString("gxHeight", gxHeight) + .WriteAttributeString("gxWidth", gxWidth) + .WriteEndElement() + + .WriteStartElement("WaveForm") + .WriteAttributeString("wLock", wLock) + .WriteAttributeString("wPosition", wPosition) + .WriteAttributeString("wLeft", wLeft) + .WriteAttributeString("wWidth", wWidth) + .WriteAttributeString("wPrecision", wPrecision) + .WriteEndElement() + + .WriteStartElement("Player") + .WriteAttributeString("Count", pArgs.Length) + .WriteAttributeString("CurrentPlayer", CurrentPlayer) + For i As Integer = 0 To UBound(pArgs) + XMLWritePlayerArguments(w, i) : Next + .WriteEndElement() 5000: .WriteStartElement("Columns") - '.WriteAttributeString("Count", col.Length) - For i As Integer = 0 To UBound(column) - XMLWriteColumn(w, i) : Next - .WriteEndElement() - - .WriteStartElement("VisualSettings") - XMLWriteValue(w, "ColumnTitle", vo.ColumnTitle.Color.ToArgb) - XMLWriteFont(w, "ColumnTitleFont", vo.ColumnTitleFont) - XMLWriteValue(w, "Bg", vo.Bg.Color.ToArgb) - XMLWriteValue(w, "Grid", vo.pGrid.Color.ToArgb) - XMLWriteValue(w, "Sub", vo.pSub.Color.ToArgb) - XMLWriteValue(w, "VLine", vo.pVLine.Color.ToArgb) - XMLWriteValue(w, "MLine", vo.pMLine.Color.ToArgb) - XMLWriteValue(w, "BGMWav", vo.pBGMWav.Color.ToArgb) - XMLWriteValue(w, "SelBox", vo.SelBox.Color.ToArgb) - XMLWriteValue(w, "TSCursor", vo.PECursor.Color.ToArgb) - XMLWriteValue(w, "TSHalf", vo.PEHalf.Color.ToArgb) - XMLWriteValue(w, "TSDeltaMouseOver", vo.PEDeltaMouseOver) - XMLWriteValue(w, "TSMouseOver", vo.PEMouseOver.Color.ToArgb) - XMLWriteValue(w, "TSSel", vo.PESel.Color.ToArgb) - XMLWriteValue(w, "TSBPM", vo.PEBPM.Color.ToArgb) - XMLWriteFont(w, "TSBPMFont", vo.PEBPMFont) - XMLWriteValue(w, "MiddleDeltaRelease", vo.MiddleDeltaRelease) - XMLWriteValue(w, "kHeight", vo.kHeight) - XMLWriteFont(w, "kFont", vo.kFont) - XMLWriteFont(w, "kMFont", vo.kMFont) - XMLWriteValue(w, "kLabelVShift", vo.kLabelVShift) - XMLWriteValue(w, "kLabelHShift", vo.kLabelHShift) - XMLWriteValue(w, "kLabelHShiftL", vo.kLabelHShiftL) - XMLWriteValue(w, "kMouseOver", vo.kMouseOver.Color.ToArgb) - XMLWriteValue(w, "kMouseOverE", vo.kMouseOverE.Color.ToArgb) - XMLWriteValue(w, "kSelected", vo.kSelected.Color.ToArgb) - XMLWriteValue(w, "kOpacity", vo.kOpacity) - .WriteEndElement() - - .WriteEndElement() - .WriteEndDocument() - .Close() - End With - End Sub - - Private Sub XMLLoadElementValue(n As XmlElement, ByRef v As Integer) - If n Is Nothing Then Exit Sub - XMLLoadAttribute(n.GetAttribute("Value"), v) - End Sub - Private Sub XMLLoadElementValue(n As XmlElement, ByRef v As Single) - If n Is Nothing Then Exit Sub - XMLLoadAttribute(n.GetAttribute("Value"), v) - End Sub - Private Sub XMLLoadElementValue(n As XmlElement, ByRef v As Color) - If n Is Nothing Then Exit Sub - XMLLoadAttribute(n.GetAttribute("Value"), v) - End Sub - - Private Sub XMLLoadElementValue(n As XmlElement, ByRef v As Font) - If n Is Nothing Then Exit Sub - - Dim xName As String = Font.FontFamily.Name - Dim xSize As Integer = Font.Size - Dim xStyle As Integer = Font.Style - XMLLoadAttribute(n.GetAttribute("Name"), xName) - XMLLoadAttribute(n.GetAttribute("Size"), xSize) - XMLLoadAttribute(n.GetAttribute("Style"), xStyle) - 'v = New Font(xName, xSize, xStyle) - End Sub - - Private Sub XMLLoadPlayer(n As XmlElement) - Dim i As Integer = -1 - XMLLoadAttribute(n.GetAttribute("Index"), i) - If i < 0 Or i > UBound(pArgs) Then Exit Sub - - XMLLoadAttribute(n.GetAttribute("Path"), pArgs(i).Path) - XMLLoadAttribute(n.GetAttribute("FromBeginning"), pArgs(i).aBegin) - XMLLoadAttribute(n.GetAttribute("FromHere"), pArgs(i).aHere) - XMLLoadAttribute(n.GetAttribute("Stop"), pArgs(i).aStop) - End Sub - - Private Sub XMLLoadColumn(n As XmlElement) - Dim i As Integer = -1 - XMLLoadAttribute(n.GetAttribute("Index"), i) - If i < 0 Or i > UBound(column) Then Exit Sub - - With column(i) - 'XMLLoadAttribute(n.GetAttribute("Left"), .Left) - XMLLoadAttribute(n.GetAttribute("Width"), .Width) - XMLLoadAttribute(n.GetAttribute("Title"), .Title) - 'XMLLoadAttribute(n.GetAttribute("Text"), .Text) - Dim Display As Boolean - Dim attr = n.GetAttribute("Display") - XMLLoadAttribute(attr, Display) - .isVisible = IIf(String.IsNullOrEmpty(attr), .isVisible, Display) - - 'XMLLoadAttribute(n.GetAttribute("isNumeric"), .isNumeric) - 'XMLLoadAttribute(n.GetAttribute("Visible"), .Visible) - 'XMLLoadAttribute(n.GetAttribute("Identifier"), .Identifier) - XMLLoadAttribute(n.GetAttribute("NoteColor"), .cNote) - .setNoteColor(.cNote) - XMLLoadAttribute(n.GetAttribute("TextColor"), .cText) - XMLLoadAttribute(n.GetAttribute("LongNoteColor"), .cLNote) - .setLNoteColor(.cLNote) - XMLLoadAttribute(n.GetAttribute("LongTextColor"), .cLText) - XMLLoadAttribute(n.GetAttribute("BG"), .cBG) - End With - End Sub - - Private Sub LoadSettings(Path As String) - If Not My.Computer.FileSystem.FileExists(Path) Then Return - - 'Dim xTempFileName As String = "" - 'Do - 'Try - 'xTempFileName = Me.RandomFileName(".xml") - 'File.Copy(Path, xTempFileName) - 'Catch - 'Continue Do - 'End Try - 'Exit Do - 'Loop - Dim Doc As New XmlDocument - Dim FileStream As New FileStream(Path, FileMode.Open, FileAccess.Read) - Doc.Load(FileStream) - - Dim Root As XmlElement = Doc.Item("iBMSC") - If Root Is Nothing Then GoTo EndOfSub - - 'version - Dim Major As Integer = My.Application.Info.Version.Major - Dim Minor As Integer = My.Application.Info.Version.Minor - Dim Build As Integer = My.Application.Info.Version.Build - Try - Dim xMajor As Integer = Val(Root.Attributes("Major").Value) - Dim xMinor As Integer = Val(Root.Attributes("Minor").Value) - Dim xBuild As Integer = Val(Root.Attributes("Build").Value) - Major = xMajor - Minor = xMinor - Build = xBuild - Catch ex As Exception - End Try - - 'form - Dim eForm As XmlElement = Root.Item("Form") - If eForm IsNot Nothing Then - With eForm - Select Case Val(.GetAttribute("WindowState")) - Case FormWindowState.Normal - WindowState = FormWindowState.Normal - XMLLoadAttribute(.GetAttribute("Width"), Width) - XMLLoadAttribute(.GetAttribute("Height"), Height) - XMLLoadAttribute(.GetAttribute("Top"), Top) - XMLLoadAttribute(.GetAttribute("Left"), Left) - Case FormWindowState.Maximized - WindowState = FormWindowState.Maximized - End Select - End With - End If - - 'recent - Dim eRecent As XmlElement = Root.Item("Recent") - If eRecent IsNot Nothing Then - With eRecent - XMLLoadAttribute(.GetAttribute("Recent0"), Recent(0)) : SetRecent(0, Recent(0)) - XMLLoadAttribute(.GetAttribute("Recent1"), Recent(1)) : SetRecent(1, Recent(1)) - XMLLoadAttribute(.GetAttribute("Recent2"), Recent(2)) : SetRecent(2, Recent(2)) - XMLLoadAttribute(.GetAttribute("Recent3"), Recent(3)) : SetRecent(3, Recent(3)) - XMLLoadAttribute(.GetAttribute("Recent4"), Recent(4)) : SetRecent(4, Recent(4)) - End With - End If - - 'edit - Dim eEdit As XmlElement = Root.Item("Edit") - If eEdit IsNot Nothing Then - With eEdit - XMLLoadAttribute(.GetAttribute("NTInput"), NTInput) - TBNTInput.Checked = NTInput - mnNTInput.Checked = NTInput - POBLong.Enabled = Not NTInput - POBLongShort.Enabled = Not NTInput - - LoadLocale(My.Application.Info.DirectoryPath & "\" & .GetAttribute("Language")) - - 'XMLLoadAttribute(.GetAttribute("SortingMethod"), SortingMethod) - - XMLLoadAttribute(.GetAttribute("ErrorCheck"), ErrorCheck) - TBErrorCheck.Checked = ErrorCheck - TBErrorCheck_Click(TBErrorCheck, New EventArgs) - - XMLLoadAttribute(.GetAttribute("ShowFileName"), ShowFileName) - TBShowFileName.Checked = ShowFileName - TBShowFileName_Click(TBShowFileName, New EventArgs) - - XMLLoadAttribute(.GetAttribute("MiddleButtonMoveMethod"), MiddleButtonMoveMethod) - XMLLoadAttribute(.GetAttribute("AutoFocusMouseEnter"), AutoFocusMouseEnter) - XMLLoadAttribute(.GetAttribute("FirstClickDisabled"), FirstClickDisabled) - - XMLLoadAttribute(.GetAttribute("AutoSaveInterval"), AutoSaveInterval) - If AutoSaveInterval Then AutoSaveTimer.Interval = AutoSaveInterval Else AutoSaveTimer.Enabled = False - - XMLLoadAttribute(.GetAttribute("PreviewOnClick"), PreviewOnClick) - TBPreviewOnClick.Checked = PreviewOnClick - TBPreviewOnClick_Click(TBPreviewOnClick, New EventArgs) - - XMLLoadAttribute(.GetAttribute("ChangePlaySide"), Rscratch) - TBChangePlaySide.Checked = Rscratch - TBChangePlaySide_Click(TBChangePlaySide, New EventArgs) - - XMLLoadAttribute(.GetAttribute("ClickStopPreview"), ClickStopPreview) - End With - End If - - 'save - Dim eSave As XmlElement = Root.Item("Save") - If eSave IsNot Nothing Then - With eSave - Select Case UCase(.GetAttribute("TextEncoding")) - Case "SYSTEM ANSI" : TextEncoding = System.Text.Encoding.Default - Case "LITTLE ENDIAN UTF16" : TextEncoding = System.Text.Encoding.Unicode - Case "ASCII" : TextEncoding = System.Text.Encoding.ASCII - Case "BIG ENDIAN UTF16" : TextEncoding = System.Text.Encoding.BigEndianUnicode - Case "LITTLE ENDIAN UTF32" : TextEncoding = System.Text.Encoding.UTF32 - 'Case "UTF7" : TextEncoding = System.Text.Encoding.UTF7 - Case "UTF8" : TextEncoding = System.Text.Encoding.UTF8 - Case "SJIS" : TextEncoding = System.Text.Encoding.GetEncoding(932) - Case "EUC-KR" : TextEncoding = System.Text.Encoding.GetEncoding(51949) - ' leave current encoding - ' Case Else - End Select - - XMLLoadAttribute(.GetAttribute("BMSGridLimit"), BMSGridLimit) - XMLLoadAttribute(.GetAttribute("BeepWhileSaved"), BeepWhileSaved) - XMLLoadAttribute(.GetAttribute("BPMx1296"), BPMx1296) - XMLLoadAttribute(.GetAttribute("STOPx1296"), STOPx1296) - End With - End If - - 'WAV - Dim eWAV As XmlElement = Root.Item("WAV") - If eWAV IsNot Nothing Then - With eWAV - XMLLoadAttribute(.GetAttribute("WAVMultiSelect"), WAVMultiSelect) - CWAVMultiSelect.Checked = WAVMultiSelect - CWAVMultiSelect_CheckedChanged(CWAVMultiSelect, New EventArgs) - - XMLLoadAttribute(.GetAttribute("WAVChangeLabel"), WAVChangeLabel) - CWAVChangeLabel.Checked = WAVChangeLabel - CWAVChangeLabel_CheckedChanged(CWAVChangeLabel, New EventArgs) - - XMLLoadAttribute(.GetAttribute("WAVEmptyfill"), WAVEmptyfill) - CWAVEmptyfill.Checked = WAVEmptyfill - CWAVEmptyfill_CheckedChanged(CWAVEmptyfill, New EventArgs) - - Dim xInt As Integer = .GetAttribute("BeatChangeMode") - Dim xBeatOpList As RadioButton() = {CBeatPreserve, CBeatMeasure, CBeatCut, CBeatScale} - If xInt >= 0 And xInt < xBeatOpList.Length Then - xBeatOpList(xInt).Checked = True - CBeatPreserve_Click(xBeatOpList(xInt), New EventArgs) - End If - End With - End If - - 'ShowHide - Dim eShowHide As XmlElement = Root.Item("ShowHide") - If eShowHide IsNot Nothing Then - With eShowHide - XMLLoadAttribute(.GetAttribute("showMenu"), mnSMenu.Checked) - XMLLoadAttribute(.GetAttribute("showTB"), mnSTB.Checked) - XMLLoadAttribute(.GetAttribute("showOpPanel"), mnSOP.Checked) - XMLLoadAttribute(.GetAttribute("showStatus"), mnSStatus.Checked) - XMLLoadAttribute(.GetAttribute("showLSplit"), mnSLSplitter.Checked) - XMLLoadAttribute(.GetAttribute("showRSplit"), mnSRSplitter.Checked) - End With - End If - - 'Grid - Dim eGrid As XmlElement = Root.Item("Grid") - If eGrid IsNot Nothing Then - With eGrid - XMLLoadAttribute(.GetAttribute("gSnap"), CGSnap.Checked) - XMLLoadAttribute(.GetAttribute("gDisableVertical"), CGDisableVertical.Checked) - XMLLoadAttribute(.GetAttribute("gWheel"), gWheel) - XMLLoadAttribute(.GetAttribute("gPgUpDn"), gPgUpDn) - XMLLoadAttribute(.GetAttribute("gShow"), CGShow.Checked) - XMLLoadAttribute(.GetAttribute("gShowS"), CGShowS.Checked) - XMLLoadAttribute(.GetAttribute("gShowBG"), CGShowBG.Checked) - XMLLoadAttribute(.GetAttribute("gShowM"), CGShowM.Checked) - XMLLoadAttribute(.GetAttribute("gShowV"), CGShowV.Checked) - XMLLoadAttribute(.GetAttribute("gShowMB"), CGShowMB.Checked) - XMLLoadAttribute(.GetAttribute("gShowC"), CGShowC.Checked) - XMLLoadAttribute(.GetAttribute("gBPM"), CGBPM.Checked) - XMLLoadAttribute(.GetAttribute("gSTOP"), CGSTOP.Checked) - XMLLoadAttribute(.GetAttribute("gSCROLL"), CGSCROLL.Checked) - XMLLoadAttribute(.GetAttribute("gBLP"), CGBLP.Checked) - XMLLoadAttribute(.GetAttribute("gP2"), CHPlayer.SelectedIndex) - XMLLoadAttribute(.GetAttribute("gCol"), CGB.Value) - XMLLoadAttribute(.GetAttribute("gxHeight"), CGHeight.Value) - XMLLoadAttribute(.GetAttribute("gxWidth"), CGWidth.Value) - XMLLoadAttribute(.GetAttribute("gSlash"), gSlash) - - Dim xgDivide As Integer = .GetAttribute("gDivide") - If xgDivide >= CGDivide.Minimum And xgDivide <= CGDivide.Maximum Then CGDivide.Value = xgDivide - - Dim xgSub As Integer = .GetAttribute("gSub") - If xgSub >= CGSub.Minimum And xgSub <= CGSub.Maximum Then CGSub.Value = xgSub - End With - End If - - 'WaveForm - Dim eWaveForm As XmlElement = Root.Item("WaveForm") - If eWaveForm IsNot Nothing Then - With eWaveForm - XMLLoadAttribute(.GetAttribute("wLock"), BWLock.Checked) - XMLLoadAttribute(.GetAttribute("wPosition"), TWPosition.Value) - XMLLoadAttribute(.GetAttribute("wLeft"), TWLeft.Value) - XMLLoadAttribute(.GetAttribute("wWidth"), TWWidth.Value) - XMLLoadAttribute(.GetAttribute("wPrecision"), TWPrecision.Value) - End With - End If - - 'Player - Dim ePlayer As XmlElement = Root.Item("Player") - If ePlayer IsNot Nothing Then - With ePlayer - XMLLoadAttribute(.GetAttribute("CurrentPlayer"), CurrentPlayer) - - Dim xCount As Integer = .GetAttribute("Count") - If xCount > 0 Then ReDim Preserve pArgs(xCount - 1) - End With - - For Each eePlayer As XmlElement In ePlayer.ChildNodes - XMLLoadPlayer(eePlayer) - Next - End If - - 'Columns - Dim eColumns As XmlElement = Root.Item("Columns") - For i = niA1 To niAQ - column(i).isVisible = False - column(i + (niD1 - niA1)).isVisible = False - Next - If eColumns IsNot Nothing Then - For Each eeCol As XmlElement In eColumns.ChildNodes - XMLLoadColumn(eeCol) - Next - End If - If iPlayer = 0 Then - For i = niD1 To niDQ - column(i).isVisible = False - Next - End If - - 'VisualSettings - Dim eVisualSettings As XmlElement = Root.Item("VisualSettings") - If eVisualSettings IsNot Nothing Then - With eVisualSettings - XMLLoadElementValue(.Item("ColumnTitle"), vo.ColumnTitle.Color) - XMLLoadElementValue(.Item("ColumnTitleFont"), vo.ColumnTitleFont) - XMLLoadElementValue(.Item("Bg"), vo.Bg.Color) - XMLLoadElementValue(.Item("Grid"), vo.pGrid.Color) - XMLLoadElementValue(.Item("Sub"), vo.pSub.Color) - XMLLoadElementValue(.Item("VLine"), vo.pVLine.Color) - XMLLoadElementValue(.Item("MLine"), vo.pMLine.Color) - - XMLLoadElementValue(.Item("BGMWav"), vo.pBGMWav.Color) - TWTransparency.Value = vo.pBGMWav.Color.A - TWTransparency2.Value = vo.pBGMWav.Color.A - TWSaturation.Value = vo.pBGMWav.Color.GetSaturation * 1000 - TWSaturation2.Value = vo.pBGMWav.Color.GetSaturation * 1000 - - XMLLoadElementValue(.Item("SelBox"), vo.SelBox.Color) - XMLLoadElementValue(.Item("TSCursor"), vo.PECursor.Color) - XMLLoadElementValue(.Item("TSHalf"), vo.PEHalf.Color) - XMLLoadElementValue(.Item("TSDeltaMouseOver"), vo.PEDeltaMouseOver) - XMLLoadElementValue(.Item("TSMouseOver"), vo.PEMouseOver.Color) - XMLLoadElementValue(.Item("TSSel"), vo.PESel.Color) - XMLLoadElementValue(.Item("TSBPM"), vo.PEBPM.Color) - XMLLoadElementValue(.Item("TSBPMFont"), vo.PEBPMFont) - XMLLoadElementValue(.Item("MiddleDeltaRelease"), vo.MiddleDeltaRelease) - XMLLoadElementValue(.Item("kHeight"), vo.kHeight) - XMLLoadElementValue(.Item("kFont"), vo.kFont) - XMLLoadElementValue(.Item("kMFont"), vo.kMFont) - XMLLoadElementValue(.Item("kLabelVShift"), vo.kLabelVShift) - XMLLoadElementValue(.Item("kLabelHShift"), vo.kLabelHShift) - XMLLoadElementValue(.Item("kLabelHShiftL"), vo.kLabelHShiftL) - XMLLoadElementValue(.Item("kMouseOver"), vo.kMouseOver.Color) - XMLLoadElementValue(.Item("kMouseOverE"), vo.kMouseOverE.Color) - XMLLoadElementValue(.Item("kSelected"), vo.kSelected.Color) - XMLLoadElementValue(.Item("kOpacity"), vo.kOpacity) - End With - End If + '.WriteAttributeString("Count", col.Length) + For i As Integer = 0 To UBound(column) + XMLWriteColumn(w, i) : Next + .WriteEndElement() + + .WriteStartElement("VisualSettings") + XMLWriteValue(w, "ColumnTitle", vo.ColumnTitle.Color.ToArgb) + XMLWriteFont(w, "ColumnTitleFont", vo.ColumnTitleFont) + XMLWriteValue(w, "Bg", vo.Bg.Color.ToArgb) + XMLWriteValue(w, "Grid", vo.pGrid.Color.ToArgb) + XMLWriteValue(w, "Sub", vo.pSub.Color.ToArgb) + XMLWriteValue(w, "VLine", vo.pVLine.Color.ToArgb) + XMLWriteValue(w, "MLine", vo.pMLine.Color.ToArgb) + XMLWriteValue(w, "BGMWav", vo.pBGMWav.Color.ToArgb) + XMLWriteValue(w, "SelBox", vo.SelBox.Color.ToArgb) + XMLWriteValue(w, "TSCursor", vo.PECursor.Color.ToArgb) + XMLWriteValue(w, "TSHalf", vo.PEHalf.Color.ToArgb) + XMLWriteValue(w, "TSDeltaMouseOver", vo.PEDeltaMouseOver) + XMLWriteValue(w, "TSMouseOver", vo.PEMouseOver.Color.ToArgb) + XMLWriteValue(w, "TSSel", vo.PESel.Color.ToArgb) + XMLWriteValue(w, "TSBPM", vo.PEBPM.Color.ToArgb) + XMLWriteFont(w, "TSBPMFont", vo.PEBPMFont) + XMLWriteValue(w, "MiddleDeltaRelease", vo.MiddleDeltaRelease) + XMLWriteValue(w, "kHeight", vo.kHeight) + XMLWriteFont(w, "kFont", vo.kFont) + XMLWriteFont(w, "kMFont", vo.kMFont) + XMLWriteValue(w, "kLabelVShift", vo.kLabelVShift) + XMLWriteValue(w, "kLabelHShift", vo.kLabelHShift) + XMLWriteValue(w, "kLabelHShiftL", vo.kLabelHShiftL) + XMLWriteValue(w, "kMouseOver", vo.kMouseOver.Color.ToArgb) + XMLWriteValue(w, "kMouseOverE", vo.kMouseOverE.Color.ToArgb) + XMLWriteValue(w, "kSelected", vo.kSelected.Color.ToArgb) + XMLWriteValue(w, "kOpacity", vo.kOpacity) + .WriteEndElement() + + .WriteEndElement() + .WriteEndDocument() + .Close() + End With + End Sub + + Private Sub XMLLoadElementValue(n As XmlElement, ByRef v As Integer) + If n Is Nothing Then Exit Sub + XMLLoadAttribute(n.GetAttribute("Value"), v) + End Sub + Private Sub XMLLoadElementValue(n As XmlElement, ByRef v As Single) + If n Is Nothing Then Exit Sub + XMLLoadAttribute(n.GetAttribute("Value"), v) + End Sub + Private Sub XMLLoadElementValue(n As XmlElement, ByRef v As Color) + If n Is Nothing Then Exit Sub + XMLLoadAttribute(n.GetAttribute("Value"), v) + End Sub + + Private Sub XMLLoadElementValue(n As XmlElement, ByRef v As Font) + If n Is Nothing Then Exit Sub + + Dim xName As String = Font.FontFamily.Name + Dim xSize As Integer = Font.Size + Dim xStyle As Integer = Font.Style + XMLLoadAttribute(n.GetAttribute("Name"), xName) + XMLLoadAttribute(n.GetAttribute("Size"), xSize) + XMLLoadAttribute(n.GetAttribute("Style"), xStyle) + 'v = New Font(xName, xSize, xStyle) + End Sub + + Private Sub XMLLoadPlayer(n As XmlElement) + Dim i As Integer = -1 + XMLLoadAttribute(n.GetAttribute("Index"), i) + If i < 0 Or i > UBound(pArgs) Then Exit Sub + + XMLLoadAttribute(n.GetAttribute("Path"), pArgs(i).Path) + XMLLoadAttribute(n.GetAttribute("FromBeginning"), pArgs(i).aBegin) + XMLLoadAttribute(n.GetAttribute("FromHere"), pArgs(i).aHere) + XMLLoadAttribute(n.GetAttribute("Stop"), pArgs(i).aStop) + End Sub + + Private Sub XMLLoadColumn(n As XmlElement) + Dim i As Integer = -1 + XMLLoadAttribute(n.GetAttribute("Index"), i) + If i < 0 Or i > UBound(column) Then Exit Sub + + With column(i) + 'XMLLoadAttribute(n.GetAttribute("Left"), .Left) + XMLLoadAttribute(n.GetAttribute("Width"), .Width) + XMLLoadAttribute(n.GetAttribute("Title"), .Title) + 'XMLLoadAttribute(n.GetAttribute("Text"), .Text) + Dim Display As Boolean + Dim attr = n.GetAttribute("Display") + XMLLoadAttribute(attr, Display) + .isVisible = IIf(String.IsNullOrEmpty(attr), .isVisible, Display) + + 'XMLLoadAttribute(n.GetAttribute("isNumeric"), .isNumeric) + 'XMLLoadAttribute(n.GetAttribute("Visible"), .Visible) + 'XMLLoadAttribute(n.GetAttribute("Identifier"), .Identifier) + XMLLoadAttribute(n.GetAttribute("NoteColor"), .cNote) + .setNoteColor(.cNote) + XMLLoadAttribute(n.GetAttribute("TextColor"), .cText) + XMLLoadAttribute(n.GetAttribute("LongNoteColor"), .cLNote) + .setLNoteColor(.cLNote) + XMLLoadAttribute(n.GetAttribute("LongTextColor"), .cLText) + XMLLoadAttribute(n.GetAttribute("BG"), .cBG) + End With + End Sub + + Private Sub LoadSettings(Path As String) + If Not My.Computer.FileSystem.FileExists(Path) Then Return + + 'Dim xTempFileName As String = "" + 'Do + 'Try + 'xTempFileName = Me.RandomFileName(".xml") + 'File.Copy(Path, xTempFileName) + 'Catch + 'Continue Do + 'End Try + 'Exit Do + 'Loop + Dim Doc As New XmlDocument + Dim FileStream As New FileStream(Path, FileMode.Open, FileAccess.Read) + Doc.Load(FileStream) + + Dim Root As XmlElement = Doc.Item("iBMSC") + If Root Is Nothing Then GoTo EndOfSub + + 'version + Dim Major As Integer = My.Application.Info.Version.Major + Dim Minor As Integer = My.Application.Info.Version.Minor + Dim Build As Integer = My.Application.Info.Version.Build + Try + Dim xMajor As Integer = Val(Root.Attributes("Major").Value) + Dim xMinor As Integer = Val(Root.Attributes("Minor").Value) + Dim xBuild As Integer = Val(Root.Attributes("Build").Value) + Major = xMajor + Minor = xMinor + Build = xBuild + Catch ex As Exception + End Try + + 'form + Dim eForm As XmlElement = Root.Item("Form") + If eForm IsNot Nothing Then + With eForm + Select Case Val(.GetAttribute("WindowState")) + Case FormWindowState.Normal + WindowState = FormWindowState.Normal + XMLLoadAttribute(.GetAttribute("Width"), Width) + XMLLoadAttribute(.GetAttribute("Height"), Height) + XMLLoadAttribute(.GetAttribute("Top"), Top) + XMLLoadAttribute(.GetAttribute("Left"), Left) + Case FormWindowState.Maximized + WindowState = FormWindowState.Maximized + End Select + End With + End If + + 'recent + Dim eRecent As XmlElement = Root.Item("Recent") + If eRecent IsNot Nothing Then + With eRecent + XMLLoadAttribute(.GetAttribute("Recent0"), Recent(0)) : SetRecent(0, Recent(0)) + XMLLoadAttribute(.GetAttribute("Recent1"), Recent(1)) : SetRecent(1, Recent(1)) + XMLLoadAttribute(.GetAttribute("Recent2"), Recent(2)) : SetRecent(2, Recent(2)) + XMLLoadAttribute(.GetAttribute("Recent3"), Recent(3)) : SetRecent(3, Recent(3)) + XMLLoadAttribute(.GetAttribute("Recent4"), Recent(4)) : SetRecent(4, Recent(4)) + End With + End If + + 'edit + Dim eEdit As XmlElement = Root.Item("Edit") + If eEdit IsNot Nothing Then + With eEdit + XMLLoadAttribute(.GetAttribute("NTInput"), NTInput) + TBNTInput.Checked = NTInput + mnNTInput.Checked = NTInput + POBLong.Enabled = Not NTInput + POBLongShort.Enabled = Not NTInput + + LoadLocale(My.Application.Info.DirectoryPath & "\" & .GetAttribute("Language")) + + 'XMLLoadAttribute(.GetAttribute("SortingMethod"), SortingMethod) + + XMLLoadAttribute(.GetAttribute("ErrorCheck"), ErrorCheck) + TBErrorCheck.Checked = ErrorCheck + TBErrorCheck_Click(TBErrorCheck, New EventArgs) + + XMLLoadAttribute(.GetAttribute("ShowFileName"), ShowFileName) + TBShowFileName.Checked = ShowFileName + TBShowFileName_Click(TBShowFileName, New EventArgs) + + XMLLoadAttribute(.GetAttribute("MiddleButtonMoveMethod"), MiddleButtonMoveMethod) + XMLLoadAttribute(.GetAttribute("AutoFocusMouseEnter"), AutoFocusMouseEnter) + XMLLoadAttribute(.GetAttribute("FirstClickDisabled"), FirstClickDisabled) + + XMLLoadAttribute(.GetAttribute("AutoSaveInterval"), AutoSaveInterval) + If AutoSaveInterval Then AutoSaveTimer.Interval = AutoSaveInterval Else AutoSaveTimer.Enabled = False + + XMLLoadAttribute(.GetAttribute("PreviewOnClick"), PreviewOnClick) + TBPreviewOnClick.Checked = PreviewOnClick + TBPreviewOnClick_Click(TBPreviewOnClick, New EventArgs) + + XMLLoadAttribute(.GetAttribute("ChangePlaySide"), Rscratch) + TBChangePlaySide.Checked = Rscratch + TBChangePlaySide_Click(TBChangePlaySide, New EventArgs) + + XMLLoadAttribute(.GetAttribute("ClickStopPreview"), ClickStopPreview) + End With + End If + + 'save + Dim eSave As XmlElement = Root.Item("Save") + If eSave IsNot Nothing Then + With eSave + Select Case UCase(.GetAttribute("TextEncoding")) + Case "SYSTEM ANSI" : TextEncoding = System.Text.Encoding.Default + Case "LITTLE ENDIAN UTF16" : TextEncoding = System.Text.Encoding.Unicode + Case "ASCII" : TextEncoding = System.Text.Encoding.ASCII + Case "BIG ENDIAN UTF16" : TextEncoding = System.Text.Encoding.BigEndianUnicode + Case "LITTLE ENDIAN UTF32" : TextEncoding = System.Text.Encoding.UTF32 + 'Case "UTF7" : TextEncoding = System.Text.Encoding.UTF7 + Case "UTF8" : TextEncoding = System.Text.Encoding.UTF8 + Case "SJIS" : TextEncoding = System.Text.Encoding.GetEncoding(932) + Case "EUC-KR" : TextEncoding = System.Text.Encoding.GetEncoding(51949) + ' leave current encoding + ' Case Else + End Select + + XMLLoadAttribute(.GetAttribute("BMSGridLimit"), BMSGridLimit) + XMLLoadAttribute(.GetAttribute("BeepWhileSaved"), BeepWhileSaved) + XMLLoadAttribute(.GetAttribute("BPMx1296"), BPMx1296) + XMLLoadAttribute(.GetAttribute("STOPx1296"), STOPx1296) + End With + End If + + 'WAV + Dim eWAV As XmlElement = Root.Item("WAV") + If eWAV IsNot Nothing Then + With eWAV + XMLLoadAttribute(.GetAttribute("WAVMultiSelect"), WAVMultiSelect) + CWAVMultiSelect.Checked = WAVMultiSelect + CWAVMultiSelect_CheckedChanged(CWAVMultiSelect, New EventArgs) + + XMLLoadAttribute(.GetAttribute("WAVChangeLabel"), WAVChangeLabel) + CWAVChangeLabel.Checked = WAVChangeLabel + CWAVChangeLabel_CheckedChanged(CWAVChangeLabel, New EventArgs) + + XMLLoadAttribute(.GetAttribute("WAVEmptyfill"), WAVEmptyfill) + CWAVEmptyfill.Checked = WAVEmptyfill + CWAVEmptyfill_CheckedChanged(CWAVEmptyfill, New EventArgs) + + Dim xInt As Integer = .GetAttribute("BeatChangeMode") + Dim xBeatOpList As RadioButton() = {CBeatPreserve, CBeatMeasure, CBeatCut, CBeatScale} + If xInt >= 0 And xInt < xBeatOpList.Length Then + xBeatOpList(xInt).Checked = True + CBeatPreserve_Click(xBeatOpList(xInt), New EventArgs) + End If + End With + End If + + 'ShowHide + Dim eShowHide As XmlElement = Root.Item("ShowHide") + If eShowHide IsNot Nothing Then + With eShowHide + XMLLoadAttribute(.GetAttribute("showMenu"), mnSMenu.Checked) + XMLLoadAttribute(.GetAttribute("showTB"), mnSTB.Checked) + XMLLoadAttribute(.GetAttribute("showOpPanel"), mnSOP.Checked) + XMLLoadAttribute(.GetAttribute("showStatus"), mnSStatus.Checked) + XMLLoadAttribute(.GetAttribute("showLSplit"), mnSLSplitter.Checked) + XMLLoadAttribute(.GetAttribute("showRSplit"), mnSRSplitter.Checked) + End With + End If + + 'Grid + Dim eGrid As XmlElement = Root.Item("Grid") + If eGrid IsNot Nothing Then + With eGrid + XMLLoadAttribute(.GetAttribute("gSnap"), CGSnap.Checked) + XMLLoadAttribute(.GetAttribute("gDisableVertical"), CGDisableVertical.Checked) + XMLLoadAttribute(.GetAttribute("gWheel"), gWheel) + XMLLoadAttribute(.GetAttribute("gPgUpDn"), gPgUpDn) + XMLLoadAttribute(.GetAttribute("gShow"), CGShow.Checked) + XMLLoadAttribute(.GetAttribute("gShowS"), CGShowS.Checked) + XMLLoadAttribute(.GetAttribute("gShowBG"), CGShowBG.Checked) + XMLLoadAttribute(.GetAttribute("gShowM"), CGShowM.Checked) + XMLLoadAttribute(.GetAttribute("gShowV"), CGShowV.Checked) + XMLLoadAttribute(.GetAttribute("gShowMB"), CGShowMB.Checked) + XMLLoadAttribute(.GetAttribute("gShowC"), CGShowC.Checked) + XMLLoadAttribute(.GetAttribute("gBPM"), CGBPM.Checked) + XMLLoadAttribute(.GetAttribute("gSTOP"), CGSTOP.Checked) + XMLLoadAttribute(.GetAttribute("gSCROLL"), CGSCROLL.Checked) + XMLLoadAttribute(.GetAttribute("gBLP"), CGBLP.Checked) + XMLLoadAttribute(.GetAttribute("gP2"), CHPlayer.SelectedIndex) + XMLLoadAttribute(.GetAttribute("gCol"), CGB.Value) + XMLLoadAttribute(.GetAttribute("gxHeight"), CGHeight.Value) + XMLLoadAttribute(.GetAttribute("gxWidth"), CGWidth.Value) + XMLLoadAttribute(.GetAttribute("gSlash"), gSlash) + + Dim xgDivide As Integer = .GetAttribute("gDivide") + If xgDivide >= CGDivide.Minimum And xgDivide <= CGDivide.Maximum Then CGDivide.Value = xgDivide + + Dim xgSub As Integer = .GetAttribute("gSub") + If xgSub >= CGSub.Minimum And xgSub <= CGSub.Maximum Then CGSub.Value = xgSub + End With + End If + + 'WaveForm + Dim eWaveForm As XmlElement = Root.Item("WaveForm") + If eWaveForm IsNot Nothing Then + With eWaveForm + XMLLoadAttribute(.GetAttribute("wLock"), BWLock.Checked) + XMLLoadAttribute(.GetAttribute("wPosition"), TWPosition.Value) + XMLLoadAttribute(.GetAttribute("wLeft"), TWLeft.Value) + XMLLoadAttribute(.GetAttribute("wWidth"), TWWidth.Value) + XMLLoadAttribute(.GetAttribute("wPrecision"), TWPrecision.Value) + End With + End If + + 'Player + Dim ePlayer As XmlElement = Root.Item("Player") + If ePlayer IsNot Nothing Then + With ePlayer + XMLLoadAttribute(.GetAttribute("CurrentPlayer"), CurrentPlayer) + + Dim xCount As Integer = .GetAttribute("Count") + If xCount > 0 Then ReDim Preserve pArgs(xCount - 1) + End With + + For Each eePlayer As XmlElement In ePlayer.ChildNodes + XMLLoadPlayer(eePlayer) + Next + End If + + 'Columns + Dim eColumns As XmlElement = Root.Item("Columns") + For i = niA1 To niAQ + column(i).isVisible = False + column(i + (niD1 - niA1)).isVisible = False + Next + If eColumns IsNot Nothing Then + For Each eeCol As XmlElement In eColumns.ChildNodes + XMLLoadColumn(eeCol) + Next + End If + If iPlayer = 0 Then + For i = niD1 To niDQ + column(i).isVisible = False + Next + End If + + 'VisualSettings + Dim eVisualSettings As XmlElement = Root.Item("VisualSettings") + If eVisualSettings IsNot Nothing Then + With eVisualSettings + XMLLoadElementValue(.Item("ColumnTitle"), vo.ColumnTitle.Color) + XMLLoadElementValue(.Item("ColumnTitleFont"), vo.ColumnTitleFont) + XMLLoadElementValue(.Item("Bg"), vo.Bg.Color) + XMLLoadElementValue(.Item("Grid"), vo.pGrid.Color) + XMLLoadElementValue(.Item("Sub"), vo.pSub.Color) + XMLLoadElementValue(.Item("VLine"), vo.pVLine.Color) + XMLLoadElementValue(.Item("MLine"), vo.pMLine.Color) + + XMLLoadElementValue(.Item("BGMWav"), vo.pBGMWav.Color) + TWTransparency.Value = vo.pBGMWav.Color.A + TWTransparency2.Value = vo.pBGMWav.Color.A + TWSaturation.Value = vo.pBGMWav.Color.GetSaturation * 1000 + TWSaturation2.Value = vo.pBGMWav.Color.GetSaturation * 1000 + + XMLLoadElementValue(.Item("SelBox"), vo.SelBox.Color) + XMLLoadElementValue(.Item("TSCursor"), vo.PECursor.Color) + XMLLoadElementValue(.Item("TSHalf"), vo.PEHalf.Color) + XMLLoadElementValue(.Item("TSDeltaMouseOver"), vo.PEDeltaMouseOver) + XMLLoadElementValue(.Item("TSMouseOver"), vo.PEMouseOver.Color) + XMLLoadElementValue(.Item("TSSel"), vo.PESel.Color) + XMLLoadElementValue(.Item("TSBPM"), vo.PEBPM.Color) + XMLLoadElementValue(.Item("TSBPMFont"), vo.PEBPMFont) + XMLLoadElementValue(.Item("MiddleDeltaRelease"), vo.MiddleDeltaRelease) + XMLLoadElementValue(.Item("kHeight"), vo.kHeight) + XMLLoadElementValue(.Item("kFont"), vo.kFont) + XMLLoadElementValue(.Item("kMFont"), vo.kMFont) + XMLLoadElementValue(.Item("kLabelVShift"), vo.kLabelVShift) + XMLLoadElementValue(.Item("kLabelHShift"), vo.kLabelHShift) + XMLLoadElementValue(.Item("kLabelHShiftL"), vo.kLabelHShiftL) + XMLLoadElementValue(.Item("kMouseOver"), vo.kMouseOver.Color) + XMLLoadElementValue(.Item("kMouseOverE"), vo.kMouseOverE.Color) + XMLLoadElementValue(.Item("kSelected"), vo.kSelected.Color) + XMLLoadElementValue(.Item("kOpacity"), vo.kOpacity) + End With + End If EndOfSub: - UpdateColumnsX() - FileStream.Close() - 'File.Delete(xTempFileName) - End Sub - - Private Sub XMLLoadLocaleMenu(n As XmlElement, ByRef target As String) - If n Is Nothing Then Exit Sub - target = If(n.HasAttribute("amp"), n.InnerText.Insert(Integer.Parse(n.GetAttribute("amp")), "&"), n.InnerText) - End Sub - - Private Sub XMLLoadLocale(n As XmlElement, ByRef target As String) - If n IsNot Nothing Then target = n.InnerText - End Sub - - Private Sub XMLLoadLocaleToolTipUniversal(n As XmlElement, target As Control) - If n Is Nothing Then Exit Sub - ToolTipUniversal.SetToolTip(target, n.InnerText) - End Sub - - Private Sub LoadLocale(Path As String) - If Not My.Computer.FileSystem.FileExists(Path) Then Return - - Dim Doc As XmlDocument = Nothing - Dim FileStream As FileStream = Nothing - - Dim xPOHeaderPart2 As Boolean = POHeaderPart2.Visible - Dim xPOGridPart2 As Boolean = POGridPart2.Visible - Dim xPOWaveFormPart2 As Boolean = POWaveFormPart2.Visible - POHeaderPart2.Visible = True - POGridPart2.Visible = True - POWaveFormPart2.Visible = True - - Try - Doc = New XmlDocument - FileStream = New FileStream(Path, FileMode.Open, FileAccess.Read) - Doc.Load(FileStream) - - Dim Root As XmlElement = Doc.Item("iBMSC.Locale") - If Root Is Nothing Then Throw New NullReferenceException - - XMLLoadLocale(Root.Item("OK"), Strings.OK) - XMLLoadLocale(Root.Item("Cancel"), Strings.Cancel) - XMLLoadLocale(Root.Item("None"), Strings.None) - - Dim eFont As XmlElement = Root.Item("Font") - If eFont IsNot Nothing Then - Dim xSize As Integer = 9 - If eFont.HasAttribute("Size") Then xSize = Val(eFont.GetAttribute("Size")) - - Dim fRegular As New Font(Font.FontFamily, xSize, FontStyle.Regular) - Dim xChildNode As XmlNode = eFont.LastChild - Do While xChildNode IsNot Nothing - If xChildNode.LocalName <> "Family" Then Continue Do - If isFontInstalled(xChildNode.InnerText) Then - fRegular = New Font(xChildNode.InnerText, xSize) - End If - xChildNode = xChildNode.PreviousSibling - Loop - - Dim rList() As Object = {Me, mnSys, Menu1, mnMain, cmnLanguage, cmnTheme, cmnConversion, TBMain, FStatus, FStatus2} - For Each c As Object In rList - Try - c.Font = fRegular - Catch ex As Exception - End Try - Next - - Dim fBold As New Font(fRegular, FontStyle.Bold) - - Dim bList() As Object = {TBStatistics, FSSS, FSSL, FSSH, TVCM, TVCD, TVCBPM, FSP1, FSP3, FSP2, PMain, PMainIn, PMainR, PMainInR, PMainL, PMainInL} - For Each c As Object In bList - Try - c.Font = fBold - Catch ex As Exception - End Try - Next - End If - - Dim eMonoFont As XmlElement = Root.Item("MonoFont") - If eMonoFont IsNot Nothing Then - Dim xSize As Integer = 9 - If eMonoFont.HasAttribute("Size") Then xSize = Val(eMonoFont.GetAttribute("Size")) - - Dim fMono As New Font(POWAVInner.Font.FontFamily, xSize) - Dim xChildNode As XmlNode = eMonoFont.LastChild - Do While xChildNode IsNot Nothing - If xChildNode.LocalName <> "Family" Then Continue Do - If isFontInstalled(xChildNode.InnerText) Then - fMono = New Font(xChildNode.InnerText, xSize) - End If - xChildNode = xChildNode.PreviousSibling - Loop - - Dim mList() As Object = {LWAV, LBMP, LBeat, TExpansion} - For Each c As Object In mList - Try - c.font = fMono - Catch ex As Exception - End Try - Next - End If - - Dim eMenu As XmlElement = Root.Item("Menu") - If eMenu IsNot Nothing Then - - Dim eFile As XmlElement = eMenu.Item("File") - If eFile IsNot Nothing Then - XMLLoadLocaleMenu(eFile.Item("Title"), mnFile.Text) - XMLLoadLocaleMenu(eFile.Item("New"), mnNew.Text) - XMLLoadLocaleMenu(eFile.Item("Open"), mnOpen.Text) - XMLLoadLocaleMenu(eFile.Item("ImportSM"), mnImportSM.Text) - XMLLoadLocaleMenu(eFile.Item("ImportIBMSC"), mnImportIBMSC.Text) - XMLLoadLocaleMenu(eFile.Item("Save"), mnSave.Text) - XMLLoadLocaleMenu(eFile.Item("SaveAs"), mnSaveAs.Text) - XMLLoadLocaleMenu(eFile.Item("ExportIBMSC"), mnExportIBMSC.Text) - XMLLoadLocaleMenu(eFile.Item("ExportBMSON"), mnExportBMSON.Text) - If Recent(0) = String.Empty Then XMLLoadLocaleMenu(eFile.Item("Recent0"), mnOpenR0.Text) - If Recent(1) = String.Empty Then XMLLoadLocaleMenu(eFile.Item("Recent1"), mnOpenR1.Text) - If Recent(2) = String.Empty Then XMLLoadLocaleMenu(eFile.Item("Recent2"), mnOpenR2.Text) - If Recent(3) = String.Empty Then XMLLoadLocaleMenu(eFile.Item("Recent3"), mnOpenR3.Text) - If Recent(4) = String.Empty Then XMLLoadLocaleMenu(eFile.Item("Recent4"), mnOpenR4.Text) - XMLLoadLocaleMenu(eFile.Item("Quit"), mnQuit.Text) - End If - - Dim eEdit As XmlElement = eMenu.Item("Edit") - If eEdit IsNot Nothing Then - XMLLoadLocaleMenu(eEdit.Item("Title"), mnEdit.Text) - XMLLoadLocaleMenu(eEdit.Item("Undo"), mnUndo.Text) - XMLLoadLocaleMenu(eEdit.Item("Redo"), mnRedo.Text) - XMLLoadLocaleMenu(eEdit.Item("Cut"), mnCut.Text) - XMLLoadLocaleMenu(eEdit.Item("Copy"), mnCopy.Text) - XMLLoadLocaleMenu(eEdit.Item("Paste"), mnPaste.Text) - XMLLoadLocaleMenu(eEdit.Item("Delete"), mnDelete.Text) - XMLLoadLocaleMenu(eEdit.Item("SelectAll"), mnSelectAll.Text) - XMLLoadLocaleMenu(eEdit.Item("Find"), mnFind.Text) - XMLLoadLocaleMenu(eEdit.Item("Stat"), mnStatistics.Text) - XMLLoadLocaleMenu(eEdit.Item("TimeSelectionTool"), mnTimeSelect.Text) - XMLLoadLocaleMenu(eEdit.Item("SelectTool"), mnSelect.Text) - XMLLoadLocaleMenu(eEdit.Item("WriteTool"), mnWrite.Text) - XMLLoadLocaleMenu(eEdit.Item("MyO2"), mnMyO2.Text) - End If - - Dim eView As XmlElement = eMenu.Item("View") - If eView IsNot Nothing Then - XMLLoadLocaleMenu(eView.Item("Title"), mnSys.Text) - End If - - Dim eOptions As XmlElement = eMenu.Item("Options") - If eOptions IsNot Nothing Then - XMLLoadLocaleMenu(eOptions.Item("Title"), mnOptions.Text) - XMLLoadLocaleMenu(eOptions.Item("NT"), mnNTInput.Text) - XMLLoadLocaleMenu(eOptions.Item("ErrorCheck"), mnErrorCheck.Text) - XMLLoadLocaleMenu(eOptions.Item("PreviewOnClick"), mnPreviewOnClick.Text) - XMLLoadLocaleMenu(eOptions.Item("ShowFileName"), mnShowFileName.Text) - XMLLoadLocaleMenu(eOptions.Item("ChangePlaySide"), mnChangePlaySide.Text) - XMLLoadLocaleMenu(eOptions.Item("GeneralOptions"), mnGOptions.Text) - XMLLoadLocaleMenu(eOptions.Item("VisualOptions"), mnVOptions.Text) - XMLLoadLocaleMenu(eOptions.Item("PlayerOptions"), mnPOptions.Text) - XMLLoadLocaleMenu(eOptions.Item("Language"), mnLanguage.Text) - XMLLoadLocaleMenu(eOptions.Item("Theme"), mnTheme.Text) - End If - - XMLLoadLocaleMenu(eMenu.Item("Conversion"), mnConversion.Text) - - Dim ePreview As XmlElement = eMenu.Item("Preview") - If ePreview IsNot Nothing Then - XMLLoadLocaleMenu(ePreview.Item("Title"), mnPreview.Text) - XMLLoadLocaleMenu(ePreview.Item("PlayBegin"), mnPlayB.Text) - XMLLoadLocaleMenu(ePreview.Item("PlayHere"), mnPlay.Text) - XMLLoadLocaleMenu(ePreview.Item("PlayStop"), mnStop.Text) - End If - - Dim eAbout As XmlElement = eMenu.Item("About") - If eAbout IsNot Nothing Then - 'XMLLoadLocaleMenu(eAbout.Item("Title"), mnAbout.Text) - 'XMLLoadLocaleMenu(eAbout.Item("About"), mnAbout1.Text) - 'XMLLoadLocaleMenu(eAbout.Item("CheckUpdates"), mnUpdate.Text) - 'XMLLoadLocaleMenu(eAbout.Item("CheckUpdatesC"), mnUpdateC.Text) - End If - End If - - Dim eToolBar As XmlElement = Root.Item("ToolBar") - If eToolBar IsNot Nothing Then - XMLLoadLocale(eToolBar.Item("New"), TBNew.Text) - XMLLoadLocale(eToolBar.Item("Open"), TBOpen.Text) - XMLLoadLocale(eToolBar.Item("Save"), TBSave.Text) - XMLLoadLocale(eToolBar.Item("Cut"), TBCut.Text) - XMLLoadLocale(eToolBar.Item("Copy"), TBCopy.Text) - XMLLoadLocale(eToolBar.Item("Paste"), TBPaste.Text) - XMLLoadLocale(eToolBar.Item("Find"), TBFind.Text) - XMLLoadLocale(eToolBar.Item("Stat"), TBStatistics.ToolTipText) - XMLLoadLocale(eToolBar.Item("Conversion"), POConvert.Text) - XMLLoadLocale(eToolBar.Item("MyO2"), TBMyO2.Text) - XMLLoadLocale(eToolBar.Item("ErrorCheck"), TBErrorCheck.Text) - XMLLoadLocale(eToolBar.Item("PreviewOnClick"), TBPreviewOnClick.Text) - XMLLoadLocale(eToolBar.Item("ShowFileName"), TBShowFileName.Text) - XMLLoadLocale(eToolBar.Item("ChangePlaySide"), TBChangePlaySide.Text) - XMLLoadLocale(eToolBar.Item("Undo"), TBUndo.Text) - XMLLoadLocale(eToolBar.Item("Redo"), TBRedo.Text) - XMLLoadLocale(eToolBar.Item("NT"), TBNTInput.Text) - XMLLoadLocale(eToolBar.Item("TimeSelectionTool"), TBTimeSelect.Text) - XMLLoadLocale(eToolBar.Item("SelectTool"), TBSelect.Text) - XMLLoadLocale(eToolBar.Item("WriteTool"), TBWrite.Text) - XMLLoadLocale(eToolBar.Item("PlayBegin"), TBPlayB.Text) - XMLLoadLocale(eToolBar.Item("PlayHere"), TBPlay.Text) - XMLLoadLocale(eToolBar.Item("PlayStop"), TBStop.Text) - XMLLoadLocale(eToolBar.Item("PlayerOptions"), TBPOptions.Text) - XMLLoadLocale(eToolBar.Item("VisualOptions"), TBVOptions.Text) - XMLLoadLocale(eToolBar.Item("GeneralOptions"), TBGOptions.Text) - XMLLoadLocale(eToolBar.Item("Language"), TBLanguage.Text) - XMLLoadLocale(eToolBar.Item("Theme"), TBTheme.Text) - ' XMLLoadLocale(eToolBar.Item("About"), TBAbout.Text) - End If - - Dim eStatusBar As XmlElement = Root.Item("StatusBar") - If eStatusBar IsNot Nothing Then - XMLLoadLocale(eStatusBar.Item("ColumnCaption"), FSC.ToolTipText) - XMLLoadLocale(eStatusBar.Item("NoteIndex"), FSW.ToolTipText) - XMLLoadLocale(eStatusBar.Item("MeasureIndex"), FSM.ToolTipText) - XMLLoadLocale(eStatusBar.Item("GridResolution"), FSP1.ToolTipText) - XMLLoadLocale(eStatusBar.Item("ReducedResolution"), FSP3.ToolTipText) - XMLLoadLocale(eStatusBar.Item("MeasureResolution"), FSP2.ToolTipText) - XMLLoadLocale(eStatusBar.Item("AbsolutePosition"), FSP4.ToolTipText) - XMLLoadLocale(eStatusBar.Item("Length"), Strings.StatusBar.Length) - XMLLoadLocale(eStatusBar.Item("LongNote"), Strings.StatusBar.LongNote) - XMLLoadLocale(eStatusBar.Item("Hidden"), Strings.StatusBar.Hidden) - XMLLoadLocale(eStatusBar.Item("LandMine"), Strings.StatusBar.LandMine) - XMLLoadLocale(eStatusBar.Item("Error"), Strings.StatusBar.Err) - XMLLoadLocale(eStatusBar.Item("SelStart"), FSSS.ToolTipText) - XMLLoadLocale(eStatusBar.Item("SelLength"), FSSL.ToolTipText) - XMLLoadLocale(eStatusBar.Item("SelSplit"), FSSH.ToolTipText) - XMLLoadLocale(eStatusBar.Item("Reverse"), BVCReverse.Text) - XMLLoadLocale(eStatusBar.Item("ByMultiple"), BVCApply.Text) - XMLLoadLocale(eStatusBar.Item("ByValue"), BVCCalculate.Text) - End If - - Dim eSubMenu As XmlElement = Root.Item("SubMenu") - If eSubMenu IsNot Nothing Then - - Dim eShowHide As XmlElement = eSubMenu.Item("ShowHide") - If eShowHide IsNot Nothing Then - 'Dim xToolTip As String = ToolTipUniversal.GetToolTip(ttlIcon) - 'XMLLoadLocaleMenu(eShowHide.Item("ToolTip"), xToolTip) - 'ToolTipUniversal.SetToolTip(ttlIcon, xToolTip) - - XMLLoadLocaleMenu(eShowHide.Item("Menu"), mnSMenu.Text) - XMLLoadLocaleMenu(eShowHide.Item("ToolBar"), mnSTB.Text) - XMLLoadLocaleMenu(eShowHide.Item("OptionsPanel"), mnSOP.Text) - XMLLoadLocaleMenu(eShowHide.Item("StatusBar"), mnSStatus.Text) - XMLLoadLocaleMenu(eShowHide.Item("LSplit"), mnSLSplitter.Text) - XMLLoadLocaleMenu(eShowHide.Item("RSplit"), mnSRSplitter.Text) - XMLLoadLocaleMenu(eShowHide.Item("Grid"), CGShow.Text) - XMLLoadLocaleMenu(eShowHide.Item("Sub"), CGShowS.Text) - XMLLoadLocaleMenu(eShowHide.Item("BG"), CGShowBG.Text) - XMLLoadLocaleMenu(eShowHide.Item("MeasureIndex"), CGShowM.Text) - XMLLoadLocaleMenu(eShowHide.Item("MeasureLine"), CGShowMB.Text) - XMLLoadLocaleMenu(eShowHide.Item("Vertical"), CGShowV.Text) - XMLLoadLocaleMenu(eShowHide.Item("ColumnCaption"), CGShowC.Text) - XMLLoadLocaleMenu(eShowHide.Item("BPM"), CGBPM.Text) - XMLLoadLocaleMenu(eShowHide.Item("STOP"), CGSTOP.Text) - XMLLoadLocaleMenu(eShowHide.Item("SCROLL"), CGSCROLL.Text) - XMLLoadLocaleMenu(eShowHide.Item("BLP"), CGBLP.Text) - End If - - Dim eInsertMeasure As XmlElement = eSubMenu.Item("InsertMeasure") - If eInsertMeasure IsNot Nothing Then - XMLLoadLocaleMenu(eInsertMeasure.Item("Insert"), MInsert.Text) - XMLLoadLocaleMenu(eInsertMeasure.Item("Remove"), MRemove.Text) - End If - - Dim eLanguage As XmlElement = eSubMenu.Item("Language") - If eLanguage IsNot Nothing Then - XMLLoadLocaleMenu(eLanguage.Item("Default"), TBLangDef.Text) - XMLLoadLocaleMenu(eLanguage.Item("Refresh"), TBLangRefresh.Text) - End If - - Dim eTheme As XmlElement = eSubMenu.Item("Theme") - If eTheme IsNot Nothing Then - XMLLoadLocaleMenu(eTheme.Item("Default"), TBThemeDef.Text) - XMLLoadLocaleMenu(eTheme.Item("Save"), TBThemeSave.Text) - XMLLoadLocaleMenu(eTheme.Item("Refresh"), TBThemeRefresh.Text) - XMLLoadLocaleMenu(eTheme.Item("LoadComptability"), TBThemeLoadComptability.Text) - End If - - Dim eConvert As XmlElement = eSubMenu.Item("Convert") - If eConvert IsNot Nothing Then - XMLLoadLocaleMenu(eConvert.Item("Long"), POBLong.Text) - XMLLoadLocaleMenu(eConvert.Item("Short"), POBShort.Text) - XMLLoadLocaleMenu(eConvert.Item("LongShort"), POBLongShort.Text) - XMLLoadLocaleMenu(eConvert.Item("Hidden"), POBHidden.Text) - XMLLoadLocaleMenu(eConvert.Item("Visible"), POBVisible.Text) - XMLLoadLocaleMenu(eConvert.Item("HiddenVisible"), POBHiddenVisible.Text) - XMLLoadLocaleMenu(eConvert.Item("Relabel"), POBModify.Text) - XMLLoadLocaleMenu(eConvert.Item("Mirror"), POBMirror.Text) - End If - - Dim eWAV As XmlElement = eSubMenu.Item("WAV") - If eWAV IsNot Nothing Then - XMLLoadLocaleMenu(eWAV.Item("MultiSelection"), CWAVMultiSelect.Text) - XMLLoadLocaleMenu(eWAV.Item("Synchronize"), CWAVChangeLabel.Text) - XMLLoadLocaleMenu(eWAV.Item("Emptyfill"), CWAVEmptyfill.Text) - End If - - Dim eBeat As XmlElement = eSubMenu.Item("Beat") - If eBeat IsNot Nothing Then - XMLLoadLocaleMenu(eBeat.Item("Absolute"), CBeatPreserve.Text) - XMLLoadLocaleMenu(eBeat.Item("Measure"), CBeatMeasure.Text) - XMLLoadLocaleMenu(eBeat.Item("Cut"), CBeatCut.Text) - XMLLoadLocaleMenu(eBeat.Item("Scale"), CBeatScale.Text) - End If - End If - - Dim eOptionsPanel As XmlElement = Root.Item("OptionsPanel") - If eOptionsPanel IsNot Nothing Then - - Dim eHeader As XmlElement = eOptionsPanel.Item("Header") - If eHeader IsNot Nothing Then - XMLLoadLocale(eHeader.Item("Header"), POHeaderSwitch.Text) - XMLLoadLocale(eHeader.Item("Title"), Label3.Text) - XMLLoadLocale(eHeader.Item("Artist"), Label4.Text) - XMLLoadLocale(eHeader.Item("Genre"), Label2.Text) - XMLLoadLocale(eHeader.Item("BPM"), Label9.Text) - XMLLoadLocale(eHeader.Item("Player"), Label8.Text) - XMLLoadLocale(eHeader.Item("Rank"), Label10.Text) - XMLLoadLocale(eHeader.Item("PlayLevel"), Label6.Text) - XMLLoadLocale(eHeader.Item("SubTitle"), Label15.Text) - XMLLoadLocale(eHeader.Item("SubArtist"), Label17.Text) - 'XMLLoadLocale(eHeader.Item("Maker"), Label14.Text) - XMLLoadLocale(eHeader.Item("StageFile"), Label16.Text) - XMLLoadLocale(eHeader.Item("Banner"), Label12.Text) - XMLLoadLocale(eHeader.Item("BackBMP"), Label11.Text) - 'XMLLoadLocale(eHeader.Item("MidiFile"), Label18.Text) - XMLLoadLocale(eHeader.Item("Difficulty"), Label21.Text) - XMLLoadLocale(eHeader.Item("ExRank"), Label23.Text) - XMLLoadLocale(eHeader.Item("Total"), Label20.Text) - 'XMLLoadLocale(eHeader.Item("VolWav"), Label22.Text) - XMLLoadLocale(eHeader.Item("Comment"), Label19.Text) - 'XMLLoadLocale(eHeader.Item("LnType"), Label13.Text) - XMLLoadLocale(eHeader.Item("LnObj"), Label24.Text) - XMLLoadLocale(eHeader.Item("LandMine"), Label26.Text) - XMLLoadLocale(eHeader.Item("MissBMP"), Label27.Text) - - RemoveHandler CHPlayer.SelectedIndexChanged, AddressOf CHPlayer_SelectedIndexChanged - XMLLoadLocale(eHeader.Item("Player1"), CHPlayer.Items.Item(0)) - XMLLoadLocale(eHeader.Item("Player2"), CHPlayer.Items.Item(1)) - XMLLoadLocale(eHeader.Item("Player3"), CHPlayer.Items.Item(2)) - AddHandler CHPlayer.SelectedIndexChanged, AddressOf CHPlayer_SelectedIndexChanged - - RemoveHandler CHRank.SelectedIndexChanged, AddressOf THGenre_TextChanged - XMLLoadLocale(eHeader.Item("Rank0"), CHRank.Items.Item(0)) - XMLLoadLocale(eHeader.Item("Rank1"), CHRank.Items.Item(1)) - XMLLoadLocale(eHeader.Item("Rank2"), CHRank.Items.Item(2)) - XMLLoadLocale(eHeader.Item("Rank3"), CHRank.Items.Item(3)) - XMLLoadLocale(eHeader.Item("Rank4"), CHRank.Items.Item(4)) - AddHandler CHRank.SelectedIndexChanged, AddressOf THGenre_TextChanged - - RemoveHandler CHDifficulty.SelectedIndexChanged, AddressOf THGenre_TextChanged - XMLLoadLocale(eHeader.Item("Difficulty0"), CHDifficulty.Items.Item(0)) - XMLLoadLocale(eHeader.Item("Difficulty1"), CHDifficulty.Items.Item(1)) - XMLLoadLocale(eHeader.Item("Difficulty2"), CHDifficulty.Items.Item(2)) - XMLLoadLocale(eHeader.Item("Difficulty3"), CHDifficulty.Items.Item(3)) - XMLLoadLocale(eHeader.Item("Difficulty4"), CHDifficulty.Items.Item(4)) - XMLLoadLocale(eHeader.Item("Difficulty5"), CHDifficulty.Items.Item(5)) - AddHandler CHDifficulty.SelectedIndexChanged, AddressOf THGenre_TextChanged - End If - - Dim eGrid As XmlElement = eOptionsPanel.Item("Grid") - If eGrid IsNot Nothing Then - XMLLoadLocale(eGrid.Item("Title"), POGridSwitch.Text) - XMLLoadLocale(eGrid.Item("Snap"), CGSnap.Text) - XMLLoadLocale(eGrid.Item("BCols"), Label1.Text) - XMLLoadLocale(eGrid.Item("DisableVertical"), CGDisableVertical.Text) - XMLLoadLocale(eGrid.Item("Scroll"), Label5.Text) - XMLLoadLocaleToolTipUniversal(eGrid.Item("LockLeft"), cVSLockL) - XMLLoadLocaleToolTipUniversal(eGrid.Item("LockMiddle"), cVSLock) - XMLLoadLocaleToolTipUniversal(eGrid.Item("LockRight"), cVSLockR) - End If - - Dim eWaveForm As XmlElement = eOptionsPanel.Item("WaveForm") - If eWaveForm IsNot Nothing Then - XMLLoadLocale(eWaveForm.Item("Title"), POWaveFormSwitch.Text) - XMLLoadLocaleToolTipUniversal(eWaveForm.Item("Load"), BWLoad) - XMLLoadLocaleToolTipUniversal(eWaveForm.Item("Clear"), BWClear) - XMLLoadLocaleToolTipUniversal(eWaveForm.Item("Lock"), BWLock) - End If - - Dim eWAV As XmlElement = eOptionsPanel.Item("WAV") - If eWAV IsNot Nothing Then - XMLLoadLocale(eWAV.Item("Title"), POWAVSwitch.Text) - XMLLoadLocaleToolTipUniversal(eWAV.Item("MoveUp"), BBMPUp) - XMLLoadLocaleToolTipUniversal(eWAV.Item("MoveDown"), BBMPDown) - XMLLoadLocaleToolTipUniversal(eWAV.Item("Browse"), BBMPBrowse) - XMLLoadLocaleToolTipUniversal(eWAV.Item("Remove"), BBMPRemove) - XMLLoadLocaleToolTipUniversal(eWAV.Item("MoveUp"), BWAVUp) - XMLLoadLocaleToolTipUniversal(eWAV.Item("MoveDown"), BWAVDown) - XMLLoadLocaleToolTipUniversal(eWAV.Item("Browse"), BWAVBrowse) - XMLLoadLocaleToolTipUniversal(eWAV.Item("Remove"), BWAVRemove) - End If - - Dim eBMP As XmlElement = eOptionsPanel.Item("BMP") - If eBMP IsNot Nothing Then - XMLLoadLocale(eBMP.Item("Title"), POBMPSwitch.Text) - End If - - XMLLoadLocale(eOptionsPanel.Item("Beat"), POBeatSwitch.Text) - XMLLoadLocale(eOptionsPanel.Item("Beat.Apply"), BBeatApply.Text) - XMLLoadLocale(eOptionsPanel.Item("Beat.Apply"), BBeatApplyV.Text) - XMLLoadLocale(eOptionsPanel.Item("Expansion"), POExpansionSwitch.Text) - End If - - Dim eMessages As XmlElement = Root.Item("Messages") - If eMessages IsNot Nothing Then - XMLLoadLocale(eMessages.Item("Err"), Strings.Messages.Err) - XMLLoadLocale(eMessages.Item("SaveOnExit"), Strings.Messages.SaveOnExit) - XMLLoadLocale(eMessages.Item("SaveOnExit1"), Strings.Messages.SaveOnExit1) - XMLLoadLocale(eMessages.Item("SaveOnExit2"), Strings.Messages.SaveOnExit2) - XMLLoadLocale(eMessages.Item("PromptEnter"), Strings.Messages.PromptEnter) - XMLLoadLocale(eMessages.Item("PromptEnterNumeric"), Strings.Messages.PromptEnterNumeric) - XMLLoadLocale(eMessages.Item("PromptEnterBPM"), Strings.Messages.PromptEnterBPM) - XMLLoadLocale(eMessages.Item("PromptEnterSTOP"), Strings.Messages.PromptEnterSTOP) - XMLLoadLocale(eMessages.Item("PromptEnterSCROLL"), Strings.Messages.PromptEnterSCROLL) - XMLLoadLocale(eMessages.Item("PromptSlashValue"), Strings.Messages.PromptSlashValue) - XMLLoadLocale(eMessages.Item("InvalidLabel"), Strings.Messages.InvalidLabel) - XMLLoadLocale(eMessages.Item("CannotFind"), Strings.Messages.CannotFind) - XMLLoadLocale(eMessages.Item("PleaseRespecifyPath"), Strings.Messages.PleaseRespecifyPath) - XMLLoadLocale(eMessages.Item("PlayerNotFound"), Strings.Messages.PlayerNotFound) - XMLLoadLocale(eMessages.Item("PreviewDelError"), Strings.Messages.PreviewDelError) - XMLLoadLocale(eMessages.Item("NegativeFactorError"), Strings.Messages.NegativeFactorError) - XMLLoadLocale(eMessages.Item("NegativeDivisorError"), Strings.Messages.NegativeDivisorError) - XMLLoadLocale(eMessages.Item("PreferencePostpone"), Strings.Messages.PreferencePostpone) - XMLLoadLocale(eMessages.Item("EraserObsolete"), Strings.Messages.EraserObsolete) - XMLLoadLocale(eMessages.Item("SaveWarning"), Strings.Messages.SaveWarning) - XMLLoadLocale(eMessages.Item("NoteOverlapError"), Strings.Messages.NoteOverlapError) - XMLLoadLocale(eMessages.Item("BPMOverflowError"), Strings.Messages.BPMOverflowError) - XMLLoadLocale(eMessages.Item("STOPOverflowError"), Strings.Messages.STOPOverflowError) - XMLLoadLocale(eMessages.Item("SCROLLOverflowError"), Strings.Messages.SCROLLOverflowError) - XMLLoadLocale(eMessages.Item("SavedFileWillContainErrors"), Strings.Messages.SavedFileWillContainErrors) - XMLLoadLocale(eMessages.Item("FileAssociationPrompt"), Strings.Messages.FileAssociationPrompt) - XMLLoadLocale(eMessages.Item("FileAssociationError"), Strings.Messages.FileAssociationError) - XMLLoadLocale(eMessages.Item("RestoreDefaultSettings"), Strings.Messages.RestoreDefaultSettings) - XMLLoadLocale(eMessages.Item("RestoreAutosavedFile"), Strings.Messages.RestoreAutosavedFile) - End If - - Dim eFileType As XmlElement = Root.Item("FileType") - If eFileType IsNot Nothing Then - XMLLoadLocale(eFileType.Item("_all"), Strings.FileType._all) - XMLLoadLocale(eFileType.Item("_bms"), Strings.FileType._bms) - XMLLoadLocale(eFileType.Item("BMS"), Strings.FileType.BMS) - XMLLoadLocale(eFileType.Item("BME"), Strings.FileType.BME) - XMLLoadLocale(eFileType.Item("BML"), Strings.FileType.BML) - XMLLoadLocale(eFileType.Item("PMS"), Strings.FileType.PMS) - XMLLoadLocale(eFileType.Item("TXT"), Strings.FileType.TXT) - XMLLoadLocale(eFileType.Item("SM"), Strings.FileType.SM) - XMLLoadLocale(eFileType.Item("IBMSC"), Strings.FileType.IBMSC) - XMLLoadLocale(eFileType.Item("XML"), Strings.FileType.XML) - XMLLoadLocale(eFileType.Item("THEME_XML"), Strings.FileType.THEME_XML) - XMLLoadLocale(eFileType.Item("TH"), Strings.FileType.TH) - XMLLoadLocale(eFileType.Item("_audio"), Strings.FileType._audio) - XMLLoadLocale(eFileType.Item("_wave"), Strings.FileType._wave) - XMLLoadLocale(eFileType.Item("WAV"), Strings.FileType.WAV) - XMLLoadLocale(eFileType.Item("OGG"), Strings.FileType.OGG) - XMLLoadLocale(eFileType.Item("MP3"), Strings.FileType.MP3) - XMLLoadLocale(eFileType.Item("FLAC"), Strings.FileType.FLAC) - XMLLoadLocale(eFileType.Item("MID"), Strings.FileType.MID) - XMLLoadLocale(eFileType.Item("_image"), Strings.FileType._image) - XMLLoadLocale(eFileType.Item("_movie"), Strings.FileType._movie) - XMLLoadLocale(eFileType.Item("BMP"), Strings.FileType.BMP) - XMLLoadLocale(eFileType.Item("PNG"), Strings.FileType.PNG) - XMLLoadLocale(eFileType.Item("JPG"), Strings.FileType.JPG) - XMLLoadLocale(eFileType.Item("GIF"), Strings.FileType.GIF) - XMLLoadLocale(eFileType.Item("MPG"), Strings.FileType.MPG) - XMLLoadLocale(eFileType.Item("AVI"), Strings.FileType.AVI) - XMLLoadLocale(eFileType.Item("MP4"), Strings.FileType.MP4) - XMLLoadLocale(eFileType.Item("WMV"), Strings.FileType.WMV) - XMLLoadLocale(eFileType.Item("WEBM"), Strings.FileType.WEBM) - XMLLoadLocale(eFileType.Item("EXE"), Strings.FileType.EXE) - End If - - Dim eStatistics As XmlElement = Root.Item("Statistics") - If eStatistics IsNot Nothing Then - XMLLoadLocale(eStatistics.Item("Title"), Strings.fStatistics.Title) - XMLLoadLocale(eStatistics.Item("lBPM"), Strings.fStatistics.lBPM) - XMLLoadLocale(eStatistics.Item("lSTOP"), Strings.fStatistics.lSTOP) - XMLLoadLocale(eStatistics.Item("lSCROLL"), Strings.fStatistics.lSCROLL) - XMLLoadLocale(eStatistics.Item("lA"), Strings.fStatistics.lA) - XMLLoadLocale(eStatistics.Item("lD"), Strings.fStatistics.lD) - XMLLoadLocale(eStatistics.Item("lBGM"), Strings.fStatistics.lBGM) - XMLLoadLocale(eStatistics.Item("lTotal"), Strings.fStatistics.lTotal) - XMLLoadLocale(eStatistics.Item("lShort"), Strings.fStatistics.lShort) - XMLLoadLocale(eStatistics.Item("lLong"), Strings.fStatistics.lLong) - XMLLoadLocale(eStatistics.Item("lLnObj"), Strings.fStatistics.lLnObj) - XMLLoadLocale(eStatistics.Item("lHidden"), Strings.fStatistics.lHidden) - XMLLoadLocale(eStatistics.Item("lLandMine"), Strings.fStatistics.lLandMine) - XMLLoadLocale(eStatistics.Item("lErrors"), Strings.fStatistics.lErrors) - End If - - Dim ePlayerOptions As XmlElement = Root.Item("PlayerOptions") - If ePlayerOptions IsNot Nothing Then - XMLLoadLocale(ePlayerOptions.Item("Title"), Strings.fopPlayer.Title) - XMLLoadLocale(ePlayerOptions.Item("Add"), Strings.fopPlayer.Add) - XMLLoadLocale(ePlayerOptions.Item("Remove"), Strings.fopPlayer.Remove) - XMLLoadLocale(ePlayerOptions.Item("Path"), Strings.fopPlayer.Path) - XMLLoadLocale(ePlayerOptions.Item("PlayFromBeginning"), Strings.fopPlayer.PlayFromBeginning) - XMLLoadLocale(ePlayerOptions.Item("PlayFromHere"), Strings.fopPlayer.PlayFromHere) - XMLLoadLocale(ePlayerOptions.Item("StopPlaying"), Strings.fopPlayer.StopPlaying) - XMLLoadLocale(ePlayerOptions.Item("References"), Strings.fopPlayer.References) - XMLLoadLocale(ePlayerOptions.Item("DirectoryOfApp"), Strings.fopPlayer.DirectoryOfApp) - XMLLoadLocale(ePlayerOptions.Item("CurrMeasure"), Strings.fopPlayer.CurrMeasure) - XMLLoadLocale(ePlayerOptions.Item("FileName"), Strings.fopPlayer.FileName) - XMLLoadLocale(ePlayerOptions.Item("RestoreDefault"), Strings.fopPlayer.RestoreDefault) - End If - - Dim eVisualOptions As XmlElement = Root.Item("VisualOptions") - If eVisualOptions IsNot Nothing Then - XMLLoadLocale(eVisualOptions.Item("Title"), Strings.fopVisual.Title) - XMLLoadLocale(eVisualOptions.Item("Width"), Strings.fopVisual.Width) - XMLLoadLocale(eVisualOptions.Item("Caption"), Strings.fopVisual.Caption) - XMLLoadLocale(eVisualOptions.Item("Note"), Strings.fopVisual.Note) - XMLLoadLocale(eVisualOptions.Item("Label"), Strings.fopVisual.Label) - XMLLoadLocale(eVisualOptions.Item("LongNote"), Strings.fopVisual.LongNote) - XMLLoadLocale(eVisualOptions.Item("LongNoteLabel"), Strings.fopVisual.LongNoteLabel) - XMLLoadLocale(eVisualOptions.Item("Bg"), Strings.fopVisual.Bg) - XMLLoadLocale(eVisualOptions.Item("ColumnCaption"), Strings.fopVisual.ColumnCaption) - XMLLoadLocale(eVisualOptions.Item("ColumnCaptionFont"), Strings.fopVisual.ColumnCaptionFont) - XMLLoadLocale(eVisualOptions.Item("Background"), Strings.fopVisual.Background) - XMLLoadLocale(eVisualOptions.Item("Grid"), Strings.fopVisual.Grid) - XMLLoadLocale(eVisualOptions.Item("SubGrid"), Strings.fopVisual.SubGrid) - XMLLoadLocale(eVisualOptions.Item("VerticalLine"), Strings.fopVisual.VerticalLine) - XMLLoadLocale(eVisualOptions.Item("MeasureBarLine"), Strings.fopVisual.MeasureBarLine) - XMLLoadLocale(eVisualOptions.Item("BGMWaveform"), Strings.fopVisual.BGMWaveform) - XMLLoadLocale(eVisualOptions.Item("NoteHeight"), Strings.fopVisual.NoteHeight) - XMLLoadLocale(eVisualOptions.Item("NoteLabel"), Strings.fopVisual.NoteLabel) - XMLLoadLocale(eVisualOptions.Item("MeasureLabel"), Strings.fopVisual.MeasureLabel) - XMLLoadLocale(eVisualOptions.Item("LabelVerticalShift"), Strings.fopVisual.LabelVerticalShift) - XMLLoadLocale(eVisualOptions.Item("LabelHorizontalShift"), Strings.fopVisual.LabelHorizontalShift) - XMLLoadLocale(eVisualOptions.Item("LongNoteLabelHorizontalShift"), Strings.fopVisual.LongNoteLabelHorizontalShift) - XMLLoadLocale(eVisualOptions.Item("HiddenNoteOpacity"), Strings.fopVisual.HiddenNoteOpacity) - XMLLoadLocale(eVisualOptions.Item("NoteBorderOnMouseOver"), Strings.fopVisual.NoteBorderOnMouseOver) - XMLLoadLocale(eVisualOptions.Item("NoteBorderOnSelection"), Strings.fopVisual.NoteBorderOnSelection) - XMLLoadLocale(eVisualOptions.Item("NoteBorderOnAdjustingLength"), Strings.fopVisual.NoteBorderOnAdjustingLength) - XMLLoadLocale(eVisualOptions.Item("SelectionBoxBorder"), Strings.fopVisual.SelectionBoxBorder) - XMLLoadLocale(eVisualOptions.Item("TSCursor"), Strings.fopVisual.TSCursor) - XMLLoadLocale(eVisualOptions.Item("TSSplitter"), Strings.fopVisual.TSSplitter) - XMLLoadLocale(eVisualOptions.Item("TSCursorSensitivity"), Strings.fopVisual.TSCursorSensitivity) - XMLLoadLocale(eVisualOptions.Item("TSMouseOverBorder"), Strings.fopVisual.TSMouseOverBorder) - XMLLoadLocale(eVisualOptions.Item("TSFill"), Strings.fopVisual.TSFill) - XMLLoadLocale(eVisualOptions.Item("TSBPM"), Strings.fopVisual.TSBPM) - XMLLoadLocale(eVisualOptions.Item("TSBPMFont"), Strings.fopVisual.TSBPMFont) - XMLLoadLocale(eVisualOptions.Item("MiddleSensitivity"), Strings.fopVisual.MiddleSensitivity) - End If - - Dim eGeneralOptions As XmlElement = Root.Item("GeneralOptions") - If eGeneralOptions IsNot Nothing Then - XMLLoadLocale(eGeneralOptions.Item("Title"), Strings.fopGeneral.Title) - XMLLoadLocale(eGeneralOptions.Item("MouseWheel"), Strings.fopGeneral.MouseWheel) - XMLLoadLocale(eGeneralOptions.Item("TextEncoding"), Strings.fopGeneral.TextEncoding) - XMLLoadLocale(eGeneralOptions.Item("PageUpDown"), Strings.fopGeneral.PageUpDown) - XMLLoadLocale(eGeneralOptions.Item("MiddleButton"), Strings.fopGeneral.MiddleButton) - XMLLoadLocale(eGeneralOptions.Item("MiddleButtonAuto"), Strings.fopGeneral.MiddleButtonAuto) - XMLLoadLocale(eGeneralOptions.Item("MiddleButtonDrag"), Strings.fopGeneral.MiddleButtonDrag) - XMLLoadLocale(eGeneralOptions.Item("AssociateFileType"), Strings.fopGeneral.AssociateFileType) - XMLLoadLocale(eGeneralOptions.Item("MaxGridPartition"), Strings.fopGeneral.MaxGridPartition) - XMLLoadLocale(eGeneralOptions.Item("BeepWhileSaved"), Strings.fopGeneral.BeepWhileSaved) - XMLLoadLocale(eGeneralOptions.Item("ExtendBPM"), Strings.fopGeneral.ExtendBPM) - XMLLoadLocale(eGeneralOptions.Item("ExtendSTOP"), Strings.fopGeneral.ExtendSTOP) - XMLLoadLocale(eGeneralOptions.Item("AutoFocusOnMouseEnter"), Strings.fopGeneral.AutoFocusOnMouseEnter) - XMLLoadLocale(eGeneralOptions.Item("DisableFirstClick"), Strings.fopGeneral.DisableFirstClick) - XMLLoadLocale(eGeneralOptions.Item("AutoSave"), Strings.fopGeneral.AutoSave) - XMLLoadLocale(eGeneralOptions.Item("minutes"), Strings.fopGeneral.minutes) - XMLLoadLocale(eGeneralOptions.Item("StopPreviewOnClick"), Strings.fopGeneral.StopPreviewOnClick) - End If - - Dim eFind As XmlElement = Root.Item("Find") - If eFind IsNot Nothing Then - XMLLoadLocale(eFind.Item("NoteRange"), Strings.fFind.NoteRange) - XMLLoadLocale(eFind.Item("MeasureRange"), Strings.fFind.MeasureRange) - XMLLoadLocale(eFind.Item("LabelRange"), Strings.fFind.LabelRange) - XMLLoadLocale(eFind.Item("ValueRange"), Strings.fFind.ValueRange) - XMLLoadLocale(eFind.Item("to"), Strings.fFind.to_) - XMLLoadLocale(eFind.Item("Selected"), Strings.fFind.Selected) - XMLLoadLocale(eFind.Item("UnSelected"), Strings.fFind.UnSelected) - XMLLoadLocale(eFind.Item("ShortNote"), Strings.fFind.ShortNote) - XMLLoadLocale(eFind.Item("LongNote"), Strings.fFind.LongNote) - XMLLoadLocale(eFind.Item("Hidden"), Strings.fFind.Hidden) - XMLLoadLocale(eFind.Item("Visible"), Strings.fFind.Visible) - XMLLoadLocale(eFind.Item("Column"), Strings.fFind.Column) - XMLLoadLocale(eFind.Item("SelectAll"), Strings.fFind.SelectAll) - XMLLoadLocale(eFind.Item("SelectInverse"), Strings.fFind.SelectInverse) - XMLLoadLocale(eFind.Item("UnselectAll"), Strings.fFind.UnselectAll) - XMLLoadLocale(eFind.Item("Operation"), Strings.fFind.Operation) - XMLLoadLocale(eFind.Item("ReplaceWithLabel"), Strings.fFind.ReplaceWithLabel) - XMLLoadLocale(eFind.Item("ReplaceWithValue"), Strings.fFind.ReplaceWithValue) - XMLLoadLocale(eFind.Item("Select"), Strings.fFind.Select_) - XMLLoadLocale(eFind.Item("Unselect"), Strings.fFind.Unselect_) - XMLLoadLocale(eFind.Item("Delete"), Strings.fFind.Delete_) - XMLLoadLocale(eFind.Item("Close"), Strings.fFind.Close_) - End If - - Dim eImportSM As XmlElement = Root.Item("ImportSM") - If eImportSM IsNot Nothing Then - XMLLoadLocale(eImportSM.Item("Title"), Strings.fImportSM.Title) - XMLLoadLocale(eImportSM.Item("Difficulty"), Strings.fImportSM.Difficulty) - XMLLoadLocale(eImportSM.Item("Note"), Strings.fImportSM.Note) - End If - - Dim eImportBMSON As XmlElement = Root.Item("ImportBMSON") - If eImportBMSON IsNot Nothing Then - XMLLoadLocale(eImportBMSON.Item("Message"), Strings.fImportBMSON.Message) - End If - - Dim eFileAssociation As XmlElement = Root.Item("FileAssociation") - If eFileAssociation IsNot Nothing Then - XMLLoadLocale(eFileAssociation.Item("BMS"), Strings.FileAssociation.BMS) - XMLLoadLocale(eFileAssociation.Item("BME"), Strings.FileAssociation.BME) - XMLLoadLocale(eFileAssociation.Item("BML"), Strings.FileAssociation.BML) - XMLLoadLocale(eFileAssociation.Item("PMS"), Strings.FileAssociation.PMS) - XMLLoadLocale(eFileAssociation.Item("IBMSC"), Strings.FileAssociation.IBMSC) - XMLLoadLocale(eFileAssociation.Item("Open"), Strings.FileAssociation.Open) - XMLLoadLocale(eFileAssociation.Item("Preview"), Strings.FileAssociation.Preview) - XMLLoadLocale(eFileAssociation.Item("ViewCode"), Strings.FileAssociation.ViewCode) - End If - - DispLang = Path.Replace(My.Application.Info.DirectoryPath & "\", String.Empty) - - Catch ex As Exception - Dim unused = MsgBox(Path & vbCrLf & vbCrLf & ex.Message, MsgBoxStyle.Exclamation) - - Finally - If FileStream IsNot Nothing Then FileStream.Close() - - POHeaderPart2.Visible = xPOHeaderPart2 - POGridPart2.Visible = xPOGridPart2 - POWaveFormPart2.Visible = xPOWaveFormPart2 - End Try - - 'File.Delete(xTempFileName) - End Sub - - Private Sub LoadThemeComptability(xPath As String) - Try - Dim xStrLine() As String = Split(My.Computer.FileSystem.ReadAllText(xPath), vbCrLf) - If xStrLine(0).Trim <> "iBMSC Configuration Settings Format" And xStrLine(0).Trim <> "iBMSC Theme Format" Then Exit Sub - - Dim xW1 As String = String.Empty - Dim xW2 As String = String.Empty - - For Each xLine As String In xStrLine - xW1 = UCase(Mid(xLine, 1, InStr(xLine, "=") - 1)) - xW2 = Mid(xLine, InStr(xLine, "=") + 1) - - Select Case xW1 - Case "VOTITLE" : vo.ColumnTitle.Color = Color.FromArgb(Val(xW2)) - Case "VOTITLEFONT" : vo.ColumnTitleFont = StringToFont(xW2, Font) - Case "VOBG" : vo.Bg.Color = Color.FromArgb(Val(xW2)) - Case "VOGRID" : vo.pGrid.Color = Color.FromArgb(Val(xW2)) - Case "VOSUB" : vo.pSub.Color = Color.FromArgb(Val(xW2)) - Case "VOVLINE" : vo.pVLine.Color = Color.FromArgb(Val(xW2)) - Case "VOMLINE" : vo.pMLine.Color = Color.FromArgb(Val(xW2)) - Case "VOBGMWAV" - vo.pBGMWav.Color = Color.FromArgb(Val(xW2)) - TWTransparency.Value = vo.pBGMWav.Color.A - TWTransparency2.Value = vo.pBGMWav.Color.A - TWSaturation.Value = vo.pBGMWav.Color.GetSaturation * 1000 - TWSaturation2.Value = vo.pBGMWav.Color.GetSaturation * 1000 - Case "VOSELBOX" : vo.SelBox.Color = Color.FromArgb(Val(xW2)) - Case "VOPECURSOR" : vo.PECursor.Color = Color.FromArgb(Val(xW2)) - Case "VOPEHALF" : vo.PEHalf.Color = Color.FromArgb(Val(xW2)) - Case "VOPEDELTAMOUSEOVER" : vo.PEDeltaMouseOver = Val(xW2) - Case "VOPEMOUSEOVER" : vo.PEMouseOver.Color = Color.FromArgb(Val(xW2)) - Case "VOPESEL" : vo.PESel.Color = Color.FromArgb(Val(xW2)) - Case "VOPEBPM" : vo.PEBPM.Color = Color.FromArgb(Val(xW2)) - Case "VOPEBPMFONT" : vo.PEBPMFont = StringToFont(xW2, Font) - Case "VKHEIGHT" : vo.kHeight = Val(xW2) - Case "VKFONT" : vo.kFont = StringToFont(xW2, Font) - Case "VKMFONT" : vo.kMFont = StringToFont(xW2, Font) - Case "VKLABELVSHIFT" : vo.kLabelVShift = Val(xW2) - Case "VKLABELHSHIFT" : vo.kLabelHShift = Val(xW2) - Case "VKLABELHSHIFTL" : vo.kLabelHShiftL = Val(xW2) - Case "VKMOUSEOVER" : vo.kMouseOver.Color = Color.FromArgb(Val(xW2)) - Case "VKMOUSEOVERE " : vo.kMouseOverE.Color = Color.FromArgb(Val(xW2)) - Case "VKSELECTED" : vo.kSelected.Color = Color.FromArgb(Val(xW2)) - 'Case "VKHIDTRANSPARENCY" : vo.kOpacity = Val(xW2) - - Case "KLENGTH" - Dim xE() As String = LoadThemeComptability_SplitStringInto26Parts(xW2) - For i As Integer = 0 To 26 - column(i).Width = Val(xE(i)) - Next - - Case "KTITLE" - Dim xE() As String = LoadThemeComptability_SplitStringInto26Parts(xW2) - For i As Integer = 0 To 26 - column(i).Title = xE(i) - Next - - Case "KCOLOR" - Dim xE() As String = LoadThemeComptability_SplitStringInto26Parts(xW2) - For i As Integer = 0 To 26 - column(i).setNoteColor(Val(xE(i))) - Next - - Case "KCOLORL" - Dim xE() As String = LoadThemeComptability_SplitStringInto26Parts(xW2) - For i As Integer = 0 To 26 - column(i).setLNoteColor(Val(xE(i))) - Next - - Case "KFORECOLOR" - Dim xE() As String = LoadThemeComptability_SplitStringInto26Parts(xW2) - For i As Integer = 0 To 26 - column(i).cText = Color.FromArgb(Val(xE(i))) - Next - - Case "KFORECOLORL" - Dim xE() As String = LoadThemeComptability_SplitStringInto26Parts(xW2) - For i As Integer = 0 To 26 - column(i).cLText = Color.FromArgb(Val(xE(i))) - Next - - Case "KBGCOLOR" - Dim xE() As String = LoadThemeComptability_SplitStringInto26Parts(xW2) - For i As Integer = 0 To 26 - column(i).cBG = Color.FromArgb(Val(xE(i))) - Next - - End Select - - Next - - Catch ex As Exception - Dim unused = MsgBox(ex.Message, MsgBoxStyle.Exclamation, Strings.Messages.Err) - - Finally - UpdateColumnsX() - - End Try - End Sub - - Private Function LoadThemeComptability_SplitStringInto26Parts(xLine As String) As String() - Dim xE() As String = Split(xLine, ",") - ReDim Preserve xE(26) - Return xE - End Function - - Private Sub LoadLang(sender As Object, e As EventArgs) - Dim xFN2 As String = sender.ToolTipText - 'ReadLanguagePack(xFN2) - LoadLocale(xFN2) - End Sub - - Private Sub LoadLocaleXML(xStr As FileInfo) - Dim d As New XmlDocument - Dim fs As New FileStream(xStr.FullName, FileMode.Open, FileAccess.Read) - - Try - d.Load(fs) - Dim xName As String = d.Item("iBMSC.Locale").GetAttribute("Name") - If xName = String.Empty Then xName = xStr.Name - - Dim unused1 = cmnLanguage.Items.Add(xName, Nothing, AddressOf LoadLang) - cmnLanguage.Items(cmnLanguage.Items.Count - 1).ToolTipText = xStr.FullName - - Catch ex As Exception - Dim unused = MsgBox(xStr.FullName & vbCrLf & vbCrLf & ex.Message, MsgBoxStyle.Exclamation) - - End Try - - fs.Close() - End Sub - - Private Sub LoadTheme(sender As Object, e As EventArgs) - 'If Not File.Exists(My.Application.Info.DirectoryPath & "\Data\" & sender.Text) Then Exit Sub - 'SaveTheme = True - 'LoadCFF(My.Computer.FileSystem.ReadAllText(My.Application.Info.DirectoryPath & "\Theme\" & sender.Text, System.Text.Encoding.Unicode)) - LoadSettings(My.Application.Info.DirectoryPath & "\Data\" & sender.Text) - ChangePlaySideSkin(False) - RefreshPanelAll() - End Sub + UpdateColumnsX() + FileStream.Close() + 'File.Delete(xTempFileName) + End Sub + + Private Sub XMLLoadLocaleMenu(n As XmlElement, ByRef target As String) + If n Is Nothing Then Exit Sub + target = If(n.HasAttribute("amp"), n.InnerText.Insert(Integer.Parse(n.GetAttribute("amp")), "&"), n.InnerText) + End Sub + + Private Sub XMLLoadLocale(n As XmlElement, ByRef target As String) + If n IsNot Nothing Then target = n.InnerText + End Sub + + Private Sub XMLLoadLocaleToolTipUniversal(n As XmlElement, target As Control) + If n Is Nothing Then Exit Sub + ToolTipUniversal.SetToolTip(target, n.InnerText) + End Sub + + Private Sub LoadLocale(Path As String) + If Not My.Computer.FileSystem.FileExists(Path) Then Return + + Dim Doc As XmlDocument = Nothing + Dim FileStream As FileStream = Nothing + + Dim xPOHeaderPart2 As Boolean = POHeaderPart2.Visible + Dim xPOGridPart2 As Boolean = POGridPart2.Visible + Dim xPOWaveFormPart2 As Boolean = POWaveFormPart2.Visible + POHeaderPart2.Visible = True + POGridPart2.Visible = True + POWaveFormPart2.Visible = True + + Try + Doc = New XmlDocument + FileStream = New FileStream(Path, FileMode.Open, FileAccess.Read) + Doc.Load(FileStream) + + Dim Root As XmlElement = Doc.Item("iBMSC.Locale") + If Root Is Nothing Then Throw New NullReferenceException + + XMLLoadLocale(Root.Item("OK"), Strings.OK) + XMLLoadLocale(Root.Item("Cancel"), Strings.Cancel) + XMLLoadLocale(Root.Item("None"), Strings.None) + + Dim eFont As XmlElement = Root.Item("Font") + If eFont IsNot Nothing Then + Dim xSize As Integer = 9 + If eFont.HasAttribute("Size") Then xSize = Val(eFont.GetAttribute("Size")) + + Dim fRegular As New Font(Font.FontFamily, xSize, FontStyle.Regular) + Dim xChildNode As XmlNode = eFont.LastChild + Do While xChildNode IsNot Nothing + If xChildNode.LocalName <> "Family" Then Continue Do + If isFontInstalled(xChildNode.InnerText) Then + fRegular = New Font(xChildNode.InnerText, xSize) + End If + xChildNode = xChildNode.PreviousSibling + Loop + + Dim rList() As Object = {Me, mnSys, Menu1, mnMain, cmnLanguage, cmnTheme, cmnConversion, TBMain, FStatus, FStatus2} + For Each c As Object In rList + Try + c.Font = fRegular + Catch ex As Exception + End Try + Next + + Dim fBold As New Font(fRegular, FontStyle.Bold) + + Dim bList() As Object = {TBStatistics, FSSS, FSSL, FSSH, TVCM, TVCD, TVCBPM, FSP1, FSP3, FSP2, PMain, PMainIn, PMainR, PMainInR, PMainL, PMainInL} + For Each c As Object In bList + Try + c.Font = fBold + Catch ex As Exception + End Try + Next + End If + + Dim eMonoFont As XmlElement = Root.Item("MonoFont") + If eMonoFont IsNot Nothing Then + Dim xSize As Integer = 9 + If eMonoFont.HasAttribute("Size") Then xSize = Val(eMonoFont.GetAttribute("Size")) + + Dim fMono As New Font(POWAVInner.Font.FontFamily, xSize) + Dim xChildNode As XmlNode = eMonoFont.LastChild + Do While xChildNode IsNot Nothing + If xChildNode.LocalName <> "Family" Then Continue Do + If isFontInstalled(xChildNode.InnerText) Then + fMono = New Font(xChildNode.InnerText, xSize) + End If + xChildNode = xChildNode.PreviousSibling + Loop + + Dim mList() As Object = {LWAV, LBMP, LBeat, TExpansion} + For Each c As Object In mList + Try + c.font = fMono + Catch ex As Exception + End Try + Next + End If + + Dim eMenu As XmlElement = Root.Item("Menu") + If eMenu IsNot Nothing Then + + Dim eFile As XmlElement = eMenu.Item("File") + If eFile IsNot Nothing Then + XMLLoadLocaleMenu(eFile.Item("Title"), mnFile.Text) + XMLLoadLocaleMenu(eFile.Item("New"), mnNew.Text) + XMLLoadLocaleMenu(eFile.Item("Open"), mnOpen.Text) + XMLLoadLocaleMenu(eFile.Item("ImportSM"), mnImportSM.Text) + XMLLoadLocaleMenu(eFile.Item("ImportIBMSC"), mnImportIBMSC.Text) + XMLLoadLocaleMenu(eFile.Item("Save"), mnSave.Text) + XMLLoadLocaleMenu(eFile.Item("SaveAs"), mnSaveAs.Text) + XMLLoadLocaleMenu(eFile.Item("ExportIBMSC"), mnExportIBMSC.Text) + XMLLoadLocaleMenu(eFile.Item("ExportBMSON"), mnExportBMSON.Text) + If Recent(0) = String.Empty Then XMLLoadLocaleMenu(eFile.Item("Recent0"), mnOpenR0.Text) + If Recent(1) = String.Empty Then XMLLoadLocaleMenu(eFile.Item("Recent1"), mnOpenR1.Text) + If Recent(2) = String.Empty Then XMLLoadLocaleMenu(eFile.Item("Recent2"), mnOpenR2.Text) + If Recent(3) = String.Empty Then XMLLoadLocaleMenu(eFile.Item("Recent3"), mnOpenR3.Text) + If Recent(4) = String.Empty Then XMLLoadLocaleMenu(eFile.Item("Recent4"), mnOpenR4.Text) + XMLLoadLocaleMenu(eFile.Item("Quit"), mnQuit.Text) + End If + + Dim eEdit As XmlElement = eMenu.Item("Edit") + If eEdit IsNot Nothing Then + XMLLoadLocaleMenu(eEdit.Item("Title"), mnEdit.Text) + XMLLoadLocaleMenu(eEdit.Item("Undo"), mnUndo.Text) + XMLLoadLocaleMenu(eEdit.Item("Redo"), mnRedo.Text) + XMLLoadLocaleMenu(eEdit.Item("Cut"), mnCut.Text) + XMLLoadLocaleMenu(eEdit.Item("Copy"), mnCopy.Text) + XMLLoadLocaleMenu(eEdit.Item("Paste"), mnPaste.Text) + XMLLoadLocaleMenu(eEdit.Item("Delete"), mnDelete.Text) + XMLLoadLocaleMenu(eEdit.Item("SelectAll"), mnSelectAll.Text) + XMLLoadLocaleMenu(eEdit.Item("Find"), mnFind.Text) + XMLLoadLocaleMenu(eEdit.Item("Stat"), mnStatistics.Text) + XMLLoadLocaleMenu(eEdit.Item("TimeSelectionTool"), mnTimeSelect.Text) + XMLLoadLocaleMenu(eEdit.Item("SelectTool"), mnSelect.Text) + XMLLoadLocaleMenu(eEdit.Item("WriteTool"), mnWrite.Text) + XMLLoadLocaleMenu(eEdit.Item("MyO2"), mnMyO2.Text) + End If + + Dim eView As XmlElement = eMenu.Item("View") + If eView IsNot Nothing Then + XMLLoadLocaleMenu(eView.Item("Title"), mnSys.Text) + End If + + Dim eOptions As XmlElement = eMenu.Item("Options") + If eOptions IsNot Nothing Then + XMLLoadLocaleMenu(eOptions.Item("Title"), mnOptions.Text) + XMLLoadLocaleMenu(eOptions.Item("NT"), mnNTInput.Text) + XMLLoadLocaleMenu(eOptions.Item("ErrorCheck"), mnErrorCheck.Text) + XMLLoadLocaleMenu(eOptions.Item("PreviewOnClick"), mnPreviewOnClick.Text) + XMLLoadLocaleMenu(eOptions.Item("ShowFileName"), mnShowFileName.Text) + XMLLoadLocaleMenu(eOptions.Item("ChangePlaySide"), mnChangePlaySide.Text) + XMLLoadLocaleMenu(eOptions.Item("GeneralOptions"), mnGOptions.Text) + XMLLoadLocaleMenu(eOptions.Item("VisualOptions"), mnVOptions.Text) + XMLLoadLocaleMenu(eOptions.Item("PlayerOptions"), mnPOptions.Text) + XMLLoadLocaleMenu(eOptions.Item("Language"), mnLanguage.Text) + XMLLoadLocaleMenu(eOptions.Item("Theme"), mnTheme.Text) + End If + + XMLLoadLocaleMenu(eMenu.Item("Conversion"), mnConversion.Text) + + Dim ePreview As XmlElement = eMenu.Item("Preview") + If ePreview IsNot Nothing Then + XMLLoadLocaleMenu(ePreview.Item("Title"), mnPreview.Text) + XMLLoadLocaleMenu(ePreview.Item("PlayBegin"), mnPlayB.Text) + XMLLoadLocaleMenu(ePreview.Item("PlayHere"), mnPlay.Text) + XMLLoadLocaleMenu(ePreview.Item("PlayStop"), mnStop.Text) + End If + + Dim eAbout As XmlElement = eMenu.Item("About") + If eAbout IsNot Nothing Then + 'XMLLoadLocaleMenu(eAbout.Item("Title"), mnAbout.Text) + 'XMLLoadLocaleMenu(eAbout.Item("About"), mnAbout1.Text) + 'XMLLoadLocaleMenu(eAbout.Item("CheckUpdates"), mnUpdate.Text) + 'XMLLoadLocaleMenu(eAbout.Item("CheckUpdatesC"), mnUpdateC.Text) + End If + End If + + Dim eToolBar As XmlElement = Root.Item("ToolBar") + If eToolBar IsNot Nothing Then + XMLLoadLocale(eToolBar.Item("New"), TBNew.Text) + XMLLoadLocale(eToolBar.Item("Open"), TBOpen.Text) + XMLLoadLocale(eToolBar.Item("Save"), TBSave.Text) + XMLLoadLocale(eToolBar.Item("Cut"), TBCut.Text) + XMLLoadLocale(eToolBar.Item("Copy"), TBCopy.Text) + XMLLoadLocale(eToolBar.Item("Paste"), TBPaste.Text) + XMLLoadLocale(eToolBar.Item("Find"), TBFind.Text) + XMLLoadLocale(eToolBar.Item("Stat"), TBStatistics.ToolTipText) + XMLLoadLocale(eToolBar.Item("Conversion"), POConvert.Text) + XMLLoadLocale(eToolBar.Item("MyO2"), TBMyO2.Text) + XMLLoadLocale(eToolBar.Item("ErrorCheck"), TBErrorCheck.Text) + XMLLoadLocale(eToolBar.Item("PreviewOnClick"), TBPreviewOnClick.Text) + XMLLoadLocale(eToolBar.Item("ShowFileName"), TBShowFileName.Text) + XMLLoadLocale(eToolBar.Item("ChangePlaySide"), TBChangePlaySide.Text) + XMLLoadLocale(eToolBar.Item("Undo"), TBUndo.Text) + XMLLoadLocale(eToolBar.Item("Redo"), TBRedo.Text) + XMLLoadLocale(eToolBar.Item("NT"), TBNTInput.Text) + XMLLoadLocale(eToolBar.Item("TimeSelectionTool"), TBTimeSelect.Text) + XMLLoadLocale(eToolBar.Item("SelectTool"), TBSelect.Text) + XMLLoadLocale(eToolBar.Item("WriteTool"), TBWrite.Text) + XMLLoadLocale(eToolBar.Item("PlayBegin"), TBPlayB.Text) + XMLLoadLocale(eToolBar.Item("PlayHere"), TBPlay.Text) + XMLLoadLocale(eToolBar.Item("PlayStop"), TBStop.Text) + XMLLoadLocale(eToolBar.Item("PlayerOptions"), TBPOptions.Text) + XMLLoadLocale(eToolBar.Item("VisualOptions"), TBVOptions.Text) + XMLLoadLocale(eToolBar.Item("GeneralOptions"), TBGOptions.Text) + XMLLoadLocale(eToolBar.Item("Language"), TBLanguage.Text) + XMLLoadLocale(eToolBar.Item("Theme"), TBTheme.Text) + ' XMLLoadLocale(eToolBar.Item("About"), TBAbout.Text) + End If + + Dim eStatusBar As XmlElement = Root.Item("StatusBar") + If eStatusBar IsNot Nothing Then + XMLLoadLocale(eStatusBar.Item("ColumnCaption"), FSC.ToolTipText) + XMLLoadLocale(eStatusBar.Item("NoteIndex"), FSW.ToolTipText) + XMLLoadLocale(eStatusBar.Item("MeasureIndex"), FSM.ToolTipText) + XMLLoadLocale(eStatusBar.Item("GridResolution"), FSP1.ToolTipText) + XMLLoadLocale(eStatusBar.Item("ReducedResolution"), FSP3.ToolTipText) + XMLLoadLocale(eStatusBar.Item("MeasureResolution"), FSP2.ToolTipText) + XMLLoadLocale(eStatusBar.Item("AbsolutePosition"), FSP4.ToolTipText) + XMLLoadLocale(eStatusBar.Item("Length"), Strings.StatusBar.Length) + XMLLoadLocale(eStatusBar.Item("LongNote"), Strings.StatusBar.LongNote) + XMLLoadLocale(eStatusBar.Item("Hidden"), Strings.StatusBar.Hidden) + XMLLoadLocale(eStatusBar.Item("LandMine"), Strings.StatusBar.LandMine) + XMLLoadLocale(eStatusBar.Item("Error"), Strings.StatusBar.Err) + XMLLoadLocale(eStatusBar.Item("SelStart"), FSSS.ToolTipText) + XMLLoadLocale(eStatusBar.Item("SelLength"), FSSL.ToolTipText) + XMLLoadLocale(eStatusBar.Item("SelSplit"), FSSH.ToolTipText) + XMLLoadLocale(eStatusBar.Item("Reverse"), BVCReverse.Text) + XMLLoadLocale(eStatusBar.Item("ByMultiple"), BVCApply.Text) + XMLLoadLocale(eStatusBar.Item("ByValue"), BVCCalculate.Text) + End If + + Dim eSubMenu As XmlElement = Root.Item("SubMenu") + If eSubMenu IsNot Nothing Then + + Dim eShowHide As XmlElement = eSubMenu.Item("ShowHide") + If eShowHide IsNot Nothing Then + 'Dim xToolTip As String = ToolTipUniversal.GetToolTip(ttlIcon) + 'XMLLoadLocaleMenu(eShowHide.Item("ToolTip"), xToolTip) + 'ToolTipUniversal.SetToolTip(ttlIcon, xToolTip) + + XMLLoadLocaleMenu(eShowHide.Item("Menu"), mnSMenu.Text) + XMLLoadLocaleMenu(eShowHide.Item("ToolBar"), mnSTB.Text) + XMLLoadLocaleMenu(eShowHide.Item("OptionsPanel"), mnSOP.Text) + XMLLoadLocaleMenu(eShowHide.Item("StatusBar"), mnSStatus.Text) + XMLLoadLocaleMenu(eShowHide.Item("LSplit"), mnSLSplitter.Text) + XMLLoadLocaleMenu(eShowHide.Item("RSplit"), mnSRSplitter.Text) + XMLLoadLocaleMenu(eShowHide.Item("Grid"), CGShow.Text) + XMLLoadLocaleMenu(eShowHide.Item("Sub"), CGShowS.Text) + XMLLoadLocaleMenu(eShowHide.Item("BG"), CGShowBG.Text) + XMLLoadLocaleMenu(eShowHide.Item("MeasureIndex"), CGShowM.Text) + XMLLoadLocaleMenu(eShowHide.Item("MeasureLine"), CGShowMB.Text) + XMLLoadLocaleMenu(eShowHide.Item("Vertical"), CGShowV.Text) + XMLLoadLocaleMenu(eShowHide.Item("ColumnCaption"), CGShowC.Text) + XMLLoadLocaleMenu(eShowHide.Item("BPM"), CGBPM.Text) + XMLLoadLocaleMenu(eShowHide.Item("STOP"), CGSTOP.Text) + XMLLoadLocaleMenu(eShowHide.Item("SCROLL"), CGSCROLL.Text) + XMLLoadLocaleMenu(eShowHide.Item("BLP"), CGBLP.Text) + End If + + Dim eInsertMeasure As XmlElement = eSubMenu.Item("InsertMeasure") + If eInsertMeasure IsNot Nothing Then + XMLLoadLocaleMenu(eInsertMeasure.Item("Insert"), MInsert.Text) + XMLLoadLocaleMenu(eInsertMeasure.Item("Remove"), MRemove.Text) + End If + + Dim eLanguage As XmlElement = eSubMenu.Item("Language") + If eLanguage IsNot Nothing Then + XMLLoadLocaleMenu(eLanguage.Item("Default"), TBLangDef.Text) + XMLLoadLocaleMenu(eLanguage.Item("Refresh"), TBLangRefresh.Text) + End If + + Dim eTheme As XmlElement = eSubMenu.Item("Theme") + If eTheme IsNot Nothing Then + XMLLoadLocaleMenu(eTheme.Item("Default"), TBThemeDef.Text) + XMLLoadLocaleMenu(eTheme.Item("Save"), TBThemeSave.Text) + XMLLoadLocaleMenu(eTheme.Item("Refresh"), TBThemeRefresh.Text) + XMLLoadLocaleMenu(eTheme.Item("LoadComptability"), TBThemeLoadComptability.Text) + End If + + Dim eConvert As XmlElement = eSubMenu.Item("Convert") + If eConvert IsNot Nothing Then + XMLLoadLocaleMenu(eConvert.Item("Long"), POBLong.Text) + XMLLoadLocaleMenu(eConvert.Item("Short"), POBShort.Text) + XMLLoadLocaleMenu(eConvert.Item("LongShort"), POBLongShort.Text) + XMLLoadLocaleMenu(eConvert.Item("Hidden"), POBHidden.Text) + XMLLoadLocaleMenu(eConvert.Item("Visible"), POBVisible.Text) + XMLLoadLocaleMenu(eConvert.Item("HiddenVisible"), POBHiddenVisible.Text) + XMLLoadLocaleMenu(eConvert.Item("Relabel"), POBModify.Text) + XMLLoadLocaleMenu(eConvert.Item("Mirror"), POBMirror.Text) + End If + + Dim eWAV As XmlElement = eSubMenu.Item("WAV") + If eWAV IsNot Nothing Then + XMLLoadLocaleMenu(eWAV.Item("MultiSelection"), CWAVMultiSelect.Text) + XMLLoadLocaleMenu(eWAV.Item("Synchronize"), CWAVChangeLabel.Text) + XMLLoadLocaleMenu(eWAV.Item("Emptyfill"), CWAVEmptyfill.Text) + End If + + Dim eBeat As XmlElement = eSubMenu.Item("Beat") + If eBeat IsNot Nothing Then + XMLLoadLocaleMenu(eBeat.Item("Absolute"), CBeatPreserve.Text) + XMLLoadLocaleMenu(eBeat.Item("Measure"), CBeatMeasure.Text) + XMLLoadLocaleMenu(eBeat.Item("Cut"), CBeatCut.Text) + XMLLoadLocaleMenu(eBeat.Item("Scale"), CBeatScale.Text) + End If + End If + + Dim eOptionsPanel As XmlElement = Root.Item("OptionsPanel") + If eOptionsPanel IsNot Nothing Then + + Dim eHeader As XmlElement = eOptionsPanel.Item("Header") + If eHeader IsNot Nothing Then + XMLLoadLocale(eHeader.Item("Header"), POHeaderSwitch.Text) + XMLLoadLocale(eHeader.Item("Title"), Label3.Text) + XMLLoadLocale(eHeader.Item("Artist"), Label4.Text) + XMLLoadLocale(eHeader.Item("Genre"), Label2.Text) + XMLLoadLocale(eHeader.Item("BPM"), Label9.Text) + XMLLoadLocale(eHeader.Item("Player"), Label8.Text) + XMLLoadLocale(eHeader.Item("Rank"), Label10.Text) + XMLLoadLocale(eHeader.Item("PlayLevel"), Label6.Text) + XMLLoadLocale(eHeader.Item("SubTitle"), Label15.Text) + XMLLoadLocale(eHeader.Item("SubArtist"), Label17.Text) + 'XMLLoadLocale(eHeader.Item("Maker"), Label14.Text) + XMLLoadLocale(eHeader.Item("StageFile"), Label16.Text) + XMLLoadLocale(eHeader.Item("Banner"), Label12.Text) + XMLLoadLocale(eHeader.Item("BackBMP"), Label11.Text) + 'XMLLoadLocale(eHeader.Item("MidiFile"), Label18.Text) + XMLLoadLocale(eHeader.Item("Difficulty"), Label21.Text) + XMLLoadLocale(eHeader.Item("ExRank"), Label23.Text) + XMLLoadLocale(eHeader.Item("Total"), Label20.Text) + 'XMLLoadLocale(eHeader.Item("VolWav"), Label22.Text) + XMLLoadLocale(eHeader.Item("Comment"), Label19.Text) + 'XMLLoadLocale(eHeader.Item("LnType"), Label13.Text) + XMLLoadLocale(eHeader.Item("LnObj"), Label24.Text) + XMLLoadLocale(eHeader.Item("LandMine"), Label26.Text) + XMLLoadLocale(eHeader.Item("MissBMP"), Label27.Text) + + RemoveHandler CHPlayer.SelectedIndexChanged, AddressOf CHPlayer_SelectedIndexChanged + XMLLoadLocale(eHeader.Item("Player1"), CHPlayer.Items.Item(0)) + XMLLoadLocale(eHeader.Item("Player2"), CHPlayer.Items.Item(1)) + XMLLoadLocale(eHeader.Item("Player3"), CHPlayer.Items.Item(2)) + AddHandler CHPlayer.SelectedIndexChanged, AddressOf CHPlayer_SelectedIndexChanged + + RemoveHandler CHRank.SelectedIndexChanged, AddressOf THGenre_TextChanged + XMLLoadLocale(eHeader.Item("Rank0"), CHRank.Items.Item(0)) + XMLLoadLocale(eHeader.Item("Rank1"), CHRank.Items.Item(1)) + XMLLoadLocale(eHeader.Item("Rank2"), CHRank.Items.Item(2)) + XMLLoadLocale(eHeader.Item("Rank3"), CHRank.Items.Item(3)) + XMLLoadLocale(eHeader.Item("Rank4"), CHRank.Items.Item(4)) + AddHandler CHRank.SelectedIndexChanged, AddressOf THGenre_TextChanged + + RemoveHandler CHDifficulty.SelectedIndexChanged, AddressOf THGenre_TextChanged + XMLLoadLocale(eHeader.Item("Difficulty0"), CHDifficulty.Items.Item(0)) + XMLLoadLocale(eHeader.Item("Difficulty1"), CHDifficulty.Items.Item(1)) + XMLLoadLocale(eHeader.Item("Difficulty2"), CHDifficulty.Items.Item(2)) + XMLLoadLocale(eHeader.Item("Difficulty3"), CHDifficulty.Items.Item(3)) + XMLLoadLocale(eHeader.Item("Difficulty4"), CHDifficulty.Items.Item(4)) + XMLLoadLocale(eHeader.Item("Difficulty5"), CHDifficulty.Items.Item(5)) + AddHandler CHDifficulty.SelectedIndexChanged, AddressOf THGenre_TextChanged + End If + + Dim eGrid As XmlElement = eOptionsPanel.Item("Grid") + If eGrid IsNot Nothing Then + XMLLoadLocale(eGrid.Item("Title"), POGridSwitch.Text) + XMLLoadLocale(eGrid.Item("Snap"), CGSnap.Text) + XMLLoadLocale(eGrid.Item("BCols"), Label1.Text) + XMLLoadLocale(eGrid.Item("DisableVertical"), CGDisableVertical.Text) + XMLLoadLocale(eGrid.Item("Scroll"), Label5.Text) + XMLLoadLocaleToolTipUniversal(eGrid.Item("LockLeft"), cVSLockL) + XMLLoadLocaleToolTipUniversal(eGrid.Item("LockMiddle"), cVSLock) + XMLLoadLocaleToolTipUniversal(eGrid.Item("LockRight"), cVSLockR) + End If + + Dim eWaveForm As XmlElement = eOptionsPanel.Item("WaveForm") + If eWaveForm IsNot Nothing Then + XMLLoadLocale(eWaveForm.Item("Title"), POWaveFormSwitch.Text) + XMLLoadLocaleToolTipUniversal(eWaveForm.Item("Load"), BWLoad) + XMLLoadLocaleToolTipUniversal(eWaveForm.Item("Clear"), BWClear) + XMLLoadLocaleToolTipUniversal(eWaveForm.Item("Lock"), BWLock) + End If + + Dim eWAV As XmlElement = eOptionsPanel.Item("WAV") + If eWAV IsNot Nothing Then + XMLLoadLocale(eWAV.Item("Title"), POWAVSwitch.Text) + XMLLoadLocaleToolTipUniversal(eWAV.Item("MoveUp"), BBMPUp) + XMLLoadLocaleToolTipUniversal(eWAV.Item("MoveDown"), BBMPDown) + XMLLoadLocaleToolTipUniversal(eWAV.Item("Browse"), BBMPBrowse) + XMLLoadLocaleToolTipUniversal(eWAV.Item("Remove"), BBMPRemove) + XMLLoadLocaleToolTipUniversal(eWAV.Item("MoveUp"), BWAVUp) + XMLLoadLocaleToolTipUniversal(eWAV.Item("MoveDown"), BWAVDown) + XMLLoadLocaleToolTipUniversal(eWAV.Item("Browse"), BWAVBrowse) + XMLLoadLocaleToolTipUniversal(eWAV.Item("Remove"), BWAVRemove) + End If + + Dim eBMP As XmlElement = eOptionsPanel.Item("BMP") + If eBMP IsNot Nothing Then + XMLLoadLocale(eBMP.Item("Title"), POBMPSwitch.Text) + End If + + XMLLoadLocale(eOptionsPanel.Item("Beat"), POBeatSwitch.Text) + XMLLoadLocale(eOptionsPanel.Item("Beat.Apply"), BBeatApply.Text) + XMLLoadLocale(eOptionsPanel.Item("Beat.Apply"), BBeatApplyV.Text) + XMLLoadLocale(eOptionsPanel.Item("Expansion"), POExpansionSwitch.Text) + End If + + Dim eMessages As XmlElement = Root.Item("Messages") + If eMessages IsNot Nothing Then + XMLLoadLocale(eMessages.Item("Err"), Strings.Messages.Err) + XMLLoadLocale(eMessages.Item("SaveOnExit"), Strings.Messages.SaveOnExit) + XMLLoadLocale(eMessages.Item("SaveOnExit1"), Strings.Messages.SaveOnExit1) + XMLLoadLocale(eMessages.Item("SaveOnExit2"), Strings.Messages.SaveOnExit2) + XMLLoadLocale(eMessages.Item("PromptEnter"), Strings.Messages.PromptEnter) + XMLLoadLocale(eMessages.Item("PromptEnterNumeric"), Strings.Messages.PromptEnterNumeric) + XMLLoadLocale(eMessages.Item("PromptEnterBPM"), Strings.Messages.PromptEnterBPM) + XMLLoadLocale(eMessages.Item("PromptEnterSTOP"), Strings.Messages.PromptEnterSTOP) + XMLLoadLocale(eMessages.Item("PromptEnterSCROLL"), Strings.Messages.PromptEnterSCROLL) + XMLLoadLocale(eMessages.Item("PromptSlashValue"), Strings.Messages.PromptSlashValue) + XMLLoadLocale(eMessages.Item("InvalidLabel"), Strings.Messages.InvalidLabel) + XMLLoadLocale(eMessages.Item("CannotFind"), Strings.Messages.CannotFind) + XMLLoadLocale(eMessages.Item("PleaseRespecifyPath"), Strings.Messages.PleaseRespecifyPath) + XMLLoadLocale(eMessages.Item("PlayerNotFound"), Strings.Messages.PlayerNotFound) + XMLLoadLocale(eMessages.Item("PreviewDelError"), Strings.Messages.PreviewDelError) + XMLLoadLocale(eMessages.Item("NegativeFactorError"), Strings.Messages.NegativeFactorError) + XMLLoadLocale(eMessages.Item("NegativeDivisorError"), Strings.Messages.NegativeDivisorError) + XMLLoadLocale(eMessages.Item("PreferencePostpone"), Strings.Messages.PreferencePostpone) + XMLLoadLocale(eMessages.Item("EraserObsolete"), Strings.Messages.EraserObsolete) + XMLLoadLocale(eMessages.Item("SaveWarning"), Strings.Messages.SaveWarning) + XMLLoadLocale(eMessages.Item("NoteOverlapError"), Strings.Messages.NoteOverlapError) + XMLLoadLocale(eMessages.Item("BPMOverflowError"), Strings.Messages.BPMOverflowError) + XMLLoadLocale(eMessages.Item("STOPOverflowError"), Strings.Messages.STOPOverflowError) + XMLLoadLocale(eMessages.Item("SCROLLOverflowError"), Strings.Messages.SCROLLOverflowError) + XMLLoadLocale(eMessages.Item("SavedFileWillContainErrors"), Strings.Messages.SavedFileWillContainErrors) + XMLLoadLocale(eMessages.Item("FileAssociationPrompt"), Strings.Messages.FileAssociationPrompt) + XMLLoadLocale(eMessages.Item("FileAssociationError"), Strings.Messages.FileAssociationError) + XMLLoadLocale(eMessages.Item("RestoreDefaultSettings"), Strings.Messages.RestoreDefaultSettings) + XMLLoadLocale(eMessages.Item("RestoreAutosavedFile"), Strings.Messages.RestoreAutosavedFile) + End If + + Dim eFileType As XmlElement = Root.Item("FileType") + If eFileType IsNot Nothing Then + XMLLoadLocale(eFileType.Item("_all"), Strings.FileType._all) + XMLLoadLocale(eFileType.Item("_bms"), Strings.FileType._bms) + XMLLoadLocale(eFileType.Item("BMS"), Strings.FileType.BMS) + XMLLoadLocale(eFileType.Item("BME"), Strings.FileType.BME) + XMLLoadLocale(eFileType.Item("BML"), Strings.FileType.BML) + XMLLoadLocale(eFileType.Item("PMS"), Strings.FileType.PMS) + XMLLoadLocale(eFileType.Item("TXT"), Strings.FileType.TXT) + XMLLoadLocale(eFileType.Item("SM"), Strings.FileType.SM) + XMLLoadLocale(eFileType.Item("IBMSC"), Strings.FileType.IBMSC) + XMLLoadLocale(eFileType.Item("XML"), Strings.FileType.XML) + XMLLoadLocale(eFileType.Item("THEME_XML"), Strings.FileType.THEME_XML) + XMLLoadLocale(eFileType.Item("TH"), Strings.FileType.TH) + XMLLoadLocale(eFileType.Item("_audio"), Strings.FileType._audio) + XMLLoadLocale(eFileType.Item("_wave"), Strings.FileType._wave) + XMLLoadLocale(eFileType.Item("WAV"), Strings.FileType.WAV) + XMLLoadLocale(eFileType.Item("OGG"), Strings.FileType.OGG) + XMLLoadLocale(eFileType.Item("MP3"), Strings.FileType.MP3) + XMLLoadLocale(eFileType.Item("FLAC"), Strings.FileType.FLAC) + XMLLoadLocale(eFileType.Item("MID"), Strings.FileType.MID) + XMLLoadLocale(eFileType.Item("_image"), Strings.FileType._image) + XMLLoadLocale(eFileType.Item("_movie"), Strings.FileType._movie) + XMLLoadLocale(eFileType.Item("BMP"), Strings.FileType.BMP) + XMLLoadLocale(eFileType.Item("PNG"), Strings.FileType.PNG) + XMLLoadLocale(eFileType.Item("JPG"), Strings.FileType.JPG) + XMLLoadLocale(eFileType.Item("GIF"), Strings.FileType.GIF) + XMLLoadLocale(eFileType.Item("MPG"), Strings.FileType.MPG) + XMLLoadLocale(eFileType.Item("AVI"), Strings.FileType.AVI) + XMLLoadLocale(eFileType.Item("MP4"), Strings.FileType.MP4) + XMLLoadLocale(eFileType.Item("WMV"), Strings.FileType.WMV) + XMLLoadLocale(eFileType.Item("WEBM"), Strings.FileType.WEBM) + XMLLoadLocale(eFileType.Item("EXE"), Strings.FileType.EXE) + End If + + Dim eStatistics As XmlElement = Root.Item("Statistics") + If eStatistics IsNot Nothing Then + XMLLoadLocale(eStatistics.Item("Title"), Strings.fStatistics.Title) + XMLLoadLocale(eStatistics.Item("lBPM"), Strings.fStatistics.lBPM) + XMLLoadLocale(eStatistics.Item("lSTOP"), Strings.fStatistics.lSTOP) + XMLLoadLocale(eStatistics.Item("lSCROLL"), Strings.fStatistics.lSCROLL) + XMLLoadLocale(eStatistics.Item("lA"), Strings.fStatistics.lA) + XMLLoadLocale(eStatistics.Item("lD"), Strings.fStatistics.lD) + XMLLoadLocale(eStatistics.Item("lBGM"), Strings.fStatistics.lBGM) + XMLLoadLocale(eStatistics.Item("lTotal"), Strings.fStatistics.lTotal) + XMLLoadLocale(eStatistics.Item("lShort"), Strings.fStatistics.lShort) + XMLLoadLocale(eStatistics.Item("lLong"), Strings.fStatistics.lLong) + XMLLoadLocale(eStatistics.Item("lLnObj"), Strings.fStatistics.lLnObj) + XMLLoadLocale(eStatistics.Item("lHidden"), Strings.fStatistics.lHidden) + XMLLoadLocale(eStatistics.Item("lLandMine"), Strings.fStatistics.lLandMine) + XMLLoadLocale(eStatistics.Item("lErrors"), Strings.fStatistics.lErrors) + End If + + Dim ePlayerOptions As XmlElement = Root.Item("PlayerOptions") + If ePlayerOptions IsNot Nothing Then + XMLLoadLocale(ePlayerOptions.Item("Title"), Strings.fopPlayer.Title) + XMLLoadLocale(ePlayerOptions.Item("Add"), Strings.fopPlayer.Add) + XMLLoadLocale(ePlayerOptions.Item("Remove"), Strings.fopPlayer.Remove) + XMLLoadLocale(ePlayerOptions.Item("Path"), Strings.fopPlayer.Path) + XMLLoadLocale(ePlayerOptions.Item("PlayFromBeginning"), Strings.fopPlayer.PlayFromBeginning) + XMLLoadLocale(ePlayerOptions.Item("PlayFromHere"), Strings.fopPlayer.PlayFromHere) + XMLLoadLocale(ePlayerOptions.Item("StopPlaying"), Strings.fopPlayer.StopPlaying) + XMLLoadLocale(ePlayerOptions.Item("References"), Strings.fopPlayer.References) + XMLLoadLocale(ePlayerOptions.Item("DirectoryOfApp"), Strings.fopPlayer.DirectoryOfApp) + XMLLoadLocale(ePlayerOptions.Item("CurrMeasure"), Strings.fopPlayer.CurrMeasure) + XMLLoadLocale(ePlayerOptions.Item("FileName"), Strings.fopPlayer.FileName) + XMLLoadLocale(ePlayerOptions.Item("RestoreDefault"), Strings.fopPlayer.RestoreDefault) + End If + + Dim eVisualOptions As XmlElement = Root.Item("VisualOptions") + If eVisualOptions IsNot Nothing Then + XMLLoadLocale(eVisualOptions.Item("Title"), Strings.fopVisual.Title) + XMLLoadLocale(eVisualOptions.Item("Width"), Strings.fopVisual.Width) + XMLLoadLocale(eVisualOptions.Item("Caption"), Strings.fopVisual.Caption) + XMLLoadLocale(eVisualOptions.Item("Note"), Strings.fopVisual.Note) + XMLLoadLocale(eVisualOptions.Item("Label"), Strings.fopVisual.Label) + XMLLoadLocale(eVisualOptions.Item("LongNote"), Strings.fopVisual.LongNote) + XMLLoadLocale(eVisualOptions.Item("LongNoteLabel"), Strings.fopVisual.LongNoteLabel) + XMLLoadLocale(eVisualOptions.Item("Bg"), Strings.fopVisual.Bg) + XMLLoadLocale(eVisualOptions.Item("ColumnCaption"), Strings.fopVisual.ColumnCaption) + XMLLoadLocale(eVisualOptions.Item("ColumnCaptionFont"), Strings.fopVisual.ColumnCaptionFont) + XMLLoadLocale(eVisualOptions.Item("Background"), Strings.fopVisual.Background) + XMLLoadLocale(eVisualOptions.Item("Grid"), Strings.fopVisual.Grid) + XMLLoadLocale(eVisualOptions.Item("SubGrid"), Strings.fopVisual.SubGrid) + XMLLoadLocale(eVisualOptions.Item("VerticalLine"), Strings.fopVisual.VerticalLine) + XMLLoadLocale(eVisualOptions.Item("MeasureBarLine"), Strings.fopVisual.MeasureBarLine) + XMLLoadLocale(eVisualOptions.Item("BGMWaveform"), Strings.fopVisual.BGMWaveform) + XMLLoadLocale(eVisualOptions.Item("NoteHeight"), Strings.fopVisual.NoteHeight) + XMLLoadLocale(eVisualOptions.Item("NoteLabel"), Strings.fopVisual.NoteLabel) + XMLLoadLocale(eVisualOptions.Item("MeasureLabel"), Strings.fopVisual.MeasureLabel) + XMLLoadLocale(eVisualOptions.Item("LabelVerticalShift"), Strings.fopVisual.LabelVerticalShift) + XMLLoadLocale(eVisualOptions.Item("LabelHorizontalShift"), Strings.fopVisual.LabelHorizontalShift) + XMLLoadLocale(eVisualOptions.Item("LongNoteLabelHorizontalShift"), Strings.fopVisual.LongNoteLabelHorizontalShift) + XMLLoadLocale(eVisualOptions.Item("HiddenNoteOpacity"), Strings.fopVisual.HiddenNoteOpacity) + XMLLoadLocale(eVisualOptions.Item("NoteBorderOnMouseOver"), Strings.fopVisual.NoteBorderOnMouseOver) + XMLLoadLocale(eVisualOptions.Item("NoteBorderOnSelection"), Strings.fopVisual.NoteBorderOnSelection) + XMLLoadLocale(eVisualOptions.Item("NoteBorderOnAdjustingLength"), Strings.fopVisual.NoteBorderOnAdjustingLength) + XMLLoadLocale(eVisualOptions.Item("SelectionBoxBorder"), Strings.fopVisual.SelectionBoxBorder) + XMLLoadLocale(eVisualOptions.Item("TSCursor"), Strings.fopVisual.TSCursor) + XMLLoadLocale(eVisualOptions.Item("TSSplitter"), Strings.fopVisual.TSSplitter) + XMLLoadLocale(eVisualOptions.Item("TSCursorSensitivity"), Strings.fopVisual.TSCursorSensitivity) + XMLLoadLocale(eVisualOptions.Item("TSMouseOverBorder"), Strings.fopVisual.TSMouseOverBorder) + XMLLoadLocale(eVisualOptions.Item("TSFill"), Strings.fopVisual.TSFill) + XMLLoadLocale(eVisualOptions.Item("TSBPM"), Strings.fopVisual.TSBPM) + XMLLoadLocale(eVisualOptions.Item("TSBPMFont"), Strings.fopVisual.TSBPMFont) + XMLLoadLocale(eVisualOptions.Item("MiddleSensitivity"), Strings.fopVisual.MiddleSensitivity) + End If + + Dim eGeneralOptions As XmlElement = Root.Item("GeneralOptions") + If eGeneralOptions IsNot Nothing Then + XMLLoadLocale(eGeneralOptions.Item("Title"), Strings.fopGeneral.Title) + XMLLoadLocale(eGeneralOptions.Item("MouseWheel"), Strings.fopGeneral.MouseWheel) + XMLLoadLocale(eGeneralOptions.Item("TextEncoding"), Strings.fopGeneral.TextEncoding) + XMLLoadLocale(eGeneralOptions.Item("PageUpDown"), Strings.fopGeneral.PageUpDown) + XMLLoadLocale(eGeneralOptions.Item("MiddleButton"), Strings.fopGeneral.MiddleButton) + XMLLoadLocale(eGeneralOptions.Item("MiddleButtonAuto"), Strings.fopGeneral.MiddleButtonAuto) + XMLLoadLocale(eGeneralOptions.Item("MiddleButtonDrag"), Strings.fopGeneral.MiddleButtonDrag) + XMLLoadLocale(eGeneralOptions.Item("AssociateFileType"), Strings.fopGeneral.AssociateFileType) + XMLLoadLocale(eGeneralOptions.Item("MaxGridPartition"), Strings.fopGeneral.MaxGridPartition) + XMLLoadLocale(eGeneralOptions.Item("BeepWhileSaved"), Strings.fopGeneral.BeepWhileSaved) + XMLLoadLocale(eGeneralOptions.Item("ExtendBPM"), Strings.fopGeneral.ExtendBPM) + XMLLoadLocale(eGeneralOptions.Item("ExtendSTOP"), Strings.fopGeneral.ExtendSTOP) + XMLLoadLocale(eGeneralOptions.Item("AutoFocusOnMouseEnter"), Strings.fopGeneral.AutoFocusOnMouseEnter) + XMLLoadLocale(eGeneralOptions.Item("DisableFirstClick"), Strings.fopGeneral.DisableFirstClick) + XMLLoadLocale(eGeneralOptions.Item("AutoSave"), Strings.fopGeneral.AutoSave) + XMLLoadLocale(eGeneralOptions.Item("minutes"), Strings.fopGeneral.minutes) + XMLLoadLocale(eGeneralOptions.Item("StopPreviewOnClick"), Strings.fopGeneral.StopPreviewOnClick) + End If + + Dim eFind As XmlElement = Root.Item("Find") + If eFind IsNot Nothing Then + XMLLoadLocale(eFind.Item("NoteRange"), Strings.fFind.NoteRange) + XMLLoadLocale(eFind.Item("MeasureRange"), Strings.fFind.MeasureRange) + XMLLoadLocale(eFind.Item("LabelRange"), Strings.fFind.LabelRange) + XMLLoadLocale(eFind.Item("ValueRange"), Strings.fFind.ValueRange) + XMLLoadLocale(eFind.Item("to"), Strings.fFind.to_) + XMLLoadLocale(eFind.Item("Selected"), Strings.fFind.Selected) + XMLLoadLocale(eFind.Item("UnSelected"), Strings.fFind.UnSelected) + XMLLoadLocale(eFind.Item("ShortNote"), Strings.fFind.ShortNote) + XMLLoadLocale(eFind.Item("LongNote"), Strings.fFind.LongNote) + XMLLoadLocale(eFind.Item("Hidden"), Strings.fFind.Hidden) + XMLLoadLocale(eFind.Item("Visible"), Strings.fFind.Visible) + XMLLoadLocale(eFind.Item("Column"), Strings.fFind.Column) + XMLLoadLocale(eFind.Item("SelectAll"), Strings.fFind.SelectAll) + XMLLoadLocale(eFind.Item("SelectInverse"), Strings.fFind.SelectInverse) + XMLLoadLocale(eFind.Item("UnselectAll"), Strings.fFind.UnselectAll) + XMLLoadLocale(eFind.Item("Operation"), Strings.fFind.Operation) + XMLLoadLocale(eFind.Item("ReplaceWithLabel"), Strings.fFind.ReplaceWithLabel) + XMLLoadLocale(eFind.Item("ReplaceWithValue"), Strings.fFind.ReplaceWithValue) + XMLLoadLocale(eFind.Item("Select"), Strings.fFind.Select_) + XMLLoadLocale(eFind.Item("Unselect"), Strings.fFind.Unselect_) + XMLLoadLocale(eFind.Item("Delete"), Strings.fFind.Delete_) + XMLLoadLocale(eFind.Item("Close"), Strings.fFind.Close_) + End If + + Dim eImportSM As XmlElement = Root.Item("ImportSM") + If eImportSM IsNot Nothing Then + XMLLoadLocale(eImportSM.Item("Title"), Strings.fImportSM.Title) + XMLLoadLocale(eImportSM.Item("Difficulty"), Strings.fImportSM.Difficulty) + XMLLoadLocale(eImportSM.Item("Note"), Strings.fImportSM.Note) + End If + + Dim eImportBMSON As XmlElement = Root.Item("ImportBMSON") + If eImportBMSON IsNot Nothing Then + XMLLoadLocale(eImportBMSON.Item("Message"), Strings.fImportBMSON.Message) + End If + + Dim eFileAssociation As XmlElement = Root.Item("FileAssociation") + If eFileAssociation IsNot Nothing Then + XMLLoadLocale(eFileAssociation.Item("BMS"), Strings.FileAssociation.BMS) + XMLLoadLocale(eFileAssociation.Item("BME"), Strings.FileAssociation.BME) + XMLLoadLocale(eFileAssociation.Item("BML"), Strings.FileAssociation.BML) + XMLLoadLocale(eFileAssociation.Item("PMS"), Strings.FileAssociation.PMS) + XMLLoadLocale(eFileAssociation.Item("IBMSC"), Strings.FileAssociation.IBMSC) + XMLLoadLocale(eFileAssociation.Item("Open"), Strings.FileAssociation.Open) + XMLLoadLocale(eFileAssociation.Item("Preview"), Strings.FileAssociation.Preview) + XMLLoadLocale(eFileAssociation.Item("ViewCode"), Strings.FileAssociation.ViewCode) + End If + + DispLang = Path.Replace(My.Application.Info.DirectoryPath & "\", String.Empty) + + Catch ex As Exception + Dim unused = MsgBox(Path & vbCrLf & vbCrLf & ex.Message, MsgBoxStyle.Exclamation) + + Finally + If FileStream IsNot Nothing Then FileStream.Close() + + POHeaderPart2.Visible = xPOHeaderPart2 + POGridPart2.Visible = xPOGridPart2 + POWaveFormPart2.Visible = xPOWaveFormPart2 + End Try + + 'File.Delete(xTempFileName) + End Sub + + Private Sub LoadThemeComptability(xPath As String) + Try + Dim xStrLine() As String = Split(My.Computer.FileSystem.ReadAllText(xPath), vbCrLf) + If xStrLine(0).Trim <> "iBMSC Configuration Settings Format" And xStrLine(0).Trim <> "iBMSC Theme Format" Then Exit Sub + + Dim xW1 As String = String.Empty + Dim xW2 As String = String.Empty + + For Each xLine As String In xStrLine + xW1 = UCase(Mid(xLine, 1, InStr(xLine, "=") - 1)) + xW2 = Mid(xLine, InStr(xLine, "=") + 1) + + Select Case xW1 + Case "VOTITLE" : vo.ColumnTitle.Color = Color.FromArgb(Val(xW2)) + Case "VOTITLEFONT" : vo.ColumnTitleFont = StringToFont(xW2, Font) + Case "VOBG" : vo.Bg.Color = Color.FromArgb(Val(xW2)) + Case "VOGRID" : vo.pGrid.Color = Color.FromArgb(Val(xW2)) + Case "VOSUB" : vo.pSub.Color = Color.FromArgb(Val(xW2)) + Case "VOVLINE" : vo.pVLine.Color = Color.FromArgb(Val(xW2)) + Case "VOMLINE" : vo.pMLine.Color = Color.FromArgb(Val(xW2)) + Case "VOBGMWAV" + vo.pBGMWav.Color = Color.FromArgb(Val(xW2)) + TWTransparency.Value = vo.pBGMWav.Color.A + TWTransparency2.Value = vo.pBGMWav.Color.A + TWSaturation.Value = vo.pBGMWav.Color.GetSaturation * 1000 + TWSaturation2.Value = vo.pBGMWav.Color.GetSaturation * 1000 + Case "VOSELBOX" : vo.SelBox.Color = Color.FromArgb(Val(xW2)) + Case "VOPECURSOR" : vo.PECursor.Color = Color.FromArgb(Val(xW2)) + Case "VOPEHALF" : vo.PEHalf.Color = Color.FromArgb(Val(xW2)) + Case "VOPEDELTAMOUSEOVER" : vo.PEDeltaMouseOver = Val(xW2) + Case "VOPEMOUSEOVER" : vo.PEMouseOver.Color = Color.FromArgb(Val(xW2)) + Case "VOPESEL" : vo.PESel.Color = Color.FromArgb(Val(xW2)) + Case "VOPEBPM" : vo.PEBPM.Color = Color.FromArgb(Val(xW2)) + Case "VOPEBPMFONT" : vo.PEBPMFont = StringToFont(xW2, Font) + Case "VKHEIGHT" : vo.kHeight = Val(xW2) + Case "VKFONT" : vo.kFont = StringToFont(xW2, Font) + Case "VKMFONT" : vo.kMFont = StringToFont(xW2, Font) + Case "VKLABELVSHIFT" : vo.kLabelVShift = Val(xW2) + Case "VKLABELHSHIFT" : vo.kLabelHShift = Val(xW2) + Case "VKLABELHSHIFTL" : vo.kLabelHShiftL = Val(xW2) + Case "VKMOUSEOVER" : vo.kMouseOver.Color = Color.FromArgb(Val(xW2)) + Case "VKMOUSEOVERE " : vo.kMouseOverE.Color = Color.FromArgb(Val(xW2)) + Case "VKSELECTED" : vo.kSelected.Color = Color.FromArgb(Val(xW2)) + 'Case "VKHIDTRANSPARENCY" : vo.kOpacity = Val(xW2) + + Case "KLENGTH" + Dim xE() As String = LoadThemeComptability_SplitStringInto26Parts(xW2) + For i As Integer = 0 To 26 + column(i).Width = Val(xE(i)) + Next + + Case "KTITLE" + Dim xE() As String = LoadThemeComptability_SplitStringInto26Parts(xW2) + For i As Integer = 0 To 26 + column(i).Title = xE(i) + Next + + Case "KCOLOR" + Dim xE() As String = LoadThemeComptability_SplitStringInto26Parts(xW2) + For i As Integer = 0 To 26 + column(i).setNoteColor(Val(xE(i))) + Next + + Case "KCOLORL" + Dim xE() As String = LoadThemeComptability_SplitStringInto26Parts(xW2) + For i As Integer = 0 To 26 + column(i).setLNoteColor(Val(xE(i))) + Next + + Case "KFORECOLOR" + Dim xE() As String = LoadThemeComptability_SplitStringInto26Parts(xW2) + For i As Integer = 0 To 26 + column(i).cText = Color.FromArgb(Val(xE(i))) + Next + + Case "KFORECOLORL" + Dim xE() As String = LoadThemeComptability_SplitStringInto26Parts(xW2) + For i As Integer = 0 To 26 + column(i).cLText = Color.FromArgb(Val(xE(i))) + Next + + Case "KBGCOLOR" + Dim xE() As String = LoadThemeComptability_SplitStringInto26Parts(xW2) + For i As Integer = 0 To 26 + column(i).cBG = Color.FromArgb(Val(xE(i))) + Next + + End Select + + Next + + Catch ex As Exception + Dim unused = MsgBox(ex.Message, MsgBoxStyle.Exclamation, Strings.Messages.Err) + + Finally + UpdateColumnsX() + + End Try + End Sub + + Private Function LoadThemeComptability_SplitStringInto26Parts(xLine As String) As String() + Dim xE() As String = Split(xLine, ",") + ReDim Preserve xE(26) + Return xE + End Function + + Private Sub LoadLang(sender As Object, e As EventArgs) + Dim xFN2 As String = sender.ToolTipText + 'ReadLanguagePack(xFN2) + LoadLocale(xFN2) + End Sub + + Private Sub LoadLocaleXML(xStr As FileInfo) + Dim d As New XmlDocument + Dim fs As New FileStream(xStr.FullName, FileMode.Open, FileAccess.Read) + + Try + d.Load(fs) + Dim xName As String = d.Item("iBMSC.Locale").GetAttribute("Name") + If xName = String.Empty Then xName = xStr.Name + + Dim unused1 = cmnLanguage.Items.Add(xName, Nothing, AddressOf LoadLang) + cmnLanguage.Items(cmnLanguage.Items.Count - 1).ToolTipText = xStr.FullName + + Catch ex As Exception + Dim unused = MsgBox(xStr.FullName & vbCrLf & vbCrLf & ex.Message, MsgBoxStyle.Exclamation) + + End Try + + fs.Close() + End Sub + + Private Sub LoadTheme(sender As Object, e As EventArgs) + 'If Not File.Exists(My.Application.Info.DirectoryPath & "\Data\" & sender.Text) Then Exit Sub + 'SaveTheme = True + 'LoadCFF(My.Computer.FileSystem.ReadAllText(My.Application.Info.DirectoryPath & "\Theme\" & sender.Text, System.Text.Encoding.Unicode)) + LoadSettings(My.Application.Info.DirectoryPath & "\Data\" & sender.Text) + ChangePlaySideSkin(False) + RefreshPanelAll() + End Sub End Class diff --git a/iBMSC/EditorRecent.vb b/iBMSC/EditorRecent.vb index 6e8ef33d8..35cf98fff 100644 --- a/iBMSC/EditorRecent.vb +++ b/iBMSC/EditorRecent.vb @@ -1,94 +1,94 @@ Partial Public Class MainWindow - Private Sub NewRecent(xFileName As String) - Dim xAlreadyExists As Boolean = False - Dim xI1 As Integer + Private Sub NewRecent(xFileName As String) + Dim xAlreadyExists As Boolean = False + Dim xI1 As Integer - For xI1 = 0 To 4 - If Recent(xI1) = xFileName Then - xAlreadyExists = True - Exit For - End If - Next + For xI1 = 0 To 4 + If Recent(xI1) = xFileName Then + xAlreadyExists = True + Exit For + End If + Next - If xAlreadyExists Then - For xI2 As Integer = xI1 To 1 Step -1 - Recent(xI2) = Recent(xI2 - 1) - Next - Recent(0) = xFileName + If xAlreadyExists Then + For xI2 As Integer = xI1 To 1 Step -1 + Recent(xI2) = Recent(xI2 - 1) + Next + Recent(0) = xFileName - Else - Recent(4) = Recent(3) - Recent(3) = Recent(2) - Recent(2) = Recent(1) - Recent(1) = Recent(0) - Recent(0) = xFileName - End If + Else + Recent(4) = Recent(3) + Recent(3) = Recent(2) + Recent(2) = Recent(1) + Recent(1) = Recent(0) + Recent(0) = xFileName + End If - SetRecent(4, Recent(4)) - SetRecent(3, Recent(3)) - SetRecent(2, Recent(2)) - SetRecent(1, Recent(1)) - SetRecent(0, Recent(0)) - End Sub + SetRecent(4, Recent(4)) + SetRecent(3, Recent(3)) + SetRecent(2, Recent(2)) + SetRecent(1, Recent(1)) + SetRecent(0, Recent(0)) + End Sub - Private Sub SetRecent(Index As Integer, Text As String) - Text = Text.Trim + Private Sub SetRecent(Index As Integer, Text As String) + Text = Text.Trim - Dim xTBOpenR As ToolStripMenuItem - Dim xmnOpenR As ToolStripMenuItem - Select Case Index - Case 0 : xTBOpenR = TBOpenR0 : xmnOpenR = mnOpenR0 - Case 1 : xTBOpenR = TBOpenR1 : xmnOpenR = mnOpenR1 - Case 2 : xTBOpenR = TBOpenR2 : xmnOpenR = mnOpenR2 - Case 3 : xTBOpenR = TBOpenR3 : xmnOpenR = mnOpenR3 - Case 4 : xTBOpenR = TBOpenR4 : xmnOpenR = mnOpenR4 - Case Else : Return - End Select + Dim xTBOpenR As ToolStripMenuItem + Dim xmnOpenR As ToolStripMenuItem + Select Case Index + Case 0 : xTBOpenR = TBOpenR0 : xmnOpenR = mnOpenR0 + Case 1 : xTBOpenR = TBOpenR1 : xmnOpenR = mnOpenR1 + Case 2 : xTBOpenR = TBOpenR2 : xmnOpenR = mnOpenR2 + Case 3 : xTBOpenR = TBOpenR3 : xmnOpenR = mnOpenR3 + Case 4 : xTBOpenR = TBOpenR4 : xmnOpenR = mnOpenR4 + Case Else : Return + End Select - xTBOpenR.Text = IIf(Text = String.Empty, "<" & Strings.None & ">", GetFileName(Text)) : xTBOpenR.ToolTipText = Text : xTBOpenR.Enabled = Not Text = String.Empty - xmnOpenR.Text = IIf(Text = String.Empty, "<" & Strings.None & ">", GetFileName(Text)) : xmnOpenR.ToolTipText = Text : xmnOpenR.Enabled = Not Text = String.Empty - End Sub + xTBOpenR.Text = IIf(Text = String.Empty, "<" & Strings.None & ">", GetFileName(Text)) : xTBOpenR.ToolTipText = Text : xTBOpenR.Enabled = Not Text = String.Empty + xmnOpenR.Text = IIf(Text = String.Empty, "<" & Strings.None & ">", GetFileName(Text)) : xmnOpenR.ToolTipText = Text : xmnOpenR.Enabled = Not Text = String.Empty + End Sub - Private Sub OpenRecent(xFileName As String) - 'KMouseDown = -1 - ReDim SelectedNotes(-1) - KMouseOver = -1 - If Not My.Computer.FileSystem.FileExists(xFileName) Then - Dim unused = MsgBox(Strings.Messages.CannotFind.Replace("{}", xFileName), MsgBoxStyle.Critical) - Exit Sub - End If - If ClosingPopSave() Then Exit Sub + Private Sub OpenRecent(xFileName As String) + 'KMouseDown = -1 + ReDim SelectedNotes(-1) + KMouseOver = -1 + If Not My.Computer.FileSystem.FileExists(xFileName) Then + Dim unused = MsgBox(Strings.Messages.CannotFind.Replace("{}", xFileName), MsgBoxStyle.Critical) + Exit Sub + End If + If ClosingPopSave() Then Exit Sub - Select Case UCase(Path.GetExtension(xFileName)) - Case ".BMS", ".BME", ".BML", ".PMS", ".TXT" - InitPath = ExcludeFileName(xFileName) - SetFileName(xFileName) - ClearUndo() - OpenBMS(My.Computer.FileSystem.ReadAllText(xFileName, TextEncoding)) - SetFileName(FileName) - SetIsSaved(True) - Case ".IBMSC" - InitPath = ExcludeFileName(xFileName) - SetFileName("Imported_" & GetFileName(xFileName)) - OpeniBMSC(xFileName) - SetIsSaved(False) - End Select - End Sub + Select Case UCase(Path.GetExtension(xFileName)) + Case ".BMS", ".BME", ".BML", ".PMS", ".TXT" + InitPath = ExcludeFileName(xFileName) + SetFileName(xFileName) + ClearUndo() + OpenBMS(My.Computer.FileSystem.ReadAllText(xFileName, TextEncoding)) + SetFileName(FileName) + SetIsSaved(True) + Case ".IBMSC" + InitPath = ExcludeFileName(xFileName) + SetFileName("Imported_" & GetFileName(xFileName)) + OpeniBMSC(xFileName) + SetIsSaved(False) + End Select + End Sub - Private Sub TBOpenR0_Click(sender As Object, e As EventArgs) Handles TBOpenR0.Click, mnOpenR0.Click - OpenRecent(Recent(0)) - End Sub - Private Sub TBOpenR1_Click(sender As Object, e As EventArgs) Handles TBOpenR1.Click, mnOpenR1.Click - OpenRecent(Recent(1)) - End Sub - Private Sub TBOpenR2_Click(sender As Object, e As EventArgs) Handles TBOpenR2.Click, mnOpenR2.Click - OpenRecent(Recent(2)) - End Sub - Private Sub TBOpenR3_Click(sender As Object, e As EventArgs) Handles TBOpenR3.Click, mnOpenR3.Click - OpenRecent(Recent(3)) - End Sub - Private Sub TBOpenR4_Click(sender As Object, e As EventArgs) Handles TBOpenR4.Click, mnOpenR4.Click - OpenRecent(Recent(4)) - End Sub + Private Sub TBOpenR0_Click(sender As Object, e As EventArgs) Handles TBOpenR0.Click, mnOpenR0.Click + OpenRecent(Recent(0)) + End Sub + Private Sub TBOpenR1_Click(sender As Object, e As EventArgs) Handles TBOpenR1.Click, mnOpenR1.Click + OpenRecent(Recent(1)) + End Sub + Private Sub TBOpenR2_Click(sender As Object, e As EventArgs) Handles TBOpenR2.Click, mnOpenR2.Click + OpenRecent(Recent(2)) + End Sub + Private Sub TBOpenR3_Click(sender As Object, e As EventArgs) Handles TBOpenR3.Click, mnOpenR3.Click + OpenRecent(Recent(3)) + End Sub + Private Sub TBOpenR4_Click(sender As Object, e As EventArgs) Handles TBOpenR4.Click, mnOpenR4.Click + OpenRecent(Recent(4)) + End Sub End Class diff --git a/iBMSC/EditorUndoRedo.vb b/iBMSC/EditorUndoRedo.vb index 48894ebbd..c14a1705a 100644 --- a/iBMSC/EditorUndoRedo.vb +++ b/iBMSC/EditorUndoRedo.vb @@ -1,435 +1,435 @@ Imports iBMSC.Editor Partial Public Class MainWindow - Private Sub PerformCommand(sCmd As UndoRedo.LinkedURCmd) - For xI2 As Integer = 1 To UBound(Notes) - Notes(xI2).Selected = False - Next - LBeat.SelectedIndices.Clear() - - Do While sCmd IsNot Nothing - Dim xType As Byte = sCmd.ofType - - Select Case xType - Case UndoRedo.opAddNote - Dim xCmd As UndoRedo.AddNote = sCmd - - ReDim Preserve Notes(UBound(Notes) + 1) - Notes(UBound(Notes)) = xCmd.note - - If TBWavIncrease.Checked Then - If IsColumnSound(xCmd.note.ColumnIndex) Then - IncreaseCurrentWav() - Else - IncreaseCurrentBmp() - End If - End If - Case UndoRedo.opRemoveNote - Dim xCmd As UndoRedo.RemoveNote = sCmd - Dim xI2 As Integer = FindNoteIndex(xCmd.note) - - If xI2 < Notes.Length Then - For xI3 As Integer = xI2 + 1 To UBound(Notes) - Notes(xI3 - 1) = Notes(xI3) - Next - ReDim Preserve Notes(UBound(Notes) - 1) - End If - - If TBWavIncrease.Checked Then - If IsColumnSound(xCmd.note.ColumnIndex) Then - DecreaseCurrentWav() - Else - DecreaseCurrentBmp() - End If - End If - - Case UndoRedo.opChangeNote - Dim xCmd As UndoRedo.ChangeNote = sCmd - Dim xI2 As Integer = FindNoteIndex(xCmd.note) - - If xI2 < Notes.Length Then - Notes(xI2) = xCmd.note - End If - - Case UndoRedo.opMoveNote - Dim xCmd As UndoRedo.MoveNote = sCmd - Dim xI2 As Integer = FindNoteIndex(xCmd.note) - - If xI2 < Notes.Length Then - With Notes(xI2) - .ColumnIndex = xCmd.NColumnIndex - .VPosition = xCmd.NVPosition - .Selected = xCmd.note.Selected And nEnabled(.ColumnIndex) - End With - End If - - Case UndoRedo.opLongNoteModify - Dim xCmd As UndoRedo.LongNoteModify = sCmd - Dim xI2 As Integer = FindNoteIndex(xCmd.note) - - If xI2 < Notes.Length Then - With Notes(xI2) - If NTInput Then - .VPosition = xCmd.NVPosition - .Length = xCmd.NLongNote - Else - .LongNote = xCmd.NLongNote - End If - .Selected = xCmd.note.Selected And nEnabled(.ColumnIndex) - End With - End If - - Case UndoRedo.opHiddenNoteModify - Dim xCmd As UndoRedo.HiddenNoteModify = sCmd - Dim xI2 As Integer = FindNoteIndex(xCmd.note) - - If xI2 < Notes.Length Then - Notes(xI2).Hidden = xCmd.NHidden - Notes(xI2).Selected = xCmd.note.Selected And nEnabled(Notes(xI2).ColumnIndex) - End If - - Case UndoRedo.opRelabelNote - Dim xCmd As UndoRedo.RelabelNote = sCmd - Dim xI2 As Integer = FindNoteIndex(xCmd.note) - - If xI2 < Notes.Length Then - Notes(xI2).Value = xCmd.NValue - Notes(xI2).Selected = xCmd.note.Selected And nEnabled(Notes(xI2).ColumnIndex) - End If - - Case UndoRedo.opRemoveAllNotes - ReDim Preserve Notes(0) - - Case UndoRedo.opChangeMeasureLength - Dim xCmd As UndoRedo.ChangeMeasureLength = sCmd - Dim xxD As Long = GetDenominator(xCmd.Value / 192) - 'Dim xDenom As Integer = 192 / GCD(xCmd.Value, 192.0R) - 'If xDenom < 4 Then xDenom = 4 - For Each xM As Integer In xCmd.Indices - MeasureLength(xM) = xCmd.Value - LBeat.Items(xM) = Add3Zeros(xM) & ": " & (xCmd.Value / 192) & IIf(xxD > 10000, String.Empty, " ( " & (xCmd.Value / 192 * xxD) & " / " & xxD & " ) ") - LBeat.SelectedIndices.Add(xM) - Next - UpdateMeasureBottom() - - Case UndoRedo.opChangeTimeSelection - Dim xCmd As UndoRedo.ChangeTimeSelection = sCmd - vSelStart = xCmd.SelStart - vSelLength = xCmd.SelLength - vSelHalf = xCmd.SelHalf - If xCmd.Selected Then - Dim xSelLo As Double = vSelStart + IIf(vSelLength < 0, vSelLength, 0) - Dim xSelHi As Double = vSelStart + IIf(vSelLength > 0, vSelLength, 0) - For xI2 As Integer = 1 To UBound(Notes) - Notes(xI2).Selected = Notes(xI2).VPosition >= xSelLo AndAlso - Notes(xI2).VPosition < xSelHi AndAlso - nEnabled(Notes(xI2).ColumnIndex) - Next - End If - - Case UndoRedo.opNT - Dim xCmd As UndoRedo.NT = sCmd - NTInput = xCmd.BecomeNT - TBNTInput.Checked = NTInput - mnNTInput.Checked = NTInput - - POBLong.Enabled = Not NTInput - POBLongShort.Enabled = Not NTInput - bAdjustLength = False - bAdjustUpper = False - - If xCmd.AutoConvert Then - If NTInput Then ConvertBMSE2NT() Else ConvertNT2BMSE() - End If - Case UndoRedo.opWavAutoincFlag - Dim xcmd As UndoRedo.WavAutoincFlag = sCmd - TBWavIncrease.Checked = xcmd.Checked - - Case UndoRedo.opVoid - - Case UndoRedo.opNoOperation - 'Exit Do - - End Select - - sCmd = sCmd.Next - Loop - - THBPM.Value = Notes(0).Value / 10000 - If IsSaved Then SetIsSaved(False) - - SortByVPositionInsertion() - UpdatePairing() - CalculateTotalPlayableNotes() - CalculateGreatestVPosition() - RefreshPanelAll() - POStatusRefresh() - End Sub - - Private Sub AddUndo(sCUndo As UndoRedo.LinkedURCmd, sCRedo As UndoRedo.LinkedURCmd, Optional OverWrite As Boolean = False) - If sCUndo Is Nothing And sCRedo Is Nothing Then Exit Sub - If IsSaved Then SetIsSaved(False) - If Not OverWrite Then sI = sIA() - - 'ClearURReference(sUndo(sI)) - 'ClearURReference(sRedo(sI)) - 'ClearURReference(sUndo(sIA)) - 'ClearURReference(sRedo(sIA)) - sUndo(sI) = sCUndo - sRedo(sI) = sCRedo - sUndo(sIA) = New UndoRedo.NoOperation - sRedo(sIA) = New UndoRedo.NoOperation - TBUndo.Enabled = True - TBRedo.Enabled = False - mnUndo.Enabled = True - mnRedo.Enabled = False - End Sub - - Private Sub ClearUndo() - 'For xI1 As Integer = 0 To 99 - ' ClearURReference(sUndo(xI1)) - ' ClearURReference(sRedo(xI1)) - 'Next - - ReDim sUndo(99) - ReDim sRedo(99) - sUndo(0) = New UndoRedo.NoOperation - sUndo(1) = New UndoRedo.NoOperation - sRedo(0) = New UndoRedo.NoOperation - sRedo(1) = New UndoRedo.NoOperation - sI = 0 - TBUndo.Enabled = False - TBRedo.Enabled = False - mnUndo.Enabled = False - mnRedo.Enabled = False - End Sub - - Private Sub RedoAddNote(note As Note, - ByRef BaseUndo As UndoRedo.LinkedURCmd, - ByRef BaseRedo As UndoRedo.LinkedURCmd, - Optional autoinc As Boolean = False) - Dim xUndo As New UndoRedo.RemoveNote(note) - Dim xRedo As New UndoRedo.AddNote(note) - xUndo.Next = BaseUndo - BaseUndo = xUndo - If BaseRedo IsNot Nothing Then BaseRedo.Next = xRedo - BaseRedo = xRedo - End Sub - - Private Sub RedoAddNote(xIndices() As Integer, xSel As Boolean, ByRef BaseUndo As UndoRedo.LinkedURCmd, ByRef BaseRedo As UndoRedo.LinkedURCmd) - For xI1 As Integer = 0 To UBound(xIndices) - Dim xUndo As New UndoRedo.RemoveNote(Notes(xI1)) - Dim xRedo As New UndoRedo.AddNote(Notes(xI1)) - xUndo.Next = BaseUndo - BaseUndo = xUndo - If BaseRedo IsNot Nothing Then BaseRedo.Next = xRedo - BaseRedo = xRedo - Next - End Sub - - Private Sub RedoAddNoteSelected(xSel As Boolean, ByRef BaseUndo As UndoRedo.LinkedURCmd, ByRef BaseRedo As UndoRedo.LinkedURCmd) - For xI1 As Integer = 1 To UBound(Notes) - If Not Notes(xI1).Selected Then Continue For - - Dim xUndo As New UndoRedo.RemoveNote(Notes(xI1)) - Dim xRedo As New UndoRedo.AddNote(Notes(xI1)) - xUndo.Next = BaseUndo - BaseUndo = xUndo - If BaseRedo IsNot Nothing Then BaseRedo.Next = xRedo - BaseRedo = xRedo - - Next - End Sub - - Private Sub RedoAddNoteAll(xSel As Boolean, ByRef BaseUndo As UndoRedo.LinkedURCmd, ByRef BaseRedo As UndoRedo.LinkedURCmd) - For xI1 As Integer = 1 To UBound(Notes) - - Dim xRedo As New UndoRedo.AddNote(Notes(xI1)) - If BaseRedo IsNot Nothing Then BaseRedo.Next = xRedo - BaseRedo = xRedo - - Next - - Dim xUndo As New UndoRedo.RemoveAllNotes With { - .Next = BaseUndo - } - BaseUndo = xUndo - End Sub - - - Private Sub RedoRemoveNote(xN As Note, ByRef BaseUndo As UndoRedo.LinkedURCmd, ByRef BaseRedo As UndoRedo.LinkedURCmd) - Dim xUndo As New UndoRedo.AddNote(xN) - Dim xRedo As New UndoRedo.RemoveNote(xN) - xUndo.Next = BaseUndo - BaseUndo = xUndo - If BaseRedo IsNot Nothing Then BaseRedo.Next = xRedo - BaseRedo = xRedo - End Sub - - Private Sub RedoRemoveNote(xIndices() As Integer, ByRef BaseUndo As UndoRedo.LinkedURCmd, ByRef BaseRedo As UndoRedo.LinkedURCmd) - For xI1 As Integer = 0 To UBound(xIndices) - Dim xUndo As New UndoRedo.AddNote(Notes(xIndices(xI1))) - Dim xRedo As New UndoRedo.RemoveNote(Notes(xIndices(xI1))) - xUndo.Next = BaseUndo - BaseUndo = xUndo - If BaseRedo IsNot Nothing Then BaseRedo.Next = xRedo - BaseRedo = xRedo - Next - End Sub - - Private Sub RedoRemoveNoteSelected(xSel As Boolean, ByRef BaseUndo As UndoRedo.LinkedURCmd, ByRef BaseRedo As UndoRedo.LinkedURCmd) - For xI1 As Integer = 1 To UBound(Notes) - If Not Notes(xI1).Selected Then Continue For - Dim xUndo As New UndoRedo.AddNote(Notes(xI1)) - Dim xRedo As New UndoRedo.RemoveNote(Notes(xI1)) - xUndo.Next = BaseUndo - BaseUndo = xUndo - If BaseRedo IsNot Nothing Then BaseRedo.Next = xRedo - BaseRedo = xRedo - Next - End Sub - - Private Sub RedoRemoveNoteAll(xSel As Boolean, ByRef BaseUndo As UndoRedo.LinkedURCmd, ByRef BaseRedo As UndoRedo.LinkedURCmd) - For xI1 As Integer = 1 To UBound(Notes) - With Notes(xI1) - Dim xUndo As New UndoRedo.AddNote(Notes(xI1)) With { - .Next = BaseUndo - } - BaseUndo = xUndo - End With - Next - Dim xRedo As New UndoRedo.RemoveAllNotes - If BaseRedo IsNot Nothing Then BaseRedo.Next = xRedo - BaseRedo = xRedo - End Sub - - Private Sub RedoChangeNote(note1 As Note, note2 As Note, ByRef BaseUndo As UndoRedo.LinkedURCmd, ByRef BaseRedo As UndoRedo.LinkedURCmd) - Dim xUndo As New UndoRedo.ChangeNote(note2, note1) - Dim xRedo As New UndoRedo.ChangeNote(note1, note2) - xUndo.Next = BaseUndo - BaseUndo = xUndo - If BaseRedo IsNot Nothing Then BaseRedo.Next = xRedo - BaseRedo = xRedo - End Sub - - - Private Sub RedoMoveNote(note As Note, nCol As Integer, nVPos As Double, ByRef BaseUndo As UndoRedo.LinkedURCmd, ByRef BaseRedo As UndoRedo.LinkedURCmd) - Dim noteAfterModification = note - noteAfterModification.ColumnIndex = nCol - noteAfterModification.VPosition = nVPos - Dim xUndo As New UndoRedo.MoveNote(noteAfterModification, note.ColumnIndex, note.VPosition) - Dim xRedo As New UndoRedo.MoveNote(note, nCol, nVPos) - xUndo.Next = BaseUndo - BaseUndo = xUndo - If BaseRedo IsNot Nothing Then BaseRedo.Next = xRedo - BaseRedo = xRedo - End Sub - - - Private Sub RedoLongNoteModify(note As Note, nVPos As Double, nLong As Double, ByRef BaseUndo As UndoRedo.LinkedURCmd, ByRef BaseRedo As UndoRedo.LinkedURCmd) - Dim n = note - n.VPosition = nVPos - n.Length = nLong - - Dim xUndo As New UndoRedo.LongNoteModify(n, note.VPosition, note.Length) - Dim xRedo As New UndoRedo.LongNoteModify(note, nVPos, n.Length) - xUndo.Next = BaseUndo - BaseUndo = xUndo - If BaseRedo IsNot Nothing Then BaseRedo.Next = xRedo - BaseRedo = xRedo - End Sub - - Private Sub RedoHiddenNoteModify(xN As Note, nHide As Boolean, xSel As Boolean, ByRef BaseUndo As UndoRedo.LinkedURCmd, ByRef BaseRedo As UndoRedo.LinkedURCmd) - Dim noteAfterModification = xN - noteAfterModification.Hidden = nHide - Dim xUndo As New UndoRedo.HiddenNoteModify(noteAfterModification, xN.Hidden) - Dim xRedo As New UndoRedo.HiddenNoteModify(xN, nHide) - xUndo.Next = BaseUndo - BaseUndo = xUndo - If BaseRedo IsNot Nothing Then BaseRedo.Next = xRedo - BaseRedo = xRedo - End Sub - - - Private Sub RedoRelabelNote(xN As Note, nVal As Long, ByRef BaseUndo As UndoRedo.LinkedURCmd, ByRef BaseRedo As UndoRedo.LinkedURCmd) - Dim noteAfterModification = xN - noteAfterModification.Value = nVal - Dim xUndo As New UndoRedo.RelabelNote(noteAfterModification, xN.Value) - Dim xRedo As New UndoRedo.RelabelNote(xN, nVal) - xUndo.Next = BaseUndo - BaseUndo = xUndo - If BaseRedo IsNot Nothing Then BaseRedo.Next = xRedo - BaseRedo = xRedo - End Sub - - Private Sub RedoChangeMeasureLengthSelected(nVal As Double, ByRef BaseUndo As UndoRedo.LinkedURCmd, ByRef BaseRedo As UndoRedo.LinkedURCmd) - Dim xIndices(LBeat.SelectedIndices.Count - 1) As Integer - LBeat.SelectedIndices.CopyTo(xIndices, 0) - If xIndices.Length = 0 Then Exit Sub - - Dim xmLen(-1) As Double - Dim xUndo(-1) As UndoRedo.ChangeMeasureLength - For Each xI1 As Integer In xIndices - Dim xI As Integer = Array.IndexOf(xmLen, MeasureLength(xI1)) - If xI = -1 Then - ReDim Preserve xmLen(UBound(xmLen) + 1) - ReDim Preserve xUndo(UBound(xUndo) + 1) - xmLen(UBound(xmLen)) = MeasureLength(xI1) - xUndo(UBound(xUndo)) = New UndoRedo.ChangeMeasureLength(MeasureLength(xI1), New Integer() {xI1}) - Else - With xUndo(xI) - ReDim Preserve .Indices(UBound(.Indices) + 1) - .Indices(UBound(.Indices)) = xI1 - End With - End If - Next - For xI1 As Integer = 0 To UBound(xUndo) - 1 - xUndo(xI1).Next = xUndo(xI1 + 1) - Next - xUndo(UBound(xUndo)).Next = BaseUndo - BaseUndo = xUndo(0) - - Dim xRedo As New UndoRedo.ChangeMeasureLength(nVal, xIndices.Clone) - If BaseRedo IsNot Nothing Then BaseRedo.Next = xRedo - BaseRedo = xRedo - End Sub - - Private Sub RedoChangeTimeSelection(pStart As Double, pLen As Double, pHalf As Double, + Private Sub PerformCommand(sCmd As UndoRedo.LinkedURCmd) + For xI2 As Integer = 1 To UBound(Notes) + Notes(xI2).Selected = False + Next + LBeat.SelectedIndices.Clear() + + Do While sCmd IsNot Nothing + Dim xType As Byte = sCmd.ofType + + Select Case xType + Case UndoRedo.opAddNote + Dim xCmd As UndoRedo.AddNote = sCmd + + ReDim Preserve Notes(UBound(Notes) + 1) + Notes(UBound(Notes)) = xCmd.note + + If TBWavIncrease.Checked Then + If IsColumnSound(xCmd.note.ColumnIndex) Then + IncreaseCurrentWav() + Else + IncreaseCurrentBmp() + End If + End If + Case UndoRedo.opRemoveNote + Dim xCmd As UndoRedo.RemoveNote = sCmd + Dim xI2 As Integer = FindNoteIndex(xCmd.note) + + If xI2 < Notes.Length Then + For xI3 As Integer = xI2 + 1 To UBound(Notes) + Notes(xI3 - 1) = Notes(xI3) + Next + ReDim Preserve Notes(UBound(Notes) - 1) + End If + + If TBWavIncrease.Checked Then + If IsColumnSound(xCmd.note.ColumnIndex) Then + DecreaseCurrentWav() + Else + DecreaseCurrentBmp() + End If + End If + + Case UndoRedo.opChangeNote + Dim xCmd As UndoRedo.ChangeNote = sCmd + Dim xI2 As Integer = FindNoteIndex(xCmd.note) + + If xI2 < Notes.Length Then + Notes(xI2) = xCmd.note + End If + + Case UndoRedo.opMoveNote + Dim xCmd As UndoRedo.MoveNote = sCmd + Dim xI2 As Integer = FindNoteIndex(xCmd.note) + + If xI2 < Notes.Length Then + With Notes(xI2) + .ColumnIndex = xCmd.NColumnIndex + .VPosition = xCmd.NVPosition + .Selected = xCmd.note.Selected And nEnabled(.ColumnIndex) + End With + End If + + Case UndoRedo.opLongNoteModify + Dim xCmd As UndoRedo.LongNoteModify = sCmd + Dim xI2 As Integer = FindNoteIndex(xCmd.note) + + If xI2 < Notes.Length Then + With Notes(xI2) + If NTInput Then + .VPosition = xCmd.NVPosition + .Length = xCmd.NLongNote + Else + .LongNote = xCmd.NLongNote + End If + .Selected = xCmd.note.Selected And nEnabled(.ColumnIndex) + End With + End If + + Case UndoRedo.opHiddenNoteModify + Dim xCmd As UndoRedo.HiddenNoteModify = sCmd + Dim xI2 As Integer = FindNoteIndex(xCmd.note) + + If xI2 < Notes.Length Then + Notes(xI2).Hidden = xCmd.NHidden + Notes(xI2).Selected = xCmd.note.Selected And nEnabled(Notes(xI2).ColumnIndex) + End If + + Case UndoRedo.opRelabelNote + Dim xCmd As UndoRedo.RelabelNote = sCmd + Dim xI2 As Integer = FindNoteIndex(xCmd.note) + + If xI2 < Notes.Length Then + Notes(xI2).Value = xCmd.NValue + Notes(xI2).Selected = xCmd.note.Selected And nEnabled(Notes(xI2).ColumnIndex) + End If + + Case UndoRedo.opRemoveAllNotes + ReDim Preserve Notes(0) + + Case UndoRedo.opChangeMeasureLength + Dim xCmd As UndoRedo.ChangeMeasureLength = sCmd + Dim xxD As Long = GetDenominator(xCmd.Value / 192) + 'Dim xDenom As Integer = 192 / GCD(xCmd.Value, 192.0R) + 'If xDenom < 4 Then xDenom = 4 + For Each xM As Integer In xCmd.Indices + MeasureLength(xM) = xCmd.Value + LBeat.Items(xM) = Add3Zeros(xM) & ": " & (xCmd.Value / 192) & IIf(xxD > 10000, String.Empty, " ( " & (xCmd.Value / 192 * xxD) & " / " & xxD & " ) ") + LBeat.SelectedIndices.Add(xM) + Next + UpdateMeasureBottom() + + Case UndoRedo.opChangeTimeSelection + Dim xCmd As UndoRedo.ChangeTimeSelection = sCmd + vSelStart = xCmd.SelStart + vSelLength = xCmd.SelLength + vSelHalf = xCmd.SelHalf + If xCmd.Selected Then + Dim xSelLo As Double = vSelStart + IIf(vSelLength < 0, vSelLength, 0) + Dim xSelHi As Double = vSelStart + IIf(vSelLength > 0, vSelLength, 0) + For xI2 As Integer = 1 To UBound(Notes) + Notes(xI2).Selected = Notes(xI2).VPosition >= xSelLo AndAlso + Notes(xI2).VPosition < xSelHi AndAlso + nEnabled(Notes(xI2).ColumnIndex) + Next + End If + + Case UndoRedo.opNT + Dim xCmd As UndoRedo.NT = sCmd + NTInput = xCmd.BecomeNT + TBNTInput.Checked = NTInput + mnNTInput.Checked = NTInput + + POBLong.Enabled = Not NTInput + POBLongShort.Enabled = Not NTInput + bAdjustLength = False + bAdjustUpper = False + + If xCmd.AutoConvert Then + If NTInput Then ConvertBMSE2NT() Else ConvertNT2BMSE() + End If + Case UndoRedo.opWavAutoincFlag + Dim xcmd As UndoRedo.WavAutoincFlag = sCmd + TBWavIncrease.Checked = xcmd.Checked + + Case UndoRedo.opVoid + + Case UndoRedo.opNoOperation + 'Exit Do + + End Select + + sCmd = sCmd.Next + Loop + + THBPM.Value = Notes(0).Value / 10000 + If IsSaved Then SetIsSaved(False) + + SortByVPositionInsertion() + UpdatePairing() + CalculateTotalPlayableNotes() + CalculateGreatestVPosition() + RefreshPanelAll() + POStatusRefresh() + End Sub + + Private Sub AddUndo(sCUndo As UndoRedo.LinkedURCmd, sCRedo As UndoRedo.LinkedURCmd, Optional OverWrite As Boolean = False) + If sCUndo Is Nothing And sCRedo Is Nothing Then Exit Sub + If IsSaved Then SetIsSaved(False) + If Not OverWrite Then sI = sIA() + + 'ClearURReference(sUndo(sI)) + 'ClearURReference(sRedo(sI)) + 'ClearURReference(sUndo(sIA)) + 'ClearURReference(sRedo(sIA)) + sUndo(sI) = sCUndo + sRedo(sI) = sCRedo + sUndo(sIA) = New UndoRedo.NoOperation + sRedo(sIA) = New UndoRedo.NoOperation + TBUndo.Enabled = True + TBRedo.Enabled = False + mnUndo.Enabled = True + mnRedo.Enabled = False + End Sub + + Private Sub ClearUndo() + 'For xI1 As Integer = 0 To 99 + ' ClearURReference(sUndo(xI1)) + ' ClearURReference(sRedo(xI1)) + 'Next + + ReDim sUndo(99) + ReDim sRedo(99) + sUndo(0) = New UndoRedo.NoOperation + sUndo(1) = New UndoRedo.NoOperation + sRedo(0) = New UndoRedo.NoOperation + sRedo(1) = New UndoRedo.NoOperation + sI = 0 + TBUndo.Enabled = False + TBRedo.Enabled = False + mnUndo.Enabled = False + mnRedo.Enabled = False + End Sub + + Private Sub RedoAddNote(note As Note, + ByRef BaseUndo As UndoRedo.LinkedURCmd, + ByRef BaseRedo As UndoRedo.LinkedURCmd, + Optional autoinc As Boolean = False) + Dim xUndo As New UndoRedo.RemoveNote(note) + Dim xRedo As New UndoRedo.AddNote(note) + xUndo.Next = BaseUndo + BaseUndo = xUndo + If BaseRedo IsNot Nothing Then BaseRedo.Next = xRedo + BaseRedo = xRedo + End Sub + + Private Sub RedoAddNote(xIndices() As Integer, xSel As Boolean, ByRef BaseUndo As UndoRedo.LinkedURCmd, ByRef BaseRedo As UndoRedo.LinkedURCmd) + For xI1 As Integer = 0 To UBound(xIndices) + Dim xUndo As New UndoRedo.RemoveNote(Notes(xI1)) + Dim xRedo As New UndoRedo.AddNote(Notes(xI1)) + xUndo.Next = BaseUndo + BaseUndo = xUndo + If BaseRedo IsNot Nothing Then BaseRedo.Next = xRedo + BaseRedo = xRedo + Next + End Sub + + Private Sub RedoAddNoteSelected(xSel As Boolean, ByRef BaseUndo As UndoRedo.LinkedURCmd, ByRef BaseRedo As UndoRedo.LinkedURCmd) + For xI1 As Integer = 1 To UBound(Notes) + If Not Notes(xI1).Selected Then Continue For + + Dim xUndo As New UndoRedo.RemoveNote(Notes(xI1)) + Dim xRedo As New UndoRedo.AddNote(Notes(xI1)) + xUndo.Next = BaseUndo + BaseUndo = xUndo + If BaseRedo IsNot Nothing Then BaseRedo.Next = xRedo + BaseRedo = xRedo + + Next + End Sub + + Private Sub RedoAddNoteAll(xSel As Boolean, ByRef BaseUndo As UndoRedo.LinkedURCmd, ByRef BaseRedo As UndoRedo.LinkedURCmd) + For xI1 As Integer = 1 To UBound(Notes) + + Dim xRedo As New UndoRedo.AddNote(Notes(xI1)) + If BaseRedo IsNot Nothing Then BaseRedo.Next = xRedo + BaseRedo = xRedo + + Next + + Dim xUndo As New UndoRedo.RemoveAllNotes With { + .Next = BaseUndo + } + BaseUndo = xUndo + End Sub + + + Private Sub RedoRemoveNote(xN As Note, ByRef BaseUndo As UndoRedo.LinkedURCmd, ByRef BaseRedo As UndoRedo.LinkedURCmd) + Dim xUndo As New UndoRedo.AddNote(xN) + Dim xRedo As New UndoRedo.RemoveNote(xN) + xUndo.Next = BaseUndo + BaseUndo = xUndo + If BaseRedo IsNot Nothing Then BaseRedo.Next = xRedo + BaseRedo = xRedo + End Sub + + Private Sub RedoRemoveNote(xIndices() As Integer, ByRef BaseUndo As UndoRedo.LinkedURCmd, ByRef BaseRedo As UndoRedo.LinkedURCmd) + For xI1 As Integer = 0 To UBound(xIndices) + Dim xUndo As New UndoRedo.AddNote(Notes(xIndices(xI1))) + Dim xRedo As New UndoRedo.RemoveNote(Notes(xIndices(xI1))) + xUndo.Next = BaseUndo + BaseUndo = xUndo + If BaseRedo IsNot Nothing Then BaseRedo.Next = xRedo + BaseRedo = xRedo + Next + End Sub + + Private Sub RedoRemoveNoteSelected(xSel As Boolean, ByRef BaseUndo As UndoRedo.LinkedURCmd, ByRef BaseRedo As UndoRedo.LinkedURCmd) + For xI1 As Integer = 1 To UBound(Notes) + If Not Notes(xI1).Selected Then Continue For + Dim xUndo As New UndoRedo.AddNote(Notes(xI1)) + Dim xRedo As New UndoRedo.RemoveNote(Notes(xI1)) + xUndo.Next = BaseUndo + BaseUndo = xUndo + If BaseRedo IsNot Nothing Then BaseRedo.Next = xRedo + BaseRedo = xRedo + Next + End Sub + + Private Sub RedoRemoveNoteAll(xSel As Boolean, ByRef BaseUndo As UndoRedo.LinkedURCmd, ByRef BaseRedo As UndoRedo.LinkedURCmd) + For xI1 As Integer = 1 To UBound(Notes) + With Notes(xI1) + Dim xUndo As New UndoRedo.AddNote(Notes(xI1)) With { + .Next = BaseUndo + } + BaseUndo = xUndo + End With + Next + Dim xRedo As New UndoRedo.RemoveAllNotes + If BaseRedo IsNot Nothing Then BaseRedo.Next = xRedo + BaseRedo = xRedo + End Sub + + Private Sub RedoChangeNote(note1 As Note, note2 As Note, ByRef BaseUndo As UndoRedo.LinkedURCmd, ByRef BaseRedo As UndoRedo.LinkedURCmd) + Dim xUndo As New UndoRedo.ChangeNote(note2, note1) + Dim xRedo As New UndoRedo.ChangeNote(note1, note2) + xUndo.Next = BaseUndo + BaseUndo = xUndo + If BaseRedo IsNot Nothing Then BaseRedo.Next = xRedo + BaseRedo = xRedo + End Sub + + + Private Sub RedoMoveNote(note As Note, nCol As Integer, nVPos As Double, ByRef BaseUndo As UndoRedo.LinkedURCmd, ByRef BaseRedo As UndoRedo.LinkedURCmd) + Dim noteAfterModification = note + noteAfterModification.ColumnIndex = nCol + noteAfterModification.VPosition = nVPos + Dim xUndo As New UndoRedo.MoveNote(noteAfterModification, note.ColumnIndex, note.VPosition) + Dim xRedo As New UndoRedo.MoveNote(note, nCol, nVPos) + xUndo.Next = BaseUndo + BaseUndo = xUndo + If BaseRedo IsNot Nothing Then BaseRedo.Next = xRedo + BaseRedo = xRedo + End Sub + + + Private Sub RedoLongNoteModify(note As Note, nVPos As Double, nLong As Double, ByRef BaseUndo As UndoRedo.LinkedURCmd, ByRef BaseRedo As UndoRedo.LinkedURCmd) + Dim n = note + n.VPosition = nVPos + n.Length = nLong + + Dim xUndo As New UndoRedo.LongNoteModify(n, note.VPosition, note.Length) + Dim xRedo As New UndoRedo.LongNoteModify(note, nVPos, n.Length) + xUndo.Next = BaseUndo + BaseUndo = xUndo + If BaseRedo IsNot Nothing Then BaseRedo.Next = xRedo + BaseRedo = xRedo + End Sub + + Private Sub RedoHiddenNoteModify(xN As Note, nHide As Boolean, xSel As Boolean, ByRef BaseUndo As UndoRedo.LinkedURCmd, ByRef BaseRedo As UndoRedo.LinkedURCmd) + Dim noteAfterModification = xN + noteAfterModification.Hidden = nHide + Dim xUndo As New UndoRedo.HiddenNoteModify(noteAfterModification, xN.Hidden) + Dim xRedo As New UndoRedo.HiddenNoteModify(xN, nHide) + xUndo.Next = BaseUndo + BaseUndo = xUndo + If BaseRedo IsNot Nothing Then BaseRedo.Next = xRedo + BaseRedo = xRedo + End Sub + + + Private Sub RedoRelabelNote(xN As Note, nVal As Long, ByRef BaseUndo As UndoRedo.LinkedURCmd, ByRef BaseRedo As UndoRedo.LinkedURCmd) + Dim noteAfterModification = xN + noteAfterModification.Value = nVal + Dim xUndo As New UndoRedo.RelabelNote(noteAfterModification, xN.Value) + Dim xRedo As New UndoRedo.RelabelNote(xN, nVal) + xUndo.Next = BaseUndo + BaseUndo = xUndo + If BaseRedo IsNot Nothing Then BaseRedo.Next = xRedo + BaseRedo = xRedo + End Sub + + Private Sub RedoChangeMeasureLengthSelected(nVal As Double, ByRef BaseUndo As UndoRedo.LinkedURCmd, ByRef BaseRedo As UndoRedo.LinkedURCmd) + Dim xIndices(LBeat.SelectedIndices.Count - 1) As Integer + LBeat.SelectedIndices.CopyTo(xIndices, 0) + If xIndices.Length = 0 Then Exit Sub + + Dim xmLen(-1) As Double + Dim xUndo(-1) As UndoRedo.ChangeMeasureLength + For Each xI1 As Integer In xIndices + Dim xI As Integer = Array.IndexOf(xmLen, MeasureLength(xI1)) + If xI = -1 Then + ReDim Preserve xmLen(UBound(xmLen) + 1) + ReDim Preserve xUndo(UBound(xUndo) + 1) + xmLen(UBound(xmLen)) = MeasureLength(xI1) + xUndo(UBound(xUndo)) = New UndoRedo.ChangeMeasureLength(MeasureLength(xI1), New Integer() {xI1}) + Else + With xUndo(xI) + ReDim Preserve .Indices(UBound(.Indices) + 1) + .Indices(UBound(.Indices)) = xI1 + End With + End If + Next + For xI1 As Integer = 0 To UBound(xUndo) - 1 + xUndo(xI1).Next = xUndo(xI1 + 1) + Next + xUndo(UBound(xUndo)).Next = BaseUndo + BaseUndo = xUndo(0) + + Dim xRedo As New UndoRedo.ChangeMeasureLength(nVal, xIndices.Clone) + If BaseRedo IsNot Nothing Then BaseRedo.Next = xRedo + BaseRedo = xRedo + End Sub + + Private Sub RedoChangeTimeSelection(pStart As Double, pLen As Double, pHalf As Double, nStart As Double, nLen As Double, nHalf As Double, xSel As Boolean, ByRef BaseUndo As UndoRedo.LinkedURCmd, ByRef BaseRedo As UndoRedo.LinkedURCmd) - Dim xUndo As New UndoRedo.ChangeTimeSelection(pStart, pLen, pHalf, xSel) - Dim xRedo As New UndoRedo.ChangeTimeSelection(nStart, nLen, nHalf, xSel) - xUndo.Next = BaseUndo - BaseUndo = xUndo - If BaseRedo IsNot Nothing Then BaseRedo.Next = xRedo - BaseRedo = xRedo - End Sub - - 'Private Sub RedoChangeVisibleColumns(ByVal pBLP As Boolean, ByVal pSTOP As Boolean, ByVal pPlayer As Integer, _ - ' ByVal nBLP As Boolean, ByVal nSTOP As Boolean, ByVal nPlayer As Integer, _ - 'ByRef BaseUndo As UndoRedo.LinkedURCmd, ByRef BaseRedo As UndoRedo.LinkedURCmd) - ' Dim xUndo As New UndoRedo.ChangeVisibleColumns(pBLP, pSTOP, pPlayer) - ' Dim xRedo As New UndoRedo.ChangeVisibleColumns(nBLP, nSTOP, nPlayer) - ' xUndo.Next = BaseUndo - ' BaseUndo = xUndo - ' If BaseRedo IsNot Nothing Then BaseRedo.Next = xRedo - ' BaseRedo = xRedo - 'End Sub - - Private Sub RedoNT(becomeNT As Boolean, autoConvert As Boolean, ByRef BaseUndo As UndoRedo.LinkedURCmd, ByRef BaseRedo As UndoRedo.LinkedURCmd) - Dim xUndo As New UndoRedo.NT(Not becomeNT, autoConvert) - Dim xRedo As New UndoRedo.NT(becomeNT, autoConvert) - xUndo.Next = BaseUndo - BaseUndo = xUndo - If BaseRedo IsNot Nothing Then BaseRedo.Next = xRedo - BaseRedo = xRedo - End Sub - - Private Sub RedoWavIncrease(wavinc As Boolean, ByRef BaseUndo As UndoRedo.LinkedURCmd, ByRef BaseRedo As UndoRedo.LinkedURCmd) - Dim xUndo As New UndoRedo.WavAutoincFlag(Not wavinc) - Dim xRedo As New UndoRedo.WavAutoincFlag(wavinc) - xUndo.Next = BaseUndo - BaseUndo = xUndo - If BaseUndo IsNot Nothing Then BaseRedo.Next = xRedo - BaseRedo = xRedo - End Sub + Dim xUndo As New UndoRedo.ChangeTimeSelection(pStart, pLen, pHalf, xSel) + Dim xRedo As New UndoRedo.ChangeTimeSelection(nStart, nLen, nHalf, xSel) + xUndo.Next = BaseUndo + BaseUndo = xUndo + If BaseRedo IsNot Nothing Then BaseRedo.Next = xRedo + BaseRedo = xRedo + End Sub + + 'Private Sub RedoChangeVisibleColumns(ByVal pBLP As Boolean, ByVal pSTOP As Boolean, ByVal pPlayer As Integer, _ + ' ByVal nBLP As Boolean, ByVal nSTOP As Boolean, ByVal nPlayer As Integer, _ + 'ByRef BaseUndo As UndoRedo.LinkedURCmd, ByRef BaseRedo As UndoRedo.LinkedURCmd) + ' Dim xUndo As New UndoRedo.ChangeVisibleColumns(pBLP, pSTOP, pPlayer) + ' Dim xRedo As New UndoRedo.ChangeVisibleColumns(nBLP, nSTOP, nPlayer) + ' xUndo.Next = BaseUndo + ' BaseUndo = xUndo + ' If BaseRedo IsNot Nothing Then BaseRedo.Next = xRedo + ' BaseRedo = xRedo + 'End Sub + + Private Sub RedoNT(becomeNT As Boolean, autoConvert As Boolean, ByRef BaseUndo As UndoRedo.LinkedURCmd, ByRef BaseRedo As UndoRedo.LinkedURCmd) + Dim xUndo As New UndoRedo.NT(Not becomeNT, autoConvert) + Dim xRedo As New UndoRedo.NT(becomeNT, autoConvert) + xUndo.Next = BaseUndo + BaseUndo = xUndo + If BaseRedo IsNot Nothing Then BaseRedo.Next = xRedo + BaseRedo = xRedo + End Sub + + Private Sub RedoWavIncrease(wavinc As Boolean, ByRef BaseUndo As UndoRedo.LinkedURCmd, ByRef BaseRedo As UndoRedo.LinkedURCmd) + Dim xUndo As New UndoRedo.WavAutoincFlag(Not wavinc) + Dim xRedo As New UndoRedo.WavAutoincFlag(wavinc) + xUndo.Next = BaseUndo + BaseUndo = xUndo + If BaseUndo IsNot Nothing Then BaseRedo.Next = xRedo + BaseRedo = xRedo + End Sub End Class diff --git a/iBMSC/Extensions.vb b/iBMSC/Extensions.vb index 0f420382b..c6417555c 100644 --- a/iBMSC/Extensions.vb +++ b/iBMSC/Extensions.vb @@ -1,10 +1,10 @@ Imports System.Runtime.CompilerServices Friend Module Extensions - - Public Sub SetValClamped(ByRef self As NumericUpDown, k As Decimal) - self.Value = Math.Min(Math.Max(k, self.Minimum), self.Maximum) - End Sub + + Public Sub SetValClamped(ByRef self As NumericUpDown, k As Decimal) + self.Value = Math.Min(Math.Max(k, self.Minimum), self.Maximum) + End Sub End Module diff --git a/iBMSC/MainWindow.vb b/iBMSC/MainWindow.vb index b68cd3448..60385e41c 100644 --- a/iBMSC/MainWindow.vb +++ b/iBMSC/MainWindow.vb @@ -1,4789 +1,4789 @@ Imports iBMSC.Editor Public Class MainWindow - 'Public Structure MARGINS - ' Public Left As Integer - ' Public Right As Integer - ' Public Top As Integer - ' Public Bottom As Integer - 'End Structure - - ' _ - 'Public Shared Function DwmIsCompositionEnabled(ByRef en As Integer) As Integer - 'End Function - ' _ - 'Public Shared Function DwmExtendFrameIntoClientArea( hwnd As IntPtr, ByRef margin As MARGINS) As Integer - 'End Function - Public Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (hwnd As IntPtr, wMsg As Integer, wParam As Integer, lParam As Integer) As Integer - Public Declare Function ReleaseCapture Lib "user32.dll" Alias "ReleaseCapture" () As Integer - - 'Private Declare Auto Function GetWindowLong Lib "user32" ( hWnd As IntPtr, nIndex As Integer) As Integer - 'Private Declare Auto Function SetWindowLong Lib "user32" ( hWnd As IntPtr, nIndex As Integer, dwNewLong As Integer) As Integer - 'Private Declare Function SetWindowPos Lib "user32.dll" ( hWnd As IntPtr, hWndInsertAfter As IntPtr, x As Integer, y As Integer, cx As Integer, cy As Integer, wFlags As Integer) As Integer - ' _ - 'Private Shared Function SetWindowText( hwnd As IntPtr, lpString As String) As Boolean - 'End Function - - 'Private Const GWL_STYLE As Integer = -16 - 'Private Const WS_CAPTION As Integer = &HC00000 - 'Private Const SWP_NOSIZE As Integer = &H1 - 'Private Const SWP_NOMOVE As Integer = &H2 - 'Private Const SWP_NOZORDER As Integer = &H4 - 'Private Const SWP_NOACTIVATE As Integer = &H10 - 'Private Const SWP_FRAMECHANGED As Integer = &H20 - 'Private Const SWP_REFRESH As Integer = SWP_NOZORDER Or SWP_NOSIZE Or SWP_NOMOVE Or SWP_NOACTIVATE Or SWP_FRAMECHANGED - - - Private MeasureLength(999) As Double - Private MeasureBottom(999) As Double - - Public Function MeasureUpper(idx As Integer) As Double - Return MeasureBottom(idx) + MeasureLength(idx) - End Function - - Private Notes() As Note = {New Note(niBPM, -1, 1200000, 0, False)} - Private mColumn(999) As Integer '0 = no column, 1 = 1 column, etc. - Private GreatestVPosition As Double '+ 2000 = -VS.Minimum - - Private VSValue As Integer = 0 'Store value before ValueChange event - Private HSValue As Integer = 0 'Store value before ValueChange event - - 'Dim SortingMethod As Integer = 1 - Private MiddleButtonMoveMethod As Integer = 0 - Private TextEncoding As System.Text.Encoding = System.Text.Encoding.UTF8 - Private DispLang As String = String.Empty 'Display Language - Private Recent() As String = {String.Empty, String.Empty, String.Empty, String.Empty, String.Empty} - Private NTInput As Boolean = True - Private ShowFileName As Boolean = False - - Private BeepWhileSaved As Boolean = True - Private BPMx1296 As Boolean = False - Private STOPx1296 As Boolean = False - - Private IsInitializing As Boolean = True - Private FirstMouseEnter As Boolean = True - - Private WAVMultiSelect As Boolean = True - Private WAVChangeLabel As Boolean = True - Private WAVEmptyfill As Boolean = True - Private BeatChangeMode As Integer = 0 - - 'Dim FloatTolerance As Double = 0.0001R - Private BMSGridLimit As Double = 1.0R - - Private LnObj As Integer = 0 '0 for none, 1-1295 for 01-ZZ - - 'IO - Private FileName As String = "Untitled.bms" - 'Dim TitlePath As New Drawing2D.GraphicsPath - Private InitPath As String = String.Empty - Private IsSaved As Boolean = True - Public Structure Chartinfo - Public Shared Fultitle As String - Public Shared Allartist As String - End Structure - 'Variables for Drag/Drop - Private DDFileName() As String = Array.Empty(Of String)() - Private SupportedFileExtension() As String = {".bms", ".bme", ".bml", ".pms", ".txt", ".sm", ".ibmsc"} - Private SupportedAudioExtension() As String = {".wav", ".mp3", ".ogg", ".flac"} - Private SupportedImageExtension() As String = {".bmp", ".png", ".jpg", ".jpeg", ".gif", ".mpg", ".mpeg", ".avi", ".m1v", ".m2v", ".m4v", ".mp4", ".webm", ".wmv"} - - 'Variables for theme - 'Dim SaveTheme As Boolean = True - - 'Variables for undo/redo - Private sUndo(99) As UndoRedo.LinkedURCmd - Private sRedo(99) As UndoRedo.LinkedURCmd - Private sI As Integer = 0 - - 'Variables for select tool - Private DisableVerticalMove As Boolean = False - Private KMouseOver As Integer = -1 'Mouse is on which note (for drawing green outline) - Private LastMouseDownLocation As PointF = New Point(-1, -1) 'Mouse is clicked on which point (location for display) (for selection box) - Private pMouseMove As PointF = New Point(-1, -1) 'Mouse is moved to which point (location for display) (for selection box) - 'Dim KMouseDown As Integer = -1 'Mouse is clicked on which note (for moving) - Private deltaVPosition As Double = 0 'difference between mouse and VPosition of K - Private bAdjustLength As Boolean 'If adjusting note length instead of moving it - Private bAdjustUpper As Boolean 'true = Adjusting upper end, false = adjusting lower end - Private bAdjustSingle As Boolean 'true if there is only one note to be adjusted - Private tempY As Integer - Private tempV As Integer - Private tempX As Integer - Private tempH As Integer - Private MiddleButtonLocation As New Point(0, 0) - Private MiddleButtonClicked As Boolean = False - Private MouseMoveStatus As New Point(0, 0) 'mouse is moved to which point (For Status Panel) - 'Dim uCol As Integer 'temp variables for undo, original enabled columnindex - 'Dim uVPos As Double 'temp variables for undo, original vposition - 'Dim uPairWithI As Double 'temp variables for undo, original note length - Private uAdded As Boolean 'temp variables for undo, if undo command is added - 'Dim uNote As Note 'temp variables for undo, original note - Private SelectedNotes(-1) As Note 'temp notes for undo - Private ctrlPressed As Boolean = False 'Indicates if the CTRL key is pressed while mousedown - Private DuplicatedSelectedNotes As Boolean = False 'Indicates if duplicate notes of select/unselect note - - 'Variables for write tool - Private ShouldDrawTempNote As Boolean = False - Private SelectedColumn As Integer = -1 - Private TempVPosition As Double = -1.0# - Private TempLength As Double = 0.0# - - 'Variables for post effects tool - Private vSelStart As Double = 192.0# - Private vSelLength As Double = 0.0# - Private vSelHalf As Double = 0.0# - Private vSelMouseOverLine As Integer = 0 '0 = nothing, 1 = start, 2 = half, 3 = end - Private vSelAdjust As Boolean = False - Private vSelK() As Note = Array.Empty(Of Note)() - Private vSelPStart As Double = 192.0# - Private vSelPLength As Double = 0.0# - Private vSelPHalf As Double = 0.0# - - 'Variables for Full-Screen Mode - Private isFullScreen As Boolean = False - Private previousWindowState As FormWindowState = FormWindowState.Normal - Private previousWindowPosition As New Rectangle(0, 0, 0, 0) - - 'Variables misc - Private menuVPosition As Double = 0.0# - Private tempResize As Integer = 0 - - '----AutoSave Options - Private PreviousAutoSavedFileName As String = String.Empty - Private AutoSaveInterval As Integer = 120000 - - '----ErrorCheck Options - Private ErrorCheck As Boolean = True - - '----Header Options - Private hWAV(1295) As String - Private hBMP(1295) As String - Private hBPM(1295) As Long 'x10000 - Private hSTOP(1295) As Long - Private hBMSCROLL(1295) As Long - - '----Grid Options - Private gSnap As Boolean = True - Private gShowGrid As Boolean = True 'Grid - Private gShowSubGrid As Boolean = True 'Sub - Private gShowBG As Boolean = True 'BG Color - Private gShowMeasureNumber As Boolean = True 'Measure Label - Private gShowVerticalLine As Boolean = True 'Vertical - Private gShowMeasureBar As Boolean = True 'Measure Barline - Private gShowC As Boolean = True 'Column Caption - Private gDivide As Integer = 16 - Private gSub As Integer = 4 - Private gSlash As Integer = 192 - Private gxHeight As Single = 1.0! - Private gxWidth As Single = 1.0! - Private gWheel As Integer = 96 - Private gPgUpDn As Integer = 384 - - Private gDisplayBGAColumn As Boolean = True - Private gSCROLL As Boolean = True - Private gSTOP As Boolean = True - Private gBPM As Boolean = True - 'Dim gA8 As Boolean = False - Private iPlayer As Integer = 0 - Private gColumns As Integer = 82 - - '----Visual Options - Private vo As New visualSettings() - - Public Sub setVO(xvo As visualSettings) - vo = xvo - End Sub - - '----Preview Options - Public Structure PlayerArguments - Public Path As String - Public aBegin As String - Public aHere As String - Public aStop As String - Public Sub New(xPath As String, xBegin As String, xHere As String, xStop As String) - Path = xPath - aBegin = xBegin - aHere = xHere - aStop = xStop - End Sub - End Structure - - Public pArgs() As PlayerArguments = {New PlayerArguments("\uBMplay.exe", - "-P -N0 """"", - "-P -N """"", - "-S"), - New PlayerArguments("\o2play.exe", - "-P -N0 """"", - "-P -N """"", - "-S"), - New PlayerArguments("java.exe -jar \beatoraja.jar", - "-a -s""""", - "none1", - "none1" - )} - - Public CurrentPlayer As Integer = 0 - Private PreviewOnClick As Boolean = True - Private PreviewErrorCheck As Boolean = False - Private Rscratch As Boolean = False - Private ClickStopPreview As Boolean = True - Private pTempFileNames() As String = Array.Empty(Of String)() - - '----Split Panel Options - Private PanelWidth() As Single = {0, 100, 0} - Private PanelhBMSCROLL() As Integer = {0, 0, 0} - Private PanelVScroll() As Integer = {0, 0, 0} - Private spLock() As Boolean = {False, False, False} - Private spDiff() As Integer = {0, 0, 0} - Private PanelFocus As Integer = 1 '0 = Left, 1 = Middle, 2 = Right - Private spMouseOver As Integer = 1 - - Private AutoFocusMouseEnter As Boolean = False - Private FirstClickDisabled As Boolean = True - Private tempFirstMouseDown As Boolean = False - - Private spMain() As Panel = Array.Empty(Of Panel)() - - '----Find Delete Replace Options - Private fdriMesL As Integer - Private fdriMesU As Integer - Private fdriLblL As Integer - Private fdriLblU As Integer - Private fdriValL As Integer - Private fdriValU As Integer - Private fdriCol() As Integer - - - Public Sub New() - InitializeComponent() - Initialize() - End Sub - - ''' - ''' - ''' - ''' Original horizontal position. - ''' HS.Value - - - Private Function HorizontalPositiontoDisplay(xHPosition As Integer, xHSVal As Long) As Integer - Return (xHPosition * gxWidth) - (xHSVal * gxWidth) - End Function - - ''' - ''' - ''' - ''' Original vertical position. - ''' VS.Value - ''' Height of the panel. (DisplayRectangle, but not ClipRectangle) - - - Private Function NoteRowToPanelHeight(xVPosition As Double, xVSVal As Long, xTHeight As Integer) As Integer - Return xTHeight - CInt((xVPosition + xVSVal) * gxHeight) - 1 - End Function - - Public Function MeasureAtDisplacement(xVPos As Double) As Integer - 'Return Math.Floor((xVPos + FloatTolerance) / 192) - 'Return Math.Floor(xVPos / 192) - Dim xI1 As Integer - For xI1 = 1 To 999 - If xVPos < MeasureBottom(xI1) Then Exit For - Next - Return xI1 - 1 - End Function - - Private Function GetMaxVPosition() As Double - Return MeasureUpper(999) - End Function - - Private Function SnapToGrid(xVPos As Double) As Double - Dim xOffset As Double = MeasureBottom(MeasureAtDisplacement(xVPos)) - Dim xRatio As Double = 192.0R / gDivide - Return (Math.Floor((xVPos - xOffset) / xRatio) * xRatio) + xOffset - End Function - - Private Sub CalculateGreatestVPosition() - 'If K Is Nothing Then Exit Sub - Dim xI1 As Integer - GreatestVPosition = 0 - - If NTInput Then - For xI1 = UBound(Notes) To 0 Step -1 - If Notes(xI1).VPosition + Notes(xI1).Length > GreatestVPosition Then GreatestVPosition = Notes(xI1).VPosition + Notes(xI1).Length - Next - Else - For xI1 = UBound(Notes) To 0 Step -1 - If Notes(xI1).VPosition > GreatestVPosition Then GreatestVPosition = Notes(xI1).VPosition - Next - End If - - Dim xI2 As Integer = -CInt(IIf(GreatestVPosition + 2000 > GetMaxVPosition(), GetMaxVPosition, GreatestVPosition + 2000)) - MainPanelScroll.Minimum = xI2 - LeftPanelScroll.Minimum = xI2 - RightPanelScroll.Minimum = xI2 - End Sub - - - Private Sub SortByVPositionInsertion() 'Insertion Sort - If UBound(Notes) <= 0 Then Exit Sub - Dim xNote As Note - Dim xI1 As Integer - Dim xI2 As Integer - For xI1 = 2 To UBound(Notes) - xNote = Notes(xI1) - For xI2 = xI1 - 1 To 1 Step -1 - If Notes(xI2).VPosition > xNote.VPosition Then - Notes(xI2 + 1) = Notes(xI2) - ' If KMouseDown = xI2 Then KMouseDown += 1 - If xI2 = 1 Then - Notes(xI2) = xNote - ' If KMouseDown = xI1 Then KMouseDown = xI2 - Exit For - End If - Else - Notes(xI2 + 1) = xNote - ' If KMouseDown = xI1 Then KMouseDown = xI2 + 1 - Exit For - End If - Next - Next - - End Sub - - Private Sub SortByVPositionQuick(xMin As Integer, xMax As Integer) 'Quick Sort - Dim xNote As Note - Dim iHi As Integer - Dim iLo As Integer - Dim xI1 As Integer - - ' If min >= max, the list contains 0 or 1 items so it is sorted. - If xMin >= xMax Then Exit Sub - - ' Pick the dividing value. - xI1 = CInt((xMax - xMin) / 2) + xMin - xNote = Notes(xI1) - - ' Swap it to the front. - Notes(xI1) = Notes(xMin) - - iLo = xMin - iHi = xMax - Do - ' Look down from hi for a value < med_value. - Do While Notes(iHi).VPosition >= xNote.VPosition - iHi -= 1 - If iHi <= iLo Then Exit Do - Loop - If iHi <= iLo Then - Notes(iLo) = xNote - Exit Do - End If - - ' Swap the lo and hi values. - Notes(iLo) = Notes(iHi) - - ' Look up from lo for a value >= med_value. - iLo += 1 - Do While Notes(iLo).VPosition < xNote.VPosition - iLo += 1 - If iLo >= iHi Then Exit Do - Loop - If iLo >= iHi Then - iLo = iHi - Notes(iHi) = xNote - Exit Do - End If - - ' Swap the lo and hi values. - Notes(iHi) = Notes(iLo) - Loop - - ' Sort the two sublists. - SortByVPositionQuick(xMin, iLo - 1) - SortByVPositionQuick(iLo + 1, xMax) - End Sub - - Private Sub SortByVPositionQuick3(xMin As Integer, xMax As Integer) - Dim xxMin As Integer - Dim xxMax As Integer - Dim xxMid As Integer - Dim xNote As Note - Dim xNoteMid As Note - Dim xI1 As Integer - Dim xI2 As Integer - Dim xI3 As Integer - - 'If xMax = 0 Then - ' xMin = LBound(K1) - ' xMax = UBound(K1) - 'End If - xxMin = xMin - xxMax = xMax - xxMid = xMax - xMin + 1 - xI1 = CInt(Int(xxMid * Rnd())) + xMin - xI2 = CInt(Int(xxMid * Rnd())) + xMin - xI3 = CInt(Int(xxMid * Rnd())) + xMin - xxMid = If(Notes(xI1).VPosition <= Notes(xI2).VPosition And Notes(xI2).VPosition <= Notes(xI3).VPosition, - xI2, - If(Notes(xI2).VPosition <= Notes(xI1).VPosition And Notes(xI1).VPosition <= Notes(xI3).VPosition, xI1, xI3)) - xNoteMid = Notes(xxMid) - Do - Do While Notes(xxMin).VPosition < xNoteMid.VPosition And xxMin < xMax - xxMin += 1 - Loop - Do While xNoteMid.VPosition < Notes(xxMax).VPosition And xxMax > xMin - xxMax -= 1 - Loop - If xxMin <= xxMax Then - xNote = Notes(xxMin) - Notes(xxMin) = Notes(xxMax) - Notes(xxMax) = xNote - xxMin += 1 - xxMax -= 1 - End If - Loop Until xxMin > xxMax - If xxMax - xMin < xMax - xxMin Then - If xMin < xxMax Then SortByVPositionQuick3(xMin, xxMax) - If xxMin < xMax Then SortByVPositionQuick3(xxMin, xMax) - Else - If xxMin < xMax Then SortByVPositionQuick3(xxMin, xMax) - If xMin < xxMax Then SortByVPositionQuick3(xMin, xxMax) - End If - End Sub - - - Private Sub UpdateMeasureBottom() - MeasureBottom(0) = 0.0# - For xI1 As Integer = 0 To 998 - MeasureBottom(xI1 + 1) = MeasureBottom(xI1) + MeasureLength(xI1) - Next - End Sub - - Private Function PathIsValid(sPath As String) As Boolean - Return File.Exists(sPath) Or Directory.Exists(sPath) - End Function - - Public Function PrevCodeToReal(InitStr As String) As String - Dim xFileName As String = IIf(Not PathIsValid(FileName), - IIf(InitPath = String.Empty, My.Application.Info.DirectoryPath, InitPath), - ExcludeFileName(FileName)) _ - & "\___TempBMS.bms" - Dim xMeasure As Integer = MeasureAtDisplacement(Math.Abs(PanelVScroll(PanelFocus))) - Dim xS1 As String = Replace(InitStr, "", My.Application.Info.DirectoryPath) - Dim xS2 As String = Replace(xS1, "", xMeasure) - Dim xS3 As String = Replace(xS2, "", xFileName) - Return xS3 - End Function - - Private Sub SetFileName(xFileName As String) - FileName = xFileName.Trim - InitPath = ExcludeFileName(FileName) - SetIsSaved(IsSaved) - End Sub - - Private Sub SetIsSaved(isSaved As Boolean) - 'pttl.Refresh() - 'pIsSaved.Visible = Not xBool - Dim xVersion As String = My.Application.Info.Version.Major & "." & My.Application.Info.Version.Minor & - IIf(My.Application.Info.Version.Build = 0, String.Empty, "." & My.Application.Info.Version.Build) - Text = IIf(isSaved, String.Empty, "*") & GetFileName(FileName) & " - " & My.Application.Info.Title & " " & xVersion - Me.IsSaved = isSaved - End Sub - - Private Sub PreviewNote(xFileLocation As String, bStop As Boolean) - If bStop Then - StopPlaying() - End If - Play(xFileLocation) - End Sub - - Private Sub AddNote(note As Note, - Optional xSelected As Boolean = False, - Optional OverWrite As Boolean = True, - Optional SortAndUpdatePairing As Boolean = True) - - If note.VPosition < 0 Or note.VPosition >= GetMaxVPosition() Then Exit Sub - - Dim xI1 As Integer = 1 - - If OverWrite Then - Do While xI1 <= UBound(Notes) - If Notes(xI1).VPosition = note.VPosition And - Notes(xI1).ColumnIndex = note.ColumnIndex Then - RemoveNote(xI1) - Else - xI1 += 1 - End If - Loop - End If - - ReDim Preserve Notes(UBound(Notes) + 1) - note.Selected = note.Selected And nEnabled(note.ColumnIndex) - Notes(UBound(Notes)) = note - - If TBWavIncrease.Checked Then - If IsColumnSound(note.ColumnIndex) Then - IncreaseCurrentWav() - End If - If IsColumnImage(note.ColumnIndex) Then - IncreaseCurrentBmp() - End If - End If - - If SortAndUpdatePairing Then SortByVPositionInsertion() : UpdatePairing() - CalculateTotalPlayableNotes() - End Sub - - Private Sub RemoveNote(I As Integer, Optional SortAndUpdatePairing As Boolean = True) - KMouseOver = -1 - Dim xI2 As Integer - - If TBWavIncrease.Checked Then - If IsColumnSound(Notes(I).ColumnIndex) Then - If Notes(I).Value = LWAV.SelectedIndex * 10000 Then - DecreaseCurrentWav() - End If - Else - If Notes(I).Value = LBMP.SelectedIndex * 10000 Then - DecreaseCurrentBmp() - End If - End If - End If - - For xI2 = I + 1 To UBound(Notes) - Notes(xI2 - 1) = Notes(xI2) - Next - ReDim Preserve Notes(UBound(Notes) - 1) - If SortAndUpdatePairing Then SortByVPositionInsertion() : UpdatePairing() - - End Sub - - Private Sub AddNotesFromClipboard(Optional xSelected As Boolean = True, Optional SortAndUpdatePairing As Boolean = True) - Dim xStrLine() As String = Split(Clipboard.GetText, vbCrLf) - - Dim xI1 As Integer - For xI1 = 0 To UBound(Notes) - Notes(xI1).Selected = False - Next - - Dim xVS As Long = PanelVScroll(PanelFocus) - Dim xTempVP As Double - Dim xKbu() As Note = Notes - - If xStrLine(0) = "iBMSC Clipboard Data" Then - If NTInput Then ReDim Preserve Notes(0) - - 'paste - Dim xStrSub() As String - For xI1 = 1 To UBound(xStrLine) - If xStrLine(xI1).Trim = String.Empty Then Continue For - xStrSub = Split(xStrLine(xI1), " ") - xTempVP = Val(xStrSub(1)) + MeasureBottom(MeasureAtDisplacement(-xVS) + 1) - If UBound(xStrSub) = 5 And xTempVP >= 0 And xTempVP < GetMaxVPosition() Then - ReDim Preserve Notes(UBound(Notes) + 1) - With Notes(UBound(Notes)) - .ColumnIndex = Val(xStrSub(0)) - .VPosition = xTempVP - .Value = Val(xStrSub(2)) - .LongNote = CBool(Val(xStrSub(3))) - .Hidden = CBool(Val(xStrSub(4))) - .Landmine = CBool(Val(xStrSub(5))) - .Selected = xSelected - End With - End If - Next - - 'convert - If NTInput Then - ConvertBMSE2NT() - - For xI1 = 1 To UBound(Notes) - Notes(xI1 - 1) = Notes(xI1) - Next - ReDim Preserve Notes(UBound(Notes) - 1) - - Dim xKn() As Note = Notes - Notes = xKbu - - Dim xIStart As Integer = Notes.Length - ReDim Preserve Notes(UBound(Notes) + xKn.Length) - - For xI1 = xIStart To UBound(Notes) - Notes(xI1) = xKn(xI1 - xIStart) - Next - End If - - ElseIf xStrLine(0) = "iBMSC Clipboard Data xNT" Then - If Not NTInput Then ReDim Preserve Notes(0) - - 'paste - Dim xStrSub() As String - For xI1 = 1 To UBound(xStrLine) - If xStrLine(xI1).Trim = String.Empty Then Continue For - xStrSub = Split(xStrLine(xI1), " ") - xTempVP = Val(xStrSub(1)) + MeasureBottom(MeasureAtDisplacement(-xVS) + 1) - If UBound(xStrSub) = 5 And xTempVP >= 0 And xTempVP < GetMaxVPosition() Then - ReDim Preserve Notes(UBound(Notes) + 1) - With Notes(UBound(Notes)) - .ColumnIndex = Val(xStrSub(0)) - .VPosition = xTempVP - .Value = Val(xStrSub(2)) - .Length = Val(xStrSub(3)) - .Hidden = CBool(Val(xStrSub(4))) - .Landmine = CBool(Val(xStrSub(5))) - .Selected = xSelected - End With - End If - Next - - 'convert - If Not NTInput Then - ConvertNT2BMSE() - - For xI1 = 1 To UBound(Notes) - Notes(xI1 - 1) = Notes(xI1) - Next - ReDim Preserve Notes(UBound(Notes) - 1) - - Dim xKn() As Note = Notes - Notes = xKbu - - Dim xIStart As Integer = Notes.Length - ReDim Preserve Notes(UBound(Notes) + xKn.Length) - - For xI1 = xIStart To UBound(Notes) - Notes(xI1) = xKn(xI1 - xIStart) - Next - End If - - ElseIf xStrLine(0) = "BMSE ClipBoard Object Data Format" Then - If NTInput Then ReDim Preserve Notes(0) - - 'paste - For xI1 = 1 To UBound(xStrLine) - ' zdr: holy crap this is obtuse - Dim posStr = Mid(xStrLine(xI1), 5, 7) - Dim vPos = Val(posStr) + MeasureBottom(MeasureAtDisplacement(-xVS) + 1) - - Dim bmsIdent = Mid(xStrLine(xI1), 1, 3) - Dim lineCol = BMSEChannelToColumnIndex(bmsIdent) - - Dim Value = Val(Mid(xStrLine(xI1), 12)) * 10000 - - Dim attribute = Mid(xStrLine(xI1), 4, 1) - - Dim validCol = Len(xStrLine(xI1)) > 11 And lineCol > 0 - Dim inRange = vPos >= 0 And vPos < GetMaxVPosition() - If validCol And inRange Then - ReDim Preserve Notes(UBound(Notes) + 1) - - With Notes(UBound(Notes)) - .ColumnIndex = lineCol - .VPosition = vPos - .Value = Value - .LongNote = attribute = "2" - .Hidden = attribute = "1" - .Selected = xSelected And nEnabled(.ColumnIndex) - End With - End If - Next - - 'convert - If NTInput Then - ConvertBMSE2NT() - - For xI1 = 1 To UBound(Notes) - Notes(xI1 - 1) = Notes(xI1) - Next - ReDim Preserve Notes(UBound(Notes) - 1) - - Dim xKn() As Note = Notes - Notes = xKbu - - Dim xIStart As Integer = Notes.Length - ReDim Preserve Notes(UBound(Notes) + xKn.Length) - - For xI1 = xIStart To UBound(Notes) - Notes(xI1) = xKn(xI1 - xIStart) - Next - End If - End If - - If SortAndUpdatePairing Then SortByVPositionInsertion() : UpdatePairing() - CalculateTotalPlayableNotes() - End Sub - - Private Sub CopyNotes(Optional Unselect As Boolean = True) - Dim xStrAll As String = "iBMSC Clipboard Data" & IIf(NTInput, " xNT", String.Empty) - Dim xI1 As Integer - Dim MinMeasure As Double = 999 - - For xI1 = 1 To UBound(Notes) - If Notes(xI1).Selected And MeasureAtDisplacement(Notes(xI1).VPosition) < MinMeasure Then MinMeasure = MeasureAtDisplacement(Notes(xI1).VPosition) - Next - MinMeasure = MeasureBottom(MinMeasure) - - If Not NTInput Then - For xI1 = 1 To UBound(Notes) - If Notes(xI1).Selected Then - xStrAll &= vbCrLf & Notes(xI1).ColumnIndex.ToString & " " & - (Notes(xI1).VPosition - MinMeasure).ToString & " " & - Notes(xI1).Value.ToString & " " & - CInt(Notes(xI1).LongNote).ToString & " " & - CInt(Notes(xI1).Hidden).ToString & " " & - CInt(Notes(xI1).Landmine).ToString - Notes(xI1).Selected = Not Unselect - End If - Next - - Else - For xI1 = 1 To UBound(Notes) - If Notes(xI1).Selected Then - xStrAll &= vbCrLf & Notes(xI1).ColumnIndex.ToString & " " & - (Notes(xI1).VPosition - MinMeasure).ToString & " " & - Notes(xI1).Value.ToString & " " & - Notes(xI1).Length.ToString & " " & - CInt(Notes(xI1).Hidden).ToString & " " & - CInt(Notes(xI1).Landmine).ToString - Notes(xI1).Selected = Not Unselect - End If - Next - End If - - Clipboard.SetText(xStrAll) - End Sub - - Private Sub RemoveNotes(Optional SortAndUpdatePairing As Boolean = True) - If UBound(Notes) = 0 Then Exit Sub - - KMouseOver = -1 - Dim xI1 As Integer = 1 - Dim xI2 As Integer - Do - If Notes(xI1).Selected Then - For xI2 = xI1 + 1 To UBound(Notes) - Notes(xI2 - 1) = Notes(xI2) - Next - ReDim Preserve Notes(UBound(Notes) - 1) - xI1 = 0 - End If - xI1 += 1 - Loop While xI1 < UBound(Notes) + 1 - If SortAndUpdatePairing Then SortByVPositionInsertion() : UpdatePairing() - CalculateTotalPlayableNotes() - End Sub - - Private Function EnabledColumnIndexToColumnArrayIndex(cEnabled As Integer) As Integer - Dim xI1 As Integer = 0 - Do - If xI1 >= gColumns Then Exit Do - If Not nEnabled(xI1) Then cEnabled += 1 - If xI1 >= cEnabled Then Exit Do - xI1 += 1 - Loop - Return cEnabled - End Function - - Private Function ColumnArrayIndexToEnabledColumnIndex(cReal As Integer) As Integer - Dim xI1 As Integer - For xI1 = 0 To cReal - 1 - If Not nEnabled(xI1) Then cReal -= 1 - Next - Return cReal - End Function - - Private Sub Form1_FormClosed(sender As Object, e As FormClosedEventArgs) Handles MyBase.FormClosed - If pTempFileNames IsNot Nothing Then - For Each xStr In pTempFileNames - File.Delete(xStr) - Next - End If - If PreviousAutoSavedFileName <> String.Empty Then File.Delete(PreviousAutoSavedFileName) - End Sub - - Private Sub Form1_FormClosing(sender As Object, e As FormClosingEventArgs) Handles MyBase.FormClosing - If Not IsSaved Then - Dim xStr = Strings.Messages.SaveOnExit - If e.CloseReason = CloseReason.WindowsShutDown Then xStr = Strings.Messages.SaveOnExit1 - If e.CloseReason = CloseReason.TaskManagerClosing Then xStr = Strings.Messages.SaveOnExit2 - - Dim xResult = MsgBox(xStr, MsgBoxStyle.YesNoCancel Or MsgBoxStyle.Question, Text) - - If xResult = MsgBoxResult.Yes Then - If ExcludeFileName(FileName) = String.Empty Then - Dim xDSave As New SaveFileDialog With { - .Filter = Strings.FileType._bms & "|*.bms;*.bme;*.bml;*.pms;*.txt|" & - Strings.FileType.BMS & "|*.bms|" & - Strings.FileType.BME & "|*.bme|" & - Strings.FileType.BML & "|*.bml|" & - Strings.FileType.PMS & "|*.pms|" & - Strings.FileType.TXT & "|*.txt|" & - Strings.FileType._all & "|*.*", - .DefaultExt = "bms", - .InitialDirectory = InitPath - } - - If xDSave.ShowDialog = Forms.DialogResult.Cancel Then e.Cancel = True : Exit Sub - SetFileName(xDSave.FileName) - End If - Dim xStrAll = SaveBMS() - My.Computer.FileSystem.WriteAllText(FileName, xStrAll, False, TextEncoding) - NewRecent(FileName) - If BeepWhileSaved Then Beep() - End If - - If xResult = MsgBoxResult.Cancel Then e.Cancel = True - End If - - If Not e.Cancel Then - 'If SaveTheme Then - ' My.Computer.FileSystem.WriteAllText(My.Application.Info.DirectoryPath & "\Skin.cff", SaveSkinCFF, False, System.Text.Encoding.Unicode) - 'Else - ' My.Computer.FileSystem.WriteAllText(My.Application.Info.DirectoryPath & "\Skin.cff", "", False, System.Text.Encoding.Unicode) - 'End If - ' - 'My.Computer.FileSystem.WriteAllText(My.Application.Info.DirectoryPath & "\PlayerArgs.cff", SavePlayerCFF, False, System.Text.Encoding.Unicode) - 'My.Computer.FileSystem.WriteAllText(My.Application.Info.DirectoryPath & "\Config.cff", SaveCFF, False, System.Text.Encoding.Unicode) - 'My.Computer.FileSystem.WriteAllText(My.Application.Info.DirectoryPath & "\PreConfig.cff", "", False, System.Text.Encoding.Unicode) - SaveSettings(My.Application.Info.DirectoryPath & "\iBMSC.Settings.xml", False) - End If - End Sub - - Private Function FilterFileBySupported(xFile() As String, xFilter() As String) As String() - Dim xPath(-1) As String - For xI1 As Integer = 0 To UBound(xFile) - If My.Computer.FileSystem.FileExists(xFile(xI1)) And Array.IndexOf(xFilter, Path.GetExtension(xFile(xI1))) <> -1 Then - ReDim Preserve xPath(UBound(xPath) + 1) - xPath(UBound(xPath)) = xFile(xI1) - End If - - If My.Computer.FileSystem.DirectoryExists(xFile(xI1)) Then - Dim xFileNames() As FileInfo = My.Computer.FileSystem.GetDirectoryInfo(xFile(xI1)).GetFiles() - For Each xStr As FileInfo In xFileNames - If Array.IndexOf(xFilter, xStr.Extension) = -1 Then Continue For - ReDim Preserve xPath(UBound(xPath) + 1) - xPath(UBound(xPath)) = xStr.FullName - Next - End If - Next - - Return xPath - End Function - - Private Sub InitializeNewBMS() - 'ReDim K(0) - 'With K(0) - ' .ColumnIndex = niBPM - ' .VPosition = -1 - ' .LongNote = False - ' .Selected = False - ' .Value = 1200000 - 'End With - - THTitle.Text = String.Empty - THArtist.Text = String.Empty - THGenre.Text = String.Empty - THBPM.Value = 120 - If CHPlayer.SelectedIndex = -1 Then CHPlayer.SelectedIndex = 0 - CHRank.SelectedIndex = 2 - THPlayLevel.Text = String.Empty - THSubTitle.Text = String.Empty - THSubArtist.Text = String.Empty - THStageFile.Text = String.Empty - THBanner.Text = String.Empty - THBackBMP.Text = String.Empty - CHDifficulty.SelectedIndex = 0 - THExRank.Text = String.Empty - THTotal.Text = String.Empty - THComment.Text = String.Empty - 'THLnType.Text = "1" - CHLnObj.SelectedIndex = 0 - - THLandMine.Text = String.Empty - THMissBMP.Text = String.Empty - TExpansion.Text = String.Empty - - THPreview.Text = String.Empty - CHLnmode.SelectedIndex = 0 - - LBeat.Items.Clear() - For xI1 As Integer = 0 To 999 - MeasureLength(xI1) = 192.0R - MeasureBottom(xI1) = xI1 * 192.0R - Dim unused = LBeat.Items.Add(Add3Zeros(xI1) & ": 1 ( 4 / 4 )") - Next - End Sub - - Private Sub InitializeOpenBMS() - CHPlayer.SelectedIndex = 0 - 'THLnType.Text = "" - End Sub - - Private Sub Form1_DragEnter(sender As Object, e As DragEventArgs) Handles MyBase.DragEnter - If e.Data.GetDataPresent(DataFormats.FileDrop) Then - e.Effect = DragDropEffects.Copy - DDFileName = FilterFileBySupported(CType(e.Data.GetData(DataFormats.FileDrop), String()), SupportedFileExtension) - Else - e.Effect = DragDropEffects.None - End If - RefreshPanelAll() - End Sub - - Private Sub Form1_DragLeave(sender As Object, e As EventArgs) Handles MyBase.DragLeave - ReDim DDFileName(-1) - RefreshPanelAll() - End Sub - - Private Sub Form1_DragDrop(sender As Object, e As DragEventArgs) Handles MyBase.DragDrop - ReDim DDFileName(-1) - If Not e.Data.GetDataPresent(DataFormats.FileDrop) Then Return - - Dim xOrigPath = CType(e.Data.GetData(DataFormats.FileDrop), String()) - Dim xPath = FilterFileBySupported(xOrigPath, SupportedFileExtension) - If xPath.Length > 0 Then - Dim xProg As New fLoadFileProgress(xPath, IsSaved) - Dim unused = xProg.ShowDialog(Me) - End If - - RefreshPanelAll() - End Sub - - Private Sub setFullScreen(value As Boolean) - If value Then - If WindowState = FormWindowState.Minimized Then Exit Sub - - SuspendLayout() - previousWindowPosition.Location = Location - previousWindowPosition.Size = Size - previousWindowState = WindowState - - WindowState = FormWindowState.Normal - FormBorderStyle = FormBorderStyle.None - WindowState = FormWindowState.Maximized - ToolStripContainer1.TopToolStripPanelVisible = False - - ResumeLayout() - isFullScreen = True - Else - SuspendLayout() - FormBorderStyle = FormBorderStyle.Sizable - ToolStripContainer1.TopToolStripPanelVisible = True - WindowState = FormWindowState.Normal - - WindowState = previousWindowState - If WindowState = FormWindowState.Normal Then - Location = previousWindowPosition.Location - Size = previousWindowPosition.Size - End If - - ResumeLayout() - isFullScreen = False - End If - End Sub - - Private Sub Form1_KeyDown(sender As Object, e As KeyEventArgs) Handles MyBase.KeyDown - Select Case e.KeyCode - Case Keys.F11 - setFullScreen(Not isFullScreen) - End Select - End Sub - - Private Sub Form1_KeyUp(sender As Object, e As KeyEventArgs) Handles MyBase.KeyUp - RefreshPanelAll() - POStatusRefresh() - End Sub - - Friend Sub ReadFile(xPath As String) - Select Case LCase(Path.GetExtension(xPath)) - Case ".bms", ".bme", ".bml", ".pms", ".txt" - OpenBMS(My.Computer.FileSystem.ReadAllText(xPath, TextEncoding)) - ClearUndo() - NewRecent(xPath) - SetFileName(xPath) - SetIsSaved(True) - - Case ".sm" - If OpenSM(My.Computer.FileSystem.ReadAllText(xPath, TextEncoding)) Then Return - InitPath = ExcludeFileName(xPath) - ClearUndo() - SetFileName("Untitled.bms") - SetIsSaved(False) - - Case ".ibmsc" - OpeniBMSC(xPath) - InitPath = ExcludeFileName(xPath) - NewRecent(xPath) - SetFileName("Imported_" & GetFileName(xPath)) - SetIsSaved(False) - - Case ".bmson" - Dim unused = MsgBox(Strings.fImportBMSON.Message) - End Select - End Sub - - - Public Function GCD(NumA As Double, NumB As Double) As Double - Dim xNMax As Double = NumA - Dim xNMin As Double = NumB - If NumA < NumB Then - xNMax = NumB - xNMin = NumA - End If - Do While xNMin >= BMSGridLimit - GCD = xNMax - (Math.Floor(xNMax / xNMin) * xNMin) - xNMax = xNMin - xNMin = GCD - Loop - GCD = xNMax - End Function - Public Shared Function GCD(NumA As Double, NumB As Double, res As Integer) As Double - Dim xNMax As Double = NumA - Dim xNMin As Double = NumB - Dim minLimit = 192.0R / res - If NumA < NumB Then - xNMax = NumB - xNMin = NumA - End If - Do While xNMin >= minLimit - GCD = xNMax - (Math.Floor(xNMax / xNMin) * xNMin) - xNMax = xNMin - xNMin = GCD - Loop - GCD = xNMax - End Function - - Private Shared Function LoadCursorFromFile(fileName As String) As IntPtr - End Function - Public Shared Function ActuallyLoadCursor(path As String) As Cursor - Return New Cursor(LoadCursorFromFile(path)) - End Function - - Private Sub Unload() - Audio.Finalize() - End Sub - - Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load - 'On Error Resume Next - TopMost = True - SuspendLayout() - Visible = False - - 'POBMP.Dispose() - 'POBGA.Dispose() - - 'Me.MaximizedBounds = Screen.GetWorkingArea(Me) - 'Me.Visible = False - SetFileName(FileName) - 'Me.ShowCaption = False - 'SetWindowText(Me.Handle.ToInt32, FileName) - - InitializeNewBMS() - 'nBeatD.SelectedIndex = 4 - - Try - Dim xTempFileName As String = RandomFileName(".cur") - My.Computer.FileSystem.WriteAllBytes(xTempFileName, My.Resources.CursorResizeDown, False) - Dim xDownCursor As Cursor = ActuallyLoadCursor(xTempFileName) - My.Computer.FileSystem.WriteAllBytes(xTempFileName, My.Resources.CursorResizeLeft, False) - Dim xLeftCursor As Cursor = ActuallyLoadCursor(xTempFileName) - My.Computer.FileSystem.WriteAllBytes(xTempFileName, My.Resources.CursorResizeRight, False) - Dim xRightCursor As Cursor = ActuallyLoadCursor(xTempFileName) - File.Delete(xTempFileName) - - POWAVResizer.Cursor = xDownCursor - POBMPResizer.Cursor = xDownCursor - POBeatResizer.Cursor = xDownCursor - POExpansionResizer.Cursor = xDownCursor - - POptionsResizer.Cursor = xLeftCursor - - SpL.Cursor = xRightCursor - SpR.Cursor = xLeftCursor - Catch ex As Exception - - End Try - - spMain = New Panel() {PMainInL, PMainIn, PMainInR} - - Dim xI1 As Integer - - sUndo(0) = New UndoRedo.NoOperation - sUndo(1) = New UndoRedo.NoOperation - sRedo(0) = New UndoRedo.NoOperation - sRedo(1) = New UndoRedo.NoOperation - sI = 0 - - LWAV.Items.Clear() - LBMP.Items.Clear() - For xI1 = 1 To 1295 - Dim unused2 = LWAV.Items.Add(C10to36(xI1) & ":") - Dim unused1 = LBMP.Items.Add(C10to36(xI1) & ":") - Next - LWAV.SelectedIndex = 0 - LBMP.SelectedIndex = 0 - CHPlayer.SelectedIndex = 0 - - CalculateGreatestVPosition() - TBLangRefresh_Click(TBLangRefresh, Nothing) - TBThemeRefresh_Click(TBThemeRefresh, Nothing) - - POHeaderPart2.Visible = False - POGridPart2.Visible = False - POWaveFormPart2.Visible = False - - If My.Computer.FileSystem.FileExists(My.Application.Info.DirectoryPath & "\iBMSC.Settings.xml") Then - LoadSettings(My.Application.Info.DirectoryPath & "\iBMSC.Settings.xml") - 'Else - '---- Settings for first-time start-up --------------------------------------------------------------------------- - 'Me.LoadLocale(My.Application.Info.DirectoryPath & "\Data\chs.Lang.xml") - '----------------------------------------------------------------------------------------------------------------- - End If - 'On Error GoTo 0 - SetIsSaved(True) - - Dim xStr() As String = Environment.GetCommandLineArgs - 'Dim xStr() As String = {Application.ExecutablePath, "C:\Users\User\Desktop\yang run xuan\SoFtwArES\Games\O2Mania\music\SHOOT!\shoot! -NM-.bms"} - - If xStr.Length = 2 Then - ReadFile(xStr(1)) - If LCase(Path.GetExtension(xStr(1))) = ".ibmsc" AndAlso GetFileName(xStr(1)).StartsWith("AutoSave_", True, Nothing) Then GoTo 1000 - End If - - 'pIsSaved.Visible = Not IsSaved - IsInitializing = False - - If Process.GetProcessesByName(Process.GetCurrentProcess.ProcessName).Length > 1 Then GoTo 1000 - Dim xFiles() As FileInfo = My.Computer.FileSystem.GetDirectoryInfo(My.Application.Info.DirectoryPath).GetFiles("AutoSave_*.IBMSC") - If xFiles Is Nothing OrElse xFiles.Length = 0 Then GoTo 1000 - - 'Me.TopMost = True - If MsgBox(Replace(Strings.Messages.RestoreAutosavedFile, "{}", xFiles.Length), MsgBoxStyle.YesNo Or MsgBoxStyle.MsgBoxSetForeground) = MsgBoxResult.Yes Then - For Each xF As FileInfo In xFiles - 'MsgBox(xF.FullName) - Dim unused = Process.Start(Application.ExecutablePath, """" & xF.FullName & """") - Next - End If - - For Each xF As FileInfo In xFiles - ReDim Preserve pTempFileNames(UBound(pTempFileNames) + 1) - pTempFileNames(UBound(pTempFileNames)) = xF.FullName - Next + 'Public Structure MARGINS + ' Public Left As Integer + ' Public Right As Integer + ' Public Top As Integer + ' Public Bottom As Integer + 'End Structure + + ' _ + 'Public Shared Function DwmIsCompositionEnabled(ByRef en As Integer) As Integer + 'End Function + ' _ + 'Public Shared Function DwmExtendFrameIntoClientArea( hwnd As IntPtr, ByRef margin As MARGINS) As Integer + 'End Function + Public Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (hwnd As IntPtr, wMsg As Integer, wParam As Integer, lParam As Integer) As Integer + Public Declare Function ReleaseCapture Lib "user32.dll" Alias "ReleaseCapture" () As Integer + + 'Private Declare Auto Function GetWindowLong Lib "user32" ( hWnd As IntPtr, nIndex As Integer) As Integer + 'Private Declare Auto Function SetWindowLong Lib "user32" ( hWnd As IntPtr, nIndex As Integer, dwNewLong As Integer) As Integer + 'Private Declare Function SetWindowPos Lib "user32.dll" ( hWnd As IntPtr, hWndInsertAfter As IntPtr, x As Integer, y As Integer, cx As Integer, cy As Integer, wFlags As Integer) As Integer + ' _ + 'Private Shared Function SetWindowText( hwnd As IntPtr, lpString As String) As Boolean + 'End Function + + 'Private Const GWL_STYLE As Integer = -16 + 'Private Const WS_CAPTION As Integer = &HC00000 + 'Private Const SWP_NOSIZE As Integer = &H1 + 'Private Const SWP_NOMOVE As Integer = &H2 + 'Private Const SWP_NOZORDER As Integer = &H4 + 'Private Const SWP_NOACTIVATE As Integer = &H10 + 'Private Const SWP_FRAMECHANGED As Integer = &H20 + 'Private Const SWP_REFRESH As Integer = SWP_NOZORDER Or SWP_NOSIZE Or SWP_NOMOVE Or SWP_NOACTIVATE Or SWP_FRAMECHANGED + + + Private MeasureLength(999) As Double + Private MeasureBottom(999) As Double + + Public Function MeasureUpper(idx As Integer) As Double + Return MeasureBottom(idx) + MeasureLength(idx) + End Function + + Private Notes() As Note = {New Note(niBPM, -1, 1200000, 0, False)} + Private mColumn(999) As Integer '0 = no column, 1 = 1 column, etc. + Private GreatestVPosition As Double '+ 2000 = -VS.Minimum + + Private VSValue As Integer = 0 'Store value before ValueChange event + Private HSValue As Integer = 0 'Store value before ValueChange event + + 'Dim SortingMethod As Integer = 1 + Private MiddleButtonMoveMethod As Integer = 0 + Private TextEncoding As System.Text.Encoding = System.Text.Encoding.UTF8 + Private DispLang As String = String.Empty 'Display Language + Private Recent() As String = {String.Empty, String.Empty, String.Empty, String.Empty, String.Empty} + Private NTInput As Boolean = True + Private ShowFileName As Boolean = False + + Private BeepWhileSaved As Boolean = True + Private BPMx1296 As Boolean = False + Private STOPx1296 As Boolean = False + + Private IsInitializing As Boolean = True + Private FirstMouseEnter As Boolean = True + + Private WAVMultiSelect As Boolean = True + Private WAVChangeLabel As Boolean = True + Private WAVEmptyfill As Boolean = True + Private BeatChangeMode As Integer = 0 + + 'Dim FloatTolerance As Double = 0.0001R + Private BMSGridLimit As Double = 1.0R + + Private LnObj As Integer = 0 '0 for none, 1-1295 for 01-ZZ + + 'IO + Private FileName As String = "Untitled.bms" + 'Dim TitlePath As New Drawing2D.GraphicsPath + Private InitPath As String = String.Empty + Private IsSaved As Boolean = True + Public Structure Chartinfo + Public Shared Fultitle As String + Public Shared Allartist As String + End Structure + 'Variables for Drag/Drop + Private DDFileName() As String = Array.Empty(Of String)() + Private SupportedFileExtension() As String = {".bms", ".bme", ".bml", ".pms", ".txt", ".sm", ".ibmsc"} + Private SupportedAudioExtension() As String = {".wav", ".mp3", ".ogg", ".flac"} + Private SupportedImageExtension() As String = {".bmp", ".png", ".jpg", ".jpeg", ".gif", ".mpg", ".mpeg", ".avi", ".m1v", ".m2v", ".m4v", ".mp4", ".webm", ".wmv"} + + 'Variables for theme + 'Dim SaveTheme As Boolean = True + + 'Variables for undo/redo + Private sUndo(99) As UndoRedo.LinkedURCmd + Private sRedo(99) As UndoRedo.LinkedURCmd + Private sI As Integer = 0 + + 'Variables for select tool + Private DisableVerticalMove As Boolean = False + Private KMouseOver As Integer = -1 'Mouse is on which note (for drawing green outline) + Private LastMouseDownLocation As PointF = New Point(-1, -1) 'Mouse is clicked on which point (location for display) (for selection box) + Private pMouseMove As PointF = New Point(-1, -1) 'Mouse is moved to which point (location for display) (for selection box) + 'Dim KMouseDown As Integer = -1 'Mouse is clicked on which note (for moving) + Private deltaVPosition As Double = 0 'difference between mouse and VPosition of K + Private bAdjustLength As Boolean 'If adjusting note length instead of moving it + Private bAdjustUpper As Boolean 'true = Adjusting upper end, false = adjusting lower end + Private bAdjustSingle As Boolean 'true if there is only one note to be adjusted + Private tempY As Integer + Private tempV As Integer + Private tempX As Integer + Private tempH As Integer + Private MiddleButtonLocation As New Point(0, 0) + Private MiddleButtonClicked As Boolean = False + Private MouseMoveStatus As New Point(0, 0) 'mouse is moved to which point (For Status Panel) + 'Dim uCol As Integer 'temp variables for undo, original enabled columnindex + 'Dim uVPos As Double 'temp variables for undo, original vposition + 'Dim uPairWithI As Double 'temp variables for undo, original note length + Private uAdded As Boolean 'temp variables for undo, if undo command is added + 'Dim uNote As Note 'temp variables for undo, original note + Private SelectedNotes(-1) As Note 'temp notes for undo + Private ctrlPressed As Boolean = False 'Indicates if the CTRL key is pressed while mousedown + Private DuplicatedSelectedNotes As Boolean = False 'Indicates if duplicate notes of select/unselect note + + 'Variables for write tool + Private ShouldDrawTempNote As Boolean = False + Private SelectedColumn As Integer = -1 + Private TempVPosition As Double = -1.0# + Private TempLength As Double = 0.0# + + 'Variables for post effects tool + Private vSelStart As Double = 192.0# + Private vSelLength As Double = 0.0# + Private vSelHalf As Double = 0.0# + Private vSelMouseOverLine As Integer = 0 '0 = nothing, 1 = start, 2 = half, 3 = end + Private vSelAdjust As Boolean = False + Private vSelK() As Note = Array.Empty(Of Note)() + Private vSelPStart As Double = 192.0# + Private vSelPLength As Double = 0.0# + Private vSelPHalf As Double = 0.0# + + 'Variables for Full-Screen Mode + Private isFullScreen As Boolean = False + Private previousWindowState As FormWindowState = FormWindowState.Normal + Private previousWindowPosition As New Rectangle(0, 0, 0, 0) + + 'Variables misc + Private menuVPosition As Double = 0.0# + Private tempResize As Integer = 0 + + '----AutoSave Options + Private PreviousAutoSavedFileName As String = String.Empty + Private AutoSaveInterval As Integer = 120000 + + '----ErrorCheck Options + Private ErrorCheck As Boolean = True + + '----Header Options + Private hWAV(1295) As String + Private hBMP(1295) As String + Private hBPM(1295) As Long 'x10000 + Private hSTOP(1295) As Long + Private hBMSCROLL(1295) As Long + + '----Grid Options + Private gSnap As Boolean = True + Private gShowGrid As Boolean = True 'Grid + Private gShowSubGrid As Boolean = True 'Sub + Private gShowBG As Boolean = True 'BG Color + Private gShowMeasureNumber As Boolean = True 'Measure Label + Private gShowVerticalLine As Boolean = True 'Vertical + Private gShowMeasureBar As Boolean = True 'Measure Barline + Private gShowC As Boolean = True 'Column Caption + Private gDivide As Integer = 16 + Private gSub As Integer = 4 + Private gSlash As Integer = 192 + Private gxHeight As Single = 1.0! + Private gxWidth As Single = 1.0! + Private gWheel As Integer = 96 + Private gPgUpDn As Integer = 384 + + Private gDisplayBGAColumn As Boolean = True + Private gSCROLL As Boolean = True + Private gSTOP As Boolean = True + Private gBPM As Boolean = True + 'Dim gA8 As Boolean = False + Private iPlayer As Integer = 0 + Private gColumns As Integer = 82 + + '----Visual Options + Private vo As New visualSettings() + + Public Sub setVO(xvo As visualSettings) + vo = xvo + End Sub + + '----Preview Options + Public Structure PlayerArguments + Public Path As String + Public aBegin As String + Public aHere As String + Public aStop As String + Public Sub New(xPath As String, xBegin As String, xHere As String, xStop As String) + Path = xPath + aBegin = xBegin + aHere = xHere + aStop = xStop + End Sub + End Structure + + Public pArgs() As PlayerArguments = {New PlayerArguments("\uBMplay.exe", + "-P -N0 """"", + "-P -N """"", + "-S"), + New PlayerArguments("\o2play.exe", + "-P -N0 """"", + "-P -N """"", + "-S"), + New PlayerArguments("java.exe -jar \beatoraja.jar", + "-a -s""""", + "none1", + "none1" + )} + + Public CurrentPlayer As Integer = 0 + Private PreviewOnClick As Boolean = True + Private PreviewErrorCheck As Boolean = False + Private Rscratch As Boolean = False + Private ClickStopPreview As Boolean = True + Private pTempFileNames() As String = Array.Empty(Of String)() + + '----Split Panel Options + Private PanelWidth() As Single = {0, 100, 0} + Private PanelhBMSCROLL() As Integer = {0, 0, 0} + Private PanelVScroll() As Integer = {0, 0, 0} + Private spLock() As Boolean = {False, False, False} + Private spDiff() As Integer = {0, 0, 0} + Private PanelFocus As Integer = 1 '0 = Left, 1 = Middle, 2 = Right + Private spMouseOver As Integer = 1 + + Private AutoFocusMouseEnter As Boolean = False + Private FirstClickDisabled As Boolean = True + Private tempFirstMouseDown As Boolean = False + + Private spMain() As Panel = Array.Empty(Of Panel)() + + '----Find Delete Replace Options + Private fdriMesL As Integer + Private fdriMesU As Integer + Private fdriLblL As Integer + Private fdriLblU As Integer + Private fdriValL As Integer + Private fdriValU As Integer + Private fdriCol() As Integer + + + Public Sub New() + InitializeComponent() + Initialize() + End Sub + + ''' + ''' + ''' + ''' Original horizontal position. + ''' HS.Value + + + Private Function HorizontalPositiontoDisplay(xHPosition As Integer, xHSVal As Long) As Integer + Return (xHPosition * gxWidth) - (xHSVal * gxWidth) + End Function + + ''' + ''' + ''' + ''' Original vertical position. + ''' VS.Value + ''' Height of the panel. (DisplayRectangle, but not ClipRectangle) + + + Private Function NoteRowToPanelHeight(xVPosition As Double, xVSVal As Long, xTHeight As Integer) As Integer + Return xTHeight - CInt((xVPosition + xVSVal) * gxHeight) - 1 + End Function + + Public Function MeasureAtDisplacement(xVPos As Double) As Integer + 'Return Math.Floor((xVPos + FloatTolerance) / 192) + 'Return Math.Floor(xVPos / 192) + Dim xI1 As Integer + For xI1 = 1 To 999 + If xVPos < MeasureBottom(xI1) Then Exit For + Next + Return xI1 - 1 + End Function + + Private Function GetMaxVPosition() As Double + Return MeasureUpper(999) + End Function + + Private Function SnapToGrid(xVPos As Double) As Double + Dim xOffset As Double = MeasureBottom(MeasureAtDisplacement(xVPos)) + Dim xRatio As Double = 192.0R / gDivide + Return (Math.Floor((xVPos - xOffset) / xRatio) * xRatio) + xOffset + End Function + + Private Sub CalculateGreatestVPosition() + 'If K Is Nothing Then Exit Sub + Dim xI1 As Integer + GreatestVPosition = 0 + + If NTInput Then + For xI1 = UBound(Notes) To 0 Step -1 + If Notes(xI1).VPosition + Notes(xI1).Length > GreatestVPosition Then GreatestVPosition = Notes(xI1).VPosition + Notes(xI1).Length + Next + Else + For xI1 = UBound(Notes) To 0 Step -1 + If Notes(xI1).VPosition > GreatestVPosition Then GreatestVPosition = Notes(xI1).VPosition + Next + End If + + Dim xI2 As Integer = -CInt(IIf(GreatestVPosition + 2000 > GetMaxVPosition(), GetMaxVPosition, GreatestVPosition + 2000)) + MainPanelScroll.Minimum = xI2 + LeftPanelScroll.Minimum = xI2 + RightPanelScroll.Minimum = xI2 + End Sub + + + Private Sub SortByVPositionInsertion() 'Insertion Sort + If UBound(Notes) <= 0 Then Exit Sub + Dim xNote As Note + Dim xI1 As Integer + Dim xI2 As Integer + For xI1 = 2 To UBound(Notes) + xNote = Notes(xI1) + For xI2 = xI1 - 1 To 1 Step -1 + If Notes(xI2).VPosition > xNote.VPosition Then + Notes(xI2 + 1) = Notes(xI2) + ' If KMouseDown = xI2 Then KMouseDown += 1 + If xI2 = 1 Then + Notes(xI2) = xNote + ' If KMouseDown = xI1 Then KMouseDown = xI2 + Exit For + End If + Else + Notes(xI2 + 1) = xNote + ' If KMouseDown = xI1 Then KMouseDown = xI2 + 1 + Exit For + End If + Next + Next + + End Sub + + Private Sub SortByVPositionQuick(xMin As Integer, xMax As Integer) 'Quick Sort + Dim xNote As Note + Dim iHi As Integer + Dim iLo As Integer + Dim xI1 As Integer + + ' If min >= max, the list contains 0 or 1 items so it is sorted. + If xMin >= xMax Then Exit Sub + + ' Pick the dividing value. + xI1 = CInt((xMax - xMin) / 2) + xMin + xNote = Notes(xI1) + + ' Swap it to the front. + Notes(xI1) = Notes(xMin) + + iLo = xMin + iHi = xMax + Do + ' Look down from hi for a value < med_value. + Do While Notes(iHi).VPosition >= xNote.VPosition + iHi -= 1 + If iHi <= iLo Then Exit Do + Loop + If iHi <= iLo Then + Notes(iLo) = xNote + Exit Do + End If + + ' Swap the lo and hi values. + Notes(iLo) = Notes(iHi) + + ' Look up from lo for a value >= med_value. + iLo += 1 + Do While Notes(iLo).VPosition < xNote.VPosition + iLo += 1 + If iLo >= iHi Then Exit Do + Loop + If iLo >= iHi Then + iLo = iHi + Notes(iHi) = xNote + Exit Do + End If + + ' Swap the lo and hi values. + Notes(iHi) = Notes(iLo) + Loop + + ' Sort the two sublists. + SortByVPositionQuick(xMin, iLo - 1) + SortByVPositionQuick(iLo + 1, xMax) + End Sub + + Private Sub SortByVPositionQuick3(xMin As Integer, xMax As Integer) + Dim xxMin As Integer + Dim xxMax As Integer + Dim xxMid As Integer + Dim xNote As Note + Dim xNoteMid As Note + Dim xI1 As Integer + Dim xI2 As Integer + Dim xI3 As Integer + + 'If xMax = 0 Then + ' xMin = LBound(K1) + ' xMax = UBound(K1) + 'End If + xxMin = xMin + xxMax = xMax + xxMid = xMax - xMin + 1 + xI1 = CInt(Int(xxMid * Rnd())) + xMin + xI2 = CInt(Int(xxMid * Rnd())) + xMin + xI3 = CInt(Int(xxMid * Rnd())) + xMin + xxMid = If(Notes(xI1).VPosition <= Notes(xI2).VPosition And Notes(xI2).VPosition <= Notes(xI3).VPosition, + xI2, + If(Notes(xI2).VPosition <= Notes(xI1).VPosition And Notes(xI1).VPosition <= Notes(xI3).VPosition, xI1, xI3)) + xNoteMid = Notes(xxMid) + Do + Do While Notes(xxMin).VPosition < xNoteMid.VPosition And xxMin < xMax + xxMin += 1 + Loop + Do While xNoteMid.VPosition < Notes(xxMax).VPosition And xxMax > xMin + xxMax -= 1 + Loop + If xxMin <= xxMax Then + xNote = Notes(xxMin) + Notes(xxMin) = Notes(xxMax) + Notes(xxMax) = xNote + xxMin += 1 + xxMax -= 1 + End If + Loop Until xxMin > xxMax + If xxMax - xMin < xMax - xxMin Then + If xMin < xxMax Then SortByVPositionQuick3(xMin, xxMax) + If xxMin < xMax Then SortByVPositionQuick3(xxMin, xMax) + Else + If xxMin < xMax Then SortByVPositionQuick3(xxMin, xMax) + If xMin < xxMax Then SortByVPositionQuick3(xMin, xxMax) + End If + End Sub + + + Private Sub UpdateMeasureBottom() + MeasureBottom(0) = 0.0# + For xI1 As Integer = 0 To 998 + MeasureBottom(xI1 + 1) = MeasureBottom(xI1) + MeasureLength(xI1) + Next + End Sub + + Private Function PathIsValid(sPath As String) As Boolean + Return File.Exists(sPath) Or Directory.Exists(sPath) + End Function + + Public Function PrevCodeToReal(InitStr As String) As String + Dim xFileName As String = IIf(Not PathIsValid(FileName), + IIf(InitPath = String.Empty, My.Application.Info.DirectoryPath, InitPath), + ExcludeFileName(FileName)) _ + & "\___TempBMS.bms" + Dim xMeasure As Integer = MeasureAtDisplacement(Math.Abs(PanelVScroll(PanelFocus))) + Dim xS1 As String = Replace(InitStr, "", My.Application.Info.DirectoryPath) + Dim xS2 As String = Replace(xS1, "", xMeasure) + Dim xS3 As String = Replace(xS2, "", xFileName) + Return xS3 + End Function + + Private Sub SetFileName(xFileName As String) + FileName = xFileName.Trim + InitPath = ExcludeFileName(FileName) + SetIsSaved(IsSaved) + End Sub + + Private Sub SetIsSaved(isSaved As Boolean) + 'pttl.Refresh() + 'pIsSaved.Visible = Not xBool + Dim xVersion As String = My.Application.Info.Version.Major & "." & My.Application.Info.Version.Minor & + IIf(My.Application.Info.Version.Build = 0, String.Empty, "." & My.Application.Info.Version.Build) + Text = IIf(isSaved, String.Empty, "*") & GetFileName(FileName) & " - " & My.Application.Info.Title & " " & xVersion + Me.IsSaved = isSaved + End Sub + + Private Sub PreviewNote(xFileLocation As String, bStop As Boolean) + If bStop Then + StopPlaying() + End If + Play(xFileLocation) + End Sub + + Private Sub AddNote(note As Note, + Optional xSelected As Boolean = False, + Optional OverWrite As Boolean = True, + Optional SortAndUpdatePairing As Boolean = True) + + If note.VPosition < 0 Or note.VPosition >= GetMaxVPosition() Then Exit Sub + + Dim xI1 As Integer = 1 + + If OverWrite Then + Do While xI1 <= UBound(Notes) + If Notes(xI1).VPosition = note.VPosition And + Notes(xI1).ColumnIndex = note.ColumnIndex Then + RemoveNote(xI1) + Else + xI1 += 1 + End If + Loop + End If + + ReDim Preserve Notes(UBound(Notes) + 1) + note.Selected = note.Selected And nEnabled(note.ColumnIndex) + Notes(UBound(Notes)) = note + + If TBWavIncrease.Checked Then + If IsColumnSound(note.ColumnIndex) Then + IncreaseCurrentWav() + End If + If IsColumnImage(note.ColumnIndex) Then + IncreaseCurrentBmp() + End If + End If + + If SortAndUpdatePairing Then SortByVPositionInsertion() : UpdatePairing() + CalculateTotalPlayableNotes() + End Sub + + Private Sub RemoveNote(I As Integer, Optional SortAndUpdatePairing As Boolean = True) + KMouseOver = -1 + Dim xI2 As Integer + + If TBWavIncrease.Checked Then + If IsColumnSound(Notes(I).ColumnIndex) Then + If Notes(I).Value = LWAV.SelectedIndex * 10000 Then + DecreaseCurrentWav() + End If + Else + If Notes(I).Value = LBMP.SelectedIndex * 10000 Then + DecreaseCurrentBmp() + End If + End If + End If + + For xI2 = I + 1 To UBound(Notes) + Notes(xI2 - 1) = Notes(xI2) + Next + ReDim Preserve Notes(UBound(Notes) - 1) + If SortAndUpdatePairing Then SortByVPositionInsertion() : UpdatePairing() + + End Sub + + Private Sub AddNotesFromClipboard(Optional xSelected As Boolean = True, Optional SortAndUpdatePairing As Boolean = True) + Dim xStrLine() As String = Split(Clipboard.GetText, vbCrLf) + + Dim xI1 As Integer + For xI1 = 0 To UBound(Notes) + Notes(xI1).Selected = False + Next + + Dim xVS As Long = PanelVScroll(PanelFocus) + Dim xTempVP As Double + Dim xKbu() As Note = Notes + + If xStrLine(0) = "iBMSC Clipboard Data" Then + If NTInput Then ReDim Preserve Notes(0) + + 'paste + Dim xStrSub() As String + For xI1 = 1 To UBound(xStrLine) + If xStrLine(xI1).Trim = String.Empty Then Continue For + xStrSub = Split(xStrLine(xI1), " ") + xTempVP = Val(xStrSub(1)) + MeasureBottom(MeasureAtDisplacement(-xVS) + 1) + If UBound(xStrSub) = 5 And xTempVP >= 0 And xTempVP < GetMaxVPosition() Then + ReDim Preserve Notes(UBound(Notes) + 1) + With Notes(UBound(Notes)) + .ColumnIndex = Val(xStrSub(0)) + .VPosition = xTempVP + .Value = Val(xStrSub(2)) + .LongNote = CBool(Val(xStrSub(3))) + .Hidden = CBool(Val(xStrSub(4))) + .Landmine = CBool(Val(xStrSub(5))) + .Selected = xSelected + End With + End If + Next + + 'convert + If NTInput Then + ConvertBMSE2NT() + + For xI1 = 1 To UBound(Notes) + Notes(xI1 - 1) = Notes(xI1) + Next + ReDim Preserve Notes(UBound(Notes) - 1) + + Dim xKn() As Note = Notes + Notes = xKbu + + Dim xIStart As Integer = Notes.Length + ReDim Preserve Notes(UBound(Notes) + xKn.Length) + + For xI1 = xIStart To UBound(Notes) + Notes(xI1) = xKn(xI1 - xIStart) + Next + End If + + ElseIf xStrLine(0) = "iBMSC Clipboard Data xNT" Then + If Not NTInput Then ReDim Preserve Notes(0) + + 'paste + Dim xStrSub() As String + For xI1 = 1 To UBound(xStrLine) + If xStrLine(xI1).Trim = String.Empty Then Continue For + xStrSub = Split(xStrLine(xI1), " ") + xTempVP = Val(xStrSub(1)) + MeasureBottom(MeasureAtDisplacement(-xVS) + 1) + If UBound(xStrSub) = 5 And xTempVP >= 0 And xTempVP < GetMaxVPosition() Then + ReDim Preserve Notes(UBound(Notes) + 1) + With Notes(UBound(Notes)) + .ColumnIndex = Val(xStrSub(0)) + .VPosition = xTempVP + .Value = Val(xStrSub(2)) + .Length = Val(xStrSub(3)) + .Hidden = CBool(Val(xStrSub(4))) + .Landmine = CBool(Val(xStrSub(5))) + .Selected = xSelected + End With + End If + Next + + 'convert + If Not NTInput Then + ConvertNT2BMSE() + + For xI1 = 1 To UBound(Notes) + Notes(xI1 - 1) = Notes(xI1) + Next + ReDim Preserve Notes(UBound(Notes) - 1) + + Dim xKn() As Note = Notes + Notes = xKbu + + Dim xIStart As Integer = Notes.Length + ReDim Preserve Notes(UBound(Notes) + xKn.Length) + + For xI1 = xIStart To UBound(Notes) + Notes(xI1) = xKn(xI1 - xIStart) + Next + End If + + ElseIf xStrLine(0) = "BMSE ClipBoard Object Data Format" Then + If NTInput Then ReDim Preserve Notes(0) + + 'paste + For xI1 = 1 To UBound(xStrLine) + ' zdr: holy crap this is obtuse + Dim posStr = Mid(xStrLine(xI1), 5, 7) + Dim vPos = Val(posStr) + MeasureBottom(MeasureAtDisplacement(-xVS) + 1) + + Dim bmsIdent = Mid(xStrLine(xI1), 1, 3) + Dim lineCol = BMSEChannelToColumnIndex(bmsIdent) + + Dim Value = Val(Mid(xStrLine(xI1), 12)) * 10000 + + Dim attribute = Mid(xStrLine(xI1), 4, 1) + + Dim validCol = Len(xStrLine(xI1)) > 11 And lineCol > 0 + Dim inRange = vPos >= 0 And vPos < GetMaxVPosition() + If validCol And inRange Then + ReDim Preserve Notes(UBound(Notes) + 1) + + With Notes(UBound(Notes)) + .ColumnIndex = lineCol + .VPosition = vPos + .Value = Value + .LongNote = attribute = "2" + .Hidden = attribute = "1" + .Selected = xSelected And nEnabled(.ColumnIndex) + End With + End If + Next + + 'convert + If NTInput Then + ConvertBMSE2NT() + + For xI1 = 1 To UBound(Notes) + Notes(xI1 - 1) = Notes(xI1) + Next + ReDim Preserve Notes(UBound(Notes) - 1) + + Dim xKn() As Note = Notes + Notes = xKbu + + Dim xIStart As Integer = Notes.Length + ReDim Preserve Notes(UBound(Notes) + xKn.Length) + + For xI1 = xIStart To UBound(Notes) + Notes(xI1) = xKn(xI1 - xIStart) + Next + End If + End If + + If SortAndUpdatePairing Then SortByVPositionInsertion() : UpdatePairing() + CalculateTotalPlayableNotes() + End Sub + + Private Sub CopyNotes(Optional Unselect As Boolean = True) + Dim xStrAll As String = "iBMSC Clipboard Data" & IIf(NTInput, " xNT", String.Empty) + Dim xI1 As Integer + Dim MinMeasure As Double = 999 + + For xI1 = 1 To UBound(Notes) + If Notes(xI1).Selected And MeasureAtDisplacement(Notes(xI1).VPosition) < MinMeasure Then MinMeasure = MeasureAtDisplacement(Notes(xI1).VPosition) + Next + MinMeasure = MeasureBottom(MinMeasure) + + If Not NTInput Then + For xI1 = 1 To UBound(Notes) + If Notes(xI1).Selected Then + xStrAll &= vbCrLf & Notes(xI1).ColumnIndex.ToString & " " & + (Notes(xI1).VPosition - MinMeasure).ToString & " " & + Notes(xI1).Value.ToString & " " & + CInt(Notes(xI1).LongNote).ToString & " " & + CInt(Notes(xI1).Hidden).ToString & " " & + CInt(Notes(xI1).Landmine).ToString + Notes(xI1).Selected = Not Unselect + End If + Next + + Else + For xI1 = 1 To UBound(Notes) + If Notes(xI1).Selected Then + xStrAll &= vbCrLf & Notes(xI1).ColumnIndex.ToString & " " & + (Notes(xI1).VPosition - MinMeasure).ToString & " " & + Notes(xI1).Value.ToString & " " & + Notes(xI1).Length.ToString & " " & + CInt(Notes(xI1).Hidden).ToString & " " & + CInt(Notes(xI1).Landmine).ToString + Notes(xI1).Selected = Not Unselect + End If + Next + End If + + Clipboard.SetText(xStrAll) + End Sub + + Private Sub RemoveNotes(Optional SortAndUpdatePairing As Boolean = True) + If UBound(Notes) = 0 Then Exit Sub + + KMouseOver = -1 + Dim xI1 As Integer = 1 + Dim xI2 As Integer + Do + If Notes(xI1).Selected Then + For xI2 = xI1 + 1 To UBound(Notes) + Notes(xI2 - 1) = Notes(xI2) + Next + ReDim Preserve Notes(UBound(Notes) - 1) + xI1 = 0 + End If + xI1 += 1 + Loop While xI1 < UBound(Notes) + 1 + If SortAndUpdatePairing Then SortByVPositionInsertion() : UpdatePairing() + CalculateTotalPlayableNotes() + End Sub + + Private Function EnabledColumnIndexToColumnArrayIndex(cEnabled As Integer) As Integer + Dim xI1 As Integer = 0 + Do + If xI1 >= gColumns Then Exit Do + If Not nEnabled(xI1) Then cEnabled += 1 + If xI1 >= cEnabled Then Exit Do + xI1 += 1 + Loop + Return cEnabled + End Function + + Private Function ColumnArrayIndexToEnabledColumnIndex(cReal As Integer) As Integer + Dim xI1 As Integer + For xI1 = 0 To cReal - 1 + If Not nEnabled(xI1) Then cReal -= 1 + Next + Return cReal + End Function + + Private Sub Form1_FormClosed(sender As Object, e As FormClosedEventArgs) Handles MyBase.FormClosed + If pTempFileNames IsNot Nothing Then + For Each xStr In pTempFileNames + File.Delete(xStr) + Next + End If + If PreviousAutoSavedFileName <> String.Empty Then File.Delete(PreviousAutoSavedFileName) + End Sub + + Private Sub Form1_FormClosing(sender As Object, e As FormClosingEventArgs) Handles MyBase.FormClosing + If Not IsSaved Then + Dim xStr = Strings.Messages.SaveOnExit + If e.CloseReason = CloseReason.WindowsShutDown Then xStr = Strings.Messages.SaveOnExit1 + If e.CloseReason = CloseReason.TaskManagerClosing Then xStr = Strings.Messages.SaveOnExit2 + + Dim xResult = MsgBox(xStr, MsgBoxStyle.YesNoCancel Or MsgBoxStyle.Question, Text) + + If xResult = MsgBoxResult.Yes Then + If ExcludeFileName(FileName) = String.Empty Then + Dim xDSave As New SaveFileDialog With { + .Filter = Strings.FileType._bms & "|*.bms;*.bme;*.bml;*.pms;*.txt|" & + Strings.FileType.BMS & "|*.bms|" & + Strings.FileType.BME & "|*.bme|" & + Strings.FileType.BML & "|*.bml|" & + Strings.FileType.PMS & "|*.pms|" & + Strings.FileType.TXT & "|*.txt|" & + Strings.FileType._all & "|*.*", + .DefaultExt = "bms", + .InitialDirectory = InitPath + } + + If xDSave.ShowDialog = Forms.DialogResult.Cancel Then e.Cancel = True : Exit Sub + SetFileName(xDSave.FileName) + End If + Dim xStrAll = SaveBMS() + My.Computer.FileSystem.WriteAllText(FileName, xStrAll, False, TextEncoding) + NewRecent(FileName) + If BeepWhileSaved Then Beep() + End If + + If xResult = MsgBoxResult.Cancel Then e.Cancel = True + End If + + If Not e.Cancel Then + 'If SaveTheme Then + ' My.Computer.FileSystem.WriteAllText(My.Application.Info.DirectoryPath & "\Skin.cff", SaveSkinCFF, False, System.Text.Encoding.Unicode) + 'Else + ' My.Computer.FileSystem.WriteAllText(My.Application.Info.DirectoryPath & "\Skin.cff", "", False, System.Text.Encoding.Unicode) + 'End If + ' + 'My.Computer.FileSystem.WriteAllText(My.Application.Info.DirectoryPath & "\PlayerArgs.cff", SavePlayerCFF, False, System.Text.Encoding.Unicode) + 'My.Computer.FileSystem.WriteAllText(My.Application.Info.DirectoryPath & "\Config.cff", SaveCFF, False, System.Text.Encoding.Unicode) + 'My.Computer.FileSystem.WriteAllText(My.Application.Info.DirectoryPath & "\PreConfig.cff", "", False, System.Text.Encoding.Unicode) + SaveSettings(My.Application.Info.DirectoryPath & "\iBMSC.Settings.xml", False) + End If + End Sub + + Private Function FilterFileBySupported(xFile() As String, xFilter() As String) As String() + Dim xPath(-1) As String + For xI1 As Integer = 0 To UBound(xFile) + If My.Computer.FileSystem.FileExists(xFile(xI1)) And Array.IndexOf(xFilter, Path.GetExtension(xFile(xI1))) <> -1 Then + ReDim Preserve xPath(UBound(xPath) + 1) + xPath(UBound(xPath)) = xFile(xI1) + End If + + If My.Computer.FileSystem.DirectoryExists(xFile(xI1)) Then + Dim xFileNames() As FileInfo = My.Computer.FileSystem.GetDirectoryInfo(xFile(xI1)).GetFiles() + For Each xStr As FileInfo In xFileNames + If Array.IndexOf(xFilter, xStr.Extension) = -1 Then Continue For + ReDim Preserve xPath(UBound(xPath) + 1) + xPath(UBound(xPath)) = xStr.FullName + Next + End If + Next + + Return xPath + End Function + + Private Sub InitializeNewBMS() + 'ReDim K(0) + 'With K(0) + ' .ColumnIndex = niBPM + ' .VPosition = -1 + ' .LongNote = False + ' .Selected = False + ' .Value = 1200000 + 'End With + + THTitle.Text = String.Empty + THArtist.Text = String.Empty + THGenre.Text = String.Empty + THBPM.Value = 120 + If CHPlayer.SelectedIndex = -1 Then CHPlayer.SelectedIndex = 0 + CHRank.SelectedIndex = 2 + THPlayLevel.Text = String.Empty + THSubTitle.Text = String.Empty + THSubArtist.Text = String.Empty + THStageFile.Text = String.Empty + THBanner.Text = String.Empty + THBackBMP.Text = String.Empty + CHDifficulty.SelectedIndex = 0 + THExRank.Text = String.Empty + THTotal.Text = String.Empty + THComment.Text = String.Empty + 'THLnType.Text = "1" + CHLnObj.SelectedIndex = 0 + + THLandMine.Text = String.Empty + THMissBMP.Text = String.Empty + TExpansion.Text = String.Empty + + THPreview.Text = String.Empty + CHLnmode.SelectedIndex = 0 + + LBeat.Items.Clear() + For xI1 As Integer = 0 To 999 + MeasureLength(xI1) = 192.0R + MeasureBottom(xI1) = xI1 * 192.0R + Dim unused = LBeat.Items.Add(Add3Zeros(xI1) & ": 1 ( 4 / 4 )") + Next + End Sub + + Private Sub InitializeOpenBMS() + CHPlayer.SelectedIndex = 0 + 'THLnType.Text = "" + End Sub + + Private Sub Form1_DragEnter(sender As Object, e As DragEventArgs) Handles MyBase.DragEnter + If e.Data.GetDataPresent(DataFormats.FileDrop) Then + e.Effect = DragDropEffects.Copy + DDFileName = FilterFileBySupported(CType(e.Data.GetData(DataFormats.FileDrop), String()), SupportedFileExtension) + Else + e.Effect = DragDropEffects.None + End If + RefreshPanelAll() + End Sub + + Private Sub Form1_DragLeave(sender As Object, e As EventArgs) Handles MyBase.DragLeave + ReDim DDFileName(-1) + RefreshPanelAll() + End Sub + + Private Sub Form1_DragDrop(sender As Object, e As DragEventArgs) Handles MyBase.DragDrop + ReDim DDFileName(-1) + If Not e.Data.GetDataPresent(DataFormats.FileDrop) Then Return + + Dim xOrigPath = CType(e.Data.GetData(DataFormats.FileDrop), String()) + Dim xPath = FilterFileBySupported(xOrigPath, SupportedFileExtension) + If xPath.Length > 0 Then + Dim xProg As New fLoadFileProgress(xPath, IsSaved) + Dim unused = xProg.ShowDialog(Me) + End If + + RefreshPanelAll() + End Sub + + Private Sub setFullScreen(value As Boolean) + If value Then + If WindowState = FormWindowState.Minimized Then Exit Sub + + SuspendLayout() + previousWindowPosition.Location = Location + previousWindowPosition.Size = Size + previousWindowState = WindowState + + WindowState = FormWindowState.Normal + FormBorderStyle = FormBorderStyle.None + WindowState = FormWindowState.Maximized + ToolStripContainer1.TopToolStripPanelVisible = False + + ResumeLayout() + isFullScreen = True + Else + SuspendLayout() + FormBorderStyle = FormBorderStyle.Sizable + ToolStripContainer1.TopToolStripPanelVisible = True + WindowState = FormWindowState.Normal + + WindowState = previousWindowState + If WindowState = FormWindowState.Normal Then + Location = previousWindowPosition.Location + Size = previousWindowPosition.Size + End If + + ResumeLayout() + isFullScreen = False + End If + End Sub + + Private Sub Form1_KeyDown(sender As Object, e As KeyEventArgs) Handles MyBase.KeyDown + Select Case e.KeyCode + Case Keys.F11 + setFullScreen(Not isFullScreen) + End Select + End Sub + + Private Sub Form1_KeyUp(sender As Object, e As KeyEventArgs) Handles MyBase.KeyUp + RefreshPanelAll() + POStatusRefresh() + End Sub + + Friend Sub ReadFile(xPath As String) + Select Case LCase(Path.GetExtension(xPath)) + Case ".bms", ".bme", ".bml", ".pms", ".txt" + OpenBMS(My.Computer.FileSystem.ReadAllText(xPath, TextEncoding)) + ClearUndo() + NewRecent(xPath) + SetFileName(xPath) + SetIsSaved(True) + + Case ".sm" + If OpenSM(My.Computer.FileSystem.ReadAllText(xPath, TextEncoding)) Then Return + InitPath = ExcludeFileName(xPath) + ClearUndo() + SetFileName("Untitled.bms") + SetIsSaved(False) + + Case ".ibmsc" + OpeniBMSC(xPath) + InitPath = ExcludeFileName(xPath) + NewRecent(xPath) + SetFileName("Imported_" & GetFileName(xPath)) + SetIsSaved(False) + + Case ".bmson" + Dim unused = MsgBox(Strings.fImportBMSON.Message) + End Select + End Sub + + + Public Function GCD(NumA As Double, NumB As Double) As Double + Dim xNMax As Double = NumA + Dim xNMin As Double = NumB + If NumA < NumB Then + xNMax = NumB + xNMin = NumA + End If + Do While xNMin >= BMSGridLimit + GCD = xNMax - (Math.Floor(xNMax / xNMin) * xNMin) + xNMax = xNMin + xNMin = GCD + Loop + GCD = xNMax + End Function + Public Shared Function GCD(NumA As Double, NumB As Double, res As Integer) As Double + Dim xNMax As Double = NumA + Dim xNMin As Double = NumB + Dim minLimit = 192.0R / res + If NumA < NumB Then + xNMax = NumB + xNMin = NumA + End If + Do While xNMin >= minLimit + GCD = xNMax - (Math.Floor(xNMax / xNMin) * xNMin) + xNMax = xNMin + xNMin = GCD + Loop + GCD = xNMax + End Function + + Private Shared Function LoadCursorFromFile(fileName As String) As IntPtr + End Function + Public Shared Function ActuallyLoadCursor(path As String) As Cursor + Return New Cursor(LoadCursorFromFile(path)) + End Function + + Private Sub Unload() + Audio.Finalize() + End Sub + + Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load + 'On Error Resume Next + TopMost = True + SuspendLayout() + Visible = False + + 'POBMP.Dispose() + 'POBGA.Dispose() + + 'Me.MaximizedBounds = Screen.GetWorkingArea(Me) + 'Me.Visible = False + SetFileName(FileName) + 'Me.ShowCaption = False + 'SetWindowText(Me.Handle.ToInt32, FileName) + + InitializeNewBMS() + 'nBeatD.SelectedIndex = 4 + + Try + Dim xTempFileName As String = RandomFileName(".cur") + My.Computer.FileSystem.WriteAllBytes(xTempFileName, My.Resources.CursorResizeDown, False) + Dim xDownCursor As Cursor = ActuallyLoadCursor(xTempFileName) + My.Computer.FileSystem.WriteAllBytes(xTempFileName, My.Resources.CursorResizeLeft, False) + Dim xLeftCursor As Cursor = ActuallyLoadCursor(xTempFileName) + My.Computer.FileSystem.WriteAllBytes(xTempFileName, My.Resources.CursorResizeRight, False) + Dim xRightCursor As Cursor = ActuallyLoadCursor(xTempFileName) + File.Delete(xTempFileName) + + POWAVResizer.Cursor = xDownCursor + POBMPResizer.Cursor = xDownCursor + POBeatResizer.Cursor = xDownCursor + POExpansionResizer.Cursor = xDownCursor + + POptionsResizer.Cursor = xLeftCursor + + SpL.Cursor = xRightCursor + SpR.Cursor = xLeftCursor + Catch ex As Exception + + End Try + + spMain = New Panel() {PMainInL, PMainIn, PMainInR} + + Dim xI1 As Integer + + sUndo(0) = New UndoRedo.NoOperation + sUndo(1) = New UndoRedo.NoOperation + sRedo(0) = New UndoRedo.NoOperation + sRedo(1) = New UndoRedo.NoOperation + sI = 0 + + LWAV.Items.Clear() + LBMP.Items.Clear() + For xI1 = 1 To 1295 + Dim unused2 = LWAV.Items.Add(C10to36(xI1) & ":") + Dim unused1 = LBMP.Items.Add(C10to36(xI1) & ":") + Next + LWAV.SelectedIndex = 0 + LBMP.SelectedIndex = 0 + CHPlayer.SelectedIndex = 0 + + CalculateGreatestVPosition() + TBLangRefresh_Click(TBLangRefresh, Nothing) + TBThemeRefresh_Click(TBThemeRefresh, Nothing) + + POHeaderPart2.Visible = False + POGridPart2.Visible = False + POWaveFormPart2.Visible = False + + If My.Computer.FileSystem.FileExists(My.Application.Info.DirectoryPath & "\iBMSC.Settings.xml") Then + LoadSettings(My.Application.Info.DirectoryPath & "\iBMSC.Settings.xml") + 'Else + '---- Settings for first-time start-up --------------------------------------------------------------------------- + 'Me.LoadLocale(My.Application.Info.DirectoryPath & "\Data\chs.Lang.xml") + '----------------------------------------------------------------------------------------------------------------- + End If + 'On Error GoTo 0 + SetIsSaved(True) + + Dim xStr() As String = Environment.GetCommandLineArgs + 'Dim xStr() As String = {Application.ExecutablePath, "C:\Users\User\Desktop\yang run xuan\SoFtwArES\Games\O2Mania\music\SHOOT!\shoot! -NM-.bms"} + + If xStr.Length = 2 Then + ReadFile(xStr(1)) + If LCase(Path.GetExtension(xStr(1))) = ".ibmsc" AndAlso GetFileName(xStr(1)).StartsWith("AutoSave_", True, Nothing) Then GoTo 1000 + End If + + 'pIsSaved.Visible = Not IsSaved + IsInitializing = False + + If Process.GetProcessesByName(Process.GetCurrentProcess.ProcessName).Length > 1 Then GoTo 1000 + Dim xFiles() As FileInfo = My.Computer.FileSystem.GetDirectoryInfo(My.Application.Info.DirectoryPath).GetFiles("AutoSave_*.IBMSC") + If xFiles Is Nothing OrElse xFiles.Length = 0 Then GoTo 1000 + + 'Me.TopMost = True + If MsgBox(Replace(Strings.Messages.RestoreAutosavedFile, "{}", xFiles.Length), MsgBoxStyle.YesNo Or MsgBoxStyle.MsgBoxSetForeground) = MsgBoxResult.Yes Then + For Each xF As FileInfo In xFiles + 'MsgBox(xF.FullName) + Dim unused = Process.Start(Application.ExecutablePath, """" & xF.FullName & """") + Next + End If + + For Each xF As FileInfo In xFiles + ReDim Preserve pTempFileNames(UBound(pTempFileNames) + 1) + pTempFileNames(UBound(pTempFileNames)) = xF.FullName + Next 1000: - IsInitializing = False - POStatusRefresh() - ResumeLayout() - - tempResize = WindowState - TopMost = False - WindowState = tempResize - - Visible = True - End Sub - - Private Sub UpdatePairing() - Dim i As Integer, j As Integer - - If NTInput Then - For i = 0 To UBound(Notes) - Notes(i).HasError = False - Notes(i).LNPair = 0 - If Notes(i).Length < 0 Then Notes(i).Length = 0 - Next - - For i = 1 To UBound(Notes) - If Notes(i).Length <> 0 Then - For j = i + 1 To UBound(Notes) - If Notes(j).VPosition > Notes(i).VPosition + Notes(i).Length Then Exit For - If Notes(j).ColumnIndex = Notes(i).ColumnIndex Then Notes(j).HasError = True - Next - Else - For j = i + 1 To UBound(Notes) - If Notes(j).VPosition > Notes(i).VPosition Then Exit For - If Notes(j).ColumnIndex = Notes(i).ColumnIndex Then Notes(j).HasError = True - Next - - If Notes(i).Value \ 10000 = LnObj AndAlso Not IsColumnNumeric(Notes(i).ColumnIndex) Then - For j = i - 1 To 1 Step -1 - If Notes(j).ColumnIndex <> Notes(i).ColumnIndex Then Continue For - If Notes(j).Hidden Then Continue For - - If Notes(j).Length <> 0 OrElse Notes(j).Value \ 10000 = LnObj Then - Notes(i).HasError = True - Else - Notes(i).LNPair = j - Notes(j).LNPair = i - End If - Exit For - Next - If j = 0 Then - Notes(i).HasError = True - End If - End If - End If - Next - - Else - For i = 0 To UBound(Notes) - Notes(i).HasError = False - Notes(i).LNPair = 0 - Next - - For i = 1 To UBound(Notes) - If IsColumnSound(Notes(i).ColumnIndex) AndAlso Notes(i).ColumnIndex < niB Then - If Notes(i).LongNote Then - 'LongNote: If overlapping a note, then error. - ' Else if already matched by a LongNote below, then match it. - ' Otherwise match anything above. - ' If ShortNote above then error on above. - ' If nothing above then error. - For j = i - 1 To 1 Step -1 - If Notes(j).ColumnIndex <> Notes(i).ColumnIndex Then Continue For - If Notes(j).VPosition = Notes(i).VPosition Then - Notes(i).HasError = True - GoTo EndSearch - ElseIf Notes(j).LongNote And Notes(j).LNPair = i Then - Notes(i).LNPair = j - GoTo EndSearch - Else - Exit For - End If - Next - - For j = i + 1 To UBound(Notes) - If Notes(j).ColumnIndex <> Notes(i).ColumnIndex Then Continue For - Notes(i).LNPair = j - Notes(j).LNPair = i - If Not Notes(j).LongNote AndAlso Notes(j).Value \ 10000 <> LnObj Then - Notes(j).HasError = True - End If - Exit For - Next - - If j = UBound(Notes) + 1 Then - Notes(i).HasError = True - End If + IsInitializing = False + POStatusRefresh() + ResumeLayout() + + tempResize = WindowState + TopMost = False + WindowState = tempResize + + Visible = True + End Sub + + Private Sub UpdatePairing() + Dim i As Integer, j As Integer + + If NTInput Then + For i = 0 To UBound(Notes) + Notes(i).HasError = False + Notes(i).LNPair = 0 + If Notes(i).Length < 0 Then Notes(i).Length = 0 + Next + + For i = 1 To UBound(Notes) + If Notes(i).Length <> 0 Then + For j = i + 1 To UBound(Notes) + If Notes(j).VPosition > Notes(i).VPosition + Notes(i).Length Then Exit For + If Notes(j).ColumnIndex = Notes(i).ColumnIndex Then Notes(j).HasError = True + Next + Else + For j = i + 1 To UBound(Notes) + If Notes(j).VPosition > Notes(i).VPosition Then Exit For + If Notes(j).ColumnIndex = Notes(i).ColumnIndex Then Notes(j).HasError = True + Next + + If Notes(i).Value \ 10000 = LnObj AndAlso Not IsColumnNumeric(Notes(i).ColumnIndex) Then + For j = i - 1 To 1 Step -1 + If Notes(j).ColumnIndex <> Notes(i).ColumnIndex Then Continue For + If Notes(j).Hidden Then Continue For + + If Notes(j).Length <> 0 OrElse Notes(j).Value \ 10000 = LnObj Then + Notes(i).HasError = True + Else + Notes(i).LNPair = j + Notes(j).LNPair = i + End If + Exit For + Next + If j = 0 Then + Notes(i).HasError = True + End If + End If + End If + Next + + Else + For i = 0 To UBound(Notes) + Notes(i).HasError = False + Notes(i).LNPair = 0 + Next + + For i = 1 To UBound(Notes) + If IsColumnSound(Notes(i).ColumnIndex) AndAlso Notes(i).ColumnIndex < niB Then + If Notes(i).LongNote Then + 'LongNote: If overlapping a note, then error. + ' Else if already matched by a LongNote below, then match it. + ' Otherwise match anything above. + ' If ShortNote above then error on above. + ' If nothing above then error. + For j = i - 1 To 1 Step -1 + If Notes(j).ColumnIndex <> Notes(i).ColumnIndex Then Continue For + If Notes(j).VPosition = Notes(i).VPosition Then + Notes(i).HasError = True + GoTo EndSearch + ElseIf Notes(j).LongNote And Notes(j).LNPair = i Then + Notes(i).LNPair = j + GoTo EndSearch + Else + Exit For + End If + Next + + For j = i + 1 To UBound(Notes) + If Notes(j).ColumnIndex <> Notes(i).ColumnIndex Then Continue For + Notes(i).LNPair = j + Notes(j).LNPair = i + If Not Notes(j).LongNote AndAlso Notes(j).Value \ 10000 <> LnObj Then + Notes(j).HasError = True + End If + Exit For + Next + + If j = UBound(Notes) + 1 Then + Notes(i).HasError = True + End If EndSearch: - ElseIf Notes(i).Value \ 10000 = LnObj Then - 'LnObj: Match anything below. - ' If matching a LongNote not matching back, then error on below. - ' If overlapping a note, then error. - ' If mathcing a LnObj below, then error on below. - ' If nothing below, then error. - For j = i - 1 To 1 Step -1 - If Notes(i).ColumnIndex <> Notes(j).ColumnIndex Then Continue For - If Notes(j).LNPair <> 0 And Notes(j).LNPair <> i Then - Notes(j).HasError = True - End If - Notes(i).LNPair = j - Notes(j).LNPair = i - If Notes(i).VPosition = Notes(j).VPosition Then - Notes(i).HasError = True - End If - If Notes(j).Value \ 10000 = LnObj Then - Notes(j).HasError = True - End If - Exit For - Next - - If j = 0 Then - Notes(i).HasError = True - End If - Else - 'ShortNote: If overlapping a note, then error. - For j = i - 1 To 1 Step -1 - If Notes(j).VPosition < Notes(i).VPosition Then Exit For - If Notes(j).ColumnIndex <> Notes(i).ColumnIndex Then Continue For - Notes(i).HasError = True - Exit For - Next - End If - Else - If Notes(i).Hidden Or Notes(i).Landmine Then - Notes(i).HasError = True - Else - 'ShortNote: If overlapping a note, then error. - For j = i - 1 To 1 Step -1 - If Notes(j).VPosition < Notes(i).VPosition Then Exit For - If Notes(j).ColumnIndex <> Notes(i).ColumnIndex Then Continue For - Notes(i).HasError = True - Exit For - Next - End If - End If - Next - - - End If - - Dim currentMS = 0.0# - Dim currentBPM = Notes(0).Value / 10000 - Dim currentBPMVPosition = 0.0# - For i = 1 To UBound(Notes) - If Notes(i).ColumnIndex = niBPM Then - currentMS += (Notes(i).VPosition - currentBPMVPosition) / currentBPM * 1250 - currentBPM = Notes(i).Value / 10000 - currentBPMVPosition = Notes(i).VPosition - End If - 'K(i).TimeOffset = currentMS + (K(i).VPosition - currentBPMVPosition) / currentBPM * 1250 - Next - End Sub - - - - Public Sub ExceptionSave(Path As String) - SaveiBMSC(Path) - End Sub - - ''' - ''' True if pressed cancel. False elsewise. - ''' - ''' True if pressed cancel. False elsewise. - - Private Function ClosingPopSave() As Boolean - If Not IsSaved Then - Dim xResult As MsgBoxResult = MsgBox(Strings.Messages.SaveOnExit, MsgBoxStyle.YesNoCancel Or MsgBoxStyle.Question, Text) - - If xResult = MsgBoxResult.Yes Then - If ExcludeFileName(FileName) = String.Empty Then - Dim xDSave As New SaveFileDialog With { - .Filter = Strings.FileType._bms & "|*.bms;*.bme;*.bml;*.pms;*.txt|" & - Strings.FileType.BMS & "|*.bms|" & - Strings.FileType.BME & "|*.bme|" & - Strings.FileType.BML & "|*.bml|" & - Strings.FileType.PMS & "|*.pms|" & - Strings.FileType.TXT & "|*.txt|" & - Strings.FileType._all & "|*.*", - .DefaultExt = "bms", - .InitialDirectory = InitPath - } - - If xDSave.ShowDialog = Forms.DialogResult.Cancel Then Return True - SetFileName(xDSave.FileName) - End If - Dim xStrAll As String = SaveBMS() - My.Computer.FileSystem.WriteAllText(FileName, xStrAll, False, TextEncoding) - NewRecent(FileName) - If BeepWhileSaved Then Beep() - End If - - If xResult = MsgBoxResult.Cancel Then Return True - End If - Return False - End Function - - Private Sub TBNew_Click(sender As Object, e As EventArgs) Handles TBNew.Click, mnNew.Click - - 'KMouseDown = -1 - ReDim SelectedNotes(-1) - KMouseOver = -1 - If ClosingPopSave() Then Exit Sub - - ClearUndo() - InitializeNewBMS() - - ReDim Notes(0) - ReDim mColumn(999) - ReDim hWAV(1295) - ReDim hBMP(1295) - ReDim hBPM(1295) 'x10000 - ReDim hSTOP(1295) - ReDim hBMSCROLL(1295) - THGenre.Text = String.Empty - THTitle.Text = String.Empty - THArtist.Text = String.Empty - THPlayLevel.Text = String.Empty - - With Notes(0) - .ColumnIndex = niBPM - .VPosition = -1 - '.LongNote = False - '.Selected = False - .Value = 1200000 - End With - THBPM.Value = 120 - - LWAV.Items.Clear() - LBMP.Items.Clear() - Dim xI1 As Integer - For xI1 = 1 To 1295 - Dim unused1 = LWAV.Items.Add(C10to36(xI1) & ": " & hWAV(xI1)) - Dim unused = LBMP.Items.Add(C10to36(xI1) & ": " & hBMP(xI1)) - Next - LWAV.SelectedIndex = 0 - LBMP.SelectedIndex = 0 - - SetFileName("Untitled.bms") - SetIsSaved(True) - 'pIsSaved.Visible = Not IsSaved - - CalculateTotalPlayableNotes() - CalculateGreatestVPosition() - RefreshPanelAll() - POStatusRefresh() - End Sub - - Private Sub TBNewC_Click(sender As Object, e As EventArgs) 'Handles TBNewC.Click - 'KMouseDown = -1 - ReDim SelectedNotes(-1) - KMouseOver = -1 - If ClosingPopSave() Then Exit Sub - - ClearUndo() - - ReDim Notes(0) - ReDim mColumn(999) - ReDim hWAV(1295) - ReDim hBMP(1295) - ReDim hBPM(1295) 'x10000 - ReDim hSTOP(1295) - ReDim hBMSCROLL(1295) - THGenre.Text = String.Empty - THTitle.Text = String.Empty - THArtist.Text = String.Empty - THPlayLevel.Text = String.Empty - - With Notes(0) - .ColumnIndex = niBPM - .VPosition = -1 - '.LongNote = False - '.Selected = False - .Value = 1200000 - End With - THBPM.Value = 120 - - SetFileName("Untitled.bms") - SetIsSaved(True) - 'pIsSaved.Visible = Not IsSaved - - If MsgBox("Please copy your code to clipboard and click OK.", MsgBoxStyle.OkCancel, "Create from code") = MsgBoxResult.Cancel Then Exit Sub - OpenBMS(Clipboard.GetText) - End Sub - - Private Sub TBOpen_ButtonClick(sender As Object, e As EventArgs) Handles TBOpen.ButtonClick, mnOpen.Click - 'KMouseDown = -1 - ReDim SelectedNotes(-1) - KMouseOver = -1 - If ClosingPopSave() Then Exit Sub - - Dim xDOpen As New OpenFileDialog With { - .Filter = Strings.FileType._bms & "|*.bms;*.bme;*.bml;*.pms;*.txt", - .DefaultExt = "bms", - .InitialDirectory = IIf(ExcludeFileName(FileName) = String.Empty, InitPath, ExcludeFileName(FileName)) - } - - If xDOpen.ShowDialog = Forms.DialogResult.Cancel Then Exit Sub - - InitPath = ExcludeFileName(xDOpen.FileName) - OpenBMS(File.ReadAllText(xDOpen.FileName, TextEncoding)) - ClearUndo() - SetFileName(xDOpen.FileName) - NewRecent(FileName) - SetIsSaved(True) - 'pIsSaved.Visible = Not IsSaved - End Sub - - Private Sub TBImportIBMSC_Click(sender As Object, e As EventArgs) Handles TBImportIBMSC.Click, mnImportIBMSC.Click - 'KMouseDown = -1 - ReDim SelectedNotes(-1) - KMouseOver = -1 - If ClosingPopSave() Then Return - - Dim xDOpen As New OpenFileDialog With { - .Filter = Strings.FileType.IBMSC & "|*.ibmsc", - .DefaultExt = "ibmsc", - .InitialDirectory = IIf(ExcludeFileName(FileName) = String.Empty, InitPath, ExcludeFileName(FileName)) - } - - If xDOpen.ShowDialog = Forms.DialogResult.Cancel Then Return - InitPath = ExcludeFileName(xDOpen.FileName) - SetFileName("Imported_" & GetFileName(xDOpen.FileName)) - OpeniBMSC(xDOpen.FileName) - NewRecent(xDOpen.FileName) - SetIsSaved(False) - 'pIsSaved.Visible = Not IsSaved - End Sub - - Private Sub TBImportSM_Click(sender As Object, e As EventArgs) Handles TBImportSM.Click, mnImportSM.Click - 'KMouseDown = -1 - ReDim SelectedNotes(-1) - KMouseOver = -1 - If ClosingPopSave() Then Exit Sub - - Dim xDOpen As New OpenFileDialog With { - .Filter = Strings.FileType.SM & "|*.sm", - .DefaultExt = "sm", - .InitialDirectory = IIf(ExcludeFileName(FileName) = String.Empty, InitPath, ExcludeFileName(FileName)) - } - - If xDOpen.ShowDialog = Forms.DialogResult.Cancel Then Exit Sub - If OpenSM(File.ReadAllText(xDOpen.FileName, TextEncoding)) Then Exit Sub - InitPath = ExcludeFileName(xDOpen.FileName) - SetFileName("Untitled.bms") - ClearUndo() - SetIsSaved(False) - 'pIsSaved.Visible = Not IsSaved - End Sub - - Private Sub TBSave_ButtonClick(sender As Object, e As EventArgs) Handles TBSave.ButtonClick, mnSave.Click - 'KMouseDown = -1 - ReDim SelectedNotes(-1) - KMouseOver = -1 - - If ExcludeFileName(FileName) = String.Empty Then - Dim xDSave As New SaveFileDialog With { - .Filter = Strings.FileType._bms & "|*.bms;*.bme;*.bml;*.pms;*.txt|" & - Strings.FileType.BMS & "|*.bms|" & - Strings.FileType.BME & "|*.bme|" & - Strings.FileType.BML & "|*.bml|" & - Strings.FileType.PMS & "|*.pms|" & - Strings.FileType.TXT & "|*.txt|" & - Strings.FileType._all & "|*.*", - .DefaultExt = "bms", - .InitialDirectory = InitPath - } - - If xDSave.ShowDialog = Forms.DialogResult.Cancel Then Exit Sub - InitPath = ExcludeFileName(xDSave.FileName) - SetFileName(xDSave.FileName) - End If - Dim xStrAll = SaveBMS() - My.Computer.FileSystem.WriteAllText(FileName, xStrAll, False, TextEncoding) - NewRecent(FileName) - SetFileName(FileName) - SetIsSaved(True) - 'pIsSaved.Visible = Not IsSaved - If BeepWhileSaved Then Beep() - End Sub - - Private Sub TBSaveAs_Click(sender As Object, e As EventArgs) Handles TBSaveAs.Click, mnSaveAs.Click - 'KMouseDown = -1 - ReDim SelectedNotes(-1) - KMouseOver = -1 - - Dim xDSave As New SaveFileDialog With { - .Filter = Strings.FileType._bms & "|*.bms;*.bme;*.bml;*.pms;*.txt|" & - Strings.FileType.BMS & "|*.bms|" & - Strings.FileType.BME & "|*.bme|" & - Strings.FileType.BML & "|*.bml|" & - Strings.FileType.PMS & "|*.pms|" & - Strings.FileType.TXT & "|*.txt|" & - Strings.FileType._all & "|*.*", - .DefaultExt = "bms", - .InitialDirectory = IIf(ExcludeFileName(FileName) = String.Empty, InitPath, ExcludeFileName(FileName)) - } - - If xDSave.ShowDialog = Forms.DialogResult.Cancel Then Exit Sub - InitPath = ExcludeFileName(xDSave.FileName) - SetFileName(xDSave.FileName) - Dim xStrAll As String = SaveBMS() - My.Computer.FileSystem.WriteAllText(FileName, xStrAll, False, TextEncoding) - NewRecent(FileName) - SetFileName(FileName) - SetIsSaved(True) - 'pIsSaved.Visible = Not IsSaved - If BeepWhileSaved Then Beep() - End Sub - - Private Sub TBExportIBMSC_Click(sender As Object, e As EventArgs) Handles TBExportIBMSC.Click, mnExportIBMSC.Click - 'KMouseDown = -1 - ReDim SelectedNotes(-1) - KMouseOver = -1 - - Dim xDSave As New SaveFileDialog With { - .Filter = Strings.FileType.IBMSC & "|*.ibmsc", - .DefaultExt = "ibmsc", - .InitialDirectory = IIf(ExcludeFileName(FileName) = String.Empty, InitPath, ExcludeFileName(FileName)) - } - If xDSave.ShowDialog = Forms.DialogResult.Cancel Then Exit Sub - - SaveiBMSC(xDSave.FileName) - 'My.Computer.FileSystem.WriteAllText(xDSave.FileName, xStrAll, False, TextEncoding) - NewRecent(FileName) - If BeepWhileSaved Then Beep() - End Sub - - Private Sub TBExportBMSON_Click(sender As Object, e As EventArgs) Handles TBExportBMSON.Click, mnExportBMSON.Click - 'KMouseDown = -1 - ReDim SelectedNotes(-1) - KMouseOver = -1 - - Dim xDSave As New SaveFileDialog With { - .Filter = Strings.FileType.BMSON & "|*.bmson", - .DefaultExt = "bmson", - .InitialDirectory = IIf(ExcludeFileName(FileName) = String.Empty, InitPath, ExcludeFileName(FileName)) - } - If xDSave.ShowDialog = Forms.DialogResult.Cancel Then Exit Sub - - SaveBMSON(xDSave.FileName) - 'My.Computer.FileSystem.WriteAllText(xDSave.FileName, xStrAll, False, TextEncoding) - NewRecent(FileName) - If BeepWhileSaved Then Beep() - End Sub - - Private Sub VSGotFocus(sender As Object, e As EventArgs) Handles MainPanelScroll.GotFocus, LeftPanelScroll.GotFocus, RightPanelScroll.GotFocus - PanelFocus = sender.Tag - Dim unused = spMain(PanelFocus).Focus() - End Sub - - Private Sub VSValueChanged(sender As Object, e As EventArgs) Handles MainPanelScroll.ValueChanged, LeftPanelScroll.ValueChanged, RightPanelScroll.ValueChanged - Dim iI As Integer = sender.Tag - - ' az: We got a wheel event when we're zooming in/out - If My.Computer.Keyboard.CtrlKeyDown Then - sender.Value = VSValue ' Undo the scroll - Exit Sub - End If - - If iI = PanelFocus And Not LastMouseDownLocation = New Point(-1, -1) And Not VSValue = -1 Then LastMouseDownLocation.Y += (VSValue - sender.Value) * gxHeight - PanelVScroll(iI) = sender.Value - - If spLock((iI + 1) Mod 3) Then - Dim xVS As Integer = PanelVScroll(iI) + spDiff(iI) - If xVS > 0 Then xVS = 0 - If xVS < MainPanelScroll.Minimum Then xVS = MainPanelScroll.Minimum - Select Case iI - Case 0 : MainPanelScroll.Value = xVS - Case 1 : RightPanelScroll.Value = xVS - Case 2 : LeftPanelScroll.Value = xVS - End Select - End If - - If spLock((iI + 2) Mod 3) Then - Dim xVS As Integer = PanelVScroll(iI) - spDiff((iI + 2) Mod 3) - If xVS > 0 Then xVS = 0 - If xVS < MainPanelScroll.Minimum Then xVS = MainPanelScroll.Minimum - Select Case iI - Case 0 : RightPanelScroll.Value = xVS - Case 1 : LeftPanelScroll.Value = xVS - Case 2 : MainPanelScroll.Value = xVS - End Select - End If - - spDiff(iI) = PanelVScroll((iI + 1) Mod 3) - PanelVScroll(iI) - spDiff((iI + 2) Mod 3) = PanelVScroll(iI) - PanelVScroll((iI + 2) Mod 3) - - VSValue = sender.Value - RefreshPanel(iI, spMain(iI).DisplayRectangle) - End Sub - - Private Sub cVSLock_CheckedChanged(sender As Object, e As EventArgs) Handles cVSLockL.CheckedChanged, cVSLock.CheckedChanged, cVSLockR.CheckedChanged - Dim iI As Integer = sender.Tag - spLock(iI) = sender.Checked - If Not spLock(iI) Then Return - - spDiff(iI) = PanelVScroll((iI + 1) Mod 3) - PanelVScroll(iI) - spDiff((iI + 2) Mod 3) = PanelVScroll(iI) - PanelVScroll((iI + 2) Mod 3) - - 'POHeaderB.Text = spDiff(0) & "_" & spDiff(1) & "_" & spDiff(2) - End Sub - - Private Sub HSGotFocus(sender As Object, e As EventArgs) Handles HS.GotFocus, HSL.GotFocus, HSR.GotFocus - PanelFocus = sender.Tag - Dim unused = spMain(PanelFocus).Focus() - End Sub - - Private Sub HSValueChanged(sender As Object, e As EventArgs) Handles HS.ValueChanged, HSL.ValueChanged, HSR.ValueChanged - Dim iI As Integer = sender.Tag - If Not LastMouseDownLocation = New Point(-1, -1) And Not HSValue = -1 Then LastMouseDownLocation.X += (HSValue - sender.Value) * gxWidth - PanelhBMSCROLL(iI) = sender.Value - HSValue = sender.Value - RefreshPanel(iI, spMain(iI).DisplayRectangle) - End Sub - - Private Sub TBSelect_Click(sender As Object, e As EventArgs) Handles TBSelect.Click, mnSelect.Click - TBSelect.Checked = True - TBWrite.Checked = False - TBTimeSelect.Checked = False - mnSelect.Checked = True - mnWrite.Checked = False - mnTimeSelect.Checked = False - - FStatus2.Visible = False - FStatus.Visible = True - - ShouldDrawTempNote = False - SelectedColumn = -1 - TempVPosition = -1 - TempLength = 0 - - vSelStart = MeasureBottom(MeasureAtDisplacement(-PanelVScroll(PanelFocus)) + 1) - vSelLength = 0 - - RefreshPanelAll() - POStatusRefresh() - End Sub - - Private Sub TBWrite_Click(sender As Object, e As EventArgs) Handles TBWrite.Click, mnWrite.Click - TBSelect.Checked = False - TBWrite.Checked = True - TBTimeSelect.Checked = False - mnSelect.Checked = False - mnWrite.Checked = True - mnTimeSelect.Checked = False - - FStatus2.Visible = False - FStatus.Visible = True - - ShouldDrawTempNote = True - SelectedColumn = -1 - TempVPosition = -1 - TempLength = 0 - - vSelStart = MeasureBottom(MeasureAtDisplacement(-PanelVScroll(PanelFocus)) + 1) - vSelLength = 0 - - RefreshPanelAll() - POStatusRefresh() - End Sub - - Private Sub TBPostEffects_Click(sender As Object, e As EventArgs) Handles TBTimeSelect.Click, mnTimeSelect.Click - TBSelect.Checked = False - TBWrite.Checked = False - TBTimeSelect.Checked = True - mnSelect.Checked = False - mnWrite.Checked = False - mnTimeSelect.Checked = True - - FStatus.Visible = False - FStatus2.Visible = True - - vSelMouseOverLine = 0 - ShouldDrawTempNote = False - SelectedColumn = -1 - TempVPosition = -1 - TempLength = 0 - ValidateSelection() - - Dim xI1 As Integer - For xI1 = 0 To UBound(Notes) - Notes(xI1).Selected = False - Next - RefreshPanelAll() - POStatusRefresh() - End Sub - - Private Sub CGHeight_ValueChanged(sender As Object, e As EventArgs) Handles CGHeight.ValueChanged - gxHeight = CGHeight.Value - CGHeight2.Value = IIf(CGHeight.Value * 4 < CGHeight2.Maximum, CGHeight.Value * 4, CGHeight2.Maximum) - RefreshPanelAll() - End Sub - - Private Sub CGHeight2_Scroll(sender As Object, e As EventArgs) Handles CGHeight2.Scroll - CGHeight.Value = CGHeight2.Value / 4 - End Sub - - Private Sub CGWidth_ValueChanged(sender As Object, e As EventArgs) Handles CGWidth.ValueChanged - gxWidth = CGWidth.Value - CGWidth2.Value = IIf(CGWidth.Value * 4 < CGWidth2.Maximum, CGWidth.Value * 4, CGWidth2.Maximum) - - HS.LargeChange = PMainIn.Width / gxWidth - If HS.Value > HS.Maximum - HS.LargeChange + 1 Then HS.Value = HS.Maximum - HS.LargeChange + 1 - HSL.LargeChange = PMainInL.Width / gxWidth - If HSL.Value > HSL.Maximum - HSL.LargeChange + 1 Then HSL.Value = HSL.Maximum - HSL.LargeChange + 1 - HSR.LargeChange = PMainInR.Width / gxWidth - If HSR.Value > HSR.Maximum - HSR.LargeChange + 1 Then HSR.Value = HSR.Maximum - HSR.LargeChange + 1 - - RefreshPanelAll() - End Sub - - Private Sub CGWidth2_Scroll(sender As Object, e As EventArgs) Handles CGWidth2.Scroll - CGWidth.Value = CGWidth2.Value / 4 - End Sub - - Private Sub CGDivide_ValueChanged(sender As Object, e As EventArgs) Handles CGDivide.ValueChanged - gDivide = CGDivide.Value - RefreshPanelAll() - End Sub - Private Sub CGSub_ValueChanged(sender As Object, e As EventArgs) Handles CGSub.ValueChanged - gSub = CGSub.Value - RefreshPanelAll() - End Sub - Private Sub BGSlash_Click(sender As Object, e As EventArgs) Handles BGSlash.Click - Dim xd As Integer = Val(InputBox(Strings.Messages.PromptSlashValue, , gSlash)) - If xd = 0 Then Exit Sub - If xd > CGDivide.Maximum Then xd = CGDivide.Maximum - If xd < CGDivide.Minimum Then xd = CGDivide.Minimum - gSlash = xd - End Sub - - - Private Sub CGSnap_CheckedChanged(sender As Object, e As EventArgs) Handles CGSnap.CheckedChanged - gSnap = CGSnap.Checked - RefreshPanelAll() - End Sub - - Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick - Dim xI1 As Integer - - Select Case PanelFocus - Case 0 - With LeftPanelScroll - xI1 = .Value + (tempY / 5 / gxHeight) - If xI1 > 0 Then xI1 = 0 - If xI1 < .Minimum Then xI1 = .Minimum - .Value = xI1 - End With - With HSL - xI1 = .Value + (tempX / 10 / gxWidth) - If xI1 > .Maximum - .LargeChange + 1 Then xI1 = .Maximum - .LargeChange + 1 - If xI1 < .Minimum Then xI1 = .Minimum - .Value = xI1 - End With - - Case 1 - With MainPanelScroll - xI1 = .Value + (tempY / 5 / gxHeight) - If xI1 > 0 Then xI1 = 0 - If xI1 < .Minimum Then xI1 = .Minimum - .Value = xI1 - End With - With HS - xI1 = .Value + (tempX / 10 / gxWidth) - If xI1 > .Maximum - .LargeChange + 1 Then xI1 = .Maximum - .LargeChange + 1 - If xI1 < .Minimum Then xI1 = .Minimum - .Value = xI1 - End With - - Case 2 - With RightPanelScroll - xI1 = .Value + (tempY / 5 / gxHeight) - If xI1 > 0 Then xI1 = 0 - If xI1 < .Minimum Then xI1 = .Minimum - .Value = xI1 - End With - With HSR - xI1 = .Value + (tempX / 10 / gxWidth) - If xI1 > .Maximum - .LargeChange + 1 Then xI1 = .Maximum - .LargeChange + 1 - If xI1 < .Minimum Then xI1 = .Minimum - .Value = xI1 - End With - End Select - - Dim xMEArgs As New MouseEventArgs(MouseButtons.Left, 0, MouseMoveStatus.X, MouseMoveStatus.Y, 0) - PMainInMouseMove(spMain(PanelFocus), xMEArgs) - - End Sub - - Private Sub TimerMiddle_Tick(sender As Object, e As EventArgs) Handles TimerMiddle.Tick - If Not MiddleButtonClicked Then TimerMiddle.Enabled = False : Return - - Dim xI1 As Integer - - Select Case PanelFocus - Case 0 - With LeftPanelScroll - xI1 = .Value + ((Cursor.Position.Y - MiddleButtonLocation.Y) / 5 / gxHeight) - If xI1 > 0 Then xI1 = 0 - If xI1 < .Minimum Then xI1 = .Minimum - .Value = xI1 - End With - With HSL - xI1 = .Value + ((Cursor.Position.X - MiddleButtonLocation.X) / 5 / gxWidth) - If xI1 > .Maximum - .LargeChange + 1 Then xI1 = .Maximum - .LargeChange + 1 - If xI1 < .Minimum Then xI1 = .Minimum - .Value = xI1 - End With - - Case 1 - With MainPanelScroll - xI1 = .Value + ((Cursor.Position.Y - MiddleButtonLocation.Y) / 5 / gxHeight) - If xI1 > 0 Then xI1 = 0 - If xI1 < .Minimum Then xI1 = .Minimum - .Value = xI1 - End With - With HS - xI1 = .Value + ((Cursor.Position.X - MiddleButtonLocation.X) / 5 / gxWidth) - If xI1 > .Maximum - .LargeChange + 1 Then xI1 = .Maximum - .LargeChange + 1 - If xI1 < .Minimum Then xI1 = .Minimum - .Value = xI1 - End With - - Case 2 - With RightPanelScroll - xI1 = .Value + ((Cursor.Position.Y - MiddleButtonLocation.Y) / 5 / gxHeight) - If xI1 > 0 Then xI1 = 0 - If xI1 < .Minimum Then xI1 = .Minimum - .Value = xI1 - End With - With HSR - xI1 = .Value + ((Cursor.Position.X - MiddleButtonLocation.X) / 5 / gxWidth) - If xI1 > .Maximum - .LargeChange + 1 Then xI1 = .Maximum - .LargeChange + 1 - If xI1 < .Minimum Then xI1 = .Minimum - .Value = xI1 - End With - End Select - - Dim xMEArgs As New MouseEventArgs(MouseButtons.Left, 0, MouseMoveStatus.X, MouseMoveStatus.Y, 0) - PMainInMouseMove(spMain(PanelFocus), xMEArgs) - End Sub - - Private Sub ValidateWavListView() - Try - Dim xRect As Rectangle = LWAV.GetItemRectangle(LWAV.SelectedIndex) - If xRect.Top + xRect.Height > LWAV.DisplayRectangle.Height Then Dim unused = SendMessage(LWAV.Handle, &H115, 1, 0) - Catch ex As Exception - End Try - End Sub - - Private Sub ValidateBmpListView() - Try - Dim xRect As Rectangle = LBMP.GetItemRectangle(LBMP.SelectedIndex) - If xRect.Top + xRect.Height > LBMP.DisplayRectangle.Height Then Dim unused = SendMessage(LBMP.Handle, &H115, 1, 0) - Catch ex As Exception - End Try - End Sub - - Private Sub LWAV_Click(sender As Object, e As EventArgs) Handles LWAV.Click - If TBWrite.Checked Then FSW.Text = C10to36(LWAV.SelectedIndex + 1) - - PreviewNote(String.Empty, True) - If Not PreviewOnClick Then Exit Sub - If hWAV(LWAV.SelectedIndex + 1) = String.Empty Then Exit Sub - - Dim xFileLocation As String = IIf(ExcludeFileName(FileName) = String.Empty, InitPath, ExcludeFileName(FileName)) & "\" & hWAV(LWAV.SelectedIndex + 1) - PreviewNote(xFileLocation, False) - End Sub - - Private Sub LWAV_DoubleClick(sender As Object, e As EventArgs) Handles LWAV.DoubleClick - Dim xDWAV As New OpenFileDialog With { - .DefaultExt = "wav", - .Filter = Strings.FileType._wave & "|*.wav;*.ogg;*.mp3;*.flac|" & - Strings.FileType.WAV & "|*.wav|" & - Strings.FileType.OGG & "|*.ogg|" & - Strings.FileType.MP3 & "|*.mp3|" & - Strings.FileType.FLAC & "|*.flac|" & - Strings.FileType._all & "|*.*", - .InitialDirectory = IIf(ExcludeFileName(FileName) = String.Empty, InitPath, ExcludeFileName(FileName)) - } - - If xDWAV.ShowDialog = Forms.DialogResult.Cancel Then Exit Sub - InitPath = ExcludeFileName(xDWAV.FileName) - hWAV(LWAV.SelectedIndex + 1) = GetFileName(xDWAV.FileName) - LWAV.Items.Item(LWAV.SelectedIndex) = C10to36(LWAV.SelectedIndex + 1) & ": " & GetFileName(xDWAV.FileName) - If IsSaved Then SetIsSaved(False) - End Sub - - Private Sub LWAV_KeyDown(sender As Object, e As KeyEventArgs) Handles LWAV.KeyDown - Select Case e.KeyCode - Case Keys.Delete - hWAV(LWAV.SelectedIndex + 1) = String.Empty - LWAV.Items.Item(LWAV.SelectedIndex) = C10to36(LWAV.SelectedIndex + 1) & ": " - If IsSaved Then SetIsSaved(False) - End Select - End Sub - - Private Sub LBMP_DoubleClick(sender As Object, e As EventArgs) Handles LBMP.DoubleClick - Dim xDBMP As New OpenFileDialog With { - .DefaultExt = "bmp", - .Filter = Strings.FileType._image & "|*.bmp;*.png;*.jpg;*.jpeg;.gif|" & - Strings.FileType._movie & "|*.mpg;*.m1v;*.m2v;*.avi;*.mp4;*.m4v;*.wmv;*.webm|" & - Strings.FileType.BMP & "|*.bmp|" & - Strings.FileType.PNG & "|*.png|" & - Strings.FileType.JPG & "|*.jpg;*.jpeg|" & - Strings.FileType.GIF & "|*.gif|" & - Strings.FileType.MP4 & "|*.mp4;*.m4v|" & - Strings.FileType.AVI & "|*.avi|" & - Strings.FileType.MPG & "|*.mpg;*.m1v;*.m2v|" & - Strings.FileType.WMV & "|*.wmv|" & - Strings.FileType.WEBM & "|*.webm|" & - Strings.FileType._all & "|*.*", - .InitialDirectory = IIf(ExcludeFileName(FileName) = String.Empty, InitPath, ExcludeFileName(FileName)) - } - - If xDBMP.ShowDialog = Forms.DialogResult.Cancel Then Exit Sub - InitPath = ExcludeFileName(xDBMP.FileName) - hBMP(LBMP.SelectedIndex + 1) = GetFileName(xDBMP.FileName) - LBMP.Items.Item(LBMP.SelectedIndex) = C10to36(LBMP.SelectedIndex + 1) & ": " & GetFileName(xDBMP.FileName) - If IsSaved Then SetIsSaved(False) - End Sub - - Private Sub LBMP_KeyDown(sender As Object, e As KeyEventArgs) Handles LBMP.KeyDown - Select Case e.KeyCode - Case Keys.Delete - hBMP(LBMP.SelectedIndex + 1) = String.Empty - LBMP.Items.Item(LBMP.SelectedIndex) = C10to36(LBMP.SelectedIndex + 1) & ": " - If IsSaved Then SetIsSaved(False) - End Select - End Sub - - Private Sub TBErrorCheck_Click(sender As Object, e As EventArgs) Handles TBErrorCheck.Click, mnErrorCheck.Click - ErrorCheck = sender.Checked - TBErrorCheck.Checked = ErrorCheck - mnErrorCheck.Checked = ErrorCheck - TBErrorCheck.Image = IIf(TBErrorCheck.Checked, My.Resources.x16CheckError, My.Resources.x16CheckErrorN) - mnErrorCheck.Image = IIf(TBErrorCheck.Checked, My.Resources.x16CheckError, My.Resources.x16CheckErrorN) - RefreshPanelAll() - End Sub - - Private Sub TBPreviewOnClick_Click(sender As Object, e As EventArgs) Handles TBPreviewOnClick.Click, mnPreviewOnClick.Click - PreviewNote(String.Empty, True) - PreviewOnClick = sender.Checked - TBPreviewOnClick.Checked = PreviewOnClick - mnPreviewOnClick.Checked = PreviewOnClick - TBPreviewOnClick.Image = IIf(PreviewOnClick, My.Resources.x16PreviewOnClick, My.Resources.x16PreviewOnClickN) - mnPreviewOnClick.Image = IIf(PreviewOnClick, My.Resources.x16PreviewOnClick, My.Resources.x16PreviewOnClickN) - End Sub - - Private Sub TBChangePlaySide_Click(sender As Object, e As EventArgs) Handles TBChangePlaySide.Click, mnChangePlaySide.Click - Rscratch = sender.Checked - ChangePlaySide(True) - TBChangePlaySide.Checked = Rscratch - mnChangePlaySide.Checked = Rscratch - TBChangePlaySide.Image = My.Resources.x16ChangePlaySide - mnChangePlaySide.Image = My.Resources.x16ChangePlaySide - RefreshPanelAll() - End Sub - - 'Private Sub TBPreviewErrorCheck_Click( sender As System.Object, e As EventArgs) - ' PreviewErrorCheck = TBPreviewErrorCheck.Checked - ' TBPreviewErrorCheck.Image = IIf(PreviewErrorCheck, My.Resources.x16PreviewCheck, My.Resources.x16PreviewCheckN) - 'End Sub - - Private Sub TBShowFileName_Click(sender As Object, e As EventArgs) Handles TBShowFileName.Click, mnShowFileName.Click - ShowFileName = sender.Checked - TBShowFileName.Checked = ShowFileName - mnShowFileName.Checked = ShowFileName - TBShowFileName.Image = IIf(ShowFileName, My.Resources.x16ShowFileName, My.Resources.x16ShowFileNameN) - mnShowFileName.Image = IIf(ShowFileName, My.Resources.x16ShowFileName, My.Resources.x16ShowFileNameN) - RefreshPanelAll() - End Sub - - Private Sub TBCut_Click(sender As Object, e As EventArgs) Handles TBCut.Click, mnCut.Click - Dim xUndo As UndoRedo.LinkedURCmd = Nothing - Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void - Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo - RedoRemoveNoteSelected(True, xUndo, xRedo) - 'Dim xRedo As String = sCmdKDs() - 'Dim xUndo As String = sCmdKs(True) - - Try - CopyNotes(False) - RemoveNotes(False) - AddUndo(xUndo, xBaseRedo.Next) - Catch ex As Exception - Dim unused = MsgBox(ex.Message, MsgBoxStyle.Exclamation, Strings.Messages.Err) - End Try - SortByVPositionInsertion() - UpdatePairing() - CalculateTotalPlayableNotes() - RefreshPanelAll() - POStatusRefresh() - CalculateGreatestVPosition() - End Sub - - Private Sub TBCopy_Click(sender As Object, e As EventArgs) Handles TBCopy.Click, mnCopy.Click - Try - CopyNotes() - Catch ex As Exception - Dim unused = MsgBox(ex.Message, MsgBoxStyle.Exclamation, Strings.Messages.Err) - End Try - RefreshPanelAll() - POStatusRefresh() - End Sub - - Private Sub TBPaste_Click(sender As Object, e As EventArgs) Handles TBPaste.Click, mnPaste.Click - AddNotesFromClipboard() - - Dim xUndo As UndoRedo.LinkedURCmd = Nothing - Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void - Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo - RedoAddNoteSelected(True, xUndo, xRedo) - AddUndo(xUndo, xBaseRedo.Next) - - 'AddUndo(sCmdKDs(), sCmdKs(True)) - - SortByVPositionInsertion() - UpdatePairing() - CalculateTotalPlayableNotes() - RefreshPanelAll() - POStatusRefresh() - CalculateGreatestVPosition() - End Sub - - 'Private Function pArgPath( I As Integer) - ' Return Mid(pArgs(I), 1, InStr(pArgs(I), vbCrLf) - 1) - 'End Function - - Private Function GetFileName(s As String) As String - Dim fslash As Integer = InStrRev(s, "/") - Dim bslash As Integer = InStrRev(s, "\") - - Return Mid(s, IIf(fslash > bslash, fslash, bslash) + 1) - - End Function - - Private Function ExcludeFileName(s As String) As String - Dim fslash As Integer = InStrRev(s, "/") - Dim bslash As Integer = InStrRev(s, "\") - If (bslash Or fslash) = 0 Then Return String.Empty - Return Mid(s, 1, IIf(fslash > bslash, fslash, bslash) - 1) - End Function - - Private Sub PlayerMissingPrompt() - Dim xArg As PlayerArguments = pArgs(CurrentPlayer) - Dim unused = MsgBox(Strings.Messages.CannotFind.Replace("{}", PrevCodeToReal(xArg.Path)) & vbCrLf & - Strings.Messages.PleaseRespecifyPath, MsgBoxStyle.Critical, Strings.Messages.PlayerNotFound) - - Dim xDOpen As New OpenFileDialog With { - .InitialDirectory = IIf(ExcludeFileName(PrevCodeToReal(xArg.Path)) = String.Empty, - My.Application.Info.DirectoryPath, - ExcludeFileName(PrevCodeToReal(xArg.Path))), - .FileName = PrevCodeToReal(xArg.Path), - .Filter = Strings.FileType.EXE & "|*.exe", - .DefaultExt = "exe" - } - If xDOpen.ShowDialog = Forms.DialogResult.Cancel Then Exit Sub - - 'pArgs(CurrentPlayer) = Replace(xDOpen.FileName, My.Application.Info.DirectoryPath, "") & _ - ' Mid(pArgs(CurrentPlayer), InStr(pArgs(CurrentPlayer), vbCrLf)) - 'xStr = Split(pArgs(CurrentPlayer), vbCrLf) - pArgs(CurrentPlayer).Path = Replace(xDOpen.FileName, My.Application.Info.DirectoryPath, "") - xArg = pArgs(CurrentPlayer) - End Sub - - Private Sub TBPlay_Click(sender As Object, e As EventArgs) Handles TBPlay.Click, mnPlay.Click - 'Dim xStr() As String = Split(pArgs(CurrentPlayer), vbCrLf) - Dim xArg As PlayerArguments = pArgs(CurrentPlayer) - - If Not File.Exists(PrevCodeToReal(xArg.Path)) Then - PlayerMissingPrompt() - xArg = pArgs(CurrentPlayer) - End If - - ' az: Treat it like we cancelled the operation - If Not File.Exists(PrevCodeToReal(xArg.Path)) Then - Exit Sub - End If - - Dim xStrAll As String = SaveBMS() - Dim xFileName As String = IIf(Not PathIsValid(FileName), - IIf(InitPath = String.Empty, My.Application.Info.DirectoryPath, InitPath), - ExcludeFileName(FileName)) & "\___TempBMS.bms" - My.Computer.FileSystem.WriteAllText(xFileName, xStrAll, False, TextEncoding) - - AddTempFileList(xFileName) - Dim unused = Process.Start(PrevCodeToReal(xArg.Path), PrevCodeToReal(xArg.aHere)) - End Sub - - Private Sub TBPlayB_Click(sender As Object, e As EventArgs) Handles TBPlayB.Click, mnPlayB.Click - 'Dim xStr() As String = Split(pArgs(CurrentPlayer), vbCrLf) - Dim xArg As PlayerArguments = pArgs(CurrentPlayer) - - If Not File.Exists(PrevCodeToReal(xArg.Path)) Then - PlayerMissingPrompt() - xArg = pArgs(CurrentPlayer) - End If - - If Not File.Exists(PrevCodeToReal(xArg.Path)) Then - Exit Sub - End If - - Dim xStrAll As String = SaveBMS() - Dim xFileName As String = IIf(Not PathIsValid(FileName), - IIf(InitPath = String.Empty, My.Application.Info.DirectoryPath, InitPath), - ExcludeFileName(FileName)) & "\___TempBMS.bms" - My.Computer.FileSystem.WriteAllText(xFileName, xStrAll, False, TextEncoding) - - AddTempFileList(xFileName) - - Dim unused = Process.Start(PrevCodeToReal(xArg.Path), PrevCodeToReal(xArg.aBegin)) - End Sub - - Private Sub TBStop_Click(sender As Object, e As EventArgs) Handles TBStop.Click, mnStop.Click - 'Dim xStr() As String = Split(pArgs(CurrentPlayer), vbCrLf) - Dim xArg As PlayerArguments = pArgs(CurrentPlayer) - - If Not File.Exists(PrevCodeToReal(xArg.Path)) Then - PlayerMissingPrompt() - xArg = pArgs(CurrentPlayer) - End If - - If Not File.Exists(PrevCodeToReal(xArg.Path)) Then - Exit Sub - End If - - Dim unused = Process.Start(PrevCodeToReal(xArg.Path), PrevCodeToReal(xArg.aStop)) - End Sub - - Private Sub AddTempFileList(s As String) - Dim xAdd As Boolean = True - If pTempFileNames IsNot Nothing Then - For Each xStr1 As String In pTempFileNames - If xStr1 = s Then xAdd = False : Exit For - Next - End If - - If xAdd Then - ReDim Preserve pTempFileNames(UBound(pTempFileNames) + 1) - pTempFileNames(UBound(pTempFileNames)) = s - End If - End Sub - Private Sub TBinfo_Click(sender As Object, e As EventArgs) Handles mnStatistics.Click, TBStatistics.Click - My.Forms.Chartinfo.Show() - End Sub - Public Sub TBStatistics_Click(sender As Object, e As EventArgs) - SortByVPositionInsertion() - UpdatePairing() - - Dim data(6, 5) As Integer - For i = 1 To UBound(Notes) - With Notes(i) - Dim row = -1 - If .ColumnIndex = niBPM Then - row = 0 - ElseIf .ColumnIndex = niSTOP Then - row = 1 - ElseIf .ColumnIndex = niSCROLL Then - row = 2 - ElseIf .ColumnIndex >= niA1 AndAlso .ColumnIndex <= niAQ Then - row = 3 - ElseIf .ColumnIndex >= niD1 AndAlso .ColumnIndex <= niDQ Then - row = 4 - ElseIf .ColumnIndex >= niB Then - row = 5 - Else - row = 6 - End If + ElseIf Notes(i).Value \ 10000 = LnObj Then + 'LnObj: Match anything below. + ' If matching a LongNote not matching back, then error on below. + ' If overlapping a note, then error. + ' If mathcing a LnObj below, then error on below. + ' If nothing below, then error. + For j = i - 1 To 1 Step -1 + If Notes(i).ColumnIndex <> Notes(j).ColumnIndex Then Continue For + If Notes(j).LNPair <> 0 And Notes(j).LNPair <> i Then + Notes(j).HasError = True + End If + Notes(i).LNPair = j + Notes(j).LNPair = i + If Notes(i).VPosition = Notes(j).VPosition Then + Notes(i).HasError = True + End If + If Notes(j).Value \ 10000 = LnObj Then + Notes(j).HasError = True + End If + Exit For + Next + + If j = 0 Then + Notes(i).HasError = True + End If + Else + 'ShortNote: If overlapping a note, then error. + For j = i - 1 To 1 Step -1 + If Notes(j).VPosition < Notes(i).VPosition Then Exit For + If Notes(j).ColumnIndex <> Notes(i).ColumnIndex Then Continue For + Notes(i).HasError = True + Exit For + Next + End If + Else + If Notes(i).Hidden Or Notes(i).Landmine Then + Notes(i).HasError = True + Else + 'ShortNote: If overlapping a note, then error. + For j = i - 1 To 1 Step -1 + If Notes(j).VPosition < Notes(i).VPosition Then Exit For + If Notes(j).ColumnIndex <> Notes(i).ColumnIndex Then Continue For + Notes(i).HasError = True + Exit For + Next + End If + End If + Next + + + End If + + Dim currentMS = 0.0# + Dim currentBPM = Notes(0).Value / 10000 + Dim currentBPMVPosition = 0.0# + For i = 1 To UBound(Notes) + If Notes(i).ColumnIndex = niBPM Then + currentMS += (Notes(i).VPosition - currentBPMVPosition) / currentBPM * 1250 + currentBPM = Notes(i).Value / 10000 + currentBPMVPosition = Notes(i).VPosition + End If + 'K(i).TimeOffset = currentMS + (K(i).VPosition - currentBPMVPosition) / currentBPM * 1250 + Next + End Sub + + + + Public Sub ExceptionSave(Path As String) + SaveiBMSC(Path) + End Sub + + ''' + ''' True if pressed cancel. False elsewise. + ''' + ''' True if pressed cancel. False elsewise. + + Private Function ClosingPopSave() As Boolean + If Not IsSaved Then + Dim xResult As MsgBoxResult = MsgBox(Strings.Messages.SaveOnExit, MsgBoxStyle.YesNoCancel Or MsgBoxStyle.Question, Text) + + If xResult = MsgBoxResult.Yes Then + If ExcludeFileName(FileName) = String.Empty Then + Dim xDSave As New SaveFileDialog With { + .Filter = Strings.FileType._bms & "|*.bms;*.bme;*.bml;*.pms;*.txt|" & + Strings.FileType.BMS & "|*.bms|" & + Strings.FileType.BME & "|*.bme|" & + Strings.FileType.BML & "|*.bml|" & + Strings.FileType.PMS & "|*.pms|" & + Strings.FileType.TXT & "|*.txt|" & + Strings.FileType._all & "|*.*", + .DefaultExt = "bms", + .InitialDirectory = InitPath + } + + If xDSave.ShowDialog = Forms.DialogResult.Cancel Then Return True + SetFileName(xDSave.FileName) + End If + Dim xStrAll As String = SaveBMS() + My.Computer.FileSystem.WriteAllText(FileName, xStrAll, False, TextEncoding) + NewRecent(FileName) + If BeepWhileSaved Then Beep() + End If + + If xResult = MsgBoxResult.Cancel Then Return True + End If + Return False + End Function + + Private Sub TBNew_Click(sender As Object, e As EventArgs) Handles TBNew.Click, mnNew.Click + + 'KMouseDown = -1 + ReDim SelectedNotes(-1) + KMouseOver = -1 + If ClosingPopSave() Then Exit Sub + + ClearUndo() + InitializeNewBMS() + + ReDim Notes(0) + ReDim mColumn(999) + ReDim hWAV(1295) + ReDim hBMP(1295) + ReDim hBPM(1295) 'x10000 + ReDim hSTOP(1295) + ReDim hBMSCROLL(1295) + THGenre.Text = String.Empty + THTitle.Text = String.Empty + THArtist.Text = String.Empty + THPlayLevel.Text = String.Empty + + With Notes(0) + .ColumnIndex = niBPM + .VPosition = -1 + '.LongNote = False + '.Selected = False + .Value = 1200000 + End With + THBPM.Value = 120 + + LWAV.Items.Clear() + LBMP.Items.Clear() + Dim xI1 As Integer + For xI1 = 1 To 1295 + Dim unused1 = LWAV.Items.Add(C10to36(xI1) & ": " & hWAV(xI1)) + Dim unused = LBMP.Items.Add(C10to36(xI1) & ": " & hBMP(xI1)) + Next + LWAV.SelectedIndex = 0 + LBMP.SelectedIndex = 0 + + SetFileName("Untitled.bms") + SetIsSaved(True) + 'pIsSaved.Visible = Not IsSaved + + CalculateTotalPlayableNotes() + CalculateGreatestVPosition() + RefreshPanelAll() + POStatusRefresh() + End Sub + + Private Sub TBNewC_Click(sender As Object, e As EventArgs) 'Handles TBNewC.Click + 'KMouseDown = -1 + ReDim SelectedNotes(-1) + KMouseOver = -1 + If ClosingPopSave() Then Exit Sub + + ClearUndo() + + ReDim Notes(0) + ReDim mColumn(999) + ReDim hWAV(1295) + ReDim hBMP(1295) + ReDim hBPM(1295) 'x10000 + ReDim hSTOP(1295) + ReDim hBMSCROLL(1295) + THGenre.Text = String.Empty + THTitle.Text = String.Empty + THArtist.Text = String.Empty + THPlayLevel.Text = String.Empty + + With Notes(0) + .ColumnIndex = niBPM + .VPosition = -1 + '.LongNote = False + '.Selected = False + .Value = 1200000 + End With + THBPM.Value = 120 + + SetFileName("Untitled.bms") + SetIsSaved(True) + 'pIsSaved.Visible = Not IsSaved + + If MsgBox("Please copy your code to clipboard and click OK.", MsgBoxStyle.OkCancel, "Create from code") = MsgBoxResult.Cancel Then Exit Sub + OpenBMS(Clipboard.GetText) + End Sub + + Private Sub TBOpen_ButtonClick(sender As Object, e As EventArgs) Handles TBOpen.ButtonClick, mnOpen.Click + 'KMouseDown = -1 + ReDim SelectedNotes(-1) + KMouseOver = -1 + If ClosingPopSave() Then Exit Sub + + Dim xDOpen As New OpenFileDialog With { + .Filter = Strings.FileType._bms & "|*.bms;*.bme;*.bml;*.pms;*.txt", + .DefaultExt = "bms", + .InitialDirectory = IIf(ExcludeFileName(FileName) = String.Empty, InitPath, ExcludeFileName(FileName)) + } + + If xDOpen.ShowDialog = Forms.DialogResult.Cancel Then Exit Sub + + InitPath = ExcludeFileName(xDOpen.FileName) + OpenBMS(File.ReadAllText(xDOpen.FileName, TextEncoding)) + ClearUndo() + SetFileName(xDOpen.FileName) + NewRecent(FileName) + SetIsSaved(True) + 'pIsSaved.Visible = Not IsSaved + End Sub + + Private Sub TBImportIBMSC_Click(sender As Object, e As EventArgs) Handles TBImportIBMSC.Click, mnImportIBMSC.Click + 'KMouseDown = -1 + ReDim SelectedNotes(-1) + KMouseOver = -1 + If ClosingPopSave() Then Return + + Dim xDOpen As New OpenFileDialog With { + .Filter = Strings.FileType.IBMSC & "|*.ibmsc", + .DefaultExt = "ibmsc", + .InitialDirectory = IIf(ExcludeFileName(FileName) = String.Empty, InitPath, ExcludeFileName(FileName)) + } + + If xDOpen.ShowDialog = Forms.DialogResult.Cancel Then Return + InitPath = ExcludeFileName(xDOpen.FileName) + SetFileName("Imported_" & GetFileName(xDOpen.FileName)) + OpeniBMSC(xDOpen.FileName) + NewRecent(xDOpen.FileName) + SetIsSaved(False) + 'pIsSaved.Visible = Not IsSaved + End Sub + + Private Sub TBImportSM_Click(sender As Object, e As EventArgs) Handles TBImportSM.Click, mnImportSM.Click + 'KMouseDown = -1 + ReDim SelectedNotes(-1) + KMouseOver = -1 + If ClosingPopSave() Then Exit Sub + + Dim xDOpen As New OpenFileDialog With { + .Filter = Strings.FileType.SM & "|*.sm", + .DefaultExt = "sm", + .InitialDirectory = IIf(ExcludeFileName(FileName) = String.Empty, InitPath, ExcludeFileName(FileName)) + } + + If xDOpen.ShowDialog = Forms.DialogResult.Cancel Then Exit Sub + If OpenSM(File.ReadAllText(xDOpen.FileName, TextEncoding)) Then Exit Sub + InitPath = ExcludeFileName(xDOpen.FileName) + SetFileName("Untitled.bms") + ClearUndo() + SetIsSaved(False) + 'pIsSaved.Visible = Not IsSaved + End Sub + + Private Sub TBSave_ButtonClick(sender As Object, e As EventArgs) Handles TBSave.ButtonClick, mnSave.Click + 'KMouseDown = -1 + ReDim SelectedNotes(-1) + KMouseOver = -1 + + If ExcludeFileName(FileName) = String.Empty Then + Dim xDSave As New SaveFileDialog With { + .Filter = Strings.FileType._bms & "|*.bms;*.bme;*.bml;*.pms;*.txt|" & + Strings.FileType.BMS & "|*.bms|" & + Strings.FileType.BME & "|*.bme|" & + Strings.FileType.BML & "|*.bml|" & + Strings.FileType.PMS & "|*.pms|" & + Strings.FileType.TXT & "|*.txt|" & + Strings.FileType._all & "|*.*", + .DefaultExt = "bms", + .InitialDirectory = InitPath + } + + If xDSave.ShowDialog = Forms.DialogResult.Cancel Then Exit Sub + InitPath = ExcludeFileName(xDSave.FileName) + SetFileName(xDSave.FileName) + End If + Dim xStrAll = SaveBMS() + My.Computer.FileSystem.WriteAllText(FileName, xStrAll, False, TextEncoding) + NewRecent(FileName) + SetFileName(FileName) + SetIsSaved(True) + 'pIsSaved.Visible = Not IsSaved + If BeepWhileSaved Then Beep() + End Sub + + Private Sub TBSaveAs_Click(sender As Object, e As EventArgs) Handles TBSaveAs.Click, mnSaveAs.Click + 'KMouseDown = -1 + ReDim SelectedNotes(-1) + KMouseOver = -1 + + Dim xDSave As New SaveFileDialog With { + .Filter = Strings.FileType._bms & "|*.bms;*.bme;*.bml;*.pms;*.txt|" & + Strings.FileType.BMS & "|*.bms|" & + Strings.FileType.BME & "|*.bme|" & + Strings.FileType.BML & "|*.bml|" & + Strings.FileType.PMS & "|*.pms|" & + Strings.FileType.TXT & "|*.txt|" & + Strings.FileType._all & "|*.*", + .DefaultExt = "bms", + .InitialDirectory = IIf(ExcludeFileName(FileName) = String.Empty, InitPath, ExcludeFileName(FileName)) + } + + If xDSave.ShowDialog = Forms.DialogResult.Cancel Then Exit Sub + InitPath = ExcludeFileName(xDSave.FileName) + SetFileName(xDSave.FileName) + Dim xStrAll As String = SaveBMS() + My.Computer.FileSystem.WriteAllText(FileName, xStrAll, False, TextEncoding) + NewRecent(FileName) + SetFileName(FileName) + SetIsSaved(True) + 'pIsSaved.Visible = Not IsSaved + If BeepWhileSaved Then Beep() + End Sub + + Private Sub TBExportIBMSC_Click(sender As Object, e As EventArgs) Handles TBExportIBMSC.Click, mnExportIBMSC.Click + 'KMouseDown = -1 + ReDim SelectedNotes(-1) + KMouseOver = -1 + + Dim xDSave As New SaveFileDialog With { + .Filter = Strings.FileType.IBMSC & "|*.ibmsc", + .DefaultExt = "ibmsc", + .InitialDirectory = IIf(ExcludeFileName(FileName) = String.Empty, InitPath, ExcludeFileName(FileName)) + } + If xDSave.ShowDialog = Forms.DialogResult.Cancel Then Exit Sub + + SaveiBMSC(xDSave.FileName) + 'My.Computer.FileSystem.WriteAllText(xDSave.FileName, xStrAll, False, TextEncoding) + NewRecent(FileName) + If BeepWhileSaved Then Beep() + End Sub + + Private Sub TBExportBMSON_Click(sender As Object, e As EventArgs) Handles TBExportBMSON.Click, mnExportBMSON.Click + 'KMouseDown = -1 + ReDim SelectedNotes(-1) + KMouseOver = -1 + + Dim xDSave As New SaveFileDialog With { + .Filter = Strings.FileType.BMSON & "|*.bmson", + .DefaultExt = "bmson", + .InitialDirectory = IIf(ExcludeFileName(FileName) = String.Empty, InitPath, ExcludeFileName(FileName)) + } + If xDSave.ShowDialog = Forms.DialogResult.Cancel Then Exit Sub + + SaveBMSON(xDSave.FileName) + 'My.Computer.FileSystem.WriteAllText(xDSave.FileName, xStrAll, False, TextEncoding) + NewRecent(FileName) + If BeepWhileSaved Then Beep() + End Sub + + Private Sub VSGotFocus(sender As Object, e As EventArgs) Handles MainPanelScroll.GotFocus, LeftPanelScroll.GotFocus, RightPanelScroll.GotFocus + PanelFocus = sender.Tag + Dim unused = spMain(PanelFocus).Focus() + End Sub + + Private Sub VSValueChanged(sender As Object, e As EventArgs) Handles MainPanelScroll.ValueChanged, LeftPanelScroll.ValueChanged, RightPanelScroll.ValueChanged + Dim iI As Integer = sender.Tag + + ' az: We got a wheel event when we're zooming in/out + If My.Computer.Keyboard.CtrlKeyDown Then + sender.Value = VSValue ' Undo the scroll + Exit Sub + End If + + If iI = PanelFocus And Not LastMouseDownLocation = New Point(-1, -1) And Not VSValue = -1 Then LastMouseDownLocation.Y += (VSValue - sender.Value) * gxHeight + PanelVScroll(iI) = sender.Value + + If spLock((iI + 1) Mod 3) Then + Dim xVS As Integer = PanelVScroll(iI) + spDiff(iI) + If xVS > 0 Then xVS = 0 + If xVS < MainPanelScroll.Minimum Then xVS = MainPanelScroll.Minimum + Select Case iI + Case 0 : MainPanelScroll.Value = xVS + Case 1 : RightPanelScroll.Value = xVS + Case 2 : LeftPanelScroll.Value = xVS + End Select + End If + + If spLock((iI + 2) Mod 3) Then + Dim xVS As Integer = PanelVScroll(iI) - spDiff((iI + 2) Mod 3) + If xVS > 0 Then xVS = 0 + If xVS < MainPanelScroll.Minimum Then xVS = MainPanelScroll.Minimum + Select Case iI + Case 0 : RightPanelScroll.Value = xVS + Case 1 : LeftPanelScroll.Value = xVS + Case 2 : MainPanelScroll.Value = xVS + End Select + End If + + spDiff(iI) = PanelVScroll((iI + 1) Mod 3) - PanelVScroll(iI) + spDiff((iI + 2) Mod 3) = PanelVScroll(iI) - PanelVScroll((iI + 2) Mod 3) + + VSValue = sender.Value + RefreshPanel(iI, spMain(iI).DisplayRectangle) + End Sub + + Private Sub cVSLock_CheckedChanged(sender As Object, e As EventArgs) Handles cVSLockL.CheckedChanged, cVSLock.CheckedChanged, cVSLockR.CheckedChanged + Dim iI As Integer = sender.Tag + spLock(iI) = sender.Checked + If Not spLock(iI) Then Return + + spDiff(iI) = PanelVScroll((iI + 1) Mod 3) - PanelVScroll(iI) + spDiff((iI + 2) Mod 3) = PanelVScroll(iI) - PanelVScroll((iI + 2) Mod 3) + + 'POHeaderB.Text = spDiff(0) & "_" & spDiff(1) & "_" & spDiff(2) + End Sub + + Private Sub HSGotFocus(sender As Object, e As EventArgs) Handles HS.GotFocus, HSL.GotFocus, HSR.GotFocus + PanelFocus = sender.Tag + Dim unused = spMain(PanelFocus).Focus() + End Sub + + Private Sub HSValueChanged(sender As Object, e As EventArgs) Handles HS.ValueChanged, HSL.ValueChanged, HSR.ValueChanged + Dim iI As Integer = sender.Tag + If Not LastMouseDownLocation = New Point(-1, -1) And Not HSValue = -1 Then LastMouseDownLocation.X += (HSValue - sender.Value) * gxWidth + PanelhBMSCROLL(iI) = sender.Value + HSValue = sender.Value + RefreshPanel(iI, spMain(iI).DisplayRectangle) + End Sub + + Private Sub TBSelect_Click(sender As Object, e As EventArgs) Handles TBSelect.Click, mnSelect.Click + TBSelect.Checked = True + TBWrite.Checked = False + TBTimeSelect.Checked = False + mnSelect.Checked = True + mnWrite.Checked = False + mnTimeSelect.Checked = False + + FStatus2.Visible = False + FStatus.Visible = True + + ShouldDrawTempNote = False + SelectedColumn = -1 + TempVPosition = -1 + TempLength = 0 + + vSelStart = MeasureBottom(MeasureAtDisplacement(-PanelVScroll(PanelFocus)) + 1) + vSelLength = 0 + + RefreshPanelAll() + POStatusRefresh() + End Sub + + Private Sub TBWrite_Click(sender As Object, e As EventArgs) Handles TBWrite.Click, mnWrite.Click + TBSelect.Checked = False + TBWrite.Checked = True + TBTimeSelect.Checked = False + mnSelect.Checked = False + mnWrite.Checked = True + mnTimeSelect.Checked = False + + FStatus2.Visible = False + FStatus.Visible = True + + ShouldDrawTempNote = True + SelectedColumn = -1 + TempVPosition = -1 + TempLength = 0 + + vSelStart = MeasureBottom(MeasureAtDisplacement(-PanelVScroll(PanelFocus)) + 1) + vSelLength = 0 + + RefreshPanelAll() + POStatusRefresh() + End Sub + + Private Sub TBPostEffects_Click(sender As Object, e As EventArgs) Handles TBTimeSelect.Click, mnTimeSelect.Click + TBSelect.Checked = False + TBWrite.Checked = False + TBTimeSelect.Checked = True + mnSelect.Checked = False + mnWrite.Checked = False + mnTimeSelect.Checked = True + + FStatus.Visible = False + FStatus2.Visible = True + + vSelMouseOverLine = 0 + ShouldDrawTempNote = False + SelectedColumn = -1 + TempVPosition = -1 + TempLength = 0 + ValidateSelection() + + Dim xI1 As Integer + For xI1 = 0 To UBound(Notes) + Notes(xI1).Selected = False + Next + RefreshPanelAll() + POStatusRefresh() + End Sub + + Private Sub CGHeight_ValueChanged(sender As Object, e As EventArgs) Handles CGHeight.ValueChanged + gxHeight = CGHeight.Value + CGHeight2.Value = IIf(CGHeight.Value * 4 < CGHeight2.Maximum, CGHeight.Value * 4, CGHeight2.Maximum) + RefreshPanelAll() + End Sub + + Private Sub CGHeight2_Scroll(sender As Object, e As EventArgs) Handles CGHeight2.Scroll + CGHeight.Value = CGHeight2.Value / 4 + End Sub + + Private Sub CGWidth_ValueChanged(sender As Object, e As EventArgs) Handles CGWidth.ValueChanged + gxWidth = CGWidth.Value + CGWidth2.Value = IIf(CGWidth.Value * 4 < CGWidth2.Maximum, CGWidth.Value * 4, CGWidth2.Maximum) + + HS.LargeChange = PMainIn.Width / gxWidth + If HS.Value > HS.Maximum - HS.LargeChange + 1 Then HS.Value = HS.Maximum - HS.LargeChange + 1 + HSL.LargeChange = PMainInL.Width / gxWidth + If HSL.Value > HSL.Maximum - HSL.LargeChange + 1 Then HSL.Value = HSL.Maximum - HSL.LargeChange + 1 + HSR.LargeChange = PMainInR.Width / gxWidth + If HSR.Value > HSR.Maximum - HSR.LargeChange + 1 Then HSR.Value = HSR.Maximum - HSR.LargeChange + 1 + + RefreshPanelAll() + End Sub + + Private Sub CGWidth2_Scroll(sender As Object, e As EventArgs) Handles CGWidth2.Scroll + CGWidth.Value = CGWidth2.Value / 4 + End Sub + + Private Sub CGDivide_ValueChanged(sender As Object, e As EventArgs) Handles CGDivide.ValueChanged + gDivide = CGDivide.Value + RefreshPanelAll() + End Sub + Private Sub CGSub_ValueChanged(sender As Object, e As EventArgs) Handles CGSub.ValueChanged + gSub = CGSub.Value + RefreshPanelAll() + End Sub + Private Sub BGSlash_Click(sender As Object, e As EventArgs) Handles BGSlash.Click + Dim xd As Integer = Val(InputBox(Strings.Messages.PromptSlashValue, , gSlash)) + If xd = 0 Then Exit Sub + If xd > CGDivide.Maximum Then xd = CGDivide.Maximum + If xd < CGDivide.Minimum Then xd = CGDivide.Minimum + gSlash = xd + End Sub + + + Private Sub CGSnap_CheckedChanged(sender As Object, e As EventArgs) Handles CGSnap.CheckedChanged + gSnap = CGSnap.Checked + RefreshPanelAll() + End Sub + + Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick + Dim xI1 As Integer + + Select Case PanelFocus + Case 0 + With LeftPanelScroll + xI1 = .Value + (tempY / 5 / gxHeight) + If xI1 > 0 Then xI1 = 0 + If xI1 < .Minimum Then xI1 = .Minimum + .Value = xI1 + End With + With HSL + xI1 = .Value + (tempX / 10 / gxWidth) + If xI1 > .Maximum - .LargeChange + 1 Then xI1 = .Maximum - .LargeChange + 1 + If xI1 < .Minimum Then xI1 = .Minimum + .Value = xI1 + End With + + Case 1 + With MainPanelScroll + xI1 = .Value + (tempY / 5 / gxHeight) + If xI1 > 0 Then xI1 = 0 + If xI1 < .Minimum Then xI1 = .Minimum + .Value = xI1 + End With + With HS + xI1 = .Value + (tempX / 10 / gxWidth) + If xI1 > .Maximum - .LargeChange + 1 Then xI1 = .Maximum - .LargeChange + 1 + If xI1 < .Minimum Then xI1 = .Minimum + .Value = xI1 + End With + + Case 2 + With RightPanelScroll + xI1 = .Value + (tempY / 5 / gxHeight) + If xI1 > 0 Then xI1 = 0 + If xI1 < .Minimum Then xI1 = .Minimum + .Value = xI1 + End With + With HSR + xI1 = .Value + (tempX / 10 / gxWidth) + If xI1 > .Maximum - .LargeChange + 1 Then xI1 = .Maximum - .LargeChange + 1 + If xI1 < .Minimum Then xI1 = .Minimum + .Value = xI1 + End With + End Select + + Dim xMEArgs As New MouseEventArgs(MouseButtons.Left, 0, MouseMoveStatus.X, MouseMoveStatus.Y, 0) + PMainInMouseMove(spMain(PanelFocus), xMEArgs) + + End Sub + + Private Sub TimerMiddle_Tick(sender As Object, e As EventArgs) Handles TimerMiddle.Tick + If Not MiddleButtonClicked Then TimerMiddle.Enabled = False : Return + + Dim xI1 As Integer + + Select Case PanelFocus + Case 0 + With LeftPanelScroll + xI1 = .Value + ((Cursor.Position.Y - MiddleButtonLocation.Y) / 5 / gxHeight) + If xI1 > 0 Then xI1 = 0 + If xI1 < .Minimum Then xI1 = .Minimum + .Value = xI1 + End With + With HSL + xI1 = .Value + ((Cursor.Position.X - MiddleButtonLocation.X) / 5 / gxWidth) + If xI1 > .Maximum - .LargeChange + 1 Then xI1 = .Maximum - .LargeChange + 1 + If xI1 < .Minimum Then xI1 = .Minimum + .Value = xI1 + End With + + Case 1 + With MainPanelScroll + xI1 = .Value + ((Cursor.Position.Y - MiddleButtonLocation.Y) / 5 / gxHeight) + If xI1 > 0 Then xI1 = 0 + If xI1 < .Minimum Then xI1 = .Minimum + .Value = xI1 + End With + With HS + xI1 = .Value + ((Cursor.Position.X - MiddleButtonLocation.X) / 5 / gxWidth) + If xI1 > .Maximum - .LargeChange + 1 Then xI1 = .Maximum - .LargeChange + 1 + If xI1 < .Minimum Then xI1 = .Minimum + .Value = xI1 + End With + + Case 2 + With RightPanelScroll + xI1 = .Value + ((Cursor.Position.Y - MiddleButtonLocation.Y) / 5 / gxHeight) + If xI1 > 0 Then xI1 = 0 + If xI1 < .Minimum Then xI1 = .Minimum + .Value = xI1 + End With + With HSR + xI1 = .Value + ((Cursor.Position.X - MiddleButtonLocation.X) / 5 / gxWidth) + If xI1 > .Maximum - .LargeChange + 1 Then xI1 = .Maximum - .LargeChange + 1 + If xI1 < .Minimum Then xI1 = .Minimum + .Value = xI1 + End With + End Select + + Dim xMEArgs As New MouseEventArgs(MouseButtons.Left, 0, MouseMoveStatus.X, MouseMoveStatus.Y, 0) + PMainInMouseMove(spMain(PanelFocus), xMEArgs) + End Sub + + Private Sub ValidateWavListView() + Try + Dim xRect As Rectangle = LWAV.GetItemRectangle(LWAV.SelectedIndex) + If xRect.Top + xRect.Height > LWAV.DisplayRectangle.Height Then Dim unused = SendMessage(LWAV.Handle, &H115, 1, 0) + Catch ex As Exception + End Try + End Sub + + Private Sub ValidateBmpListView() + Try + Dim xRect As Rectangle = LBMP.GetItemRectangle(LBMP.SelectedIndex) + If xRect.Top + xRect.Height > LBMP.DisplayRectangle.Height Then Dim unused = SendMessage(LBMP.Handle, &H115, 1, 0) + Catch ex As Exception + End Try + End Sub + + Private Sub LWAV_Click(sender As Object, e As EventArgs) Handles LWAV.Click + If TBWrite.Checked Then FSW.Text = C10to36(LWAV.SelectedIndex + 1) + + PreviewNote(String.Empty, True) + If Not PreviewOnClick Then Exit Sub + If hWAV(LWAV.SelectedIndex + 1) = String.Empty Then Exit Sub + + Dim xFileLocation As String = IIf(ExcludeFileName(FileName) = String.Empty, InitPath, ExcludeFileName(FileName)) & "\" & hWAV(LWAV.SelectedIndex + 1) + PreviewNote(xFileLocation, False) + End Sub + + Private Sub LWAV_DoubleClick(sender As Object, e As EventArgs) Handles LWAV.DoubleClick + Dim xDWAV As New OpenFileDialog With { + .DefaultExt = "wav", + .Filter = Strings.FileType._wave & "|*.wav;*.ogg;*.mp3;*.flac|" & + Strings.FileType.WAV & "|*.wav|" & + Strings.FileType.OGG & "|*.ogg|" & + Strings.FileType.MP3 & "|*.mp3|" & + Strings.FileType.FLAC & "|*.flac|" & + Strings.FileType._all & "|*.*", + .InitialDirectory = IIf(ExcludeFileName(FileName) = String.Empty, InitPath, ExcludeFileName(FileName)) + } + + If xDWAV.ShowDialog = Forms.DialogResult.Cancel Then Exit Sub + InitPath = ExcludeFileName(xDWAV.FileName) + hWAV(LWAV.SelectedIndex + 1) = GetFileName(xDWAV.FileName) + LWAV.Items.Item(LWAV.SelectedIndex) = C10to36(LWAV.SelectedIndex + 1) & ": " & GetFileName(xDWAV.FileName) + If IsSaved Then SetIsSaved(False) + End Sub + + Private Sub LWAV_KeyDown(sender As Object, e As KeyEventArgs) Handles LWAV.KeyDown + Select Case e.KeyCode + Case Keys.Delete + hWAV(LWAV.SelectedIndex + 1) = String.Empty + LWAV.Items.Item(LWAV.SelectedIndex) = C10to36(LWAV.SelectedIndex + 1) & ": " + If IsSaved Then SetIsSaved(False) + End Select + End Sub + + Private Sub LBMP_DoubleClick(sender As Object, e As EventArgs) Handles LBMP.DoubleClick + Dim xDBMP As New OpenFileDialog With { + .DefaultExt = "bmp", + .Filter = Strings.FileType._image & "|*.bmp;*.png;*.jpg;*.jpeg;.gif|" & + Strings.FileType._movie & "|*.mpg;*.m1v;*.m2v;*.avi;*.mp4;*.m4v;*.wmv;*.webm|" & + Strings.FileType.BMP & "|*.bmp|" & + Strings.FileType.PNG & "|*.png|" & + Strings.FileType.JPG & "|*.jpg;*.jpeg|" & + Strings.FileType.GIF & "|*.gif|" & + Strings.FileType.MP4 & "|*.mp4;*.m4v|" & + Strings.FileType.AVI & "|*.avi|" & + Strings.FileType.MPG & "|*.mpg;*.m1v;*.m2v|" & + Strings.FileType.WMV & "|*.wmv|" & + Strings.FileType.WEBM & "|*.webm|" & + Strings.FileType._all & "|*.*", + .InitialDirectory = IIf(ExcludeFileName(FileName) = String.Empty, InitPath, ExcludeFileName(FileName)) + } + + If xDBMP.ShowDialog = Forms.DialogResult.Cancel Then Exit Sub + InitPath = ExcludeFileName(xDBMP.FileName) + hBMP(LBMP.SelectedIndex + 1) = GetFileName(xDBMP.FileName) + LBMP.Items.Item(LBMP.SelectedIndex) = C10to36(LBMP.SelectedIndex + 1) & ": " & GetFileName(xDBMP.FileName) + If IsSaved Then SetIsSaved(False) + End Sub + + Private Sub LBMP_KeyDown(sender As Object, e As KeyEventArgs) Handles LBMP.KeyDown + Select Case e.KeyCode + Case Keys.Delete + hBMP(LBMP.SelectedIndex + 1) = String.Empty + LBMP.Items.Item(LBMP.SelectedIndex) = C10to36(LBMP.SelectedIndex + 1) & ": " + If IsSaved Then SetIsSaved(False) + End Select + End Sub + + Private Sub TBErrorCheck_Click(sender As Object, e As EventArgs) Handles TBErrorCheck.Click, mnErrorCheck.Click + ErrorCheck = sender.Checked + TBErrorCheck.Checked = ErrorCheck + mnErrorCheck.Checked = ErrorCheck + TBErrorCheck.Image = IIf(TBErrorCheck.Checked, My.Resources.x16CheckError, My.Resources.x16CheckErrorN) + mnErrorCheck.Image = IIf(TBErrorCheck.Checked, My.Resources.x16CheckError, My.Resources.x16CheckErrorN) + RefreshPanelAll() + End Sub + + Private Sub TBPreviewOnClick_Click(sender As Object, e As EventArgs) Handles TBPreviewOnClick.Click, mnPreviewOnClick.Click + PreviewNote(String.Empty, True) + PreviewOnClick = sender.Checked + TBPreviewOnClick.Checked = PreviewOnClick + mnPreviewOnClick.Checked = PreviewOnClick + TBPreviewOnClick.Image = IIf(PreviewOnClick, My.Resources.x16PreviewOnClick, My.Resources.x16PreviewOnClickN) + mnPreviewOnClick.Image = IIf(PreviewOnClick, My.Resources.x16PreviewOnClick, My.Resources.x16PreviewOnClickN) + End Sub + + Private Sub TBChangePlaySide_Click(sender As Object, e As EventArgs) Handles TBChangePlaySide.Click, mnChangePlaySide.Click + Rscratch = sender.Checked + ChangePlaySide(True) + TBChangePlaySide.Checked = Rscratch + mnChangePlaySide.Checked = Rscratch + TBChangePlaySide.Image = My.Resources.x16ChangePlaySide + mnChangePlaySide.Image = My.Resources.x16ChangePlaySide + RefreshPanelAll() + End Sub + + 'Private Sub TBPreviewErrorCheck_Click( sender As System.Object, e As EventArgs) + ' PreviewErrorCheck = TBPreviewErrorCheck.Checked + ' TBPreviewErrorCheck.Image = IIf(PreviewErrorCheck, My.Resources.x16PreviewCheck, My.Resources.x16PreviewCheckN) + 'End Sub + + Private Sub TBShowFileName_Click(sender As Object, e As EventArgs) Handles TBShowFileName.Click, mnShowFileName.Click + ShowFileName = sender.Checked + TBShowFileName.Checked = ShowFileName + mnShowFileName.Checked = ShowFileName + TBShowFileName.Image = IIf(ShowFileName, My.Resources.x16ShowFileName, My.Resources.x16ShowFileNameN) + mnShowFileName.Image = IIf(ShowFileName, My.Resources.x16ShowFileName, My.Resources.x16ShowFileNameN) + RefreshPanelAll() + End Sub + + Private Sub TBCut_Click(sender As Object, e As EventArgs) Handles TBCut.Click, mnCut.Click + Dim xUndo As UndoRedo.LinkedURCmd = Nothing + Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void + Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo + RedoRemoveNoteSelected(True, xUndo, xRedo) + 'Dim xRedo As String = sCmdKDs() + 'Dim xUndo As String = sCmdKs(True) + + Try + CopyNotes(False) + RemoveNotes(False) + AddUndo(xUndo, xBaseRedo.Next) + Catch ex As Exception + Dim unused = MsgBox(ex.Message, MsgBoxStyle.Exclamation, Strings.Messages.Err) + End Try + SortByVPositionInsertion() + UpdatePairing() + CalculateTotalPlayableNotes() + RefreshPanelAll() + POStatusRefresh() + CalculateGreatestVPosition() + End Sub + + Private Sub TBCopy_Click(sender As Object, e As EventArgs) Handles TBCopy.Click, mnCopy.Click + Try + CopyNotes() + Catch ex As Exception + Dim unused = MsgBox(ex.Message, MsgBoxStyle.Exclamation, Strings.Messages.Err) + End Try + RefreshPanelAll() + POStatusRefresh() + End Sub + + Private Sub TBPaste_Click(sender As Object, e As EventArgs) Handles TBPaste.Click, mnPaste.Click + AddNotesFromClipboard() + + Dim xUndo As UndoRedo.LinkedURCmd = Nothing + Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void + Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo + RedoAddNoteSelected(True, xUndo, xRedo) + AddUndo(xUndo, xBaseRedo.Next) + + 'AddUndo(sCmdKDs(), sCmdKs(True)) + + SortByVPositionInsertion() + UpdatePairing() + CalculateTotalPlayableNotes() + RefreshPanelAll() + POStatusRefresh() + CalculateGreatestVPosition() + End Sub + + 'Private Function pArgPath( I As Integer) + ' Return Mid(pArgs(I), 1, InStr(pArgs(I), vbCrLf) - 1) + 'End Function + + Private Function GetFileName(s As String) As String + Dim fslash As Integer = InStrRev(s, "/") + Dim bslash As Integer = InStrRev(s, "\") + + Return Mid(s, IIf(fslash > bslash, fslash, bslash) + 1) + + End Function + + Private Function ExcludeFileName(s As String) As String + Dim fslash As Integer = InStrRev(s, "/") + Dim bslash As Integer = InStrRev(s, "\") + If (bslash Or fslash) = 0 Then Return String.Empty + Return Mid(s, 1, IIf(fslash > bslash, fslash, bslash) - 1) + End Function + + Private Sub PlayerMissingPrompt() + Dim xArg As PlayerArguments = pArgs(CurrentPlayer) + Dim unused = MsgBox(Strings.Messages.CannotFind.Replace("{}", PrevCodeToReal(xArg.Path)) & vbCrLf & + Strings.Messages.PleaseRespecifyPath, MsgBoxStyle.Critical, Strings.Messages.PlayerNotFound) + + Dim xDOpen As New OpenFileDialog With { + .InitialDirectory = IIf(ExcludeFileName(PrevCodeToReal(xArg.Path)) = String.Empty, + My.Application.Info.DirectoryPath, + ExcludeFileName(PrevCodeToReal(xArg.Path))), + .FileName = PrevCodeToReal(xArg.Path), + .Filter = Strings.FileType.EXE & "|*.exe", + .DefaultExt = "exe" + } + If xDOpen.ShowDialog = Forms.DialogResult.Cancel Then Exit Sub + + 'pArgs(CurrentPlayer) = Replace(xDOpen.FileName, My.Application.Info.DirectoryPath, "") & _ + ' Mid(pArgs(CurrentPlayer), InStr(pArgs(CurrentPlayer), vbCrLf)) + 'xStr = Split(pArgs(CurrentPlayer), vbCrLf) + pArgs(CurrentPlayer).Path = Replace(xDOpen.FileName, My.Application.Info.DirectoryPath, "") + xArg = pArgs(CurrentPlayer) + End Sub + + Private Sub TBPlay_Click(sender As Object, e As EventArgs) Handles TBPlay.Click, mnPlay.Click + 'Dim xStr() As String = Split(pArgs(CurrentPlayer), vbCrLf) + Dim xArg As PlayerArguments = pArgs(CurrentPlayer) + + If Not File.Exists(PrevCodeToReal(xArg.Path)) Then + PlayerMissingPrompt() + xArg = pArgs(CurrentPlayer) + End If + + ' az: Treat it like we cancelled the operation + If Not File.Exists(PrevCodeToReal(xArg.Path)) Then + Exit Sub + End If + + Dim xStrAll As String = SaveBMS() + Dim xFileName As String = IIf(Not PathIsValid(FileName), + IIf(InitPath = String.Empty, My.Application.Info.DirectoryPath, InitPath), + ExcludeFileName(FileName)) & "\___TempBMS.bms" + My.Computer.FileSystem.WriteAllText(xFileName, xStrAll, False, TextEncoding) + + AddTempFileList(xFileName) + Dim unused = Process.Start(PrevCodeToReal(xArg.Path), PrevCodeToReal(xArg.aHere)) + End Sub + + Private Sub TBPlayB_Click(sender As Object, e As EventArgs) Handles TBPlayB.Click, mnPlayB.Click + 'Dim xStr() As String = Split(pArgs(CurrentPlayer), vbCrLf) + Dim xArg As PlayerArguments = pArgs(CurrentPlayer) + + If Not File.Exists(PrevCodeToReal(xArg.Path)) Then + PlayerMissingPrompt() + xArg = pArgs(CurrentPlayer) + End If + + If Not File.Exists(PrevCodeToReal(xArg.Path)) Then + Exit Sub + End If + + Dim xStrAll As String = SaveBMS() + Dim xFileName As String = IIf(Not PathIsValid(FileName), + IIf(InitPath = String.Empty, My.Application.Info.DirectoryPath, InitPath), + ExcludeFileName(FileName)) & "\___TempBMS.bms" + My.Computer.FileSystem.WriteAllText(xFileName, xStrAll, False, TextEncoding) + + AddTempFileList(xFileName) + + Dim unused = Process.Start(PrevCodeToReal(xArg.Path), PrevCodeToReal(xArg.aBegin)) + End Sub + + Private Sub TBStop_Click(sender As Object, e As EventArgs) Handles TBStop.Click, mnStop.Click + 'Dim xStr() As String = Split(pArgs(CurrentPlayer), vbCrLf) + Dim xArg As PlayerArguments = pArgs(CurrentPlayer) + + If Not File.Exists(PrevCodeToReal(xArg.Path)) Then + PlayerMissingPrompt() + xArg = pArgs(CurrentPlayer) + End If + + If Not File.Exists(PrevCodeToReal(xArg.Path)) Then + Exit Sub + End If + + Dim unused = Process.Start(PrevCodeToReal(xArg.Path), PrevCodeToReal(xArg.aStop)) + End Sub + + Private Sub AddTempFileList(s As String) + Dim xAdd As Boolean = True + If pTempFileNames IsNot Nothing Then + For Each xStr1 As String In pTempFileNames + If xStr1 = s Then xAdd = False : Exit For + Next + End If + + If xAdd Then + ReDim Preserve pTempFileNames(UBound(pTempFileNames) + 1) + pTempFileNames(UBound(pTempFileNames)) = s + End If + End Sub + Private Sub TBinfo_Click(sender As Object, e As EventArgs) Handles mnStatistics.Click, TBStatistics.Click + My.Forms.Chartinfo.Show() + End Sub + Public Sub TBStatistics_Click(sender As Object, e As EventArgs) + SortByVPositionInsertion() + UpdatePairing() + + Dim data(6, 5) As Integer + For i = 1 To UBound(Notes) + With Notes(i) + Dim row = -1 + If .ColumnIndex = niBPM Then + row = 0 + ElseIf .ColumnIndex = niSTOP Then + row = 1 + ElseIf .ColumnIndex = niSCROLL Then + row = 2 + ElseIf .ColumnIndex >= niA1 AndAlso .ColumnIndex <= niAQ Then + row = 3 + ElseIf .ColumnIndex >= niD1 AndAlso .ColumnIndex <= niDQ Then + row = 4 + ElseIf .ColumnIndex >= niB Then + row = 5 + Else + row = 6 + End If StartCount: If Not NTInput Then - If Not .LongNote Then data(row, 0) += 1 - If .LongNote Then data(row, 1) += 1 - If .Value \ 10000 = LnObj Then data(row, 1) += 1 - If .Hidden Then data(row, 2) += 1 - If .Landmine Then data(row, 3) += 1 - If .HasError Then data(row, 4) += 1 - data(row, 5) += 1 - - Else - Dim noteUnit = 1 - If .Length = 0 Then data(row, 0) += 1 - If .Length <> 0 Then data(row, 1) += 2 : noteUnit = 2 - - If .Value \ 10000 = LnObj Then data(row, 1) += noteUnit - If .Hidden Then data(row, 2) += noteUnit - If .Landmine Then data(row, 3) += noteUnit - If .HasError Then data(row, 4) += noteUnit - data(row, 5) += noteUnit - - End If - - If row <> 6 Then row = 6 : GoTo StartCount - End With - Next - - Dim dStat As New dgStatistics(data) - Dim unused = dStat.ShowDialog - End Sub - - ''' - ''' Remark: Pls sort and updatepairing before this process. - ''' - - Private Sub CalculateTotalPlayableNotes() - Dim xI1 As Integer - Dim xIAll As Integer = 0 - - If Not NTInput Then - For xI1 = 1 To UBound(Notes) - If Notes(xI1).ColumnIndex >= niA1 AndAlso Notes(xI1).ColumnIndex <= niAQ Then xIAll += 1 - If Notes(xI1).ColumnIndex >= niD1 AndAlso Notes(xI1).ColumnIndex <= niDQ AndAlso column(Notes(xI1).ColumnIndex).isVisible Then xIAll += 1 - Next - - Else - For xI1 = 1 To UBound(Notes) - If Notes(xI1).ColumnIndex >= niA1 And Notes(xI1).ColumnIndex <= niAQ Then - xIAll += 1 - If Notes(xI1).Length <> 0 Then xIAll += 1 - End If - If Notes(xI1).ColumnIndex >= niD1 And Notes(xI1).ColumnIndex <= niDQ AndAlso column(Notes(xI1).ColumnIndex).isVisible Then - xIAll += 1 - If Notes(xI1).Length <> 0 Then xIAll += 1 - End If - Next - - End If - - TBStatistics.Text = xIAll - End Sub - - Private Function CalculateTotalNotes() As Integer - Dim xI1 As Integer - Dim xIAll As Integer = 0 - - For xI1 = 1 To UBound(Notes) - If Notes(xI1).ColumnIndex >= niA1 AndAlso Notes(xI1).ColumnIndex <= niAQ AndAlso - Not Notes(xI1).Hidden AndAlso Not Notes(xI1).Landmine AndAlso column(Notes(xI1).ColumnIndex).isVisible Then - xIAll += 1 - End If - If Notes(xI1).ColumnIndex >= niD1 AndAlso Notes(xI1).ColumnIndex <= niDQ AndAlso - Not Notes(xI1).Hidden AndAlso Not Notes(xI1).Landmine AndAlso column(Notes(xI1).ColumnIndex).isVisible Then - xIAll += 1 - End If - Next - - Return xIAll - End Function - - Public Function GetMouseVPosition(Optional snap As Boolean = True) - Dim panHeight = spMain(PanelFocus).Height - Dim panDisplacement = PanelVScroll(PanelFocus) - Dim vpos = (panHeight - (panDisplacement * gxHeight) - MouseMoveStatus.Y - 1) / gxHeight - Return If(snap, SnapToGrid(vpos), DirectCast(vpos, Object)) - End Function - - Private Sub POStatusRefresh() - - If TBSelect.Checked Then - Dim xI1 As Integer = KMouseOver - If xI1 < 0 Then - - TempVPosition = GetMouseVPosition(gSnap) - - SelectedColumn = GetColumnAtX(MouseMoveStatus.X, PanelhBMSCROLL(PanelFocus)) - - Dim xMeasure As Integer = MeasureAtDisplacement(TempVPosition) - Dim xMLength As Double = MeasureLength(xMeasure) - Dim xVposMod As Double = TempVPosition - MeasureBottom(xMeasure) - Dim xGCD As Double = GCD(IIf(xVposMod = 0, xMLength, xVposMod), xMLength) - - FSP1.Text = (xVposMod * gDivide / 192).ToString & " / " & (xMLength * gDivide / 192).ToString & " " - FSP2.Text = xVposMod.ToString & " / " & xMLength & " " - FSP3.Text = CInt(xVposMod / xGCD).ToString & " / " & CInt(xMLength / xGCD).ToString & " " - FSP4.Text = TempVPosition.ToString() & " " - TimeStatusLabel.Text = GetTimeFromVPosition(TempVPosition).ToString("F4") - FSC.Text = nTitle(SelectedColumn) - FSW.Text = String.Empty - FSM.Text = Add3Zeros(xMeasure) - FST.Text = String.Empty - FSH.Text = String.Empty - FSL.Text = String.Empty - FSE.Text = String.Empty - - Else - Dim xMeasure As Integer = MeasureAtDisplacement(Notes(xI1).VPosition) - Dim xMLength As Double = MeasureLength(xMeasure) - Dim xVposMod As Double = Notes(xI1).VPosition - MeasureBottom(xMeasure) - Dim xGCD As Double = GCD(IIf(xVposMod = 0, xMLength, xVposMod), xMLength) - - FSP1.Text = (xVposMod * gDivide / 192).ToString & " / " & (xMLength * gDivide / 192).ToString & " " - FSP2.Text = xVposMod.ToString & " / " & xMLength & " " - FSP3.Text = CInt(xVposMod / xGCD).ToString & " / " & CInt(xMLength / xGCD).ToString & " " - FSP4.Text = Notes(xI1).VPosition.ToString() & " " - TimeStatusLabel.Text = GetTimeFromVPosition(TempVPosition).ToString("F4") - FSC.Text = nTitle(Notes(xI1).ColumnIndex) - FSW.Text = IIf(IsColumnNumeric(Notes(xI1).ColumnIndex), - Notes(xI1).Value / 10000, - C10to36(Notes(xI1).Value \ 10000)) - FSM.Text = Add3Zeros(xMeasure) - FST.Text = IIf(NTInput, Strings.StatusBar.Length & " = " & Notes(xI1).Length, IIf(Notes(xI1).LongNote, Strings.StatusBar.LongNote, String.Empty)) - FSH.Text = IIf(Notes(xI1).Hidden, Strings.StatusBar.Hidden, String.Empty) - FSL.Text = IIf(Notes(xI1).Landmine, Strings.StatusBar.LandMine, String.Empty) - FSE.Text = IIf(Notes(xI1).HasError, Strings.StatusBar.Err, String.Empty) - - End If - - ElseIf TBWrite.Checked Then - If SelectedColumn < 0 Then Exit Sub - - Dim xMeasure As Integer = MeasureAtDisplacement(TempVPosition) - Dim xMLength As Double = MeasureLength(xMeasure) - Dim xVposMod As Double = TempVPosition - MeasureBottom(xMeasure) - Dim xGCD As Double = GCD(IIf(xVposMod = 0, xMLength, xVposMod), xMLength) - - FSP1.Text = (xVposMod * gDivide / 192).ToString & " / " & (xMLength * gDivide / 192).ToString & " " - FSP2.Text = xVposMod.ToString & " / " & xMLength & " " - FSP3.Text = CInt(xVposMod / xGCD).ToString & " / " & CInt(xMLength / xGCD).ToString & " " - FSP4.Text = TempVPosition.ToString() & " " - TimeStatusLabel.Text = GetTimeFromVPosition(TempVPosition).ToString("F4") - FSC.Text = nTitle(SelectedColumn) - If IsColumnSound(SelectedColumn) Then - FSW.Text = C10to36(LWAV.SelectedIndex + 1) - ElseIf IsColumnImage(SelectedColumn) Then - FSW.Text = C10to36(LBMP.SelectedIndex + 1) - Else - FSW.Text = String.Empty - End If - FSM.Text = Add3Zeros(xMeasure) - FST.Text = IIf(NTInput, TempLength, IIf(My.Computer.Keyboard.ShiftKeyDown And Not My.Computer.Keyboard.CtrlKeyDown, Strings.StatusBar.LongNote, String.Empty)) - FSH.Text = IIf(My.Computer.Keyboard.CtrlKeyDown And Not My.Computer.Keyboard.ShiftKeyDown, Strings.StatusBar.Hidden, String.Empty) - FSL.Text = IIf(My.Computer.Keyboard.ShiftKeyDown And My.Computer.Keyboard.CtrlKeyDown, Strings.StatusBar.LandMine, String.Empty) - - ElseIf TBTimeSelect.Checked Then - FSSS.Text = vSelStart - FSSL.Text = vSelLength - FSSH.Text = vSelHalf - - End If - FStatus.Invalidate() - End Sub - - Private Function GetTimeFromVPosition(vpos As Double) As Double - Dim timing_notes = (From note In Notes - Where note.ColumnIndex = niBPM Or note.ColumnIndex = niSTOP - Group By Column = note.ColumnIndex - Into NoteGroups = Group).ToDictionary(Function(x) x.Column, Function(x) x.NoteGroups) - - Dim bpm_notes = timing_notes.Item(niBPM) - - Dim stop_notes As IEnumerable(Of Note) = Nothing - - Dim value As IEnumerable(Of Note) = Nothing - If timing_notes.TryGetValue(niSTOP, value) Then - stop_notes = value - End If - - - Dim stop_contrib As Double - Dim bpm_contrib As Double - - For i = 0 To bpm_notes.Count() - 1 - ' az: sum bpm contribution first - Dim duration = 0.0 - Dim current_note = bpm_notes.ElementAt(i) - Dim notevpos = Math.Max(0, current_note.VPosition) - - If i + 1 <> bpm_notes.Count() Then - Dim next_note = bpm_notes.ElementAt(i + 1) - duration = next_note.VPosition - notevpos - Else - duration = vpos - notevpos - End If - - Dim current_bps = 60 / (current_note.Value / 10000) - bpm_contrib += current_bps * duration / 48 - - If stop_notes Is Nothing Then Continue For - - Dim stops = From stp In stop_notes - Where stp.VPosition >= notevpos And - stp.VPosition < notevpos + duration - - Dim stop_beats = stops.Sum(Function(x) x.Value / 10000.0) / 48 - stop_contrib += current_bps * stop_beats - - Next - - Return stop_contrib + bpm_contrib - End Function - - Private Sub POBStorm_Click(sender As Object, e As EventArgs) - - End Sub - - Private Sub POBMirror_Click(sender As Object, e As EventArgs) Handles POBMirror.Click - Dim xI1 As Integer - Dim xUndo As UndoRedo.LinkedURCmd = Nothing - Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void - Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo - - For xI1 = 1 To UBound(Notes) - If Not Notes(xI1).Selected Then Continue For - 'xRedo &= sCmdKM(niA1, .VPosition, .Value, IIf(NTInput, .Length, .LongNote), .Hidden, RealColumnToEnabled(niA7) - RealColumnToEnabled(niA1), 0, True) & vbCrLf - 'xUndo &= sCmdKM(niA7, .VPosition, .Value, IIf(NTInput, .Length, .LongNote), .Hidden, RealColumnToEnabled(niA1) - RealColumnToEnabled(niA7), 0, True) & vbCrLf - - Dim xCol As Integer - If Rscratch Then - Select Case Notes(xI1).ColumnIndex - Case niA1 : xCol = niA7 - Case niA2 : xCol = niA6 - Case niA3 : xCol = niA5 - Case niA4 : xCol = niA4 - Case niA5 : xCol = niA3 - Case niA6 : xCol = niA2 - Case niA7 : xCol = niA1 - Case niD1 : xCol = niD7 - Case niD2 : xCol = niD6 - Case niD3 : xCol = niD5 - Case niD4 : xCol = niD4 - Case niD5 : xCol = niD3 - Case niD6 : xCol = niD2 - Case niD7 : xCol = niD1 - Case Else : Continue For - End Select - Else - Select Case Notes(xI1).ColumnIndex - Case niA3 : xCol = niA9 - Case niA4 : xCol = niA8 - Case niA5 : xCol = niA7 - Case niA6 : xCol = niA6 - Case niA7 : xCol = niA5 - Case niA8 : xCol = niA4 - Case niA9 : xCol = niA3 - Case niD1 : xCol = niD7 - Case niD2 : xCol = niD6 - Case niD3 : xCol = niD5 - Case niD4 : xCol = niD4 - Case niD5 : xCol = niD3 - Case niD6 : xCol = niD2 - Case niD7 : xCol = niD1 - Case Else : Continue For - End Select - End If - - RedoMoveNote(Notes(xI1), xCol, Notes(xI1).VPosition, xUndo, xRedo) - Notes(xI1).ColumnIndex = xCol - Next - - AddUndo(xUndo, xBaseRedo.Next) - UpdatePairing() - RefreshPanelAll() - End Sub - - - - - - - - Private Sub ValidateSelection() - If vSelStart < 0 Then vSelLength += vSelStart : vSelHalf += vSelStart : vSelStart = 0 - If vSelStart > GetMaxVPosition() - 1 Then vSelLength += vSelStart - GetMaxVPosition() + 1 : vSelHalf += vSelStart - GetMaxVPosition() + 1 : vSelStart = GetMaxVPosition() - 1 - If vSelStart + vSelLength < 0 Then vSelLength = -vSelStart - If vSelStart + vSelLength > GetMaxVPosition() - 1 Then vSelLength = GetMaxVPosition() - 1 - vSelStart - - If Math.Sign(vSelHalf) <> Math.Sign(vSelLength) Then vSelHalf = 0 - If Math.Abs(vSelHalf) > Math.Abs(vSelLength) Then vSelHalf = vSelLength - End Sub - - - - Private Sub TVCM_KeyDown(sender As Object, e As KeyEventArgs) Handles TVCM.KeyDown - If e.KeyCode = Keys.Enter Then - TVCM.Text = Val(TVCM.Text) - If Val(TVCM.Text) <= 0 Then - Dim unused = MsgBox(Strings.Messages.NegativeFactorError, MsgBoxStyle.Critical, Strings.Messages.Err) - TVCM.Text = 1 - TVCM.Focus() - TVCM.SelectAll() - Else - BVCApply_Click(BVCApply, New EventArgs) - End If - End If - End Sub - - Private Sub TVCM_LostFocus(sender As Object, e As EventArgs) Handles TVCM.LostFocus - TVCM.Text = Val(TVCM.Text) - If Val(TVCM.Text) <= 0 Then - Dim unused = MsgBox(Strings.Messages.NegativeFactorError, MsgBoxStyle.Critical, Strings.Messages.Err) - TVCM.Text = 1 - TVCM.Focus() - TVCM.SelectAll() - End If - End Sub - - Private Sub TVCD_KeyDown(sender As Object, e As KeyEventArgs) Handles TVCD.KeyDown - If e.KeyCode = Keys.Enter Then - TVCD.Text = Val(TVCD.Text) - If Val(TVCD.Text) <= 0 Then - Dim unused = MsgBox(Strings.Messages.NegativeDivisorError, MsgBoxStyle.Critical, Strings.Messages.Err) - TVCD.Text = 1 - TVCD.Focus() - TVCD.SelectAll() - Else - BVCApply_Click(BVCApply, New EventArgs) - End If - End If - End Sub - - Private Sub TVCD_LostFocus(sender As Object, e As EventArgs) Handles TVCD.LostFocus - TVCD.Text = Val(TVCD.Text) - If Val(TVCD.Text) <= 0 Then - Dim unused = MsgBox(Strings.Messages.NegativeDivisorError, MsgBoxStyle.Critical, Strings.Messages.Err) - TVCD.Text = 1 - TVCD.Focus() - TVCD.SelectAll() - End If - End Sub - - Private Sub TVCBPM_KeyDown(sender As Object, e As KeyEventArgs) Handles TVCBPM.KeyDown - If e.KeyCode = Keys.Enter Then - TVCBPM.Text = Val(TVCBPM.Text) - If Val(TVCBPM.Text) <= 0 Then - Dim unused = MsgBox(Strings.Messages.NegativeDivisorError, MsgBoxStyle.Critical, Strings.Messages.Err) - TVCBPM.Text = Notes(0).Value / 10000 - TVCBPM.Focus() - TVCBPM.SelectAll() - Else - BVCCalculate_Click(BVCCalculate, New EventArgs) - End If - End If - End Sub - - Private Sub TVCBPM_LostFocus(sender As Object, e As EventArgs) Handles TVCBPM.LostFocus - TVCBPM.Text = Val(TVCBPM.Text) - If Val(TVCBPM.Text) <= 0 Then - Dim unused = MsgBox(Strings.Messages.NegativeDivisorError, MsgBoxStyle.Critical, Strings.Messages.Err) - TVCBPM.Text = Notes(0).Value / 10000 - TVCBPM.Focus() - TVCBPM.SelectAll() - End If - End Sub - - Private Function FindNoteIndex(note As Note) As Integer - Dim xI1 As Integer - If NTInput Then - For xI1 = 1 To UBound(Notes) - If Notes(xI1).equalsNT(note) Then Return xI1 - Next - Else - For xI1 = 1 To UBound(Notes) - If Notes(xI1).equalsBMSE(note) Then Return xI1 - Next - End If - Return xI1 - End Function - - - - - Private Function sIA() As Integer - Return IIf(sI > 98, 0, sI + 1) - End Function - - Private Function sIM() As Integer - Return IIf(sI < 1, 99, sI - 1) - End Function - - - - Private Sub TBUndo_Click(sender As Object, e As EventArgs) Handles TBUndo.Click, mnUndo.Click - KMouseOver = -1 - 'KMouseDown = -1 - ReDim SelectedNotes(-1) - If sUndo(sI).ofType = UndoRedo.opNoOperation Then Exit Sub - PerformCommand(sUndo(sI)) - sI = sIM() - - TBUndo.Enabled = sUndo(sI).ofType <> UndoRedo.opNoOperation - TBRedo.Enabled = sRedo(sIA).ofType <> UndoRedo.opNoOperation - mnUndo.Enabled = sUndo(sI).ofType <> UndoRedo.opNoOperation - mnRedo.Enabled = sRedo(sIA).ofType <> UndoRedo.opNoOperation - End Sub - - Private Sub TBRedo_Click(sender As Object, e As EventArgs) Handles TBRedo.Click, mnRedo.Click - KMouseOver = -1 - 'KMouseDown = -1 - ReDim SelectedNotes(-1) - If sRedo(sIA).ofType = UndoRedo.opNoOperation Then Exit Sub - PerformCommand(sRedo(sIA)) - sI = sIA() - - TBUndo.Enabled = sUndo(sI).ofType <> UndoRedo.opNoOperation - TBRedo.Enabled = sRedo(sIA).ofType <> UndoRedo.opNoOperation - mnUndo.Enabled = sUndo(sI).ofType <> UndoRedo.opNoOperation - mnRedo.Enabled = sRedo(sIA).ofType <> UndoRedo.opNoOperation - End Sub - - 'Undo appends before, Redo appends after. - 'After a sequence of Commands, - ' Undo will be the first one to execute, - ' Redo will be the last one to execute. - 'Remember to save the first Redo. - - 'In case where undo is Nothing: Dont worry. - 'In case where redo is Nothing: - ' If only one redo is in a sequence, put Nothing. - ' If several redo are in a sequence, - ' Create Void first. - ' Record its reference into a seperate copy. (xBaseRedo = xRedo) - ' Use this xRedo as the BaseRedo. - ' When calling AddUndo subroutine, use xBaseRedo.Next as cRedo. - - 'Dim xUndo As UndoRedo.LinkedURCmd = Nothing - 'Dim xRedo As UndoRedo.LinkedURCmd = Nothing - '... 'Me.RedoRemoveNote(K(xI1), True, xUndo, xRedo) - 'AddUndo(xUndo, xRedo) - - 'Dim xUndo As UndoRedo.LinkedURCmd = Nothing - 'Dim xRedo As New UndoRedo.Void - 'Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo - '... 'Me.RedoRemoveNote(K(xI1), True, xUndo, xRedo) - 'AddUndo(xUndo, xBaseRedo.Next) - - - - Private Sub TBAbout_Click(sender As Object, e As EventArgs) - 'If My.Computer.FileSystem.FileExists(My.Application.Info.DirectoryPath & "\About.png") Then - 'Aboutboxx1.SelectBitmap() - Dim Aboutboxx1 As New AboutBox1 With { - .bBitmap = My.Resources.About0, - .ClientSize = New Size(1000, 500) - } - Aboutboxx1.ClickToCopy.Visible = True - Dim unused = Aboutboxx1.ShowDialog(Me) - 'Else - ' MsgBox(locale.Messages.cannotfind & " ""About.png""", MsgBoxStyle.Critical, locale.Messages.err) - 'End If - End Sub - - Private Sub TBOptions_Click(sender As Object, e As EventArgs) Handles TBVOptions.Click, mnVOptions.Click - - Dim xDiag As New OpVisual(vo, column, LWAV.Font) - Dim unused = xDiag.ShowDialog(Me) - UpdateColumnsX() - RefreshPanelAll() - End Sub - - Private Sub AddToPOWAV(xPath() As String) - Dim xIndices(LWAV.SelectedIndices.Count - 1) As Integer - LWAV.SelectedIndices.CopyTo(xIndices, 0) - If xIndices.Length = 0 Then Exit Sub - - If WAVEmptyfill Then - Dim i As Integer = 0 - Dim currWavIndex As Integer = xIndices(0) - ReDim Preserve xIndices(UBound(xPath)) - - Do While i < xIndices.Length And currWavIndex <= 1294 - Do While currWavIndex <= 1294 AndAlso hWAV(currWavIndex + 1) <> String.Empty - currWavIndex += 1 - Loop - If currWavIndex > 1294 Then Exit Do - - xIndices(i) = currWavIndex - currWavIndex += 1 - i += 1 - Loop - - If currWavIndex > 1294 Then - ReDim Preserve xPath(i - 1) - ReDim Preserve xIndices(i - 1) - End If - Else - If xIndices.Length < xPath.Length Then - Dim i As Integer = xIndices.Length - Dim currWavIndex As Integer = xIndices(UBound(xIndices)) + 1 - ReDim Preserve xIndices(UBound(xPath)) - - Do While i < xIndices.Length And currWavIndex <= 1294 - Do While currWavIndex <= 1294 AndAlso hWAV(currWavIndex + 1) <> String.Empty - currWavIndex += 1 - Loop - If currWavIndex > 1294 Then Exit Do - - xIndices(i) = currWavIndex - currWavIndex += 1 - i += 1 - Loop - - If currWavIndex > 1294 Then - ReDim Preserve xPath(i - 1) - ReDim Preserve xIndices(i - 1) - End If - End If - End If - - 'Dim xI2 As Integer = 0 - For xI1 As Integer = 0 To UBound(xPath) - 'If xI2 > UBound(xIndices) Then Exit For - 'hWAV(xIndices(xI2) + 1) = GetFileName(xPath(xI1)) - 'LWAV.Items.Item(xIndices(xI2)) = C10to36(xIndices(xI2) + 1) & ": " & GetFileName(xPath(xI1)) - hWAV(xIndices(xI1) + 1) = GetFileName(xPath(xI1)) - LWAV.Items.Item(xIndices(xI1)) = C10to36(xIndices(xI1) + 1) & ": " & GetFileName(xPath(xI1)) - 'xI2 += 1 - Next - - LWAV.SelectedIndices.Clear() - For xI1 As Integer = 0 To IIf(UBound(xIndices) < UBound(xPath), UBound(xIndices), UBound(xPath)) - LWAV.SelectedIndices.Add(xIndices(xI1)) - Next - - If IsSaved Then SetIsSaved(False) - RefreshPanelAll() - End Sub - - Private Sub POWAV_DragDrop(sender As Object, e As DragEventArgs) Handles POWAV.DragDrop - ReDim DDFileName(-1) - If Not e.Data.GetDataPresent(DataFormats.FileDrop) Then Return - - Dim xOrigPath() As String = CType(e.Data.GetData(DataFormats.FileDrop), String()) - Dim xPath() As String = FilterFileBySupported(xOrigPath, SupportedAudioExtension) - Array.Sort(xPath) - If xPath.Length = 0 Then - RefreshPanelAll() - Exit Sub - End If - - AddToPOWAV(xPath) - End Sub - - Private Sub POWAV_DragEnter(sender As Object, e As DragEventArgs) Handles POWAV.DragEnter - If e.Data.GetDataPresent(DataFormats.FileDrop) Then - e.Effect = DragDropEffects.Copy - DDFileName = FilterFileBySupported(CType(e.Data.GetData(DataFormats.FileDrop), String()), SupportedAudioExtension) - Else - e.Effect = DragDropEffects.None - End If - RefreshPanelAll() - End Sub - - Private Sub POWAV_DragLeave(sender As Object, e As EventArgs) Handles POWAV.DragLeave - ReDim DDFileName(-1) - RefreshPanelAll() - End Sub - - Private Sub POWAV_Resize(sender As Object, e As EventArgs) Handles POWAV.Resize - LWAV.Height = sender.Height - 25 - End Sub - - Private Sub AddToPOBMP(xPath() As String) - Dim xIndices(LBMP.SelectedIndices.Count - 1) As Integer - LBMP.SelectedIndices.CopyTo(xIndices, 0) - If xIndices.Length = 0 Then Exit Sub - - If WAVEmptyfill Then - Dim i As Integer = 0 - Dim currBmpIndex As Integer = xIndices(0) - ReDim Preserve xIndices(UBound(xPath)) - - Do While i < xIndices.Length And currBmpIndex <= 1294 - Do While currBmpIndex <= 1294 AndAlso hBMP(currBmpIndex + 1) <> String.Empty - currBmpIndex += 1 - Loop - If currBmpIndex > 1294 Then Exit Do - - xIndices(i) = currBmpIndex - currBmpIndex += 1 - i += 1 - Loop - - If currBmpIndex > 1294 Then - ReDim Preserve xPath(i - 1) - ReDim Preserve xIndices(i - 1) - End If - Else - If xIndices.Length < xPath.Length Then - Dim i As Integer = xIndices.Length - Dim currBmpIndex As Integer = xIndices(UBound(xIndices)) + 1 - ReDim Preserve xIndices(UBound(xPath)) - - Do While i < xIndices.Length And currBmpIndex <= 1294 - Do While currBmpIndex <= 1294 AndAlso hBMP(currBmpIndex + 1) <> String.Empty - currBmpIndex += 1 - Loop - If currBmpIndex > 1294 Then Exit Do - - xIndices(i) = currBmpIndex - currBmpIndex += 1 - i += 1 - Loop - - If currBmpIndex > 1294 Then - ReDim Preserve xPath(i - 1) - ReDim Preserve xIndices(i - 1) - End If - End If - End If - - 'Dim xI2 As Integer = 0 - For xI1 As Integer = 0 To UBound(xPath) - 'If xI2 > UBound(xIndices) Then Exit For - 'hBMP(xIndices(xI2) + 1) = GetFileName(xPath(xI1)) - 'LBMP.Items.Item(xIndices(xI2)) = C10to36(xIndices(xI2) + 1) & ": " & GetFileName(xPath(xI1)) - hBMP(xIndices(xI1) + 1) = GetFileName(xPath(xI1)) - LBMP.Items.Item(xIndices(xI1)) = C10to36(xIndices(xI1) + 1) & ": " & GetFileName(xPath(xI1)) - 'xI2 += 1 - Next - - LBMP.SelectedIndices.Clear() - For xI1 As Integer = 0 To IIf(UBound(xIndices) < UBound(xPath), UBound(xIndices), UBound(xPath)) - LBMP.SelectedIndices.Add(xIndices(xI1)) - Next - - If IsSaved Then SetIsSaved(False) - RefreshPanelAll() - End Sub - - Private Sub POBMP_DragDrop(sender As Object, e As DragEventArgs) Handles POBMP.DragDrop - ReDim DDFileName(-1) - If Not e.Data.GetDataPresent(DataFormats.FileDrop) Then Return - - Dim xOrigPath() As String = CType(e.Data.GetData(DataFormats.FileDrop), String()) - Dim xPath() As String = FilterFileBySupported(xOrigPath, SupportedImageExtension) - Array.Sort(xPath) - If xPath.Length = 0 Then - RefreshPanelAll() - Exit Sub - End If - - AddToPOBMP(xPath) - End Sub - - Private Sub POBMP_DragEnter(sender As Object, e As DragEventArgs) Handles POBMP.DragEnter - If e.Data.GetDataPresent(DataFormats.FileDrop) Then - e.Effect = DragDropEffects.Copy - DDFileName = FilterFileBySupported(CType(e.Data.GetData(DataFormats.FileDrop), String()), SupportedImageExtension) - Else - e.Effect = DragDropEffects.None - End If - RefreshPanelAll() - End Sub - - Private Sub POBMP_DragLeave(sender As Object, e As EventArgs) Handles POBMP.DragLeave - ReDim DDFileName(-1) - RefreshPanelAll() - End Sub - - Private Sub POBMP_Resize(sender As Object, e As EventArgs) Handles POBMP.Resize - LBMP.Height = sender.Height - 25 - End Sub - Private Sub POBeat_Resize(sender As Object, e As EventArgs) Handles POBeat.Resize - LBeat.Height = POBeat.Height - 25 - End Sub - Private Sub POExpansion_Resize(sender As Object, e As EventArgs) Handles POExpansion.Resize - TExpansion.Height = POExpansion.Height - 2 - End Sub - - Private Sub mn_DropDownClosed(sender As Object, e As EventArgs) - sender.ForeColor = Color.White - End Sub - Private Sub mn_DropDownOpened(sender As Object, e As EventArgs) - sender.ForeColor = Color.Black - End Sub - Private Sub mn_MouseEnter(sender As Object, e As EventArgs) - If sender.Pressed Then Return - sender.ForeColor = Color.Black - End Sub - Private Sub mn_MouseLeave(sender As Object, e As EventArgs) - If sender.Pressed Then Return - sender.ForeColor = Color.White - End Sub - - Private Sub TBPOptions_Click(sender As Object, e As EventArgs) Handles TBPOptions.Click, mnPOptions.Click - Dim xDOp As New OpPlayer(CurrentPlayer) - Dim unused = xDOp.ShowDialog(Me) - End Sub - - Private Sub THGenre_TextChanged(sender As Object, e As EventArgs) Handles _ + If Not .LongNote Then data(row, 0) += 1 + If .LongNote Then data(row, 1) += 1 + If .Value \ 10000 = LnObj Then data(row, 1) += 1 + If .Hidden Then data(row, 2) += 1 + If .Landmine Then data(row, 3) += 1 + If .HasError Then data(row, 4) += 1 + data(row, 5) += 1 + + Else + Dim noteUnit = 1 + If .Length = 0 Then data(row, 0) += 1 + If .Length <> 0 Then data(row, 1) += 2 : noteUnit = 2 + + If .Value \ 10000 = LnObj Then data(row, 1) += noteUnit + If .Hidden Then data(row, 2) += noteUnit + If .Landmine Then data(row, 3) += noteUnit + If .HasError Then data(row, 4) += noteUnit + data(row, 5) += noteUnit + + End If + + If row <> 6 Then row = 6 : GoTo StartCount + End With + Next + + Dim dStat As New dgStatistics(data) + Dim unused = dStat.ShowDialog + End Sub + + ''' + ''' Remark: Pls sort and updatepairing before this process. + ''' + + Private Sub CalculateTotalPlayableNotes() + Dim xI1 As Integer + Dim xIAll As Integer = 0 + + If Not NTInput Then + For xI1 = 1 To UBound(Notes) + If Notes(xI1).ColumnIndex >= niA1 AndAlso Notes(xI1).ColumnIndex <= niAQ Then xIAll += 1 + If Notes(xI1).ColumnIndex >= niD1 AndAlso Notes(xI1).ColumnIndex <= niDQ AndAlso column(Notes(xI1).ColumnIndex).isVisible Then xIAll += 1 + Next + + Else + For xI1 = 1 To UBound(Notes) + If Notes(xI1).ColumnIndex >= niA1 And Notes(xI1).ColumnIndex <= niAQ Then + xIAll += 1 + If Notes(xI1).Length <> 0 Then xIAll += 1 + End If + If Notes(xI1).ColumnIndex >= niD1 And Notes(xI1).ColumnIndex <= niDQ AndAlso column(Notes(xI1).ColumnIndex).isVisible Then + xIAll += 1 + If Notes(xI1).Length <> 0 Then xIAll += 1 + End If + Next + + End If + + TBStatistics.Text = xIAll + End Sub + + Private Function CalculateTotalNotes() As Integer + Dim xI1 As Integer + Dim xIAll As Integer = 0 + + For xI1 = 1 To UBound(Notes) + If Notes(xI1).ColumnIndex >= niA1 AndAlso Notes(xI1).ColumnIndex <= niAQ AndAlso + Not Notes(xI1).Hidden AndAlso Not Notes(xI1).Landmine AndAlso column(Notes(xI1).ColumnIndex).isVisible Then + xIAll += 1 + End If + If Notes(xI1).ColumnIndex >= niD1 AndAlso Notes(xI1).ColumnIndex <= niDQ AndAlso + Not Notes(xI1).Hidden AndAlso Not Notes(xI1).Landmine AndAlso column(Notes(xI1).ColumnIndex).isVisible Then + xIAll += 1 + End If + Next + + Return xIAll + End Function + + Public Function GetMouseVPosition(Optional snap As Boolean = True) + Dim panHeight = spMain(PanelFocus).Height + Dim panDisplacement = PanelVScroll(PanelFocus) + Dim vpos = (panHeight - (panDisplacement * gxHeight) - MouseMoveStatus.Y - 1) / gxHeight + Return If(snap, SnapToGrid(vpos), DirectCast(vpos, Object)) + End Function + + Private Sub POStatusRefresh() + + If TBSelect.Checked Then + Dim xI1 As Integer = KMouseOver + If xI1 < 0 Then + + TempVPosition = GetMouseVPosition(gSnap) + + SelectedColumn = GetColumnAtX(MouseMoveStatus.X, PanelhBMSCROLL(PanelFocus)) + + Dim xMeasure As Integer = MeasureAtDisplacement(TempVPosition) + Dim xMLength As Double = MeasureLength(xMeasure) + Dim xVposMod As Double = TempVPosition - MeasureBottom(xMeasure) + Dim xGCD As Double = GCD(IIf(xVposMod = 0, xMLength, xVposMod), xMLength) + + FSP1.Text = (xVposMod * gDivide / 192).ToString & " / " & (xMLength * gDivide / 192).ToString & " " + FSP2.Text = xVposMod.ToString & " / " & xMLength & " " + FSP3.Text = CInt(xVposMod / xGCD).ToString & " / " & CInt(xMLength / xGCD).ToString & " " + FSP4.Text = TempVPosition.ToString() & " " + TimeStatusLabel.Text = GetTimeFromVPosition(TempVPosition).ToString("F4") + FSC.Text = nTitle(SelectedColumn) + FSW.Text = String.Empty + FSM.Text = Add3Zeros(xMeasure) + FST.Text = String.Empty + FSH.Text = String.Empty + FSL.Text = String.Empty + FSE.Text = String.Empty + + Else + Dim xMeasure As Integer = MeasureAtDisplacement(Notes(xI1).VPosition) + Dim xMLength As Double = MeasureLength(xMeasure) + Dim xVposMod As Double = Notes(xI1).VPosition - MeasureBottom(xMeasure) + Dim xGCD As Double = GCD(IIf(xVposMod = 0, xMLength, xVposMod), xMLength) + + FSP1.Text = (xVposMod * gDivide / 192).ToString & " / " & (xMLength * gDivide / 192).ToString & " " + FSP2.Text = xVposMod.ToString & " / " & xMLength & " " + FSP3.Text = CInt(xVposMod / xGCD).ToString & " / " & CInt(xMLength / xGCD).ToString & " " + FSP4.Text = Notes(xI1).VPosition.ToString() & " " + TimeStatusLabel.Text = GetTimeFromVPosition(TempVPosition).ToString("F4") + FSC.Text = nTitle(Notes(xI1).ColumnIndex) + FSW.Text = IIf(IsColumnNumeric(Notes(xI1).ColumnIndex), + Notes(xI1).Value / 10000, + C10to36(Notes(xI1).Value \ 10000)) + FSM.Text = Add3Zeros(xMeasure) + FST.Text = IIf(NTInput, Strings.StatusBar.Length & " = " & Notes(xI1).Length, IIf(Notes(xI1).LongNote, Strings.StatusBar.LongNote, String.Empty)) + FSH.Text = IIf(Notes(xI1).Hidden, Strings.StatusBar.Hidden, String.Empty) + FSL.Text = IIf(Notes(xI1).Landmine, Strings.StatusBar.LandMine, String.Empty) + FSE.Text = IIf(Notes(xI1).HasError, Strings.StatusBar.Err, String.Empty) + + End If + + ElseIf TBWrite.Checked Then + If SelectedColumn < 0 Then Exit Sub + + Dim xMeasure As Integer = MeasureAtDisplacement(TempVPosition) + Dim xMLength As Double = MeasureLength(xMeasure) + Dim xVposMod As Double = TempVPosition - MeasureBottom(xMeasure) + Dim xGCD As Double = GCD(IIf(xVposMod = 0, xMLength, xVposMod), xMLength) + + FSP1.Text = (xVposMod * gDivide / 192).ToString & " / " & (xMLength * gDivide / 192).ToString & " " + FSP2.Text = xVposMod.ToString & " / " & xMLength & " " + FSP3.Text = CInt(xVposMod / xGCD).ToString & " / " & CInt(xMLength / xGCD).ToString & " " + FSP4.Text = TempVPosition.ToString() & " " + TimeStatusLabel.Text = GetTimeFromVPosition(TempVPosition).ToString("F4") + FSC.Text = nTitle(SelectedColumn) + If IsColumnSound(SelectedColumn) Then + FSW.Text = C10to36(LWAV.SelectedIndex + 1) + ElseIf IsColumnImage(SelectedColumn) Then + FSW.Text = C10to36(LBMP.SelectedIndex + 1) + Else + FSW.Text = String.Empty + End If + FSM.Text = Add3Zeros(xMeasure) + FST.Text = IIf(NTInput, TempLength, IIf(My.Computer.Keyboard.ShiftKeyDown And Not My.Computer.Keyboard.CtrlKeyDown, Strings.StatusBar.LongNote, String.Empty)) + FSH.Text = IIf(My.Computer.Keyboard.CtrlKeyDown And Not My.Computer.Keyboard.ShiftKeyDown, Strings.StatusBar.Hidden, String.Empty) + FSL.Text = IIf(My.Computer.Keyboard.ShiftKeyDown And My.Computer.Keyboard.CtrlKeyDown, Strings.StatusBar.LandMine, String.Empty) + + ElseIf TBTimeSelect.Checked Then + FSSS.Text = vSelStart + FSSL.Text = vSelLength + FSSH.Text = vSelHalf + + End If + FStatus.Invalidate() + End Sub + + Private Function GetTimeFromVPosition(vpos As Double) As Double + Dim timing_notes = (From note In Notes + Where note.ColumnIndex = niBPM Or note.ColumnIndex = niSTOP + Group By Column = note.ColumnIndex + Into NoteGroups = Group).ToDictionary(Function(x) x.Column, Function(x) x.NoteGroups) + + Dim bpm_notes = timing_notes.Item(niBPM) + + Dim stop_notes As IEnumerable(Of Note) = Nothing + + Dim value As IEnumerable(Of Note) = Nothing + If timing_notes.TryGetValue(niSTOP, value) Then + stop_notes = value + End If + + + Dim stop_contrib As Double + Dim bpm_contrib As Double + + For i = 0 To bpm_notes.Count() - 1 + ' az: sum bpm contribution first + Dim duration = 0.0 + Dim current_note = bpm_notes.ElementAt(i) + Dim notevpos = Math.Max(0, current_note.VPosition) + + If i + 1 <> bpm_notes.Count() Then + Dim next_note = bpm_notes.ElementAt(i + 1) + duration = next_note.VPosition - notevpos + Else + duration = vpos - notevpos + End If + + Dim current_bps = 60 / (current_note.Value / 10000) + bpm_contrib += current_bps * duration / 48 + + If stop_notes Is Nothing Then Continue For + + Dim stops = From stp In stop_notes + Where stp.VPosition >= notevpos And + stp.VPosition < notevpos + duration + + Dim stop_beats = stops.Sum(Function(x) x.Value / 10000.0) / 48 + stop_contrib += current_bps * stop_beats + + Next + + Return stop_contrib + bpm_contrib + End Function + + Private Sub POBStorm_Click(sender As Object, e As EventArgs) + + End Sub + + Private Sub POBMirror_Click(sender As Object, e As EventArgs) Handles POBMirror.Click + Dim xI1 As Integer + Dim xUndo As UndoRedo.LinkedURCmd = Nothing + Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void + Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo + + For xI1 = 1 To UBound(Notes) + If Not Notes(xI1).Selected Then Continue For + 'xRedo &= sCmdKM(niA1, .VPosition, .Value, IIf(NTInput, .Length, .LongNote), .Hidden, RealColumnToEnabled(niA7) - RealColumnToEnabled(niA1), 0, True) & vbCrLf + 'xUndo &= sCmdKM(niA7, .VPosition, .Value, IIf(NTInput, .Length, .LongNote), .Hidden, RealColumnToEnabled(niA1) - RealColumnToEnabled(niA7), 0, True) & vbCrLf + + Dim xCol As Integer + If Rscratch Then + Select Case Notes(xI1).ColumnIndex + Case niA1 : xCol = niA7 + Case niA2 : xCol = niA6 + Case niA3 : xCol = niA5 + Case niA4 : xCol = niA4 + Case niA5 : xCol = niA3 + Case niA6 : xCol = niA2 + Case niA7 : xCol = niA1 + Case niD1 : xCol = niD7 + Case niD2 : xCol = niD6 + Case niD3 : xCol = niD5 + Case niD4 : xCol = niD4 + Case niD5 : xCol = niD3 + Case niD6 : xCol = niD2 + Case niD7 : xCol = niD1 + Case Else : Continue For + End Select + Else + Select Case Notes(xI1).ColumnIndex + Case niA3 : xCol = niA9 + Case niA4 : xCol = niA8 + Case niA5 : xCol = niA7 + Case niA6 : xCol = niA6 + Case niA7 : xCol = niA5 + Case niA8 : xCol = niA4 + Case niA9 : xCol = niA3 + Case niD1 : xCol = niD7 + Case niD2 : xCol = niD6 + Case niD3 : xCol = niD5 + Case niD4 : xCol = niD4 + Case niD5 : xCol = niD3 + Case niD6 : xCol = niD2 + Case niD7 : xCol = niD1 + Case Else : Continue For + End Select + End If + + RedoMoveNote(Notes(xI1), xCol, Notes(xI1).VPosition, xUndo, xRedo) + Notes(xI1).ColumnIndex = xCol + Next + + AddUndo(xUndo, xBaseRedo.Next) + UpdatePairing() + RefreshPanelAll() + End Sub + + + + + + + + Private Sub ValidateSelection() + If vSelStart < 0 Then vSelLength += vSelStart : vSelHalf += vSelStart : vSelStart = 0 + If vSelStart > GetMaxVPosition() - 1 Then vSelLength += vSelStart - GetMaxVPosition() + 1 : vSelHalf += vSelStart - GetMaxVPosition() + 1 : vSelStart = GetMaxVPosition() - 1 + If vSelStart + vSelLength < 0 Then vSelLength = -vSelStart + If vSelStart + vSelLength > GetMaxVPosition() - 1 Then vSelLength = GetMaxVPosition() - 1 - vSelStart + + If Math.Sign(vSelHalf) <> Math.Sign(vSelLength) Then vSelHalf = 0 + If Math.Abs(vSelHalf) > Math.Abs(vSelLength) Then vSelHalf = vSelLength + End Sub + + + + Private Sub TVCM_KeyDown(sender As Object, e As KeyEventArgs) Handles TVCM.KeyDown + If e.KeyCode = Keys.Enter Then + TVCM.Text = Val(TVCM.Text) + If Val(TVCM.Text) <= 0 Then + Dim unused = MsgBox(Strings.Messages.NegativeFactorError, MsgBoxStyle.Critical, Strings.Messages.Err) + TVCM.Text = 1 + TVCM.Focus() + TVCM.SelectAll() + Else + BVCApply_Click(BVCApply, New EventArgs) + End If + End If + End Sub + + Private Sub TVCM_LostFocus(sender As Object, e As EventArgs) Handles TVCM.LostFocus + TVCM.Text = Val(TVCM.Text) + If Val(TVCM.Text) <= 0 Then + Dim unused = MsgBox(Strings.Messages.NegativeFactorError, MsgBoxStyle.Critical, Strings.Messages.Err) + TVCM.Text = 1 + TVCM.Focus() + TVCM.SelectAll() + End If + End Sub + + Private Sub TVCD_KeyDown(sender As Object, e As KeyEventArgs) Handles TVCD.KeyDown + If e.KeyCode = Keys.Enter Then + TVCD.Text = Val(TVCD.Text) + If Val(TVCD.Text) <= 0 Then + Dim unused = MsgBox(Strings.Messages.NegativeDivisorError, MsgBoxStyle.Critical, Strings.Messages.Err) + TVCD.Text = 1 + TVCD.Focus() + TVCD.SelectAll() + Else + BVCApply_Click(BVCApply, New EventArgs) + End If + End If + End Sub + + Private Sub TVCD_LostFocus(sender As Object, e As EventArgs) Handles TVCD.LostFocus + TVCD.Text = Val(TVCD.Text) + If Val(TVCD.Text) <= 0 Then + Dim unused = MsgBox(Strings.Messages.NegativeDivisorError, MsgBoxStyle.Critical, Strings.Messages.Err) + TVCD.Text = 1 + TVCD.Focus() + TVCD.SelectAll() + End If + End Sub + + Private Sub TVCBPM_KeyDown(sender As Object, e As KeyEventArgs) Handles TVCBPM.KeyDown + If e.KeyCode = Keys.Enter Then + TVCBPM.Text = Val(TVCBPM.Text) + If Val(TVCBPM.Text) <= 0 Then + Dim unused = MsgBox(Strings.Messages.NegativeDivisorError, MsgBoxStyle.Critical, Strings.Messages.Err) + TVCBPM.Text = Notes(0).Value / 10000 + TVCBPM.Focus() + TVCBPM.SelectAll() + Else + BVCCalculate_Click(BVCCalculate, New EventArgs) + End If + End If + End Sub + + Private Sub TVCBPM_LostFocus(sender As Object, e As EventArgs) Handles TVCBPM.LostFocus + TVCBPM.Text = Val(TVCBPM.Text) + If Val(TVCBPM.Text) <= 0 Then + Dim unused = MsgBox(Strings.Messages.NegativeDivisorError, MsgBoxStyle.Critical, Strings.Messages.Err) + TVCBPM.Text = Notes(0).Value / 10000 + TVCBPM.Focus() + TVCBPM.SelectAll() + End If + End Sub + + Private Function FindNoteIndex(note As Note) As Integer + Dim xI1 As Integer + If NTInput Then + For xI1 = 1 To UBound(Notes) + If Notes(xI1).equalsNT(note) Then Return xI1 + Next + Else + For xI1 = 1 To UBound(Notes) + If Notes(xI1).equalsBMSE(note) Then Return xI1 + Next + End If + Return xI1 + End Function + + + + + Private Function sIA() As Integer + Return IIf(sI > 98, 0, sI + 1) + End Function + + Private Function sIM() As Integer + Return IIf(sI < 1, 99, sI - 1) + End Function + + + + Private Sub TBUndo_Click(sender As Object, e As EventArgs) Handles TBUndo.Click, mnUndo.Click + KMouseOver = -1 + 'KMouseDown = -1 + ReDim SelectedNotes(-1) + If sUndo(sI).ofType = UndoRedo.opNoOperation Then Exit Sub + PerformCommand(sUndo(sI)) + sI = sIM() + + TBUndo.Enabled = sUndo(sI).ofType <> UndoRedo.opNoOperation + TBRedo.Enabled = sRedo(sIA).ofType <> UndoRedo.opNoOperation + mnUndo.Enabled = sUndo(sI).ofType <> UndoRedo.opNoOperation + mnRedo.Enabled = sRedo(sIA).ofType <> UndoRedo.opNoOperation + End Sub + + Private Sub TBRedo_Click(sender As Object, e As EventArgs) Handles TBRedo.Click, mnRedo.Click + KMouseOver = -1 + 'KMouseDown = -1 + ReDim SelectedNotes(-1) + If sRedo(sIA).ofType = UndoRedo.opNoOperation Then Exit Sub + PerformCommand(sRedo(sIA)) + sI = sIA() + + TBUndo.Enabled = sUndo(sI).ofType <> UndoRedo.opNoOperation + TBRedo.Enabled = sRedo(sIA).ofType <> UndoRedo.opNoOperation + mnUndo.Enabled = sUndo(sI).ofType <> UndoRedo.opNoOperation + mnRedo.Enabled = sRedo(sIA).ofType <> UndoRedo.opNoOperation + End Sub + + 'Undo appends before, Redo appends after. + 'After a sequence of Commands, + ' Undo will be the first one to execute, + ' Redo will be the last one to execute. + 'Remember to save the first Redo. + + 'In case where undo is Nothing: Dont worry. + 'In case where redo is Nothing: + ' If only one redo is in a sequence, put Nothing. + ' If several redo are in a sequence, + ' Create Void first. + ' Record its reference into a seperate copy. (xBaseRedo = xRedo) + ' Use this xRedo as the BaseRedo. + ' When calling AddUndo subroutine, use xBaseRedo.Next as cRedo. + + 'Dim xUndo As UndoRedo.LinkedURCmd = Nothing + 'Dim xRedo As UndoRedo.LinkedURCmd = Nothing + '... 'Me.RedoRemoveNote(K(xI1), True, xUndo, xRedo) + 'AddUndo(xUndo, xRedo) + + 'Dim xUndo As UndoRedo.LinkedURCmd = Nothing + 'Dim xRedo As New UndoRedo.Void + 'Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo + '... 'Me.RedoRemoveNote(K(xI1), True, xUndo, xRedo) + 'AddUndo(xUndo, xBaseRedo.Next) + + + + Private Sub TBAbout_Click(sender As Object, e As EventArgs) + 'If My.Computer.FileSystem.FileExists(My.Application.Info.DirectoryPath & "\About.png") Then + 'Aboutboxx1.SelectBitmap() + Dim Aboutboxx1 As New AboutBox1 With { + .bBitmap = My.Resources.About0, + .ClientSize = New Size(1000, 500) + } + Aboutboxx1.ClickToCopy.Visible = True + Dim unused = Aboutboxx1.ShowDialog(Me) + 'Else + ' MsgBox(locale.Messages.cannotfind & " ""About.png""", MsgBoxStyle.Critical, locale.Messages.err) + 'End If + End Sub + + Private Sub TBOptions_Click(sender As Object, e As EventArgs) Handles TBVOptions.Click, mnVOptions.Click + + Dim xDiag As New OpVisual(vo, column, LWAV.Font) + Dim unused = xDiag.ShowDialog(Me) + UpdateColumnsX() + RefreshPanelAll() + End Sub + + Private Sub AddToPOWAV(xPath() As String) + Dim xIndices(LWAV.SelectedIndices.Count - 1) As Integer + LWAV.SelectedIndices.CopyTo(xIndices, 0) + If xIndices.Length = 0 Then Exit Sub + + If WAVEmptyfill Then + Dim i As Integer = 0 + Dim currWavIndex As Integer = xIndices(0) + ReDim Preserve xIndices(UBound(xPath)) + + Do While i < xIndices.Length And currWavIndex <= 1294 + Do While currWavIndex <= 1294 AndAlso hWAV(currWavIndex + 1) <> String.Empty + currWavIndex += 1 + Loop + If currWavIndex > 1294 Then Exit Do + + xIndices(i) = currWavIndex + currWavIndex += 1 + i += 1 + Loop + + If currWavIndex > 1294 Then + ReDim Preserve xPath(i - 1) + ReDim Preserve xIndices(i - 1) + End If + Else + If xIndices.Length < xPath.Length Then + Dim i As Integer = xIndices.Length + Dim currWavIndex As Integer = xIndices(UBound(xIndices)) + 1 + ReDim Preserve xIndices(UBound(xPath)) + + Do While i < xIndices.Length And currWavIndex <= 1294 + Do While currWavIndex <= 1294 AndAlso hWAV(currWavIndex + 1) <> String.Empty + currWavIndex += 1 + Loop + If currWavIndex > 1294 Then Exit Do + + xIndices(i) = currWavIndex + currWavIndex += 1 + i += 1 + Loop + + If currWavIndex > 1294 Then + ReDim Preserve xPath(i - 1) + ReDim Preserve xIndices(i - 1) + End If + End If + End If + + 'Dim xI2 As Integer = 0 + For xI1 As Integer = 0 To UBound(xPath) + 'If xI2 > UBound(xIndices) Then Exit For + 'hWAV(xIndices(xI2) + 1) = GetFileName(xPath(xI1)) + 'LWAV.Items.Item(xIndices(xI2)) = C10to36(xIndices(xI2) + 1) & ": " & GetFileName(xPath(xI1)) + hWAV(xIndices(xI1) + 1) = GetFileName(xPath(xI1)) + LWAV.Items.Item(xIndices(xI1)) = C10to36(xIndices(xI1) + 1) & ": " & GetFileName(xPath(xI1)) + 'xI2 += 1 + Next + + LWAV.SelectedIndices.Clear() + For xI1 As Integer = 0 To IIf(UBound(xIndices) < UBound(xPath), UBound(xIndices), UBound(xPath)) + LWAV.SelectedIndices.Add(xIndices(xI1)) + Next + + If IsSaved Then SetIsSaved(False) + RefreshPanelAll() + End Sub + + Private Sub POWAV_DragDrop(sender As Object, e As DragEventArgs) Handles POWAV.DragDrop + ReDim DDFileName(-1) + If Not e.Data.GetDataPresent(DataFormats.FileDrop) Then Return + + Dim xOrigPath() As String = CType(e.Data.GetData(DataFormats.FileDrop), String()) + Dim xPath() As String = FilterFileBySupported(xOrigPath, SupportedAudioExtension) + Array.Sort(xPath) + If xPath.Length = 0 Then + RefreshPanelAll() + Exit Sub + End If + + AddToPOWAV(xPath) + End Sub + + Private Sub POWAV_DragEnter(sender As Object, e As DragEventArgs) Handles POWAV.DragEnter + If e.Data.GetDataPresent(DataFormats.FileDrop) Then + e.Effect = DragDropEffects.Copy + DDFileName = FilterFileBySupported(CType(e.Data.GetData(DataFormats.FileDrop), String()), SupportedAudioExtension) + Else + e.Effect = DragDropEffects.None + End If + RefreshPanelAll() + End Sub + + Private Sub POWAV_DragLeave(sender As Object, e As EventArgs) Handles POWAV.DragLeave + ReDim DDFileName(-1) + RefreshPanelAll() + End Sub + + Private Sub POWAV_Resize(sender As Object, e As EventArgs) Handles POWAV.Resize + LWAV.Height = sender.Height - 25 + End Sub + + Private Sub AddToPOBMP(xPath() As String) + Dim xIndices(LBMP.SelectedIndices.Count - 1) As Integer + LBMP.SelectedIndices.CopyTo(xIndices, 0) + If xIndices.Length = 0 Then Exit Sub + + If WAVEmptyfill Then + Dim i As Integer = 0 + Dim currBmpIndex As Integer = xIndices(0) + ReDim Preserve xIndices(UBound(xPath)) + + Do While i < xIndices.Length And currBmpIndex <= 1294 + Do While currBmpIndex <= 1294 AndAlso hBMP(currBmpIndex + 1) <> String.Empty + currBmpIndex += 1 + Loop + If currBmpIndex > 1294 Then Exit Do + + xIndices(i) = currBmpIndex + currBmpIndex += 1 + i += 1 + Loop + + If currBmpIndex > 1294 Then + ReDim Preserve xPath(i - 1) + ReDim Preserve xIndices(i - 1) + End If + Else + If xIndices.Length < xPath.Length Then + Dim i As Integer = xIndices.Length + Dim currBmpIndex As Integer = xIndices(UBound(xIndices)) + 1 + ReDim Preserve xIndices(UBound(xPath)) + + Do While i < xIndices.Length And currBmpIndex <= 1294 + Do While currBmpIndex <= 1294 AndAlso hBMP(currBmpIndex + 1) <> String.Empty + currBmpIndex += 1 + Loop + If currBmpIndex > 1294 Then Exit Do + + xIndices(i) = currBmpIndex + currBmpIndex += 1 + i += 1 + Loop + + If currBmpIndex > 1294 Then + ReDim Preserve xPath(i - 1) + ReDim Preserve xIndices(i - 1) + End If + End If + End If + + 'Dim xI2 As Integer = 0 + For xI1 As Integer = 0 To UBound(xPath) + 'If xI2 > UBound(xIndices) Then Exit For + 'hBMP(xIndices(xI2) + 1) = GetFileName(xPath(xI1)) + 'LBMP.Items.Item(xIndices(xI2)) = C10to36(xIndices(xI2) + 1) & ": " & GetFileName(xPath(xI1)) + hBMP(xIndices(xI1) + 1) = GetFileName(xPath(xI1)) + LBMP.Items.Item(xIndices(xI1)) = C10to36(xIndices(xI1) + 1) & ": " & GetFileName(xPath(xI1)) + 'xI2 += 1 + Next + + LBMP.SelectedIndices.Clear() + For xI1 As Integer = 0 To IIf(UBound(xIndices) < UBound(xPath), UBound(xIndices), UBound(xPath)) + LBMP.SelectedIndices.Add(xIndices(xI1)) + Next + + If IsSaved Then SetIsSaved(False) + RefreshPanelAll() + End Sub + + Private Sub POBMP_DragDrop(sender As Object, e As DragEventArgs) Handles POBMP.DragDrop + ReDim DDFileName(-1) + If Not e.Data.GetDataPresent(DataFormats.FileDrop) Then Return + + Dim xOrigPath() As String = CType(e.Data.GetData(DataFormats.FileDrop), String()) + Dim xPath() As String = FilterFileBySupported(xOrigPath, SupportedImageExtension) + Array.Sort(xPath) + If xPath.Length = 0 Then + RefreshPanelAll() + Exit Sub + End If + + AddToPOBMP(xPath) + End Sub + + Private Sub POBMP_DragEnter(sender As Object, e As DragEventArgs) Handles POBMP.DragEnter + If e.Data.GetDataPresent(DataFormats.FileDrop) Then + e.Effect = DragDropEffects.Copy + DDFileName = FilterFileBySupported(CType(e.Data.GetData(DataFormats.FileDrop), String()), SupportedImageExtension) + Else + e.Effect = DragDropEffects.None + End If + RefreshPanelAll() + End Sub + + Private Sub POBMP_DragLeave(sender As Object, e As EventArgs) Handles POBMP.DragLeave + ReDim DDFileName(-1) + RefreshPanelAll() + End Sub + + Private Sub POBMP_Resize(sender As Object, e As EventArgs) Handles POBMP.Resize + LBMP.Height = sender.Height - 25 + End Sub + Private Sub POBeat_Resize(sender As Object, e As EventArgs) Handles POBeat.Resize + LBeat.Height = POBeat.Height - 25 + End Sub + Private Sub POExpansion_Resize(sender As Object, e As EventArgs) Handles POExpansion.Resize + TExpansion.Height = POExpansion.Height - 2 + End Sub + + Private Sub mn_DropDownClosed(sender As Object, e As EventArgs) + sender.ForeColor = Color.White + End Sub + Private Sub mn_DropDownOpened(sender As Object, e As EventArgs) + sender.ForeColor = Color.Black + End Sub + Private Sub mn_MouseEnter(sender As Object, e As EventArgs) + If sender.Pressed Then Return + sender.ForeColor = Color.Black + End Sub + Private Sub mn_MouseLeave(sender As Object, e As EventArgs) + If sender.Pressed Then Return + sender.ForeColor = Color.White + End Sub + + Private Sub TBPOptions_Click(sender As Object, e As EventArgs) Handles TBPOptions.Click, mnPOptions.Click + Dim xDOp As New OpPlayer(CurrentPlayer) + Dim unused = xDOp.ShowDialog(Me) + End Sub + + Private Sub THGenre_TextChanged(sender As Object, e As EventArgs) Handles _ THGenre.TextChanged, THTitle.TextChanged, THArtist.TextChanged, THPlayLevel.TextChanged, CHRank.SelectedIndexChanged, TExpansion.TextChanged, THSubTitle.TextChanged, THSubArtist.TextChanged, THStageFile.TextChanged, THBanner.TextChanged, THBackBMP.TextChanged, CHDifficulty.SelectedIndexChanged, THExRank.TextChanged, THTotal.TextChanged, THComment.TextChanged, THPreview.TextChanged, CHLnmode.SelectedIndexChanged - If IsSaved Then SetIsSaved(False) - - If ReferenceEquals(sender, THLandMine) Then - hWAV(0) = THLandMine.Text - ElseIf ReferenceEquals(sender, THMissBMP) Then - hBMP(0) = THMissBMP.Text - End If - End Sub - - Private Sub CHLnObj_SelectedIndexChanged(sender As Object, e As EventArgs) Handles CHLnObj.SelectedIndexChanged - If IsSaved Then SetIsSaved(False) - LnObj = CHLnObj.SelectedIndex - UpdatePairing() - RefreshPanelAll() - End Sub - - Private Sub ConvertBMSE2NT() - ReDim SelectedNotes(-1) - SortByVPositionInsertion() - - For i2 As Integer = 0 To UBound(Notes) - Notes(i2).Length = 0.0# - Next - - Dim i As Integer = 1 - Dim j As Integer = 0 - Dim xUbound As Integer = UBound(Notes) - - Do While i <= xUbound - If Not Notes(i).LongNote Then i += 1 : Continue Do - - For j = i + 1 To xUbound - If Notes(j).ColumnIndex <> Notes(i).ColumnIndex Then Continue For - - If Notes(j).LongNote Then - Notes(i).Length = Notes(j).VPosition - Notes(i).VPosition - For j2 As Integer = j To xUbound - 1 - Notes(j2) = Notes(j2 + 1) - Next - xUbound -= 1 - Exit For - - ElseIf Notes(j).Value \ 10000 = LnObj Then - Exit For - - End If - Next - - i += 1 - Loop - - ReDim Preserve Notes(xUbound) - - For i = 0 To xUbound - Notes(i).LongNote = False - Next - - SortByVPositionInsertion() - UpdatePairing() - CalculateTotalPlayableNotes() - End Sub - - Private Sub ConvertNT2BMSE() - ReDim SelectedNotes(-1) - Dim xK(0) As Note - xK(0) = Notes(0) - - For xI1 As Integer = 1 To UBound(Notes) - ReDim Preserve xK(UBound(xK) + 1) - With xK(UBound(xK)) - .ColumnIndex = Notes(xI1).ColumnIndex - .LongNote = Notes(xI1).Length > 0 - .Landmine = Notes(xI1).Landmine - .Value = Notes(xI1).Value - .VPosition = Notes(xI1).VPosition - .Selected = Notes(xI1).Selected - .Hidden = Notes(xI1).Hidden - End With - - If Notes(xI1).Length > 0 Then - ReDim Preserve xK(UBound(xK) + 1) - With xK(UBound(xK)) - .ColumnIndex = Notes(xI1).ColumnIndex - .LongNote = True - .Landmine = False - .Value = Notes(xI1).Value - .VPosition = Notes(xI1).VPosition + Notes(xI1).Length - .Selected = Notes(xI1).Selected - .Hidden = Notes(xI1).Hidden - End With - End If - Next - - Notes = xK - - SortByVPositionInsertion() - UpdatePairing() - CalculateTotalPlayableNotes() - End Sub - - Private Sub TBWavIncrease_Click(sender As Object, e As EventArgs) Handles TBWavIncrease.Click - Dim xUndo As UndoRedo.LinkedURCmd = Nothing - Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void - Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo - - TBWavIncrease.Checked = Not sender.Checked - RedoWavIncrease(TBWavIncrease.Checked, xUndo, xRedo) - AddUndo(xUndo, xBaseRedo.Next) - End Sub - - Private Sub TBNTInput_Click(sender As Object, e As EventArgs) Handles TBNTInput.Click, mnNTInput.Click - 'Dim xUndo As String = "NT_" & CInt(NTInput) & "_0" & vbCrLf & "KZ" & vbCrLf & sCmdKsAll(False) - 'Dim xRedo As String = "NT_" & CInt(Not NTInput) & "_1" - Dim xUndo As UndoRedo.LinkedURCmd = Nothing - Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void - Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo - - RedoRemoveNoteAll(False, xUndo, xRedo) - - NTInput = sender.Checked - - TBNTInput.Checked = NTInput - mnNTInput.Checked = NTInput - POBLong.Enabled = Not NTInput - POBLongShort.Enabled = Not NTInput - - bAdjustLength = False - bAdjustUpper = False - - RedoNT(NTInput, False, xUndo, xRedo) - If NTInput Then - ConvertBMSE2NT() - Else - ConvertNT2BMSE() - End If - RedoAddNoteAll(False, xUndo, xRedo) - - AddUndo(xUndo, xBaseRedo.Next) - RefreshPanelAll() - End Sub - - Private Sub THBPM_ValueChanged(sender As Object, e As EventArgs) Handles THBPM.ValueChanged - If Notes IsNot Nothing Then Notes(0).Value = THBPM.Value * 10000 : RefreshPanelAll() - If IsSaved Then SetIsSaved(False) - End Sub - - Private Sub TWPosition_ValueChanged(sender As Object, e As EventArgs) Handles TWPosition.ValueChanged - wPosition = TWPosition.Value - TWPosition2.Value = IIf(wPosition > TWPosition2.Maximum, TWPosition2.Maximum, wPosition) - RefreshPanelAll() - End Sub - - Private Sub TWLeft_ValueChanged(sender As Object, e As EventArgs) Handles TWLeft.ValueChanged - wLeft = TWLeft.Value - TWLeft2.Value = IIf(wLeft > TWLeft2.Maximum, TWLeft2.Maximum, wLeft) - RefreshPanelAll() - End Sub - - Private Sub TWWidth_ValueChanged(sender As Object, e As EventArgs) Handles TWWidth.ValueChanged - wWidth = TWWidth.Value - TWWidth2.Value = IIf(wWidth > TWWidth2.Maximum, TWWidth2.Maximum, wWidth) - RefreshPanelAll() - End Sub - - Private Sub TWPrecision_ValueChanged(sender As Object, e As EventArgs) Handles TWPrecision.ValueChanged - wPrecision = TWPrecision.Value - TWPrecision2.Value = IIf(wPrecision > TWPrecision2.Maximum, TWPrecision2.Maximum, wPrecision) - RefreshPanelAll() - End Sub - - Private Sub TWTransparency_ValueChanged(sender As Object, e As EventArgs) Handles TWTransparency.ValueChanged - TWTransparency2.Value = TWTransparency.Value - vo.pBGMWav.Color = Color.FromArgb(TWTransparency.Value, vo.pBGMWav.Color) - RefreshPanelAll() - End Sub - - Private Sub TWSaturation_ValueChanged(sender As Object, e As EventArgs) Handles TWSaturation.ValueChanged - Dim xColor As Color = vo.pBGMWav.Color - TWSaturation2.Value = TWSaturation.Value - vo.pBGMWav.Color = HSL2RGB(xColor.GetHue, TWSaturation.Value, xColor.GetBrightness * 1000, xColor.A) - RefreshPanelAll() - End Sub - - Private Sub TWPosition2_Scroll(sender As Object, e As EventArgs) Handles TWPosition2.Scroll - TWPosition.Value = TWPosition2.Value - End Sub - - Private Sub TWLeft2_Scroll(sender As Object, e As EventArgs) Handles TWLeft2.Scroll - TWLeft.Value = TWLeft2.Value - End Sub - - Private Sub TWWidth2_Scroll(sender As Object, e As EventArgs) Handles TWWidth2.Scroll - TWWidth.Value = TWWidth2.Value - End Sub - - Private Sub TWPrecision2_Scroll(sender As Object, e As EventArgs) Handles TWPrecision2.Scroll - TWPrecision.Value = TWPrecision2.Value - End Sub - - Private Sub TWTransparency2_Scroll(sender As Object, e As EventArgs) Handles TWTransparency2.Scroll - TWTransparency.Value = TWTransparency2.Value - End Sub - - Private Sub TWSaturation2_Scroll(sender As Object, e As EventArgs) Handles TWSaturation2.Scroll - TWSaturation.Value = TWSaturation2.Value - End Sub - - Private Sub TBLangDef_Click(sender As Object, e As EventArgs) Handles TBLangDef.Click - DispLang = String.Empty - Dim unused = MsgBox(Strings.Messages.PreferencePostpone, MsgBoxStyle.Information) - End Sub - - Private Sub TBLangRefresh_Click(sender As Object, e As EventArgs) Handles TBLangRefresh.Click - For xI1 As Integer = cmnLanguage.Items.Count - 1 To 3 Step -1 - Try - cmnLanguage.Items.RemoveAt(xI1) - Catch ex As Exception - End Try - Next - - If Not Directory.Exists(My.Application.Info.DirectoryPath & "\Data") Then My.Computer.FileSystem.CreateDirectory(My.Application.Info.DirectoryPath & "\Data") - Dim xFileNames() As FileInfo = My.Computer.FileSystem.GetDirectoryInfo(My.Application.Info.DirectoryPath & "\Data").GetFiles("*.Lang.xml") - - For Each xStr As FileInfo In xFileNames - LoadLocaleXML(xStr) - Next - End Sub - - - Private Sub UpdateColumnsX() - column(0).Left = 0 - 'If col(0).Width = 0 Then col(0).Visible = False - - For xI1 As Integer = 1 To UBound(column) - column(xI1).Left = column(xI1 - 1).Left + IIf(column(xI1 - 1).isVisible, column(xI1 - 1).Width, 0) - 'If col(xI1).Width = 0 Then col(xI1).Visible = False - Next - HSL.Maximum = nLeft(gColumns) + column(niB).Width - HS.Maximum = nLeft(gColumns) + column(niB).Width - HSR.Maximum = nLeft(gColumns) + column(niB).Width - End Sub - - Private Sub CHPlayer_SelectedIndexChanged(sender As Object, e As EventArgs) Handles CHPlayer.SelectedIndexChanged - If CHPlayer.SelectedIndex = -1 Then CHPlayer.SelectedIndex = 0 - - iPlayer = CHPlayer.SelectedIndex - Dim xGP2 As Boolean = iPlayer <> 0 - column(niD8).isVisible = xGP2 And column(niAA).isVisible - column(niD9).isVisible = xGP2 And column(niAB).isVisible - column(niDA).isVisible = xGP2 And column(niAC).isVisible - column(niDB).isVisible = xGP2 And column(niAD).isVisible - column(niDC).isVisible = xGP2 And column(niAE).isVisible - column(niDD).isVisible = xGP2 And column(niAF).isVisible - column(niDE).isVisible = xGP2 And column(niAG).isVisible - column(niDF).isVisible = xGP2 And column(niAH).isVisible - column(niDG).isVisible = xGP2 And column(niAI).isVisible - column(niDH).isVisible = xGP2 And column(niAJ).isVisible - column(niDI).isVisible = xGP2 And column(niAK).isVisible - column(niDJ).isVisible = xGP2 And column(niAL).isVisible - column(niDK).isVisible = xGP2 And column(niAM).isVisible - column(niDL).isVisible = xGP2 And column(niAN).isVisible - column(niDM).isVisible = xGP2 And column(niAO).isVisible - column(niDN).isVisible = xGP2 And column(niAP).isVisible - column(niDO).isVisible = xGP2 And column(niAQ).isVisible - If Rscratch Then - column(niD1).isVisible = xGP2 And column(niA1).isVisible - column(niD2).isVisible = xGP2 And column(niA2).isVisible - column(niD3).isVisible = xGP2 And column(niA3).isVisible - column(niD4).isVisible = xGP2 And column(niA4).isVisible - column(niD5).isVisible = xGP2 And column(niA5).isVisible - column(niD6).isVisible = xGP2 And column(niA6).isVisible - column(niD7).isVisible = xGP2 And column(niA7).isVisible - column(niDP).isVisible = xGP2 And column(niA8).isVisible - column(niDQ).isVisible = xGP2 And column(niA9).isVisible - Else - column(niD1).isVisible = xGP2 And column(niA3).isVisible - column(niD2).isVisible = xGP2 And column(niA4).isVisible - column(niD3).isVisible = xGP2 And column(niA5).isVisible - column(niD4).isVisible = xGP2 And column(niA6).isVisible - column(niD5).isVisible = xGP2 And column(niA7).isVisible - column(niD6).isVisible = xGP2 And column(niA8).isVisible - column(niD7).isVisible = xGP2 And column(niA9).isVisible - column(niDP).isVisible = xGP2 And column(niA1).isVisible - column(niDQ).isVisible = xGP2 And column(niA2).isVisible - End If - column(niS3).isVisible = xGP2 - - For xI1 As Integer = 1 To UBound(Notes) - Notes(xI1).Selected = Notes(xI1).Selected And nEnabled(Notes(xI1).ColumnIndex) - Next - 'AddUndo(xUndo, xRedo) - UpdateColumnsX() - - If IsInitializing Then Exit Sub - RefreshPanelAll() - End Sub - - Private Sub CGB_ValueChanged(sender As Object, e As EventArgs) Handles CGB.ValueChanged - gColumns = niB + CGB.Value - 1 - UpdateColumnsX() - RefreshPanelAll() - End Sub - - Private Sub TBGOptions_Click(sender As Object, e As EventArgs) Handles TBGOptions.Click, mnGOptions.Click - Dim xTE As Integer - Select Case UCase(EncodingToString(TextEncoding)) ' az: wow seriously? is there really no better way? - Case "SYSTEM ANSI" : xTE = 0 - Case "LITTLE ENDIAN UTF16" : xTE = 1 - Case "ASCII" : xTE = 2 - Case "BIG ENDIAN UTF16" : xTE = 3 - Case "LITTLE ENDIAN UTF32" : xTE = 4 - Case "UTF7" : xTE = 5 - Case "UTF8" : xTE = 6 - Case "SJIS" : xTE = 7 - Case "EUC-KR" : xTE = 8 - Case Else : xTE = 0 - End Select - - Dim xDiag As New OpGeneral(gWheel, gPgUpDn, MiddleButtonMoveMethod, xTE, 192.0R / BMSGridLimit, - AutoSaveInterval, BeepWhileSaved, BPMx1296, STOPx1296, - AutoFocusMouseEnter, FirstClickDisabled, ClickStopPreview) - - If xDiag.ShowDialog() = Forms.DialogResult.OK Then - With xDiag - gWheel = .zWheel - gPgUpDn = .zPgUpDn - TextEncoding = .zEncoding - 'SortingMethod = .zSort - MiddleButtonMoveMethod = .zMiddle - AutoSaveInterval = .zAutoSave - BMSGridLimit = 192.0R / .zGridPartition - BeepWhileSaved = .cBeep.Checked - BPMx1296 = .cBpm1296.Checked - STOPx1296 = .cStop1296.Checked - AutoFocusMouseEnter = .cMEnterFocus.Checked - FirstClickDisabled = .cMClickFocus.Checked - ClickStopPreview = .cMStopPreview.Checked - End With - If AutoSaveInterval Then AutoSaveTimer.Interval = AutoSaveInterval - AutoSaveTimer.Enabled = AutoSaveInterval - End If - End Sub - - Private Sub POBLong_Click(sender As Object, e As EventArgs) Handles POBLong.Click - If NTInput Then Exit Sub - - Dim xUndo As UndoRedo.LinkedURCmd = Nothing - Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void - Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo - - For xI1 As Integer = 1 To UBound(Notes) - If Not Notes(xI1).Selected Then Continue For - - RedoLongNoteModify(Notes(xI1), Notes(xI1).VPosition, True, xUndo, xRedo) - Notes(xI1).LongNote = True - Next - AddUndo(xUndo, xBaseRedo.Next) - SortByVPositionInsertion() - UpdatePairing() - RefreshPanelAll() - End Sub - - Private Sub POBNormal_Click(sender As Object, e As EventArgs) Handles POBShort.Click - Dim xUndo As UndoRedo.LinkedURCmd = Nothing - Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void - Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo - - If Not NTInput Then - For xI1 As Integer = 1 To UBound(Notes) - If Not Notes(xI1).Selected Then Continue For - - RedoLongNoteModify(Notes(xI1), Notes(xI1).VPosition, 0, xUndo, xRedo) - Notes(xI1).LongNote = False - Next - - Else - For xI1 As Integer = 1 To UBound(Notes) - If Not Notes(xI1).Selected Then Continue For - - RedoLongNoteModify(Notes(xI1), Notes(xI1).VPosition, 0, xUndo, xRedo) - Notes(xI1).Length = 0 - Next - End If - - AddUndo(xUndo, xBaseRedo.Next) - SortByVPositionInsertion() - UpdatePairing() - RefreshPanelAll() - End Sub - - Private Sub POBNormalLong_Click(sender As Object, e As EventArgs) Handles POBLongShort.Click - If NTInput Then Exit Sub - - Dim xUndo As UndoRedo.LinkedURCmd = Nothing - Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void - Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo - - For xI1 As Integer = 1 To UBound(Notes) - If Not Notes(xI1).Selected Then Continue For - - RedoLongNoteModify(Notes(xI1), Notes(xI1).VPosition, Not Notes(xI1).LongNote, xUndo, xRedo) - Notes(xI1).LongNote = Not Notes(xI1).LongNote - Next - - AddUndo(xUndo, xBaseRedo.Next) - SortByVPositionInsertion() - UpdatePairing() - RefreshPanelAll() - End Sub - - Private Sub POBHidden_Click(sender As Object, e As EventArgs) Handles POBHidden.Click - Dim xUndo As UndoRedo.LinkedURCmd = Nothing - Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void - Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo - - For xI1 As Integer = 1 To UBound(Notes) - If Not Notes(xI1).Selected Then Continue For - - RedoHiddenNoteModify(Notes(xI1), True, True, xUndo, xRedo) - Notes(xI1).Hidden = True - Next - AddUndo(xUndo, xBaseRedo.Next) - SortByVPositionInsertion() - UpdatePairing() - RefreshPanelAll() - End Sub - - Private Sub POBVisible_Click(sender As Object, e As EventArgs) Handles POBVisible.Click - Dim xUndo As UndoRedo.LinkedURCmd = Nothing - Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void - Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo - - For xI1 As Integer = 1 To UBound(Notes) - If Not Notes(xI1).Selected Then Continue For - - RedoHiddenNoteModify(Notes(xI1), False, True, xUndo, xRedo) - Notes(xI1).Hidden = False - Next - AddUndo(xUndo, xBaseRedo.Next) - SortByVPositionInsertion() - UpdatePairing() - RefreshPanelAll() - End Sub - - Private Sub POBHiddenVisible_Click(sender As Object, e As EventArgs) Handles POBHiddenVisible.Click - Dim xUndo As UndoRedo.LinkedURCmd = Nothing - Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void - Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo - - For xI1 As Integer = 1 To UBound(Notes) - If Not Notes(xI1).Selected Then Continue For - - RedoHiddenNoteModify(Notes(xI1), Not Notes(xI1).Hidden, True, xUndo, xRedo) - Notes(xI1).Hidden = Not Notes(xI1).Hidden - Next - AddUndo(xUndo, xBaseRedo.Next) - SortByVPositionInsertion() - UpdatePairing() - RefreshPanelAll() - End Sub - - Private Sub POBModify_Click(sender As Object, e As EventArgs) Handles POBModify.Click - Dim xNum As Boolean = False - Dim xLbl As Boolean = False - Dim xI1 As Integer - - For xI1 = 1 To UBound(Notes) - If Notes(xI1).Selected AndAlso IsColumnNumeric(Notes(xI1).ColumnIndex) Then xNum = True : Exit For - Next - For xI1 = 1 To UBound(Notes) - If Notes(xI1).Selected AndAlso Not IsColumnNumeric(Notes(xI1).ColumnIndex) Then xLbl = True : Exit For - Next - If Not (xNum Or xLbl) Then Exit Sub - - If xNum Then - Dim xD1 As Double = Val(InputBox(Strings.Messages.PromptEnterNumeric, Text)) * 10000 - If Not xD1 = 0 Then - If xD1 <= 0 Then xD1 = 1 - - Dim xUndo As UndoRedo.LinkedURCmd = Nothing - Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void - Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo - - For xI1 = 1 To UBound(Notes) - If Not IsColumnNumeric(Notes(xI1).ColumnIndex) Then Continue For - If Not Notes(xI1).Selected Then Continue For - - RedoRelabelNote(Notes(xI1), xD1, xUndo, xRedo) - Notes(xI1).Value = xD1 - Next - AddUndo(xUndo, xBaseRedo.Next) - End If - End If - - If xLbl Then - Dim xStr As String = UCase(Trim(InputBox(Strings.Messages.PromptEnter, Text))) - - If Len(xStr) = 0 Then GoTo Jump2 - If xStr = "00" Or xStr = "0" Then GoTo Jump1 - If Not Len(xStr) = 1 And Not Len(xStr) = 2 Then GoTo Jump1 - - Dim xI3 As Integer = Asc(Mid(xStr, 1, 1)) - If Not ((xI3 >= 48 And xI3 <= 57) Or (xI3 >= 65 And xI3 <= 90)) Then GoTo Jump1 - If Len(xStr) = 2 Then - Dim xI4 As Integer = Asc(Mid(xStr, 2, 1)) - If Not ((xI4 >= 48 And xI4 <= 57) Or (xI4 >= 65 And xI4 <= 90)) Then GoTo Jump1 - End If - Dim xVal As Integer = C36to10(xStr) * 10000 - - Dim xUndo As UndoRedo.LinkedURCmd = Nothing - Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void - Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo - - For xI1 = 1 To UBound(Notes) - If IsColumnNumeric(Notes(xI1).ColumnIndex) Then Continue For - If Not Notes(xI1).Selected Then Continue For - - RedoRelabelNote(Notes(xI1), xVal, xUndo, xRedo) - Notes(xI1).Value = xVal - Next - AddUndo(xUndo, xBaseRedo.Next) - GoTo Jump2 + If IsSaved Then SetIsSaved(False) + + If ReferenceEquals(sender, THLandMine) Then + hWAV(0) = THLandMine.Text + ElseIf ReferenceEquals(sender, THMissBMP) Then + hBMP(0) = THMissBMP.Text + End If + End Sub + + Private Sub CHLnObj_SelectedIndexChanged(sender As Object, e As EventArgs) Handles CHLnObj.SelectedIndexChanged + If IsSaved Then SetIsSaved(False) + LnObj = CHLnObj.SelectedIndex + UpdatePairing() + RefreshPanelAll() + End Sub + + Private Sub ConvertBMSE2NT() + ReDim SelectedNotes(-1) + SortByVPositionInsertion() + + For i2 As Integer = 0 To UBound(Notes) + Notes(i2).Length = 0.0# + Next + + Dim i As Integer = 1 + Dim j As Integer = 0 + Dim xUbound As Integer = UBound(Notes) + + Do While i <= xUbound + If Not Notes(i).LongNote Then i += 1 : Continue Do + + For j = i + 1 To xUbound + If Notes(j).ColumnIndex <> Notes(i).ColumnIndex Then Continue For + + If Notes(j).LongNote Then + Notes(i).Length = Notes(j).VPosition - Notes(i).VPosition + For j2 As Integer = j To xUbound - 1 + Notes(j2) = Notes(j2 + 1) + Next + xUbound -= 1 + Exit For + + ElseIf Notes(j).Value \ 10000 = LnObj Then + Exit For + + End If + Next + + i += 1 + Loop + + ReDim Preserve Notes(xUbound) + + For i = 0 To xUbound + Notes(i).LongNote = False + Next + + SortByVPositionInsertion() + UpdatePairing() + CalculateTotalPlayableNotes() + End Sub + + Private Sub ConvertNT2BMSE() + ReDim SelectedNotes(-1) + Dim xK(0) As Note + xK(0) = Notes(0) + + For xI1 As Integer = 1 To UBound(Notes) + ReDim Preserve xK(UBound(xK) + 1) + With xK(UBound(xK)) + .ColumnIndex = Notes(xI1).ColumnIndex + .LongNote = Notes(xI1).Length > 0 + .Landmine = Notes(xI1).Landmine + .Value = Notes(xI1).Value + .VPosition = Notes(xI1).VPosition + .Selected = Notes(xI1).Selected + .Hidden = Notes(xI1).Hidden + End With + + If Notes(xI1).Length > 0 Then + ReDim Preserve xK(UBound(xK) + 1) + With xK(UBound(xK)) + .ColumnIndex = Notes(xI1).ColumnIndex + .LongNote = True + .Landmine = False + .Value = Notes(xI1).Value + .VPosition = Notes(xI1).VPosition + Notes(xI1).Length + .Selected = Notes(xI1).Selected + .Hidden = Notes(xI1).Hidden + End With + End If + Next + + Notes = xK + + SortByVPositionInsertion() + UpdatePairing() + CalculateTotalPlayableNotes() + End Sub + + Private Sub TBWavIncrease_Click(sender As Object, e As EventArgs) Handles TBWavIncrease.Click + Dim xUndo As UndoRedo.LinkedURCmd = Nothing + Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void + Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo + + TBWavIncrease.Checked = Not sender.Checked + RedoWavIncrease(TBWavIncrease.Checked, xUndo, xRedo) + AddUndo(xUndo, xBaseRedo.Next) + End Sub + + Private Sub TBNTInput_Click(sender As Object, e As EventArgs) Handles TBNTInput.Click, mnNTInput.Click + 'Dim xUndo As String = "NT_" & CInt(NTInput) & "_0" & vbCrLf & "KZ" & vbCrLf & sCmdKsAll(False) + 'Dim xRedo As String = "NT_" & CInt(Not NTInput) & "_1" + Dim xUndo As UndoRedo.LinkedURCmd = Nothing + Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void + Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo + + RedoRemoveNoteAll(False, xUndo, xRedo) + + NTInput = sender.Checked + + TBNTInput.Checked = NTInput + mnNTInput.Checked = NTInput + POBLong.Enabled = Not NTInput + POBLongShort.Enabled = Not NTInput + + bAdjustLength = False + bAdjustUpper = False + + RedoNT(NTInput, False, xUndo, xRedo) + If NTInput Then + ConvertBMSE2NT() + Else + ConvertNT2BMSE() + End If + RedoAddNoteAll(False, xUndo, xRedo) + + AddUndo(xUndo, xBaseRedo.Next) + RefreshPanelAll() + End Sub + + Private Sub THBPM_ValueChanged(sender As Object, e As EventArgs) Handles THBPM.ValueChanged + If Notes IsNot Nothing Then Notes(0).Value = THBPM.Value * 10000 : RefreshPanelAll() + If IsSaved Then SetIsSaved(False) + End Sub + + Private Sub TWPosition_ValueChanged(sender As Object, e As EventArgs) Handles TWPosition.ValueChanged + wPosition = TWPosition.Value + TWPosition2.Value = IIf(wPosition > TWPosition2.Maximum, TWPosition2.Maximum, wPosition) + RefreshPanelAll() + End Sub + + Private Sub TWLeft_ValueChanged(sender As Object, e As EventArgs) Handles TWLeft.ValueChanged + wLeft = TWLeft.Value + TWLeft2.Value = IIf(wLeft > TWLeft2.Maximum, TWLeft2.Maximum, wLeft) + RefreshPanelAll() + End Sub + + Private Sub TWWidth_ValueChanged(sender As Object, e As EventArgs) Handles TWWidth.ValueChanged + wWidth = TWWidth.Value + TWWidth2.Value = IIf(wWidth > TWWidth2.Maximum, TWWidth2.Maximum, wWidth) + RefreshPanelAll() + End Sub + + Private Sub TWPrecision_ValueChanged(sender As Object, e As EventArgs) Handles TWPrecision.ValueChanged + wPrecision = TWPrecision.Value + TWPrecision2.Value = IIf(wPrecision > TWPrecision2.Maximum, TWPrecision2.Maximum, wPrecision) + RefreshPanelAll() + End Sub + + Private Sub TWTransparency_ValueChanged(sender As Object, e As EventArgs) Handles TWTransparency.ValueChanged + TWTransparency2.Value = TWTransparency.Value + vo.pBGMWav.Color = Color.FromArgb(TWTransparency.Value, vo.pBGMWav.Color) + RefreshPanelAll() + End Sub + + Private Sub TWSaturation_ValueChanged(sender As Object, e As EventArgs) Handles TWSaturation.ValueChanged + Dim xColor As Color = vo.pBGMWav.Color + TWSaturation2.Value = TWSaturation.Value + vo.pBGMWav.Color = HSL2RGB(xColor.GetHue, TWSaturation.Value, xColor.GetBrightness * 1000, xColor.A) + RefreshPanelAll() + End Sub + + Private Sub TWPosition2_Scroll(sender As Object, e As EventArgs) Handles TWPosition2.Scroll + TWPosition.Value = TWPosition2.Value + End Sub + + Private Sub TWLeft2_Scroll(sender As Object, e As EventArgs) Handles TWLeft2.Scroll + TWLeft.Value = TWLeft2.Value + End Sub + + Private Sub TWWidth2_Scroll(sender As Object, e As EventArgs) Handles TWWidth2.Scroll + TWWidth.Value = TWWidth2.Value + End Sub + + Private Sub TWPrecision2_Scroll(sender As Object, e As EventArgs) Handles TWPrecision2.Scroll + TWPrecision.Value = TWPrecision2.Value + End Sub + + Private Sub TWTransparency2_Scroll(sender As Object, e As EventArgs) Handles TWTransparency2.Scroll + TWTransparency.Value = TWTransparency2.Value + End Sub + + Private Sub TWSaturation2_Scroll(sender As Object, e As EventArgs) Handles TWSaturation2.Scroll + TWSaturation.Value = TWSaturation2.Value + End Sub + + Private Sub TBLangDef_Click(sender As Object, e As EventArgs) Handles TBLangDef.Click + DispLang = String.Empty + Dim unused = MsgBox(Strings.Messages.PreferencePostpone, MsgBoxStyle.Information) + End Sub + + Private Sub TBLangRefresh_Click(sender As Object, e As EventArgs) Handles TBLangRefresh.Click + For xI1 As Integer = cmnLanguage.Items.Count - 1 To 3 Step -1 + Try + cmnLanguage.Items.RemoveAt(xI1) + Catch ex As Exception + End Try + Next + + If Not Directory.Exists(My.Application.Info.DirectoryPath & "\Data") Then My.Computer.FileSystem.CreateDirectory(My.Application.Info.DirectoryPath & "\Data") + Dim xFileNames() As FileInfo = My.Computer.FileSystem.GetDirectoryInfo(My.Application.Info.DirectoryPath & "\Data").GetFiles("*.Lang.xml") + + For Each xStr As FileInfo In xFileNames + LoadLocaleXML(xStr) + Next + End Sub + + + Private Sub UpdateColumnsX() + column(0).Left = 0 + 'If col(0).Width = 0 Then col(0).Visible = False + + For xI1 As Integer = 1 To UBound(column) + column(xI1).Left = column(xI1 - 1).Left + IIf(column(xI1 - 1).isVisible, column(xI1 - 1).Width, 0) + 'If col(xI1).Width = 0 Then col(xI1).Visible = False + Next + HSL.Maximum = nLeft(gColumns) + column(niB).Width + HS.Maximum = nLeft(gColumns) + column(niB).Width + HSR.Maximum = nLeft(gColumns) + column(niB).Width + End Sub + + Private Sub CHPlayer_SelectedIndexChanged(sender As Object, e As EventArgs) Handles CHPlayer.SelectedIndexChanged + If CHPlayer.SelectedIndex = -1 Then CHPlayer.SelectedIndex = 0 + + iPlayer = CHPlayer.SelectedIndex + Dim xGP2 As Boolean = iPlayer <> 0 + column(niD8).isVisible = xGP2 And column(niAA).isVisible + column(niD9).isVisible = xGP2 And column(niAB).isVisible + column(niDA).isVisible = xGP2 And column(niAC).isVisible + column(niDB).isVisible = xGP2 And column(niAD).isVisible + column(niDC).isVisible = xGP2 And column(niAE).isVisible + column(niDD).isVisible = xGP2 And column(niAF).isVisible + column(niDE).isVisible = xGP2 And column(niAG).isVisible + column(niDF).isVisible = xGP2 And column(niAH).isVisible + column(niDG).isVisible = xGP2 And column(niAI).isVisible + column(niDH).isVisible = xGP2 And column(niAJ).isVisible + column(niDI).isVisible = xGP2 And column(niAK).isVisible + column(niDJ).isVisible = xGP2 And column(niAL).isVisible + column(niDK).isVisible = xGP2 And column(niAM).isVisible + column(niDL).isVisible = xGP2 And column(niAN).isVisible + column(niDM).isVisible = xGP2 And column(niAO).isVisible + column(niDN).isVisible = xGP2 And column(niAP).isVisible + column(niDO).isVisible = xGP2 And column(niAQ).isVisible + If Rscratch Then + column(niD1).isVisible = xGP2 And column(niA1).isVisible + column(niD2).isVisible = xGP2 And column(niA2).isVisible + column(niD3).isVisible = xGP2 And column(niA3).isVisible + column(niD4).isVisible = xGP2 And column(niA4).isVisible + column(niD5).isVisible = xGP2 And column(niA5).isVisible + column(niD6).isVisible = xGP2 And column(niA6).isVisible + column(niD7).isVisible = xGP2 And column(niA7).isVisible + column(niDP).isVisible = xGP2 And column(niA8).isVisible + column(niDQ).isVisible = xGP2 And column(niA9).isVisible + Else + column(niD1).isVisible = xGP2 And column(niA3).isVisible + column(niD2).isVisible = xGP2 And column(niA4).isVisible + column(niD3).isVisible = xGP2 And column(niA5).isVisible + column(niD4).isVisible = xGP2 And column(niA6).isVisible + column(niD5).isVisible = xGP2 And column(niA7).isVisible + column(niD6).isVisible = xGP2 And column(niA8).isVisible + column(niD7).isVisible = xGP2 And column(niA9).isVisible + column(niDP).isVisible = xGP2 And column(niA1).isVisible + column(niDQ).isVisible = xGP2 And column(niA2).isVisible + End If + column(niS3).isVisible = xGP2 + + For xI1 As Integer = 1 To UBound(Notes) + Notes(xI1).Selected = Notes(xI1).Selected And nEnabled(Notes(xI1).ColumnIndex) + Next + 'AddUndo(xUndo, xRedo) + UpdateColumnsX() + + If IsInitializing Then Exit Sub + RefreshPanelAll() + End Sub + + Private Sub CGB_ValueChanged(sender As Object, e As EventArgs) Handles CGB.ValueChanged + gColumns = niB + CGB.Value - 1 + UpdateColumnsX() + RefreshPanelAll() + End Sub + + Private Sub TBGOptions_Click(sender As Object, e As EventArgs) Handles TBGOptions.Click, mnGOptions.Click + Dim xTE As Integer + Select Case UCase(EncodingToString(TextEncoding)) ' az: wow seriously? is there really no better way? + Case "SYSTEM ANSI" : xTE = 0 + Case "LITTLE ENDIAN UTF16" : xTE = 1 + Case "ASCII" : xTE = 2 + Case "BIG ENDIAN UTF16" : xTE = 3 + Case "LITTLE ENDIAN UTF32" : xTE = 4 + Case "UTF7" : xTE = 5 + Case "UTF8" : xTE = 6 + Case "SJIS" : xTE = 7 + Case "EUC-KR" : xTE = 8 + Case Else : xTE = 0 + End Select + + Dim xDiag As New OpGeneral(gWheel, gPgUpDn, MiddleButtonMoveMethod, xTE, 192.0R / BMSGridLimit, + AutoSaveInterval, BeepWhileSaved, BPMx1296, STOPx1296, + AutoFocusMouseEnter, FirstClickDisabled, ClickStopPreview) + + If xDiag.ShowDialog() = Forms.DialogResult.OK Then + With xDiag + gWheel = .zWheel + gPgUpDn = .zPgUpDn + TextEncoding = .zEncoding + 'SortingMethod = .zSort + MiddleButtonMoveMethod = .zMiddle + AutoSaveInterval = .zAutoSave + BMSGridLimit = 192.0R / .zGridPartition + BeepWhileSaved = .cBeep.Checked + BPMx1296 = .cBpm1296.Checked + STOPx1296 = .cStop1296.Checked + AutoFocusMouseEnter = .cMEnterFocus.Checked + FirstClickDisabled = .cMClickFocus.Checked + ClickStopPreview = .cMStopPreview.Checked + End With + If AutoSaveInterval Then AutoSaveTimer.Interval = AutoSaveInterval + AutoSaveTimer.Enabled = AutoSaveInterval + End If + End Sub + + Private Sub POBLong_Click(sender As Object, e As EventArgs) Handles POBLong.Click + If NTInput Then Exit Sub + + Dim xUndo As UndoRedo.LinkedURCmd = Nothing + Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void + Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo + + For xI1 As Integer = 1 To UBound(Notes) + If Not Notes(xI1).Selected Then Continue For + + RedoLongNoteModify(Notes(xI1), Notes(xI1).VPosition, True, xUndo, xRedo) + Notes(xI1).LongNote = True + Next + AddUndo(xUndo, xBaseRedo.Next) + SortByVPositionInsertion() + UpdatePairing() + RefreshPanelAll() + End Sub + + Private Sub POBNormal_Click(sender As Object, e As EventArgs) Handles POBShort.Click + Dim xUndo As UndoRedo.LinkedURCmd = Nothing + Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void + Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo + + If Not NTInput Then + For xI1 As Integer = 1 To UBound(Notes) + If Not Notes(xI1).Selected Then Continue For + + RedoLongNoteModify(Notes(xI1), Notes(xI1).VPosition, 0, xUndo, xRedo) + Notes(xI1).LongNote = False + Next + + Else + For xI1 As Integer = 1 To UBound(Notes) + If Not Notes(xI1).Selected Then Continue For + + RedoLongNoteModify(Notes(xI1), Notes(xI1).VPosition, 0, xUndo, xRedo) + Notes(xI1).Length = 0 + Next + End If + + AddUndo(xUndo, xBaseRedo.Next) + SortByVPositionInsertion() + UpdatePairing() + RefreshPanelAll() + End Sub + + Private Sub POBNormalLong_Click(sender As Object, e As EventArgs) Handles POBLongShort.Click + If NTInput Then Exit Sub + + Dim xUndo As UndoRedo.LinkedURCmd = Nothing + Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void + Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo + + For xI1 As Integer = 1 To UBound(Notes) + If Not Notes(xI1).Selected Then Continue For + + RedoLongNoteModify(Notes(xI1), Notes(xI1).VPosition, Not Notes(xI1).LongNote, xUndo, xRedo) + Notes(xI1).LongNote = Not Notes(xI1).LongNote + Next + + AddUndo(xUndo, xBaseRedo.Next) + SortByVPositionInsertion() + UpdatePairing() + RefreshPanelAll() + End Sub + + Private Sub POBHidden_Click(sender As Object, e As EventArgs) Handles POBHidden.Click + Dim xUndo As UndoRedo.LinkedURCmd = Nothing + Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void + Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo + + For xI1 As Integer = 1 To UBound(Notes) + If Not Notes(xI1).Selected Then Continue For + + RedoHiddenNoteModify(Notes(xI1), True, True, xUndo, xRedo) + Notes(xI1).Hidden = True + Next + AddUndo(xUndo, xBaseRedo.Next) + SortByVPositionInsertion() + UpdatePairing() + RefreshPanelAll() + End Sub + + Private Sub POBVisible_Click(sender As Object, e As EventArgs) Handles POBVisible.Click + Dim xUndo As UndoRedo.LinkedURCmd = Nothing + Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void + Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo + + For xI1 As Integer = 1 To UBound(Notes) + If Not Notes(xI1).Selected Then Continue For + + RedoHiddenNoteModify(Notes(xI1), False, True, xUndo, xRedo) + Notes(xI1).Hidden = False + Next + AddUndo(xUndo, xBaseRedo.Next) + SortByVPositionInsertion() + UpdatePairing() + RefreshPanelAll() + End Sub + + Private Sub POBHiddenVisible_Click(sender As Object, e As EventArgs) Handles POBHiddenVisible.Click + Dim xUndo As UndoRedo.LinkedURCmd = Nothing + Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void + Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo + + For xI1 As Integer = 1 To UBound(Notes) + If Not Notes(xI1).Selected Then Continue For + + RedoHiddenNoteModify(Notes(xI1), Not Notes(xI1).Hidden, True, xUndo, xRedo) + Notes(xI1).Hidden = Not Notes(xI1).Hidden + Next + AddUndo(xUndo, xBaseRedo.Next) + SortByVPositionInsertion() + UpdatePairing() + RefreshPanelAll() + End Sub + + Private Sub POBModify_Click(sender As Object, e As EventArgs) Handles POBModify.Click + Dim xNum As Boolean = False + Dim xLbl As Boolean = False + Dim xI1 As Integer + + For xI1 = 1 To UBound(Notes) + If Notes(xI1).Selected AndAlso IsColumnNumeric(Notes(xI1).ColumnIndex) Then xNum = True : Exit For + Next + For xI1 = 1 To UBound(Notes) + If Notes(xI1).Selected AndAlso Not IsColumnNumeric(Notes(xI1).ColumnIndex) Then xLbl = True : Exit For + Next + If Not (xNum Or xLbl) Then Exit Sub + + If xNum Then + Dim xD1 As Double = Val(InputBox(Strings.Messages.PromptEnterNumeric, Text)) * 10000 + If Not xD1 = 0 Then + If xD1 <= 0 Then xD1 = 1 + + Dim xUndo As UndoRedo.LinkedURCmd = Nothing + Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void + Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo + + For xI1 = 1 To UBound(Notes) + If Not IsColumnNumeric(Notes(xI1).ColumnIndex) Then Continue For + If Not Notes(xI1).Selected Then Continue For + + RedoRelabelNote(Notes(xI1), xD1, xUndo, xRedo) + Notes(xI1).Value = xD1 + Next + AddUndo(xUndo, xBaseRedo.Next) + End If + End If + + If xLbl Then + Dim xStr As String = UCase(Trim(InputBox(Strings.Messages.PromptEnter, Text))) + + If Len(xStr) = 0 Then GoTo Jump2 + If xStr = "00" Or xStr = "0" Then GoTo Jump1 + If Not Len(xStr) = 1 And Not Len(xStr) = 2 Then GoTo Jump1 + + Dim xI3 As Integer = Asc(Mid(xStr, 1, 1)) + If Not ((xI3 >= 48 And xI3 <= 57) Or (xI3 >= 65 And xI3 <= 90)) Then GoTo Jump1 + If Len(xStr) = 2 Then + Dim xI4 As Integer = Asc(Mid(xStr, 2, 1)) + If Not ((xI4 >= 48 And xI4 <= 57) Or (xI4 >= 65 And xI4 <= 90)) Then GoTo Jump1 + End If + Dim xVal As Integer = C36to10(xStr) * 10000 + + Dim xUndo As UndoRedo.LinkedURCmd = Nothing + Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void + Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo + + For xI1 = 1 To UBound(Notes) + If IsColumnNumeric(Notes(xI1).ColumnIndex) Then Continue For + If Not Notes(xI1).Selected Then Continue For + + RedoRelabelNote(Notes(xI1), xVal, xUndo, xRedo) + Notes(xI1).Value = xVal + Next + AddUndo(xUndo, xBaseRedo.Next) + GoTo Jump2 Jump1: - Dim unused = MsgBox(Strings.Messages.InvalidLabel, MsgBoxStyle.Critical, Strings.Messages.Err) + Dim unused = MsgBox(Strings.Messages.InvalidLabel, MsgBoxStyle.Critical, Strings.Messages.Err) Jump2: - End If - - RefreshPanelAll() - End Sub - - Private Sub TBMyO2_Click(sender As Object, e As EventArgs) Handles TBMyO2.Click, mnMyO2.Click - Dim xDiag As New dgMyO2 - xDiag.Show() - End Sub - - - Private Sub TBFind_Click(sender As Object, e As EventArgs) Handles TBFind.Click, mnFind.Click - Dim xDiag As New diagFind(gColumns, Strings.Messages.Err, Strings.Messages.InvalidLabel) - xDiag.Show() - End Sub - - Private Function fdrCheck(xNote As Note) As Boolean - Return xNote.VPosition >= MeasureBottom(fdriMesL) And xNote.VPosition < MeasureBottom(fdriMesU) + MeasureLength(fdriMesU) AndAlso - IIf(IsColumnNumeric(xNote.ColumnIndex), - xNote.Value >= fdriValL And xNote.Value <= fdriValU, - xNote.Value >= fdriLblL And xNote.Value <= fdriLblU) AndAlso - Array.IndexOf(fdriCol, xNote.ColumnIndex) <> -1 - End Function - - Private Function fdrRangeS(xbLim1 As Boolean, xbLim2 As Boolean, xVal As Boolean) As Boolean - Return (Not xbLim1 And xbLim2 And xVal) Or (xbLim1 And Not xbLim2 And Not xVal) Or (xbLim1 And xbLim2) - End Function - - Public Sub fdrSelect(iRange As Integer, - xMesL As Integer, xMesU As Integer, - xLblL As String, xLblU As String, - xValL As Integer, xValU As Integer, - iCol() As Integer) - - fdriMesL = xMesL - fdriMesU = xMesU - fdriLblL = C36to10(xLblL) * 10000 - fdriLblU = C36to10(xLblU) * 10000 - fdriValL = xValL - fdriValU = xValU - fdriCol = iCol - - Dim xbSel As Boolean = iRange Mod 2 = 0 - Dim xbUnsel As Boolean = iRange Mod 3 = 0 - Dim xbShort As Boolean = iRange Mod 5 = 0 - Dim xbLong As Boolean = iRange Mod 7 = 0 - Dim xbHidden As Boolean = iRange Mod 11 = 0 - Dim xbVisible As Boolean = iRange Mod 13 = 0 - - Dim xSel(UBound(Notes)) As Boolean - For xI1 As Integer = 1 To UBound(Notes) - xSel(xI1) = Notes(xI1).Selected - Next - - 'Main process - For xI1 As Integer = 1 To UBound(Notes) - Dim bbba As Boolean = xbSel And xSel(xI1) - Dim bbbb As Boolean = xbUnsel And Not xSel(xI1) - Dim bbbc As Boolean = nEnabled(Notes(xI1).ColumnIndex) - Dim bbbd As Boolean = fdrRangeS(xbShort, xbLong, IIf(NTInput, Notes(xI1).Length, Notes(xI1).LongNote)) - Dim bbbe As Boolean = fdrRangeS(xbVisible, xbHidden, Notes(xI1).Hidden) - Dim bbbf As Boolean = fdrCheck(Notes(xI1)) - - If ((xbSel And xSel(xI1)) Or (xbUnsel And Not xSel(xI1))) AndAlso - nEnabled(Notes(xI1).ColumnIndex) AndAlso fdrRangeS(xbShort, xbLong, IIf(NTInput, Notes(xI1).Length, Notes(xI1).LongNote)) And fdrRangeS(xbVisible, xbHidden, Notes(xI1).Hidden) Then - Notes(xI1).Selected = fdrCheck(Notes(xI1)) - End If - Next - - RefreshPanelAll() - Beep() - End Sub - - Public Sub fdrUnselect(iRange As Integer, - xMesL As Integer, xMesU As Integer, - xLblL As String, xLblU As String, - xValL As Integer, xValU As Integer, - iCol() As Integer) - - fdriMesL = xMesL - fdriMesU = xMesU - fdriLblL = C36to10(xLblL) * 10000 - fdriLblU = C36to10(xLblU) * 10000 - fdriValL = xValL - fdriValU = xValU - fdriCol = iCol - - Dim xbSel As Boolean = iRange Mod 2 = 0 - Dim xbUnsel As Boolean = iRange Mod 3 = 0 - Dim xbShort As Boolean = iRange Mod 5 = 0 - Dim xbLong As Boolean = iRange Mod 7 = 0 - Dim xbHidden As Boolean = iRange Mod 11 = 0 - Dim xbVisible As Boolean = iRange Mod 13 = 0 - - Dim xSel(UBound(Notes)) As Boolean - For xI1 As Integer = 1 To UBound(Notes) - xSel(xI1) = Notes(xI1).Selected - Next - - 'Main process - For xI1 As Integer = 1 To UBound(Notes) - If ((xbSel And xSel(xI1)) Or (xbUnsel And Not xSel(xI1))) AndAlso - nEnabled(Notes(xI1).ColumnIndex) AndAlso fdrRangeS(xbShort, xbLong, IIf(NTInput, Notes(xI1).Length, Notes(xI1).LongNote)) And fdrRangeS(xbVisible, xbHidden, Notes(xI1).Hidden) Then - Notes(xI1).Selected = Not fdrCheck(Notes(xI1)) - End If - Next - - RefreshPanelAll() - Beep() - End Sub - - Public Sub fdrDelete(iRange As Integer, - xMesL As Integer, xMesU As Integer, - xLblL As String, xLblU As String, - xValL As Integer, xValU As Integer, - iCol() As Integer) - - fdriMesL = xMesL - fdriMesU = xMesU - fdriLblL = C36to10(xLblL) * 10000 - fdriLblU = C36to10(xLblU) * 10000 - fdriValL = xValL - fdriValU = xValU - fdriCol = iCol - - Dim xbSel As Boolean = iRange Mod 2 = 0 - Dim xbUnsel As Boolean = iRange Mod 3 = 0 - Dim xbShort As Boolean = iRange Mod 5 = 0 - Dim xbLong As Boolean = iRange Mod 7 = 0 - Dim xbHidden As Boolean = iRange Mod 11 = 0 - Dim xbVisible As Boolean = iRange Mod 13 = 0 - - Dim xUndo As UndoRedo.LinkedURCmd = Nothing - Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void - Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo - - 'Main process - Dim xI1 As Integer = 1 - Do While xI1 <= UBound(Notes) - If ((xbSel And Notes(xI1).Selected) Or (xbUnsel And Not Notes(xI1).Selected)) AndAlso - fdrCheck(Notes(xI1)) AndAlso nEnabled(Notes(xI1).ColumnIndex) AndAlso fdrRangeS(xbShort, xbLong, IIf(NTInput, Notes(xI1).Length, Notes(xI1).LongNote)) And fdrRangeS(xbVisible, xbHidden, Notes(xI1).Hidden) Then - RedoRemoveNote(Notes(xI1), xUndo, xRedo) - RemoveNote(xI1, False) - Else - xI1 += 1 - End If - Loop - - AddUndo(xUndo, xBaseRedo.Next) - SortByVPositionInsertion() - UpdatePairing() - RefreshPanelAll() - CalculateTotalPlayableNotes() - Beep() - End Sub - - Public Sub fdrReplaceL(iRange As Integer, - xMesL As Integer, xMesU As Integer, - xLblL As String, xLblU As String, - xValL As Integer, xValU As Integer, - iCol() As Integer, xReplaceLbl As String) - - fdriMesL = xMesL - fdriMesU = xMesU - fdriLblL = C36to10(xLblL) * 10000 - fdriLblU = C36to10(xLblU) * 10000 - fdriValL = xValL - fdriValU = xValU - fdriCol = iCol - - Dim xbSel As Boolean = iRange Mod 2 = 0 - Dim xbUnsel As Boolean = iRange Mod 3 = 0 - Dim xbShort As Boolean = iRange Mod 5 = 0 - Dim xbLong As Boolean = iRange Mod 7 = 0 - Dim xbHidden As Boolean = iRange Mod 11 = 0 - Dim xbVisible As Boolean = iRange Mod 13 = 0 - - Dim xxLbl As Integer = C36to10(xReplaceLbl) * 10000 - - Dim xUndo As UndoRedo.LinkedURCmd = Nothing - Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void - Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo - - 'Main process - For xI1 As Integer = 1 To UBound(Notes) - If ((xbSel And Notes(xI1).Selected) Or (xbUnsel And Not Notes(xI1).Selected)) AndAlso - fdrCheck(Notes(xI1)) AndAlso nEnabled(Notes(xI1).ColumnIndex) And Not IsColumnNumeric(Notes(xI1).ColumnIndex) AndAlso fdrRangeS(xbShort, xbLong, IIf(NTInput, Notes(xI1).Length, Notes(xI1).LongNote)) And fdrRangeS(xbVisible, xbHidden, Notes(xI1).Hidden) Then - 'xUndo &= sCmdKC(K(xI1).ColumnIndex, K(xI1).VPosition, xxLbl, IIf(NTInput, K(xI1).Length, K(xI1).LongNote), K(xI1).Hidden, 0, 0, K(xI1).Value, IIf(NTInput, K(xI1).Length, K(xI1).LongNote), K(xI1).Hidden, True) & vbCrLf - 'xRedo &= sCmdKC(K(xI1).ColumnIndex, K(xI1).VPosition, K(xI1).Value, IIf(NTInput, K(xI1).Length, K(xI1).LongNote), K(xI1).Hidden, 0, 0, xxLbl, IIf(NTInput, K(xI1).Length, K(xI1).LongNote), K(xI1).Hidden, True) & vbCrLf - RedoRelabelNote(Notes(xI1), xxLbl, xUndo, xRedo) - Notes(xI1).Value = xxLbl - End If - Next - - AddUndo(xUndo, xBaseRedo.Next) - RefreshPanelAll() - Beep() - End Sub - - Public Sub fdrReplaceV(iRange As Integer, - xMesL As Integer, xMesU As Integer, - xLblL As String, xLblU As String, - xValL As Integer, xValU As Integer, - iCol() As Integer, xReplaceVal As Integer) - - fdriMesL = xMesL - fdriMesU = xMesU - fdriLblL = C36to10(xLblL) * 10000 - fdriLblU = C36to10(xLblU) * 10000 - fdriValL = xValL - fdriValU = xValU - fdriCol = iCol - - Dim xbSel As Boolean = iRange Mod 2 = 0 - Dim xbUnsel As Boolean = iRange Mod 3 = 0 - Dim xbShort As Boolean = iRange Mod 5 = 0 - Dim xbLong As Boolean = iRange Mod 7 = 0 - Dim xbHidden As Boolean = iRange Mod 11 = 0 - Dim xbVisible As Boolean = iRange Mod 13 = 0 - - Dim xUndo As UndoRedo.LinkedURCmd = Nothing - Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void - Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo - - 'Main process - For xI1 As Integer = 1 To UBound(Notes) - If ((xbSel And Notes(xI1).Selected) Or (xbUnsel And Not Notes(xI1).Selected)) AndAlso - fdrCheck(Notes(xI1)) AndAlso nEnabled(Notes(xI1).ColumnIndex) And IsColumnNumeric(Notes(xI1).ColumnIndex) AndAlso fdrRangeS(xbShort, xbLong, IIf(NTInput, Notes(xI1).Length, Notes(xI1).LongNote)) And fdrRangeS(xbVisible, xbHidden, Notes(xI1).Hidden) Then - 'xUndo &= sCmdKC(K(xI1).ColumnIndex, K(xI1).VPosition, xReplaceVal, IIf(NTInput, K(xI1).Length, K(xI1).LongNote), K(xI1).Hidden, 0, 0, K(xI1).Value, IIf(NTInput, K(xI1).Length, K(xI1).LongNote), K(xI1).Hidden, True) & vbCrLf - 'xRedo &= sCmdKC(K(xI1).ColumnIndex, K(xI1).VPosition, K(xI1).Value, IIf(NTInput, K(xI1).Length, K(xI1).LongNote), K(xI1).Hidden, 0, 0, xReplaceVal, IIf(NTInput, K(xI1).Length, K(xI1).LongNote), K(xI1).Hidden, True) & vbCrLf - RedoRelabelNote(Notes(xI1), xReplaceVal, xUndo, xRedo) - Notes(xI1).Value = xReplaceVal - End If - Next - - AddUndo(xUndo, xBaseRedo.Next) - RefreshPanelAll() - Beep() - End Sub - - Private Sub MInsert_Click(sender As Object, e As EventArgs) Handles MInsert.Click - Dim xUndo As UndoRedo.LinkedURCmd = Nothing - Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void - Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo - - Dim xMeasure As Integer = MeasureAtDisplacement(menuVPosition) - Dim xMLength As Double = MeasureLength(xMeasure) - Dim xVP As Double = MeasureBottom(xMeasure) - - If NTInput Then - Dim xI1 As Integer = 1 - Do While xI1 <= UBound(Notes) - If MeasureAtDisplacement(Notes(xI1).VPosition) >= 999 Then - RedoRemoveNote(Notes(xI1), xUndo, xRedo) - RemoveNote(xI1, False) - Else - xI1 += 1 - End If - Loop - - Dim xdVP As Double - For xI1 = 1 To UBound(Notes) - If Notes(xI1).VPosition >= xVP And Notes(xI1).VPosition + Notes(xI1).Length <= MeasureBottom(999) Then - RedoMoveNote(Notes(xI1), Notes(xI1).ColumnIndex, Notes(xI1).VPosition + xMLength, xUndo, xRedo) - Notes(xI1).VPosition += xMLength - - ElseIf Notes(xI1).VPosition >= xVP Then - xdVP = MeasureBottom(999) - 1 - Notes(xI1).VPosition - Notes(xI1).Length - RedoLongNoteModify(Notes(xI1), Notes(xI1).VPosition + xMLength, Notes(xI1).Length + xdVP, xUndo, xRedo) - Notes(xI1).VPosition += xMLength - Notes(xI1).Length += xdVP - - ElseIf Notes(xI1).VPosition + Notes(xI1).Length >= xVP Then - xdVP = IIf(Notes(xI1).VPosition + Notes(xI1).Length > MeasureBottom(999) - 1, GetMaxVPosition() - 1 - Notes(xI1).VPosition - Notes(xI1).Length, xMLength) - RedoLongNoteModify(Notes(xI1), Notes(xI1).VPosition, Notes(xI1).Length + xdVP, xUndo, xRedo) - Notes(xI1).Length += xdVP - End If - Next - - Else - Dim xI1 As Integer = 1 - Do While xI1 <= UBound(Notes) - If MeasureAtDisplacement(Notes(xI1).VPosition) >= 999 Then - RedoRemoveNote(Notes(xI1), xUndo, xRedo) - RemoveNote(xI1, False) - Else - xI1 += 1 - End If - Loop - - For xI1 = 1 To UBound(Notes) - If Notes(xI1).VPosition >= xVP Then - RedoMoveNote(Notes(xI1), Notes(xI1).ColumnIndex, Notes(xI1).VPosition + xMLength, xUndo, xRedo) - Notes(xI1).VPosition += xMLength - End If - Next - End If - - For xI1 As Integer = 999 To xMeasure + 1 Step -1 - MeasureLength(xI1) = MeasureLength(xI1 - 1) - Next - UpdateMeasureBottom() - - AddUndo(xUndo, xBaseRedo.Next) - UpdatePairing() - CalculateGreatestVPosition() - CalculateTotalPlayableNotes() - RefreshPanelAll() - End Sub - - Private Sub MRemove_Click(sender As Object, e As EventArgs) Handles MRemove.Click - Dim xUndo As UndoRedo.LinkedURCmd = Nothing - Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void - Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo - - Dim xMeasure As Integer = MeasureAtDisplacement(menuVPosition) - Dim xMLength As Double = MeasureLength(xMeasure) - - Dim unused As Double = MeasureBottom(xMeasure) - - - Dim xVP As Double - If NTInput Then - Dim xI1 As Integer = 1 - Do While xI1 <= UBound(Notes) - If MeasureAtDisplacement(Notes(xI1).VPosition) = xMeasure And MeasureAtDisplacement(Notes(xI1).VPosition + Notes(xI1).Length) = xMeasure Then - RedoRemoveNote(Notes(xI1), xUndo, xRedo) - RemoveNote(xI1, False) - Else - xI1 += 1 - End If - Loop - - Dim xdVP As Double - xVP = MeasureBottom(xMeasure) - For xI1 = 1 To UBound(Notes) - If Notes(xI1).VPosition >= xVP + xMLength Then - RedoMoveNote(Notes(xI1), Notes(xI1).ColumnIndex, Notes(xI1).VPosition - xMLength, xUndo, xRedo) - Notes(xI1).VPosition -= xMLength - - ElseIf Notes(xI1).VPosition >= xVP Then - xdVP = xMLength + xVP - Notes(xI1).VPosition - RedoLongNoteModify(Notes(xI1), Notes(xI1).VPosition + xdVP - xMLength, Notes(xI1).Length - xdVP, xUndo, xRedo) - Notes(xI1).VPosition += xdVP - xMLength - Notes(xI1).Length -= xdVP - - ElseIf Notes(xI1).VPosition + Notes(xI1).Length >= xVP Then - xdVP = IIf(Notes(xI1).VPosition + Notes(xI1).Length >= xVP + xMLength, xMLength, Notes(xI1).VPosition + Notes(xI1).Length - xVP + 1) - RedoLongNoteModify(Notes(xI1), Notes(xI1).VPosition, Notes(xI1).Length - xdVP, xUndo, xRedo) - Notes(xI1).Length -= xdVP - End If - Next - - Else - Dim xI1 As Integer = 1 - Do While xI1 <= UBound(Notes) - If MeasureAtDisplacement(Notes(xI1).VPosition) = xMeasure Then - RedoRemoveNote(Notes(xI1), xUndo, xRedo) - RemoveNote(xI1, False) - Else - xI1 += 1 - End If - Loop - - xVP = MeasureBottom(xMeasure) - For xI1 = 1 To UBound(Notes) - If Notes(xI1).VPosition >= xVP Then - RedoMoveNote(Notes(xI1), Notes(xI1).ColumnIndex, Notes(xI1).VPosition - xMLength, xUndo, xRedo) - Notes(xI1).VPosition -= xMLength - End If - Next - End If - - For xI1 As Integer = 999 To xMeasure + 1 Step -1 - MeasureLength(xI1 - 1) = MeasureLength(xI1) - Next - UpdateMeasureBottom() - - AddUndo(xUndo, xBaseRedo.Next) - SortByVPositionInsertion() - UpdatePairing() - CalculateGreatestVPosition() - CalculateTotalPlayableNotes() - RefreshPanelAll() - End Sub - - Private Sub TBThemeDef_Click(sender As Object, e As EventArgs) Handles TBThemeDef.Click - Dim xTempFileName As String = My.Application.Info.DirectoryPath & "\____TempFile.Theme.xml" - My.Computer.FileSystem.WriteAllText(xTempFileName, My.Resources.O2Mania_Theme, False, System.Text.Encoding.Unicode) - LoadSettings(xTempFileName) - ChangePlaySideSkin(False) - File.Delete(xTempFileName) - - RefreshPanelAll() - End Sub - - Private Sub TBThemeSave_Click(sender As Object, e As EventArgs) Handles TBThemeSave.Click - Dim xDiag As New SaveFileDialog With { - .Filter = Strings.FileType.THEME_XML & "|*.Theme.xml", - .DefaultExt = "Theme.xml", - .InitialDirectory = My.Application.Info.DirectoryPath & "\Data" - } - If xDiag.ShowDialog = Forms.DialogResult.Cancel Then Exit Sub - - SaveSettings(xDiag.FileName, True) - If BeepWhileSaved Then Beep() - TBThemeRefresh_Click(TBThemeRefresh, New EventArgs) - End Sub - - Private Sub TBThemeRefresh_Click(sender As Object, e As EventArgs) Handles TBThemeRefresh.Click - For xI1 As Integer = cmnTheme.Items.Count - 1 To 5 Step -1 - Try - cmnTheme.Items.RemoveAt(xI1) - Catch ex As Exception - End Try - Next - - If Not Directory.Exists(My.Application.Info.DirectoryPath & "\Data") Then My.Computer.FileSystem.CreateDirectory(My.Application.Info.DirectoryPath & "\Data") - Dim xFileNames() As FileInfo = My.Computer.FileSystem.GetDirectoryInfo(My.Application.Info.DirectoryPath & "\Data").GetFiles("*.Theme.xml") - For Each xStr As FileInfo In xFileNames - Dim unused = cmnTheme.Items.Add(xStr.Name, Nothing, AddressOf LoadTheme) - Next - End Sub - - Private Sub TBThemeLoadComptability_Click(sender As Object, e As EventArgs) Handles TBThemeLoadComptability.Click - Dim xDiag As New OpenFileDialog With { - .Filter = Strings.FileType.TH & "|*.th", - .DefaultExt = "th", - .InitialDirectory = My.Application.Info.DirectoryPath - } - If My.Computer.FileSystem.DirectoryExists(My.Application.Info.DirectoryPath & "\Theme") Then xDiag.InitialDirectory = My.Application.Info.DirectoryPath & "\Theme" - If xDiag.ShowDialog = Forms.DialogResult.Cancel Then Exit Sub - - LoadThemeComptability(xDiag.FileName) - RefreshPanelAll() - End Sub - - ''' - ''' Will return Double.PositiveInfinity if canceled. - ''' - Private Function InputBoxDouble(Prompt As String, LBound As Double, UBound As Double, Optional Title As String = "", Optional DefaultResponse As String = "") As Double - Dim xStr As String = InputBox(Prompt, Title, DefaultResponse) - If xStr = String.Empty Then Return Double.PositiveInfinity - - InputBoxDouble = Val(xStr) - If InputBoxDouble > UBound Then InputBoxDouble = UBound - If InputBoxDouble < LBound Then InputBoxDouble = LBound - End Function - - Private Sub FSSS_Click(sender As Object, e As EventArgs) Handles FSSS.Click - Dim xMax As Double = IIf(vSelLength > 0, GetMaxVPosition() - vSelLength, GetMaxVPosition) - Dim xMin As Double = IIf(vSelLength < 0, -vSelLength, 0) - Dim xDouble As Double = InputBoxDouble("Please enter a number between " & xMin & " and " & xMax & ".", xMin, xMax, , vSelStart) - If xDouble = Double.PositiveInfinity Then Return - - vSelStart = xDouble - ValidateSelection() - RefreshPanelAll() - POStatusRefresh() - End Sub - - Private Sub FSSL_Click(sender As Object, e As EventArgs) Handles FSSL.Click - Dim xMax As Double = GetMaxVPosition() - vSelStart - Dim xMin As Double = -vSelStart - Dim xDouble As Double = InputBoxDouble("Please enter a number between " & xMin & " and " & xMax & ".", xMin, xMax, , vSelLength) - If xDouble = Double.PositiveInfinity Then Return - - vSelLength = xDouble - ValidateSelection() - RefreshPanelAll() - POStatusRefresh() - End Sub - - Private Sub FSSH_Click(sender As Object, e As EventArgs) Handles FSSH.Click - Dim xMax As Double = IIf(vSelLength > 0, vSelLength, 0) - Dim xMin As Double = IIf(vSelLength > 0, 0, -vSelLength) - Dim xDouble As Double = InputBoxDouble("Please enter a number between " & xMin & " and " & xMax & ".", xMin, xMax, , vSelHalf) - If xDouble = Double.PositiveInfinity Then Return - - vSelHalf = xDouble - ValidateSelection() - RefreshPanelAll() - POStatusRefresh() - End Sub - - Private Sub BVCReverse_Click(sender As Object, e As EventArgs) Handles BVCReverse.Click - vSelStart += vSelLength - vSelHalf -= vSelLength - vSelLength *= -1 - ValidateSelection() - RefreshPanelAll() - POStatusRefresh() - End Sub - - Private Sub AutoSaveTimer_Tick(sender As Object, e As EventArgs) Handles AutoSaveTimer.Tick - Dim xTime As Date = Now - Dim xFileName As String - With xTime - xFileName = My.Application.Info.DirectoryPath & "\AutoSave_" & - .Year & "_" & .Month & "_" & .Day & "_" & .Hour & "_" & .Minute & "_" & .Second & "_" & .Millisecond & ".IBMSC" - End With - 'My.Computer.FileSystem.WriteAllText(xFileName, SaveiBMSC, False, System.Text.Encoding.Unicode) - SaveiBMSC(xFileName) - - On Error Resume Next - If PreviousAutoSavedFileName <> String.Empty Then File.Delete(PreviousAutoSavedFileName) - On Error GoTo 0 - - PreviousAutoSavedFileName = xFileName - End Sub - - Private Sub CWAVMultiSelect_CheckedChanged(sender As Object, e As EventArgs) Handles CWAVMultiSelect.CheckedChanged - WAVMultiSelect = CWAVMultiSelect.Checked - LWAV.SelectionMode = IIf(WAVMultiSelect, SelectionMode.MultiExtended, SelectionMode.One) - LBMP.SelectionMode = IIf(WAVMultiSelect, SelectionMode.MultiExtended, SelectionMode.One) - End Sub - - Private Sub CWAVChangeLabel_CheckedChanged(sender As Object, e As EventArgs) Handles CWAVChangeLabel.CheckedChanged - WAVChangeLabel = CWAVChangeLabel.Checked - End Sub - Private Sub CWAVEmptyfill_CheckedChanged(sender As Object, e As EventArgs) Handles CWAVEmptyfill.CheckedChanged - WAVEmptyfill = CWAVEmptyfill.Checked - End Sub - - Private Sub BWAVUp_Click(sender As Object, e As EventArgs) Handles BWAVUp.Click - If LWAV.SelectedIndex = -1 Then Return - - Dim xUndo As UndoRedo.LinkedURCmd = Nothing - Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void - Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo - - Dim xIndices(LWAV.SelectedIndices.Count - 1) As Integer - LWAV.SelectedIndices.CopyTo(xIndices, 0) - - Dim xS As Integer - For xS = 0 To 1294 - If Array.IndexOf(xIndices, xS) = -1 Then Exit For - Next - - For xI1 As Integer = xS To 1294 - Dim xIndex As Integer = Array.IndexOf(xIndices, xI1) - If xIndex <> -1 Then - Dim xStr As String = hWAV(xI1 + 1) - hWAV(xI1 + 1) = hWAV(xI1) - hWAV(xI1) = xStr - - LWAV.Items.Item(xI1) = C10to36(xI1 + 1) & ": " & hWAV(xI1 + 1) - LWAV.Items.Item(xI1 - 1) = C10to36(xI1) & ": " & hWAV(xI1) - - If Not WAVChangeLabel Then GoTo 1100 - - Dim xL1 As String = C10to36(xI1) - Dim xL2 As String = C10to36(xI1 + 1) - For xI2 As Integer = 1 To UBound(Notes) - If Not IsColumnSound(Notes(xI2).ColumnIndex) Then Continue For - - If C10to36(Notes(xI2).Value \ 10000) = xL1 Then - RedoRelabelNote(Notes(xI2), (xI1 * 10000) + 10000, xUndo, xRedo) - Notes(xI2).Value = (xI1 * 10000) + 10000 - - ElseIf C10to36(Notes(xI2).Value \ 10000) = xL2 Then - RedoRelabelNote(Notes(xI2), xI1 * 10000, xUndo, xRedo) - Notes(xI2).Value = xI1 * 10000 - - End If - Next + End If + + RefreshPanelAll() + End Sub + + Private Sub TBMyO2_Click(sender As Object, e As EventArgs) Handles TBMyO2.Click, mnMyO2.Click + Dim xDiag As New dgMyO2 + xDiag.Show() + End Sub + + + Private Sub TBFind_Click(sender As Object, e As EventArgs) Handles TBFind.Click, mnFind.Click + Dim xDiag As New diagFind(gColumns, Strings.Messages.Err, Strings.Messages.InvalidLabel) + xDiag.Show() + End Sub + + Private Function fdrCheck(xNote As Note) As Boolean + Return xNote.VPosition >= MeasureBottom(fdriMesL) And xNote.VPosition < MeasureBottom(fdriMesU) + MeasureLength(fdriMesU) AndAlso + IIf(IsColumnNumeric(xNote.ColumnIndex), + xNote.Value >= fdriValL And xNote.Value <= fdriValU, + xNote.Value >= fdriLblL And xNote.Value <= fdriLblU) AndAlso + Array.IndexOf(fdriCol, xNote.ColumnIndex) <> -1 + End Function + + Private Function fdrRangeS(xbLim1 As Boolean, xbLim2 As Boolean, xVal As Boolean) As Boolean + Return (Not xbLim1 And xbLim2 And xVal) Or (xbLim1 And Not xbLim2 And Not xVal) Or (xbLim1 And xbLim2) + End Function + + Public Sub fdrSelect(iRange As Integer, + xMesL As Integer, xMesU As Integer, + xLblL As String, xLblU As String, + xValL As Integer, xValU As Integer, + iCol() As Integer) + + fdriMesL = xMesL + fdriMesU = xMesU + fdriLblL = C36to10(xLblL) * 10000 + fdriLblU = C36to10(xLblU) * 10000 + fdriValL = xValL + fdriValU = xValU + fdriCol = iCol + + Dim xbSel As Boolean = iRange Mod 2 = 0 + Dim xbUnsel As Boolean = iRange Mod 3 = 0 + Dim xbShort As Boolean = iRange Mod 5 = 0 + Dim xbLong As Boolean = iRange Mod 7 = 0 + Dim xbHidden As Boolean = iRange Mod 11 = 0 + Dim xbVisible As Boolean = iRange Mod 13 = 0 + + Dim xSel(UBound(Notes)) As Boolean + For xI1 As Integer = 1 To UBound(Notes) + xSel(xI1) = Notes(xI1).Selected + Next + + 'Main process + For xI1 As Integer = 1 To UBound(Notes) + Dim bbba As Boolean = xbSel And xSel(xI1) + Dim bbbb As Boolean = xbUnsel And Not xSel(xI1) + Dim bbbc As Boolean = nEnabled(Notes(xI1).ColumnIndex) + Dim bbbd As Boolean = fdrRangeS(xbShort, xbLong, IIf(NTInput, Notes(xI1).Length, Notes(xI1).LongNote)) + Dim bbbe As Boolean = fdrRangeS(xbVisible, xbHidden, Notes(xI1).Hidden) + Dim bbbf As Boolean = fdrCheck(Notes(xI1)) + + If ((xbSel And xSel(xI1)) Or (xbUnsel And Not xSel(xI1))) AndAlso + nEnabled(Notes(xI1).ColumnIndex) AndAlso fdrRangeS(xbShort, xbLong, IIf(NTInput, Notes(xI1).Length, Notes(xI1).LongNote)) And fdrRangeS(xbVisible, xbHidden, Notes(xI1).Hidden) Then + Notes(xI1).Selected = fdrCheck(Notes(xI1)) + End If + Next + + RefreshPanelAll() + Beep() + End Sub + + Public Sub fdrUnselect(iRange As Integer, + xMesL As Integer, xMesU As Integer, + xLblL As String, xLblU As String, + xValL As Integer, xValU As Integer, + iCol() As Integer) + + fdriMesL = xMesL + fdriMesU = xMesU + fdriLblL = C36to10(xLblL) * 10000 + fdriLblU = C36to10(xLblU) * 10000 + fdriValL = xValL + fdriValU = xValU + fdriCol = iCol + + Dim xbSel As Boolean = iRange Mod 2 = 0 + Dim xbUnsel As Boolean = iRange Mod 3 = 0 + Dim xbShort As Boolean = iRange Mod 5 = 0 + Dim xbLong As Boolean = iRange Mod 7 = 0 + Dim xbHidden As Boolean = iRange Mod 11 = 0 + Dim xbVisible As Boolean = iRange Mod 13 = 0 + + Dim xSel(UBound(Notes)) As Boolean + For xI1 As Integer = 1 To UBound(Notes) + xSel(xI1) = Notes(xI1).Selected + Next + + 'Main process + For xI1 As Integer = 1 To UBound(Notes) + If ((xbSel And xSel(xI1)) Or (xbUnsel And Not xSel(xI1))) AndAlso + nEnabled(Notes(xI1).ColumnIndex) AndAlso fdrRangeS(xbShort, xbLong, IIf(NTInput, Notes(xI1).Length, Notes(xI1).LongNote)) And fdrRangeS(xbVisible, xbHidden, Notes(xI1).Hidden) Then + Notes(xI1).Selected = Not fdrCheck(Notes(xI1)) + End If + Next + + RefreshPanelAll() + Beep() + End Sub + + Public Sub fdrDelete(iRange As Integer, + xMesL As Integer, xMesU As Integer, + xLblL As String, xLblU As String, + xValL As Integer, xValU As Integer, + iCol() As Integer) + + fdriMesL = xMesL + fdriMesU = xMesU + fdriLblL = C36to10(xLblL) * 10000 + fdriLblU = C36to10(xLblU) * 10000 + fdriValL = xValL + fdriValU = xValU + fdriCol = iCol + + Dim xbSel As Boolean = iRange Mod 2 = 0 + Dim xbUnsel As Boolean = iRange Mod 3 = 0 + Dim xbShort As Boolean = iRange Mod 5 = 0 + Dim xbLong As Boolean = iRange Mod 7 = 0 + Dim xbHidden As Boolean = iRange Mod 11 = 0 + Dim xbVisible As Boolean = iRange Mod 13 = 0 + + Dim xUndo As UndoRedo.LinkedURCmd = Nothing + Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void + Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo + + 'Main process + Dim xI1 As Integer = 1 + Do While xI1 <= UBound(Notes) + If ((xbSel And Notes(xI1).Selected) Or (xbUnsel And Not Notes(xI1).Selected)) AndAlso + fdrCheck(Notes(xI1)) AndAlso nEnabled(Notes(xI1).ColumnIndex) AndAlso fdrRangeS(xbShort, xbLong, IIf(NTInput, Notes(xI1).Length, Notes(xI1).LongNote)) And fdrRangeS(xbVisible, xbHidden, Notes(xI1).Hidden) Then + RedoRemoveNote(Notes(xI1), xUndo, xRedo) + RemoveNote(xI1, False) + Else + xI1 += 1 + End If + Loop + + AddUndo(xUndo, xBaseRedo.Next) + SortByVPositionInsertion() + UpdatePairing() + RefreshPanelAll() + CalculateTotalPlayableNotes() + Beep() + End Sub + + Public Sub fdrReplaceL(iRange As Integer, + xMesL As Integer, xMesU As Integer, + xLblL As String, xLblU As String, + xValL As Integer, xValU As Integer, + iCol() As Integer, xReplaceLbl As String) + + fdriMesL = xMesL + fdriMesU = xMesU + fdriLblL = C36to10(xLblL) * 10000 + fdriLblU = C36to10(xLblU) * 10000 + fdriValL = xValL + fdriValU = xValU + fdriCol = iCol + + Dim xbSel As Boolean = iRange Mod 2 = 0 + Dim xbUnsel As Boolean = iRange Mod 3 = 0 + Dim xbShort As Boolean = iRange Mod 5 = 0 + Dim xbLong As Boolean = iRange Mod 7 = 0 + Dim xbHidden As Boolean = iRange Mod 11 = 0 + Dim xbVisible As Boolean = iRange Mod 13 = 0 + + Dim xxLbl As Integer = C36to10(xReplaceLbl) * 10000 + + Dim xUndo As UndoRedo.LinkedURCmd = Nothing + Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void + Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo + + 'Main process + For xI1 As Integer = 1 To UBound(Notes) + If ((xbSel And Notes(xI1).Selected) Or (xbUnsel And Not Notes(xI1).Selected)) AndAlso + fdrCheck(Notes(xI1)) AndAlso nEnabled(Notes(xI1).ColumnIndex) And Not IsColumnNumeric(Notes(xI1).ColumnIndex) AndAlso fdrRangeS(xbShort, xbLong, IIf(NTInput, Notes(xI1).Length, Notes(xI1).LongNote)) And fdrRangeS(xbVisible, xbHidden, Notes(xI1).Hidden) Then + 'xUndo &= sCmdKC(K(xI1).ColumnIndex, K(xI1).VPosition, xxLbl, IIf(NTInput, K(xI1).Length, K(xI1).LongNote), K(xI1).Hidden, 0, 0, K(xI1).Value, IIf(NTInput, K(xI1).Length, K(xI1).LongNote), K(xI1).Hidden, True) & vbCrLf + 'xRedo &= sCmdKC(K(xI1).ColumnIndex, K(xI1).VPosition, K(xI1).Value, IIf(NTInput, K(xI1).Length, K(xI1).LongNote), K(xI1).Hidden, 0, 0, xxLbl, IIf(NTInput, K(xI1).Length, K(xI1).LongNote), K(xI1).Hidden, True) & vbCrLf + RedoRelabelNote(Notes(xI1), xxLbl, xUndo, xRedo) + Notes(xI1).Value = xxLbl + End If + Next + + AddUndo(xUndo, xBaseRedo.Next) + RefreshPanelAll() + Beep() + End Sub + + Public Sub fdrReplaceV(iRange As Integer, + xMesL As Integer, xMesU As Integer, + xLblL As String, xLblU As String, + xValL As Integer, xValU As Integer, + iCol() As Integer, xReplaceVal As Integer) + + fdriMesL = xMesL + fdriMesU = xMesU + fdriLblL = C36to10(xLblL) * 10000 + fdriLblU = C36to10(xLblU) * 10000 + fdriValL = xValL + fdriValU = xValU + fdriCol = iCol + + Dim xbSel As Boolean = iRange Mod 2 = 0 + Dim xbUnsel As Boolean = iRange Mod 3 = 0 + Dim xbShort As Boolean = iRange Mod 5 = 0 + Dim xbLong As Boolean = iRange Mod 7 = 0 + Dim xbHidden As Boolean = iRange Mod 11 = 0 + Dim xbVisible As Boolean = iRange Mod 13 = 0 + + Dim xUndo As UndoRedo.LinkedURCmd = Nothing + Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void + Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo + + 'Main process + For xI1 As Integer = 1 To UBound(Notes) + If ((xbSel And Notes(xI1).Selected) Or (xbUnsel And Not Notes(xI1).Selected)) AndAlso + fdrCheck(Notes(xI1)) AndAlso nEnabled(Notes(xI1).ColumnIndex) And IsColumnNumeric(Notes(xI1).ColumnIndex) AndAlso fdrRangeS(xbShort, xbLong, IIf(NTInput, Notes(xI1).Length, Notes(xI1).LongNote)) And fdrRangeS(xbVisible, xbHidden, Notes(xI1).Hidden) Then + 'xUndo &= sCmdKC(K(xI1).ColumnIndex, K(xI1).VPosition, xReplaceVal, IIf(NTInput, K(xI1).Length, K(xI1).LongNote), K(xI1).Hidden, 0, 0, K(xI1).Value, IIf(NTInput, K(xI1).Length, K(xI1).LongNote), K(xI1).Hidden, True) & vbCrLf + 'xRedo &= sCmdKC(K(xI1).ColumnIndex, K(xI1).VPosition, K(xI1).Value, IIf(NTInput, K(xI1).Length, K(xI1).LongNote), K(xI1).Hidden, 0, 0, xReplaceVal, IIf(NTInput, K(xI1).Length, K(xI1).LongNote), K(xI1).Hidden, True) & vbCrLf + RedoRelabelNote(Notes(xI1), xReplaceVal, xUndo, xRedo) + Notes(xI1).Value = xReplaceVal + End If + Next + + AddUndo(xUndo, xBaseRedo.Next) + RefreshPanelAll() + Beep() + End Sub + + Private Sub MInsert_Click(sender As Object, e As EventArgs) Handles MInsert.Click + Dim xUndo As UndoRedo.LinkedURCmd = Nothing + Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void + Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo + + Dim xMeasure As Integer = MeasureAtDisplacement(menuVPosition) + Dim xMLength As Double = MeasureLength(xMeasure) + Dim xVP As Double = MeasureBottom(xMeasure) + + If NTInput Then + Dim xI1 As Integer = 1 + Do While xI1 <= UBound(Notes) + If MeasureAtDisplacement(Notes(xI1).VPosition) >= 999 Then + RedoRemoveNote(Notes(xI1), xUndo, xRedo) + RemoveNote(xI1, False) + Else + xI1 += 1 + End If + Loop + + Dim xdVP As Double + For xI1 = 1 To UBound(Notes) + If Notes(xI1).VPosition >= xVP And Notes(xI1).VPosition + Notes(xI1).Length <= MeasureBottom(999) Then + RedoMoveNote(Notes(xI1), Notes(xI1).ColumnIndex, Notes(xI1).VPosition + xMLength, xUndo, xRedo) + Notes(xI1).VPosition += xMLength + + ElseIf Notes(xI1).VPosition >= xVP Then + xdVP = MeasureBottom(999) - 1 - Notes(xI1).VPosition - Notes(xI1).Length + RedoLongNoteModify(Notes(xI1), Notes(xI1).VPosition + xMLength, Notes(xI1).Length + xdVP, xUndo, xRedo) + Notes(xI1).VPosition += xMLength + Notes(xI1).Length += xdVP + + ElseIf Notes(xI1).VPosition + Notes(xI1).Length >= xVP Then + xdVP = IIf(Notes(xI1).VPosition + Notes(xI1).Length > MeasureBottom(999) - 1, GetMaxVPosition() - 1 - Notes(xI1).VPosition - Notes(xI1).Length, xMLength) + RedoLongNoteModify(Notes(xI1), Notes(xI1).VPosition, Notes(xI1).Length + xdVP, xUndo, xRedo) + Notes(xI1).Length += xdVP + End If + Next + + Else + Dim xI1 As Integer = 1 + Do While xI1 <= UBound(Notes) + If MeasureAtDisplacement(Notes(xI1).VPosition) >= 999 Then + RedoRemoveNote(Notes(xI1), xUndo, xRedo) + RemoveNote(xI1, False) + Else + xI1 += 1 + End If + Loop + + For xI1 = 1 To UBound(Notes) + If Notes(xI1).VPosition >= xVP Then + RedoMoveNote(Notes(xI1), Notes(xI1).ColumnIndex, Notes(xI1).VPosition + xMLength, xUndo, xRedo) + Notes(xI1).VPosition += xMLength + End If + Next + End If + + For xI1 As Integer = 999 To xMeasure + 1 Step -1 + MeasureLength(xI1) = MeasureLength(xI1 - 1) + Next + UpdateMeasureBottom() + + AddUndo(xUndo, xBaseRedo.Next) + UpdatePairing() + CalculateGreatestVPosition() + CalculateTotalPlayableNotes() + RefreshPanelAll() + End Sub + + Private Sub MRemove_Click(sender As Object, e As EventArgs) Handles MRemove.Click + Dim xUndo As UndoRedo.LinkedURCmd = Nothing + Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void + Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo + + Dim xMeasure As Integer = MeasureAtDisplacement(menuVPosition) + Dim xMLength As Double = MeasureLength(xMeasure) + + Dim unused As Double = MeasureBottom(xMeasure) + + + Dim xVP As Double + If NTInput Then + Dim xI1 As Integer = 1 + Do While xI1 <= UBound(Notes) + If MeasureAtDisplacement(Notes(xI1).VPosition) = xMeasure And MeasureAtDisplacement(Notes(xI1).VPosition + Notes(xI1).Length) = xMeasure Then + RedoRemoveNote(Notes(xI1), xUndo, xRedo) + RemoveNote(xI1, False) + Else + xI1 += 1 + End If + Loop + + Dim xdVP As Double + xVP = MeasureBottom(xMeasure) + For xI1 = 1 To UBound(Notes) + If Notes(xI1).VPosition >= xVP + xMLength Then + RedoMoveNote(Notes(xI1), Notes(xI1).ColumnIndex, Notes(xI1).VPosition - xMLength, xUndo, xRedo) + Notes(xI1).VPosition -= xMLength + + ElseIf Notes(xI1).VPosition >= xVP Then + xdVP = xMLength + xVP - Notes(xI1).VPosition + RedoLongNoteModify(Notes(xI1), Notes(xI1).VPosition + xdVP - xMLength, Notes(xI1).Length - xdVP, xUndo, xRedo) + Notes(xI1).VPosition += xdVP - xMLength + Notes(xI1).Length -= xdVP + + ElseIf Notes(xI1).VPosition + Notes(xI1).Length >= xVP Then + xdVP = IIf(Notes(xI1).VPosition + Notes(xI1).Length >= xVP + xMLength, xMLength, Notes(xI1).VPosition + Notes(xI1).Length - xVP + 1) + RedoLongNoteModify(Notes(xI1), Notes(xI1).VPosition, Notes(xI1).Length - xdVP, xUndo, xRedo) + Notes(xI1).Length -= xdVP + End If + Next + + Else + Dim xI1 As Integer = 1 + Do While xI1 <= UBound(Notes) + If MeasureAtDisplacement(Notes(xI1).VPosition) = xMeasure Then + RedoRemoveNote(Notes(xI1), xUndo, xRedo) + RemoveNote(xI1, False) + Else + xI1 += 1 + End If + Loop + + xVP = MeasureBottom(xMeasure) + For xI1 = 1 To UBound(Notes) + If Notes(xI1).VPosition >= xVP Then + RedoMoveNote(Notes(xI1), Notes(xI1).ColumnIndex, Notes(xI1).VPosition - xMLength, xUndo, xRedo) + Notes(xI1).VPosition -= xMLength + End If + Next + End If + + For xI1 As Integer = 999 To xMeasure + 1 Step -1 + MeasureLength(xI1 - 1) = MeasureLength(xI1) + Next + UpdateMeasureBottom() + + AddUndo(xUndo, xBaseRedo.Next) + SortByVPositionInsertion() + UpdatePairing() + CalculateGreatestVPosition() + CalculateTotalPlayableNotes() + RefreshPanelAll() + End Sub + + Private Sub TBThemeDef_Click(sender As Object, e As EventArgs) Handles TBThemeDef.Click + Dim xTempFileName As String = My.Application.Info.DirectoryPath & "\____TempFile.Theme.xml" + My.Computer.FileSystem.WriteAllText(xTempFileName, My.Resources.O2Mania_Theme, False, System.Text.Encoding.Unicode) + LoadSettings(xTempFileName) + ChangePlaySideSkin(False) + File.Delete(xTempFileName) + + RefreshPanelAll() + End Sub + + Private Sub TBThemeSave_Click(sender As Object, e As EventArgs) Handles TBThemeSave.Click + Dim xDiag As New SaveFileDialog With { + .Filter = Strings.FileType.THEME_XML & "|*.Theme.xml", + .DefaultExt = "Theme.xml", + .InitialDirectory = My.Application.Info.DirectoryPath & "\Data" + } + If xDiag.ShowDialog = Forms.DialogResult.Cancel Then Exit Sub + + SaveSettings(xDiag.FileName, True) + If BeepWhileSaved Then Beep() + TBThemeRefresh_Click(TBThemeRefresh, New EventArgs) + End Sub + + Private Sub TBThemeRefresh_Click(sender As Object, e As EventArgs) Handles TBThemeRefresh.Click + For xI1 As Integer = cmnTheme.Items.Count - 1 To 5 Step -1 + Try + cmnTheme.Items.RemoveAt(xI1) + Catch ex As Exception + End Try + Next + + If Not Directory.Exists(My.Application.Info.DirectoryPath & "\Data") Then My.Computer.FileSystem.CreateDirectory(My.Application.Info.DirectoryPath & "\Data") + Dim xFileNames() As FileInfo = My.Computer.FileSystem.GetDirectoryInfo(My.Application.Info.DirectoryPath & "\Data").GetFiles("*.Theme.xml") + For Each xStr As FileInfo In xFileNames + Dim unused = cmnTheme.Items.Add(xStr.Name, Nothing, AddressOf LoadTheme) + Next + End Sub + + Private Sub TBThemeLoadComptability_Click(sender As Object, e As EventArgs) Handles TBThemeLoadComptability.Click + Dim xDiag As New OpenFileDialog With { + .Filter = Strings.FileType.TH & "|*.th", + .DefaultExt = "th", + .InitialDirectory = My.Application.Info.DirectoryPath + } + If My.Computer.FileSystem.DirectoryExists(My.Application.Info.DirectoryPath & "\Theme") Then xDiag.InitialDirectory = My.Application.Info.DirectoryPath & "\Theme" + If xDiag.ShowDialog = Forms.DialogResult.Cancel Then Exit Sub + + LoadThemeComptability(xDiag.FileName) + RefreshPanelAll() + End Sub + + ''' + ''' Will return Double.PositiveInfinity if canceled. + ''' + Private Function InputBoxDouble(Prompt As String, LBound As Double, UBound As Double, Optional Title As String = "", Optional DefaultResponse As String = "") As Double + Dim xStr As String = InputBox(Prompt, Title, DefaultResponse) + If xStr = String.Empty Then Return Double.PositiveInfinity + + InputBoxDouble = Val(xStr) + If InputBoxDouble > UBound Then InputBoxDouble = UBound + If InputBoxDouble < LBound Then InputBoxDouble = LBound + End Function + + Private Sub FSSS_Click(sender As Object, e As EventArgs) Handles FSSS.Click + Dim xMax As Double = IIf(vSelLength > 0, GetMaxVPosition() - vSelLength, GetMaxVPosition) + Dim xMin As Double = IIf(vSelLength < 0, -vSelLength, 0) + Dim xDouble As Double = InputBoxDouble("Please enter a number between " & xMin & " and " & xMax & ".", xMin, xMax, , vSelStart) + If xDouble = Double.PositiveInfinity Then Return + + vSelStart = xDouble + ValidateSelection() + RefreshPanelAll() + POStatusRefresh() + End Sub + + Private Sub FSSL_Click(sender As Object, e As EventArgs) Handles FSSL.Click + Dim xMax As Double = GetMaxVPosition() - vSelStart + Dim xMin As Double = -vSelStart + Dim xDouble As Double = InputBoxDouble("Please enter a number between " & xMin & " and " & xMax & ".", xMin, xMax, , vSelLength) + If xDouble = Double.PositiveInfinity Then Return + + vSelLength = xDouble + ValidateSelection() + RefreshPanelAll() + POStatusRefresh() + End Sub + + Private Sub FSSH_Click(sender As Object, e As EventArgs) Handles FSSH.Click + Dim xMax As Double = IIf(vSelLength > 0, vSelLength, 0) + Dim xMin As Double = IIf(vSelLength > 0, 0, -vSelLength) + Dim xDouble As Double = InputBoxDouble("Please enter a number between " & xMin & " and " & xMax & ".", xMin, xMax, , vSelHalf) + If xDouble = Double.PositiveInfinity Then Return + + vSelHalf = xDouble + ValidateSelection() + RefreshPanelAll() + POStatusRefresh() + End Sub + + Private Sub BVCReverse_Click(sender As Object, e As EventArgs) Handles BVCReverse.Click + vSelStart += vSelLength + vSelHalf -= vSelLength + vSelLength *= -1 + ValidateSelection() + RefreshPanelAll() + POStatusRefresh() + End Sub + + Private Sub AutoSaveTimer_Tick(sender As Object, e As EventArgs) Handles AutoSaveTimer.Tick + Dim xTime As Date = Now + Dim xFileName As String + With xTime + xFileName = My.Application.Info.DirectoryPath & "\AutoSave_" & + .Year & "_" & .Month & "_" & .Day & "_" & .Hour & "_" & .Minute & "_" & .Second & "_" & .Millisecond & ".IBMSC" + End With + 'My.Computer.FileSystem.WriteAllText(xFileName, SaveiBMSC, False, System.Text.Encoding.Unicode) + SaveiBMSC(xFileName) + + On Error Resume Next + If PreviousAutoSavedFileName <> String.Empty Then File.Delete(PreviousAutoSavedFileName) + On Error GoTo 0 + + PreviousAutoSavedFileName = xFileName + End Sub + + Private Sub CWAVMultiSelect_CheckedChanged(sender As Object, e As EventArgs) Handles CWAVMultiSelect.CheckedChanged + WAVMultiSelect = CWAVMultiSelect.Checked + LWAV.SelectionMode = IIf(WAVMultiSelect, SelectionMode.MultiExtended, SelectionMode.One) + LBMP.SelectionMode = IIf(WAVMultiSelect, SelectionMode.MultiExtended, SelectionMode.One) + End Sub + + Private Sub CWAVChangeLabel_CheckedChanged(sender As Object, e As EventArgs) Handles CWAVChangeLabel.CheckedChanged + WAVChangeLabel = CWAVChangeLabel.Checked + End Sub + Private Sub CWAVEmptyfill_CheckedChanged(sender As Object, e As EventArgs) Handles CWAVEmptyfill.CheckedChanged + WAVEmptyfill = CWAVEmptyfill.Checked + End Sub + + Private Sub BWAVUp_Click(sender As Object, e As EventArgs) Handles BWAVUp.Click + If LWAV.SelectedIndex = -1 Then Return + + Dim xUndo As UndoRedo.LinkedURCmd = Nothing + Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void + Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo + + Dim xIndices(LWAV.SelectedIndices.Count - 1) As Integer + LWAV.SelectedIndices.CopyTo(xIndices, 0) + + Dim xS As Integer + For xS = 0 To 1294 + If Array.IndexOf(xIndices, xS) = -1 Then Exit For + Next + + For xI1 As Integer = xS To 1294 + Dim xIndex As Integer = Array.IndexOf(xIndices, xI1) + If xIndex <> -1 Then + Dim xStr As String = hWAV(xI1 + 1) + hWAV(xI1 + 1) = hWAV(xI1) + hWAV(xI1) = xStr + + LWAV.Items.Item(xI1) = C10to36(xI1 + 1) & ": " & hWAV(xI1 + 1) + LWAV.Items.Item(xI1 - 1) = C10to36(xI1) & ": " & hWAV(xI1) + + If Not WAVChangeLabel Then GoTo 1100 + + Dim xL1 As String = C10to36(xI1) + Dim xL2 As String = C10to36(xI1 + 1) + For xI2 As Integer = 1 To UBound(Notes) + If Not IsColumnSound(Notes(xI2).ColumnIndex) Then Continue For + + If C10to36(Notes(xI2).Value \ 10000) = xL1 Then + RedoRelabelNote(Notes(xI2), (xI1 * 10000) + 10000, xUndo, xRedo) + Notes(xI2).Value = (xI1 * 10000) + 10000 + + ElseIf C10to36(Notes(xI2).Value \ 10000) = xL2 Then + RedoRelabelNote(Notes(xI2), xI1 * 10000, xUndo, xRedo) + Notes(xI2).Value = xI1 * 10000 + + End If + Next 1100: xIndices(xIndex) += -1 - End If - Next + End If + Next - LWAV.SelectedIndices.Clear() - For xI1 As Integer = 0 To UBound(xIndices) - LWAV.SelectedIndices.Add(xIndices(xI1)) - Next + LWAV.SelectedIndices.Clear() + For xI1 As Integer = 0 To UBound(xIndices) + LWAV.SelectedIndices.Add(xIndices(xI1)) + Next - AddUndo(xUndo, xBaseRedo.Next) - RefreshPanelAll() - POStatusRefresh() - End Sub + AddUndo(xUndo, xBaseRedo.Next) + RefreshPanelAll() + POStatusRefresh() + End Sub - Private Sub BWAVDown_Click(sender As Object, e As EventArgs) Handles BWAVDown.Click - If LWAV.SelectedIndex = -1 Then Return + Private Sub BWAVDown_Click(sender As Object, e As EventArgs) Handles BWAVDown.Click + If LWAV.SelectedIndex = -1 Then Return - Dim xUndo As UndoRedo.LinkedURCmd = Nothing - Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void - Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo + Dim xUndo As UndoRedo.LinkedURCmd = Nothing + Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void + Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo - Dim xIndices(LWAV.SelectedIndices.Count - 1) As Integer - LWAV.SelectedIndices.CopyTo(xIndices, 0) + Dim xIndices(LWAV.SelectedIndices.Count - 1) As Integer + LWAV.SelectedIndices.CopyTo(xIndices, 0) - Dim xS As Integer - For xS = 1294 To 0 Step -1 - If Array.IndexOf(xIndices, xS) = -1 Then Exit For - Next + Dim xS As Integer + For xS = 1294 To 0 Step -1 + If Array.IndexOf(xIndices, xS) = -1 Then Exit For + Next - For xI1 As Integer = xS To 0 Step -1 - Dim xIndex As Integer = Array.IndexOf(xIndices, xI1) - If xIndex <> -1 Then - Dim xStr As String = hWAV(xI1 + 1) - hWAV(xI1 + 1) = hWAV(xI1 + 2) - hWAV(xI1 + 2) = xStr + For xI1 As Integer = xS To 0 Step -1 + Dim xIndex As Integer = Array.IndexOf(xIndices, xI1) + If xIndex <> -1 Then + Dim xStr As String = hWAV(xI1 + 1) + hWAV(xI1 + 1) = hWAV(xI1 + 2) + hWAV(xI1 + 2) = xStr - LWAV.Items.Item(xI1) = C10to36(xI1 + 1) & ": " & hWAV(xI1 + 1) - LWAV.Items.Item(xI1 + 1) = C10to36(xI1 + 2) & ": " & hWAV(xI1 + 2) + LWAV.Items.Item(xI1) = C10to36(xI1 + 1) & ": " & hWAV(xI1 + 1) + LWAV.Items.Item(xI1 + 1) = C10to36(xI1 + 2) & ": " & hWAV(xI1 + 2) - If Not WAVChangeLabel Then GoTo 1100 + If Not WAVChangeLabel Then GoTo 1100 - Dim xL1 As String = C10to36(xI1 + 2) - Dim xL2 As String = C10to36(xI1 + 1) - For xI2 As Integer = 1 To UBound(Notes) - If Not IsColumnSound(Notes(xI2).ColumnIndex) Then Continue For + Dim xL1 As String = C10to36(xI1 + 2) + Dim xL2 As String = C10to36(xI1 + 1) + For xI2 As Integer = 1 To UBound(Notes) + If Not IsColumnSound(Notes(xI2).ColumnIndex) Then Continue For - If C10to36(Notes(xI2).Value \ 10000) = xL1 Then - RedoRelabelNote(Notes(xI2), (xI1 * 10000) + 10000, xUndo, xRedo) - Notes(xI2).Value = (xI1 * 10000) + 10000 + If C10to36(Notes(xI2).Value \ 10000) = xL1 Then + RedoRelabelNote(Notes(xI2), (xI1 * 10000) + 10000, xUndo, xRedo) + Notes(xI2).Value = (xI1 * 10000) + 10000 - ElseIf C10to36(Notes(xI2).Value \ 10000) = xL2 Then - RedoRelabelNote(Notes(xI2), (xI1 * 10000) + 20000, xUndo, xRedo) - Notes(xI2).Value = (xI1 * 10000) + 20000 + ElseIf C10to36(Notes(xI2).Value \ 10000) = xL2 Then + RedoRelabelNote(Notes(xI2), (xI1 * 10000) + 20000, xUndo, xRedo) + Notes(xI2).Value = (xI1 * 10000) + 20000 - End If - Next + End If + Next 1100: xIndices(xIndex) += 1 - End If - Next - - LWAV.SelectedIndices.Clear() - For xI1 As Integer = 0 To UBound(xIndices) - LWAV.SelectedIndices.Add(xIndices(xI1)) - Next - - AddUndo(xUndo, xBaseRedo.Next) - RefreshPanelAll() - POStatusRefresh() - End Sub - - Private Sub BWAVBrowse_Click(sender As Object, e As EventArgs) Handles BWAVBrowse.Click - Dim xDWAV As New OpenFileDialog With { - .DefaultExt = "wav", - .Filter = Strings.FileType._wave & "|*.wav;*.ogg;*.mp3;*.flac|" & - Strings.FileType.WAV & "|*.wav|" & - Strings.FileType.OGG & "|*.ogg|" & - Strings.FileType.MP3 & "|*.mp3|" & - Strings.FileType.FLAC & "|*.flac|" & - Strings.FileType._all & "|*.*", - .InitialDirectory = IIf(ExcludeFileName(FileName) = String.Empty, InitPath, ExcludeFileName(FileName)), - .Multiselect = WAVMultiSelect - } - - If xDWAV.ShowDialog = Forms.DialogResult.Cancel Then Exit Sub - InitPath = ExcludeFileName(xDWAV.FileName) - - AddToPOWAV(xDWAV.FileNames) - End Sub - - Private Sub BWAVRemove_Click(sender As Object, e As EventArgs) Handles BWAVRemove.Click - Dim xIndices(LWAV.SelectedIndices.Count - 1) As Integer - LWAV.SelectedIndices.CopyTo(xIndices, 0) - For xI1 As Integer = 0 To UBound(xIndices) - hWAV(xIndices(xI1) + 1) = String.Empty - LWAV.Items.Item(xIndices(xI1)) = C10to36(xIndices(xI1) + 1) & ": " - Next - - LWAV.SelectedIndices.Clear() - For xI1 As Integer = 0 To UBound(xIndices) - LWAV.SelectedIndices.Add(xIndices(xI1)) - Next - - If IsSaved Then SetIsSaved(False) - RefreshPanelAll() - POStatusRefresh() - End Sub - - Private Sub BBMPUp_Click(sender As Object, e As EventArgs) Handles BBMPUp.Click - If LBMP.SelectedIndex = -1 Then Return - - Dim xUndo As UndoRedo.LinkedURCmd = Nothing - Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void - Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo - - Dim xIndices(LBMP.SelectedIndices.Count - 1) As Integer - LBMP.SelectedIndices.CopyTo(xIndices, 0) - - Dim xS As Integer - For xS = 0 To 1294 - If Array.IndexOf(xIndices, xS) = -1 Then Exit For - Next - - For xI1 As Integer = xS To 1294 - Dim xIndex As Integer = Array.IndexOf(xIndices, xI1) - If xIndex <> -1 Then - Dim xStr As String = hBMP(xI1 + 1) - hBMP(xI1 + 1) = hBMP(xI1) - hBMP(xI1) = xStr - - LBMP.Items.Item(xI1) = C10to36(xI1 + 1) & ": " & hBMP(xI1 + 1) - LBMP.Items.Item(xI1 - 1) = C10to36(xI1) & ": " & hBMP(xI1) - - If Not WAVChangeLabel Then GoTo 1101 - - Dim xL1 As String = C10to36(xI1) - Dim xL2 As String = C10to36(xI1 + 1) - For xI2 As Integer = 1 To UBound(Notes) - If Not IsColumnImage(Notes(xI2).ColumnIndex) Then Continue For - - If C10to36(Notes(xI2).Value \ 10000) = xL1 Then - RedoRelabelNote(Notes(xI2), (xI1 * 10000) + 10000, xUndo, xRedo) - Notes(xI2).Value = (xI1 * 10000) + 10000 - - ElseIf C10to36(Notes(xI2).Value \ 10000) = xL2 Then - RedoRelabelNote(Notes(xI2), xI1 * 10000, xUndo, xRedo) - Notes(xI2).Value = xI1 * 10000 - - End If - Next + End If + Next + + LWAV.SelectedIndices.Clear() + For xI1 As Integer = 0 To UBound(xIndices) + LWAV.SelectedIndices.Add(xIndices(xI1)) + Next + + AddUndo(xUndo, xBaseRedo.Next) + RefreshPanelAll() + POStatusRefresh() + End Sub + + Private Sub BWAVBrowse_Click(sender As Object, e As EventArgs) Handles BWAVBrowse.Click + Dim xDWAV As New OpenFileDialog With { + .DefaultExt = "wav", + .Filter = Strings.FileType._wave & "|*.wav;*.ogg;*.mp3;*.flac|" & + Strings.FileType.WAV & "|*.wav|" & + Strings.FileType.OGG & "|*.ogg|" & + Strings.FileType.MP3 & "|*.mp3|" & + Strings.FileType.FLAC & "|*.flac|" & + Strings.FileType._all & "|*.*", + .InitialDirectory = IIf(ExcludeFileName(FileName) = String.Empty, InitPath, ExcludeFileName(FileName)), + .Multiselect = WAVMultiSelect + } + + If xDWAV.ShowDialog = Forms.DialogResult.Cancel Then Exit Sub + InitPath = ExcludeFileName(xDWAV.FileName) + + AddToPOWAV(xDWAV.FileNames) + End Sub + + Private Sub BWAVRemove_Click(sender As Object, e As EventArgs) Handles BWAVRemove.Click + Dim xIndices(LWAV.SelectedIndices.Count - 1) As Integer + LWAV.SelectedIndices.CopyTo(xIndices, 0) + For xI1 As Integer = 0 To UBound(xIndices) + hWAV(xIndices(xI1) + 1) = String.Empty + LWAV.Items.Item(xIndices(xI1)) = C10to36(xIndices(xI1) + 1) & ": " + Next + + LWAV.SelectedIndices.Clear() + For xI1 As Integer = 0 To UBound(xIndices) + LWAV.SelectedIndices.Add(xIndices(xI1)) + Next + + If IsSaved Then SetIsSaved(False) + RefreshPanelAll() + POStatusRefresh() + End Sub + + Private Sub BBMPUp_Click(sender As Object, e As EventArgs) Handles BBMPUp.Click + If LBMP.SelectedIndex = -1 Then Return + + Dim xUndo As UndoRedo.LinkedURCmd = Nothing + Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void + Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo + + Dim xIndices(LBMP.SelectedIndices.Count - 1) As Integer + LBMP.SelectedIndices.CopyTo(xIndices, 0) + + Dim xS As Integer + For xS = 0 To 1294 + If Array.IndexOf(xIndices, xS) = -1 Then Exit For + Next + + For xI1 As Integer = xS To 1294 + Dim xIndex As Integer = Array.IndexOf(xIndices, xI1) + If xIndex <> -1 Then + Dim xStr As String = hBMP(xI1 + 1) + hBMP(xI1 + 1) = hBMP(xI1) + hBMP(xI1) = xStr + + LBMP.Items.Item(xI1) = C10to36(xI1 + 1) & ": " & hBMP(xI1 + 1) + LBMP.Items.Item(xI1 - 1) = C10to36(xI1) & ": " & hBMP(xI1) + + If Not WAVChangeLabel Then GoTo 1101 + + Dim xL1 As String = C10to36(xI1) + Dim xL2 As String = C10to36(xI1 + 1) + For xI2 As Integer = 1 To UBound(Notes) + If Not IsColumnImage(Notes(xI2).ColumnIndex) Then Continue For + + If C10to36(Notes(xI2).Value \ 10000) = xL1 Then + RedoRelabelNote(Notes(xI2), (xI1 * 10000) + 10000, xUndo, xRedo) + Notes(xI2).Value = (xI1 * 10000) + 10000 + + ElseIf C10to36(Notes(xI2).Value \ 10000) = xL2 Then + RedoRelabelNote(Notes(xI2), xI1 * 10000, xUndo, xRedo) + Notes(xI2).Value = xI1 * 10000 + + End If + Next 1101: xIndices(xIndex) += -1 - End If - Next + End If + Next - LBMP.SelectedIndices.Clear() - For xI1 As Integer = 0 To UBound(xIndices) - LBMP.SelectedIndices.Add(xIndices(xI1)) - Next + LBMP.SelectedIndices.Clear() + For xI1 As Integer = 0 To UBound(xIndices) + LBMP.SelectedIndices.Add(xIndices(xI1)) + Next - AddUndo(xUndo, xBaseRedo.Next) - RefreshPanelAll() - POStatusRefresh() - End Sub + AddUndo(xUndo, xBaseRedo.Next) + RefreshPanelAll() + POStatusRefresh() + End Sub - Private Sub BBMPDown_Click(sender As Object, e As EventArgs) Handles BBMPDown.Click - If LBMP.SelectedIndex = -1 Then Return + Private Sub BBMPDown_Click(sender As Object, e As EventArgs) Handles BBMPDown.Click + If LBMP.SelectedIndex = -1 Then Return - Dim xUndo As UndoRedo.LinkedURCmd = Nothing - Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void - Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo + Dim xUndo As UndoRedo.LinkedURCmd = Nothing + Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void + Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo - Dim xIndices(LBMP.SelectedIndices.Count - 1) As Integer - LBMP.SelectedIndices.CopyTo(xIndices, 0) + Dim xIndices(LBMP.SelectedIndices.Count - 1) As Integer + LBMP.SelectedIndices.CopyTo(xIndices, 0) - Dim xS As Integer - For xS = 1294 To 0 Step -1 - If Array.IndexOf(xIndices, xS) = -1 Then Exit For - Next + Dim xS As Integer + For xS = 1294 To 0 Step -1 + If Array.IndexOf(xIndices, xS) = -1 Then Exit For + Next - For xI1 As Integer = xS To 0 Step -1 - Dim xIndex As Integer = Array.IndexOf(xIndices, xI1) - If xIndex <> -1 Then - Dim xStr As String = hBMP(xI1 + 1) - hBMP(xI1 + 1) = hBMP(xI1 + 2) - hBMP(xI1 + 2) = xStr + For xI1 As Integer = xS To 0 Step -1 + Dim xIndex As Integer = Array.IndexOf(xIndices, xI1) + If xIndex <> -1 Then + Dim xStr As String = hBMP(xI1 + 1) + hBMP(xI1 + 1) = hBMP(xI1 + 2) + hBMP(xI1 + 2) = xStr - LBMP.Items.Item(xI1) = C10to36(xI1 + 1) & ": " & hBMP(xI1 + 1) - LBMP.Items.Item(xI1 + 1) = C10to36(xI1 + 2) & ": " & hBMP(xI1 + 2) + LBMP.Items.Item(xI1) = C10to36(xI1 + 1) & ": " & hBMP(xI1 + 1) + LBMP.Items.Item(xI1 + 1) = C10to36(xI1 + 2) & ": " & hBMP(xI1 + 2) - If Not WAVChangeLabel Then GoTo 1100 + If Not WAVChangeLabel Then GoTo 1100 - Dim xL1 As String = C10to36(xI1 + 2) - Dim xL2 As String = C10to36(xI1 + 1) - For xI2 As Integer = 1 To UBound(Notes) - If Not IsColumnImage(Notes(xI2).ColumnIndex) Then Continue For + Dim xL1 As String = C10to36(xI1 + 2) + Dim xL2 As String = C10to36(xI1 + 1) + For xI2 As Integer = 1 To UBound(Notes) + If Not IsColumnImage(Notes(xI2).ColumnIndex) Then Continue For - If C10to36(Notes(xI2).Value \ 10000) = xL1 Then - RedoRelabelNote(Notes(xI2), (xI1 * 10000) + 10000, xUndo, xRedo) - Notes(xI2).Value = (xI1 * 10000) + 10000 + If C10to36(Notes(xI2).Value \ 10000) = xL1 Then + RedoRelabelNote(Notes(xI2), (xI1 * 10000) + 10000, xUndo, xRedo) + Notes(xI2).Value = (xI1 * 10000) + 10000 - ElseIf C10to36(Notes(xI2).Value \ 10000) = xL2 Then - RedoRelabelNote(Notes(xI2), (xI1 * 10000) + 20000, xUndo, xRedo) - Notes(xI2).Value = (xI1 * 10000) + 20000 + ElseIf C10to36(Notes(xI2).Value \ 10000) = xL2 Then + RedoRelabelNote(Notes(xI2), (xI1 * 10000) + 20000, xUndo, xRedo) + Notes(xI2).Value = (xI1 * 10000) + 20000 - End If - Next + End If + Next 1100: xIndices(xIndex) += 1 - End If - Next - - LBMP.SelectedIndices.Clear() - For xI1 As Integer = 0 To UBound(xIndices) - LBMP.SelectedIndices.Add(xIndices(xI1)) - Next - - AddUndo(xUndo, xBaseRedo.Next) - RefreshPanelAll() - POStatusRefresh() - End Sub - - Private Sub BBMPBrowse_Click(sender As Object, e As EventArgs) Handles BBMPBrowse.Click - Dim xDBMP As New OpenFileDialog With { - .DefaultExt = "bmp", - .Filter = Strings.FileType._image & "|*.bmp;*.png;*.jpg;*.jpeg;.gif|" & - Strings.FileType._movie & "|*.mpg;*.m1v;*.m2v;*.avi;*.mp4;*.m4v;*.wmv;*.webm|" & - Strings.FileType.BMP & "|*.bmp|" & - Strings.FileType.PNG & "|*.png|" & - Strings.FileType.JPG & "|*.jpg;*.jpeg|" & - Strings.FileType.GIF & "|*.gif|" & - Strings.FileType.MP4 & "|*.mp4;*.m4v|" & - Strings.FileType.AVI & "|*.avi|" & - Strings.FileType.MPG & "|*.mpg;*.m1v;*.m2v|" & - Strings.FileType.WMV & "|*.wmv|" & - Strings.FileType.WEBM & "|*.webm|" & - Strings.FileType._all & "|*.*", - .InitialDirectory = IIf(ExcludeFileName(FileName) = String.Empty, InitPath, ExcludeFileName(FileName)), - .Multiselect = WAVMultiSelect - } - - If xDBMP.ShowDialog = Forms.DialogResult.Cancel Then Exit Sub - InitPath = ExcludeFileName(xDBMP.FileName) - - AddToPOBMP(xDBMP.FileNames) - End Sub - - Private Sub BBMPRemove_Click(sender As Object, e As EventArgs) Handles BBMPRemove.Click - Dim xIndices(LBMP.SelectedIndices.Count - 1) As Integer - LBMP.SelectedIndices.CopyTo(xIndices, 0) - For xI1 As Integer = 0 To UBound(xIndices) - hBMP(xIndices(xI1) + 1) = String.Empty - LBMP.Items.Item(xIndices(xI1)) = C10to36(xIndices(xI1) + 1) & ": " - Next - - LBMP.SelectedIndices.Clear() - For xI1 As Integer = 0 To UBound(xIndices) - LBMP.SelectedIndices.Add(xIndices(xI1)) - Next - - If IsSaved Then SetIsSaved(False) - RefreshPanelAll() - POStatusRefresh() - End Sub - - Private Sub mnMain_MouseDown(sender As Object, e As MouseEventArgs) Handles mnMain.MouseDown ', TBMain.MouseDown ', pttl.MouseDown, pIsSaved.MouseDown - If e.Button = MouseButtons.Left Then - Dim unused1 = ReleaseCapture() - Dim unused = SendMessage(Handle, &H112, &HF012, 0) - If e.Clicks = 2 Then - If WindowState = FormWindowState.Maximized Then WindowState = FormWindowState.Normal Else WindowState = FormWindowState.Maximized - End If - ElseIf e.Button = MouseButtons.Right Then - 'mnSys.Show(sender, e.Location) - End If - End Sub - - Private Sub mnSelectAll_Click(sender As Object, e As EventArgs) Handles mnSelectAll.Click - If Not (PMainIn.Focused OrElse PMainInL.Focused Or PMainInR.Focused) Then Exit Sub - For xI1 As Integer = 1 To UBound(Notes) - Notes(xI1).Selected = nEnabled(Notes(xI1).ColumnIndex) - Next - If TBTimeSelect.Checked Then - CalculateGreatestVPosition() - vSelStart = 0 - vSelLength = MeasureBottom(MeasureAtDisplacement(GreatestVPosition)) + MeasureLength(MeasureAtDisplacement(GreatestVPosition)) - End If - RefreshPanelAll() - POStatusRefresh() - End Sub - - Private Sub mnDelete_Click(sender As Object, e As EventArgs) Handles mnDelete.Click - If Not (PMainIn.Focused OrElse PMainInL.Focused Or PMainInR.Focused) Then Exit Sub - - Dim xUndo As UndoRedo.LinkedURCmd = Nothing - Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void - Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo - - RedoRemoveNoteSelected(True, xUndo, xRedo) - RemoveNotes(True) - - AddUndo(xUndo, xBaseRedo.Next) - CalculateGreatestVPosition() - CalculateTotalPlayableNotes() - RefreshPanelAll() - POStatusRefresh() - End Sub - - Private Sub mnUpdate_Click(sender As Object, e As EventArgs) - Dim unused = Process.Start("http://www.cs.mcgill.ca/~ryang6/iBMSC/") - End Sub - - Private Sub mnUpdateC_Click(sender As Object, e As EventArgs) - Dim unused = Process.Start("http://bbs.rohome.net/thread-1074065-1-1.html") - End Sub - - Private Sub mnQuit_Click(sender As Object, e As EventArgs) Handles mnQuit.Click - Close() - End Sub - - - Private Sub EnableDWM() - mnMain.BackColor = Color.Black - 'TBMain.BackColor = Color.FromArgb(64, 64, 64) - - For Each xmn As ToolStripMenuItem In mnMain.Items - xmn.ForeColor = Color.White - AddHandler xmn.DropDownClosed, AddressOf mn_DropDownClosed - AddHandler xmn.DropDownOpened, AddressOf mn_DropDownOpened - AddHandler xmn.MouseEnter, AddressOf mn_MouseEnter - AddHandler xmn.MouseLeave, AddressOf mn_MouseLeave - Next - End Sub - - Private Sub DisableDWM() - mnMain.BackColor = SystemColors.Control - 'TBMain.BackColor = SystemColors.Control - - For Each xmn As ToolStripMenuItem In mnMain.Items - xmn.ForeColor = SystemColors.ControlText - RemoveHandler xmn.DropDownClosed, AddressOf mn_DropDownClosed - RemoveHandler xmn.DropDownOpened, AddressOf mn_DropDownOpened - RemoveHandler xmn.MouseEnter, AddressOf mn_MouseEnter - RemoveHandler xmn.MouseLeave, AddressOf mn_MouseLeave - Next - End Sub - - Private Sub ttlIcon_MouseDown(sender As Object, e As MouseEventArgs) - 'ttlIcon.Image = My.Resources.icon2_16 - 'mnSys.Show(ttlIcon, 0, ttlIcon.Height) - End Sub - Private Sub ttlIcon_MouseEnter(sender As Object, e As EventArgs) - 'ttlIcon.Image = My.Resources.icon2_16_highlight - End Sub - Private Sub ttlIcon_MouseLeave(sender As Object, e As EventArgs) - 'ttlIcon.Image = My.Resources.icon2_16 - End Sub - - Private Sub mnSMenu_Click(sender As Object, e As EventArgs) Handles mnSMenu.CheckedChanged - mnMain.Visible = mnSMenu.Checked - End Sub - Private Sub mnSTB_Click(sender As Object, e As EventArgs) Handles mnSTB.CheckedChanged - TBMain.Visible = mnSTB.Checked - End Sub - Private Sub mnSOP_Click(sender As Object, e As EventArgs) Handles mnSOP.CheckedChanged - POptions.Visible = mnSOP.Checked - End Sub - Private Sub mnSStatus_Click(sender As Object, e As EventArgs) Handles mnSStatus.CheckedChanged - pStatus.Visible = mnSStatus.Checked - End Sub - Private Sub mnSLSplitter_Click(sender As Object, e As EventArgs) Handles mnSLSplitter.CheckedChanged - SpL.Visible = mnSLSplitter.Checked - End Sub - Private Sub mnSRSplitter_Click(sender As Object, e As EventArgs) Handles mnSRSplitter.CheckedChanged - SpR.Visible = mnSRSplitter.Checked - End Sub - Private Sub CGShow_CheckedChanged(sender As Object, e As EventArgs) Handles CGShow.CheckedChanged - gShowGrid = CGShow.Checked - RefreshPanelAll() - End Sub - Private Sub CGShowS_CheckedChanged(sender As Object, e As EventArgs) Handles CGShowS.CheckedChanged - gShowSubGrid = CGShowS.Checked - RefreshPanelAll() - End Sub - Private Sub CGShowBG_CheckedChanged(sender As Object, e As EventArgs) Handles CGShowBG.CheckedChanged - gShowBG = CGShowBG.Checked - RefreshPanelAll() - End Sub - Private Sub CGShowM_CheckedChanged(sender As Object, e As EventArgs) Handles CGShowM.CheckedChanged - gShowMeasureNumber = CGShowM.Checked - RefreshPanelAll() - End Sub - Private Sub CGShowV_CheckedChanged(sender As Object, e As EventArgs) Handles CGShowV.CheckedChanged - gShowVerticalLine = CGShowV.Checked - RefreshPanelAll() - End Sub - Private Sub CGShowMB_CheckedChanged(sender As Object, e As EventArgs) Handles CGShowMB.CheckedChanged - gShowMeasureBar = CGShowMB.Checked - RefreshPanelAll() - End Sub - Private Sub CGShowC_CheckedChanged(sender As Object, e As EventArgs) Handles CGShowC.CheckedChanged - gShowC = CGShowC.Checked - RefreshPanelAll() - End Sub - Private Sub CGBLP_CheckedChanged(sender As Object, e As EventArgs) Handles CGBLP.CheckedChanged - gDisplayBGAColumn = CGBLP.Checked - - column(niBGA).isVisible = gDisplayBGAColumn - column(niLAYER).isVisible = gDisplayBGAColumn - column(niPOOR).isVisible = gDisplayBGAColumn - column(niS4).isVisible = gDisplayBGAColumn - - If IsInitializing Then Exit Sub - For xI1 As Integer = 1 To UBound(Notes) - Notes(xI1).Selected = Notes(xI1).Selected And nEnabled(Notes(xI1).ColumnIndex) - Next - 'AddUndo(xUndo, xRedo) - UpdateColumnsX() - RefreshPanelAll() - End Sub - Private Sub CGSCROLL_CheckedChanged(sender As Object, e As EventArgs) Handles CGSCROLL.CheckedChanged - gSCROLL = CGSCROLL.Checked - - column(niSCROLL).isVisible = gSCROLL - - If IsInitializing Then Exit Sub - For xI1 As Integer = 1 To UBound(Notes) - Notes(xI1).Selected = Notes(xI1).Selected And nEnabled(Notes(xI1).ColumnIndex) - Next - 'AddUndo(xUndo, xRedo) - UpdateColumnsX() - RefreshPanelAll() - End Sub - Private Sub CGSTOP_CheckedChanged(sender As Object, e As EventArgs) Handles CGSTOP.CheckedChanged - gSTOP = CGSTOP.Checked - - column(niSTOP).isVisible = gSTOP - - If IsInitializing Then Exit Sub - For xI1 As Integer = 1 To UBound(Notes) - Notes(xI1).Selected = Notes(xI1).Selected And nEnabled(Notes(xI1).ColumnIndex) - Next - 'AddUndo(xUndo, xRedo) - UpdateColumnsX() - RefreshPanelAll() - End Sub - Private Sub CGBPM_CheckedChanged(sender As Object, e As EventArgs) Handles CGBPM.CheckedChanged - 'Dim xUndo As UndoRedo.LinkedURCmd = Nothing - 'Dim xRedo As UndoRedo.LinkedURCmd = Nothing - 'Me.RedoChangeVisibleColumns(gBLP, gSTOP, iPlayer, gBLP, CGSTOP.Checked, iPlayer, xUndo, xRedo) - gBPM = CGBPM.Checked - - column(niBPM).isVisible = gBPM - - If IsInitializing Then Exit Sub - For xI1 As Integer = 1 To UBound(Notes) - Notes(xI1).Selected = Notes(xI1).Selected And nEnabled(Notes(xI1).ColumnIndex) - Next - 'AddUndo(xUndo, xRedo) - UpdateColumnsX() - RefreshPanelAll() - End Sub - - Private Sub CGDisableVertical_CheckedChanged(sender As Object, e As EventArgs) Handles CGDisableVertical.CheckedChanged - DisableVerticalMove = CGDisableVertical.Checked - End Sub - - Private Sub CBeatPreserve_Click(sender As Object, e As EventArgs) Handles CBeatPreserve.Click, CBeatMeasure.Click, CBeatCut.Click, CBeatScale.Click - 'If Not sender.Checked Then Exit Sub - Dim xBeatList() As RadioButton = {CBeatPreserve, CBeatMeasure, CBeatCut, CBeatScale} - BeatChangeMode = Array.IndexOf(Of RadioButton)(xBeatList, sender) - 'For xI1 As Integer = 0 To mnBeat.Items.Count - 1 - 'If xI1 <> BeatChangeMode Then CType(mnBeat.Items(xI1), ToolStripMenuItem).Checked = False - 'Next - 'sender.Checked = True - End Sub - - - Private Sub tBeatValue_LostFocus(sender As Object, e As EventArgs) Handles tBeatValue.LostFocus - Dim a As Double - If Double.TryParse(tBeatValue.Text, a) Then - If a <= 0.0# Or a >= 1000.0# Then tBeatValue.BackColor = Color.FromArgb(&HFFFFC0C0) Else tBeatValue.BackColor = Nothing - - tBeatValue.Text = a - End If - End Sub - - - - Private Sub ApplyBeat(xRatio As Double, xDisplay As String) - SortByVPositionInsertion() - - Dim xUndo As UndoRedo.LinkedURCmd = Nothing - Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void - Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo - - RedoChangeMeasureLengthSelected(192 * xRatio, xUndo, xRedo) - - Dim xIndices(LBeat.SelectedIndices.Count - 1) As Integer - LBeat.SelectedIndices.CopyTo(xIndices, 0) - - - For Each xI1 As Integer In xIndices - Dim dLength As Double = (xRatio * 192.0R) - MeasureLength(xI1) - Dim dRatio As Double = xRatio * 192.0R / MeasureLength(xI1) - - Dim xBottom As Double = 0 - For xI2 As Integer = 0 To xI1 - 1 - xBottom += MeasureLength(xI2) - Next - Dim xUpBefore As Double = xBottom + MeasureLength(xI1) - Dim xUpAfter As Double = xUpBefore + dLength - - Select Case BeatChangeMode - Case 1 + End If + Next + + LBMP.SelectedIndices.Clear() + For xI1 As Integer = 0 To UBound(xIndices) + LBMP.SelectedIndices.Add(xIndices(xI1)) + Next + + AddUndo(xUndo, xBaseRedo.Next) + RefreshPanelAll() + POStatusRefresh() + End Sub + + Private Sub BBMPBrowse_Click(sender As Object, e As EventArgs) Handles BBMPBrowse.Click + Dim xDBMP As New OpenFileDialog With { + .DefaultExt = "bmp", + .Filter = Strings.FileType._image & "|*.bmp;*.png;*.jpg;*.jpeg;.gif|" & + Strings.FileType._movie & "|*.mpg;*.m1v;*.m2v;*.avi;*.mp4;*.m4v;*.wmv;*.webm|" & + Strings.FileType.BMP & "|*.bmp|" & + Strings.FileType.PNG & "|*.png|" & + Strings.FileType.JPG & "|*.jpg;*.jpeg|" & + Strings.FileType.GIF & "|*.gif|" & + Strings.FileType.MP4 & "|*.mp4;*.m4v|" & + Strings.FileType.AVI & "|*.avi|" & + Strings.FileType.MPG & "|*.mpg;*.m1v;*.m2v|" & + Strings.FileType.WMV & "|*.wmv|" & + Strings.FileType.WEBM & "|*.webm|" & + Strings.FileType._all & "|*.*", + .InitialDirectory = IIf(ExcludeFileName(FileName) = String.Empty, InitPath, ExcludeFileName(FileName)), + .Multiselect = WAVMultiSelect + } + + If xDBMP.ShowDialog = Forms.DialogResult.Cancel Then Exit Sub + InitPath = ExcludeFileName(xDBMP.FileName) + + AddToPOBMP(xDBMP.FileNames) + End Sub + + Private Sub BBMPRemove_Click(sender As Object, e As EventArgs) Handles BBMPRemove.Click + Dim xIndices(LBMP.SelectedIndices.Count - 1) As Integer + LBMP.SelectedIndices.CopyTo(xIndices, 0) + For xI1 As Integer = 0 To UBound(xIndices) + hBMP(xIndices(xI1) + 1) = String.Empty + LBMP.Items.Item(xIndices(xI1)) = C10to36(xIndices(xI1) + 1) & ": " + Next + + LBMP.SelectedIndices.Clear() + For xI1 As Integer = 0 To UBound(xIndices) + LBMP.SelectedIndices.Add(xIndices(xI1)) + Next + + If IsSaved Then SetIsSaved(False) + RefreshPanelAll() + POStatusRefresh() + End Sub + + Private Sub mnMain_MouseDown(sender As Object, e As MouseEventArgs) Handles mnMain.MouseDown ', TBMain.MouseDown ', pttl.MouseDown, pIsSaved.MouseDown + If e.Button = MouseButtons.Left Then + Dim unused1 = ReleaseCapture() + Dim unused = SendMessage(Handle, &H112, &HF012, 0) + If e.Clicks = 2 Then + If WindowState = FormWindowState.Maximized Then WindowState = FormWindowState.Normal Else WindowState = FormWindowState.Maximized + End If + ElseIf e.Button = MouseButtons.Right Then + 'mnSys.Show(sender, e.Location) + End If + End Sub + + Private Sub mnSelectAll_Click(sender As Object, e As EventArgs) Handles mnSelectAll.Click + If Not (PMainIn.Focused OrElse PMainInL.Focused Or PMainInR.Focused) Then Exit Sub + For xI1 As Integer = 1 To UBound(Notes) + Notes(xI1).Selected = nEnabled(Notes(xI1).ColumnIndex) + Next + If TBTimeSelect.Checked Then + CalculateGreatestVPosition() + vSelStart = 0 + vSelLength = MeasureBottom(MeasureAtDisplacement(GreatestVPosition)) + MeasureLength(MeasureAtDisplacement(GreatestVPosition)) + End If + RefreshPanelAll() + POStatusRefresh() + End Sub + + Private Sub mnDelete_Click(sender As Object, e As EventArgs) Handles mnDelete.Click + If Not (PMainIn.Focused OrElse PMainInL.Focused Or PMainInR.Focused) Then Exit Sub + + Dim xUndo As UndoRedo.LinkedURCmd = Nothing + Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void + Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo + + RedoRemoveNoteSelected(True, xUndo, xRedo) + RemoveNotes(True) + + AddUndo(xUndo, xBaseRedo.Next) + CalculateGreatestVPosition() + CalculateTotalPlayableNotes() + RefreshPanelAll() + POStatusRefresh() + End Sub + + Private Sub mnUpdate_Click(sender As Object, e As EventArgs) + Dim unused = Process.Start("http://www.cs.mcgill.ca/~ryang6/iBMSC/") + End Sub + + Private Sub mnUpdateC_Click(sender As Object, e As EventArgs) + Dim unused = Process.Start("http://bbs.rohome.net/thread-1074065-1-1.html") + End Sub + + Private Sub mnQuit_Click(sender As Object, e As EventArgs) Handles mnQuit.Click + Close() + End Sub + + + Private Sub EnableDWM() + mnMain.BackColor = Color.Black + 'TBMain.BackColor = Color.FromArgb(64, 64, 64) + + For Each xmn As ToolStripMenuItem In mnMain.Items + xmn.ForeColor = Color.White + AddHandler xmn.DropDownClosed, AddressOf mn_DropDownClosed + AddHandler xmn.DropDownOpened, AddressOf mn_DropDownOpened + AddHandler xmn.MouseEnter, AddressOf mn_MouseEnter + AddHandler xmn.MouseLeave, AddressOf mn_MouseLeave + Next + End Sub + + Private Sub DisableDWM() + mnMain.BackColor = SystemColors.Control + 'TBMain.BackColor = SystemColors.Control + + For Each xmn As ToolStripMenuItem In mnMain.Items + xmn.ForeColor = SystemColors.ControlText + RemoveHandler xmn.DropDownClosed, AddressOf mn_DropDownClosed + RemoveHandler xmn.DropDownOpened, AddressOf mn_DropDownOpened + RemoveHandler xmn.MouseEnter, AddressOf mn_MouseEnter + RemoveHandler xmn.MouseLeave, AddressOf mn_MouseLeave + Next + End Sub + + Private Sub ttlIcon_MouseDown(sender As Object, e As MouseEventArgs) + 'ttlIcon.Image = My.Resources.icon2_16 + 'mnSys.Show(ttlIcon, 0, ttlIcon.Height) + End Sub + Private Sub ttlIcon_MouseEnter(sender As Object, e As EventArgs) + 'ttlIcon.Image = My.Resources.icon2_16_highlight + End Sub + Private Sub ttlIcon_MouseLeave(sender As Object, e As EventArgs) + 'ttlIcon.Image = My.Resources.icon2_16 + End Sub + + Private Sub mnSMenu_Click(sender As Object, e As EventArgs) Handles mnSMenu.CheckedChanged + mnMain.Visible = mnSMenu.Checked + End Sub + Private Sub mnSTB_Click(sender As Object, e As EventArgs) Handles mnSTB.CheckedChanged + TBMain.Visible = mnSTB.Checked + End Sub + Private Sub mnSOP_Click(sender As Object, e As EventArgs) Handles mnSOP.CheckedChanged + POptions.Visible = mnSOP.Checked + End Sub + Private Sub mnSStatus_Click(sender As Object, e As EventArgs) Handles mnSStatus.CheckedChanged + pStatus.Visible = mnSStatus.Checked + End Sub + Private Sub mnSLSplitter_Click(sender As Object, e As EventArgs) Handles mnSLSplitter.CheckedChanged + SpL.Visible = mnSLSplitter.Checked + End Sub + Private Sub mnSRSplitter_Click(sender As Object, e As EventArgs) Handles mnSRSplitter.CheckedChanged + SpR.Visible = mnSRSplitter.Checked + End Sub + Private Sub CGShow_CheckedChanged(sender As Object, e As EventArgs) Handles CGShow.CheckedChanged + gShowGrid = CGShow.Checked + RefreshPanelAll() + End Sub + Private Sub CGShowS_CheckedChanged(sender As Object, e As EventArgs) Handles CGShowS.CheckedChanged + gShowSubGrid = CGShowS.Checked + RefreshPanelAll() + End Sub + Private Sub CGShowBG_CheckedChanged(sender As Object, e As EventArgs) Handles CGShowBG.CheckedChanged + gShowBG = CGShowBG.Checked + RefreshPanelAll() + End Sub + Private Sub CGShowM_CheckedChanged(sender As Object, e As EventArgs) Handles CGShowM.CheckedChanged + gShowMeasureNumber = CGShowM.Checked + RefreshPanelAll() + End Sub + Private Sub CGShowV_CheckedChanged(sender As Object, e As EventArgs) Handles CGShowV.CheckedChanged + gShowVerticalLine = CGShowV.Checked + RefreshPanelAll() + End Sub + Private Sub CGShowMB_CheckedChanged(sender As Object, e As EventArgs) Handles CGShowMB.CheckedChanged + gShowMeasureBar = CGShowMB.Checked + RefreshPanelAll() + End Sub + Private Sub CGShowC_CheckedChanged(sender As Object, e As EventArgs) Handles CGShowC.CheckedChanged + gShowC = CGShowC.Checked + RefreshPanelAll() + End Sub + Private Sub CGBLP_CheckedChanged(sender As Object, e As EventArgs) Handles CGBLP.CheckedChanged + gDisplayBGAColumn = CGBLP.Checked + + column(niBGA).isVisible = gDisplayBGAColumn + column(niLAYER).isVisible = gDisplayBGAColumn + column(niPOOR).isVisible = gDisplayBGAColumn + column(niS4).isVisible = gDisplayBGAColumn + + If IsInitializing Then Exit Sub + For xI1 As Integer = 1 To UBound(Notes) + Notes(xI1).Selected = Notes(xI1).Selected And nEnabled(Notes(xI1).ColumnIndex) + Next + 'AddUndo(xUndo, xRedo) + UpdateColumnsX() + RefreshPanelAll() + End Sub + Private Sub CGSCROLL_CheckedChanged(sender As Object, e As EventArgs) Handles CGSCROLL.CheckedChanged + gSCROLL = CGSCROLL.Checked + + column(niSCROLL).isVisible = gSCROLL + + If IsInitializing Then Exit Sub + For xI1 As Integer = 1 To UBound(Notes) + Notes(xI1).Selected = Notes(xI1).Selected And nEnabled(Notes(xI1).ColumnIndex) + Next + 'AddUndo(xUndo, xRedo) + UpdateColumnsX() + RefreshPanelAll() + End Sub + Private Sub CGSTOP_CheckedChanged(sender As Object, e As EventArgs) Handles CGSTOP.CheckedChanged + gSTOP = CGSTOP.Checked + + column(niSTOP).isVisible = gSTOP + + If IsInitializing Then Exit Sub + For xI1 As Integer = 1 To UBound(Notes) + Notes(xI1).Selected = Notes(xI1).Selected And nEnabled(Notes(xI1).ColumnIndex) + Next + 'AddUndo(xUndo, xRedo) + UpdateColumnsX() + RefreshPanelAll() + End Sub + Private Sub CGBPM_CheckedChanged(sender As Object, e As EventArgs) Handles CGBPM.CheckedChanged + 'Dim xUndo As UndoRedo.LinkedURCmd = Nothing + 'Dim xRedo As UndoRedo.LinkedURCmd = Nothing + 'Me.RedoChangeVisibleColumns(gBLP, gSTOP, iPlayer, gBLP, CGSTOP.Checked, iPlayer, xUndo, xRedo) + gBPM = CGBPM.Checked + + column(niBPM).isVisible = gBPM + + If IsInitializing Then Exit Sub + For xI1 As Integer = 1 To UBound(Notes) + Notes(xI1).Selected = Notes(xI1).Selected And nEnabled(Notes(xI1).ColumnIndex) + Next + 'AddUndo(xUndo, xRedo) + UpdateColumnsX() + RefreshPanelAll() + End Sub + + Private Sub CGDisableVertical_CheckedChanged(sender As Object, e As EventArgs) Handles CGDisableVertical.CheckedChanged + DisableVerticalMove = CGDisableVertical.Checked + End Sub + + Private Sub CBeatPreserve_Click(sender As Object, e As EventArgs) Handles CBeatPreserve.Click, CBeatMeasure.Click, CBeatCut.Click, CBeatScale.Click + 'If Not sender.Checked Then Exit Sub + Dim xBeatList() As RadioButton = {CBeatPreserve, CBeatMeasure, CBeatCut, CBeatScale} + BeatChangeMode = Array.IndexOf(Of RadioButton)(xBeatList, sender) + 'For xI1 As Integer = 0 To mnBeat.Items.Count - 1 + 'If xI1 <> BeatChangeMode Then CType(mnBeat.Items(xI1), ToolStripMenuItem).Checked = False + 'Next + 'sender.Checked = True + End Sub + + + Private Sub tBeatValue_LostFocus(sender As Object, e As EventArgs) Handles tBeatValue.LostFocus + Dim a As Double + If Double.TryParse(tBeatValue.Text, a) Then + If a <= 0.0# Or a >= 1000.0# Then tBeatValue.BackColor = Color.FromArgb(&HFFFFC0C0) Else tBeatValue.BackColor = Nothing + + tBeatValue.Text = a + End If + End Sub + + + + Private Sub ApplyBeat(xRatio As Double, xDisplay As String) + SortByVPositionInsertion() + + Dim xUndo As UndoRedo.LinkedURCmd = Nothing + Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void + Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo + + RedoChangeMeasureLengthSelected(192 * xRatio, xUndo, xRedo) + + Dim xIndices(LBeat.SelectedIndices.Count - 1) As Integer + LBeat.SelectedIndices.CopyTo(xIndices, 0) + + + For Each xI1 As Integer In xIndices + Dim dLength As Double = (xRatio * 192.0R) - MeasureLength(xI1) + Dim dRatio As Double = xRatio * 192.0R / MeasureLength(xI1) + + Dim xBottom As Double = 0 + For xI2 As Integer = 0 To xI1 - 1 + xBottom += MeasureLength(xI2) + Next + Dim xUpBefore As Double = xBottom + MeasureLength(xI1) + Dim xUpAfter As Double = xUpBefore + dLength + + Select Case BeatChangeMode + Case 1 case2: Dim xI0 As Integer - If NTInput Then - For xI0 = 1 To UBound(Notes) - If Notes(xI0).VPosition >= xUpBefore Then Exit For - If Notes(xI0).VPosition + Notes(xI0).Length >= xUpBefore Then - RedoLongNoteModify(Notes(xI0), Notes(xI0).VPosition, Notes(xI0).Length + dLength, xUndo, xRedo) - Notes(xI0).Length += dLength - End If - Next - Else - For xI0 = 1 To UBound(Notes) - If Notes(xI0).VPosition >= xUpBefore Then Exit For - Next - End If - - For xI9 As Integer = xI0 To UBound(Notes) - RedoLongNoteModify(Notes(xI9), Notes(xI9).VPosition + dLength, Notes(xI9).Length, xUndo, xRedo) - Notes(xI9).VPosition += dLength - Next - - Case 2 - If dLength < 0 Then - If NTInput Then - Dim xI0 As Integer = 1 - Dim xU As Integer = UBound(Notes) - Do While xI0 <= xU - If Notes(xI0).VPosition < xUpAfter Then - If Notes(xI0).VPosition + Notes(xI0).Length >= xUpAfter And Notes(xI0).VPosition + Notes(xI0).Length < xUpBefore Then - Dim nLen As Double = xUpAfter - Notes(xI0).VPosition - 1.0R - RedoLongNoteModify(Notes(xI0), Notes(xI0).VPosition, nLen, xUndo, xRedo) - Notes(xI0).Length = nLen - End If - ElseIf Notes(xI0).VPosition < xUpBefore Then - If Notes(xI0).VPosition + Notes(xI0).Length < xUpBefore Then - RedoRemoveNote(Notes(xI0), xUndo, xRedo) - RemoveNote(xI0) - xI0 -= 1 - xU -= 1 - Else - Dim nLen As Double = Notes(xI0).Length - xUpBefore + Notes(xI0).VPosition - RedoLongNoteModify(Notes(xI0), xUpBefore, nLen, xUndo, xRedo) - Notes(xI0).Length = nLen - Notes(xI0).VPosition = xUpBefore - End If - End If - xI0 += 1 - Loop - Else - Dim xI0 As Integer - Dim xI9 As Integer - For xI0 = 1 To UBound(Notes) - If Notes(xI0).VPosition >= xUpAfter Then Exit For - Next - For xI9 = xI0 To UBound(Notes) - If Notes(xI9).VPosition >= xUpBefore Then Exit For - Next - - For xI8 As Integer = xI0 To xI9 - 1 - RedoRemoveNote(Notes(xI8), xUndo, xRedo) - Next - For xI8 As Integer = xI9 To UBound(Notes) - Notes(xI8 - xI9 + xI0) = Notes(xI8) - Next - ReDim Preserve Notes(UBound(Notes) - xI9 + xI0) - End If - End If - - GoTo case2 - - Case 3 - If NTInput Then - For xI0 As Integer = 1 To UBound(Notes) - If Notes(xI0).VPosition < xBottom Then - If Notes(xI0).VPosition + Notes(xI0).Length > xUpBefore Then - RedoLongNoteModify(Notes(xI0), Notes(xI0).VPosition, Notes(xI0).Length + dLength, xUndo, xRedo) - Notes(xI0).Length += dLength - ElseIf Notes(xI0).VPosition + Notes(xI0).Length > xBottom Then - Dim nLen As Double = ((Notes(xI0).Length + Notes(xI0).VPosition - xBottom) * dRatio) + xBottom - Notes(xI0).VPosition - RedoLongNoteModify(Notes(xI0), Notes(xI0).VPosition, nLen, xUndo, xRedo) - Notes(xI0).Length = nLen - End If - ElseIf Notes(xI0).VPosition < xUpBefore Then - If Notes(xI0).VPosition + Notes(xI0).Length > xUpBefore Then - Dim nLen As Double = ((xUpBefore - Notes(xI0).VPosition) * dRatio) + Notes(xI0).VPosition + Notes(xI0).Length - xUpBefore - Dim nVPos As Double = ((Notes(xI0).VPosition - xBottom) * dRatio) + xBottom - RedoLongNoteModify(Notes(xI0), nVPos, nLen, xUndo, xRedo) - Notes(xI0).Length = nLen - Notes(xI0).VPosition = nVPos - Else - Dim nLen As Double = Notes(xI0).Length * dRatio - Dim nVPos As Double = ((Notes(xI0).VPosition - xBottom) * dRatio) + xBottom - RedoLongNoteModify(Notes(xI0), nVPos, nLen, xUndo, xRedo) - Notes(xI0).Length = nLen - Notes(xI0).VPosition = nVPos - End If - Else - RedoLongNoteModify(Notes(xI0), Notes(xI0).VPosition + dLength, Notes(xI0).Length, xUndo, xRedo) - Notes(xI0).VPosition += dLength - End If - Next - Else - Dim xI0 As Integer - Dim xI9 As Integer - For xI0 = 1 To UBound(Notes) - If Notes(xI0).VPosition >= xBottom Then Exit For - Next - For xI9 = xI0 To UBound(Notes) - If Notes(xI9).VPosition >= xUpBefore Then Exit For - Next - - For xI8 As Integer = xI0 To xI9 - 1 - Dim nVP As Double = ((Notes(xI8).VPosition - xBottom) * dRatio) + xBottom - RedoLongNoteModify(Notes(xI0), nVP, Notes(xI0).Length, xUndo, xRedo) - Notes(xI8).VPosition = nVP - Next - - 'GoTo case2 - - For xI8 As Integer = xI9 To UBound(Notes) - RedoLongNoteModify(Notes(xI8), Notes(xI8).VPosition + dLength, Notes(xI8).Length, xUndo, xRedo) - Notes(xI8).VPosition += dLength - Next - End If - - End Select - - MeasureLength(xI1) = xRatio * 192.0R - LBeat.Items(xI1) = Add3Zeros(xI1) & ": " & xDisplay - Next - UpdateMeasureBottom() - 'xUndo &= vbCrLf & xUndo2 - 'xRedo &= vbCrLf & xRedo2 - - LBeat.SelectedIndices.Clear() - For xI1 As Integer = 0 To UBound(xIndices) - LBeat.SelectedIndices.Add(xIndices(xI1)) - Next - - AddUndo(xUndo, xBaseRedo.Next) - SortByVPositionInsertion() - UpdatePairing() - CalculateTotalPlayableNotes() - CalculateGreatestVPosition() - RefreshPanelAll() - POStatusRefresh() - End Sub - - Private Sub BBeatApply_Click(sender As Object, e As EventArgs) Handles BBeatApply.Click - Dim xxD As Integer = nBeatD.Value - Dim xxN As Integer = nBeatN.Value - Dim xxRatio As Double = xxN / xxD - - ApplyBeat(xxRatio, xxRatio & " ( " & xxN & " / " & xxD & " ) ") - End Sub - - Private Sub BBeatApplyV_Click(sender As Object, e As EventArgs) Handles BBeatApplyV.Click - Dim a As Double - If Double.TryParse(tBeatValue.Text, a) Then - If a <= 0.0# Or a >= 1000.0# Then Media.SystemSounds.Hand.Play() : Exit Sub - - Dim xxD As Long = GetDenominator(a) - - ApplyBeat(a, a & IIf(xxD > 10000, String.Empty, " ( " & (a * xxD) & " / " & xxD & " ) ")) - End If - End Sub - - - Private Sub BHStageFile_Click(sender As Object, e As EventArgs) Handles BHStageFile.Click, BHBanner.Click, BHBackBMP.Click, BHMissBMP.Click - Dim xDiag As New OpenFileDialog With { - .Filter = Strings.FileType._image & "|*.bmp;*.png;*.jpeg;*.jpg;*.gif|" & - Strings.FileType._all & "|*.*", - .InitialDirectory = IIf(ExcludeFileName(FileName) = String.Empty, InitPath, ExcludeFileName(FileName)), - .DefaultExt = "png" - } - - If xDiag.ShowDialog = Forms.DialogResult.Cancel Then Exit Sub - InitPath = ExcludeFileName(xDiag.FileName) - - If ReferenceEquals(sender, BHStageFile) Then - THStageFile.Text = GetFileName(xDiag.FileName) - ElseIf ReferenceEquals(sender, BHBanner) Then - THBanner.Text = GetFileName(xDiag.FileName) - ElseIf ReferenceEquals(sender, BHBackBMP) Then - THBackBMP.Text = GetFileName(xDiag.FileName) - ElseIf ReferenceEquals(sender, BHMissBMP) Then - THMissBMP.Text = GetFileName(xDiag.FileName) - hBMP(0) = THMissBMP.Text - End If - End Sub - - Private Sub BHWavFile_Click(sender As Object, e As EventArgs) Handles BHLandMine.Click, BHPreview.Click - Dim xDiag As New OpenFileDialog With { - .Filter = Strings.FileType._wave & "|*.wav;*.ogg;*.mp3;*.flac|" & - Strings.FileType.WAV & "|*.wav|" & - Strings.FileType.OGG & "|*.ogg|" & - Strings.FileType.MP3 & "|*.mp3|" & - Strings.FileType.FLAC & "|*.flac|" & - Strings.FileType._all & "|*.*", - .InitialDirectory = IIf(ExcludeFileName(FileName) = String.Empty, InitPath, ExcludeFileName(FileName)), - .DefaultExt = "wav" - } - - If xDiag.ShowDialog = Forms.DialogResult.Cancel Then Exit Sub - - If ReferenceEquals(sender, BHLandMine) Then - InitPath = ExcludeFileName(xDiag.FileName) - THLandMine.Text = GetFileName(xDiag.FileName) - hWAV(0) = THLandMine.Text - ElseIf ReferenceEquals(sender, BHPreview) Then - InitPath = ExcludeFileName(xDiag.FileName) - THPreview.Text = GetFileName(xDiag.FileName) - End If - End Sub - - Private Sub Switches_CheckedChanged(sender As Object, e As EventArgs) Handles _ + If NTInput Then + For xI0 = 1 To UBound(Notes) + If Notes(xI0).VPosition >= xUpBefore Then Exit For + If Notes(xI0).VPosition + Notes(xI0).Length >= xUpBefore Then + RedoLongNoteModify(Notes(xI0), Notes(xI0).VPosition, Notes(xI0).Length + dLength, xUndo, xRedo) + Notes(xI0).Length += dLength + End If + Next + Else + For xI0 = 1 To UBound(Notes) + If Notes(xI0).VPosition >= xUpBefore Then Exit For + Next + End If + + For xI9 As Integer = xI0 To UBound(Notes) + RedoLongNoteModify(Notes(xI9), Notes(xI9).VPosition + dLength, Notes(xI9).Length, xUndo, xRedo) + Notes(xI9).VPosition += dLength + Next + + Case 2 + If dLength < 0 Then + If NTInput Then + Dim xI0 As Integer = 1 + Dim xU As Integer = UBound(Notes) + Do While xI0 <= xU + If Notes(xI0).VPosition < xUpAfter Then + If Notes(xI0).VPosition + Notes(xI0).Length >= xUpAfter And Notes(xI0).VPosition + Notes(xI0).Length < xUpBefore Then + Dim nLen As Double = xUpAfter - Notes(xI0).VPosition - 1.0R + RedoLongNoteModify(Notes(xI0), Notes(xI0).VPosition, nLen, xUndo, xRedo) + Notes(xI0).Length = nLen + End If + ElseIf Notes(xI0).VPosition < xUpBefore Then + If Notes(xI0).VPosition + Notes(xI0).Length < xUpBefore Then + RedoRemoveNote(Notes(xI0), xUndo, xRedo) + RemoveNote(xI0) + xI0 -= 1 + xU -= 1 + Else + Dim nLen As Double = Notes(xI0).Length - xUpBefore + Notes(xI0).VPosition + RedoLongNoteModify(Notes(xI0), xUpBefore, nLen, xUndo, xRedo) + Notes(xI0).Length = nLen + Notes(xI0).VPosition = xUpBefore + End If + End If + xI0 += 1 + Loop + Else + Dim xI0 As Integer + Dim xI9 As Integer + For xI0 = 1 To UBound(Notes) + If Notes(xI0).VPosition >= xUpAfter Then Exit For + Next + For xI9 = xI0 To UBound(Notes) + If Notes(xI9).VPosition >= xUpBefore Then Exit For + Next + + For xI8 As Integer = xI0 To xI9 - 1 + RedoRemoveNote(Notes(xI8), xUndo, xRedo) + Next + For xI8 As Integer = xI9 To UBound(Notes) + Notes(xI8 - xI9 + xI0) = Notes(xI8) + Next + ReDim Preserve Notes(UBound(Notes) - xI9 + xI0) + End If + End If + + GoTo case2 + + Case 3 + If NTInput Then + For xI0 As Integer = 1 To UBound(Notes) + If Notes(xI0).VPosition < xBottom Then + If Notes(xI0).VPosition + Notes(xI0).Length > xUpBefore Then + RedoLongNoteModify(Notes(xI0), Notes(xI0).VPosition, Notes(xI0).Length + dLength, xUndo, xRedo) + Notes(xI0).Length += dLength + ElseIf Notes(xI0).VPosition + Notes(xI0).Length > xBottom Then + Dim nLen As Double = ((Notes(xI0).Length + Notes(xI0).VPosition - xBottom) * dRatio) + xBottom - Notes(xI0).VPosition + RedoLongNoteModify(Notes(xI0), Notes(xI0).VPosition, nLen, xUndo, xRedo) + Notes(xI0).Length = nLen + End If + ElseIf Notes(xI0).VPosition < xUpBefore Then + If Notes(xI0).VPosition + Notes(xI0).Length > xUpBefore Then + Dim nLen As Double = ((xUpBefore - Notes(xI0).VPosition) * dRatio) + Notes(xI0).VPosition + Notes(xI0).Length - xUpBefore + Dim nVPos As Double = ((Notes(xI0).VPosition - xBottom) * dRatio) + xBottom + RedoLongNoteModify(Notes(xI0), nVPos, nLen, xUndo, xRedo) + Notes(xI0).Length = nLen + Notes(xI0).VPosition = nVPos + Else + Dim nLen As Double = Notes(xI0).Length * dRatio + Dim nVPos As Double = ((Notes(xI0).VPosition - xBottom) * dRatio) + xBottom + RedoLongNoteModify(Notes(xI0), nVPos, nLen, xUndo, xRedo) + Notes(xI0).Length = nLen + Notes(xI0).VPosition = nVPos + End If + Else + RedoLongNoteModify(Notes(xI0), Notes(xI0).VPosition + dLength, Notes(xI0).Length, xUndo, xRedo) + Notes(xI0).VPosition += dLength + End If + Next + Else + Dim xI0 As Integer + Dim xI9 As Integer + For xI0 = 1 To UBound(Notes) + If Notes(xI0).VPosition >= xBottom Then Exit For + Next + For xI9 = xI0 To UBound(Notes) + If Notes(xI9).VPosition >= xUpBefore Then Exit For + Next + + For xI8 As Integer = xI0 To xI9 - 1 + Dim nVP As Double = ((Notes(xI8).VPosition - xBottom) * dRatio) + xBottom + RedoLongNoteModify(Notes(xI0), nVP, Notes(xI0).Length, xUndo, xRedo) + Notes(xI8).VPosition = nVP + Next + + 'GoTo case2 + + For xI8 As Integer = xI9 To UBound(Notes) + RedoLongNoteModify(Notes(xI8), Notes(xI8).VPosition + dLength, Notes(xI8).Length, xUndo, xRedo) + Notes(xI8).VPosition += dLength + Next + End If + + End Select + + MeasureLength(xI1) = xRatio * 192.0R + LBeat.Items(xI1) = Add3Zeros(xI1) & ": " & xDisplay + Next + UpdateMeasureBottom() + 'xUndo &= vbCrLf & xUndo2 + 'xRedo &= vbCrLf & xRedo2 + + LBeat.SelectedIndices.Clear() + For xI1 As Integer = 0 To UBound(xIndices) + LBeat.SelectedIndices.Add(xIndices(xI1)) + Next + + AddUndo(xUndo, xBaseRedo.Next) + SortByVPositionInsertion() + UpdatePairing() + CalculateTotalPlayableNotes() + CalculateGreatestVPosition() + RefreshPanelAll() + POStatusRefresh() + End Sub + + Private Sub BBeatApply_Click(sender As Object, e As EventArgs) Handles BBeatApply.Click + Dim xxD As Integer = nBeatD.Value + Dim xxN As Integer = nBeatN.Value + Dim xxRatio As Double = xxN / xxD + + ApplyBeat(xxRatio, xxRatio & " ( " & xxN & " / " & xxD & " ) ") + End Sub + + Private Sub BBeatApplyV_Click(sender As Object, e As EventArgs) Handles BBeatApplyV.Click + Dim a As Double + If Double.TryParse(tBeatValue.Text, a) Then + If a <= 0.0# Or a >= 1000.0# Then Media.SystemSounds.Hand.Play() : Exit Sub + + Dim xxD As Long = GetDenominator(a) + + ApplyBeat(a, a & IIf(xxD > 10000, String.Empty, " ( " & (a * xxD) & " / " & xxD & " ) ")) + End If + End Sub + + + Private Sub BHStageFile_Click(sender As Object, e As EventArgs) Handles BHStageFile.Click, BHBanner.Click, BHBackBMP.Click, BHMissBMP.Click + Dim xDiag As New OpenFileDialog With { + .Filter = Strings.FileType._image & "|*.bmp;*.png;*.jpeg;*.jpg;*.gif|" & + Strings.FileType._all & "|*.*", + .InitialDirectory = IIf(ExcludeFileName(FileName) = String.Empty, InitPath, ExcludeFileName(FileName)), + .DefaultExt = "png" + } + + If xDiag.ShowDialog = Forms.DialogResult.Cancel Then Exit Sub + InitPath = ExcludeFileName(xDiag.FileName) + + If ReferenceEquals(sender, BHStageFile) Then + THStageFile.Text = GetFileName(xDiag.FileName) + ElseIf ReferenceEquals(sender, BHBanner) Then + THBanner.Text = GetFileName(xDiag.FileName) + ElseIf ReferenceEquals(sender, BHBackBMP) Then + THBackBMP.Text = GetFileName(xDiag.FileName) + ElseIf ReferenceEquals(sender, BHMissBMP) Then + THMissBMP.Text = GetFileName(xDiag.FileName) + hBMP(0) = THMissBMP.Text + End If + End Sub + + Private Sub BHWavFile_Click(sender As Object, e As EventArgs) Handles BHLandMine.Click, BHPreview.Click + Dim xDiag As New OpenFileDialog With { + .Filter = Strings.FileType._wave & "|*.wav;*.ogg;*.mp3;*.flac|" & + Strings.FileType.WAV & "|*.wav|" & + Strings.FileType.OGG & "|*.ogg|" & + Strings.FileType.MP3 & "|*.mp3|" & + Strings.FileType.FLAC & "|*.flac|" & + Strings.FileType._all & "|*.*", + .InitialDirectory = IIf(ExcludeFileName(FileName) = String.Empty, InitPath, ExcludeFileName(FileName)), + .DefaultExt = "wav" + } + + If xDiag.ShowDialog = Forms.DialogResult.Cancel Then Exit Sub + + If ReferenceEquals(sender, BHLandMine) Then + InitPath = ExcludeFileName(xDiag.FileName) + THLandMine.Text = GetFileName(xDiag.FileName) + hWAV(0) = THLandMine.Text + ElseIf ReferenceEquals(sender, BHPreview) Then + InitPath = ExcludeFileName(xDiag.FileName) + THPreview.Text = GetFileName(xDiag.FileName) + End If + End Sub + + Private Sub Switches_CheckedChanged(sender As Object, e As EventArgs) Handles _ POHeaderSwitch.CheckedChanged, POGridSwitch.CheckedChanged, POWaveFormSwitch.CheckedChanged, @@ -4792,152 +4792,152 @@ POBMPSwitch.CheckedChanged, POBeatSwitch.CheckedChanged, POExpansionSwitch.CheckedChanged - Try - Dim Source As CheckBox = CType(sender, CheckBox) - Dim Target As Panel = Nothing + Try + Dim Source As CheckBox = CType(sender, CheckBox) + Dim Target As Panel = Nothing - If sender Is Nothing Then : Exit Sub - ElseIf sender Is POHeaderSwitch Then : Target = POHeaderInner - ElseIf sender Is POGridSwitch Then : Target = POGridInner - ElseIf sender Is POWaveFormSwitch Then : Target = POWaveFormInner - ElseIf sender Is POWAVSwitch Then : Target = POWAVInner - ElseIf sender Is POBMPSwitch Then : Target = POBMPInner - ElseIf sender Is POBeatSwitch Then : Target = POBeatInner - ElseIf sender Is POExpansionSwitch Then : Target = POExpansionInner - End If + If sender Is Nothing Then : Exit Sub + ElseIf sender Is POHeaderSwitch Then : Target = POHeaderInner + ElseIf sender Is POGridSwitch Then : Target = POGridInner + ElseIf sender Is POWaveFormSwitch Then : Target = POWaveFormInner + ElseIf sender Is POWAVSwitch Then : Target = POWAVInner + ElseIf sender Is POBMPSwitch Then : Target = POBMPInner + ElseIf sender Is POBeatSwitch Then : Target = POBeatInner + ElseIf sender Is POExpansionSwitch Then : Target = POExpansionInner + End If - Target.Visible = Source.Checked + Target.Visible = Source.Checked - Catch ex As Exception + Catch ex As Exception - End Try - End Sub + End Try + End Sub - Private Sub Expanders_CheckChanged(sender As Object, e As EventArgs) Handles _ + Private Sub Expanders_CheckChanged(sender As Object, e As EventArgs) Handles _ POHeaderExpander.CheckedChanged, POGridExpander.CheckedChanged, POWaveFormExpander.CheckedChanged, POWAVExpander.CheckedChanged, POBeatExpander.CheckedChanged - Try - Dim Source As CheckBox = CType(sender, CheckBox) - Dim Target As Panel = Nothing - 'Dim TargetParent As Panel = Nothing + Try + Dim Source As CheckBox = CType(sender, CheckBox) + Dim Target As Panel = Nothing + 'Dim TargetParent As Panel = Nothing - If sender Is Nothing Then : Exit Sub - ElseIf ReferenceEquals(sender, POHeaderExpander) Then : Target = POHeaderPart2 ' : TargetParent = POHeaderInner - ElseIf ReferenceEquals(sender, POGridExpander) Then : Target = POGridPart2 ' : TargetParent = POGridInner - ElseIf ReferenceEquals(sender, POWaveFormExpander) Then : Target = POWaveFormPart2 ' : TargetParent = POWaveFormInner - ElseIf ReferenceEquals(sender, POWAVExpander) Then : Target = POWAVPart2 ' : TargetParent = POWaveFormInner - ElseIf ReferenceEquals(sender, POBeatExpander) Then : Target = POBeatPart2 ' : TargetParent = POWaveFormInner - End If + If sender Is Nothing Then : Exit Sub + ElseIf ReferenceEquals(sender, POHeaderExpander) Then : Target = POHeaderPart2 ' : TargetParent = POHeaderInner + ElseIf ReferenceEquals(sender, POGridExpander) Then : Target = POGridPart2 ' : TargetParent = POGridInner + ElseIf ReferenceEquals(sender, POWaveFormExpander) Then : Target = POWaveFormPart2 ' : TargetParent = POWaveFormInner + ElseIf ReferenceEquals(sender, POWAVExpander) Then : Target = POWAVPart2 ' : TargetParent = POWaveFormInner + ElseIf ReferenceEquals(sender, POBeatExpander) Then : Target = POBeatPart2 ' : TargetParent = POWaveFormInner + End If - Target.Visible = Source.Checked - - Catch ex As Exception - - End Try - - End Sub - - Private Sub VerticalResizer_MouseDown(sender As Object, e As MouseEventArgs) Handles POWAVResizer.MouseDown, POBMPResizer.MouseDown, POBeatResizer.MouseDown, POExpansionResizer.MouseDown - tempResize = e.Y - End Sub - - Private Sub HorizontalResizer_MouseDown(sender As Object, e As MouseEventArgs) Handles POptionsResizer.MouseDown, SpL.MouseDown, SpR.MouseDown - tempResize = e.X - End Sub - - Private Sub POResizer_MouseMove(sender As Object, e As MouseEventArgs) Handles POWAVResizer.MouseMove, POBMPResizer.MouseMove, POBeatResizer.MouseMove, POExpansionResizer.MouseMove - If e.Button <> MouseButtons.Left Then Exit Sub - If e.Y = tempResize Then Exit Sub - - Try - Dim Source As Button = CType(sender, Button) - Dim Target As Panel = Source.Parent - - Dim xHeight As Integer = Target.Height + e.Y - tempResize - If xHeight < 10 Then xHeight = 10 - Target.Height = xHeight - - Target.Refresh() - Catch ex As Exception - - End Try - End Sub - - Private Sub POptionsResizer_MouseMove(sender As Object, e As MouseEventArgs) Handles POptionsResizer.MouseMove - If e.Button <> MouseButtons.Left Then Exit Sub - If e.X = tempResize Then Exit Sub - - Try - Dim xWidth As Integer = POptionsScroll.Width - e.X + tempResize - If xWidth < 25 Then xWidth = 25 - POptionsScroll.Width = xWidth - - Refresh() - Application.DoEvents() - Catch ex As Exception - - End Try - End Sub - - Private Sub SpR_MouseMove(sender As Object, e As MouseEventArgs) Handles SpR.MouseMove - If e.Button <> MouseButtons.Left Then Exit Sub - If e.X = tempResize Then Exit Sub - - Try - Dim xWidth As Integer = PMainR.Width - e.X + tempResize - If xWidth < 0 Then xWidth = 0 - PMainR.Width = xWidth - - ToolStripContainer1.Refresh() - Application.DoEvents() - Catch ex As Exception - - End Try - End Sub - - Private Sub SpL_MouseMove(sender As Object, e As MouseEventArgs) Handles SpL.MouseMove - If e.Button <> MouseButtons.Left Then Exit Sub - If e.X = tempResize Then Exit Sub - - Try - Dim xWidth As Integer = PMainL.Width + e.X - tempResize - If xWidth < 0 Then xWidth = 0 - PMainL.Width = xWidth - - ToolStripContainer1.Refresh() - Application.DoEvents() - Catch ex As Exception - - End Try - End Sub - - Private Sub mnGotoMeasure_Click(sender As Object, e As EventArgs) Handles mnGotoMeasure.Click - Dim s = InputBox(Strings.Messages.PromptEnterMeasure, "Enter Measure") - - Dim i As Integer - If Integer.TryParse(s, i) Then - If i < 0 Or i > 999 Then - Exit Sub - End If - - PanelVScroll(PanelFocus) = -MeasureBottom(i) - End If - End Sub - Private Sub Reloadbms() - 'KMouseDown = -1 - ReDim SelectedNotes(-1) - KMouseOver = -1 - If ClosingPopSave() Then Exit Sub - OpenBMS(File.ReadAllText(FileName, TextEncoding)) - ClearUndo() - SetFileName(FileName) - NewRecent(FileName) - SetIsSaved(True) - 'pIsSaved.Visible = Not IsSaved - End Sub + Target.Visible = Source.Checked + + Catch ex As Exception + + End Try + + End Sub + + Private Sub VerticalResizer_MouseDown(sender As Object, e As MouseEventArgs) Handles POWAVResizer.MouseDown, POBMPResizer.MouseDown, POBeatResizer.MouseDown, POExpansionResizer.MouseDown + tempResize = e.Y + End Sub + + Private Sub HorizontalResizer_MouseDown(sender As Object, e As MouseEventArgs) Handles POptionsResizer.MouseDown, SpL.MouseDown, SpR.MouseDown + tempResize = e.X + End Sub + + Private Sub POResizer_MouseMove(sender As Object, e As MouseEventArgs) Handles POWAVResizer.MouseMove, POBMPResizer.MouseMove, POBeatResizer.MouseMove, POExpansionResizer.MouseMove + If e.Button <> MouseButtons.Left Then Exit Sub + If e.Y = tempResize Then Exit Sub + + Try + Dim Source As Button = CType(sender, Button) + Dim Target As Panel = Source.Parent + + Dim xHeight As Integer = Target.Height + e.Y - tempResize + If xHeight < 10 Then xHeight = 10 + Target.Height = xHeight + + Target.Refresh() + Catch ex As Exception + + End Try + End Sub + + Private Sub POptionsResizer_MouseMove(sender As Object, e As MouseEventArgs) Handles POptionsResizer.MouseMove + If e.Button <> MouseButtons.Left Then Exit Sub + If e.X = tempResize Then Exit Sub + + Try + Dim xWidth As Integer = POptionsScroll.Width - e.X + tempResize + If xWidth < 25 Then xWidth = 25 + POptionsScroll.Width = xWidth + + Refresh() + Application.DoEvents() + Catch ex As Exception + + End Try + End Sub + + Private Sub SpR_MouseMove(sender As Object, e As MouseEventArgs) Handles SpR.MouseMove + If e.Button <> MouseButtons.Left Then Exit Sub + If e.X = tempResize Then Exit Sub + + Try + Dim xWidth As Integer = PMainR.Width - e.X + tempResize + If xWidth < 0 Then xWidth = 0 + PMainR.Width = xWidth + + ToolStripContainer1.Refresh() + Application.DoEvents() + Catch ex As Exception + + End Try + End Sub + + Private Sub SpL_MouseMove(sender As Object, e As MouseEventArgs) Handles SpL.MouseMove + If e.Button <> MouseButtons.Left Then Exit Sub + If e.X = tempResize Then Exit Sub + + Try + Dim xWidth As Integer = PMainL.Width + e.X - tempResize + If xWidth < 0 Then xWidth = 0 + PMainL.Width = xWidth + + ToolStripContainer1.Refresh() + Application.DoEvents() + Catch ex As Exception + + End Try + End Sub + + Private Sub mnGotoMeasure_Click(sender As Object, e As EventArgs) Handles mnGotoMeasure.Click + Dim s = InputBox(Strings.Messages.PromptEnterMeasure, "Enter Measure") + + Dim i As Integer + If Integer.TryParse(s, i) Then + If i < 0 Or i > 999 Then + Exit Sub + End If + + PanelVScroll(PanelFocus) = -MeasureBottom(i) + End If + End Sub + Private Sub Reloadbms() + 'KMouseDown = -1 + ReDim SelectedNotes(-1) + KMouseOver = -1 + If ClosingPopSave() Then Exit Sub + OpenBMS(File.ReadAllText(FileName, TextEncoding)) + ClearUndo() + SetFileName(FileName) + NewRecent(FileName) + SetIsSaved(True) + 'pIsSaved.Visible = Not IsSaved + End Sub End Class \ No newline at end of file diff --git a/iBMSC/MyO2.vb b/iBMSC/MyO2.vb index ece26a38b..51debbccb 100644 --- a/iBMSC/MyO2.vb +++ b/iBMSC/MyO2.vb @@ -1,308 +1,308 @@ Partial Public Class MainWindow - Public Sub MyO2ConstBPM(vBPM As Integer) - SortByVPositionInsertion() - Dim xUndo As UndoRedo.LinkedURCmd = Nothing - Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void - Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo - - Dim xI1 As Integer - Dim xI2 As Integer - Dim xI3 As Integer - - 'Save undo - 'For xI3 = 1 To UBound(K) - ' K(xI3).Selected = True - ' Next - ' xUndo = "KZ" & vbCrLf & _ - ' sCmdKs(False) & vbCrLf & _ - ' "SA_" & vSelStart & "_" & vSelLength & "_" & vSelHalf & "_0" - RedoRemoveNoteAll(False, xUndo, xRedo) - - 'Adjust note - Dim xcTime As Double = 0 - Dim xcVPos As Double = 0 - Dim xcBPM As Integer = Notes(0).Value - - If Not NTInput Then - For xI1 = 1 To UBound(Notes) - If Notes(xI1).ColumnIndex = niBPM Then - xcTime += (Notes(xI1).VPosition - xcVPos) / xcBPM - xcVPos = Notes(xI1).VPosition - xcBPM = Notes(xI1).Value - Else - Notes(xI1).VPosition = vBPM * (xcTime + ((Notes(xI1).VPosition - xcVPos) / xcBPM)) - End If - Next - - Else - For xI1 = 1 To UBound(Notes) - If Notes(xI1).ColumnIndex = niBPM Then - xcTime += (Notes(xI1).VPosition - xcVPos) / xcBPM - xcVPos = Notes(xI1).VPosition - xcBPM = Notes(xI1).Value - ElseIf Notes(xI1).Length = 0 Then - Notes(xI1).VPosition = vBPM * (xcTime + ((Notes(xI1).VPosition - xcVPos) / xcBPM)) - Else - Dim xNewTimeL As Double = xcTime + ((Notes(xI1).VPosition - xcVPos) / xcBPM) - - 'find bpms - Dim xcTime2 As Double = xcTime - Dim xcVPos2 As Double = xcVPos - Dim xcBPM2 As Integer = xcBPM - For xI2 = xI1 + 1 To UBound(Notes) - If Notes(xI2).VPosition >= Notes(xI1).VPosition + Notes(xI1).Length Then Exit For - If Notes(xI2).ColumnIndex = niBPM Then - xcTime2 += (Notes(xI2).VPosition - xcVPos2) / xcBPM2 - xcVPos2 = Notes(xI2).VPosition - xcBPM2 = Notes(xI2).Value - End If - Next - Dim xNewTimeU As Double = xcTime2 + ((Notes(xI1).VPosition + Notes(xI1).Length - xcVPos2) / xcBPM2) - - Notes(xI1).VPosition = vBPM * xNewTimeL - Notes(xI1).Length = (vBPM * xNewTimeU) - Notes(xI1).VPosition - End If - Next - End If - - 'Delete BPMs - xI1 = 1 - Do While xI1 <= UBound(Notes) - If Notes(xI1).ColumnIndex = niBPM Then - For xI3 = xI1 + 1 To UBound(Notes) - Notes(xI3 - 1) = Notes(xI3) - Next - ReDim Preserve Notes(UBound(Notes) - 1) - Else - xI1 += 1 - End If - Loop - - 'Save redo - 'For xI3 = 1 To UBound(K) - ' K(xI3).Selected = True - 'Next - 'xRedo = "KZ" & vbCrLf & _ - ' sCmdKs(False) & vbCrLf & _ - ' "SA_" & vSelStart & "_" & vSelLength & "_" & vSelHalf & "_1" - - RedoAddNoteAll(False, xUndo, xRedo) - RedoRelabelNote(Notes(0), vBPM, xUndo, xRedo) - - AddUndo(xUndo, xBaseRedo.Next) - SortByVPositionInsertion() - UpdatePairing() - Notes(0).Value = vBPM - THBPM.Value = vBPM / 10000 - CalculateTotalPlayableNotes() - CalculateGreatestVPosition() - RefreshPanelAll() - POStatusRefresh() - End Sub - - Public Function MyO2GridCheck() As String() - CalculateGreatestVPosition() - SortByVPositionInsertion() - Dim xResult(-1) As String - Dim xResult2(-1) As String - Dim Identifiers() As String = {"01", "03", "04", "06", "07", "08", "09", - "16", "11", "12", "13", "14", "15", "18", "19", - "26", "21", "22", "23", "24", "25", "28", "29", - "36", "31", "32", "33", "34", "35", "38", "39", - "46", "41", "42", "43", "44", "45", "48", "49", - "56", "51", "52", "53", "54", "55", "58", "59", - "66", "61", "62", "63", "64", "65", "68", "69", - "76", "71", "72", "73", "74", "75", "78", "79", - "86", "81", "82", "83", "84", "85", "88", "89"} - - Dim xLowerIndex As Integer = 1 - - If Not NTInput Then - For xMeasure As Integer = 0 To MeasureAtDisplacement(GreatestVPosition) - 'Find Ks in the same measure - Dim xI1 As Integer - For xI1 = xLowerIndex To UBound(Notes) - If MeasureAtDisplacement(Notes(xI1).VPosition) > xMeasure Then Exit For - Next - Dim xUpperIndex As Integer = xI1 - - For Each xId As String In Identifiers - 'collect vposition data - Dim xVPos(-1) As Double - For xI2 As Integer = xLowerIndex To xUpperIndex - 1 - If GetBMSChannelBy(Notes(xI2)) = xId And Math.Abs(Notes(xI2).VPosition - (MeasureAtDisplacement(Notes(xI2).VPosition) * 192)) > 0 Then - ReDim Preserve xVPos(UBound(xVPos) + 1) - xVPos(UBound(xVPos)) = Notes(xI2).VPosition - (xMeasure * 192) : If xVPos(UBound(xVPos)) < 0 Then xVPos(UBound(xVPos)) = 0 - End If - Next - - 'find gcd - Dim xGCD As Double = 192 - For xI2 As Integer = 0 To UBound(xVPos) - xGCD = GCD(xGCD, xVPos(xI2)) - Next - - 'check if smaller than minGCD - If xGCD < 3 Then - 'suggestion - Dim xAdj64 As Boolean - Dim xD48 As Integer = 0 - Dim xD64 As Integer = 0 - For xI2 As Integer = 0 To UBound(xVPos) - xD48 += Math.Abs(xVPos(xI2) - (CInt(xVPos(xI2) / 4) * 4)) - xD64 += Math.Abs(xVPos(xI2) - (CInt(xVPos(xI2) / 3) * 3)) - Next - xAdj64 = xD48 > xD64 - - 'put result - ReDim Preserve xResult(UBound(xResult) + 1) - xResult(UBound(xResult)) = xMeasure & "_" & - BMSChannelToColumn(xId) & "_" & - nTitle(BMSChannelToColumn(xId)) & "_" & - 192 / xGCD & "_" & - IsChannelLongNote(xId) & "_" & - IsChannelHidden(xId) & "_" & - xAdj64 & "_" & - xD64 & "_" & - xD48 - End If - Next + Public Sub MyO2ConstBPM(vBPM As Integer) + SortByVPositionInsertion() + Dim xUndo As UndoRedo.LinkedURCmd = Nothing + Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void + Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo + + Dim xI1 As Integer + Dim xI2 As Integer + Dim xI3 As Integer + + 'Save undo + 'For xI3 = 1 To UBound(K) + ' K(xI3).Selected = True + ' Next + ' xUndo = "KZ" & vbCrLf & _ + ' sCmdKs(False) & vbCrLf & _ + ' "SA_" & vSelStart & "_" & vSelLength & "_" & vSelHalf & "_0" + RedoRemoveNoteAll(False, xUndo, xRedo) + + 'Adjust note + Dim xcTime As Double = 0 + Dim xcVPos As Double = 0 + Dim xcBPM As Integer = Notes(0).Value + + If Not NTInput Then + For xI1 = 1 To UBound(Notes) + If Notes(xI1).ColumnIndex = niBPM Then + xcTime += (Notes(xI1).VPosition - xcVPos) / xcBPM + xcVPos = Notes(xI1).VPosition + xcBPM = Notes(xI1).Value + Else + Notes(xI1).VPosition = vBPM * (xcTime + ((Notes(xI1).VPosition - xcVPos) / xcBPM)) + End If + Next + + Else + For xI1 = 1 To UBound(Notes) + If Notes(xI1).ColumnIndex = niBPM Then + xcTime += (Notes(xI1).VPosition - xcVPos) / xcBPM + xcVPos = Notes(xI1).VPosition + xcBPM = Notes(xI1).Value + ElseIf Notes(xI1).Length = 0 Then + Notes(xI1).VPosition = vBPM * (xcTime + ((Notes(xI1).VPosition - xcVPos) / xcBPM)) + Else + Dim xNewTimeL As Double = xcTime + ((Notes(xI1).VPosition - xcVPos) / xcBPM) + + 'find bpms + Dim xcTime2 As Double = xcTime + Dim xcVPos2 As Double = xcVPos + Dim xcBPM2 As Integer = xcBPM + For xI2 = xI1 + 1 To UBound(Notes) + If Notes(xI2).VPosition >= Notes(xI1).VPosition + Notes(xI1).Length Then Exit For + If Notes(xI2).ColumnIndex = niBPM Then + xcTime2 += (Notes(xI2).VPosition - xcVPos2) / xcBPM2 + xcVPos2 = Notes(xI2).VPosition + xcBPM2 = Notes(xI2).Value + End If + Next + Dim xNewTimeU As Double = xcTime2 + ((Notes(xI1).VPosition + Notes(xI1).Length - xcVPos2) / xcBPM2) + + Notes(xI1).VPosition = vBPM * xNewTimeL + Notes(xI1).Length = (vBPM * xNewTimeU) - Notes(xI1).VPosition + End If + Next + End If + + 'Delete BPMs + xI1 = 1 + Do While xI1 <= UBound(Notes) + If Notes(xI1).ColumnIndex = niBPM Then + For xI3 = xI1 + 1 To UBound(Notes) + Notes(xI3 - 1) = Notes(xI3) + Next + ReDim Preserve Notes(UBound(Notes) - 1) + Else + xI1 += 1 + End If + Loop + + 'Save redo + 'For xI3 = 1 To UBound(K) + ' K(xI3).Selected = True + 'Next + 'xRedo = "KZ" & vbCrLf & _ + ' sCmdKs(False) & vbCrLf & _ + ' "SA_" & vSelStart & "_" & vSelLength & "_" & vSelHalf & "_1" + + RedoAddNoteAll(False, xUndo, xRedo) + RedoRelabelNote(Notes(0), vBPM, xUndo, xRedo) + + AddUndo(xUndo, xBaseRedo.Next) + SortByVPositionInsertion() + UpdatePairing() + Notes(0).Value = vBPM + THBPM.Value = vBPM / 10000 + CalculateTotalPlayableNotes() + CalculateGreatestVPosition() + RefreshPanelAll() + POStatusRefresh() + End Sub + + Public Function MyO2GridCheck() As String() + CalculateGreatestVPosition() + SortByVPositionInsertion() + Dim xResult(-1) As String + Dim xResult2(-1) As String + Dim Identifiers() As String = {"01", "03", "04", "06", "07", "08", "09", + "16", "11", "12", "13", "14", "15", "18", "19", + "26", "21", "22", "23", "24", "25", "28", "29", + "36", "31", "32", "33", "34", "35", "38", "39", + "46", "41", "42", "43", "44", "45", "48", "49", + "56", "51", "52", "53", "54", "55", "58", "59", + "66", "61", "62", "63", "64", "65", "68", "69", + "76", "71", "72", "73", "74", "75", "78", "79", + "86", "81", "82", "83", "84", "85", "88", "89"} + + Dim xLowerIndex As Integer = 1 + + If Not NTInput Then + For xMeasure As Integer = 0 To MeasureAtDisplacement(GreatestVPosition) + 'Find Ks in the same measure + Dim xI1 As Integer + For xI1 = xLowerIndex To UBound(Notes) + If MeasureAtDisplacement(Notes(xI1).VPosition) > xMeasure Then Exit For + Next + Dim xUpperIndex As Integer = xI1 + + For Each xId As String In Identifiers + 'collect vposition data + Dim xVPos(-1) As Double + For xI2 As Integer = xLowerIndex To xUpperIndex - 1 + If GetBMSChannelBy(Notes(xI2)) = xId And Math.Abs(Notes(xI2).VPosition - (MeasureAtDisplacement(Notes(xI2).VPosition) * 192)) > 0 Then + ReDim Preserve xVPos(UBound(xVPos) + 1) + xVPos(UBound(xVPos)) = Notes(xI2).VPosition - (xMeasure * 192) : If xVPos(UBound(xVPos)) < 0 Then xVPos(UBound(xVPos)) = 0 + End If + Next + + 'find gcd + Dim xGCD As Double = 192 + For xI2 As Integer = 0 To UBound(xVPos) + xGCD = GCD(xGCD, xVPos(xI2)) + Next + + 'check if smaller than minGCD + If xGCD < 3 Then + 'suggestion + Dim xAdj64 As Boolean + Dim xD48 As Integer = 0 + Dim xD64 As Integer = 0 + For xI2 As Integer = 0 To UBound(xVPos) + xD48 += Math.Abs(xVPos(xI2) - (CInt(xVPos(xI2) / 4) * 4)) + xD64 += Math.Abs(xVPos(xI2) - (CInt(xVPos(xI2) / 3) * 3)) + Next + xAdj64 = xD48 > xD64 + + 'put result + ReDim Preserve xResult(UBound(xResult) + 1) + xResult(UBound(xResult)) = xMeasure & "_" & + BMSChannelToColumn(xId) & "_" & + nTitle(BMSChannelToColumn(xId)) & "_" & + 192 / xGCD & "_" & + IsChannelLongNote(xId) & "_" & + IsChannelHidden(xId) & "_" & + xAdj64 & "_" & + xD64 & "_" & + xD48 + End If + Next 980: xLowerIndex = xUpperIndex 990: Next - Else - For xMeasure As Integer = 0 To MeasureAtDisplacement(GreatestVPosition) + Else + For xMeasure As Integer = 0 To MeasureAtDisplacement(GreatestVPosition) - For Each xId As String In Identifiers - Dim xVPos(-1) As Double + For Each xId As String In Identifiers + Dim xVPos(-1) As Double - 'collect vposition data - For xI2 As Integer = 1 To UBound(Notes) - If MeasureAtDisplacement(Notes(xI2).VPosition) > xMeasure Then Exit For + 'collect vposition data + For xI2 As Integer = 1 To UBound(Notes) + If MeasureAtDisplacement(Notes(xI2).VPosition) > xMeasure Then Exit For - If GetBMSChannelBy(Notes(xI2)) <> xId Then GoTo 1330 - If IsChannelLongNote(xId) Xor CBool(Notes(xI2).Length) Then GoTo 1330 + If GetBMSChannelBy(Notes(xI2)) <> xId Then GoTo 1330 + If IsChannelLongNote(xId) Xor CBool(Notes(xI2).Length) Then GoTo 1330 - If MeasureAtDisplacement(Notes(xI2).VPosition) = xMeasure AndAlso Math.Abs(Notes(xI2).VPosition - (MeasureAtDisplacement(Notes(xI2).VPosition) * 192)) > 0 Then - ReDim Preserve xVPos(UBound(xVPos) + 1) - xVPos(UBound(xVPos)) = Notes(xI2).VPosition - (xMeasure * 192) : If xVPos(UBound(xVPos)) < 0 Then xVPos(UBound(xVPos)) = 0 - End If + If MeasureAtDisplacement(Notes(xI2).VPosition) = xMeasure AndAlso Math.Abs(Notes(xI2).VPosition - (MeasureAtDisplacement(Notes(xI2).VPosition) * 192)) > 0 Then + ReDim Preserve xVPos(UBound(xVPos) + 1) + xVPos(UBound(xVPos)) = Notes(xI2).VPosition - (xMeasure * 192) : If xVPos(UBound(xVPos)) < 0 Then xVPos(UBound(xVPos)) = 0 + End If - If Not CBool(Notes(xI2).Length) Then GoTo 1330 + If Not CBool(Notes(xI2).Length) Then GoTo 1330 - If MeasureAtDisplacement(Notes(xI2).VPosition + Notes(xI2).Length) = xMeasure AndAlso Not Notes(xI2).VPosition + Notes(xI2).Length - (xMeasure * 192) = 0 Then - ReDim Preserve xVPos(UBound(xVPos) + 1) - xVPos(UBound(xVPos)) = Notes(xI2).VPosition + Notes(xI2).Length - (xMeasure * 192) : If xVPos(UBound(xVPos)) < 0 Then xVPos(UBound(xVPos)) = 0 - End If + If MeasureAtDisplacement(Notes(xI2).VPosition + Notes(xI2).Length) = xMeasure AndAlso Not Notes(xI2).VPosition + Notes(xI2).Length - (xMeasure * 192) = 0 Then + ReDim Preserve xVPos(UBound(xVPos) + 1) + xVPos(UBound(xVPos)) = Notes(xI2).VPosition + Notes(xI2).Length - (xMeasure * 192) : If xVPos(UBound(xVPos)) < 0 Then xVPos(UBound(xVPos)) = 0 + End If 1330: Next - 'find gcd - Dim xGCD As Double = 192 - For xI2 As Integer = 0 To UBound(xVPos) - xGCD = GCD(xGCD, xVPos(xI2)) - Next - - 'check if smaller than minGCD - If xGCD < 3 Then - 'suggestion - Dim xAdj64 As Boolean - Dim xD48 As Integer = 0 - Dim xD64 As Integer = 0 - For xI2 As Integer = 0 To UBound(xVPos) - xD48 += Math.Abs(xVPos(xI2) - (CInt(xVPos(xI2) / 4) * 4)) - xD64 += Math.Abs(xVPos(xI2) - (CInt(xVPos(xI2) / 3) * 3)) - Next - xAdj64 = xD48 > xD64 - - 'put result - ReDim Preserve xResult(UBound(xResult) + 1) - xResult(UBound(xResult)) = xMeasure & "_" & - BMSChannelToColumn(xId) & "_" & - nTitle(BMSChannelToColumn(xId)) & "_" & - 192 / xGCD & "_" & - IsChannelLongNote(xId) & "_" & - IsChannelHidden(xId) & "_" & - xAdj64 & "_" & - xD64 & "_" & - xD48 - End If - Next + 'find gcd + Dim xGCD As Double = 192 + For xI2 As Integer = 0 To UBound(xVPos) + xGCD = GCD(xGCD, xVPos(xI2)) + Next + + 'check if smaller than minGCD + If xGCD < 3 Then + 'suggestion + Dim xAdj64 As Boolean + Dim xD48 As Integer = 0 + Dim xD64 As Integer = 0 + For xI2 As Integer = 0 To UBound(xVPos) + xD48 += Math.Abs(xVPos(xI2) - (CInt(xVPos(xI2) / 4) * 4)) + xD64 += Math.Abs(xVPos(xI2) - (CInt(xVPos(xI2) / 3) * 3)) + Next + xAdj64 = xD48 > xD64 + + 'put result + ReDim Preserve xResult(UBound(xResult) + 1) + xResult(UBound(xResult)) = xMeasure & "_" & + BMSChannelToColumn(xId) & "_" & + nTitle(BMSChannelToColumn(xId)) & "_" & + 192 / xGCD & "_" & + IsChannelLongNote(xId) & "_" & + IsChannelHidden(xId) & "_" & + xAdj64 & "_" & + xD64 & "_" & + xD48 + End If + Next 1990: Next - End If - - Return xResult - End Function - - Public Sub MyO2GridAdjust(xaj() As dgMyO2.Adj) - Dim xUndo As UndoRedo.LinkedURCmd = Nothing - Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void - Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo - - 'Save undo - 'For xI3 As Integer = 1 To UBound(K) - ' K(xI3).Selected = True - 'Next - 'xUndo = "KZ" & vbCrLf & _ - ' sCmdKs(False) & vbCrLf & _ - ' "SA_" & vSelStart & "_" & vSelLength & "_" & vSelHalf & "_0" - RedoRemoveNoteAll(False, xUndo, xRedo) - - 'adjust - If Not NTInput Then - For Each xadj As dgMyO2.Adj In xaj - For xI1 As Integer = 1 To UBound(Notes) - If MeasureAtDisplacement(Notes(xI1).VPosition) = xadj.Measure And - Notes(xI1).ColumnIndex = xadj.ColumnIndex And - Notes(xI1).LongNote = xadj.LongNote And - Notes(xI1).Hidden = xadj.Hidden Then - Notes(xI1).VPosition = CLng(Notes(xI1).VPosition / IIf(xadj.AdjTo64, 3, 4)) * IIf(xadj.AdjTo64, 3, 4) - End If - Next - Next - - Else - For Each xadj As dgMyO2.Adj In xaj - For xI1 As Integer = 1 To UBound(Notes) - If CBool(Notes(xI1).Length) Xor xadj.LongNote Then GoTo 1100 - - Dim xStart As Double = Notes(xI1).VPosition - Dim xEnd As Double = Notes(xI1).VPosition + Notes(xI1).Length - If MeasureAtDisplacement(Notes(xI1).VPosition) = xadj.Measure And - Notes(xI1).ColumnIndex = xadj.ColumnIndex And - Notes(xI1).Hidden = xadj.Hidden Then _ - xStart = CLng(Notes(xI1).VPosition / IIf(xadj.AdjTo64, 3, 4)) * IIf(xadj.AdjTo64, 3, 4) - - If Notes(xI1).Length > 0 AndAlso - MeasureAtDisplacement(Notes(xI1).VPosition + Notes(xI1).Length) = xadj.Measure And - Notes(xI1).ColumnIndex = xadj.ColumnIndex And - Notes(xI1).Hidden = xadj.Hidden Then _ - xEnd = CLng((Notes(xI1).VPosition + Notes(xI1).Length) / IIf(xadj.AdjTo64, 3, 4)) * IIf(xadj.AdjTo64, 3, 4) - - Notes(xI1).VPosition = xStart - If Notes(xI1).Length > 0 Then Notes(xI1).Length = xEnd - Notes(xI1).VPosition + End If + + Return xResult + End Function + + Public Sub MyO2GridAdjust(xaj() As dgMyO2.Adj) + Dim xUndo As UndoRedo.LinkedURCmd = Nothing + Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void + Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo + + 'Save undo + 'For xI3 As Integer = 1 To UBound(K) + ' K(xI3).Selected = True + 'Next + 'xUndo = "KZ" & vbCrLf & _ + ' sCmdKs(False) & vbCrLf & _ + ' "SA_" & vSelStart & "_" & vSelLength & "_" & vSelHalf & "_0" + RedoRemoveNoteAll(False, xUndo, xRedo) + + 'adjust + If Not NTInput Then + For Each xadj As dgMyO2.Adj In xaj + For xI1 As Integer = 1 To UBound(Notes) + If MeasureAtDisplacement(Notes(xI1).VPosition) = xadj.Measure And + Notes(xI1).ColumnIndex = xadj.ColumnIndex And + Notes(xI1).LongNote = xadj.LongNote And + Notes(xI1).Hidden = xadj.Hidden Then + Notes(xI1).VPosition = CLng(Notes(xI1).VPosition / IIf(xadj.AdjTo64, 3, 4)) * IIf(xadj.AdjTo64, 3, 4) + End If + Next + Next + + Else + For Each xadj As dgMyO2.Adj In xaj + For xI1 As Integer = 1 To UBound(Notes) + If CBool(Notes(xI1).Length) Xor xadj.LongNote Then GoTo 1100 + + Dim xStart As Double = Notes(xI1).VPosition + Dim xEnd As Double = Notes(xI1).VPosition + Notes(xI1).Length + If MeasureAtDisplacement(Notes(xI1).VPosition) = xadj.Measure And + Notes(xI1).ColumnIndex = xadj.ColumnIndex And + Notes(xI1).Hidden = xadj.Hidden Then _ + xStart = CLng(Notes(xI1).VPosition / IIf(xadj.AdjTo64, 3, 4)) * IIf(xadj.AdjTo64, 3, 4) + + If Notes(xI1).Length > 0 AndAlso + MeasureAtDisplacement(Notes(xI1).VPosition + Notes(xI1).Length) = xadj.Measure And + Notes(xI1).ColumnIndex = xadj.ColumnIndex And + Notes(xI1).Hidden = xadj.Hidden Then _ + xEnd = CLng((Notes(xI1).VPosition + Notes(xI1).Length) / IIf(xadj.AdjTo64, 3, 4)) * IIf(xadj.AdjTo64, 3, 4) + + Notes(xI1).VPosition = xStart + If Notes(xI1).Length > 0 Then Notes(xI1).Length = xEnd - Notes(xI1).VPosition 1100: Next - Next - End If - - 'Save redo - 'For xI3 As Integer = 1 To UBound(K) - ' K(xI3).Selected = True - ' Next - ' xRedo = "KZ" & vbCrLf & _ - ' sCmdKs(False) & vbCrLf & _ - ' "SA_" & vSelStart & "_" & vSelLength & "_" & vSelHalf & "_1" - RedoAddNoteAll(False, xUndo, xRedo) - - AddUndo(xUndo, xBaseRedo.Next) - SortByVPositionInsertion() - UpdatePairing() - CalculateTotalPlayableNotes() - CalculateGreatestVPosition() - RefreshPanelAll() - POStatusRefresh() - Beep() - End Sub + Next + End If + + 'Save redo + 'For xI3 As Integer = 1 To UBound(K) + ' K(xI3).Selected = True + ' Next + ' xRedo = "KZ" & vbCrLf & _ + ' sCmdKs(False) & vbCrLf & _ + ' "SA_" & vSelStart & "_" & vSelLength & "_" & vSelHalf & "_1" + RedoAddNoteAll(False, xUndo, xRedo) + + AddUndo(xUndo, xBaseRedo.Next) + SortByVPositionInsertion() + UpdatePairing() + CalculateTotalPlayableNotes() + CalculateGreatestVPosition() + RefreshPanelAll() + POStatusRefresh() + Beep() + End Sub End Class diff --git a/iBMSC/Option Windows/Note.vb b/iBMSC/Option Windows/Note.vb index 7c3c861d5..0af99a79f 100644 --- a/iBMSC/Option Windows/Note.vb +++ b/iBMSC/Option Windows/Note.vb @@ -1,87 +1,87 @@ Namespace Editor - Public Structure Note - Public VPosition As Double - Public ColumnIndex As Integer - Public Value As Long 'x10000 - Public LongNote As Boolean - Public Hidden As Boolean - Public Length As Double - Public Landmine As Boolean + Public Structure Note + Public VPosition As Double + Public ColumnIndex As Integer + Public Value As Long 'x10000 + Public LongNote As Boolean + Public Hidden As Boolean + Public Length As Double + Public Landmine As Boolean - Public LNPair As Integer - Public Selected As Boolean - Public HasError As Boolean + Public LNPair As Integer + Public Selected As Boolean + Public HasError As Boolean - 'Public TempBoolean As Boolean - Public TempSelected As Boolean - Public TempMouseDown As Boolean - Public TempIndex As Integer + 'Public TempBoolean As Boolean + Public TempSelected As Boolean + Public TempMouseDown As Boolean + Public TempIndex As Integer - Public Function equalsBMSE(note As Note) As Boolean - Return VPosition = note.VPosition And - ColumnIndex = note.ColumnIndex And - Value = note.Value And - LongNote = note.LongNote And - Hidden = note.Hidden And - Landmine = note.Landmine - End Function - Public Function equalsNT(note As Note) As Boolean - Return VPosition = note.VPosition And - ColumnIndex = note.ColumnIndex And - Value = note.Value And - Hidden = note.Hidden And - Length = note.Length And - Landmine = note.Landmine - End Function + Public Function equalsBMSE(note As Note) As Boolean + Return VPosition = note.VPosition And + ColumnIndex = note.ColumnIndex And + Value = note.Value And + LongNote = note.LongNote And + Hidden = note.Hidden And + Landmine = note.Landmine + End Function + Public Function equalsNT(note As Note) As Boolean + Return VPosition = note.VPosition And + ColumnIndex = note.ColumnIndex And + Value = note.Value And + Hidden = note.Hidden And + Length = note.Length And + Landmine = note.Landmine + End Function - Public Sub New(nColumnIndex As Integer, - nVposition As Double, - nValue As Long, - Optional nLongNote As Double = 0, - Optional nHidden As Boolean = False, - Optional nSelected As Boolean = False, - Optional nLandmine As Boolean = False) - VPosition = nVposition - ColumnIndex = nColumnIndex - Value = nValue - LongNote = nLongNote - Length = nLongNote - Hidden = nHidden - Landmine = nLandmine - End Sub + Public Sub New(nColumnIndex As Integer, + nVposition As Double, + nValue As Long, + Optional nLongNote As Double = 0, + Optional nHidden As Boolean = False, + Optional nSelected As Boolean = False, + Optional nLandmine As Boolean = False) + VPosition = nVposition + ColumnIndex = nColumnIndex + Value = nValue + LongNote = nLongNote + Length = nLongNote + Hidden = nHidden + Landmine = nLandmine + End Sub - Friend Function ToBytes() As Byte() - Dim MS As New MemoryStream() - Dim bw As New BinaryWriter(MS) - WriteBinWriter(bw) + Friend Function ToBytes() As Byte() + Dim MS As New MemoryStream() + Dim bw As New BinaryWriter(MS) + WriteBinWriter(bw) - Return MS.GetBuffer() - End Function + Return MS.GetBuffer() + End Function - Friend Sub WriteBinWriter(bw As BinaryWriter) - bw.Write(VPosition) - bw.Write(ColumnIndex) - bw.Write(Value) - bw.Write(LongNote) - bw.Write(Length) - bw.Write(Hidden) - bw.Write(Landmine) - End Sub + Friend Sub WriteBinWriter(bw As BinaryWriter) + bw.Write(VPosition) + bw.Write(ColumnIndex) + bw.Write(Value) + bw.Write(LongNote) + bw.Write(Length) + bw.Write(Hidden) + bw.Write(Landmine) + End Sub - Friend Sub FromBinReader(br As BinaryReader) - VPosition = br.ReadDouble() - ColumnIndex = br.ReadInt32() - Value = br.ReadInt64() - LongNote = br.ReadBoolean() - Length = br.ReadDouble() - Hidden = br.ReadBoolean() - Landmine = br.ReadBoolean() - End Sub + Friend Sub FromBinReader(br As BinaryReader) + VPosition = br.ReadDouble() + ColumnIndex = br.ReadInt32() + Value = br.ReadInt64() + LongNote = br.ReadBoolean() + Length = br.ReadDouble() + Hidden = br.ReadBoolean() + Landmine = br.ReadBoolean() + End Sub - Sub FromBytes(bytes() As Byte) - Using br As New BinaryReader(New MemoryStream(bytes)) - FromBinReader(br) - End Using - End Sub - End Structure + Sub FromBytes(bytes() As Byte) + Using br As New BinaryReader(New MemoryStream(bytes)) + FromBinReader(br) + End Using + End Sub + End Structure End Namespace diff --git a/iBMSC/Option Windows/OpGeneral.vb b/iBMSC/Option Windows/OpGeneral.vb index aeab7a05a..303200412 100644 --- a/iBMSC/Option Windows/OpGeneral.vb +++ b/iBMSC/Option Windows/OpGeneral.vb @@ -1,360 +1,360 @@ Public Class OpGeneral - Public zWheel As Integer - Public zPgUpDn As Integer - Public zEncoding As System.Text.Encoding - Public zMiddle As Integer - 'Public zSort As Integer - Public zAutoSave As Integer - Public zGridPartition As Integer - - 'Dim lpfa() As String - - _ - Public Shared Sub SHChangeNotify(wEventId As Integer, uFlags As Integer, dwItem1 As Integer, dwItem2 As Integer) - End Sub - - Private Sub OK_Button_Click(sender As Object, e As EventArgs) Handles OK_Button.Click - - Select Case CWheel.SelectedIndex - Case 0 : zWheel = 192 - Case 1 : zWheel = 96 - Case 2 : zWheel = 64 - Case 3 : zWheel = 48 - End Select - Select Case CPgUpDn.SelectedIndex - Case 0 : zPgUpDn = 1536 - Case 1 : zPgUpDn = 1152 - Case 2 : zPgUpDn = 768 - Case 3 : zPgUpDn = 576 - Case 4 : zPgUpDn = 384 - Case 5 : zPgUpDn = 192 - Case 6 : zPgUpDn = 96 - End Select - Select Case CTextEncoding.SelectedIndex - Case 0 : zEncoding = System.Text.Encoding.Default - Case 1 : zEncoding = System.Text.Encoding.Unicode - Case 2 : zEncoding = System.Text.Encoding.ASCII - Case 3 : zEncoding = System.Text.Encoding.BigEndianUnicode - Case 4 : zEncoding = System.Text.Encoding.UTF32 - 'Case 5 : zEncoding = System.Text.Encoding.UTF7 - Case 6 : zEncoding = System.Text.Encoding.UTF8 - Case 7 : zEncoding = System.Text.Encoding.GetEncoding(932) - Case 8 : zEncoding = System.Text.Encoding.GetEncoding(51949) - End Select - 'zSort = CSortingMethod.SelectedIndex - zMiddle = IIf(rMiddleDrag.Checked, 1, 0) - zAutoSave = IIf(cAutoSave.Checked, 1, 0) * NAutoSave.Value * 60000 - zGridPartition = nGridPartition.Value - DialogResult = DialogResult.OK - Close() - End Sub - - Private Sub Cancel_Button_Click(sender As Object, e As EventArgs) Handles Cancel_Button.Click - DialogResult = DialogResult.Cancel - Close() - End Sub - - Public Sub New(xMsWheel As Integer, xPgUpDn As Integer, xMiddleButton As Integer, xTextEncoding As Integer, xGridPartition As Integer, _ - xAutoSave As Integer, xBeep As Boolean, xBPMx As Boolean, xSTOPx As Boolean, _ - xMFEnter As Boolean, xMFClick As Boolean, xMStopPreview As Boolean) - InitializeComponent() - - On Error Resume Next - Select Case xMsWheel - Case 192 : CWheel.SelectedIndex = 0 - Case 96 : CWheel.SelectedIndex = 1 - Case 64 : CWheel.SelectedIndex = 2 - Case 48 : CWheel.SelectedIndex = 3 - End Select - - Select Case xPgUpDn - Case 1536 : CPgUpDn.SelectedIndex = 0 - Case 1152 : CPgUpDn.SelectedIndex = 1 - Case 768 : CPgUpDn.SelectedIndex = 2 - Case 576 : CPgUpDn.SelectedIndex = 3 - Case 384 : CPgUpDn.SelectedIndex = 4 - Case 192 : CPgUpDn.SelectedIndex = 5 - Case 96 : CPgUpDn.SelectedIndex = 6 - End Select - - CTextEncoding.SelectedIndex = xTextEncoding - 'CSortingMethod.SelectedIndex = xSort - nGridPartition.Value = xGridPartition - - If xMiddleButton = 0 Then rMiddleAuto.Checked = True _ - Else rMiddleDrag.Checked = True - - If xAutoSave / 60000 > NAutoSave.Maximum Or xAutoSave / 60000 < NAutoSave.Minimum Then - cAutoSave.Checked = False - Else - NAutoSave.Value = xAutoSave / 60000 - End If - - cBeep.Checked = xBeep - cBpm1296.Checked = xBPMx - cStop1296.Checked = xSTOPx - cMEnterFocus.Checked = xMFEnter - cMClickFocus.Checked = xMFClick - cMStopPreview.Checked = xMStopPreview - End Sub - - Private Sub OpGeneral_Load(sender As Object, e As EventArgs) Handles MyBase.Load - Font = MainWindow.Font - - 'lpfa = Form1.lpfa - 'Dim xL() As String = Form1.lpgo - Text = Strings.fopGeneral.Title - Label1.Text = Strings.fopGeneral.MouseWheel - Label2.Text = Strings.fopGeneral.TextEncoding - 'Label3.Text = Locale.fopGeneral.SortingMethod - Label5.Text = Strings.fopGeneral.PageUpDown - Label3.Text = Strings.fopGeneral.MiddleButton - Label4.Text = Strings.fopGeneral.AssociateFileType - 'CSortingMethod.Items.Item(0) = Locale.fopGeneral.sortBubble - 'CSortingMethod.Items.Item(1) = Locale.fopGeneral.sortInsertion - 'CSortingMethod.Items.Item(2) = Locale.fopGeneral.sortQuick - 'CSortingMethod.Items.Item(3) = Locale.fopGeneral.sortQuickD3 - 'CSortingMethod.Items.Item(4) = Locale.fopGeneral.sortHeap - rMiddleAuto.Text = Strings.fopGeneral.MiddleButtonAuto - rMiddleDrag.Text = Strings.fopGeneral.MiddleButtonDrag - Label6.Text = Strings.fopGeneral.MaxGridPartition - - cBeep.Text = Strings.fopGeneral.BeepWhileSaved - cBpm1296.Text = Strings.fopGeneral.ExtendBPM - cStop1296.Text = Strings.fopGeneral.ExtendSTOP - cMEnterFocus.Text = Strings.fopGeneral.AutoFocusOnMouseEnter - cMClickFocus.Text = Strings.fopGeneral.DisableFirstClick - cAutoSave.Text = Strings.fopGeneral.AutoSave - Label7.Text = Strings.fopGeneral.minutes - cMStopPreview.Text = Strings.fopGeneral.StopPreviewOnClick - - Dim enc = System.Text.Encoding.Default - CTextEncoding.Items(0) = "System ANSI (" & enc.EncodingName & ")" - - OK_Button.Text = Strings.OK - Cancel_Button.Text = Strings.Cancel - End Sub - - Private Sub TBAssociate_Click(sender As Object, e As EventArgs) Handles TBAssociate.Click - Associate(".bms", "iBMSC.BMS", Strings.FileAssociation.BMS, False) - End Sub - - Private Sub TBAssociateIBMSC_Click(sender As Object, e As EventArgs) Handles TBAssociateIBMSC.Click - Associate(".ibmsc", "iBMSC.iBMSC", Strings.FileAssociation.IBMSC, True) - End Sub - - Private Sub TBAssociateBME_Click(sender As Object, e As EventArgs) Handles TBAssociateBME.Click - Associate(".bme", "iBMSC.BME", Strings.FileAssociation.BME, False) - End Sub - - Private Sub TBAssociateBML_Click(sender As Object, e As EventArgs) Handles TBAssociateBML.Click - Associate(".bml", "iBMSC.BML", Strings.FileAssociation.BML, False) - End Sub - - Private Sub TBAssociatePMS_Click(sender As Object, e As EventArgs) Handles TBAssociatePMS.Click - Associate(".pms", "iBMSC.PMS", Strings.FileAssociation.PMS, False) - End Sub - - Private Sub Associate(xExt As String, xClass As String, xDescription As String, isIBMSC As Boolean) - If MsgBox(Replace(Strings.Messages.FileAssociationPrompt, "{}", "*" & xExt), MsgBoxStyle.YesNo Or MsgBoxStyle.Question) <> MsgBoxResult.Yes Then Exit Sub - - Dim xReg As Microsoft.Win32.RegistryKey - - Try - With Microsoft.Win32.Registry.ClassesRoot - If Array.IndexOf(.GetSubKeyNames(), xExt) <> -1 Then .DeleteSubKeyTree(xExt) - Dim unused9 = .CreateSubKey(xExt) - xReg = .OpenSubKey(xExt, True) - xReg.SetValue(String.Empty, xClass, Microsoft.Win32.RegistryValueKind.String) - - If Array.IndexOf(.GetSubKeyNames(), xClass) <> -1 Then .DeleteSubKeyTree(xClass) - Dim unused8 = .CreateSubKey(xClass) - xReg = .OpenSubKey(xClass, True) - xReg.SetValue(String.Empty, xDescription, Microsoft.Win32.RegistryValueKind.String) - - 'Default Icon - Dim unused7 = xReg.CreateSubKey("DefaultIcon") - xReg = .OpenSubKey(xClass & "\DefaultIcon", True) - xReg.SetValue(String.Empty, My.Application.Info.DirectoryPath & "\TypeBMS.ico", Microsoft.Win32.RegistryValueKind.String) - - xReg = .OpenSubKey(xClass, True) - Dim unused6 = xReg.CreateSubKey("shell") - xReg = .OpenSubKey(xClass & "\shell", True) - xReg.SetValue(String.Empty, "open") - - xReg = .OpenSubKey(xClass & "\shell", True) - Dim unused5 = xReg.CreateSubKey("open\command") - xReg = .OpenSubKey(xClass & "\shell\open", True) - xReg.SetValue(String.Empty, Strings.FileAssociation.Open) - xReg = .OpenSubKey(xClass & "\shell\open\command", True) - xReg.SetValue(String.Empty, """" & Application.ExecutablePath & """ ""%1""") - - If Not isIBMSC Then - xReg = .OpenSubKey(xClass & "\shell", True) - Dim unused4 = xReg.CreateSubKey("preview\command") - xReg = .OpenSubKey(xClass & "\shell\preview", True) - xReg.SetValue(String.Empty, Strings.FileAssociation.Preview) - xReg = .OpenSubKey(xClass & "\shell\preview\command", True) - xReg.SetValue(String.Empty, """" & My.Application.Info.DirectoryPath & "\uBMplay.exe" & """ ""%1""") - - xReg = .OpenSubKey(xClass & "\shell", True) - Dim unused3 = xReg.CreateSubKey("viewcode\command") - xReg = .OpenSubKey(xClass & "\shell\viewcode", True) - xReg.SetValue(String.Empty, Strings.FileAssociation.ViewCode) - xReg = .OpenSubKey(xClass & "\shell\viewcode\command", True) - xReg.SetValue(String.Empty, Environment.SystemDirectory & "\notepad.exe %1") - End If - End With - - With Microsoft.Win32.Registry.CurrentUser - Dim unused2 = .CreateSubKey("Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\" & xExt) - - xReg = .OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\" & xExt, True) - 'xReg.DeleteSubKey("UserChoice") - Dim unused1 = xReg.CreateSubKey("UserChoice") - xReg = .OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\" & xExt & "\UserChoice", True) - xReg.SetValue("Progid", xClass) - End With - - Catch ex As Exception - Dim unused = MsgBox(Strings.Messages.FileAssociationError & vbCrLf & vbCrLf & ex.Message, MsgBoxStyle.Exclamation, Strings.Messages.Err) - End Try - - SHChangeNotify(&H8000000, 0, 0, 0) - Beep() - End Sub - - ' Private Sub TBAssociateE_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TBAssociatePMS.Click - ' If MsgBox(Replace(Locale.Messages.FileAssociationPrompt, "{}", "*.bme, *.bml"), MsgBoxStyle.YesNo + MsgBoxStyle.Question) <> MsgBoxResult.Yes Then Exit Sub - ' - ' Dim xReg As Microsoft.Win32.RegistryKey - ' On Error GoTo Jump1 - ' - ' Dim xExt As String = ".bme" - ' Dim xCtg As String = "iBMSC.BME" - ' - 'Jump2: - ' - ' With Microsoft.Win32.Registry.ClassesRoot - ' If Array.IndexOf(.GetSubKeyNames(), xExt) <> -1 Then .DeleteSubKeyTree(xExt) - ' .CreateSubKey(xExt) - ' xReg = .OpenSubKey(xExt, True) - ' xReg.SetValue("", xCtg, Microsoft.Win32.RegistryValueKind.String) - ' - ' If Array.IndexOf(.GetSubKeyNames(), xCtg) <> -1 Then .DeleteSubKeyTree(xCtg) - ' .CreateSubKey(xCtg) - ' xReg = .OpenSubKey(xCtg, True) - ' xReg.SetValue("", lpfa(0), Microsoft.Win32.RegistryValueKind.String) - ' - ' xReg.CreateSubKey("DefaultIcon") - ' xReg = .OpenSubKey(xCtg & "\DefaultIcon", True) - ' 'xReg.SetValue("", My.Application.Info.DirectoryPath & "\TypeBMS.ico", Microsoft.Win32.RegistryValueKind.String) - ' - ' xReg = .OpenSubKey(xCtg, True) - ' xReg.CreateSubKey("shell") - ' xReg = .OpenSubKey(xCtg & "\shell", True) - ' xReg.SetValue("", "open") - ' - ' xReg.CreateSubKey("open\command") - ' xReg.CreateSubKey("preview\command") - ' xReg.CreateSubKey("viewcode\command") - ' - ' xReg = .OpenSubKey(xCtg & "\shell\open", True) - ' xReg.SetValue("", lpfa(1)) - ' xReg = .OpenSubKey(xCtg & "\shell\preview", True) - ' xReg.SetValue("", lpfa(2)) - ' xReg = .OpenSubKey(xCtg & "\shell\viewcode", True) - ' xReg.SetValue("", lpfa(3)) - ' - ' xReg = .OpenSubKey(xCtg & "\shell\open\command", True) - ' xReg.SetValue("", """" & Application.ExecutablePath & """ ""%1""") - ' xReg = .OpenSubKey(xCtg & "\shell\preview\command", True) - ' xReg.SetValue("", """" & My.Application.Info.DirectoryPath & "\uBMplay.exe" & """ ""%1""") - ' xReg = .OpenSubKey(xCtg & "\shell\viewcode\command", True) - ' xReg.SetValue("", Environment.SystemDirectory & "\notepad.exe %1") - ' End With - ' - ' With Microsoft.Win32.Registry.CurrentUser - ' .CreateSubKey("Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\" & xExt) - ' - ' xReg = .OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\" & xExt, True) - ' xReg.CreateSubKey("UserChoice") - ' xReg = .OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\" & xExt & "\UserChoice", True) - ' xReg.SetValue("Progid", xCtg) - ' End With - ' - ' If xExt <> ".bml" Or xCtg <> "iBMSC.BML" Then - ' xExt = ".bml" - ' xCtg = "iBMSC.BML" - ' GoTo Jump2 - ' End If - ' - 'Jump1: - ' Beep() - ' End Sub - - ' Private Sub TBAssociateIBMSC_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TBAssociateIBMSC.Click - ' If MsgBox(Replace(Locale.Messages.FileAssociationPrompt, "{}", "*.ibmsc"), MsgBoxStyle.YesNo + MsgBoxStyle.Question) <> MsgBoxResult.Yes Then Exit Sub - ' - ' Dim xReg As Microsoft.Win32.RegistryKey - ' On Error GoTo Jump1 - ' - ' Dim xExt As String = ".ibmsc" - ' Dim xCtg As String = "iBMSC.iBMSC" - ' - ' With Microsoft.Win32.Registry.ClassesRoot - ' If Array.IndexOf(.GetSubKeyNames(), xExt) <> -1 Then .DeleteSubKeyTree(xExt) - ' .CreateSubKey(xExt) - ' xReg = .OpenSubKey(xExt, True) - ' xReg.SetValue("", xCtg, Microsoft.Win32.RegistryValueKind.String) - ' - ' If Array.IndexOf(.GetSubKeyNames(), xCtg) <> -1 Then .DeleteSubKeyTree(xCtg) - ' .CreateSubKey(xCtg) - ' xReg = .OpenSubKey(xCtg, True) - ' xReg.SetValue("", lpfa(0), Microsoft.Win32.RegistryValueKind.String) - ' - ' xReg.CreateSubKey("DefaultIcon") - ' xReg = .OpenSubKey(xCtg & "\DefaultIcon", True) - ' 'xReg.SetValue("", My.Application.Info.DirectoryPath & "\TypeBMS.ico", Microsoft.Win32.RegistryValueKind.String) - ' - ' xReg = .OpenSubKey(xCtg, True) - ' xReg.CreateSubKey("shell") - ' xReg = .OpenSubKey(xCtg & "\shell", True) - ' xReg.SetValue("", "open") - ' - ' xReg.CreateSubKey("open\command") - ' 'xReg.CreateSubKey("preview\command") - ' xReg.CreateSubKey("viewcode\command") - ' - ' xReg = .OpenSubKey(xCtg & "\shell\open", True) - ' xReg.SetValue("", lpfa(1)) - ' 'xReg = .OpenSubKey(xCtg & "\shell\preview", True) - ' 'xReg.SetValue("", lpfa(2)) - ' xReg = .OpenSubKey(xCtg & "\shell\viewcode", True) - ' xReg.SetValue("", lpfa(3)) - ' - ' xReg = .OpenSubKey(xCtg & "\shell\open\command", True) - ' xReg.SetValue("", """" & Application.ExecutablePath & """ ""%1""") - ' 'xReg = .OpenSubKey(xCtg & "\shell\preview\command", True) - ' 'xReg.SetValue("", """" & My.Application.Info.DirectoryPath & "\uBMplay.exe" & """ ""%1""") - ' xReg = .OpenSubKey(xCtg & "\shell\viewcode\command", True) - ' xReg.SetValue("", Environment.SystemDirectory & "\notepad.exe %1") - ' End With - ' - ' With Microsoft.Win32.Registry.CurrentUser - ' .CreateSubKey("Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\" & xExt) - ' - ' xReg = .OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\" & xExt, True) - ' xReg.CreateSubKey("UserChoice") - ' xReg = .OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\" & xExt & "\UserChoice", True) - ' xReg.SetValue("Progid", xCtg) - ' End With - ' - 'Jump1: - ' Beep() - ' End Sub - - Private Sub cAutoSave_CheckedChanged(sender As Object, e As EventArgs) Handles cAutoSave.CheckedChanged - NAutoSave.Enabled = cAutoSave.Checked - End Sub + Public zWheel As Integer + Public zPgUpDn As Integer + Public zEncoding As System.Text.Encoding + Public zMiddle As Integer + 'Public zSort As Integer + Public zAutoSave As Integer + Public zGridPartition As Integer + + 'Dim lpfa() As String + + _ + Public Shared Sub SHChangeNotify(wEventId As Integer, uFlags As Integer, dwItem1 As Integer, dwItem2 As Integer) + End Sub + + Private Sub OK_Button_Click(sender As Object, e As EventArgs) Handles OK_Button.Click + + Select Case CWheel.SelectedIndex + Case 0 : zWheel = 192 + Case 1 : zWheel = 96 + Case 2 : zWheel = 64 + Case 3 : zWheel = 48 + End Select + Select Case CPgUpDn.SelectedIndex + Case 0 : zPgUpDn = 1536 + Case 1 : zPgUpDn = 1152 + Case 2 : zPgUpDn = 768 + Case 3 : zPgUpDn = 576 + Case 4 : zPgUpDn = 384 + Case 5 : zPgUpDn = 192 + Case 6 : zPgUpDn = 96 + End Select + Select Case CTextEncoding.SelectedIndex + Case 0 : zEncoding = System.Text.Encoding.Default + Case 1 : zEncoding = System.Text.Encoding.Unicode + Case 2 : zEncoding = System.Text.Encoding.ASCII + Case 3 : zEncoding = System.Text.Encoding.BigEndianUnicode + Case 4 : zEncoding = System.Text.Encoding.UTF32 + 'Case 5 : zEncoding = System.Text.Encoding.UTF7 + Case 6 : zEncoding = System.Text.Encoding.UTF8 + Case 7 : zEncoding = System.Text.Encoding.GetEncoding(932) + Case 8 : zEncoding = System.Text.Encoding.GetEncoding(51949) + End Select + 'zSort = CSortingMethod.SelectedIndex + zMiddle = IIf(rMiddleDrag.Checked, 1, 0) + zAutoSave = IIf(cAutoSave.Checked, 1, 0) * NAutoSave.Value * 60000 + zGridPartition = nGridPartition.Value + DialogResult = DialogResult.OK + Close() + End Sub + + Private Sub Cancel_Button_Click(sender As Object, e As EventArgs) Handles Cancel_Button.Click + DialogResult = DialogResult.Cancel + Close() + End Sub + + Public Sub New(xMsWheel As Integer, xPgUpDn As Integer, xMiddleButton As Integer, xTextEncoding As Integer, xGridPartition As Integer, _ + xAutoSave As Integer, xBeep As Boolean, xBPMx As Boolean, xSTOPx As Boolean, _ + xMFEnter As Boolean, xMFClick As Boolean, xMStopPreview As Boolean) + InitializeComponent() + + On Error Resume Next + Select Case xMsWheel + Case 192 : CWheel.SelectedIndex = 0 + Case 96 : CWheel.SelectedIndex = 1 + Case 64 : CWheel.SelectedIndex = 2 + Case 48 : CWheel.SelectedIndex = 3 + End Select + + Select Case xPgUpDn + Case 1536 : CPgUpDn.SelectedIndex = 0 + Case 1152 : CPgUpDn.SelectedIndex = 1 + Case 768 : CPgUpDn.SelectedIndex = 2 + Case 576 : CPgUpDn.SelectedIndex = 3 + Case 384 : CPgUpDn.SelectedIndex = 4 + Case 192 : CPgUpDn.SelectedIndex = 5 + Case 96 : CPgUpDn.SelectedIndex = 6 + End Select + + CTextEncoding.SelectedIndex = xTextEncoding + 'CSortingMethod.SelectedIndex = xSort + nGridPartition.Value = xGridPartition + + If xMiddleButton = 0 Then rMiddleAuto.Checked = True _ + Else rMiddleDrag.Checked = True + + If xAutoSave / 60000 > NAutoSave.Maximum Or xAutoSave / 60000 < NAutoSave.Minimum Then + cAutoSave.Checked = False + Else + NAutoSave.Value = xAutoSave / 60000 + End If + + cBeep.Checked = xBeep + cBpm1296.Checked = xBPMx + cStop1296.Checked = xSTOPx + cMEnterFocus.Checked = xMFEnter + cMClickFocus.Checked = xMFClick + cMStopPreview.Checked = xMStopPreview + End Sub + + Private Sub OpGeneral_Load(sender As Object, e As EventArgs) Handles MyBase.Load + Font = MainWindow.Font + + 'lpfa = Form1.lpfa + 'Dim xL() As String = Form1.lpgo + Text = Strings.fopGeneral.Title + Label1.Text = Strings.fopGeneral.MouseWheel + Label2.Text = Strings.fopGeneral.TextEncoding + 'Label3.Text = Locale.fopGeneral.SortingMethod + Label5.Text = Strings.fopGeneral.PageUpDown + Label3.Text = Strings.fopGeneral.MiddleButton + Label4.Text = Strings.fopGeneral.AssociateFileType + 'CSortingMethod.Items.Item(0) = Locale.fopGeneral.sortBubble + 'CSortingMethod.Items.Item(1) = Locale.fopGeneral.sortInsertion + 'CSortingMethod.Items.Item(2) = Locale.fopGeneral.sortQuick + 'CSortingMethod.Items.Item(3) = Locale.fopGeneral.sortQuickD3 + 'CSortingMethod.Items.Item(4) = Locale.fopGeneral.sortHeap + rMiddleAuto.Text = Strings.fopGeneral.MiddleButtonAuto + rMiddleDrag.Text = Strings.fopGeneral.MiddleButtonDrag + Label6.Text = Strings.fopGeneral.MaxGridPartition + + cBeep.Text = Strings.fopGeneral.BeepWhileSaved + cBpm1296.Text = Strings.fopGeneral.ExtendBPM + cStop1296.Text = Strings.fopGeneral.ExtendSTOP + cMEnterFocus.Text = Strings.fopGeneral.AutoFocusOnMouseEnter + cMClickFocus.Text = Strings.fopGeneral.DisableFirstClick + cAutoSave.Text = Strings.fopGeneral.AutoSave + Label7.Text = Strings.fopGeneral.minutes + cMStopPreview.Text = Strings.fopGeneral.StopPreviewOnClick + + Dim enc = System.Text.Encoding.Default + CTextEncoding.Items(0) = "System ANSI (" & enc.EncodingName & ")" + + OK_Button.Text = Strings.OK + Cancel_Button.Text = Strings.Cancel + End Sub + + Private Sub TBAssociate_Click(sender As Object, e As EventArgs) Handles TBAssociate.Click + Associate(".bms", "iBMSC.BMS", Strings.FileAssociation.BMS, False) + End Sub + + Private Sub TBAssociateIBMSC_Click(sender As Object, e As EventArgs) Handles TBAssociateIBMSC.Click + Associate(".ibmsc", "iBMSC.iBMSC", Strings.FileAssociation.IBMSC, True) + End Sub + + Private Sub TBAssociateBME_Click(sender As Object, e As EventArgs) Handles TBAssociateBME.Click + Associate(".bme", "iBMSC.BME", Strings.FileAssociation.BME, False) + End Sub + + Private Sub TBAssociateBML_Click(sender As Object, e As EventArgs) Handles TBAssociateBML.Click + Associate(".bml", "iBMSC.BML", Strings.FileAssociation.BML, False) + End Sub + + Private Sub TBAssociatePMS_Click(sender As Object, e As EventArgs) Handles TBAssociatePMS.Click + Associate(".pms", "iBMSC.PMS", Strings.FileAssociation.PMS, False) + End Sub + + Private Sub Associate(xExt As String, xClass As String, xDescription As String, isIBMSC As Boolean) + If MsgBox(Replace(Strings.Messages.FileAssociationPrompt, "{}", "*" & xExt), MsgBoxStyle.YesNo Or MsgBoxStyle.Question) <> MsgBoxResult.Yes Then Exit Sub + + Dim xReg As Microsoft.Win32.RegistryKey + + Try + With Microsoft.Win32.Registry.ClassesRoot + If Array.IndexOf(.GetSubKeyNames(), xExt) <> -1 Then .DeleteSubKeyTree(xExt) + Dim unused9 = .CreateSubKey(xExt) + xReg = .OpenSubKey(xExt, True) + xReg.SetValue(String.Empty, xClass, Microsoft.Win32.RegistryValueKind.String) + + If Array.IndexOf(.GetSubKeyNames(), xClass) <> -1 Then .DeleteSubKeyTree(xClass) + Dim unused8 = .CreateSubKey(xClass) + xReg = .OpenSubKey(xClass, True) + xReg.SetValue(String.Empty, xDescription, Microsoft.Win32.RegistryValueKind.String) + + 'Default Icon + Dim unused7 = xReg.CreateSubKey("DefaultIcon") + xReg = .OpenSubKey(xClass & "\DefaultIcon", True) + xReg.SetValue(String.Empty, My.Application.Info.DirectoryPath & "\TypeBMS.ico", Microsoft.Win32.RegistryValueKind.String) + + xReg = .OpenSubKey(xClass, True) + Dim unused6 = xReg.CreateSubKey("shell") + xReg = .OpenSubKey(xClass & "\shell", True) + xReg.SetValue(String.Empty, "open") + + xReg = .OpenSubKey(xClass & "\shell", True) + Dim unused5 = xReg.CreateSubKey("open\command") + xReg = .OpenSubKey(xClass & "\shell\open", True) + xReg.SetValue(String.Empty, Strings.FileAssociation.Open) + xReg = .OpenSubKey(xClass & "\shell\open\command", True) + xReg.SetValue(String.Empty, """" & Application.ExecutablePath & """ ""%1""") + + If Not isIBMSC Then + xReg = .OpenSubKey(xClass & "\shell", True) + Dim unused4 = xReg.CreateSubKey("preview\command") + xReg = .OpenSubKey(xClass & "\shell\preview", True) + xReg.SetValue(String.Empty, Strings.FileAssociation.Preview) + xReg = .OpenSubKey(xClass & "\shell\preview\command", True) + xReg.SetValue(String.Empty, """" & My.Application.Info.DirectoryPath & "\uBMplay.exe" & """ ""%1""") + + xReg = .OpenSubKey(xClass & "\shell", True) + Dim unused3 = xReg.CreateSubKey("viewcode\command") + xReg = .OpenSubKey(xClass & "\shell\viewcode", True) + xReg.SetValue(String.Empty, Strings.FileAssociation.ViewCode) + xReg = .OpenSubKey(xClass & "\shell\viewcode\command", True) + xReg.SetValue(String.Empty, Environment.SystemDirectory & "\notepad.exe %1") + End If + End With + + With Microsoft.Win32.Registry.CurrentUser + Dim unused2 = .CreateSubKey("Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\" & xExt) + + xReg = .OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\" & xExt, True) + 'xReg.DeleteSubKey("UserChoice") + Dim unused1 = xReg.CreateSubKey("UserChoice") + xReg = .OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\" & xExt & "\UserChoice", True) + xReg.SetValue("Progid", xClass) + End With + + Catch ex As Exception + Dim unused = MsgBox(Strings.Messages.FileAssociationError & vbCrLf & vbCrLf & ex.Message, MsgBoxStyle.Exclamation, Strings.Messages.Err) + End Try + + SHChangeNotify(&H8000000, 0, 0, 0) + Beep() + End Sub + + ' Private Sub TBAssociateE_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TBAssociatePMS.Click + ' If MsgBox(Replace(Locale.Messages.FileAssociationPrompt, "{}", "*.bme, *.bml"), MsgBoxStyle.YesNo + MsgBoxStyle.Question) <> MsgBoxResult.Yes Then Exit Sub + ' + ' Dim xReg As Microsoft.Win32.RegistryKey + ' On Error GoTo Jump1 + ' + ' Dim xExt As String = ".bme" + ' Dim xCtg As String = "iBMSC.BME" + ' + 'Jump2: + ' + ' With Microsoft.Win32.Registry.ClassesRoot + ' If Array.IndexOf(.GetSubKeyNames(), xExt) <> -1 Then .DeleteSubKeyTree(xExt) + ' .CreateSubKey(xExt) + ' xReg = .OpenSubKey(xExt, True) + ' xReg.SetValue("", xCtg, Microsoft.Win32.RegistryValueKind.String) + ' + ' If Array.IndexOf(.GetSubKeyNames(), xCtg) <> -1 Then .DeleteSubKeyTree(xCtg) + ' .CreateSubKey(xCtg) + ' xReg = .OpenSubKey(xCtg, True) + ' xReg.SetValue("", lpfa(0), Microsoft.Win32.RegistryValueKind.String) + ' + ' xReg.CreateSubKey("DefaultIcon") + ' xReg = .OpenSubKey(xCtg & "\DefaultIcon", True) + ' 'xReg.SetValue("", My.Application.Info.DirectoryPath & "\TypeBMS.ico", Microsoft.Win32.RegistryValueKind.String) + ' + ' xReg = .OpenSubKey(xCtg, True) + ' xReg.CreateSubKey("shell") + ' xReg = .OpenSubKey(xCtg & "\shell", True) + ' xReg.SetValue("", "open") + ' + ' xReg.CreateSubKey("open\command") + ' xReg.CreateSubKey("preview\command") + ' xReg.CreateSubKey("viewcode\command") + ' + ' xReg = .OpenSubKey(xCtg & "\shell\open", True) + ' xReg.SetValue("", lpfa(1)) + ' xReg = .OpenSubKey(xCtg & "\shell\preview", True) + ' xReg.SetValue("", lpfa(2)) + ' xReg = .OpenSubKey(xCtg & "\shell\viewcode", True) + ' xReg.SetValue("", lpfa(3)) + ' + ' xReg = .OpenSubKey(xCtg & "\shell\open\command", True) + ' xReg.SetValue("", """" & Application.ExecutablePath & """ ""%1""") + ' xReg = .OpenSubKey(xCtg & "\shell\preview\command", True) + ' xReg.SetValue("", """" & My.Application.Info.DirectoryPath & "\uBMplay.exe" & """ ""%1""") + ' xReg = .OpenSubKey(xCtg & "\shell\viewcode\command", True) + ' xReg.SetValue("", Environment.SystemDirectory & "\notepad.exe %1") + ' End With + ' + ' With Microsoft.Win32.Registry.CurrentUser + ' .CreateSubKey("Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\" & xExt) + ' + ' xReg = .OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\" & xExt, True) + ' xReg.CreateSubKey("UserChoice") + ' xReg = .OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\" & xExt & "\UserChoice", True) + ' xReg.SetValue("Progid", xCtg) + ' End With + ' + ' If xExt <> ".bml" Or xCtg <> "iBMSC.BML" Then + ' xExt = ".bml" + ' xCtg = "iBMSC.BML" + ' GoTo Jump2 + ' End If + ' + 'Jump1: + ' Beep() + ' End Sub + + ' Private Sub TBAssociateIBMSC_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TBAssociateIBMSC.Click + ' If MsgBox(Replace(Locale.Messages.FileAssociationPrompt, "{}", "*.ibmsc"), MsgBoxStyle.YesNo + MsgBoxStyle.Question) <> MsgBoxResult.Yes Then Exit Sub + ' + ' Dim xReg As Microsoft.Win32.RegistryKey + ' On Error GoTo Jump1 + ' + ' Dim xExt As String = ".ibmsc" + ' Dim xCtg As String = "iBMSC.iBMSC" + ' + ' With Microsoft.Win32.Registry.ClassesRoot + ' If Array.IndexOf(.GetSubKeyNames(), xExt) <> -1 Then .DeleteSubKeyTree(xExt) + ' .CreateSubKey(xExt) + ' xReg = .OpenSubKey(xExt, True) + ' xReg.SetValue("", xCtg, Microsoft.Win32.RegistryValueKind.String) + ' + ' If Array.IndexOf(.GetSubKeyNames(), xCtg) <> -1 Then .DeleteSubKeyTree(xCtg) + ' .CreateSubKey(xCtg) + ' xReg = .OpenSubKey(xCtg, True) + ' xReg.SetValue("", lpfa(0), Microsoft.Win32.RegistryValueKind.String) + ' + ' xReg.CreateSubKey("DefaultIcon") + ' xReg = .OpenSubKey(xCtg & "\DefaultIcon", True) + ' 'xReg.SetValue("", My.Application.Info.DirectoryPath & "\TypeBMS.ico", Microsoft.Win32.RegistryValueKind.String) + ' + ' xReg = .OpenSubKey(xCtg, True) + ' xReg.CreateSubKey("shell") + ' xReg = .OpenSubKey(xCtg & "\shell", True) + ' xReg.SetValue("", "open") + ' + ' xReg.CreateSubKey("open\command") + ' 'xReg.CreateSubKey("preview\command") + ' xReg.CreateSubKey("viewcode\command") + ' + ' xReg = .OpenSubKey(xCtg & "\shell\open", True) + ' xReg.SetValue("", lpfa(1)) + ' 'xReg = .OpenSubKey(xCtg & "\shell\preview", True) + ' 'xReg.SetValue("", lpfa(2)) + ' xReg = .OpenSubKey(xCtg & "\shell\viewcode", True) + ' xReg.SetValue("", lpfa(3)) + ' + ' xReg = .OpenSubKey(xCtg & "\shell\open\command", True) + ' xReg.SetValue("", """" & Application.ExecutablePath & """ ""%1""") + ' 'xReg = .OpenSubKey(xCtg & "\shell\preview\command", True) + ' 'xReg.SetValue("", """" & My.Application.Info.DirectoryPath & "\uBMplay.exe" & """ ""%1""") + ' xReg = .OpenSubKey(xCtg & "\shell\viewcode\command", True) + ' xReg.SetValue("", Environment.SystemDirectory & "\notepad.exe %1") + ' End With + ' + ' With Microsoft.Win32.Registry.CurrentUser + ' .CreateSubKey("Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\" & xExt) + ' + ' xReg = .OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\" & xExt, True) + ' xReg.CreateSubKey("UserChoice") + ' xReg = .OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\" & xExt & "\UserChoice", True) + ' xReg.SetValue("Progid", xCtg) + ' End With + ' + 'Jump1: + ' Beep() + ' End Sub + + Private Sub cAutoSave_CheckedChanged(sender As Object, e As EventArgs) Handles cAutoSave.CheckedChanged + NAutoSave.Enabled = cAutoSave.Checked + End Sub End Class diff --git a/iBMSC/Option Windows/OpPlayer.vb b/iBMSC/Option Windows/OpPlayer.vb index a663cb67f..fd795309b 100644 --- a/iBMSC/Option Windows/OpPlayer.vb +++ b/iBMSC/Option Windows/OpPlayer.vb @@ -1,204 +1,204 @@ Public Class OpPlayer - Private pArg() As MainWindow.PlayerArguments - 'Dim ImplicitChange As Boolean = False - Private CurrPlayer As Integer = -1 - - Private Sub OK_Button_Click(sender As Object, e As EventArgs) Handles OK_Button.Click - DialogResult = DialogResult.OK - Close() - - MainWindow.pArgs = pArg.Clone - MainWindow.CurrentPlayer = CurrPlayer - - Dispose() - End Sub - - Private Sub Cancel_Button_Click(sender As Object, e As EventArgs) Handles Cancel_Button.Click - DialogResult = DialogResult.Cancel - Close() - Dispose() - End Sub - - Private Sub OpPlayer_Load(sender As Object, e As EventArgs) Handles MyBase.Load - Font = MainWindow.Font - - Text = Strings.fopPlayer.Title - Label1.Text = Strings.fopPlayer.Path - Label2.Text = Strings.fopPlayer.PlayFromBeginning - Label3.Text = Strings.fopPlayer.PlayFromHere - Label4.Text = Strings.fopPlayer.StopPlaying - BAdd.Text = Strings.fopPlayer.Add - BRemove.Text = Strings.fopPlayer.Remove - Label6.Text = Strings.fopPlayer.References & vbCrLf & _ - " = " & Strings.fopPlayer.DirectoryOfApp & vbCrLf & _ - " = " & Strings.fopPlayer.CurrMeasure & vbCrLf & _ - " = " & Strings.fopPlayer.FileName - OK_Button.Text = Strings.OK - Cancel_Button.Text = Strings.Cancel - BDefault.Text = Strings.fopPlayer.RestoreDefault - End Sub - - Private Sub LPlayer_Click(sender As Object, e As EventArgs) Handles LPlayer.Click - If pArg Is Nothing OrElse pArg.Length = 0 Then Exit Sub - - CurrPlayer = LPlayer.SelectedIndex - ShowInTextbox() - End Sub - - Private Sub LPlayer_KeyDown(sender As Object, e As KeyEventArgs) Handles LPlayer.KeyDown - LPlayer_Click(sender, New EventArgs) - End Sub - - Private Sub BPrevAdd_Click(sender As Object, e As EventArgs) Handles BAdd.Click - ReDim Preserve pArg(UBound(pArg) + 1) - CurrPlayer += 1 - For xI1 As Integer = UBound(pArg) To CurrPlayer Step -1 - pArg(xI1) = pArg(xI1 - 1) - Next - - LPlayer.Items.Insert(CurrPlayer, _ - GetFileName(pArg(CurrPlayer - 1).Path)) - LPlayer.SelectedIndex += 1 - End Sub - - Private Sub BPrevDelete_Click(sender As Object, e As EventArgs) Handles BRemove.Click - If LPlayer.Items.Count = 1 Then - Dim unused = MsgBox(Strings.Messages.PreviewDelError, MsgBoxStyle.Exclamation) - Exit Sub - End If - - For xI1 As Integer = CurrPlayer To UBound(pArg) - 1 - pArg(xI1) = pArg(xI1 + 1) - Next - ReDim Preserve pArg(UBound(pArg) - 1) - - 'RemoveHandler LPlayer.SelectedIndexChanged, AddressOf LPlayer_SelectedIndexChanged - LPlayer.Items.RemoveAt(CurrPlayer) - 'AddHandler LPlayer.SelectedIndexChanged, AddressOf LPlayer_SelectedIndexChanged - - LPlayer.SelectedIndex = IIf(CurrPlayer > UBound(pArg), CurrPlayer - 1, CurrPlayer) - CurrPlayer = Math.Min(CurrPlayer, UBound(pArg)) - ShowInTextbox() - End Sub - - Private Sub BPrevBrowse_Click(sender As Object, e As EventArgs) Handles BBrowse.Click - Dim xDOpen As New OpenFileDialog With { - .InitialDirectory = IIf(Path.GetDirectoryName(Replace(TPath.Text, "", My.Application.Info.DirectoryPath)) = String.Empty, _ - My.Application.Info.DirectoryPath, _ - Path.GetDirectoryName(Replace(TPath.Text, "", My.Application.Info.DirectoryPath))), - .Filter = Strings.FileType.EXE & "|*.exe", - .DefaultExt = "exe" - } - If xDOpen.ShowDialog = Forms.DialogResult.Cancel Then Exit Sub - TPath.Text = Replace(xDOpen.FileName, My.Application.Info.DirectoryPath, "") - End Sub - - Private Sub BPrevDefault_Click(sender As Object, e As EventArgs) Handles BDefault.Click - 'ImplicitChange = True - If MsgBox(Strings.Messages.RestoreDefaultSettings, MsgBoxStyle.Question + MsgBoxStyle.YesNo) = MsgBoxResult.No Then Exit Sub - - pArg = New MainWindow.PlayerArguments() {New MainWindow.PlayerArguments("\uBMplay.exe", _ - "-P -N0 """"", _ - "-P -N """"", _ - "-S"), _ - New MainWindow.PlayerArguments("\o2play.exe", _ - "-P -N0 """"", _ - "-P -N """"", _ - "-S")} - CurrPlayer = 0 - ResetLPlayer_ShowInTextbox() - 'ImplicitChange = False - End Sub - - 'Affect LPlayer and all textboxes - Private Sub ResetLPlayer_ShowInTextbox() - LPlayer.Items.Clear() - For xI1 As Integer = 0 To UBound(pArg) - Dim unused = LPlayer.Items.Add(GetFileName(pArg(xI1).Path)) - Next - 'RemoveHandler LPlayer.SelectedIndexChanged, AddressOf LPlayer_SelectedIndexChanged - LPlayer.SelectedIndex = CurrPlayer - 'AddHandler LPlayer.SelectedIndexChanged, AddressOf LPlayer_SelectedIndexChanged - ShowInTextbox() - 'ImplicitChange = False - End Sub - - 'affect current LPlayer index value - Private Sub LPlayerChangeCurrIndex(xStr As String) - 'RemoveHandler LPlayer.SelectedIndexChanged, AddressOf LPlayer_SelectedIndexChanged - LPlayer.Items.Item(CurrPlayer) = GetFileName(xStr) - 'AddHandler LPlayer.SelectedIndexChanged, AddressOf LPlayer_SelectedIndexChanged - End Sub - - 'Affect pArgs - Private Sub SavePArg() - pArg(CurrPlayer).Path = TPath.Text - pArg(CurrPlayer).aBegin = TPlayB.Text - pArg(CurrPlayer).aHere = TPlay.Text - pArg(CurrPlayer).aStop = TStop.Text - 'pArg(CurrPlayer) = TPath.Text & vbCrLf & _ - ' TPlayB.Text & vbCrLf & _ - ' TPlay.Text & vbCrLf & _ - ' TStop.Text - End Sub - - 'affect all textboxes - Private Sub ShowInTextbox() - 'ImplicitChange = True - 'Dim xStr() As String = Split(pArg(CurrPlayer), vbCrLf) - 'If xStr.Length <> 4 Then ReDim Preserve xStr(3) - TPath.Text = pArg(CurrPlayer).Path - TPlayB.Text = pArg(CurrPlayer).aBegin - TPlay.Text = pArg(CurrPlayer).aHere - TStop.Text = pArg(CurrPlayer).aStop - ValidateTextBox() - 'ImplicitChange = False - End Sub - - Private Sub ValidateTextBox() - For Each xT As TextBox In New TextBox() {TPath, TPlayB, TPlay, TStop} - Dim xText As String = xT.Text.Replace("", String.Empty).Replace("", String.Empty).Replace("", String.Empty).Replace("""", String.Empty) - Dim xContainsInvalidChar As Boolean = False - - For Each xC As Char In Path.GetInvalidPathChars - If xText.IndexOf(xC) <> -1 Then - xContainsInvalidChar = True - Exit For - End If - Next - - xT.BackColor = If(xContainsInvalidChar, Color.FromArgb(&HFFFFC0C0), Nothing) - Next - End Sub - - Public Sub New(xCurrPlayer As Integer) - InitializeComponent() - - pArg = MainWindow.pArgs.Clone - CurrPlayer = xCurrPlayer - ResetLPlayer_ShowInTextbox() - End Sub - - Private Sub TPath_KeyDown(sender As Object, e As KeyEventArgs) Handles TPath.KeyUp, TPlay.KeyUp, TPlayB.KeyUp, TStop.KeyUp - SavePArg() - If ReferenceEquals(sender, TPath) Then _ - LPlayerChangeCurrIndex(pArg(CurrPlayer).Path) - End Sub - - Private Sub TPath_LostFocus(sender As Object, e As EventArgs) Handles TPath.LostFocus, TPlay.LostFocus, TPlayB.LostFocus, TStop.LostFocus - SavePArg() - If ReferenceEquals(sender, TPath) Then _ - LPlayerChangeCurrIndex(pArg(CurrPlayer).Path) - ValidateTextBox() - End Sub - - 'Private Function pArgPath(ByVal I As Integer) - ' Return Mid(pArg(I), 1, InStr(pArg(I), vbCrLf) - 1) - 'End Function - - Private Function GetFileName(s As String) As String - Dim fslash As Integer = InStrRev(s, "/") - Dim bslash As Integer = InStrRev(s, "\") - Return Mid(s, IIf(fslash > bslash, fslash, bslash) + 1) - End Function + Private pArg() As MainWindow.PlayerArguments + 'Dim ImplicitChange As Boolean = False + Private CurrPlayer As Integer = -1 + + Private Sub OK_Button_Click(sender As Object, e As EventArgs) Handles OK_Button.Click + DialogResult = DialogResult.OK + Close() + + MainWindow.pArgs = pArg.Clone + MainWindow.CurrentPlayer = CurrPlayer + + Dispose() + End Sub + + Private Sub Cancel_Button_Click(sender As Object, e As EventArgs) Handles Cancel_Button.Click + DialogResult = DialogResult.Cancel + Close() + Dispose() + End Sub + + Private Sub OpPlayer_Load(sender As Object, e As EventArgs) Handles MyBase.Load + Font = MainWindow.Font + + Text = Strings.fopPlayer.Title + Label1.Text = Strings.fopPlayer.Path + Label2.Text = Strings.fopPlayer.PlayFromBeginning + Label3.Text = Strings.fopPlayer.PlayFromHere + Label4.Text = Strings.fopPlayer.StopPlaying + BAdd.Text = Strings.fopPlayer.Add + BRemove.Text = Strings.fopPlayer.Remove + Label6.Text = Strings.fopPlayer.References & vbCrLf & _ + " = " & Strings.fopPlayer.DirectoryOfApp & vbCrLf & _ + " = " & Strings.fopPlayer.CurrMeasure & vbCrLf & _ + " = " & Strings.fopPlayer.FileName + OK_Button.Text = Strings.OK + Cancel_Button.Text = Strings.Cancel + BDefault.Text = Strings.fopPlayer.RestoreDefault + End Sub + + Private Sub LPlayer_Click(sender As Object, e As EventArgs) Handles LPlayer.Click + If pArg Is Nothing OrElse pArg.Length = 0 Then Exit Sub + + CurrPlayer = LPlayer.SelectedIndex + ShowInTextbox() + End Sub + + Private Sub LPlayer_KeyDown(sender As Object, e As KeyEventArgs) Handles LPlayer.KeyDown + LPlayer_Click(sender, New EventArgs) + End Sub + + Private Sub BPrevAdd_Click(sender As Object, e As EventArgs) Handles BAdd.Click + ReDim Preserve pArg(UBound(pArg) + 1) + CurrPlayer += 1 + For xI1 As Integer = UBound(pArg) To CurrPlayer Step -1 + pArg(xI1) = pArg(xI1 - 1) + Next + + LPlayer.Items.Insert(CurrPlayer, _ + GetFileName(pArg(CurrPlayer - 1).Path)) + LPlayer.SelectedIndex += 1 + End Sub + + Private Sub BPrevDelete_Click(sender As Object, e As EventArgs) Handles BRemove.Click + If LPlayer.Items.Count = 1 Then + Dim unused = MsgBox(Strings.Messages.PreviewDelError, MsgBoxStyle.Exclamation) + Exit Sub + End If + + For xI1 As Integer = CurrPlayer To UBound(pArg) - 1 + pArg(xI1) = pArg(xI1 + 1) + Next + ReDim Preserve pArg(UBound(pArg) - 1) + + 'RemoveHandler LPlayer.SelectedIndexChanged, AddressOf LPlayer_SelectedIndexChanged + LPlayer.Items.RemoveAt(CurrPlayer) + 'AddHandler LPlayer.SelectedIndexChanged, AddressOf LPlayer_SelectedIndexChanged + + LPlayer.SelectedIndex = IIf(CurrPlayer > UBound(pArg), CurrPlayer - 1, CurrPlayer) + CurrPlayer = Math.Min(CurrPlayer, UBound(pArg)) + ShowInTextbox() + End Sub + + Private Sub BPrevBrowse_Click(sender As Object, e As EventArgs) Handles BBrowse.Click + Dim xDOpen As New OpenFileDialog With { + .InitialDirectory = IIf(Path.GetDirectoryName(Replace(TPath.Text, "", My.Application.Info.DirectoryPath)) = String.Empty, _ + My.Application.Info.DirectoryPath, _ + Path.GetDirectoryName(Replace(TPath.Text, "", My.Application.Info.DirectoryPath))), + .Filter = Strings.FileType.EXE & "|*.exe", + .DefaultExt = "exe" + } + If xDOpen.ShowDialog = Forms.DialogResult.Cancel Then Exit Sub + TPath.Text = Replace(xDOpen.FileName, My.Application.Info.DirectoryPath, "") + End Sub + + Private Sub BPrevDefault_Click(sender As Object, e As EventArgs) Handles BDefault.Click + 'ImplicitChange = True + If MsgBox(Strings.Messages.RestoreDefaultSettings, MsgBoxStyle.Question + MsgBoxStyle.YesNo) = MsgBoxResult.No Then Exit Sub + + pArg = New MainWindow.PlayerArguments() {New MainWindow.PlayerArguments("\uBMplay.exe", _ + "-P -N0 """"", _ + "-P -N """"", _ + "-S"), _ + New MainWindow.PlayerArguments("\o2play.exe", _ + "-P -N0 """"", _ + "-P -N """"", _ + "-S")} + CurrPlayer = 0 + ResetLPlayer_ShowInTextbox() + 'ImplicitChange = False + End Sub + + 'Affect LPlayer and all textboxes + Private Sub ResetLPlayer_ShowInTextbox() + LPlayer.Items.Clear() + For xI1 As Integer = 0 To UBound(pArg) + Dim unused = LPlayer.Items.Add(GetFileName(pArg(xI1).Path)) + Next + 'RemoveHandler LPlayer.SelectedIndexChanged, AddressOf LPlayer_SelectedIndexChanged + LPlayer.SelectedIndex = CurrPlayer + 'AddHandler LPlayer.SelectedIndexChanged, AddressOf LPlayer_SelectedIndexChanged + ShowInTextbox() + 'ImplicitChange = False + End Sub + + 'affect current LPlayer index value + Private Sub LPlayerChangeCurrIndex(xStr As String) + 'RemoveHandler LPlayer.SelectedIndexChanged, AddressOf LPlayer_SelectedIndexChanged + LPlayer.Items.Item(CurrPlayer) = GetFileName(xStr) + 'AddHandler LPlayer.SelectedIndexChanged, AddressOf LPlayer_SelectedIndexChanged + End Sub + + 'Affect pArgs + Private Sub SavePArg() + pArg(CurrPlayer).Path = TPath.Text + pArg(CurrPlayer).aBegin = TPlayB.Text + pArg(CurrPlayer).aHere = TPlay.Text + pArg(CurrPlayer).aStop = TStop.Text + 'pArg(CurrPlayer) = TPath.Text & vbCrLf & _ + ' TPlayB.Text & vbCrLf & _ + ' TPlay.Text & vbCrLf & _ + ' TStop.Text + End Sub + + 'affect all textboxes + Private Sub ShowInTextbox() + 'ImplicitChange = True + 'Dim xStr() As String = Split(pArg(CurrPlayer), vbCrLf) + 'If xStr.Length <> 4 Then ReDim Preserve xStr(3) + TPath.Text = pArg(CurrPlayer).Path + TPlayB.Text = pArg(CurrPlayer).aBegin + TPlay.Text = pArg(CurrPlayer).aHere + TStop.Text = pArg(CurrPlayer).aStop + ValidateTextBox() + 'ImplicitChange = False + End Sub + + Private Sub ValidateTextBox() + For Each xT As TextBox In New TextBox() {TPath, TPlayB, TPlay, TStop} + Dim xText As String = xT.Text.Replace("", String.Empty).Replace("", String.Empty).Replace("", String.Empty).Replace("""", String.Empty) + Dim xContainsInvalidChar As Boolean = False + + For Each xC As Char In Path.GetInvalidPathChars + If xText.IndexOf(xC) <> -1 Then + xContainsInvalidChar = True + Exit For + End If + Next + + xT.BackColor = If(xContainsInvalidChar, Color.FromArgb(&HFFFFC0C0), Nothing) + Next + End Sub + + Public Sub New(xCurrPlayer As Integer) + InitializeComponent() + + pArg = MainWindow.pArgs.Clone + CurrPlayer = xCurrPlayer + ResetLPlayer_ShowInTextbox() + End Sub + + Private Sub TPath_KeyDown(sender As Object, e As KeyEventArgs) Handles TPath.KeyUp, TPlay.KeyUp, TPlayB.KeyUp, TStop.KeyUp + SavePArg() + If ReferenceEquals(sender, TPath) Then _ + LPlayerChangeCurrIndex(pArg(CurrPlayer).Path) + End Sub + + Private Sub TPath_LostFocus(sender As Object, e As EventArgs) Handles TPath.LostFocus, TPlay.LostFocus, TPlayB.LostFocus, TStop.LostFocus + SavePArg() + If ReferenceEquals(sender, TPath) Then _ + LPlayerChangeCurrIndex(pArg(CurrPlayer).Path) + ValidateTextBox() + End Sub + + 'Private Function pArgPath(ByVal I As Integer) + ' Return Mid(pArg(I), 1, InStr(pArg(I), vbCrLf) - 1) + 'End Function + + Private Function GetFileName(s As String) As String + Dim fslash As Integer = InStrRev(s, "/") + Dim bslash As Integer = InStrRev(s, "\") + Return Mid(s, IIf(fslash > bslash, fslash, bslash) + 1) + End Function End Class diff --git a/iBMSC/Option Windows/OpVisual.vb b/iBMSC/Option Windows/OpVisual.vb index 51978ebc0..ae9c9c5dd 100644 --- a/iBMSC/Option Windows/OpVisual.vb +++ b/iBMSC/Option Windows/OpVisual.vb @@ -1,774 +1,774 @@ Imports iBMSC.Editor Public Class OpVisual - Private niB As Integer = MainWindow.niB - - Public Structure ColumnOptionSet - Public Width As NumericUpDown - Public Title As TextBox - Public SNote As Button - Public SText As Button - Public LNote As Button - Public LText As Button - Public BG As Button - End Structure - - 'Const Max As Integer = 99 - - 'Dim lWidth() As Integer - 'Dim lTitle() As String - 'Dim lColor() As Color - 'Dim lForeColor() As Color - 'Dim lColorL() As Color - 'Dim lForeColorL() As Color - 'Dim lBg() As Color - - 'Dim WithEvents jWidth As New ArrayList - 'Dim WithEvents jTitle As New ArrayList - 'Dim WithEvents jColor As New ArrayList - 'Dim WithEvents jForeColor As New ArrayList - 'Dim WithEvents jColorL As New ArrayList - 'Dim WithEvents jForeColorL As New ArrayList - 'Dim WithEvents jBg As New ArrayList - - 'Dim eColor(13) As Color - 'Dim eFont(3) As Font - 'Dim eI(4) As Integer - - 'Dim WithEvents eaColor As New ArrayList - 'Dim WithEvents eaFont As New ArrayList - 'Dim WithEvents eaI As New ArrayList - - Private vo As visualSettings - Private col() As Column - Private co() As ColumnOptionSet - - - - Public Sub New(xvo As visualSettings, xcol() As Column, monoFont As Font) - InitializeComponent() - - 'eColor = xeColor - 'eFont = xeFont - 'eI = xeI - vo = xvo - - cButtonChange(cColumnTitle, vo.ColumnTitle.Color) - cButtonChange(cBG, vo.Bg.Color) - cButtonChange(cGrid, vo.pGrid.Color) - cButtonChange(cSub, vo.pSub.Color) - cButtonChange(cVerticalLine, vo.pVLine.Color) - cButtonChange(cMeasureBarLine, vo.pMLine.Color) - cButtonChange(cWaveForm, vo.pBGMWav.Color) - cButtonChange(cMouseOver, vo.kMouseOver.Color) - cButtonChange(cSelectedBorder, vo.kSelected.Color) - cButtonChange(cAdjustLengthBorder, vo.kMouseOverE.Color) - cButtonChange(cSelectionBox, vo.SelBox.Color) - cButtonChange(cTSCursor, vo.PECursor.Color) - cButtonChange(cTSSplitter, vo.PEHalf.Color) - cButtonChange(cTSMouseOver, vo.PEMouseOver.Color) - cButtonChange(cTSSelectionFill, vo.PESel.Color) - cButtonChange(cTSBPM, vo.PEBPM.Color) - - fButtonChange(fColumnTitle, vo.ColumnTitleFont) - fButtonChange(fNoteLabel, vo.kFont) - fButtonChange(fMeasureLabel, vo.kMFont) - fButtonChange(fTSBPM, vo.PEBPMFont) - - - iNoteHeight.SetValClamped(vo.kHeight) - iLabelVerticalShift.SetValClamped(vo.kLabelVShift) - iLabelHorizShift.SetValClamped(vo.kLabelHShift) - iLongLabelHorizShift.SetValClamped(vo.kLabelHShiftL) - iHiddenNoteOpacity.SetValClamped(vo.kOpacity) - iTSSensitivity.SetValClamped(vo.PEDeltaMouseOver) - iMiddleSensitivity.SetValClamped(vo.MiddleDeltaRelease) - - 'lWidth = xlWidth - 'lTitle = xlTitle - 'lColor = xlColor - 'lForeColor = xlForeColor - 'lColorL = xlColorL - 'lForeColorL = xlForeColorL - 'lBg = xlBg - - col = xcol.Clone - ReDim co(UBound(col)) - - For xI1 As Integer = 0 To UBound(col) - Dim jw As New NumericUpDown - With jw - .BorderStyle = BorderStyle.FixedSingle - .Location = New Point(xI1 * 32, 12) - .Maximum = 999 - .Size = New Size(33, 23) - .Value = col(xI1).Width - End With - - Dim jt As New TextBox - With jt - .BorderStyle = BorderStyle.FixedSingle - .Location = New Point(xI1 * 32, 34) - .Size = New Size(33, 23) - .Text = col(xI1).Title - End With - - Dim js As New Button - With js - .FlatStyle = FlatStyle.Popup - .Font = monoFont - .Location = New Point(xI1 * 32, 63) - .Size = New Size(33, 66) - .BackColor = Color.FromArgb(col(xI1).cNote) - .ForeColor = col(xI1).cText - .Text = To4Hex(col(xI1).cNote) - .Name = "cNote" - End With - Dim jst As New Button - With jst - .FlatStyle = FlatStyle.Popup - .Font = monoFont - .Location = New Point(xI1 * 32, 128) - .Size = New Size(33, 66) - .BackColor = Color.FromArgb(col(xI1).cNote) - .ForeColor = col(xI1).cText - .Text = To4Hex(col(xI1).cText.ToArgb) - .Name = "cText" - End With - js.Tag = jst - jst.Tag = js - - Dim jl As New Button - With jl - .FlatStyle = FlatStyle.Popup - .Font = monoFont - .Location = New Point(xI1 * 32, 193) - .Size = New Size(33, 66) - .BackColor = Color.FromArgb(col(xI1).cLNote) - .ForeColor = col(xI1).cLText - .Text = To4Hex(col(xI1).cLNote) - .Name = "cNote" - End With - Dim jlt As New Button - With jlt - .FlatStyle = FlatStyle.Popup - .Font = monoFont - .Location = New Point(xI1 * 32, 258) - .Size = New Size(33, 66) - .BackColor = Color.FromArgb(col(xI1).cLNote) - .ForeColor = col(xI1).cLText - .Text = To4Hex(col(xI1).cLText.ToArgb) - .Name = "cText" - End With - jl.Tag = jlt - jlt.Tag = jl - - Dim jb As New Button - With jb - .FlatStyle = FlatStyle.Popup - .Font = monoFont - .Location = New Point(xI1 * 32, 323) - .Size = New Size(33, 66) - .BackColor = col(xI1).cBG - .ForeColor = IIf(CInt(col(xI1).cBG.GetBrightness * 255) + 255 - col(xI1).cBG.A >= 128, Color.Black, Color.White) - .Text = To4Hex(col(xI1).cBG.ToArgb) - .Name = "cBG" - .Tag = Nothing - End With - - Panel2.Controls.Add(jw) - Panel2.Controls.Add(jt) - Panel2.Controls.Add(js) - Panel2.Controls.Add(jst) - Panel2.Controls.Add(jl) - Panel2.Controls.Add(jlt) - Panel2.Controls.Add(jb) - co(xI1).Width = jw - co(xI1).Title = jt - co(xI1).SNote = js - co(xI1).SText = jst - co(xI1).LNote = jl - co(xI1).LText = jlt - co(xI1).BG = jb - 'AddHandler jw.ValueChanged, AddressOf WidthChanged - 'AddHandler jt.TextChanged, AddressOf TitleChanged - AddHandler js.Click, AddressOf ButtonClick - AddHandler jst.Click, AddressOf ButtonClick - AddHandler jl.Click, AddressOf ButtonClick - AddHandler jlt.Click, AddressOf ButtonClick - AddHandler jb.Click, AddressOf ButtonClick - Next - End Sub - - Private Sub cButtonChange(xbutton As Button, c As Color) - xbutton.Text = Hex(c.ToArgb) - xbutton.BackColor = c - xbutton.ForeColor = IIf(CInt(c.GetBrightness * 255) + 255 - c.A >= 128, Color.Black, Color.White) - End Sub - - Private Sub fButtonChange(xbutton As Button, f As Font) - xbutton.Text = f.FontFamily.Name - xbutton.Font = f - End Sub - - Private Sub OK_Button_Click(sender As Object, e As EventArgs) Handles OK_Button.Click - 'With Form1 - - '----------------------------------------------- - 'Page 2----------------------------------------- - '----------------------------------------------- - - '.voTitle.Color = eColor(0) - '.voBg.Color = eColor(1) - '.voGrid.Color = eColor(2) - '.voSub.Color = eColor(3) - '.voVLine.Color = eColor(4) - '.voMLine.Color = eColor(5) - - '.voBGMWav.Color = eColor(6) - '.TWTransparency.Value = eColor(6).A - '.TWTransparency2.Value = eColor(6).A - '.TWSaturation.Value = eColor(6).GetSaturation * 1000 - '.TWSaturation2.Value = eColor(6).GetSaturation * 1000 - - '.voSelBox.Color = eColor(7) - '.voPECursor.Color = eColor(8) - '.voPESel.Color = eColor(9) - '.voPEBPM.Color = eColor(10) - '.vKMouseOver.Color = eColor(11) - '.vKSelected.Color = eColor(12) - '.vKMouseOverE.Color = eColor(13) - '.voTitleFont = eFont(0) - '.voPEBPMFont = eFont(1) - '.vKFont = eFont(2) - '.vKMFont = eFont(3) - '.vKHeight = eI(0) - '.vKLabelVShift = eI(1) - '.vKLabelHShift = eI(2) - '.vKLabelHShiftL = eI(3) - '.vKHidTransparency = CSng(eI(4)) / 100 - - '----------------------------------------------- - 'Page 1----------------------------------------- - '----------------------------------------------- - - '.kLength = lWidth - '.kTitle = lTitle - '.kColor = ColorArrayToIntArray(lColor) - '.kForeColor = ColorArrayToIntArray(lForeColor) - '.kColorL = ColorArrayToIntArray(lColorL) - '.kForeColorL = ColorArrayToIntArray(lForeColorL) - '.kBgColor = ColorArrayToIntArray(lBg) - - 'End With - - vo.ColumnTitle.Color = cColumnTitle.BackColor - vo.Bg.Color = cBG.BackColor - vo.pGrid.Color = cGrid.BackColor - vo.pSub.Color = cSub.BackColor - vo.pVLine.Color = cVerticalLine.BackColor - vo.pMLine.Color = cMeasureBarLine.BackColor - vo.pBGMWav.Color = cWaveForm.BackColor - vo.kMouseOver.Color = cMouseOver.BackColor - vo.kSelected.Color = cSelectedBorder.BackColor - vo.kMouseOverE.Color = cAdjustLengthBorder.BackColor - vo.SelBox.Color = cSelectionBox.BackColor - vo.PECursor.Color = cTSCursor.BackColor - vo.PEHalf.Color = cTSSplitter.BackColor - vo.PEMouseOver.Color = cTSMouseOver.BackColor - vo.PESel.Color = cTSSelectionFill.BackColor - vo.PEBPM.Color = cTSBPM.BackColor - - vo.ColumnTitleFont = fColumnTitle.Font - vo.kFont = fNoteLabel.Font - vo.kMFont = fMeasureLabel.Font - vo.PEBPMFont = fTSBPM.Font - - vo.kHeight = CInt(iNoteHeight.Value) - vo.kLabelVShift = CInt(iLabelVerticalShift.Value) - vo.kLabelHShift = CInt(iLabelHorizShift.Value) - vo.kLabelHShiftL = CInt(iLongLabelHorizShift.Value) - vo.kOpacity = iHiddenNoteOpacity.Value - vo.PEDeltaMouseOver = CInt(iTSSensitivity.Value) - vo.MiddleDeltaRelease = CInt(iMiddleSensitivity.Value) - - MainWindow.setVO(vo) - - For xI1 As Integer = 0 To UBound(co) - col(xI1).Title = co(xI1).Title.Text - col(xI1).Width = co(xI1).Width.Value - col(xI1).setNoteColor(co(xI1).SNote.BackColor.ToArgb) - col(xI1).cText = co(xI1).SText.ForeColor - col(xI1).setLNoteColor(co(xI1).LNote.BackColor.ToArgb) - col(xI1).cLText = co(xI1).LText.ForeColor - col(xI1).cBG = co(xI1).BG.BackColor - Next - - MainWindow.column = col - - DialogResult = DialogResult.OK - Close() - End Sub - - Private Sub Cancel_Button_Click(sender As Object, e As EventArgs) Handles Cancel_Button.Click - DialogResult = DialogResult.Cancel - Close() - End Sub - - Private Sub OpVisual_Load(sender As Object, e As EventArgs) Handles MyBase.Load - Font = MainWindow.Font - - 'Language - - 'Dim xSA() As String = Form1.lpvo - - 'Me.Text = xSA(0) - ''rb1.Text = xSA(1) - ''rb2.Text = xSA(2) - ''Label9.Text = xSA(3) - ''Label10.Text = xSA(4) - ''Label11.Text = "(" & xSA(5) & ")" - ''Label20.Text = "(" & xSA(5) & ")" - ''Label12.Text = xSA(6) - ''Label13.Text = xSA(7) - ''Label14.Text = xSA(8) - ''Label17.Text = xSA(9) - ''Label16.Text = xSA(10) - ''Label15.Text = xSA(11) - ''Label19.Text = xSA(12) - ''Label18.Text = xSA(13) - - 'Label1.Text = xSA(14) - 'Label2.Text = xSA(15) - 'Label4.Text = xSA(17) - 'Label6.Text = xSA(18) - 'Label5.Text = xSA(19) - 'Label7.Text = xSA(20) - 'Label8.Text = xSA(21) - - 'Label37.Text = xSA(22) - 'Label30.Text = xSA(23) - 'Label26.Text = xSA(24) - 'Label27.Text = xSA(25) - 'Label29.Text = xSA(26) - 'Label40.Text = xSA(27) - 'Label22.Text = xSA(28) - 'Label31.Text = xSA(29) - 'Label98.Text = xSA(30) - 'Label86.Text = xSA(31) - 'Label88.Text = xSA(32) - 'Label21.Text = xSA(33) - 'Label24.Text = xSA(34) - 'Label28.Text = xSA(35) - 'Label25.Text = xSA(36) - 'Label38.Text = xSA(37) - 'Label39.Text = xSA(38) - 'Label34.Text = xSA(39) - 'Label35.Text = xSA(40) - 'Label23.Text = xSA(41) - 'OK_Button.Text = xSA(42) - 'Cancel_Button.Text = xSA(43) - 'Label3.Text = xSA(44) - - Text = Strings.fopVisual.Title - - Label37.Text = Strings.fopVisual.ColumnCaption - Label9.Text = Strings.fopVisual.ColumnCaptionFont - Label30.Text = Strings.fopVisual.Background - Label26.Text = Strings.fopVisual.Grid - Label27.Text = Strings.fopVisual.SubGrid - Label29.Text = Strings.fopVisual.VerticalLine - Label40.Text = Strings.fopVisual.MeasureBarLine - Label22.Text = Strings.fopVisual.BGMWaveform - Label21.Text = Strings.fopVisual.NoteHeight - Label24.Text = Strings.fopVisual.NoteLabel - Label28.Text = Strings.fopVisual.MeasureLabel - Label25.Text = Strings.fopVisual.LabelVerticalShift - Label38.Text = Strings.fopVisual.LabelHorizontalShift - Label39.Text = Strings.fopVisual.LongNoteLabelHorizontalShift - Label33.Text = Strings.fopVisual.HiddenNoteOpacity - Label34.Text = Strings.fopVisual.NoteBorderOnMouseOver - Label35.Text = Strings.fopVisual.NoteBorderOnSelection - Label23.Text = Strings.fopVisual.NoteBorderOnAdjustingLength - Label31.Text = Strings.fopVisual.SelectionBoxBorder - Label98.Text = Strings.fopVisual.TSCursor - Label97.Text = Strings.fopVisual.TSSplitter - Label96.Text = Strings.fopVisual.TSCursorSensitivity - Label91.Text = Strings.fopVisual.TSMouseOverBorder - Label86.Text = Strings.fopVisual.TSFill - Label88.Text = Strings.fopVisual.TSBPM - Label82.Text = Strings.fopVisual.TSBPMFont - Label14.Text = Strings.fopVisual.MiddleSensitivity - - Label1.Text = Strings.fopVisual.Width - Label2.Text = Strings.fopVisual.Caption - Label4.Text = Strings.fopVisual.Note - Label6.Text = Strings.fopVisual.Label - Label5.Text = Strings.fopVisual.LongNote - Label7.Text = Strings.fopVisual.LongNoteLabel - Label8.Text = Strings.fopVisual.Bg - - '----------------------------------------------- - 'Page 2----------------------------------------- - '----------------------------------------------- - - 'With eaColor - ' .Add(cColumnTitle) - ' .Add(cBG) - ' .Add(cGrid) - ' .Add(cSub) - ' .Add(cVerticalLine) - ' .Add(cMeasureBarLine) - ' .Add(cWaveForm) - ' .Add(cSelectionBox) - ' .Add(cTSCursor) - ' .Add(cTSSelectionArea) - ' .Add(cTSBPM) - ' .Add(cMouseOver) - ' .Add(cSelectedBorder) - ' .Add(cAdjustLengthBorder) - 'End With - 'With eaFont - ' .Add(fColumnTitle) - ' .Add(fTSBPM) - ' .Add(fNoteLabel) - ' .Add(fMeasureLabel) - 'End With - 'With eaI - ' .Add(iNoteHeight) - ' .Add(iLabelVerticalShift) - ' .Add(iLabelHorizShift) - ' .Add(iLongNoteLabelHorizShift) - ' .Add(iHiddenNoteOpacity) - 'End With - - 'Dim xI1 As Integer - 'For xI1 = 0 To 13 - ' eaColor(xI1).Text = Hex(eColor(xI1).ToArgb) - ' eaColor(xI1).BackColor = eColor(xI1) - ' eaColor(xI1).ForeColor = IIf(eColor(xI1).GetBrightness + (255 - eColor(xI1).A) / 255 >= 0.5, Color.Black, Color.White) - 'Next - 'For xI1 = 0 To 3 - ' eaFont(xI1).Text = eFont(xI1).FontFamily.Name - ' eaFont(xI1).Font = eFont(xI1) - 'Next - 'For xI1 = 0 To 4 - ' eaI(xI1).Value = eI(xI1) - 'Next - - 'AddHandler cColumnTitle.Click, AddressOf BCClick - 'AddHandler cBG.Click, AddressOf BCClick - 'AddHandler cGrid.Click, AddressOf BCClick - 'AddHandler cSub.Click, AddressOf BCClick - 'AddHandler cVerticalLine.Click, AddressOf BCClick - 'AddHandler cMeasureBarLine.Click, AddressOf BCClick - 'AddHandler cWaveForm.Click, AddressOf BCClick - 'AddHandler cSelectionBox.Click, AddressOf BCClick - 'AddHandler cTSCursor.Click, AddressOf BCClick - 'AddHandler cTSSelectionArea.Click, AddressOf BCClick - 'AddHandler cTSBPM.Click, AddressOf BCClick - 'AddHandler cMouseOver.Click, AddressOf BCClick - 'AddHandler cSelectedBorder.Click, AddressOf BCClick - 'AddHandler cAdjustLengthBorder.Click, AddressOf BCClick - 'AddHandler fColumnTitle.Click, AddressOf BFClick - 'AddHandler fTSBPM.Click, AddressOf BFClick - 'AddHandler fNoteLabel.Click, AddressOf BFClick - 'AddHandler fMeasureLabel.Click, AddressOf BFClick - 'AddHandler iNoteHeight.ValueChanged, AddressOf BIValueChanged - 'AddHandler iLabelVerticalShift.ValueChanged, AddressOf BIValueChanged - 'AddHandler iLabelHorizShift.ValueChanged, AddressOf BIValueChanged - 'AddHandler iLongNoteLabelHorizShift.ValueChanged, AddressOf BIValueChanged - 'AddHandler iHiddenNoteOpacity.ValueChanged, AddressOf BIValueChanged - - '----------------------------------------------- - 'Page 1----------------------------------------- - '----------------------------------------------- - - ''Width - 'For xI1 = 0 To niB - ' Dim xjWidth As New NumericUpDown - ' With xjWidth - ' .BorderStyle = BorderStyle.FixedSingle - ' .Location = New Point(lLeft(xI1), 12) - ' .Maximum = 99 - ' .Size = New Size(33, 23) - ' .Value = lWidth(xI1) - ' .Tag = xI1 - ' End With - ' Panel1.Controls.Add(xjWidth) - ' jWidth.Add(xjWidth) - ' AddHandler xjWidth.ValueChanged, AddressOf WidthChanged - 'Next - ' - ''Title - 'For xI1 = 0 To niB - ' Dim xjTitle As New TextBox - ' With xjTitle - ' .BorderStyle = BorderStyle.FixedSingle - ' .Location = New Point(lLeft(xI1), 34) - ' .Size = New Size(33, 23) - ' .Text = lTitle(xI1) - ' .Tag = xI1 - ' End With - ' Panel1.Controls.Add(xjTitle) - ' jTitle.Add(xjTitle) - ' AddHandler xjTitle.TextChanged, AddressOf TitleChanged - 'Next - ' - ''Color - 'For xI1 = 0 To niB - ' Dim xjColor As New Button - ' With xjColor - ' .FlatStyle = FlatStyle.Popup - ' .Font = New Font("Consolas", 9) - ' .Location = New Point(lLeft(xI1), 63) - ' .Size = New Size(33, 66) - ' .BackColor = lColor(xI1) - ' .ForeColor = lForeColor(xI1) - ' .Text = To4Hex(lColor(xI1).ToArgb) - ' .Tag = xI1 - ' End With - ' Panel1.Controls.Add(xjColor) - ' jColor.Add(xjColor) - ' AddHandler xjColor.Click, AddressOf B1Click - 'Next - ' - ''ForeColor - 'For xI1 = 0 To niB - ' Dim xjColor As New Button - ' With xjColor - ' .FlatStyle = FlatStyle.Popup - ' .Font = New Font("Consolas", 9) - ' .Location = New Point(lLeft(xI1), 128) - ' .Size = New Size(33, 66) - ' .BackColor = lColor(xI1) - ' .ForeColor = lForeColor(xI1) - ' .Text = To4Hex(lForeColor(xI1).ToArgb) - ' .Tag = xI1 - ' End With - ' Panel1.Controls.Add(xjColor) - ' jForeColor.Add(xjColor) - ' AddHandler xjColor.Click, AddressOf B2Click - 'Next - ' - ''ColorL - 'For xI1 = 0 To niB - ' Dim xjColor As New Button - ' With xjColor - ' .FlatStyle = FlatStyle.Popup - ' .Font = New Font("Consolas", 9) - ' .Location = New Point(lLeft(xI1), 193) - ' .Size = New Size(33, 66) - ' .BackColor = lColorL(xI1) - ' .ForeColor = lForeColorL(xI1) - ' .Text = To4Hex(lColorL(xI1).ToArgb) - ' .Tag = xI1 - ' End With - ' Panel1.Controls.Add(xjColor) - ' jColorL.Add(xjColor) - ' AddHandler xjColor.Click, AddressOf B3Click - 'Next - ' - ''ForeColorL - 'For xI1 = 0 To niB - ' Dim xjColor As New Button - ' With xjColor - ' .FlatStyle = FlatStyle.Popup - ' .Font = New Font("Consolas", 9) - ' .Location = New Point(lLeft(xI1), 258) - ' .Size = New Size(33, 66) - ' .BackColor = lColorL(xI1) - ' .ForeColor = lForeColorL(xI1) - ' .Text = To4Hex(lForeColorL(xI1).ToArgb) - ' .Tag = xI1 - ' End With - ' Panel1.Controls.Add(xjColor) - ' jForeColorL.Add(xjColor) - ' AddHandler xjColor.Click, AddressOf B4Click - 'Next - ' - ''BgColor - 'For xI1 = 0 To niB - ' Dim xjColor As New Button - ' With xjColor - ' .FlatStyle = FlatStyle.Popup - ' .Font = New Font("Consolas", 9) - ' .Location = New Point(lLeft(xI1), 323) - ' .Size = New Size(33, 66) - ' .BackColor = lBg(xI1) - ' .ForeColor = IIf(lBg(xI1).GetBrightness + (255 - lBg(xI1).A) / 255 >= 0.5, Color.Black, Color.White) - ' .Text = To4Hex(lBg(xI1).ToArgb) - ' .Tag = xI1 - ' End With - ' Panel1.Controls.Add(xjColor) - ' jBg.Add(xjColor) - ' AddHandler xjColor.Click, AddressOf B5Click - 'Next - - End Sub - - 'Private Sub rb1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) - ' Panel1.Visible = rb1.Checked - 'End Sub - ' - 'Private Sub rb2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) - ' Panel2.Visible = rb2.Checked - 'End Sub - ' - Private Sub BCClick(sender As Object, e As EventArgs) _ - Handles cColumnTitle.Click, _ - cBG.Click, _ - cGrid.Click, _ - cSub.Click, _ - cVerticalLine.Click, _ - cMeasureBarLine.Click, _ - cWaveForm.Click, _ - cMouseOver.Click, _ - cSelectedBorder.Click, _ - cAdjustLengthBorder.Click, _ - cSelectionBox.Click, _ - cTSCursor.Click, _ - cTSSplitter.Click, _ - cTSMouseOver.Click, _ - cTSSelectionFill.Click, _ - cTSBPM.Click - - 'Dim xI As Integer = Val(sender.Tag) - Dim s As Button = CType(sender, Button) - Dim xColorPicker As New ColorPicker - xColorPicker.SetOrigColor(s.BackColor) - If xColorPicker.ShowDialog(Me) = Forms.DialogResult.Cancel Then Exit Sub - - cButtonChange(s, xColorPicker.NewColor) - 'eColor(xI) = xColorPicker.NewColor - 'sender.Text = Hex(eColor(xI).ToArgb) - 'sender.BackColor = eColor(xI) - 'sender.ForeColor = IIf(eColor(xI).GetBrightness + (255 - eColor(xI).A) / 255 >= 0.5, Color.Black, Color.White) - End Sub - - Private Sub BFClick(sender As Object, e As EventArgs) _ - Handles fColumnTitle.Click, _ - fNoteLabel.Click, _ - fMeasureLabel.Click, _ - fTSBPM.Click - - 'Dim xI As Integer = Val(sender.Tag) - Dim s As Button = CType(sender, Button) - Dim xDFont As New FontDialog With { - .Font = s.Font - } - If xDFont.ShowDialog(Me) = Forms.DialogResult.Cancel Then Exit Sub - - fButtonChange(s, xDFont.Font) - 'eFont(xI) = xDFont.Font - 'sender.Text = eFont(xI).FontFamily.Name - 'sender.Font = eFont(xI) - End Sub - - 'Private Sub BIValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) - ' eI(Val(sender.Tag)) = sender.Value - 'End Sub - - 'Private Sub WidthChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) - ' lWidth(Val(sender.Tag)) = sender.Value - 'End Sub - 'Private Sub TitleChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) - ' lTitle(Val(sender.Tag)) = sender.Text - 'End Sub - 'Private Sub B1Click(ByVal sender As System.Object, ByVal e As System.EventArgs) - ' Dim xColorPicker As New ColorPicker - ' Dim xI As Integer = Val(sender.Tag) - ' - ' xColorPicker.SetOrigColor(lColor(xI)) - ' If xColorPicker.ShowDialog(Me) = Windows.Forms.DialogResult.Cancel Then Exit Sub - ' lColor(xI) = xColorPicker.NewColor - ' sender.Text = To4Hex(lColor(xI).ToArgb) - ' sender.BackColor = lColor(xI) - ' jForeColor(xI).Backcolor = lColor(xI) - 'End Sub - 'Private Sub B2Click(ByVal sender As System.Object, ByVal e As System.EventArgs) - ' Dim xColorPicker As New ColorPicker - ' Dim xI As Integer = Val(sender.Tag) - ' - ' xColorPicker.SetOrigColor(lForeColor(xI)) - ' If xColorPicker.ShowDialog(Me) = Windows.Forms.DialogResult.Cancel Then Exit Sub - ' lForeColor(xI) = xColorPicker.NewColor - ' sender.Text = To4Hex(lForeColor(xI).ToArgb) - ' sender.ForeColor = lForeColor(xI) - ' jColor(xI).ForeColor = lForeColor(xI) - 'End Sub - 'Private Sub B3Click(ByVal sender As System.Object, ByVal e As System.EventArgs) - ' Dim xColorPicker As New ColorPicker - ' Dim xI As Integer = Val(sender.Tag) - ' - ' xColorPicker.SetOrigColor(lColorL(xI)) - ' If xColorPicker.ShowDialog(Me) = Windows.Forms.DialogResult.Cancel Then Exit Sub - ' lColorL(xI) = xColorPicker.NewColor - ' sender.Text = To4Hex(lColorL(xI).ToArgb) - ' sender.BackColor = lColorL(xI) - ' jForeColorL(xI).Backcolor = lColorL(xI) - 'End Sub - 'Private Sub B4Click(ByVal sender As System.Object, ByVal e As System.EventArgs) - ' Dim xColorPicker As New ColorPicker - ' Dim xI As Integer = Val(sender.Tag) - ' - ' xColorPicker.SetOrigColor(lForeColorL(xI)) - ' If xColorPicker.ShowDialog(Me) = Windows.Forms.DialogResult.Cancel Then Exit Sub - ' lForeColorL(xI) = xColorPicker.NewColor - ' sender.Text = To4Hex(lForeColorL(xI).ToArgb) - ' sender.ForeColor = lForeColorL(xI) - ' jColorL(xI).ForeColor = lForeColorL(xI) - 'End Sub - 'Private Sub B5Click(ByVal sender As System.Object, ByVal e As System.EventArgs) - ' Dim xColorPicker As New ColorPicker - ' Dim xI As Integer = Val(sender.Tag) - ' - ' xColorPicker.SetOrigColor(lBg(xI)) - ' If xColorPicker.ShowDialog(Me) = Windows.Forms.DialogResult.Cancel Then Exit Sub - ' lBg(xI) = xColorPicker.NewColor - ' sender.Text = To4Hex(lBg(xI).ToArgb) - ' sender.BackColor = lBg(xI) - ' sender.ForeColor = IIf(lBg(xI).GetBrightness + (255 - lBg(xI).A) / 255 >= 0.5, Color.Black, Color.White) - 'End Sub - Private Sub ButtonClick(sender As Object, e As EventArgs) - 'Dim xI As Integer = Val(sender.Tag) - Dim s As Button = CType(sender, Button) - Dim xColorPicker As New ColorPicker - - 'xColorPicker.SetOrigColor(lColor(xI)) - If s.Name = "cText" Then xColorPicker.SetOrigColor(s.ForeColor) _ - Else xColorPicker.SetOrigColor(s.BackColor) - - If xColorPicker.ShowDialog(Me) = Forms.DialogResult.Cancel Then Exit Sub - - s.Text = To4Hex(xColorPicker.NewColor.ToArgb) - Select Case s.Name - Case "cNote" - s.BackColor = xColorPicker.NewColor - CType(s.Tag, Button).BackColor = xColorPicker.NewColor - Case "cText" - s.ForeColor = xColorPicker.NewColor - CType(s.Tag, Button).ForeColor = xColorPicker.NewColor - Case "cBG" - s.BackColor = xColorPicker.NewColor - s.ForeColor = IIf(CInt(xColorPicker.NewColor.GetBrightness * 255) + 255 - xColorPicker.NewColor.A >= 128, Color.Black, Color.White) - End Select - 'lColor(xI) = xColorPicker.NewColor - 'sender.Text = To4Hex(lColor(xI).ToArgb) - 'sender.BackColor = lColor(xI) - 'jForeColor(xI).Backcolor = lColor(xI) - End Sub - - Private Function ColorArrayToIntArray(xC() As Color) As Integer() - Dim xI(UBound(xC)) As Integer - For xI1 As Integer = 0 To UBound(xI) - xI(xI1) = xC(xI1).ToArgb - Next - Return xI - End Function - - Private Function To4Hex(xInt As Integer) As String - Dim xCl As Color = Color.FromArgb(xInt) - Return Hex(xCl.A) & vbCrLf & Hex(xCl.R) & vbCrLf & Hex(xCl.G) & vbCrLf & Hex(xCl.B) - End Function + Private niB As Integer = MainWindow.niB + + Public Structure ColumnOptionSet + Public Width As NumericUpDown + Public Title As TextBox + Public SNote As Button + Public SText As Button + Public LNote As Button + Public LText As Button + Public BG As Button + End Structure + + 'Const Max As Integer = 99 + + 'Dim lWidth() As Integer + 'Dim lTitle() As String + 'Dim lColor() As Color + 'Dim lForeColor() As Color + 'Dim lColorL() As Color + 'Dim lForeColorL() As Color + 'Dim lBg() As Color + + 'Dim WithEvents jWidth As New ArrayList + 'Dim WithEvents jTitle As New ArrayList + 'Dim WithEvents jColor As New ArrayList + 'Dim WithEvents jForeColor As New ArrayList + 'Dim WithEvents jColorL As New ArrayList + 'Dim WithEvents jForeColorL As New ArrayList + 'Dim WithEvents jBg As New ArrayList + + 'Dim eColor(13) As Color + 'Dim eFont(3) As Font + 'Dim eI(4) As Integer + + 'Dim WithEvents eaColor As New ArrayList + 'Dim WithEvents eaFont As New ArrayList + 'Dim WithEvents eaI As New ArrayList + + Private vo As visualSettings + Private col() As Column + Private co() As ColumnOptionSet + + + + Public Sub New(xvo As visualSettings, xcol() As Column, monoFont As Font) + InitializeComponent() + + 'eColor = xeColor + 'eFont = xeFont + 'eI = xeI + vo = xvo + + cButtonChange(cColumnTitle, vo.ColumnTitle.Color) + cButtonChange(cBG, vo.Bg.Color) + cButtonChange(cGrid, vo.pGrid.Color) + cButtonChange(cSub, vo.pSub.Color) + cButtonChange(cVerticalLine, vo.pVLine.Color) + cButtonChange(cMeasureBarLine, vo.pMLine.Color) + cButtonChange(cWaveForm, vo.pBGMWav.Color) + cButtonChange(cMouseOver, vo.kMouseOver.Color) + cButtonChange(cSelectedBorder, vo.kSelected.Color) + cButtonChange(cAdjustLengthBorder, vo.kMouseOverE.Color) + cButtonChange(cSelectionBox, vo.SelBox.Color) + cButtonChange(cTSCursor, vo.PECursor.Color) + cButtonChange(cTSSplitter, vo.PEHalf.Color) + cButtonChange(cTSMouseOver, vo.PEMouseOver.Color) + cButtonChange(cTSSelectionFill, vo.PESel.Color) + cButtonChange(cTSBPM, vo.PEBPM.Color) + + fButtonChange(fColumnTitle, vo.ColumnTitleFont) + fButtonChange(fNoteLabel, vo.kFont) + fButtonChange(fMeasureLabel, vo.kMFont) + fButtonChange(fTSBPM, vo.PEBPMFont) + + + iNoteHeight.SetValClamped(vo.kHeight) + iLabelVerticalShift.SetValClamped(vo.kLabelVShift) + iLabelHorizShift.SetValClamped(vo.kLabelHShift) + iLongLabelHorizShift.SetValClamped(vo.kLabelHShiftL) + iHiddenNoteOpacity.SetValClamped(vo.kOpacity) + iTSSensitivity.SetValClamped(vo.PEDeltaMouseOver) + iMiddleSensitivity.SetValClamped(vo.MiddleDeltaRelease) + + 'lWidth = xlWidth + 'lTitle = xlTitle + 'lColor = xlColor + 'lForeColor = xlForeColor + 'lColorL = xlColorL + 'lForeColorL = xlForeColorL + 'lBg = xlBg + + col = xcol.Clone + ReDim co(UBound(col)) + + For xI1 As Integer = 0 To UBound(col) + Dim jw As New NumericUpDown + With jw + .BorderStyle = BorderStyle.FixedSingle + .Location = New Point(xI1 * 32, 12) + .Maximum = 999 + .Size = New Size(33, 23) + .Value = col(xI1).Width + End With + + Dim jt As New TextBox + With jt + .BorderStyle = BorderStyle.FixedSingle + .Location = New Point(xI1 * 32, 34) + .Size = New Size(33, 23) + .Text = col(xI1).Title + End With + + Dim js As New Button + With js + .FlatStyle = FlatStyle.Popup + .Font = monoFont + .Location = New Point(xI1 * 32, 63) + .Size = New Size(33, 66) + .BackColor = Color.FromArgb(col(xI1).cNote) + .ForeColor = col(xI1).cText + .Text = To4Hex(col(xI1).cNote) + .Name = "cNote" + End With + Dim jst As New Button + With jst + .FlatStyle = FlatStyle.Popup + .Font = monoFont + .Location = New Point(xI1 * 32, 128) + .Size = New Size(33, 66) + .BackColor = Color.FromArgb(col(xI1).cNote) + .ForeColor = col(xI1).cText + .Text = To4Hex(col(xI1).cText.ToArgb) + .Name = "cText" + End With + js.Tag = jst + jst.Tag = js + + Dim jl As New Button + With jl + .FlatStyle = FlatStyle.Popup + .Font = monoFont + .Location = New Point(xI1 * 32, 193) + .Size = New Size(33, 66) + .BackColor = Color.FromArgb(col(xI1).cLNote) + .ForeColor = col(xI1).cLText + .Text = To4Hex(col(xI1).cLNote) + .Name = "cNote" + End With + Dim jlt As New Button + With jlt + .FlatStyle = FlatStyle.Popup + .Font = monoFont + .Location = New Point(xI1 * 32, 258) + .Size = New Size(33, 66) + .BackColor = Color.FromArgb(col(xI1).cLNote) + .ForeColor = col(xI1).cLText + .Text = To4Hex(col(xI1).cLText.ToArgb) + .Name = "cText" + End With + jl.Tag = jlt + jlt.Tag = jl + + Dim jb As New Button + With jb + .FlatStyle = FlatStyle.Popup + .Font = monoFont + .Location = New Point(xI1 * 32, 323) + .Size = New Size(33, 66) + .BackColor = col(xI1).cBG + .ForeColor = IIf(CInt(col(xI1).cBG.GetBrightness * 255) + 255 - col(xI1).cBG.A >= 128, Color.Black, Color.White) + .Text = To4Hex(col(xI1).cBG.ToArgb) + .Name = "cBG" + .Tag = Nothing + End With + + Panel2.Controls.Add(jw) + Panel2.Controls.Add(jt) + Panel2.Controls.Add(js) + Panel2.Controls.Add(jst) + Panel2.Controls.Add(jl) + Panel2.Controls.Add(jlt) + Panel2.Controls.Add(jb) + co(xI1).Width = jw + co(xI1).Title = jt + co(xI1).SNote = js + co(xI1).SText = jst + co(xI1).LNote = jl + co(xI1).LText = jlt + co(xI1).BG = jb + 'AddHandler jw.ValueChanged, AddressOf WidthChanged + 'AddHandler jt.TextChanged, AddressOf TitleChanged + AddHandler js.Click, AddressOf ButtonClick + AddHandler jst.Click, AddressOf ButtonClick + AddHandler jl.Click, AddressOf ButtonClick + AddHandler jlt.Click, AddressOf ButtonClick + AddHandler jb.Click, AddressOf ButtonClick + Next + End Sub + + Private Sub cButtonChange(xbutton As Button, c As Color) + xbutton.Text = Hex(c.ToArgb) + xbutton.BackColor = c + xbutton.ForeColor = IIf(CInt(c.GetBrightness * 255) + 255 - c.A >= 128, Color.Black, Color.White) + End Sub + + Private Sub fButtonChange(xbutton As Button, f As Font) + xbutton.Text = f.FontFamily.Name + xbutton.Font = f + End Sub + + Private Sub OK_Button_Click(sender As Object, e As EventArgs) Handles OK_Button.Click + 'With Form1 + + '----------------------------------------------- + 'Page 2----------------------------------------- + '----------------------------------------------- + + '.voTitle.Color = eColor(0) + '.voBg.Color = eColor(1) + '.voGrid.Color = eColor(2) + '.voSub.Color = eColor(3) + '.voVLine.Color = eColor(4) + '.voMLine.Color = eColor(5) + + '.voBGMWav.Color = eColor(6) + '.TWTransparency.Value = eColor(6).A + '.TWTransparency2.Value = eColor(6).A + '.TWSaturation.Value = eColor(6).GetSaturation * 1000 + '.TWSaturation2.Value = eColor(6).GetSaturation * 1000 + + '.voSelBox.Color = eColor(7) + '.voPECursor.Color = eColor(8) + '.voPESel.Color = eColor(9) + '.voPEBPM.Color = eColor(10) + '.vKMouseOver.Color = eColor(11) + '.vKSelected.Color = eColor(12) + '.vKMouseOverE.Color = eColor(13) + '.voTitleFont = eFont(0) + '.voPEBPMFont = eFont(1) + '.vKFont = eFont(2) + '.vKMFont = eFont(3) + '.vKHeight = eI(0) + '.vKLabelVShift = eI(1) + '.vKLabelHShift = eI(2) + '.vKLabelHShiftL = eI(3) + '.vKHidTransparency = CSng(eI(4)) / 100 + + '----------------------------------------------- + 'Page 1----------------------------------------- + '----------------------------------------------- + + '.kLength = lWidth + '.kTitle = lTitle + '.kColor = ColorArrayToIntArray(lColor) + '.kForeColor = ColorArrayToIntArray(lForeColor) + '.kColorL = ColorArrayToIntArray(lColorL) + '.kForeColorL = ColorArrayToIntArray(lForeColorL) + '.kBgColor = ColorArrayToIntArray(lBg) + + 'End With + + vo.ColumnTitle.Color = cColumnTitle.BackColor + vo.Bg.Color = cBG.BackColor + vo.pGrid.Color = cGrid.BackColor + vo.pSub.Color = cSub.BackColor + vo.pVLine.Color = cVerticalLine.BackColor + vo.pMLine.Color = cMeasureBarLine.BackColor + vo.pBGMWav.Color = cWaveForm.BackColor + vo.kMouseOver.Color = cMouseOver.BackColor + vo.kSelected.Color = cSelectedBorder.BackColor + vo.kMouseOverE.Color = cAdjustLengthBorder.BackColor + vo.SelBox.Color = cSelectionBox.BackColor + vo.PECursor.Color = cTSCursor.BackColor + vo.PEHalf.Color = cTSSplitter.BackColor + vo.PEMouseOver.Color = cTSMouseOver.BackColor + vo.PESel.Color = cTSSelectionFill.BackColor + vo.PEBPM.Color = cTSBPM.BackColor + + vo.ColumnTitleFont = fColumnTitle.Font + vo.kFont = fNoteLabel.Font + vo.kMFont = fMeasureLabel.Font + vo.PEBPMFont = fTSBPM.Font + + vo.kHeight = CInt(iNoteHeight.Value) + vo.kLabelVShift = CInt(iLabelVerticalShift.Value) + vo.kLabelHShift = CInt(iLabelHorizShift.Value) + vo.kLabelHShiftL = CInt(iLongLabelHorizShift.Value) + vo.kOpacity = iHiddenNoteOpacity.Value + vo.PEDeltaMouseOver = CInt(iTSSensitivity.Value) + vo.MiddleDeltaRelease = CInt(iMiddleSensitivity.Value) + + MainWindow.setVO(vo) + + For xI1 As Integer = 0 To UBound(co) + col(xI1).Title = co(xI1).Title.Text + col(xI1).Width = co(xI1).Width.Value + col(xI1).setNoteColor(co(xI1).SNote.BackColor.ToArgb) + col(xI1).cText = co(xI1).SText.ForeColor + col(xI1).setLNoteColor(co(xI1).LNote.BackColor.ToArgb) + col(xI1).cLText = co(xI1).LText.ForeColor + col(xI1).cBG = co(xI1).BG.BackColor + Next + + MainWindow.column = col + + DialogResult = DialogResult.OK + Close() + End Sub + + Private Sub Cancel_Button_Click(sender As Object, e As EventArgs) Handles Cancel_Button.Click + DialogResult = DialogResult.Cancel + Close() + End Sub + + Private Sub OpVisual_Load(sender As Object, e As EventArgs) Handles MyBase.Load + Font = MainWindow.Font + + 'Language + + 'Dim xSA() As String = Form1.lpvo + + 'Me.Text = xSA(0) + ''rb1.Text = xSA(1) + ''rb2.Text = xSA(2) + ''Label9.Text = xSA(3) + ''Label10.Text = xSA(4) + ''Label11.Text = "(" & xSA(5) & ")" + ''Label20.Text = "(" & xSA(5) & ")" + ''Label12.Text = xSA(6) + ''Label13.Text = xSA(7) + ''Label14.Text = xSA(8) + ''Label17.Text = xSA(9) + ''Label16.Text = xSA(10) + ''Label15.Text = xSA(11) + ''Label19.Text = xSA(12) + ''Label18.Text = xSA(13) + + 'Label1.Text = xSA(14) + 'Label2.Text = xSA(15) + 'Label4.Text = xSA(17) + 'Label6.Text = xSA(18) + 'Label5.Text = xSA(19) + 'Label7.Text = xSA(20) + 'Label8.Text = xSA(21) + + 'Label37.Text = xSA(22) + 'Label30.Text = xSA(23) + 'Label26.Text = xSA(24) + 'Label27.Text = xSA(25) + 'Label29.Text = xSA(26) + 'Label40.Text = xSA(27) + 'Label22.Text = xSA(28) + 'Label31.Text = xSA(29) + 'Label98.Text = xSA(30) + 'Label86.Text = xSA(31) + 'Label88.Text = xSA(32) + 'Label21.Text = xSA(33) + 'Label24.Text = xSA(34) + 'Label28.Text = xSA(35) + 'Label25.Text = xSA(36) + 'Label38.Text = xSA(37) + 'Label39.Text = xSA(38) + 'Label34.Text = xSA(39) + 'Label35.Text = xSA(40) + 'Label23.Text = xSA(41) + 'OK_Button.Text = xSA(42) + 'Cancel_Button.Text = xSA(43) + 'Label3.Text = xSA(44) + + Text = Strings.fopVisual.Title + + Label37.Text = Strings.fopVisual.ColumnCaption + Label9.Text = Strings.fopVisual.ColumnCaptionFont + Label30.Text = Strings.fopVisual.Background + Label26.Text = Strings.fopVisual.Grid + Label27.Text = Strings.fopVisual.SubGrid + Label29.Text = Strings.fopVisual.VerticalLine + Label40.Text = Strings.fopVisual.MeasureBarLine + Label22.Text = Strings.fopVisual.BGMWaveform + Label21.Text = Strings.fopVisual.NoteHeight + Label24.Text = Strings.fopVisual.NoteLabel + Label28.Text = Strings.fopVisual.MeasureLabel + Label25.Text = Strings.fopVisual.LabelVerticalShift + Label38.Text = Strings.fopVisual.LabelHorizontalShift + Label39.Text = Strings.fopVisual.LongNoteLabelHorizontalShift + Label33.Text = Strings.fopVisual.HiddenNoteOpacity + Label34.Text = Strings.fopVisual.NoteBorderOnMouseOver + Label35.Text = Strings.fopVisual.NoteBorderOnSelection + Label23.Text = Strings.fopVisual.NoteBorderOnAdjustingLength + Label31.Text = Strings.fopVisual.SelectionBoxBorder + Label98.Text = Strings.fopVisual.TSCursor + Label97.Text = Strings.fopVisual.TSSplitter + Label96.Text = Strings.fopVisual.TSCursorSensitivity + Label91.Text = Strings.fopVisual.TSMouseOverBorder + Label86.Text = Strings.fopVisual.TSFill + Label88.Text = Strings.fopVisual.TSBPM + Label82.Text = Strings.fopVisual.TSBPMFont + Label14.Text = Strings.fopVisual.MiddleSensitivity + + Label1.Text = Strings.fopVisual.Width + Label2.Text = Strings.fopVisual.Caption + Label4.Text = Strings.fopVisual.Note + Label6.Text = Strings.fopVisual.Label + Label5.Text = Strings.fopVisual.LongNote + Label7.Text = Strings.fopVisual.LongNoteLabel + Label8.Text = Strings.fopVisual.Bg + + '----------------------------------------------- + 'Page 2----------------------------------------- + '----------------------------------------------- + + 'With eaColor + ' .Add(cColumnTitle) + ' .Add(cBG) + ' .Add(cGrid) + ' .Add(cSub) + ' .Add(cVerticalLine) + ' .Add(cMeasureBarLine) + ' .Add(cWaveForm) + ' .Add(cSelectionBox) + ' .Add(cTSCursor) + ' .Add(cTSSelectionArea) + ' .Add(cTSBPM) + ' .Add(cMouseOver) + ' .Add(cSelectedBorder) + ' .Add(cAdjustLengthBorder) + 'End With + 'With eaFont + ' .Add(fColumnTitle) + ' .Add(fTSBPM) + ' .Add(fNoteLabel) + ' .Add(fMeasureLabel) + 'End With + 'With eaI + ' .Add(iNoteHeight) + ' .Add(iLabelVerticalShift) + ' .Add(iLabelHorizShift) + ' .Add(iLongNoteLabelHorizShift) + ' .Add(iHiddenNoteOpacity) + 'End With + + 'Dim xI1 As Integer + 'For xI1 = 0 To 13 + ' eaColor(xI1).Text = Hex(eColor(xI1).ToArgb) + ' eaColor(xI1).BackColor = eColor(xI1) + ' eaColor(xI1).ForeColor = IIf(eColor(xI1).GetBrightness + (255 - eColor(xI1).A) / 255 >= 0.5, Color.Black, Color.White) + 'Next + 'For xI1 = 0 To 3 + ' eaFont(xI1).Text = eFont(xI1).FontFamily.Name + ' eaFont(xI1).Font = eFont(xI1) + 'Next + 'For xI1 = 0 To 4 + ' eaI(xI1).Value = eI(xI1) + 'Next + + 'AddHandler cColumnTitle.Click, AddressOf BCClick + 'AddHandler cBG.Click, AddressOf BCClick + 'AddHandler cGrid.Click, AddressOf BCClick + 'AddHandler cSub.Click, AddressOf BCClick + 'AddHandler cVerticalLine.Click, AddressOf BCClick + 'AddHandler cMeasureBarLine.Click, AddressOf BCClick + 'AddHandler cWaveForm.Click, AddressOf BCClick + 'AddHandler cSelectionBox.Click, AddressOf BCClick + 'AddHandler cTSCursor.Click, AddressOf BCClick + 'AddHandler cTSSelectionArea.Click, AddressOf BCClick + 'AddHandler cTSBPM.Click, AddressOf BCClick + 'AddHandler cMouseOver.Click, AddressOf BCClick + 'AddHandler cSelectedBorder.Click, AddressOf BCClick + 'AddHandler cAdjustLengthBorder.Click, AddressOf BCClick + 'AddHandler fColumnTitle.Click, AddressOf BFClick + 'AddHandler fTSBPM.Click, AddressOf BFClick + 'AddHandler fNoteLabel.Click, AddressOf BFClick + 'AddHandler fMeasureLabel.Click, AddressOf BFClick + 'AddHandler iNoteHeight.ValueChanged, AddressOf BIValueChanged + 'AddHandler iLabelVerticalShift.ValueChanged, AddressOf BIValueChanged + 'AddHandler iLabelHorizShift.ValueChanged, AddressOf BIValueChanged + 'AddHandler iLongNoteLabelHorizShift.ValueChanged, AddressOf BIValueChanged + 'AddHandler iHiddenNoteOpacity.ValueChanged, AddressOf BIValueChanged + + '----------------------------------------------- + 'Page 1----------------------------------------- + '----------------------------------------------- + + ''Width + 'For xI1 = 0 To niB + ' Dim xjWidth As New NumericUpDown + ' With xjWidth + ' .BorderStyle = BorderStyle.FixedSingle + ' .Location = New Point(lLeft(xI1), 12) + ' .Maximum = 99 + ' .Size = New Size(33, 23) + ' .Value = lWidth(xI1) + ' .Tag = xI1 + ' End With + ' Panel1.Controls.Add(xjWidth) + ' jWidth.Add(xjWidth) + ' AddHandler xjWidth.ValueChanged, AddressOf WidthChanged + 'Next + ' + ''Title + 'For xI1 = 0 To niB + ' Dim xjTitle As New TextBox + ' With xjTitle + ' .BorderStyle = BorderStyle.FixedSingle + ' .Location = New Point(lLeft(xI1), 34) + ' .Size = New Size(33, 23) + ' .Text = lTitle(xI1) + ' .Tag = xI1 + ' End With + ' Panel1.Controls.Add(xjTitle) + ' jTitle.Add(xjTitle) + ' AddHandler xjTitle.TextChanged, AddressOf TitleChanged + 'Next + ' + ''Color + 'For xI1 = 0 To niB + ' Dim xjColor As New Button + ' With xjColor + ' .FlatStyle = FlatStyle.Popup + ' .Font = New Font("Consolas", 9) + ' .Location = New Point(lLeft(xI1), 63) + ' .Size = New Size(33, 66) + ' .BackColor = lColor(xI1) + ' .ForeColor = lForeColor(xI1) + ' .Text = To4Hex(lColor(xI1).ToArgb) + ' .Tag = xI1 + ' End With + ' Panel1.Controls.Add(xjColor) + ' jColor.Add(xjColor) + ' AddHandler xjColor.Click, AddressOf B1Click + 'Next + ' + ''ForeColor + 'For xI1 = 0 To niB + ' Dim xjColor As New Button + ' With xjColor + ' .FlatStyle = FlatStyle.Popup + ' .Font = New Font("Consolas", 9) + ' .Location = New Point(lLeft(xI1), 128) + ' .Size = New Size(33, 66) + ' .BackColor = lColor(xI1) + ' .ForeColor = lForeColor(xI1) + ' .Text = To4Hex(lForeColor(xI1).ToArgb) + ' .Tag = xI1 + ' End With + ' Panel1.Controls.Add(xjColor) + ' jForeColor.Add(xjColor) + ' AddHandler xjColor.Click, AddressOf B2Click + 'Next + ' + ''ColorL + 'For xI1 = 0 To niB + ' Dim xjColor As New Button + ' With xjColor + ' .FlatStyle = FlatStyle.Popup + ' .Font = New Font("Consolas", 9) + ' .Location = New Point(lLeft(xI1), 193) + ' .Size = New Size(33, 66) + ' .BackColor = lColorL(xI1) + ' .ForeColor = lForeColorL(xI1) + ' .Text = To4Hex(lColorL(xI1).ToArgb) + ' .Tag = xI1 + ' End With + ' Panel1.Controls.Add(xjColor) + ' jColorL.Add(xjColor) + ' AddHandler xjColor.Click, AddressOf B3Click + 'Next + ' + ''ForeColorL + 'For xI1 = 0 To niB + ' Dim xjColor As New Button + ' With xjColor + ' .FlatStyle = FlatStyle.Popup + ' .Font = New Font("Consolas", 9) + ' .Location = New Point(lLeft(xI1), 258) + ' .Size = New Size(33, 66) + ' .BackColor = lColorL(xI1) + ' .ForeColor = lForeColorL(xI1) + ' .Text = To4Hex(lForeColorL(xI1).ToArgb) + ' .Tag = xI1 + ' End With + ' Panel1.Controls.Add(xjColor) + ' jForeColorL.Add(xjColor) + ' AddHandler xjColor.Click, AddressOf B4Click + 'Next + ' + ''BgColor + 'For xI1 = 0 To niB + ' Dim xjColor As New Button + ' With xjColor + ' .FlatStyle = FlatStyle.Popup + ' .Font = New Font("Consolas", 9) + ' .Location = New Point(lLeft(xI1), 323) + ' .Size = New Size(33, 66) + ' .BackColor = lBg(xI1) + ' .ForeColor = IIf(lBg(xI1).GetBrightness + (255 - lBg(xI1).A) / 255 >= 0.5, Color.Black, Color.White) + ' .Text = To4Hex(lBg(xI1).ToArgb) + ' .Tag = xI1 + ' End With + ' Panel1.Controls.Add(xjColor) + ' jBg.Add(xjColor) + ' AddHandler xjColor.Click, AddressOf B5Click + 'Next + + End Sub + + 'Private Sub rb1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) + ' Panel1.Visible = rb1.Checked + 'End Sub + ' + 'Private Sub rb2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) + ' Panel2.Visible = rb2.Checked + 'End Sub + ' + Private Sub BCClick(sender As Object, e As EventArgs) _ + Handles cColumnTitle.Click, _ + cBG.Click, _ + cGrid.Click, _ + cSub.Click, _ + cVerticalLine.Click, _ + cMeasureBarLine.Click, _ + cWaveForm.Click, _ + cMouseOver.Click, _ + cSelectedBorder.Click, _ + cAdjustLengthBorder.Click, _ + cSelectionBox.Click, _ + cTSCursor.Click, _ + cTSSplitter.Click, _ + cTSMouseOver.Click, _ + cTSSelectionFill.Click, _ + cTSBPM.Click + + 'Dim xI As Integer = Val(sender.Tag) + Dim s As Button = CType(sender, Button) + Dim xColorPicker As New ColorPicker + xColorPicker.SetOrigColor(s.BackColor) + If xColorPicker.ShowDialog(Me) = Forms.DialogResult.Cancel Then Exit Sub + + cButtonChange(s, xColorPicker.NewColor) + 'eColor(xI) = xColorPicker.NewColor + 'sender.Text = Hex(eColor(xI).ToArgb) + 'sender.BackColor = eColor(xI) + 'sender.ForeColor = IIf(eColor(xI).GetBrightness + (255 - eColor(xI).A) / 255 >= 0.5, Color.Black, Color.White) + End Sub + + Private Sub BFClick(sender As Object, e As EventArgs) _ + Handles fColumnTitle.Click, _ + fNoteLabel.Click, _ + fMeasureLabel.Click, _ + fTSBPM.Click + + 'Dim xI As Integer = Val(sender.Tag) + Dim s As Button = CType(sender, Button) + Dim xDFont As New FontDialog With { + .Font = s.Font + } + If xDFont.ShowDialog(Me) = Forms.DialogResult.Cancel Then Exit Sub + + fButtonChange(s, xDFont.Font) + 'eFont(xI) = xDFont.Font + 'sender.Text = eFont(xI).FontFamily.Name + 'sender.Font = eFont(xI) + End Sub + + 'Private Sub BIValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) + ' eI(Val(sender.Tag)) = sender.Value + 'End Sub + + 'Private Sub WidthChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) + ' lWidth(Val(sender.Tag)) = sender.Value + 'End Sub + 'Private Sub TitleChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) + ' lTitle(Val(sender.Tag)) = sender.Text + 'End Sub + 'Private Sub B1Click(ByVal sender As System.Object, ByVal e As System.EventArgs) + ' Dim xColorPicker As New ColorPicker + ' Dim xI As Integer = Val(sender.Tag) + ' + ' xColorPicker.SetOrigColor(lColor(xI)) + ' If xColorPicker.ShowDialog(Me) = Windows.Forms.DialogResult.Cancel Then Exit Sub + ' lColor(xI) = xColorPicker.NewColor + ' sender.Text = To4Hex(lColor(xI).ToArgb) + ' sender.BackColor = lColor(xI) + ' jForeColor(xI).Backcolor = lColor(xI) + 'End Sub + 'Private Sub B2Click(ByVal sender As System.Object, ByVal e As System.EventArgs) + ' Dim xColorPicker As New ColorPicker + ' Dim xI As Integer = Val(sender.Tag) + ' + ' xColorPicker.SetOrigColor(lForeColor(xI)) + ' If xColorPicker.ShowDialog(Me) = Windows.Forms.DialogResult.Cancel Then Exit Sub + ' lForeColor(xI) = xColorPicker.NewColor + ' sender.Text = To4Hex(lForeColor(xI).ToArgb) + ' sender.ForeColor = lForeColor(xI) + ' jColor(xI).ForeColor = lForeColor(xI) + 'End Sub + 'Private Sub B3Click(ByVal sender As System.Object, ByVal e As System.EventArgs) + ' Dim xColorPicker As New ColorPicker + ' Dim xI As Integer = Val(sender.Tag) + ' + ' xColorPicker.SetOrigColor(lColorL(xI)) + ' If xColorPicker.ShowDialog(Me) = Windows.Forms.DialogResult.Cancel Then Exit Sub + ' lColorL(xI) = xColorPicker.NewColor + ' sender.Text = To4Hex(lColorL(xI).ToArgb) + ' sender.BackColor = lColorL(xI) + ' jForeColorL(xI).Backcolor = lColorL(xI) + 'End Sub + 'Private Sub B4Click(ByVal sender As System.Object, ByVal e As System.EventArgs) + ' Dim xColorPicker As New ColorPicker + ' Dim xI As Integer = Val(sender.Tag) + ' + ' xColorPicker.SetOrigColor(lForeColorL(xI)) + ' If xColorPicker.ShowDialog(Me) = Windows.Forms.DialogResult.Cancel Then Exit Sub + ' lForeColorL(xI) = xColorPicker.NewColor + ' sender.Text = To4Hex(lForeColorL(xI).ToArgb) + ' sender.ForeColor = lForeColorL(xI) + ' jColorL(xI).ForeColor = lForeColorL(xI) + 'End Sub + 'Private Sub B5Click(ByVal sender As System.Object, ByVal e As System.EventArgs) + ' Dim xColorPicker As New ColorPicker + ' Dim xI As Integer = Val(sender.Tag) + ' + ' xColorPicker.SetOrigColor(lBg(xI)) + ' If xColorPicker.ShowDialog(Me) = Windows.Forms.DialogResult.Cancel Then Exit Sub + ' lBg(xI) = xColorPicker.NewColor + ' sender.Text = To4Hex(lBg(xI).ToArgb) + ' sender.BackColor = lBg(xI) + ' sender.ForeColor = IIf(lBg(xI).GetBrightness + (255 - lBg(xI).A) / 255 >= 0.5, Color.Black, Color.White) + 'End Sub + Private Sub ButtonClick(sender As Object, e As EventArgs) + 'Dim xI As Integer = Val(sender.Tag) + Dim s As Button = CType(sender, Button) + Dim xColorPicker As New ColorPicker + + 'xColorPicker.SetOrigColor(lColor(xI)) + If s.Name = "cText" Then xColorPicker.SetOrigColor(s.ForeColor) _ + Else xColorPicker.SetOrigColor(s.BackColor) + + If xColorPicker.ShowDialog(Me) = Forms.DialogResult.Cancel Then Exit Sub + + s.Text = To4Hex(xColorPicker.NewColor.ToArgb) + Select Case s.Name + Case "cNote" + s.BackColor = xColorPicker.NewColor + CType(s.Tag, Button).BackColor = xColorPicker.NewColor + Case "cText" + s.ForeColor = xColorPicker.NewColor + CType(s.Tag, Button).ForeColor = xColorPicker.NewColor + Case "cBG" + s.BackColor = xColorPicker.NewColor + s.ForeColor = IIf(CInt(xColorPicker.NewColor.GetBrightness * 255) + 255 - xColorPicker.NewColor.A >= 128, Color.Black, Color.White) + End Select + 'lColor(xI) = xColorPicker.NewColor + 'sender.Text = To4Hex(lColor(xI).ToArgb) + 'sender.BackColor = lColor(xI) + 'jForeColor(xI).Backcolor = lColor(xI) + End Sub + + Private Function ColorArrayToIntArray(xC() As Color) As Integer() + Dim xI(UBound(xC)) As Integer + For xI1 As Integer = 0 To UBound(xI) + xI(xI1) = xC(xI1).ToArgb + Next + Return xI + End Function + + Private Function To4Hex(xInt As Integer) As String + Dim xCl As Color = Color.FromArgb(xInt) + Return Hex(xCl.A) & vbCrLf & Hex(xCl.R) & vbCrLf & Hex(xCl.G) & vbCrLf & Hex(xCl.B) + End Function End Class diff --git a/iBMSC/PanelDraw.vb b/iBMSC/PanelDraw.vb index 0097c01a3..f6f9c2b3e 100644 --- a/iBMSC/PanelDraw.vb +++ b/iBMSC/PanelDraw.vb @@ -2,733 +2,733 @@ Partial Public Class MainWindow - Private Sub RefreshPanelAll() - If IsInitializing Then Exit Sub - RefreshPanel(0, PMainInL.DisplayRectangle) - RefreshPanel(1, PMainIn.DisplayRectangle) - RefreshPanel(2, PMainInR.DisplayRectangle) - End Sub - - Private bufferlist As New Dictionary(Of Integer, BufferedGraphics) - Private rectList As New Dictionary(Of Integer, Rectangle) - Private Function GetBuffer(xIndex As Integer, DisplayRect As Rectangle) - If bufferlist.ContainsKey(xIndex) AndAlso rectList.Item(xIndex) = DisplayRect Then - Return bufferlist.Item(xIndex) - Else - If bufferlist.ContainsKey(xIndex) Then - bufferlist.Item(xIndex).Dispose() - Dim unused1 = bufferlist.Remove(xIndex) - Dim unused = rectList.Remove(xIndex) - End If - - Dim gfx = BufferedGraphicsManager.Current.Allocate(spMain(xIndex).CreateGraphics, DisplayRect) - bufferlist.Add(xIndex, gfx) - rectList.Add(xIndex, DisplayRect) - Return gfx - End If - End Function - - Private Sub RefreshPanel(xIndex As Integer, DisplayRect As Rectangle) - If WindowState = FormWindowState.Minimized Then Return - If DisplayRect.Width <= 0 Or DisplayRect.Height <= 0 Then Return - 'If spMain.Count = 0 Then Return - 'Dim currentContext As BufferedGraphicsContext = BufferedGraphicsManager.Current - Dim e1 As BufferedGraphics = GetBuffer(xIndex, DisplayRect) - e1.Graphics.FillRectangle(vo.Bg, DisplayRect) - - Dim xTHeight As Integer = spMain(xIndex).Height - Dim xTWidth As Integer = spMain(xIndex).Width - Dim xPanelhBMSCROLL As Integer = PanelhBMSCROLL(xIndex) - Dim xPanelDisplacement As Integer = PanelVScroll(xIndex) - Dim xVSR As Integer = -PanelVScroll(xIndex) - Dim xVSu As Integer = IIf(xVSR + (xTHeight / gxHeight) > GetMaxVPosition(), GetMaxVPosition(), xVSR + (xTHeight / gxHeight)) - - 'e1.Graphics.SmoothingMode = Drawing2D.SmoothingMode.AntiAlias - Dim xI1 As Integer - - 'Bg color - DrawBackgroundColor(e1, xTHeight, xTWidth, xPanelhBMSCROLL, xI1) - - xI1 = DrawPanelLines(e1, xTHeight, xTWidth, xPanelhBMSCROLL, xPanelDisplacement, xVSu) - - 'Column Caption - xI1 = DrawColumnCaptions(e1, xTWidth, xPanelhBMSCROLL, xI1) - - 'WaveForm - DrawWaveform(e1, xTHeight, xVSR, xI1) - - 'K - 'If Not K Is Nothing Then - DrawNotes(e1, xTHeight, xPanelhBMSCROLL, xPanelDisplacement) - - 'End If - - 'Selection Box - DrawSelectionBox(xIndex, e1) - - 'Mouse Over - If TBSelect.Checked AndAlso Not KMouseOver = -1 Then - DrawMouseOver(e1, xTHeight, xPanelhBMSCROLL, xPanelDisplacement) - End If - - If ShouldDrawTempNote AndAlso (SelectedColumn > -1 And TempVPosition > -1) Then - DrawTempNote(e1, xTHeight, xPanelhBMSCROLL, xPanelDisplacement) - End If - - 'Time Selection - If TBTimeSelect.Checked Then - DrawTimeSelection(e1, xTHeight, xTWidth, xPanelhBMSCROLL, xPanelDisplacement) - End If - - 'Middle button: CLick and Scroll - If MiddleButtonClicked Then - e1 = DrawClickAndScroll(xIndex, e1) - End If - - 'Drag/Drop - DrawDragAndDrop(xIndex, e1) - - e1.Render(spMain(xIndex).CreateGraphics) - 'e1.Dispose() - End Sub - - Private Sub DrawTempNote(e1 As BufferedGraphics, xTHeight As Integer, xHS As Integer, xVS As Integer) - Dim xAlpha As Single = 1.0F - If ModifierHiddenActive() Then - xAlpha = vo.kOpacity - End If - - Dim xText As String - If IsColumnNumeric(SelectedColumn) Then - xText = GetColumn(SelectedColumn).Title - ElseIf IsColumnSound(SelectedColumn) Then - xText = C10to36(LWAV.SelectedIndex + 1) - Else - xText = C10to36(LBMP.SelectedIndex + 1) - End If - - Dim xPen As Pen - Dim xBrush As Drawing2D.LinearGradientBrush - Dim xBrush2 As SolidBrush - Dim point1 As New Point(HorizontalPositiontoDisplay(nLeft(SelectedColumn), xHS), - NoteRowToPanelHeight(TempVPosition, xVS, xTHeight) - vo.kHeight - 10) - Dim point2 As New Point(HorizontalPositiontoDisplay(nLeft(SelectedColumn) + GetColumnWidth(SelectedColumn), xHS), - NoteRowToPanelHeight(TempVPosition, xVS, xTHeight) + 10) - - Dim bright As Color - Dim dark As Color - If NTInput Or Not ModifierLongNoteActive() Then - xPen = New Pen(GetColumn(SelectedColumn).getBright(xAlpha)) - bright = GetColumn(SelectedColumn).getBright(xAlpha) - dark = GetColumn(SelectedColumn).getDark(xAlpha) - - xBrush2 = New SolidBrush(GetColumn(SelectedColumn).cText) - Else - xPen = New Pen(GetColumn(SelectedColumn).getLongBright(xAlpha)) - bright = GetColumn(SelectedColumn).getLongBright(xAlpha) - dark = GetColumn(SelectedColumn).getLongDark(xAlpha) - - xBrush2 = New SolidBrush(GetColumn(SelectedColumn).cLText) - End If - - ' Temp landmine - If ModifierLandmineActive() Then - bright = Color.Red - dark = Color.Red - End If - - xBrush = New Drawing2D.LinearGradientBrush(point1, point2, bright, dark) - - e1.Graphics.FillRectangle(xBrush, HorizontalPositiontoDisplay(nLeft(SelectedColumn), xHS) + 2, - NoteRowToPanelHeight(TempVPosition, xVS, xTHeight) - vo.kHeight + 1, - (GetColumnWidth(SelectedColumn) * gxWidth) - 3, - vo.kHeight - 1) - e1.Graphics.DrawRectangle(xPen, - HorizontalPositiontoDisplay(nLeft(SelectedColumn), xHS) + 1, - NoteRowToPanelHeight(TempVPosition, xVS, xTHeight) - vo.kHeight, - (GetColumnWidth(SelectedColumn) * gxWidth) - 2, - vo.kHeight) - - e1.Graphics.DrawString(xText, vo.kFont, xBrush2, - HorizontalPositiontoDisplay(nLeft(SelectedColumn), xHS) + vo.kLabelHShiftL - 2, - NoteRowToPanelHeight(TempVPosition, xVS, xTHeight) - vo.kHeight + vo.kLabelVShift) - End Sub - - Private Sub DrawDragAndDrop(xIndex As Integer, e1 As BufferedGraphics) - If UBound(DDFileName) > -1 Then - 'Dim xFont As New Font("Cambria", 12) - Dim xBrush As New SolidBrush(Color.FromArgb(&HC0FFFFFF)) - Dim xCenterX As Single = spMain(xIndex).DisplayRectangle.Width / 2 - Dim xCenterY As Single = spMain(xIndex).DisplayRectangle.Height / 2 - Dim xFormat As New StringFormat With { - .Alignment = StringAlignment.Center, - .LineAlignment = StringAlignment.Center - } - e1.Graphics.DrawString(Join(DDFileName, vbCrLf), Font, xBrush, spMain(xIndex).DisplayRectangle, xFormat) - End If - End Sub - - Private Sub DrawSelectionBox(xIndex As Integer, e1 As BufferedGraphics) - If TBSelect.Checked AndAlso xIndex = PanelFocus AndAlso Not (pMouseMove = New Point(-1, -1) Or LastMouseDownLocation = New Point(-1, -1)) Then - e1.Graphics.DrawRectangle(vo.SelBox, IIf(pMouseMove.X > LastMouseDownLocation.X, LastMouseDownLocation.X, pMouseMove.X), - IIf(pMouseMove.Y > LastMouseDownLocation.Y, LastMouseDownLocation.Y, pMouseMove.Y), - Math.Abs(pMouseMove.X - LastMouseDownLocation.X), Math.Abs(pMouseMove.Y - LastMouseDownLocation.Y)) - End If - End Sub - - Public Function GetColumnHighlightColor(col As Color, Optional factor As Double = 2.0) - Dim clamp = Function(x) IIf(x > 255, 255, x) - Return Color.FromArgb( - clamp(col.A * factor), - clamp(col.R * factor), - clamp(col.G * factor), - clamp(col.B * factor)) - End Function - - Private Sub DrawBackgroundColor(e1 As BufferedGraphics, xTHeight As Integer, xTWidth As Integer, xHS As Integer, xI1 As Integer) - If gShowBG Then - For xI1 = 0 To gColumns - If (nLeft(xI1 + 1) * gxWidth) - (xHS * gxWidth) + 1 < 0 Then Continue For - If (nLeft(xI1) * gxWidth) - (xHS * gxWidth) + 1 > xTWidth Then Exit For - If Not GetColumn(xI1).cBG.GetBrightness = 0 And GetColumnWidth(xI1) > 0 Then - Dim col = GetColumn(xI1).cBG - If xI1 = GetColumnAtX(MouseMoveStatus.X, xHS) Then - col = GetColumnHighlightColor(col) - End If - Dim brush = New SolidBrush(col) - - e1.Graphics.FillRectangle(brush, - (nLeft(xI1) * gxWidth) - (xHS * gxWidth) + 1, - 0, - GetColumnWidth(xI1) * gxWidth, - xTHeight) - End If - Next - End If - End Sub - - Private Function DrawColumnCaptions(e1 As BufferedGraphics, xTWidth As Integer, xHS As Integer, xI1 As Integer) As Integer - If gShowC Then - For xI1 = 0 To gColumns - If (nLeft(xI1 + 1) * gxWidth) - (xHS * gxWidth) + 1 < 0 Then Continue For - If (nLeft(xI1) * gxWidth) - (xHS * gxWidth) + 1 > xTWidth Then Exit For - If GetColumnWidth(xI1) > 0 Then e1.Graphics.DrawString(nTitle(xI1), vo.ColumnTitleFont, vo.ColumnTitle, (nLeft(xI1) * gxWidth) - (xHS * gxWidth), 0) - Next - End If - - Return xI1 - End Function - - Private Function DrawPanelLines(e1 As BufferedGraphics, - xTHeight As Integer, xTWidth As Integer, - xHS As Integer, xVS As Integer, - xVSu As Integer) As Integer - 'Vertical line - If gShowVerticalLine Then - For xI1 = 0 To gColumns - Dim xpos = (nLeft(xI1) * gxWidth) - (xHS * gxWidth) - If xpos + 1 < 0 Then Continue For - If xpos + 1 > xTWidth Then Exit For - If GetColumnWidth(xI1) > 0 Then e1.Graphics.DrawLine(vo.pVLine, - xpos, 0, - xpos, xTHeight) - Next - End If - - 'Grid, Sub, Measure - Dim Measure - For Measure = MeasureAtDisplacement(-xVS) To MeasureAtDisplacement(xVSu) - 'grid - If gShowGrid Then DrawGridLines(e1, - xTHeight, xTWidth, - xVS, Measure, - gDivide, vo.pGrid) - - 'sub - If gShowSubGrid Then DrawGridLines(e1, - xTHeight, xTWidth, - xVS, Measure, - gSub, vo.pSub) - - - 'measure and measurebar - Dim xCurr = MeasureBottom(Measure) - Dim Height = NoteRowToPanelHeight(xCurr, xVS, xTHeight) - If gShowMeasureBar Then e1.Graphics.DrawLine(vo.pMLine, 0, Height, - xTWidth, Height) - If gShowMeasureNumber Then e1.Graphics.DrawString("[" & Add3Zeros(Measure).ToString & "]", vo.kMFont, - New SolidBrush(GetColumn(0).cText), -xHS * gxWidth, - Height - vo.kMFont.Height) - Next - - Dim vpos = GetMouseVPosition(gSnap) - Dim mouseLineHeight = NoteRowToPanelHeight(vpos, xVS, xTHeight) - Dim p = New Pen(Color.White) - e1.Graphics.DrawLine(p, 0, mouseLineHeight, xTWidth, mouseLineHeight) - - Return Measure - End Function - - Private Sub DrawGridLines(e1 As BufferedGraphics, - xTHeight As Integer, xTWidth As Integer, - xVS As Integer, measureIndex As Integer, - divisions As Integer, pen As Pen) - Dim Line = 0 - Dim xUpper As Double = MeasureUpper(measureIndex) - Dim xCurr = MeasureBottom(measureIndex) - Dim xDiff = 192 / divisions - Do While xCurr < xUpper - Dim Height = NoteRowToPanelHeight(xCurr, xVS, xTHeight) - e1.Graphics.DrawLine(pen, 0, Height, - xTWidth, Height) - Line += 1 - xCurr = MeasureBottom(measureIndex) + (Line * xDiff) - Loop - End Sub - - Private Function IsNoteVisible(note As Note, xTHeight As Integer, xVS As Integer) As Boolean - Dim xUpperBorder As Single = Math.Abs(xVS) + (xTHeight / gxHeight) - Dim xLowerBorder As Single = Math.Abs(xVS) - (vo.kHeight / gxHeight) - - Dim AboveLower = note.VPosition >= xLowerBorder - Dim HeadBelow = note.VPosition <= xLowerBorder - Dim TailAbove = note.VPosition + note.Length >= xLowerBorder - Dim IntersectsNT = HeadBelow And TailAbove - Dim Intersecs = note.VPosition <= xLowerBorder And Notes(note.LNPair).VPosition >= xLowerBorder - Dim AboveUpper = note.VPosition > xUpperBorder - - Dim NoteInside = (Not AboveUpper) And AboveLower - - Return NoteInside OrElse IntersectsNT OrElse IntersectsNT - End Function - - Private Function IsNoteVisible(noteindex As Integer, xTHeight As Integer, xVS As Integer) As Boolean - Return IsNoteVisible(Notes(noteindex), xTHeight, xVS) - End Function - - Private Sub DrawNotes(e1 As BufferedGraphics, xTHeight As Integer, xHS As Integer, xVS As Integer) - Dim xI1 As Integer - Dim xUpperBorder As Single = Math.Abs(xVS) + (xTHeight / gxHeight) - Dim xLowerBorder As Single = Math.Abs(xVS) - (vo.kHeight / gxHeight) - - For xI1 = 0 To UBound(Notes) - If Notes(xI1).VPosition > xUpperBorder Then Exit For - If Not IsNoteVisible(xI1, xTHeight, xVS) Then Continue For - If NTInput Then - DrawNoteNT(Notes(xI1), e1, xHS, xVS, xTHeight) - Else - DrawNote(Notes(xI1), e1, xHS, xVS, xTHeight) - End If - Next - End Sub - - Private Function GetNoteRectangle(note As Note, xTHeight As Integer, xHS As Integer, xVS As Integer) As Rectangle - Dim xDispX As Integer = HorizontalPositiontoDisplay(nLeft(note.ColumnIndex), xHS) - - Dim xDispY As Integer = IIf(Not NTInput Or (bAdjustLength And Not bAdjustUpper), - NoteRowToPanelHeight(note.VPosition, xVS, xTHeight) - vo.kHeight - 1, - NoteRowToPanelHeight(note.VPosition + - note.Length, xVS, xTHeight) - - vo.kHeight - 1) - - Dim xDispW As Integer = (GetColumnWidth(note.ColumnIndex) * gxWidth) + 1 - Dim xDispH As Integer = IIf(Not NTInput Or bAdjustLength, - vo.kHeight + 3, - (note.Length * gxHeight) + vo.kHeight + 3) - - Return New Rectangle(xDispX, xDispY, xDispW, xDispH) - End Function - - Private Function GetNoteRectangle(noteIndex As Integer, xTHeight As Integer, xHS As Integer, xVS As Integer) As Rectangle - Return GetNoteRectangle(Notes(noteIndex), xTHeight, xHS, xVS) - End Function - - - Private Sub DrawMouseOver(e1 As BufferedGraphics, xTHeight As Integer, xHS As Integer, xVS As Integer) - If NTInput Then - If Not bAdjustLength Then DrawNoteNT(Notes(KMouseOver), e1, xHS, xVS, xTHeight) - Else - DrawNote(Notes(KMouseOver), e1, xHS, xVS, xTHeight) - End If - - Dim rect = GetNoteRectangle(KMouseOver, xTHeight, xHS, xVS) - Dim pen = IIf(bAdjustLength, vo.kMouseOverE, vo.kMouseOver) - Dim unused1 = e1.Graphics.DrawRectangle(pen, rect.X, rect.Y, rect.Width - 1, rect.Height - 1) - - If ModifierMultiselectActive() Then - For Each note In Notes - If IsNoteVisible(note, xTHeight, xVS) AndAlso IsLabelMatch(note, KMouseOver) Then - Dim nrect = GetNoteRectangle(note, xTHeight, xHS, xVS) - Dim unused = e1.Graphics.DrawRectangle(pen, nrect.X, nrect.Y, nrect.Width - 1, nrect.Height - 1) - End If - Next - End If - - End Sub - - Private Sub DrawTimeSelection(e1 As BufferedGraphics, xTHeight As Integer, xTWidth As Integer, xHS As Integer, xVS As Integer) - Dim xI1 As Integer - Dim xBPMStart = Notes(0).Value - Dim xBPMHalf = Notes(0).Value - Dim xBPMEnd = Notes(0).Value - - For xI1 = 1 To UBound(Notes) - If Notes(xI1).ColumnIndex = niBPM Then - If Notes(xI1).VPosition <= vSelStart Then xBPMStart = Notes(xI1).Value - If Notes(xI1).VPosition <= vSelStart + vSelHalf Then xBPMHalf = Notes(xI1).Value - If Notes(xI1).VPosition <= vSelStart + vSelLength Then xBPMEnd = Notes(xI1).Value - End If - If Notes(xI1).VPosition > vSelStart + vSelLength Then Exit For - Next - - 'Selection area - e1.Graphics.FillRectangle(vo.PESel, - 0, - NoteRowToPanelHeight(vSelStart + IIf(vSelLength > 0, vSelLength, 0), xVS, xTHeight) + Math.Abs(CInt(vSelLength <> 0)), - xTWidth, - CInt(Math.Abs(vSelLength) * gxHeight)) - 'End Cursor - e1.Graphics.DrawLine(vo.PECursor, - 0, - NoteRowToPanelHeight(vSelStart + vSelLength, xVS, xTHeight), - xTWidth, - NoteRowToPanelHeight(vSelStart + vSelLength, xVS, xTHeight)) - 'Half Cursor - e1.Graphics.DrawLine(vo.PEHalf, - 0, - NoteRowToPanelHeight(vSelStart + vSelHalf, xVS, xTHeight), - xTWidth, - NoteRowToPanelHeight(vSelStart + vSelHalf, xVS, xTHeight)) - 'Start BPM - e1.Graphics.DrawString(xBPMStart / 10000, - vo.PEBPMFont, vo.PEBPM, - (-xHS + nLeft(niBPM)) * gxWidth, - NoteRowToPanelHeight(vSelStart, xVS, xTHeight) - vo.PEBPMFont.Height + 3) - 'Half BPM - e1.Graphics.DrawString(xBPMHalf / 10000, - vo.PEBPMFont, vo.PEBPM, - (-xHS + nLeft(niBPM)) * gxWidth, - NoteRowToPanelHeight(vSelStart + vSelHalf, xVS, xTHeight) - vo.PEBPMFont.Height + 3) - 'End BPM - e1.Graphics.DrawString(xBPMEnd / 10000, - vo.PEBPMFont, vo.PEBPM, - (-xHS + nLeft(niBPM)) * gxWidth, - NoteRowToPanelHeight(vSelStart + vSelLength, xVS, xTHeight) - vo.PEBPMFont.Height + 3) - - 'SelLine - If vSelMouseOverLine = 1 Then 'Start Cursor - e1.Graphics.DrawRectangle(vo.PEMouseOver, - 0, NoteRowToPanelHeight(vSelStart, xVS, xTHeight) - 1, - xTWidth - 1, 2) - ElseIf vSelMouseOverLine = 2 Then 'Half Cursor - e1.Graphics.DrawRectangle(vo.PEMouseOver, - 0, NoteRowToPanelHeight(vSelStart + vSelHalf, xVS, xTHeight) - 1, - xTWidth - 1, 2) - ElseIf vSelMouseOverLine = 3 Then 'End Cursor - e1.Graphics.DrawRectangle(vo.PEMouseOver, - 0, NoteRowToPanelHeight(vSelStart + vSelLength, xVS, xTHeight) - 1, - xTWidth - 1, 2) - End If - End Sub - - Private Function DrawClickAndScroll(xIndex As Integer, e1 As BufferedGraphics) As BufferedGraphics - Dim xDeltaLocation As Point = spMain(xIndex).PointToScreen(New Point(0, 0)) - - Dim xInitX As Single = MiddleButtonLocation.X - xDeltaLocation.X - Dim xInitY As Single = MiddleButtonLocation.Y - xDeltaLocation.Y - Dim xCurrX As Single = Cursor.Position.X - xDeltaLocation.X - Dim xCurrY As Single = Cursor.Position.Y - xDeltaLocation.Y - Dim xAngle As Double = Math.Atan2(xCurrY - xInitY, xCurrX - xInitX) - e1.Graphics.SmoothingMode = Drawing2D.SmoothingMode.HighQuality - - If Not (xInitX = xCurrX And xInitY = xCurrY) Then - Dim xPointx() As PointF = {New PointF(xCurrX, xCurrY), - New PointF((Math.Cos(xAngle + (Math.PI / 2)) * 10) + xInitX, (Math.Sin(xAngle + (Math.PI / 2)) * 10) + xInitY), - New PointF((Math.Cos(xAngle - (Math.PI / 2)) * 10) + xInitX, (Math.Sin(xAngle - (Math.PI / 2)) * 10) + xInitY)} - e1.Graphics.FillPolygon(New Drawing2D.LinearGradientBrush(New Point(xInitX, xInitY), New Point(xCurrX, xCurrY), Color.FromArgb(0), Color.FromArgb(-1)), xPointx) - End If - - e1.Graphics.FillEllipse(Brushes.LightGray, xInitX - 10, xInitY - 10, 20, 20) - e1.Graphics.DrawEllipse(Pens.Black, xInitX - 8, xInitY - 8, 16, 16) - - e1.Graphics.SmoothingMode = Drawing2D.SmoothingMode.Default - Return e1 - End Function - - Private Sub DrawWaveform(e1 As BufferedGraphics, xTHeight As Integer, xVSR As Integer, xI1 As Integer) - If wWavL IsNot Nothing And wWavR IsNot Nothing And wPrecision > 0 Then - If wLock Then - For xI0 As Integer = 1 To UBound(Notes) - If Notes(xI0).ColumnIndex >= niB Then wPosition = Notes(xI0).VPosition : Exit For - Next - End If - - Dim xPtsL(xTHeight * wPrecision) As PointF - Dim xPtsR(xTHeight * wPrecision) As PointF - - Dim xD1 As Double - - Dim bVPosition() As Double = {wPosition} - Dim bBPM() As Decimal = {Notes(0).Value / 10000} - Dim bWavDataIndex() As Decimal = {0} - - For xI1 = 1 To UBound(Notes) - If Notes(xI1).ColumnIndex = niBPM Then - If Notes(xI1).VPosition >= wPosition Then - ReDim Preserve bVPosition(UBound(bVPosition) + 1) - ReDim Preserve bBPM(UBound(bBPM) + 1) - ReDim Preserve bWavDataIndex(UBound(bWavDataIndex) + 1) - bVPosition(UBound(bVPosition)) = Notes(xI1).VPosition - bBPM(UBound(bBPM)) = Notes(xI1).Value / 10000 - bWavDataIndex(UBound(bWavDataIndex)) = ((Notes(xI1).VPosition - bVPosition(UBound(bVPosition) - 1)) * 1.25 * wSampleRate / bBPM(UBound(bBPM) - 1)) + bWavDataIndex(UBound(bWavDataIndex) - 1) - Else - bBPM(0) = Notes(xI1).Value / 10000 - End If - End If - Next - - Dim xI3 As Double - - For xI1 = xTHeight * wPrecision To 0 Step -1 - xI3 = ((-xI1 / wPrecision) + xTHeight + (xVSR * gxHeight) - 1) / gxHeight - - Dim xI2 As Integer - For xI2 = 1 To UBound(bVPosition) - If bVPosition(xI2) >= xI3 Then Exit For - Next - xI2 -= 1 - xD1 = bWavDataIndex(xI2) + ((xI3 - bVPosition(xI2)) * 1.25 * wSampleRate / bBPM(xI2)) - - If xD1 <= UBound(wWavL) And xD1 >= 0 Then - xPtsL(xI1) = New PointF((wWavL(Int(xD1)) * wWidth) + wLeft, xI1 / wPrecision) - xPtsR(xI1) = New PointF((wWavR(Int(xD1)) * wWidth) + wLeft, xI1 / wPrecision) - Else - xPtsL(xI1) = New PointF(wLeft, xI1 / wPrecision) - xPtsR(xI1) = New PointF(wLeft, xI1 / wPrecision) - End If - Next - e1.Graphics.DrawLines(vo.pBGMWav, xPtsL) - e1.Graphics.DrawLines(vo.pBGMWav, xPtsR) - End If - End Sub - - ''' - ''' Draw a note in a buffer. - ''' - ''' Note to be drawn. - ''' Buffer. - ''' HS.Value. - ''' VS.Value. - ''' Display height of the panel. (not ClipRectangle.Height) - - Private Sub DrawNote(sNote As Note, e As BufferedGraphics, xHS As Long, xVS As Long, xHeight As Integer) ', Optional ByVal CheckError As Boolean = True) ', Optional ByVal ConnectToIndex As Long = 0) - If Not nEnabled(sNote.ColumnIndex) Then Exit Sub - Dim xAlpha As Single = 1.0F - If sNote.Hidden Then xAlpha = vo.kOpacity - - Dim xLabel As String = C10to36(sNote.Value \ 10000) - If ShowFileName Then - If IsColumnSound(sNote.ColumnIndex) Then - If hWAV(C36to10(xLabel)) <> String.Empty Then xLabel = Path.GetFileNameWithoutExtension(hWAV(C36to10(xLabel))) - Else - If hBMP(C36to10(xLabel)) <> String.Empty Then xLabel = Path.GetFileNameWithoutExtension(hBMP(C36to10(xLabel))) - End If - End If - - Dim xPen As Pen - Dim xBrush As Drawing2D.LinearGradientBrush - Dim xBrush2 As SolidBrush - - Dim bright As Color - Dim dark As Color - Dim p1 = New Point(HorizontalPositiontoDisplay(nLeft(sNote.ColumnIndex), xHS), - NoteRowToPanelHeight(sNote.VPosition, xVS, xHeight) - vo.kHeight - 10) - Dim p2 = New Point(HorizontalPositiontoDisplay(nLeft(sNote.ColumnIndex) + GetColumnWidth(sNote.ColumnIndex), xHS), - NoteRowToPanelHeight(sNote.VPosition, xVS, xHeight) + 10) - - If Not sNote.LongNote Then - xPen = New Pen(GetColumn(sNote.ColumnIndex).getBright(xAlpha)) - - bright = GetColumn(sNote.ColumnIndex).getBright(xAlpha) - dark = GetColumn(sNote.ColumnIndex).getDark(xAlpha) - - If sNote.Landmine Then - bright = Color.Red - dark = Color.Red - End If - - xBrush2 = New SolidBrush(GetColumn(sNote.ColumnIndex).cText) - Else - bright = GetColumn(sNote.ColumnIndex).getLongBright(xAlpha) - dark = GetColumn(sNote.ColumnIndex).getLongDark(xAlpha) - - xBrush2 = New SolidBrush(GetColumn(sNote.ColumnIndex).cLText) - End If - - xPen = New Pen(bright) - xBrush = New Drawing2D.LinearGradientBrush(p1, p2, bright, dark) - - ' Fill - e.Graphics.FillRectangle(xBrush, HorizontalPositiontoDisplay(nLeft(sNote.ColumnIndex), xHS) + 2, - NoteRowToPanelHeight(sNote.VPosition, xVS, xHeight) - vo.kHeight + 1, - (GetColumnWidth(sNote.ColumnIndex) * gxWidth) - 3, - vo.kHeight - 1) - ' Outline - e.Graphics.DrawRectangle(xPen, - HorizontalPositiontoDisplay(nLeft(sNote.ColumnIndex), xHS) + 1, - NoteRowToPanelHeight(sNote.VPosition, xVS, xHeight) - vo.kHeight, - (GetColumnWidth(sNote.ColumnIndex) * gxWidth) - 2, - vo.kHeight) - - ' Label - Dim unused = e.Graphics.DrawString(IIf(IsColumnNumeric(sNote.ColumnIndex), sNote.Value / 10000, xLabel), - vo.kFont, xBrush2, - HorizontalPositiontoDisplay(nLeft(sNote.ColumnIndex), xHS) + vo.kLabelHShift, - NoteRowToPanelHeight(sNote.VPosition, xVS, xHeight) - vo.kHeight + vo.kLabelVShift) - - If sNote.ColumnIndex < niB Then - If sNote.LNPair <> 0 Then - DrawPairedLNBody(sNote, e, xHS, xVS, xHeight, xAlpha) - End If - End If - - - 'e.Graphics.DrawString(sNote.TimeOffset.ToString("0.##"), New Font("Verdana", 9), Brushes.Cyan, _ - ' New Point(HorizontalPositiontoDisplay(nLeft(sNote.ColumnIndex + 1), xHS), VerticalPositiontoDisplay(sNote.VPosition, xVS, xHeight) - vo.kHeight - 2)) - - 'If ErrorCheck AndAlso (sNote.LongNote Xor sNote.PairWithI <> 0) Then e.Graphics.DrawImage(My.Resources.ImageError, _ - If ErrorCheck AndAlso sNote.HasError Then e.Graphics.DrawImage(My.Resources.ImageError, - HorizontalPositiontoDisplay(nLeft(sNote.ColumnIndex) + (GetColumnWidth(sNote.ColumnIndex) / 2), xHS) - 12, - CInt(NoteRowToPanelHeight(sNote.VPosition, xVS, xHeight) - (vo.kHeight / 2) - 12), - 24, 24) - - If sNote.Selected Then e.Graphics.DrawRectangle(vo.kSelected, HorizontalPositiontoDisplay(nLeft(sNote.ColumnIndex), xHS), NoteRowToPanelHeight(sNote.VPosition, xVS, xHeight) - vo.kHeight - 1, GetColumnWidth(sNote.ColumnIndex) * gxWidth, vo.kHeight + 2) - - End Sub - - Private Sub DrawPairedLNBody(sNote As Note, e As BufferedGraphics, xHS As Long, xVS As Long, xHeight As Integer, xAlpha As Single) - Dim xPen2 As New Pen(GetColumn(sNote.ColumnIndex).getLongBright(xAlpha)) - Dim xBrush3 As New Drawing2D.LinearGradientBrush( - New Point(HorizontalPositiontoDisplay(nLeft(sNote.ColumnIndex) - (0.5 * GetColumnWidth(sNote.ColumnIndex)), xHS), - NoteRowToPanelHeight(Notes(sNote.LNPair).VPosition, xVS, xHeight)), - New Point(HorizontalPositiontoDisplay(nLeft(sNote.ColumnIndex) + (1.5 * GetColumnWidth(sNote.ColumnIndex)), xHS), - NoteRowToPanelHeight(sNote.VPosition, xVS, xHeight) + vo.kHeight), - GetColumn(sNote.ColumnIndex).getLongBright(xAlpha), - GetColumn(sNote.ColumnIndex).getLongDark(xAlpha)) - e.Graphics.FillRectangle(xBrush3, HorizontalPositiontoDisplay(nLeft(Notes(sNote.LNPair).ColumnIndex), xHS) + 3, NoteRowToPanelHeight(Notes(sNote.LNPair).VPosition, xVS, xHeight) + 1, - (GetColumnWidth(Notes(sNote.LNPair).ColumnIndex) * gxWidth) - 5, NoteRowToPanelHeight(sNote.VPosition, xVS, xHeight) - NoteRowToPanelHeight(Notes(sNote.LNPair).VPosition, xVS, xHeight) - vo.kHeight - 1) - e.Graphics.DrawRectangle(xPen2, HorizontalPositiontoDisplay(nLeft(Notes(sNote.LNPair).ColumnIndex), xHS) + 2, NoteRowToPanelHeight(Notes(sNote.LNPair).VPosition, xVS, xHeight), - (GetColumnWidth(Notes(sNote.LNPair).ColumnIndex) * gxWidth) - 4, NoteRowToPanelHeight(sNote.VPosition, xVS, xHeight) - NoteRowToPanelHeight(Notes(sNote.LNPair).VPosition, xVS, xHeight) - vo.kHeight) - End Sub - - ''' - ''' Draw a note in a buffer under NT mode. - ''' - ''' Note to be drawn. - ''' Buffer. - ''' HS.Value. - ''' VS.Value. - ''' Display height of the panel. (not ClipRectangle.Height) - - Private Sub DrawNoteNT(sNote As Note, e As BufferedGraphics, xHS As Long, xVS As Long, xHeight As Integer) ', Optional ByVal CheckError As Boolean = True) - If Not nEnabled(sNote.ColumnIndex) Then Exit Sub - Dim xAlpha As Single = 1.0F - If sNote.Hidden Then xAlpha = vo.kOpacity - - Dim xLabel As String = C10to36(sNote.Value \ 10000) - If ShowFileName Then - If IsColumnSound(sNote.ColumnIndex) Then - If hWAV(C36to10(xLabel)) <> String.Empty Then xLabel = Path.GetFileNameWithoutExtension(hWAV(C36to10(xLabel))) - Else - If hBMP(C36to10(xLabel)) <> String.Empty Then xLabel = Path.GetFileNameWithoutExtension(hBMP(C36to10(xLabel))) - End If - End If - - Dim xPen1 As Pen - Dim xBrush As Drawing2D.LinearGradientBrush - Dim xBrush2 As SolidBrush - - Dim p1 As Point - Dim p2 As Point - Dim bright As Color - Dim dark As Color - - If sNote.Length = 0 Then - p1 = New Point(HorizontalPositiontoDisplay(nLeft(sNote.ColumnIndex), xHS), - NoteRowToPanelHeight(sNote.VPosition, xVS, xHeight) - vo.kHeight - 10) - - p2 = New Point(HorizontalPositiontoDisplay(nLeft(sNote.ColumnIndex) + GetColumnWidth(sNote.ColumnIndex), xHS), - NoteRowToPanelHeight(sNote.VPosition, xVS, xHeight) + 10) - - bright = GetColumn(sNote.ColumnIndex).getBright(xAlpha) - dark = GetColumn(sNote.ColumnIndex).getDark(xAlpha) - - If sNote.Landmine Then - bright = Color.Red - dark = Color.Red - End If - - xBrush2 = New SolidBrush(GetColumn(sNote.ColumnIndex).cText) - Else - p1 = New Point(HorizontalPositiontoDisplay(nLeft(sNote.ColumnIndex) - (0.5 * GetColumnWidth(sNote.ColumnIndex)), xHS), - NoteRowToPanelHeight(sNote.VPosition + sNote.Length, xVS, xHeight) - vo.kHeight) - p2 = New Point(HorizontalPositiontoDisplay(nLeft(sNote.ColumnIndex) + (1.5 * GetColumnWidth(sNote.ColumnIndex)), xHS), - NoteRowToPanelHeight(sNote.VPosition, xVS, xHeight)) - - bright = GetColumn(sNote.ColumnIndex).getLongBright(xAlpha) - dark = GetColumn(sNote.ColumnIndex).getLongDark(xAlpha) - - xBrush2 = New SolidBrush(GetColumn(sNote.ColumnIndex).cLText) - End If - - xPen1 = New Pen(bright) - xBrush = New Drawing2D.LinearGradientBrush(p1, p2, bright, dark) - - ' Note gradient - e.Graphics.FillRectangle(xBrush, - HorizontalPositiontoDisplay(nLeft(sNote.ColumnIndex), xHS) + 1, - NoteRowToPanelHeight(sNote.VPosition + sNote.Length, xVS, xHeight) - vo.kHeight + 1, - (GetColumnWidth(sNote.ColumnIndex) * gxWidth) - 1, - CInt(sNote.Length * gxHeight) + vo.kHeight - 1) - - ' Outline - e.Graphics.DrawRectangle(xPen1, HorizontalPositiontoDisplay(nLeft(sNote.ColumnIndex), xHS) + 1, - NoteRowToPanelHeight(sNote.VPosition + sNote.Length, xVS, xHeight) - vo.kHeight, - (GetColumnWidth(sNote.ColumnIndex) * gxWidth) - 3, CInt(sNote.Length * gxHeight) + vo.kHeight) - - ' Note B36 - Dim unused = e.Graphics.DrawString(IIf(IsColumnNumeric(sNote.ColumnIndex), sNote.Value / 10000, xLabel), - vo.kFont, xBrush2, - HorizontalPositiontoDisplay(nLeft(sNote.ColumnIndex), xHS) + vo.kLabelHShiftL - 2, - NoteRowToPanelHeight(sNote.VPosition, xVS, xHeight) - vo.kHeight + vo.kLabelVShift) - - ' Draw paired body - If sNote.ColumnIndex < niB Then - If sNote.Length = 0 And sNote.LNPair <> 0 Then - DrawPairedLNBody(sNote, e, xHS, xVS, xHeight, xAlpha) - End If - End If - - - ' Select Box - If sNote.Selected Then - e.Graphics.DrawRectangle(vo.kSelected, - HorizontalPositiontoDisplay(nLeft(sNote.ColumnIndex), xHS), - NoteRowToPanelHeight(sNote.VPosition + sNote.Length, xVS, xHeight) - vo.kHeight - 1, - GetColumnWidth(sNote.ColumnIndex) * gxWidth, - CInt(sNote.Length * gxHeight) + vo.kHeight + 2) - End If - - ' Errors - If ErrorCheck AndAlso sNote.HasError Then - e.Graphics.DrawImage(My.Resources.ImageError, - HorizontalPositiontoDisplay(nLeft(sNote.ColumnIndex) + (GetColumnWidth(sNote.ColumnIndex) / 2), xHS) - 12, - CInt(NoteRowToPanelHeight(sNote.VPosition, xVS, xHeight) - (vo.kHeight / 2) - 12), - 24, 24) - End If - - 'e.Graphics.DrawString(sNote.TimeOffset.ToString("0.##"), New Font("Verdana", 9), Brushes.Cyan, _ - ' New Point(HorizontalPositiontoDisplay(nLeft(sNote.ColumnIndex + 1), xHS), VerticalPositiontoDisplay(sNote.VPosition, xVS, xHeight) - vo.kHeight - 2)) - - End Sub + Private Sub RefreshPanelAll() + If IsInitializing Then Exit Sub + RefreshPanel(0, PMainInL.DisplayRectangle) + RefreshPanel(1, PMainIn.DisplayRectangle) + RefreshPanel(2, PMainInR.DisplayRectangle) + End Sub + + Private bufferlist As New Dictionary(Of Integer, BufferedGraphics) + Private rectList As New Dictionary(Of Integer, Rectangle) + Private Function GetBuffer(xIndex As Integer, DisplayRect As Rectangle) + If bufferlist.ContainsKey(xIndex) AndAlso rectList.Item(xIndex) = DisplayRect Then + Return bufferlist.Item(xIndex) + Else + If bufferlist.ContainsKey(xIndex) Then + bufferlist.Item(xIndex).Dispose() + Dim unused1 = bufferlist.Remove(xIndex) + Dim unused = rectList.Remove(xIndex) + End If + + Dim gfx = BufferedGraphicsManager.Current.Allocate(spMain(xIndex).CreateGraphics, DisplayRect) + bufferlist.Add(xIndex, gfx) + rectList.Add(xIndex, DisplayRect) + Return gfx + End If + End Function + + Private Sub RefreshPanel(xIndex As Integer, DisplayRect As Rectangle) + If WindowState = FormWindowState.Minimized Then Return + If DisplayRect.Width <= 0 Or DisplayRect.Height <= 0 Then Return + 'If spMain.Count = 0 Then Return + 'Dim currentContext As BufferedGraphicsContext = BufferedGraphicsManager.Current + Dim e1 As BufferedGraphics = GetBuffer(xIndex, DisplayRect) + e1.Graphics.FillRectangle(vo.Bg, DisplayRect) + + Dim xTHeight As Integer = spMain(xIndex).Height + Dim xTWidth As Integer = spMain(xIndex).Width + Dim xPanelhBMSCROLL As Integer = PanelhBMSCROLL(xIndex) + Dim xPanelDisplacement As Integer = PanelVScroll(xIndex) + Dim xVSR As Integer = -PanelVScroll(xIndex) + Dim xVSu As Integer = IIf(xVSR + (xTHeight / gxHeight) > GetMaxVPosition(), GetMaxVPosition(), xVSR + (xTHeight / gxHeight)) + + 'e1.Graphics.SmoothingMode = Drawing2D.SmoothingMode.AntiAlias + Dim xI1 As Integer + + 'Bg color + DrawBackgroundColor(e1, xTHeight, xTWidth, xPanelhBMSCROLL, xI1) + + xI1 = DrawPanelLines(e1, xTHeight, xTWidth, xPanelhBMSCROLL, xPanelDisplacement, xVSu) + + 'Column Caption + xI1 = DrawColumnCaptions(e1, xTWidth, xPanelhBMSCROLL, xI1) + + 'WaveForm + DrawWaveform(e1, xTHeight, xVSR, xI1) + + 'K + 'If Not K Is Nothing Then + DrawNotes(e1, xTHeight, xPanelhBMSCROLL, xPanelDisplacement) + + 'End If + + 'Selection Box + DrawSelectionBox(xIndex, e1) + + 'Mouse Over + If TBSelect.Checked AndAlso Not KMouseOver = -1 Then + DrawMouseOver(e1, xTHeight, xPanelhBMSCROLL, xPanelDisplacement) + End If + + If ShouldDrawTempNote AndAlso (SelectedColumn > -1 And TempVPosition > -1) Then + DrawTempNote(e1, xTHeight, xPanelhBMSCROLL, xPanelDisplacement) + End If + + 'Time Selection + If TBTimeSelect.Checked Then + DrawTimeSelection(e1, xTHeight, xTWidth, xPanelhBMSCROLL, xPanelDisplacement) + End If + + 'Middle button: CLick and Scroll + If MiddleButtonClicked Then + e1 = DrawClickAndScroll(xIndex, e1) + End If + + 'Drag/Drop + DrawDragAndDrop(xIndex, e1) + + e1.Render(spMain(xIndex).CreateGraphics) + 'e1.Dispose() + End Sub + + Private Sub DrawTempNote(e1 As BufferedGraphics, xTHeight As Integer, xHS As Integer, xVS As Integer) + Dim xAlpha As Single = 1.0F + If ModifierHiddenActive() Then + xAlpha = vo.kOpacity + End If + + Dim xText As String + If IsColumnNumeric(SelectedColumn) Then + xText = GetColumn(SelectedColumn).Title + ElseIf IsColumnSound(SelectedColumn) Then + xText = C10to36(LWAV.SelectedIndex + 1) + Else + xText = C10to36(LBMP.SelectedIndex + 1) + End If + + Dim xPen As Pen + Dim xBrush As Drawing2D.LinearGradientBrush + Dim xBrush2 As SolidBrush + Dim point1 As New Point(HorizontalPositiontoDisplay(nLeft(SelectedColumn), xHS), + NoteRowToPanelHeight(TempVPosition, xVS, xTHeight) - vo.kHeight - 10) + Dim point2 As New Point(HorizontalPositiontoDisplay(nLeft(SelectedColumn) + GetColumnWidth(SelectedColumn), xHS), + NoteRowToPanelHeight(TempVPosition, xVS, xTHeight) + 10) + + Dim bright As Color + Dim dark As Color + If NTInput Or Not ModifierLongNoteActive() Then + xPen = New Pen(GetColumn(SelectedColumn).getBright(xAlpha)) + bright = GetColumn(SelectedColumn).getBright(xAlpha) + dark = GetColumn(SelectedColumn).getDark(xAlpha) + + xBrush2 = New SolidBrush(GetColumn(SelectedColumn).cText) + Else + xPen = New Pen(GetColumn(SelectedColumn).getLongBright(xAlpha)) + bright = GetColumn(SelectedColumn).getLongBright(xAlpha) + dark = GetColumn(SelectedColumn).getLongDark(xAlpha) + + xBrush2 = New SolidBrush(GetColumn(SelectedColumn).cLText) + End If + + ' Temp landmine + If ModifierLandmineActive() Then + bright = Color.Red + dark = Color.Red + End If + + xBrush = New Drawing2D.LinearGradientBrush(point1, point2, bright, dark) + + e1.Graphics.FillRectangle(xBrush, HorizontalPositiontoDisplay(nLeft(SelectedColumn), xHS) + 2, + NoteRowToPanelHeight(TempVPosition, xVS, xTHeight) - vo.kHeight + 1, + (GetColumnWidth(SelectedColumn) * gxWidth) - 3, + vo.kHeight - 1) + e1.Graphics.DrawRectangle(xPen, + HorizontalPositiontoDisplay(nLeft(SelectedColumn), xHS) + 1, + NoteRowToPanelHeight(TempVPosition, xVS, xTHeight) - vo.kHeight, + (GetColumnWidth(SelectedColumn) * gxWidth) - 2, + vo.kHeight) + + e1.Graphics.DrawString(xText, vo.kFont, xBrush2, + HorizontalPositiontoDisplay(nLeft(SelectedColumn), xHS) + vo.kLabelHShiftL - 2, + NoteRowToPanelHeight(TempVPosition, xVS, xTHeight) - vo.kHeight + vo.kLabelVShift) + End Sub + + Private Sub DrawDragAndDrop(xIndex As Integer, e1 As BufferedGraphics) + If UBound(DDFileName) > -1 Then + 'Dim xFont As New Font("Cambria", 12) + Dim xBrush As New SolidBrush(Color.FromArgb(&HC0FFFFFF)) + Dim xCenterX As Single = spMain(xIndex).DisplayRectangle.Width / 2 + Dim xCenterY As Single = spMain(xIndex).DisplayRectangle.Height / 2 + Dim xFormat As New StringFormat With { + .Alignment = StringAlignment.Center, + .LineAlignment = StringAlignment.Center + } + e1.Graphics.DrawString(Join(DDFileName, vbCrLf), Font, xBrush, spMain(xIndex).DisplayRectangle, xFormat) + End If + End Sub + + Private Sub DrawSelectionBox(xIndex As Integer, e1 As BufferedGraphics) + If TBSelect.Checked AndAlso xIndex = PanelFocus AndAlso Not (pMouseMove = New Point(-1, -1) Or LastMouseDownLocation = New Point(-1, -1)) Then + e1.Graphics.DrawRectangle(vo.SelBox, IIf(pMouseMove.X > LastMouseDownLocation.X, LastMouseDownLocation.X, pMouseMove.X), + IIf(pMouseMove.Y > LastMouseDownLocation.Y, LastMouseDownLocation.Y, pMouseMove.Y), + Math.Abs(pMouseMove.X - LastMouseDownLocation.X), Math.Abs(pMouseMove.Y - LastMouseDownLocation.Y)) + End If + End Sub + + Public Function GetColumnHighlightColor(col As Color, Optional factor As Double = 2.0) + Dim clamp = Function(x) IIf(x > 255, 255, x) + Return Color.FromArgb( + clamp(col.A * factor), + clamp(col.R * factor), + clamp(col.G * factor), + clamp(col.B * factor)) + End Function + + Private Sub DrawBackgroundColor(e1 As BufferedGraphics, xTHeight As Integer, xTWidth As Integer, xHS As Integer, xI1 As Integer) + If gShowBG Then + For xI1 = 0 To gColumns + If (nLeft(xI1 + 1) * gxWidth) - (xHS * gxWidth) + 1 < 0 Then Continue For + If (nLeft(xI1) * gxWidth) - (xHS * gxWidth) + 1 > xTWidth Then Exit For + If Not GetColumn(xI1).cBG.GetBrightness = 0 And GetColumnWidth(xI1) > 0 Then + Dim col = GetColumn(xI1).cBG + If xI1 = GetColumnAtX(MouseMoveStatus.X, xHS) Then + col = GetColumnHighlightColor(col) + End If + Dim brush = New SolidBrush(col) + + e1.Graphics.FillRectangle(brush, + (nLeft(xI1) * gxWidth) - (xHS * gxWidth) + 1, + 0, + GetColumnWidth(xI1) * gxWidth, + xTHeight) + End If + Next + End If + End Sub + + Private Function DrawColumnCaptions(e1 As BufferedGraphics, xTWidth As Integer, xHS As Integer, xI1 As Integer) As Integer + If gShowC Then + For xI1 = 0 To gColumns + If (nLeft(xI1 + 1) * gxWidth) - (xHS * gxWidth) + 1 < 0 Then Continue For + If (nLeft(xI1) * gxWidth) - (xHS * gxWidth) + 1 > xTWidth Then Exit For + If GetColumnWidth(xI1) > 0 Then e1.Graphics.DrawString(nTitle(xI1), vo.ColumnTitleFont, vo.ColumnTitle, (nLeft(xI1) * gxWidth) - (xHS * gxWidth), 0) + Next + End If + + Return xI1 + End Function + + Private Function DrawPanelLines(e1 As BufferedGraphics, + xTHeight As Integer, xTWidth As Integer, + xHS As Integer, xVS As Integer, + xVSu As Integer) As Integer + 'Vertical line + If gShowVerticalLine Then + For xI1 = 0 To gColumns + Dim xpos = (nLeft(xI1) * gxWidth) - (xHS * gxWidth) + If xpos + 1 < 0 Then Continue For + If xpos + 1 > xTWidth Then Exit For + If GetColumnWidth(xI1) > 0 Then e1.Graphics.DrawLine(vo.pVLine, + xpos, 0, + xpos, xTHeight) + Next + End If + + 'Grid, Sub, Measure + Dim Measure + For Measure = MeasureAtDisplacement(-xVS) To MeasureAtDisplacement(xVSu) + 'grid + If gShowGrid Then DrawGridLines(e1, + xTHeight, xTWidth, + xVS, Measure, + gDivide, vo.pGrid) + + 'sub + If gShowSubGrid Then DrawGridLines(e1, + xTHeight, xTWidth, + xVS, Measure, + gSub, vo.pSub) + + + 'measure and measurebar + Dim xCurr = MeasureBottom(Measure) + Dim Height = NoteRowToPanelHeight(xCurr, xVS, xTHeight) + If gShowMeasureBar Then e1.Graphics.DrawLine(vo.pMLine, 0, Height, + xTWidth, Height) + If gShowMeasureNumber Then e1.Graphics.DrawString("[" & Add3Zeros(Measure).ToString & "]", vo.kMFont, + New SolidBrush(GetColumn(0).cText), -xHS * gxWidth, + Height - vo.kMFont.Height) + Next + + Dim vpos = GetMouseVPosition(gSnap) + Dim mouseLineHeight = NoteRowToPanelHeight(vpos, xVS, xTHeight) + Dim p = New Pen(Color.White) + e1.Graphics.DrawLine(p, 0, mouseLineHeight, xTWidth, mouseLineHeight) + + Return Measure + End Function + + Private Sub DrawGridLines(e1 As BufferedGraphics, + xTHeight As Integer, xTWidth As Integer, + xVS As Integer, measureIndex As Integer, + divisions As Integer, pen As Pen) + Dim Line = 0 + Dim xUpper As Double = MeasureUpper(measureIndex) + Dim xCurr = MeasureBottom(measureIndex) + Dim xDiff = 192 / divisions + Do While xCurr < xUpper + Dim Height = NoteRowToPanelHeight(xCurr, xVS, xTHeight) + e1.Graphics.DrawLine(pen, 0, Height, + xTWidth, Height) + Line += 1 + xCurr = MeasureBottom(measureIndex) + (Line * xDiff) + Loop + End Sub + + Private Function IsNoteVisible(note As Note, xTHeight As Integer, xVS As Integer) As Boolean + Dim xUpperBorder As Single = Math.Abs(xVS) + (xTHeight / gxHeight) + Dim xLowerBorder As Single = Math.Abs(xVS) - (vo.kHeight / gxHeight) + + Dim AboveLower = note.VPosition >= xLowerBorder + Dim HeadBelow = note.VPosition <= xLowerBorder + Dim TailAbove = note.VPosition + note.Length >= xLowerBorder + Dim IntersectsNT = HeadBelow And TailAbove + Dim Intersecs = note.VPosition <= xLowerBorder And Notes(note.LNPair).VPosition >= xLowerBorder + Dim AboveUpper = note.VPosition > xUpperBorder + + Dim NoteInside = (Not AboveUpper) And AboveLower + + Return NoteInside OrElse IntersectsNT OrElse IntersectsNT + End Function + + Private Function IsNoteVisible(noteindex As Integer, xTHeight As Integer, xVS As Integer) As Boolean + Return IsNoteVisible(Notes(noteindex), xTHeight, xVS) + End Function + + Private Sub DrawNotes(e1 As BufferedGraphics, xTHeight As Integer, xHS As Integer, xVS As Integer) + Dim xI1 As Integer + Dim xUpperBorder As Single = Math.Abs(xVS) + (xTHeight / gxHeight) + Dim xLowerBorder As Single = Math.Abs(xVS) - (vo.kHeight / gxHeight) + + For xI1 = 0 To UBound(Notes) + If Notes(xI1).VPosition > xUpperBorder Then Exit For + If Not IsNoteVisible(xI1, xTHeight, xVS) Then Continue For + If NTInput Then + DrawNoteNT(Notes(xI1), e1, xHS, xVS, xTHeight) + Else + DrawNote(Notes(xI1), e1, xHS, xVS, xTHeight) + End If + Next + End Sub + + Private Function GetNoteRectangle(note As Note, xTHeight As Integer, xHS As Integer, xVS As Integer) As Rectangle + Dim xDispX As Integer = HorizontalPositiontoDisplay(nLeft(note.ColumnIndex), xHS) + + Dim xDispY As Integer = IIf(Not NTInput Or (bAdjustLength And Not bAdjustUpper), + NoteRowToPanelHeight(note.VPosition, xVS, xTHeight) - vo.kHeight - 1, + NoteRowToPanelHeight(note.VPosition + + note.Length, xVS, xTHeight) - + vo.kHeight - 1) + + Dim xDispW As Integer = (GetColumnWidth(note.ColumnIndex) * gxWidth) + 1 + Dim xDispH As Integer = IIf(Not NTInput Or bAdjustLength, + vo.kHeight + 3, + (note.Length * gxHeight) + vo.kHeight + 3) + + Return New Rectangle(xDispX, xDispY, xDispW, xDispH) + End Function + + Private Function GetNoteRectangle(noteIndex As Integer, xTHeight As Integer, xHS As Integer, xVS As Integer) As Rectangle + Return GetNoteRectangle(Notes(noteIndex), xTHeight, xHS, xVS) + End Function + + + Private Sub DrawMouseOver(e1 As BufferedGraphics, xTHeight As Integer, xHS As Integer, xVS As Integer) + If NTInput Then + If Not bAdjustLength Then DrawNoteNT(Notes(KMouseOver), e1, xHS, xVS, xTHeight) + Else + DrawNote(Notes(KMouseOver), e1, xHS, xVS, xTHeight) + End If + + Dim rect = GetNoteRectangle(KMouseOver, xTHeight, xHS, xVS) + Dim pen = IIf(bAdjustLength, vo.kMouseOverE, vo.kMouseOver) + Dim unused1 = e1.Graphics.DrawRectangle(pen, rect.X, rect.Y, rect.Width - 1, rect.Height - 1) + + If ModifierMultiselectActive() Then + For Each note In Notes + If IsNoteVisible(note, xTHeight, xVS) AndAlso IsLabelMatch(note, KMouseOver) Then + Dim nrect = GetNoteRectangle(note, xTHeight, xHS, xVS) + Dim unused = e1.Graphics.DrawRectangle(pen, nrect.X, nrect.Y, nrect.Width - 1, nrect.Height - 1) + End If + Next + End If + + End Sub + + Private Sub DrawTimeSelection(e1 As BufferedGraphics, xTHeight As Integer, xTWidth As Integer, xHS As Integer, xVS As Integer) + Dim xI1 As Integer + Dim xBPMStart = Notes(0).Value + Dim xBPMHalf = Notes(0).Value + Dim xBPMEnd = Notes(0).Value + + For xI1 = 1 To UBound(Notes) + If Notes(xI1).ColumnIndex = niBPM Then + If Notes(xI1).VPosition <= vSelStart Then xBPMStart = Notes(xI1).Value + If Notes(xI1).VPosition <= vSelStart + vSelHalf Then xBPMHalf = Notes(xI1).Value + If Notes(xI1).VPosition <= vSelStart + vSelLength Then xBPMEnd = Notes(xI1).Value + End If + If Notes(xI1).VPosition > vSelStart + vSelLength Then Exit For + Next + + 'Selection area + e1.Graphics.FillRectangle(vo.PESel, + 0, + NoteRowToPanelHeight(vSelStart + IIf(vSelLength > 0, vSelLength, 0), xVS, xTHeight) + Math.Abs(CInt(vSelLength <> 0)), + xTWidth, + CInt(Math.Abs(vSelLength) * gxHeight)) + 'End Cursor + e1.Graphics.DrawLine(vo.PECursor, + 0, + NoteRowToPanelHeight(vSelStart + vSelLength, xVS, xTHeight), + xTWidth, + NoteRowToPanelHeight(vSelStart + vSelLength, xVS, xTHeight)) + 'Half Cursor + e1.Graphics.DrawLine(vo.PEHalf, + 0, + NoteRowToPanelHeight(vSelStart + vSelHalf, xVS, xTHeight), + xTWidth, + NoteRowToPanelHeight(vSelStart + vSelHalf, xVS, xTHeight)) + 'Start BPM + e1.Graphics.DrawString(xBPMStart / 10000, + vo.PEBPMFont, vo.PEBPM, + (-xHS + nLeft(niBPM)) * gxWidth, + NoteRowToPanelHeight(vSelStart, xVS, xTHeight) - vo.PEBPMFont.Height + 3) + 'Half BPM + e1.Graphics.DrawString(xBPMHalf / 10000, + vo.PEBPMFont, vo.PEBPM, + (-xHS + nLeft(niBPM)) * gxWidth, + NoteRowToPanelHeight(vSelStart + vSelHalf, xVS, xTHeight) - vo.PEBPMFont.Height + 3) + 'End BPM + e1.Graphics.DrawString(xBPMEnd / 10000, + vo.PEBPMFont, vo.PEBPM, + (-xHS + nLeft(niBPM)) * gxWidth, + NoteRowToPanelHeight(vSelStart + vSelLength, xVS, xTHeight) - vo.PEBPMFont.Height + 3) + + 'SelLine + If vSelMouseOverLine = 1 Then 'Start Cursor + e1.Graphics.DrawRectangle(vo.PEMouseOver, + 0, NoteRowToPanelHeight(vSelStart, xVS, xTHeight) - 1, + xTWidth - 1, 2) + ElseIf vSelMouseOverLine = 2 Then 'Half Cursor + e1.Graphics.DrawRectangle(vo.PEMouseOver, + 0, NoteRowToPanelHeight(vSelStart + vSelHalf, xVS, xTHeight) - 1, + xTWidth - 1, 2) + ElseIf vSelMouseOverLine = 3 Then 'End Cursor + e1.Graphics.DrawRectangle(vo.PEMouseOver, + 0, NoteRowToPanelHeight(vSelStart + vSelLength, xVS, xTHeight) - 1, + xTWidth - 1, 2) + End If + End Sub + + Private Function DrawClickAndScroll(xIndex As Integer, e1 As BufferedGraphics) As BufferedGraphics + Dim xDeltaLocation As Point = spMain(xIndex).PointToScreen(New Point(0, 0)) + + Dim xInitX As Single = MiddleButtonLocation.X - xDeltaLocation.X + Dim xInitY As Single = MiddleButtonLocation.Y - xDeltaLocation.Y + Dim xCurrX As Single = Cursor.Position.X - xDeltaLocation.X + Dim xCurrY As Single = Cursor.Position.Y - xDeltaLocation.Y + Dim xAngle As Double = Math.Atan2(xCurrY - xInitY, xCurrX - xInitX) + e1.Graphics.SmoothingMode = Drawing2D.SmoothingMode.HighQuality + + If Not (xInitX = xCurrX And xInitY = xCurrY) Then + Dim xPointx() As PointF = {New PointF(xCurrX, xCurrY), + New PointF((Math.Cos(xAngle + (Math.PI / 2)) * 10) + xInitX, (Math.Sin(xAngle + (Math.PI / 2)) * 10) + xInitY), + New PointF((Math.Cos(xAngle - (Math.PI / 2)) * 10) + xInitX, (Math.Sin(xAngle - (Math.PI / 2)) * 10) + xInitY)} + e1.Graphics.FillPolygon(New Drawing2D.LinearGradientBrush(New Point(xInitX, xInitY), New Point(xCurrX, xCurrY), Color.FromArgb(0), Color.FromArgb(-1)), xPointx) + End If + + e1.Graphics.FillEllipse(Brushes.LightGray, xInitX - 10, xInitY - 10, 20, 20) + e1.Graphics.DrawEllipse(Pens.Black, xInitX - 8, xInitY - 8, 16, 16) + + e1.Graphics.SmoothingMode = Drawing2D.SmoothingMode.Default + Return e1 + End Function + + Private Sub DrawWaveform(e1 As BufferedGraphics, xTHeight As Integer, xVSR As Integer, xI1 As Integer) + If wWavL IsNot Nothing And wWavR IsNot Nothing And wPrecision > 0 Then + If wLock Then + For xI0 As Integer = 1 To UBound(Notes) + If Notes(xI0).ColumnIndex >= niB Then wPosition = Notes(xI0).VPosition : Exit For + Next + End If + + Dim xPtsL(xTHeight * wPrecision) As PointF + Dim xPtsR(xTHeight * wPrecision) As PointF + + Dim xD1 As Double + + Dim bVPosition() As Double = {wPosition} + Dim bBPM() As Decimal = {Notes(0).Value / 10000} + Dim bWavDataIndex() As Decimal = {0} + + For xI1 = 1 To UBound(Notes) + If Notes(xI1).ColumnIndex = niBPM Then + If Notes(xI1).VPosition >= wPosition Then + ReDim Preserve bVPosition(UBound(bVPosition) + 1) + ReDim Preserve bBPM(UBound(bBPM) + 1) + ReDim Preserve bWavDataIndex(UBound(bWavDataIndex) + 1) + bVPosition(UBound(bVPosition)) = Notes(xI1).VPosition + bBPM(UBound(bBPM)) = Notes(xI1).Value / 10000 + bWavDataIndex(UBound(bWavDataIndex)) = ((Notes(xI1).VPosition - bVPosition(UBound(bVPosition) - 1)) * 1.25 * wSampleRate / bBPM(UBound(bBPM) - 1)) + bWavDataIndex(UBound(bWavDataIndex) - 1) + Else + bBPM(0) = Notes(xI1).Value / 10000 + End If + End If + Next + + Dim xI3 As Double + + For xI1 = xTHeight * wPrecision To 0 Step -1 + xI3 = ((-xI1 / wPrecision) + xTHeight + (xVSR * gxHeight) - 1) / gxHeight + + Dim xI2 As Integer + For xI2 = 1 To UBound(bVPosition) + If bVPosition(xI2) >= xI3 Then Exit For + Next + xI2 -= 1 + xD1 = bWavDataIndex(xI2) + ((xI3 - bVPosition(xI2)) * 1.25 * wSampleRate / bBPM(xI2)) + + If xD1 <= UBound(wWavL) And xD1 >= 0 Then + xPtsL(xI1) = New PointF((wWavL(Int(xD1)) * wWidth) + wLeft, xI1 / wPrecision) + xPtsR(xI1) = New PointF((wWavR(Int(xD1)) * wWidth) + wLeft, xI1 / wPrecision) + Else + xPtsL(xI1) = New PointF(wLeft, xI1 / wPrecision) + xPtsR(xI1) = New PointF(wLeft, xI1 / wPrecision) + End If + Next + e1.Graphics.DrawLines(vo.pBGMWav, xPtsL) + e1.Graphics.DrawLines(vo.pBGMWav, xPtsR) + End If + End Sub + + ''' + ''' Draw a note in a buffer. + ''' + ''' Note to be drawn. + ''' Buffer. + ''' HS.Value. + ''' VS.Value. + ''' Display height of the panel. (not ClipRectangle.Height) + + Private Sub DrawNote(sNote As Note, e As BufferedGraphics, xHS As Long, xVS As Long, xHeight As Integer) ', Optional ByVal CheckError As Boolean = True) ', Optional ByVal ConnectToIndex As Long = 0) + If Not nEnabled(sNote.ColumnIndex) Then Exit Sub + Dim xAlpha As Single = 1.0F + If sNote.Hidden Then xAlpha = vo.kOpacity + + Dim xLabel As String = C10to36(sNote.Value \ 10000) + If ShowFileName Then + If IsColumnSound(sNote.ColumnIndex) Then + If hWAV(C36to10(xLabel)) <> String.Empty Then xLabel = Path.GetFileNameWithoutExtension(hWAV(C36to10(xLabel))) + Else + If hBMP(C36to10(xLabel)) <> String.Empty Then xLabel = Path.GetFileNameWithoutExtension(hBMP(C36to10(xLabel))) + End If + End If + + Dim xPen As Pen + Dim xBrush As Drawing2D.LinearGradientBrush + Dim xBrush2 As SolidBrush + + Dim bright As Color + Dim dark As Color + Dim p1 = New Point(HorizontalPositiontoDisplay(nLeft(sNote.ColumnIndex), xHS), + NoteRowToPanelHeight(sNote.VPosition, xVS, xHeight) - vo.kHeight - 10) + Dim p2 = New Point(HorizontalPositiontoDisplay(nLeft(sNote.ColumnIndex) + GetColumnWidth(sNote.ColumnIndex), xHS), + NoteRowToPanelHeight(sNote.VPosition, xVS, xHeight) + 10) + + If Not sNote.LongNote Then + xPen = New Pen(GetColumn(sNote.ColumnIndex).getBright(xAlpha)) + + bright = GetColumn(sNote.ColumnIndex).getBright(xAlpha) + dark = GetColumn(sNote.ColumnIndex).getDark(xAlpha) + + If sNote.Landmine Then + bright = Color.Red + dark = Color.Red + End If + + xBrush2 = New SolidBrush(GetColumn(sNote.ColumnIndex).cText) + Else + bright = GetColumn(sNote.ColumnIndex).getLongBright(xAlpha) + dark = GetColumn(sNote.ColumnIndex).getLongDark(xAlpha) + + xBrush2 = New SolidBrush(GetColumn(sNote.ColumnIndex).cLText) + End If + + xPen = New Pen(bright) + xBrush = New Drawing2D.LinearGradientBrush(p1, p2, bright, dark) + + ' Fill + e.Graphics.FillRectangle(xBrush, HorizontalPositiontoDisplay(nLeft(sNote.ColumnIndex), xHS) + 2, + NoteRowToPanelHeight(sNote.VPosition, xVS, xHeight) - vo.kHeight + 1, + (GetColumnWidth(sNote.ColumnIndex) * gxWidth) - 3, + vo.kHeight - 1) + ' Outline + e.Graphics.DrawRectangle(xPen, + HorizontalPositiontoDisplay(nLeft(sNote.ColumnIndex), xHS) + 1, + NoteRowToPanelHeight(sNote.VPosition, xVS, xHeight) - vo.kHeight, + (GetColumnWidth(sNote.ColumnIndex) * gxWidth) - 2, + vo.kHeight) + + ' Label + Dim unused = e.Graphics.DrawString(IIf(IsColumnNumeric(sNote.ColumnIndex), sNote.Value / 10000, xLabel), + vo.kFont, xBrush2, + HorizontalPositiontoDisplay(nLeft(sNote.ColumnIndex), xHS) + vo.kLabelHShift, + NoteRowToPanelHeight(sNote.VPosition, xVS, xHeight) - vo.kHeight + vo.kLabelVShift) + + If sNote.ColumnIndex < niB Then + If sNote.LNPair <> 0 Then + DrawPairedLNBody(sNote, e, xHS, xVS, xHeight, xAlpha) + End If + End If + + + 'e.Graphics.DrawString(sNote.TimeOffset.ToString("0.##"), New Font("Verdana", 9), Brushes.Cyan, _ + ' New Point(HorizontalPositiontoDisplay(nLeft(sNote.ColumnIndex + 1), xHS), VerticalPositiontoDisplay(sNote.VPosition, xVS, xHeight) - vo.kHeight - 2)) + + 'If ErrorCheck AndAlso (sNote.LongNote Xor sNote.PairWithI <> 0) Then e.Graphics.DrawImage(My.Resources.ImageError, _ + If ErrorCheck AndAlso sNote.HasError Then e.Graphics.DrawImage(My.Resources.ImageError, + HorizontalPositiontoDisplay(nLeft(sNote.ColumnIndex) + (GetColumnWidth(sNote.ColumnIndex) / 2), xHS) - 12, + CInt(NoteRowToPanelHeight(sNote.VPosition, xVS, xHeight) - (vo.kHeight / 2) - 12), + 24, 24) + + If sNote.Selected Then e.Graphics.DrawRectangle(vo.kSelected, HorizontalPositiontoDisplay(nLeft(sNote.ColumnIndex), xHS), NoteRowToPanelHeight(sNote.VPosition, xVS, xHeight) - vo.kHeight - 1, GetColumnWidth(sNote.ColumnIndex) * gxWidth, vo.kHeight + 2) + + End Sub + + Private Sub DrawPairedLNBody(sNote As Note, e As BufferedGraphics, xHS As Long, xVS As Long, xHeight As Integer, xAlpha As Single) + Dim xPen2 As New Pen(GetColumn(sNote.ColumnIndex).getLongBright(xAlpha)) + Dim xBrush3 As New Drawing2D.LinearGradientBrush( + New Point(HorizontalPositiontoDisplay(nLeft(sNote.ColumnIndex) - (0.5 * GetColumnWidth(sNote.ColumnIndex)), xHS), + NoteRowToPanelHeight(Notes(sNote.LNPair).VPosition, xVS, xHeight)), + New Point(HorizontalPositiontoDisplay(nLeft(sNote.ColumnIndex) + (1.5 * GetColumnWidth(sNote.ColumnIndex)), xHS), + NoteRowToPanelHeight(sNote.VPosition, xVS, xHeight) + vo.kHeight), + GetColumn(sNote.ColumnIndex).getLongBright(xAlpha), + GetColumn(sNote.ColumnIndex).getLongDark(xAlpha)) + e.Graphics.FillRectangle(xBrush3, HorizontalPositiontoDisplay(nLeft(Notes(sNote.LNPair).ColumnIndex), xHS) + 3, NoteRowToPanelHeight(Notes(sNote.LNPair).VPosition, xVS, xHeight) + 1, + (GetColumnWidth(Notes(sNote.LNPair).ColumnIndex) * gxWidth) - 5, NoteRowToPanelHeight(sNote.VPosition, xVS, xHeight) - NoteRowToPanelHeight(Notes(sNote.LNPair).VPosition, xVS, xHeight) - vo.kHeight - 1) + e.Graphics.DrawRectangle(xPen2, HorizontalPositiontoDisplay(nLeft(Notes(sNote.LNPair).ColumnIndex), xHS) + 2, NoteRowToPanelHeight(Notes(sNote.LNPair).VPosition, xVS, xHeight), + (GetColumnWidth(Notes(sNote.LNPair).ColumnIndex) * gxWidth) - 4, NoteRowToPanelHeight(sNote.VPosition, xVS, xHeight) - NoteRowToPanelHeight(Notes(sNote.LNPair).VPosition, xVS, xHeight) - vo.kHeight) + End Sub + + ''' + ''' Draw a note in a buffer under NT mode. + ''' + ''' Note to be drawn. + ''' Buffer. + ''' HS.Value. + ''' VS.Value. + ''' Display height of the panel. (not ClipRectangle.Height) + + Private Sub DrawNoteNT(sNote As Note, e As BufferedGraphics, xHS As Long, xVS As Long, xHeight As Integer) ', Optional ByVal CheckError As Boolean = True) + If Not nEnabled(sNote.ColumnIndex) Then Exit Sub + Dim xAlpha As Single = 1.0F + If sNote.Hidden Then xAlpha = vo.kOpacity + + Dim xLabel As String = C10to36(sNote.Value \ 10000) + If ShowFileName Then + If IsColumnSound(sNote.ColumnIndex) Then + If hWAV(C36to10(xLabel)) <> String.Empty Then xLabel = Path.GetFileNameWithoutExtension(hWAV(C36to10(xLabel))) + Else + If hBMP(C36to10(xLabel)) <> String.Empty Then xLabel = Path.GetFileNameWithoutExtension(hBMP(C36to10(xLabel))) + End If + End If + + Dim xPen1 As Pen + Dim xBrush As Drawing2D.LinearGradientBrush + Dim xBrush2 As SolidBrush + + Dim p1 As Point + Dim p2 As Point + Dim bright As Color + Dim dark As Color + + If sNote.Length = 0 Then + p1 = New Point(HorizontalPositiontoDisplay(nLeft(sNote.ColumnIndex), xHS), + NoteRowToPanelHeight(sNote.VPosition, xVS, xHeight) - vo.kHeight - 10) + + p2 = New Point(HorizontalPositiontoDisplay(nLeft(sNote.ColumnIndex) + GetColumnWidth(sNote.ColumnIndex), xHS), + NoteRowToPanelHeight(sNote.VPosition, xVS, xHeight) + 10) + + bright = GetColumn(sNote.ColumnIndex).getBright(xAlpha) + dark = GetColumn(sNote.ColumnIndex).getDark(xAlpha) + + If sNote.Landmine Then + bright = Color.Red + dark = Color.Red + End If + + xBrush2 = New SolidBrush(GetColumn(sNote.ColumnIndex).cText) + Else + p1 = New Point(HorizontalPositiontoDisplay(nLeft(sNote.ColumnIndex) - (0.5 * GetColumnWidth(sNote.ColumnIndex)), xHS), + NoteRowToPanelHeight(sNote.VPosition + sNote.Length, xVS, xHeight) - vo.kHeight) + p2 = New Point(HorizontalPositiontoDisplay(nLeft(sNote.ColumnIndex) + (1.5 * GetColumnWidth(sNote.ColumnIndex)), xHS), + NoteRowToPanelHeight(sNote.VPosition, xVS, xHeight)) + + bright = GetColumn(sNote.ColumnIndex).getLongBright(xAlpha) + dark = GetColumn(sNote.ColumnIndex).getLongDark(xAlpha) + + xBrush2 = New SolidBrush(GetColumn(sNote.ColumnIndex).cLText) + End If + + xPen1 = New Pen(bright) + xBrush = New Drawing2D.LinearGradientBrush(p1, p2, bright, dark) + + ' Note gradient + e.Graphics.FillRectangle(xBrush, + HorizontalPositiontoDisplay(nLeft(sNote.ColumnIndex), xHS) + 1, + NoteRowToPanelHeight(sNote.VPosition + sNote.Length, xVS, xHeight) - vo.kHeight + 1, + (GetColumnWidth(sNote.ColumnIndex) * gxWidth) - 1, + CInt(sNote.Length * gxHeight) + vo.kHeight - 1) + + ' Outline + e.Graphics.DrawRectangle(xPen1, HorizontalPositiontoDisplay(nLeft(sNote.ColumnIndex), xHS) + 1, + NoteRowToPanelHeight(sNote.VPosition + sNote.Length, xVS, xHeight) - vo.kHeight, + (GetColumnWidth(sNote.ColumnIndex) * gxWidth) - 3, CInt(sNote.Length * gxHeight) + vo.kHeight) + + ' Note B36 + Dim unused = e.Graphics.DrawString(IIf(IsColumnNumeric(sNote.ColumnIndex), sNote.Value / 10000, xLabel), + vo.kFont, xBrush2, + HorizontalPositiontoDisplay(nLeft(sNote.ColumnIndex), xHS) + vo.kLabelHShiftL - 2, + NoteRowToPanelHeight(sNote.VPosition, xVS, xHeight) - vo.kHeight + vo.kLabelVShift) + + ' Draw paired body + If sNote.ColumnIndex < niB Then + If sNote.Length = 0 And sNote.LNPair <> 0 Then + DrawPairedLNBody(sNote, e, xHS, xVS, xHeight, xAlpha) + End If + End If + + + ' Select Box + If sNote.Selected Then + e.Graphics.DrawRectangle(vo.kSelected, + HorizontalPositiontoDisplay(nLeft(sNote.ColumnIndex), xHS), + NoteRowToPanelHeight(sNote.VPosition + sNote.Length, xVS, xHeight) - vo.kHeight - 1, + GetColumnWidth(sNote.ColumnIndex) * gxWidth, + CInt(sNote.Length * gxHeight) + vo.kHeight + 2) + End If + + ' Errors + If ErrorCheck AndAlso sNote.HasError Then + e.Graphics.DrawImage(My.Resources.ImageError, + HorizontalPositiontoDisplay(nLeft(sNote.ColumnIndex) + (GetColumnWidth(sNote.ColumnIndex) / 2), xHS) - 12, + CInt(NoteRowToPanelHeight(sNote.VPosition, xVS, xHeight) - (vo.kHeight / 2) - 12), + 24, 24) + End If + + 'e.Graphics.DrawString(sNote.TimeOffset.ToString("0.##"), New Font("Verdana", 9), Brushes.Cyan, _ + ' New Point(HorizontalPositiontoDisplay(nLeft(sNote.ColumnIndex + 1), xHS), VerticalPositiontoDisplay(sNote.VPosition, xVS, xHeight) - vo.kHeight - 2)) + + End Sub End Class diff --git a/iBMSC/PanelEvents.vb b/iBMSC/PanelEvents.vb index 1eb8b4b40..f0492dfd6 100644 --- a/iBMSC/PanelEvents.vb +++ b/iBMSC/PanelEvents.vb @@ -2,1764 +2,1764 @@ Partial Public Class MainWindow - Private Sub PMainInPreviewKeyDown(sender As Object, e As PreviewKeyDownEventArgs) Handles PMainIn.PreviewKeyDown, PMainInL.PreviewKeyDown, PMainInR.PreviewKeyDown - If e.KeyCode = Keys.ShiftKey Or e.KeyCode = Keys.ControlKey Then - RefreshPanelAll() - POStatusRefresh() - Exit Sub - End If - - If e.KeyCode = 18 Then Exit Sub - - Dim iI As Integer = sender.Tag - Dim xI1 As Integer - Dim xTargetColumn As Integer = -1 - Dim xUndo As UndoRedo.LinkedURCmd = Nothing - Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void - Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo - ReDim SelectedNotes(-1) - - Select Case e.KeyCode - Case Keys.Up - Dim xVPosition As Double = 192 / gDivide - If My.Computer.Keyboard.CtrlKeyDown Then xVPosition = 1 - - 'Ks cannot be beyond the upper boundary - Dim muVPosition As Double = GetMaxVPosition() - 1 - For xI1 = 1 To UBound(Notes) - If Notes(xI1).Selected Then - 'K(xI1).VPosition = Math.Floor(K(xI1).VPosition / (192 / gDivide)) * 192 / gDivide - muVPosition = IIf(Notes(xI1).VPosition + IIf(NTInput, Notes(xI1).Length, 0) + xVPosition > muVPosition, - Notes(xI1).VPosition + IIf(NTInput, Notes(xI1).Length, 0) + xVPosition, - muVPosition) - End If - Next - muVPosition -= 191999 - - 'xRedo = sCmdKMs(0, xVPosition - muVPosition, True) - Dim xVPos As Double - For xI1 = 1 To UBound(Notes) - If Not Notes(xI1).Selected Then Continue For - - xVPos = Notes(xI1).VPosition + xVPosition - muVPosition - RedoMoveNote(Notes(xI1), Notes(xI1).ColumnIndex, xVPos, xUndo, xRedo) - Notes(xI1).VPosition = xVPos - Next - 'xUndo = sCmdKMs(0, -xVPosition + muVPosition, True) - - If xVPosition - muVPosition <> 0 Then AddUndo(xUndo, xBaseRedo.Next) - SortByVPositionInsertion() - UpdatePairing() - CalculateTotalPlayableNotes() - CalculateGreatestVPosition() - RefreshPanelAll() - - Case Keys.Down - Dim xVPosition As Double = -192 / gDivide - If My.Computer.Keyboard.CtrlKeyDown Then xVPosition = -1 - - 'Ks cannot be beyond the lower boundary - Dim mVPosition As Double = 0 - For xI1 = 1 To UBound(Notes) - If Notes(xI1).Selected Then - 'K(xI1).VPosition = Math.Ceiling(K(xI1).VPosition / (192 / gDivide)) * 192 / gDivide - mVPosition = IIf(Notes(xI1).VPosition + xVPosition < mVPosition, - Notes(xI1).VPosition + xVPosition, - mVPosition) - End If - Next - - 'xRedo = sCmdKMs(0, xVPosition - mVPosition, True) - Dim xVPos As Double - For xI1 = 1 To UBound(Notes) - If Not Notes(xI1).Selected Then Continue For - - xVPos = Notes(xI1).VPosition + xVPosition - mVPosition - RedoMoveNote(Notes(xI1), Notes(xI1).ColumnIndex, xVPos, xUndo, xRedo) - Notes(xI1).VPosition = xVPos - Next - 'xUndo = sCmdKMs(0, -xVPosition + mVPosition, True) - - If xVPosition - mVPosition <> 0 Then AddUndo(xUndo, xBaseRedo.Next) - SortByVPositionInsertion() - UpdatePairing() - CalculateTotalPlayableNotes() - CalculateGreatestVPosition() - RefreshPanelAll() - - Case Keys.Left - 'For xI1 = 1 To UBound(K) - ' If K(xI1).Selected Then K(xI1).ColumnIndex = RealColumnToEnabled(K(xI1).ColumnIndex) - 1 - 'Next - - 'Ks cannot be beyond the left boundary - Dim mLeft As Integer = 0 - For xI1 = 1 To UBound(Notes) - If Notes(xI1).Selected Then mLeft = IIf(ColumnArrayIndexToEnabledColumnIndex(Notes(xI1).ColumnIndex) - 1 < mLeft, - ColumnArrayIndexToEnabledColumnIndex(Notes(xI1).ColumnIndex) - 1, - mLeft) - Next - 'xRedo = sCmdKMs(-1 - mLeft, 0, True) - Dim xCol As Integer - For xI1 = 1 To UBound(Notes) - If Not Notes(xI1).Selected Then Continue For - - xCol = EnabledColumnIndexToColumnArrayIndex(ColumnArrayIndexToEnabledColumnIndex(Notes(xI1).ColumnIndex) - 1 - mLeft) - RedoMoveNote(Notes(xI1), xCol, Notes(xI1).VPosition, xUndo, xRedo) - Notes(xI1).ColumnIndex = xCol - Next - 'xUndo = sCmdKMs(1 + mLeft, 0, True) - - If -1 - mLeft <> 0 Then AddUndo(xUndo, xBaseRedo.Next) - UpdatePairing() - CalculateTotalPlayableNotes() - RefreshPanelAll() - - Case Keys.Right - 'xRedo = sCmdKMs(1, 0, True) - Dim xCol As Integer - For xI1 = 1 To UBound(Notes) - If Not Notes(xI1).Selected Then Continue For - - xCol = EnabledColumnIndexToColumnArrayIndex(ColumnArrayIndexToEnabledColumnIndex(Notes(xI1).ColumnIndex) + 1) - RedoMoveNote(Notes(xI1), xCol, Notes(xI1).VPosition, xUndo, xRedo) - Notes(xI1).ColumnIndex = xCol - Next - 'xUndo = sCmdKMs(-1, 0, True) - - AddUndo(xUndo, xBaseRedo.Next) - UpdatePairing() - CalculateTotalPlayableNotes() - RefreshPanelAll() - - Case Keys.Delete - mnDelete_Click(mnDelete, New EventArgs) - - Case Keys.Home - If PanelFocus = 0 Then LeftPanelScroll.Value = 0 - If PanelFocus = 1 Then MainPanelScroll.Value = 0 - If PanelFocus = 2 Then RightPanelScroll.Value = 0 - - Case Keys.End - If PanelFocus = 0 Then LeftPanelScroll.Value = LeftPanelScroll.Minimum - If PanelFocus = 1 Then MainPanelScroll.Value = MainPanelScroll.Minimum - If PanelFocus = 2 Then RightPanelScroll.Value = RightPanelScroll.Minimum - - Case Keys.PageUp - If PanelFocus = 0 Then LeftPanelScroll.Value = IIf(LeftPanelScroll.Value - gPgUpDn > LeftPanelScroll.Minimum, LeftPanelScroll.Value - gPgUpDn, LeftPanelScroll.Minimum) - If PanelFocus = 1 Then MainPanelScroll.Value = IIf(MainPanelScroll.Value - gPgUpDn > MainPanelScroll.Minimum, MainPanelScroll.Value - gPgUpDn, MainPanelScroll.Minimum) - If PanelFocus = 2 Then RightPanelScroll.Value = IIf(RightPanelScroll.Value - gPgUpDn > RightPanelScroll.Minimum, RightPanelScroll.Value - gPgUpDn, RightPanelScroll.Minimum) - - Case Keys.PageDown - If PanelFocus = 0 Then LeftPanelScroll.Value = IIf(LeftPanelScroll.Value + gPgUpDn < 0, LeftPanelScroll.Value + gPgUpDn, 0) - If PanelFocus = 1 Then MainPanelScroll.Value = IIf(MainPanelScroll.Value + gPgUpDn < 0, MainPanelScroll.Value + gPgUpDn, 0) - If PanelFocus = 2 Then RightPanelScroll.Value = IIf(RightPanelScroll.Value + gPgUpDn < 0, RightPanelScroll.Value + gPgUpDn, 0) - - Case Keys.Oemcomma - If gDivide * 2 <= CGDivide.Maximum Then CGDivide.Value = gDivide * 2 - - Case Keys.OemPeriod - If gDivide \ 2 >= CGDivide.Minimum Then CGDivide.Value = gDivide \ 2 - - Case Keys.OemQuestion - 'Dim xTempSwap As Integer = gSlash - 'gSlash = CGDivide.Value - 'CGDivide.Value = xTempSwap - CGDivide.Value = gSlash - - Case Keys.Oemplus - With CGHeight - .Value += IIf(.Value > .Maximum - .Increment, .Maximum - .Value, .Increment) - End With - - Case Keys.OemMinus - With CGHeight - .Value -= IIf(.Value < .Minimum + .Increment, .Value - .Minimum, .Increment) - End With - - Case Keys.Add - IncreaseCurrentWav() - Case Keys.Subtract - DecreaseCurrentWav() - - Case Keys.G - 'az: don't trigger when we use Go To Measure - If Not My.Computer.Keyboard.CtrlKeyDown Then CGSnap.Checked = Not gSnap - - Case Keys.L - If Not My.Computer.Keyboard.CtrlKeyDown Then POBLong_Click(Nothing, Nothing) - - Case Keys.S - If Not My.Computer.Keyboard.CtrlKeyDown Then POBNormal_Click(Nothing, Nothing) - - Case Keys.D - CGDisableVertical.Checked = Not CGDisableVertical.Checked - - Case Keys.NumPad0, Keys.D0 - MoveToBGM(xUndo, xRedo) - - Case Keys.Oem1, Keys.NumPad1, Keys.D1 : MoveToColumn(niA2, xUndo, xRedo) - Case Keys.Oem2, Keys.NumPad2, Keys.D2 : MoveToColumn(niA3, xUndo, xRedo) - Case Keys.Oem3, Keys.NumPad3, Keys.D3 : MoveToColumn(niA4, xUndo, xRedo) - Case Keys.Oem4, Keys.NumPad4, Keys.D4 : MoveToColumn(niA5, xUndo, xRedo) - Case Keys.Oem5, Keys.NumPad5, Keys.D5 : MoveToColumn(niA6, xUndo, xRedo) - Case Keys.Oem6, Keys.NumPad6, Keys.D6 : MoveToColumn(niA7, xUndo, xRedo) - Case Keys.Oem7, Keys.NumPad7, Keys.D7 : MoveToColumn(niA8, xUndo, xRedo) - Case Keys.Oem8, Keys.NumPad8, Keys.D8 : MoveToColumn(niA9, xUndo, xRedo) - - End Select - - If My.Computer.Keyboard.CtrlKeyDown And (Not My.Computer.Keyboard.AltKeyDown) And (Not My.Computer.Keyboard.ShiftKeyDown) Then - Select Case e.KeyCode - Case Keys.Z : TBUndo_Click(TBUndo, New EventArgs) - Case Keys.Y : TBRedo_Click(TBRedo, New EventArgs) - Case Keys.X : TBCut_Click(TBCut, New EventArgs) - Case Keys.C : TBCopy_Click(TBCopy, New EventArgs) - Case Keys.V : TBPaste_Click(TBPaste, New EventArgs) - Case Keys.A : mnSelectAll_Click(mnSelectAll, New EventArgs) - Case Keys.F : TBFind_Click(TBFind, New EventArgs) - Case Keys.T : TBStatistics_Click(TBStatistics, New EventArgs) - End Select - End If - - If ModifierMultiselectActive() Then - If e.KeyCode = Keys.A And KMouseOver <> -1 Then - SelectAllWithHoveredNoteLabel() - End If - End If - - PMainInMouseMove(sender) - POStatusRefresh() - End Sub - - Private Sub SelectAllWithHoveredNoteLabel() - For xI1 = 0 To UBound(Notes) - Notes(xI1).Selected = IIf(IsLabelMatch(Notes(xI1), KMouseOver), True, Notes(xI1).Selected) - Next - End Sub - - Private Function IsLabelMatch(note As Note, index As Integer) As Boolean - If TBShowFileName.Checked Then - Dim wavidx = Notes(index).Value / 10000 - Dim wav = hWAV(wavidx) - If hWAV(note.Value / 10000) = wav Then - Return True - End If - Else - If note.Value = Notes(index).Value Then - Return True - End If - End If - - Return False - End Function - - Private Sub DecreaseCurrentWav() - If LWAV.SelectedIndex = -1 Then - LWAV.SelectedIndex = 0 - Else - Dim newIndex As Integer = LWAV.SelectedIndex - 1 - If newIndex < 0 Then newIndex = 0 - LWAV.SelectedIndices.Clear() - LWAV.SelectedIndex = newIndex - End If - End Sub - - Private Sub IncreaseCurrentWav() - If LWAV.SelectedIndex = -1 Then - LWAV.SelectedIndex = 0 - Else - Dim newIndex As Integer = LWAV.SelectedIndex + 1 - If newIndex > LWAV.Items.Count - 1 Then newIndex = LWAV.Items.Count - 1 - LWAV.SelectedIndices.Clear() - LWAV.SelectedIndex = newIndex - ValidateWavListView() - End If - End Sub - - Private Sub DecreaseCurrentBmp() - If LBMP.SelectedIndex = -1 Then - LBMP.SelectedIndex = 0 - Else - Dim newIndex As Integer = LBMP.SelectedIndex - 1 - If newIndex < 0 Then newIndex = 0 - LBMP.SelectedIndices.Clear() - LBMP.SelectedIndex = newIndex - End If - End Sub - - Private Sub IncreaseCurrentBmp() - If LBMP.SelectedIndex = -1 Then - LBMP.SelectedIndex = 0 - Else - Dim newIndex As Integer = LBMP.SelectedIndex + 1 - If newIndex > LBMP.Items.Count - 1 Then newIndex = LBMP.Items.Count - 1 - LBMP.SelectedIndices.Clear() - LBMP.SelectedIndex = newIndex - ValidateWavListView() - End If - End Sub - - Private Sub MoveToBGM(xUndo As UndoRedo.LinkedURCmd, xRedo As UndoRedo.LinkedURCmd) - Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo - - For xI2 As Integer = 1 To UBound(Notes) - If Not Notes(xI2).Selected Then Continue For - - With Notes(xI2) - Dim currentBGMColumn As Integer = niB - - 'TODO: optimize the for loops below - If NTInput Then - For xI0 As Integer = 1 To UBound(Notes) - Dim IntersectA = Notes(xI0).VPosition <= Notes(xI2).VPosition + Notes(xI2).Length - Dim IntersectB = Notes(xI0).VPosition + Notes(xI0).Length >= Notes(xI2).VPosition - If Notes(xI0).ColumnIndex = currentBGMColumn AndAlso IntersectA And IntersectB Then - currentBGMColumn += 1 : xI0 = 1 - End If - Next - Else - For xI0 As Integer = 1 To UBound(Notes) - If Notes(xI0).ColumnIndex = currentBGMColumn AndAlso Notes(xI0).VPosition = Notes(xI2).VPosition Then - currentBGMColumn += 1 : xI0 = 1 - End If - Next - End If - - RedoMoveNote(Notes(xI2), currentBGMColumn, .VPosition, xUndo, xRedo) - .ColumnIndex = currentBGMColumn - End With - Next - AddUndo(xUndo, xBaseRedo.Next) - UpdatePairing() - CalculateTotalPlayableNotes() - RefreshPanelAll() - End Sub - - Private Sub MoveToColumn(xTargetColumn As Integer, xUndo As UndoRedo.LinkedURCmd, xRedo As UndoRedo.LinkedURCmd) - Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo - If xTargetColumn = -1 Then Return - - If Rscratch Then - Select Case xTargetColumn - Case niA2 : xTargetColumn = niA9 - Case niA3 : xTargetColumn = niA1 - Case niA4 : xTargetColumn = niA2 - Case niA5 : xTargetColumn = niA3 - Case niA6 : xTargetColumn = niA4 - Case niA7 : xTargetColumn = niA5 - Case niA8 : xTargetColumn = niA6 - Case niA9 : xTargetColumn = niA7 - End Select - End If - - If Not nEnabled(xTargetColumn) Then Return - Dim bMoveAndDeselectFirstNote = My.Computer.Keyboard.ShiftKeyDown - - For xI2 As Integer = 1 To UBound(Notes) - If Not Notes(xI2).Selected Then Continue For - - RedoMoveNote(Notes(xI2), xTargetColumn, Notes(xI2).VPosition, xUndo, xRedo) - Notes(xI2).ColumnIndex = xTargetColumn - - If bMoveAndDeselectFirstNote Then - Notes(xI2).Selected = False - PanelPreviewNoteIndex(xI2) - - ' az: Add selected notes to undo - ' to preserve selection status - ' this works because the note find - ' does not account for selection status - ' when checking equality! (equalsBMSE, equalsNT) - For xI3 As Integer = 1 To UBound(Notes) - If xI3 = xI2 Then Continue For - If Notes(xI3).Selected Then - RedoMoveNote(Notes(xI3), Notes(xI3).ColumnIndex, Notes(xI3).VPosition, xUndo, xRedo) - End If - Next - - Exit For - End If - Next - AddUndo(xUndo, xBaseRedo.Next) - UpdatePairing() - CalculateTotalPlayableNotes() - RefreshPanelAll() - End Sub - - Private Sub PMainInResize(sender As Object, e As EventArgs) Handles PMainIn.Resize, PMainInL.Resize, PMainInR.Resize - If Not Created Then Exit Sub - - Dim iI As Integer = sender.Tag - PanelWidth(0) = PMainL.Width - PanelWidth(1) = PMain.Width - PanelWidth(2) = PMainR.Width - - Select Case iI - Case 0 - LeftPanelScroll.LargeChange = sender.Height * 0.9 - LeftPanelScroll.Maximum = LeftPanelScroll.LargeChange - 1 - HSL.LargeChange = sender.Width / gxWidth - If HSL.Value > HSL.Maximum - HSL.LargeChange + 1 Then HSL.Value = HSL.Maximum - HSL.LargeChange + 1 - Case 1 - MainPanelScroll.LargeChange = sender.Height * 0.9 - MainPanelScroll.Maximum = MainPanelScroll.LargeChange - 1 - HS.LargeChange = sender.Width / gxWidth - If HS.Value > HS.Maximum - HS.LargeChange + 1 Then HS.Value = HS.Maximum - HS.LargeChange + 1 - Case 2 - RightPanelScroll.LargeChange = sender.Height * 0.9 - RightPanelScroll.Maximum = RightPanelScroll.LargeChange - 1 - HSR.LargeChange = sender.Width / gxWidth - If HSR.Value > HSR.Maximum - HSR.LargeChange + 1 Then HSR.Value = HSR.Maximum - HSR.LargeChange + 1 - End Select - RefreshPanel(iI, sender.DisplayRectangle) - End Sub - - Private Sub PMainInLostFocus(sender As Object, e As EventArgs) Handles PMainIn.LostFocus, PMainInL.LostFocus, PMainInR.LostFocus - RefreshPanelAll() - End Sub - - Private Sub PMainInMouseDown(sender As Object, e As MouseEventArgs) Handles PMainIn.MouseDown, PMainInL.MouseDown, PMainInR.MouseDown - tempFirstMouseDown = FirstClickDisabled And Not sender.Focused - - PanelFocus = sender.Tag - Dim unused = sender.Focus() - LastMouseDownLocation = New Point(-1, -1) - VSValue = PanelVScroll(PanelFocus) - - If NTInput Then bAdjustUpper = False : bAdjustLength = False - ctrlPressed = False : DuplicatedSelectedNotes = False - - If MiddleButtonClicked Then MiddleButtonClicked = False : Exit Sub - - Dim xHS As Long = PanelhBMSCROLL(PanelFocus) - Dim xVS As Long = PanelVScroll(PanelFocus) - Dim xHeight As Integer = spMain(PanelFocus).Height - - Select Case e.Button - Case MouseButtons.Left - If tempFirstMouseDown And Not TBTimeSelect.Checked Then RefreshPanelAll() : Exit Select - - KMouseOver = -1 - 'If K Is Nothing Then pMouseDown = e.Location : Exit Select - - 'Find the clicked K - Dim NoteIndex As Integer = GetClickedNote(e, xHS, xVS, xHeight) - - PanelPreviewNoteIndex(NoteIndex) - - For xI1 = 0 To UBound(Notes) - Notes(xI1).TempMouseDown = False - Next - - HandleCurrentModeOnClick(e, xHS, xVS, xHeight, NoteIndex) - RefreshPanelAll() - POStatusRefresh() - - Case MouseButtons.Middle - If MiddleButtonMoveMethod = 1 Then - tempX = e.X - tempY = e.Y - tempV = xVS - tempH = xHS - Else - MiddleButtonLocation = Cursor.Position - MiddleButtonClicked = True - TimerMiddle.Enabled = True - End If - - Case MouseButtons.Right - DeselectOrRemove(e, xHS, xVS, xHeight) - End Select - End Sub - - Private Sub DeselectOrRemove(e As MouseEventArgs, xHS As Long, xVS As Long, xHeight As Integer) - KMouseOver = -1 - 'KMouseDown = -1 - ReDim SelectedNotes(-1) - 'If K Is Nothing Then pMouseDown = e.Location : Exit Select - - If Not tempFirstMouseDown Then - - Dim xI1 As Integer - For xI1 = UBound(Notes) To 1 Step -1 - 'If mouse is clicking on a K - If MouseInNote(e, xHS, xVS, xHeight, Notes(xI1)) Then - - If My.Computer.Keyboard.ShiftKeyDown Then - If Not IsColumnNumeric(Notes(xI1).ColumnIndex) Then - If IsColumnSound(Notes(xI1).ColumnIndex) Then - LWAV.SelectedIndices.Clear() - LWAV.SelectedIndex = C36to10(C10to36(Notes(xI1).Value \ 10000)) - 1 - ValidateWavListView() - Else - LBMP.SelectedIndices.Clear() - LBMP.SelectedIndex = C36to10(C10to36(Notes(xI1).Value \ 10000)) - 1 - ValidateBmpListView() - End If - End If - Else - Dim xUndo As UndoRedo.LinkedURCmd = Nothing - Dim xRedo As UndoRedo.LinkedURCmd = Nothing - - RedoRemoveNote(Notes(xI1), xUndo, xRedo) - RemoveNote(xI1) - - AddUndo(xUndo, xRedo) - RefreshPanelAll() - End If - - Exit For - End If - Next - - CalculateTotalPlayableNotes() - End If - End Sub - - Private Function GetClickedNote(e As MouseEventArgs, xHS As Long, xVS As Long, xHeight As Integer) As Integer - Dim NoteIndex As Integer = -1 - For xI1 = UBound(Notes) To 0 Step -1 - 'If mouse is clicking on a K - If MouseInNote(e, xHS, xVS, xHeight, Notes(xI1)) Then - ' found it! - NoteIndex = xI1 - deltaVPosition = IIf(NTInput, GetMouseVPosition(False) - Notes(xI1).VPosition, 0) - - If NTInput And My.Computer.Keyboard.ShiftKeyDown Then - bAdjustUpper = e.Y <= NoteRowToPanelHeight(Notes(xI1).VPosition + Notes(xI1).Length, xVS, xHeight) - bAdjustLength = e.Y >= NoteRowToPanelHeight(Notes(xI1).VPosition, xVS, xHeight) - vo.kHeight Or bAdjustUpper - End If - - Exit For - - End If - Next - - Return NoteIndex - End Function - - Private Sub PanelPreviewNoteIndex(NoteIndex As Integer) - 'Play wav - If ClickStopPreview Then PreviewNote(String.Empty, True) - 'My.Computer.Audio.Stop() - If NoteIndex > 0 And PreviewOnClick AndAlso IsColumnSound(Notes(NoteIndex).ColumnIndex) Then - Dim xI2 As Integer = Notes(NoteIndex).Value \ 10000 - If Notes(NoteIndex).Landmine Then - xI2 = 0 - Else - If xI2 <= 0 Then xI2 = 1 - If xI2 >= 1296 Then xI2 = 1295 - End If - - If Not hWAV(xI2) = String.Empty Then ' AndAlso Path.GetExtension(hWAV(xI2)).ToLower = ".wav" Then - Dim xFileLocation As String = IIf(ExcludeFileName(FileName) = String.Empty, InitPath, ExcludeFileName(FileName)) & "\" & hWAV(xI2) - If Not ClickStopPreview Then PreviewNote(String.Empty, True) - PreviewNote(xFileLocation, False) - End If - End If - End Sub - - Private Sub HandleCurrentModeOnClick(e As MouseEventArgs, xHS As Long, xVS As Long, xHeight As Integer, ByRef NoteIndex As Integer) - If TBSelect.Checked Then - OnSelectModeLeftClick(e, NoteIndex, xHeight, xVS) - ElseIf NTInput And TBWrite.Checked Then - TempVPosition = -1 - SelectedColumn = -1 - ShouldDrawTempNote = False - - Dim xVPosition = GetMouseVPosition(gSnap) - - If xVPosition < 0 Or xVPosition >= GetMaxVPosition() Then Exit Sub - - Dim xColumn = GetColumnAtEvent(e, xHS) - - For xI2 As Integer = UBound(Notes) To 1 Step -1 - If Notes(xI2).VPosition = xVPosition And Notes(xI2).ColumnIndex = xColumn Then NoteIndex = xI2 : Exit For - Next - - Dim Hidden As Boolean = ModifierHiddenActive() - - If NoteIndex > 0 Then - ReDim SelectedNotes(0) - SelectedNotes(0) = Notes(NoteIndex) - Notes(NoteIndex).TempIndex = 0 - - 'KMouseDown = xITemp - Notes(NoteIndex).TempMouseDown = True - Notes(NoteIndex).Length = xVPosition - Notes(NoteIndex).VPosition - - 'uVPos = K(xITemp).VPosition - bAdjustUpper = True - - Dim xUndo As UndoRedo.LinkedURCmd = Nothing - Dim xRedo As UndoRedo.LinkedURCmd = Nothing - - - RedoLongNoteModify(SelectedNotes(0), Notes(NoteIndex).VPosition, Notes(NoteIndex).Length, xUndo, xRedo) - AddUndo(xUndo, xRedo) - 'With uNote - ' AddUndo(sCmdKL(.ColumnIndex, .VPosition, .Value, K(xITemp).Length, .Hidden, .Length, True, True), _ - ' sCmdKL(.ColumnIndex, .VPosition, .Value, .Length, .Hidden, K(xITemp).Length, True, True)) - 'End With - - ElseIf IsColumnNumeric(xColumn) Then - - Dim xMessage As String = Strings.Messages.PromptEnterNumeric - If xColumn = niBPM Then xMessage = Strings.Messages.PromptEnterBPM - If xColumn = niSTOP Then xMessage = Strings.Messages.PromptEnterSTOP - If xColumn = niSCROLL Then xMessage = Strings.Messages.PromptEnterSCROLL - - Dim valstr As String = InputBox(xMessage, Text) - Dim value As Double = Val(valstr) * 10000 - - If (xColumn = niSCROLL And valstr = "0") Or value <> 0 Then - If xColumn <> niSCROLL And value <= 0 Then value = 1 - - Dim xUndo As UndoRedo.LinkedURCmd = Nothing - Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void - Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo - - For xI1 = 1 To UBound(Notes) - If Notes(xI1).VPosition = xVPosition AndAlso Notes(xI1).ColumnIndex = xColumn Then _ - RedoRemoveNote(Notes(xI1), xUndo, xRedo) - Next - - Dim n = New Note(xColumn, xVPosition, value, 0, Hidden) - RedoAddNote(n, xUndo, xRedo) - - AddNote(n) - AddUndo(xUndo, xBaseRedo.Next) - End If - - ShouldDrawTempNote = True - - Else - Dim xLbl = If(IsColumnSound(xColumn), (LWAV.SelectedIndex + 1) * 10000, (LBMP.SelectedIndex + 1) * 10000) - - Dim Landmine As Boolean = ModifierLandmineActive() - - ReDim Preserve Notes(UBound(Notes) + 1) - With Notes(UBound(Notes)) - .VPosition = xVPosition - .ColumnIndex = xColumn - .Value = xLbl - .Hidden = Hidden - .Landmine = Landmine - .TempMouseDown = True - End With - - ReDim SelectedNotes(0) - SelectedNotes(0) = Notes(UBound(Notes)) - SelectedNotes(0).LNPair = -1 - - If TBWavIncrease.Checked Then - If IsColumnSound(xColumn) Then - IncreaseCurrentWav() - Else - IncreaseCurrentBmp() - End If - End If - - 'KMouseDown = 1 - - 'uNote.Value = 0 - 'uVPos = xVPosition - uAdded = False - - Dim xUndo As UndoRedo.LinkedURCmd = Nothing - Dim xRedo As UndoRedo.LinkedURCmd = Nothing - RedoAddNote(Notes(UBound(Notes)), xUndo, xRedo, TBWavIncrease.Checked) - AddUndo(xUndo, xRedo) - End If - - SortByVPositionInsertion() - UpdatePairing() - CalculateTotalPlayableNotes() - - ElseIf TBTimeSelect.Checked Then - - Dim xL1 As Double - If NoteIndex >= 0 Then xL1 = Notes(NoteIndex).VPosition _ - Else xL1 = (xHeight - (xVS * gxHeight) - e.Y - 1) / gxHeight - - vSelAdjust = ModifierLongNoteActive() - - vSelMouseOverLine = 0 - If Math.Abs(e.Y - NoteRowToPanelHeight(vSelStart + vSelLength, xVS, xHeight)) <= vo.PEDeltaMouseOver Then - vSelMouseOverLine = 3 - ElseIf Math.Abs(e.Y - NoteRowToPanelHeight(vSelStart + vSelHalf, xVS, xHeight)) <= vo.PEDeltaMouseOver Then - vSelMouseOverLine = 2 - ElseIf Math.Abs(e.Y - NoteRowToPanelHeight(vSelStart, xVS, xHeight)) <= vo.PEDeltaMouseOver Then - vSelMouseOverLine = 1 - End If - - If Not vSelAdjust Then - If vSelMouseOverLine = 1 Then - If gSnap And NoteIndex <= 0 Then xL1 = SnapToGrid(xL1) - vSelLength += vSelStart - xL1 - vSelHalf += vSelStart - xL1 - vSelStart = xL1 - - ElseIf vSelMouseOverLine = 2 Then - vSelHalf = xL1 - If gSnap And NoteIndex <= 0 Then vSelHalf = SnapToGrid(vSelHalf) - vSelHalf -= vSelStart - - ElseIf vSelMouseOverLine = 3 Then - vSelLength = xL1 - If gSnap And NoteIndex <= 0 Then vSelLength = SnapToGrid(vSelLength) - vSelLength -= vSelStart - - Else - vSelLength = 0 - vSelStart = xL1 - If gSnap And NoteIndex <= 0 Then vSelStart = SnapToGrid(vSelStart) - End If - ValidateSelection() - - Else - If vSelMouseOverLine = 2 Then - SortByVPositionInsertion() - vSelPStart = vSelStart - vSelPLength = vSelLength - vSelPHalf = vSelHalf - vSelK = Notes - ReDim Preserve vSelK(UBound(vSelK)) - - If gSnap And NoteIndex <= 0 And Not My.Computer.Keyboard.CtrlKeyDown Then xL1 = SnapToGrid(xL1) - AddUndo(New UndoRedo.Void, New UndoRedo.Void) - BPMChangeHalf(xL1 - vSelHalf - vSelStart, , True) - SortByVPositionInsertion() - UpdatePairing() - CalculateGreatestVPosition() - - ElseIf vSelMouseOverLine = 3 Or vSelMouseOverLine = 1 Then - SortByVPositionInsertion() - vSelPStart = vSelStart - vSelPLength = vSelLength - vSelPHalf = vSelHalf - vSelK = Notes - ReDim Preserve vSelK(UBound(vSelK)) - - If gSnap And NoteIndex <= 0 And Not My.Computer.Keyboard.CtrlKeyDown Then xL1 = SnapToGrid(xL1) - AddUndo(New UndoRedo.Void, New UndoRedo.Void) - BPMChangeTop(IIf(vSelMouseOverLine = 3, xL1 - vSelStart, vSelStart + vSelLength - xL1) / vSelLength, , True) - SortByVPositionInsertion() - UpdatePairing() - CalculateGreatestVPosition() - - Else - vSelLength = xL1 - If gSnap And NoteIndex <= 0 And Not My.Computer.Keyboard.CtrlKeyDown Then vSelLength = SnapToGrid(vSelLength) - vSelLength -= vSelStart - End If - - End If - - If vSelLength Then - Dim xVLower As Double = IIf(vSelLength > 0, vSelStart, vSelStart + vSelLength) - Dim xVUpper As Double = IIf(vSelLength < 0, vSelStart, vSelStart + vSelLength) - If NTInput Then - For xI2 As Integer = 1 To UBound(Notes) - Notes(xI2).Selected = Not Notes(xI2).VPosition >= xVUpper And Not Notes(xI2).VPosition + Notes(xI2).Length < xVLower And nEnabled(Notes(xI2).ColumnIndex) - Next - Else - For xI2 As Integer = 1 To UBound(Notes) - Notes(xI2).Selected = Notes(xI2).VPosition >= xVLower And Notes(xI2).VPosition < xVUpper And nEnabled(Notes(xI2).ColumnIndex) - Next - End If - Else - For xI2 As Integer = 1 To UBound(Notes) - Notes(xI2).Selected = False - Next - End If - - End If - End Sub - - Private Sub OnSelectModeLeftClick(e As MouseEventArgs, NoteIndex As Integer, xTHeight As Integer, xVS As Integer) - If NoteIndex >= 0 And e.Clicks = 2 Then - DoubleClickNoteIndex(NoteIndex) - ElseIf NoteIndex > 0 Then - 'KMouseDown = -1 - ReDim SelectedNotes(-1) - - 'KMouseDown = xITemp - Notes(NoteIndex).TempMouseDown = True - - If My.Computer.Keyboard.CtrlKeyDown And Not ModifierMultiselectActive() Then - 'If Not K(xITemp).Selected Then K(xITemp).Selected = True - ctrlPressed = True - - ElseIf ModifierMultiselectActive() Then - For xI1 = 0 To UBound(Notes) - If IsNoteVisible(xI1, xTHeight, xVS) Then - If IsLabelMatch(Notes(xI1), NoteIndex) Then - Notes(xI1).Selected = Not Notes(xI1).Selected - End If - End If - Next - Else - ' az description: If the clicked note is not selected, select only this one. - 'Otherwise, we clicked an already selected note - 'and we should rebuild the selected note array. - If Not Notes(NoteIndex).Selected Then - For xI1 = 0 To UBound(Notes) - If Notes(xI1).Selected Then Notes(xI1).Selected = False - Next - Notes(NoteIndex).Selected = True - End If - - Dim SelectedCount As Integer = 0 - For xI1 = 0 To UBound(Notes) - If Notes(xI1).Selected Then SelectedCount += 1 - Next - - ' adjustsingle if selectedcount is 1 - bAdjustSingle = SelectedCount = 1 - - ReDim SelectedNotes(SelectedCount) - SelectedNotes(0) = Notes(NoteIndex) - Notes(NoteIndex).TempIndex = 0 - Dim idx = 1 - - ' Add already selected notes including this one - For xI1 = 1 To NoteIndex - 1 - If Notes(xI1).Selected Then - Notes(xI1).TempIndex = idx - SelectedNotes(idx) = Notes(xI1) - idx += 1 - End If - Next - For xI1 = NoteIndex + 1 To UBound(Notes) - If Notes(xI1).Selected Then - Notes(xI1).TempIndex = idx - SelectedNotes(idx) = Notes(xI1) - idx += 1 - End If - Next - - 'uCol = RealColumnToEnabled(K(xITemp).ColumnIndex) - 'uVPos = K(xITemp).VPosition - 'uNote = K(xITemp) - uAdded = False - - End If - - Else - ReDim SelectedNotes(-1) - LastMouseDownLocation = e.Location - If Not My.Computer.Keyboard.CtrlKeyDown Then - For xI1 = 0 To UBound(Notes) - Notes(xI1).Selected = False - Notes(xI1).TempSelected = False - Next - Else - For xI1 = 0 To UBound(Notes) - Notes(xI1).TempSelected = Notes(xI1).Selected - Next - End If - End If - End Sub - - ' Handles a double click on a note in select mode. - Private Sub DoubleClickNoteIndex(NoteIndex As Integer) - Dim Note As Note = Notes(NoteIndex) - Dim NoteColumn As Integer = Note.ColumnIndex - - If IsColumnNumeric(NoteColumn) Then - 'BPM/Stop prompt - Dim xMessage As String = Strings.Messages.PromptEnterNumeric - If NoteColumn = niBPM Then xMessage = Strings.Messages.PromptEnterBPM - If NoteColumn = niSTOP Then xMessage = Strings.Messages.PromptEnterSTOP - If NoteColumn = niSCROLL Then xMessage = Strings.Messages.PromptEnterSCROLL - - - Dim valstr As String = InputBox(xMessage, Text) - Dim PromptValue As Double = Val(valstr) * 10000 - If (NoteColumn = niSCROLL And valstr = "0") Or PromptValue <> 0 Then - - Dim xUndo As UndoRedo.LinkedURCmd = Nothing - Dim xRedo As UndoRedo.LinkedURCmd = Nothing - RedoRelabelNote(Note, PromptValue, xUndo, xRedo) - If NoteIndex = 0 Then - THBPM.Value = PromptValue / 10000 - Else - Notes(NoteIndex).Value = PromptValue - End If - AddUndo(xUndo, xRedo) - End If - Else - 'Label prompt - Dim xStr As String = UCase(Trim(InputBox(Strings.Messages.PromptEnter, Text))) - - If Len(xStr) = 0 Then Return - - If IsBase36(xStr) And Not (xStr = "00" Or xStr = "0") Then - Dim xUndo As UndoRedo.LinkedURCmd = Nothing - Dim xRedo As UndoRedo.LinkedURCmd = Nothing - RedoRelabelNote(Note, C36to10(xStr) * 10000, xUndo, xRedo) - Notes(NoteIndex).Value = C36to10(xStr) * 10000 - AddUndo(xUndo, xRedo) - Return - Else - Dim unused = MsgBox(Strings.Messages.InvalidLabel, MsgBoxStyle.Critical, Strings.Messages.Err) - End If - - End If - End Sub - - Private Function MouseInNote(e As MouseEventArgs, xHS As Long, xVS As Long, xHeight As Integer, note As Note) As Boolean - Return e.X >= HorizontalPositiontoDisplay(nLeft(note.ColumnIndex), xHS) + 1 And - e.X <= HorizontalPositiontoDisplay(nLeft(note.ColumnIndex) + GetColumnWidth(note.ColumnIndex), xHS) - 1 And - e.Y >= NoteRowToPanelHeight(note.VPosition + IIf(NTInput, note.Length, 0), xVS, xHeight) - vo.kHeight And - e.Y <= NoteRowToPanelHeight(note.VPosition, xVS, xHeight) - End Function - - Private Sub PMainInMouseEnter(sender As Object, e As EventArgs) Handles PMainIn.MouseEnter, PMainInL.MouseEnter, PMainInR.MouseEnter - spMouseOver = sender.Tag - Dim xPMainIn As Panel = sender - If AutoFocusMouseEnter AndAlso Focused Then Dim unused1 = xPMainIn.Focus() : PanelFocus = spMouseOver - If FirstMouseEnter Then FirstMouseEnter = False : Dim unused = xPMainIn.Focus() : PanelFocus = spMouseOver - End Sub - - Private Sub PMainInMouseLeave(sender As Object, e As EventArgs) Handles PMainIn.MouseLeave, PMainInL.MouseLeave, PMainInR.MouseLeave - KMouseOver = -1 - 'KMouseDown = -1 - ReDim SelectedNotes(-1) - TempVPosition = -1 - SelectedColumn = -1 - RefreshPanelAll() - End Sub - - Private Sub PMainInMouseMove(sender As Panel) - Dim p As Point = sender.PointToClient(Cursor.Position) - PMainInMouseMove(sender, New MouseEventArgs(MouseButtons.None, 0, p.X, p.Y, 0)) - End Sub - - Private Sub PMainInMouseMove(sender As Object, e As MouseEventArgs) Handles PMainIn.MouseMove, PMainInL.MouseMove, PMainInR.MouseMove - MouseMoveStatus = e.Location - - Dim iI As Integer = sender.Tag - - Dim xHS As Long = PanelhBMSCROLL(iI) - Dim xVS As Long = PanelVScroll(iI) - Dim xHeight As Integer = spMain(iI).Height - Dim xWidth As Integer = spMain(iI).Width - - Select Case e.Button - Case MouseButtons.None - 'If K Is Nothing Then Exit Select - If MiddleButtonClicked Then Exit Select - - If isFullScreen Then - If e.Y < 5 Then ToolStripContainer1.TopToolStripPanelVisible = True Else ToolStripContainer1.TopToolStripPanelVisible = False - End If - - Dim xMouseRemainInSameRegion As Boolean = False - - Dim noteIndex As Integer - Dim foundNoteIndex As Integer = -1 - For noteIndex = UBound(Notes) To 0 Step -1 - If MouseInNote(e, xHS, xVS, xHeight, Notes(noteIndex)) Then - foundNoteIndex = noteIndex - - xMouseRemainInSameRegion = foundNoteIndex = KMouseOver - If NTInput Then - Dim vy = NoteRowToPanelHeight(Notes(noteIndex).VPosition + Notes(noteIndex).Length, - xVS, xHeight) - - Dim xbAdjustUpper As Boolean = (e.Y <= vy) And ModifierLongNoteActive() - Dim xbAdjustLength As Boolean = (e.Y >= vy - vo.kHeight Or xbAdjustUpper) And ModifierLongNoteActive() - xMouseRemainInSameRegion = xMouseRemainInSameRegion And xbAdjustUpper = bAdjustUpper And xbAdjustLength = bAdjustLength - bAdjustUpper = xbAdjustUpper - bAdjustLength = xbAdjustLength - End If - - Exit For - End If - Next - - Dim xTempbTimeSelectionMode As Boolean = TBTimeSelect.Checked - - If TBSelect.Checked Or xTempbTimeSelectionMode Then - - If xMouseRemainInSameRegion Then Exit Select - If KMouseOver >= 0 Then KMouseOver = -1 - - If xTempbTimeSelectionMode Then - - vSelMouseOverLine = 0 - - If Math.Abs(e.Y - NoteRowToPanelHeight(vSelStart + vSelLength, xVS, xHeight)) <= vo.PEDeltaMouseOver Then - vSelMouseOverLine = 3 - ElseIf Math.Abs(e.Y - NoteRowToPanelHeight(vSelStart + vSelHalf, xVS, xHeight)) <= vo.PEDeltaMouseOver Then - vSelMouseOverLine = 2 - ElseIf Math.Abs(e.Y - NoteRowToPanelHeight(vSelStart, xVS, xHeight)) <= vo.PEDeltaMouseOver Then - vSelMouseOverLine = 1 - End If - - End If - - ' draw green highlight - If foundNoteIndex > -1 Then - DrawNoteHoverHighlight(iI, xHS, xVS, xHeight, foundNoteIndex) - End If - - KMouseOver = foundNoteIndex - - ElseIf TBWrite.Checked Then - TempVPosition = (xHeight - (xVS * gxHeight) - e.Y - 1) / gxHeight 'VPosition of the mouse - If gSnap Then TempVPosition = SnapToGrid(TempVPosition) - - SelectedColumn = GetColumnAtEvent(e, xHS) 'get the enabled column where mouse is - - TempLength = 0 - If foundNoteIndex > -1 Then TempLength = Notes(foundNoteIndex).Length - - RefreshPanelAll() - End If - - Case MouseButtons.Left - If tempFirstMouseDown And Not TBTimeSelect.Checked Then Exit Select + Private Sub PMainInPreviewKeyDown(sender As Object, e As PreviewKeyDownEventArgs) Handles PMainIn.PreviewKeyDown, PMainInL.PreviewKeyDown, PMainInR.PreviewKeyDown + If e.KeyCode = Keys.ShiftKey Or e.KeyCode = Keys.ControlKey Then + RefreshPanelAll() + POStatusRefresh() + Exit Sub + End If + + If e.KeyCode = 18 Then Exit Sub + + Dim iI As Integer = sender.Tag + Dim xI1 As Integer + Dim xTargetColumn As Integer = -1 + Dim xUndo As UndoRedo.LinkedURCmd = Nothing + Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void + Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo + ReDim SelectedNotes(-1) + + Select Case e.KeyCode + Case Keys.Up + Dim xVPosition As Double = 192 / gDivide + If My.Computer.Keyboard.CtrlKeyDown Then xVPosition = 1 + + 'Ks cannot be beyond the upper boundary + Dim muVPosition As Double = GetMaxVPosition() - 1 + For xI1 = 1 To UBound(Notes) + If Notes(xI1).Selected Then + 'K(xI1).VPosition = Math.Floor(K(xI1).VPosition / (192 / gDivide)) * 192 / gDivide + muVPosition = IIf(Notes(xI1).VPosition + IIf(NTInput, Notes(xI1).Length, 0) + xVPosition > muVPosition, + Notes(xI1).VPosition + IIf(NTInput, Notes(xI1).Length, 0) + xVPosition, + muVPosition) + End If + Next + muVPosition -= 191999 + + 'xRedo = sCmdKMs(0, xVPosition - muVPosition, True) + Dim xVPos As Double + For xI1 = 1 To UBound(Notes) + If Not Notes(xI1).Selected Then Continue For + + xVPos = Notes(xI1).VPosition + xVPosition - muVPosition + RedoMoveNote(Notes(xI1), Notes(xI1).ColumnIndex, xVPos, xUndo, xRedo) + Notes(xI1).VPosition = xVPos + Next + 'xUndo = sCmdKMs(0, -xVPosition + muVPosition, True) + + If xVPosition - muVPosition <> 0 Then AddUndo(xUndo, xBaseRedo.Next) + SortByVPositionInsertion() + UpdatePairing() + CalculateTotalPlayableNotes() + CalculateGreatestVPosition() + RefreshPanelAll() + + Case Keys.Down + Dim xVPosition As Double = -192 / gDivide + If My.Computer.Keyboard.CtrlKeyDown Then xVPosition = -1 + + 'Ks cannot be beyond the lower boundary + Dim mVPosition As Double = 0 + For xI1 = 1 To UBound(Notes) + If Notes(xI1).Selected Then + 'K(xI1).VPosition = Math.Ceiling(K(xI1).VPosition / (192 / gDivide)) * 192 / gDivide + mVPosition = IIf(Notes(xI1).VPosition + xVPosition < mVPosition, + Notes(xI1).VPosition + xVPosition, + mVPosition) + End If + Next + + 'xRedo = sCmdKMs(0, xVPosition - mVPosition, True) + Dim xVPos As Double + For xI1 = 1 To UBound(Notes) + If Not Notes(xI1).Selected Then Continue For + + xVPos = Notes(xI1).VPosition + xVPosition - mVPosition + RedoMoveNote(Notes(xI1), Notes(xI1).ColumnIndex, xVPos, xUndo, xRedo) + Notes(xI1).VPosition = xVPos + Next + 'xUndo = sCmdKMs(0, -xVPosition + mVPosition, True) + + If xVPosition - mVPosition <> 0 Then AddUndo(xUndo, xBaseRedo.Next) + SortByVPositionInsertion() + UpdatePairing() + CalculateTotalPlayableNotes() + CalculateGreatestVPosition() + RefreshPanelAll() + + Case Keys.Left + 'For xI1 = 1 To UBound(K) + ' If K(xI1).Selected Then K(xI1).ColumnIndex = RealColumnToEnabled(K(xI1).ColumnIndex) - 1 + 'Next + + 'Ks cannot be beyond the left boundary + Dim mLeft As Integer = 0 + For xI1 = 1 To UBound(Notes) + If Notes(xI1).Selected Then mLeft = IIf(ColumnArrayIndexToEnabledColumnIndex(Notes(xI1).ColumnIndex) - 1 < mLeft, + ColumnArrayIndexToEnabledColumnIndex(Notes(xI1).ColumnIndex) - 1, + mLeft) + Next + 'xRedo = sCmdKMs(-1 - mLeft, 0, True) + Dim xCol As Integer + For xI1 = 1 To UBound(Notes) + If Not Notes(xI1).Selected Then Continue For + + xCol = EnabledColumnIndexToColumnArrayIndex(ColumnArrayIndexToEnabledColumnIndex(Notes(xI1).ColumnIndex) - 1 - mLeft) + RedoMoveNote(Notes(xI1), xCol, Notes(xI1).VPosition, xUndo, xRedo) + Notes(xI1).ColumnIndex = xCol + Next + 'xUndo = sCmdKMs(1 + mLeft, 0, True) + + If -1 - mLeft <> 0 Then AddUndo(xUndo, xBaseRedo.Next) + UpdatePairing() + CalculateTotalPlayableNotes() + RefreshPanelAll() + + Case Keys.Right + 'xRedo = sCmdKMs(1, 0, True) + Dim xCol As Integer + For xI1 = 1 To UBound(Notes) + If Not Notes(xI1).Selected Then Continue For + + xCol = EnabledColumnIndexToColumnArrayIndex(ColumnArrayIndexToEnabledColumnIndex(Notes(xI1).ColumnIndex) + 1) + RedoMoveNote(Notes(xI1), xCol, Notes(xI1).VPosition, xUndo, xRedo) + Notes(xI1).ColumnIndex = xCol + Next + 'xUndo = sCmdKMs(-1, 0, True) + + AddUndo(xUndo, xBaseRedo.Next) + UpdatePairing() + CalculateTotalPlayableNotes() + RefreshPanelAll() + + Case Keys.Delete + mnDelete_Click(mnDelete, New EventArgs) + + Case Keys.Home + If PanelFocus = 0 Then LeftPanelScroll.Value = 0 + If PanelFocus = 1 Then MainPanelScroll.Value = 0 + If PanelFocus = 2 Then RightPanelScroll.Value = 0 + + Case Keys.End + If PanelFocus = 0 Then LeftPanelScroll.Value = LeftPanelScroll.Minimum + If PanelFocus = 1 Then MainPanelScroll.Value = MainPanelScroll.Minimum + If PanelFocus = 2 Then RightPanelScroll.Value = RightPanelScroll.Minimum + + Case Keys.PageUp + If PanelFocus = 0 Then LeftPanelScroll.Value = IIf(LeftPanelScroll.Value - gPgUpDn > LeftPanelScroll.Minimum, LeftPanelScroll.Value - gPgUpDn, LeftPanelScroll.Minimum) + If PanelFocus = 1 Then MainPanelScroll.Value = IIf(MainPanelScroll.Value - gPgUpDn > MainPanelScroll.Minimum, MainPanelScroll.Value - gPgUpDn, MainPanelScroll.Minimum) + If PanelFocus = 2 Then RightPanelScroll.Value = IIf(RightPanelScroll.Value - gPgUpDn > RightPanelScroll.Minimum, RightPanelScroll.Value - gPgUpDn, RightPanelScroll.Minimum) + + Case Keys.PageDown + If PanelFocus = 0 Then LeftPanelScroll.Value = IIf(LeftPanelScroll.Value + gPgUpDn < 0, LeftPanelScroll.Value + gPgUpDn, 0) + If PanelFocus = 1 Then MainPanelScroll.Value = IIf(MainPanelScroll.Value + gPgUpDn < 0, MainPanelScroll.Value + gPgUpDn, 0) + If PanelFocus = 2 Then RightPanelScroll.Value = IIf(RightPanelScroll.Value + gPgUpDn < 0, RightPanelScroll.Value + gPgUpDn, 0) + + Case Keys.Oemcomma + If gDivide * 2 <= CGDivide.Maximum Then CGDivide.Value = gDivide * 2 + + Case Keys.OemPeriod + If gDivide \ 2 >= CGDivide.Minimum Then CGDivide.Value = gDivide \ 2 + + Case Keys.OemQuestion + 'Dim xTempSwap As Integer = gSlash + 'gSlash = CGDivide.Value + 'CGDivide.Value = xTempSwap + CGDivide.Value = gSlash + + Case Keys.Oemplus + With CGHeight + .Value += IIf(.Value > .Maximum - .Increment, .Maximum - .Value, .Increment) + End With + + Case Keys.OemMinus + With CGHeight + .Value -= IIf(.Value < .Minimum + .Increment, .Value - .Minimum, .Increment) + End With + + Case Keys.Add + IncreaseCurrentWav() + Case Keys.Subtract + DecreaseCurrentWav() + + Case Keys.G + 'az: don't trigger when we use Go To Measure + If Not My.Computer.Keyboard.CtrlKeyDown Then CGSnap.Checked = Not gSnap + + Case Keys.L + If Not My.Computer.Keyboard.CtrlKeyDown Then POBLong_Click(Nothing, Nothing) + + Case Keys.S + If Not My.Computer.Keyboard.CtrlKeyDown Then POBNormal_Click(Nothing, Nothing) + + Case Keys.D + CGDisableVertical.Checked = Not CGDisableVertical.Checked + + Case Keys.NumPad0, Keys.D0 + MoveToBGM(xUndo, xRedo) + + Case Keys.Oem1, Keys.NumPad1, Keys.D1 : MoveToColumn(niA2, xUndo, xRedo) + Case Keys.Oem2, Keys.NumPad2, Keys.D2 : MoveToColumn(niA3, xUndo, xRedo) + Case Keys.Oem3, Keys.NumPad3, Keys.D3 : MoveToColumn(niA4, xUndo, xRedo) + Case Keys.Oem4, Keys.NumPad4, Keys.D4 : MoveToColumn(niA5, xUndo, xRedo) + Case Keys.Oem5, Keys.NumPad5, Keys.D5 : MoveToColumn(niA6, xUndo, xRedo) + Case Keys.Oem6, Keys.NumPad6, Keys.D6 : MoveToColumn(niA7, xUndo, xRedo) + Case Keys.Oem7, Keys.NumPad7, Keys.D7 : MoveToColumn(niA8, xUndo, xRedo) + Case Keys.Oem8, Keys.NumPad8, Keys.D8 : MoveToColumn(niA9, xUndo, xRedo) + + End Select + + If My.Computer.Keyboard.CtrlKeyDown And (Not My.Computer.Keyboard.AltKeyDown) And (Not My.Computer.Keyboard.ShiftKeyDown) Then + Select Case e.KeyCode + Case Keys.Z : TBUndo_Click(TBUndo, New EventArgs) + Case Keys.Y : TBRedo_Click(TBRedo, New EventArgs) + Case Keys.X : TBCut_Click(TBCut, New EventArgs) + Case Keys.C : TBCopy_Click(TBCopy, New EventArgs) + Case Keys.V : TBPaste_Click(TBPaste, New EventArgs) + Case Keys.A : mnSelectAll_Click(mnSelectAll, New EventArgs) + Case Keys.F : TBFind_Click(TBFind, New EventArgs) + Case Keys.T : TBStatistics_Click(TBStatistics, New EventArgs) + End Select + End If + + If ModifierMultiselectActive() Then + If e.KeyCode = Keys.A And KMouseOver <> -1 Then + SelectAllWithHoveredNoteLabel() + End If + End If + + PMainInMouseMove(sender) + POStatusRefresh() + End Sub + + Private Sub SelectAllWithHoveredNoteLabel() + For xI1 = 0 To UBound(Notes) + Notes(xI1).Selected = IIf(IsLabelMatch(Notes(xI1), KMouseOver), True, Notes(xI1).Selected) + Next + End Sub + + Private Function IsLabelMatch(note As Note, index As Integer) As Boolean + If TBShowFileName.Checked Then + Dim wavidx = Notes(index).Value / 10000 + Dim wav = hWAV(wavidx) + If hWAV(note.Value / 10000) = wav Then + Return True + End If + Else + If note.Value = Notes(index).Value Then + Return True + End If + End If + + Return False + End Function + + Private Sub DecreaseCurrentWav() + If LWAV.SelectedIndex = -1 Then + LWAV.SelectedIndex = 0 + Else + Dim newIndex As Integer = LWAV.SelectedIndex - 1 + If newIndex < 0 Then newIndex = 0 + LWAV.SelectedIndices.Clear() + LWAV.SelectedIndex = newIndex + End If + End Sub + + Private Sub IncreaseCurrentWav() + If LWAV.SelectedIndex = -1 Then + LWAV.SelectedIndex = 0 + Else + Dim newIndex As Integer = LWAV.SelectedIndex + 1 + If newIndex > LWAV.Items.Count - 1 Then newIndex = LWAV.Items.Count - 1 + LWAV.SelectedIndices.Clear() + LWAV.SelectedIndex = newIndex + ValidateWavListView() + End If + End Sub + + Private Sub DecreaseCurrentBmp() + If LBMP.SelectedIndex = -1 Then + LBMP.SelectedIndex = 0 + Else + Dim newIndex As Integer = LBMP.SelectedIndex - 1 + If newIndex < 0 Then newIndex = 0 + LBMP.SelectedIndices.Clear() + LBMP.SelectedIndex = newIndex + End If + End Sub + + Private Sub IncreaseCurrentBmp() + If LBMP.SelectedIndex = -1 Then + LBMP.SelectedIndex = 0 + Else + Dim newIndex As Integer = LBMP.SelectedIndex + 1 + If newIndex > LBMP.Items.Count - 1 Then newIndex = LBMP.Items.Count - 1 + LBMP.SelectedIndices.Clear() + LBMP.SelectedIndex = newIndex + ValidateWavListView() + End If + End Sub + + Private Sub MoveToBGM(xUndo As UndoRedo.LinkedURCmd, xRedo As UndoRedo.LinkedURCmd) + Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo + + For xI2 As Integer = 1 To UBound(Notes) + If Not Notes(xI2).Selected Then Continue For + + With Notes(xI2) + Dim currentBGMColumn As Integer = niB + + 'TODO: optimize the for loops below + If NTInput Then + For xI0 As Integer = 1 To UBound(Notes) + Dim IntersectA = Notes(xI0).VPosition <= Notes(xI2).VPosition + Notes(xI2).Length + Dim IntersectB = Notes(xI0).VPosition + Notes(xI0).Length >= Notes(xI2).VPosition + If Notes(xI0).ColumnIndex = currentBGMColumn AndAlso IntersectA And IntersectB Then + currentBGMColumn += 1 : xI0 = 1 + End If + Next + Else + For xI0 As Integer = 1 To UBound(Notes) + If Notes(xI0).ColumnIndex = currentBGMColumn AndAlso Notes(xI0).VPosition = Notes(xI2).VPosition Then + currentBGMColumn += 1 : xI0 = 1 + End If + Next + End If + + RedoMoveNote(Notes(xI2), currentBGMColumn, .VPosition, xUndo, xRedo) + .ColumnIndex = currentBGMColumn + End With + Next + AddUndo(xUndo, xBaseRedo.Next) + UpdatePairing() + CalculateTotalPlayableNotes() + RefreshPanelAll() + End Sub + + Private Sub MoveToColumn(xTargetColumn As Integer, xUndo As UndoRedo.LinkedURCmd, xRedo As UndoRedo.LinkedURCmd) + Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo + If xTargetColumn = -1 Then Return + + If Rscratch Then + Select Case xTargetColumn + Case niA2 : xTargetColumn = niA9 + Case niA3 : xTargetColumn = niA1 + Case niA4 : xTargetColumn = niA2 + Case niA5 : xTargetColumn = niA3 + Case niA6 : xTargetColumn = niA4 + Case niA7 : xTargetColumn = niA5 + Case niA8 : xTargetColumn = niA6 + Case niA9 : xTargetColumn = niA7 + End Select + End If + + If Not nEnabled(xTargetColumn) Then Return + Dim bMoveAndDeselectFirstNote = My.Computer.Keyboard.ShiftKeyDown + + For xI2 As Integer = 1 To UBound(Notes) + If Not Notes(xI2).Selected Then Continue For + + RedoMoveNote(Notes(xI2), xTargetColumn, Notes(xI2).VPosition, xUndo, xRedo) + Notes(xI2).ColumnIndex = xTargetColumn + + If bMoveAndDeselectFirstNote Then + Notes(xI2).Selected = False + PanelPreviewNoteIndex(xI2) + + ' az: Add selected notes to undo + ' to preserve selection status + ' this works because the note find + ' does not account for selection status + ' when checking equality! (equalsBMSE, equalsNT) + For xI3 As Integer = 1 To UBound(Notes) + If xI3 = xI2 Then Continue For + If Notes(xI3).Selected Then + RedoMoveNote(Notes(xI3), Notes(xI3).ColumnIndex, Notes(xI3).VPosition, xUndo, xRedo) + End If + Next + + Exit For + End If + Next + AddUndo(xUndo, xBaseRedo.Next) + UpdatePairing() + CalculateTotalPlayableNotes() + RefreshPanelAll() + End Sub + + Private Sub PMainInResize(sender As Object, e As EventArgs) Handles PMainIn.Resize, PMainInL.Resize, PMainInR.Resize + If Not Created Then Exit Sub + + Dim iI As Integer = sender.Tag + PanelWidth(0) = PMainL.Width + PanelWidth(1) = PMain.Width + PanelWidth(2) = PMainR.Width + + Select Case iI + Case 0 + LeftPanelScroll.LargeChange = sender.Height * 0.9 + LeftPanelScroll.Maximum = LeftPanelScroll.LargeChange - 1 + HSL.LargeChange = sender.Width / gxWidth + If HSL.Value > HSL.Maximum - HSL.LargeChange + 1 Then HSL.Value = HSL.Maximum - HSL.LargeChange + 1 + Case 1 + MainPanelScroll.LargeChange = sender.Height * 0.9 + MainPanelScroll.Maximum = MainPanelScroll.LargeChange - 1 + HS.LargeChange = sender.Width / gxWidth + If HS.Value > HS.Maximum - HS.LargeChange + 1 Then HS.Value = HS.Maximum - HS.LargeChange + 1 + Case 2 + RightPanelScroll.LargeChange = sender.Height * 0.9 + RightPanelScroll.Maximum = RightPanelScroll.LargeChange - 1 + HSR.LargeChange = sender.Width / gxWidth + If HSR.Value > HSR.Maximum - HSR.LargeChange + 1 Then HSR.Value = HSR.Maximum - HSR.LargeChange + 1 + End Select + RefreshPanel(iI, sender.DisplayRectangle) + End Sub + + Private Sub PMainInLostFocus(sender As Object, e As EventArgs) Handles PMainIn.LostFocus, PMainInL.LostFocus, PMainInR.LostFocus + RefreshPanelAll() + End Sub + + Private Sub PMainInMouseDown(sender As Object, e As MouseEventArgs) Handles PMainIn.MouseDown, PMainInL.MouseDown, PMainInR.MouseDown + tempFirstMouseDown = FirstClickDisabled And Not sender.Focused + + PanelFocus = sender.Tag + Dim unused = sender.Focus() + LastMouseDownLocation = New Point(-1, -1) + VSValue = PanelVScroll(PanelFocus) + + If NTInput Then bAdjustUpper = False : bAdjustLength = False + ctrlPressed = False : DuplicatedSelectedNotes = False + + If MiddleButtonClicked Then MiddleButtonClicked = False : Exit Sub + + Dim xHS As Long = PanelhBMSCROLL(PanelFocus) + Dim xVS As Long = PanelVScroll(PanelFocus) + Dim xHeight As Integer = spMain(PanelFocus).Height + + Select Case e.Button + Case MouseButtons.Left + If tempFirstMouseDown And Not TBTimeSelect.Checked Then RefreshPanelAll() : Exit Select + + KMouseOver = -1 + 'If K Is Nothing Then pMouseDown = e.Location : Exit Select + + 'Find the clicked K + Dim NoteIndex As Integer = GetClickedNote(e, xHS, xVS, xHeight) + + PanelPreviewNoteIndex(NoteIndex) + + For xI1 = 0 To UBound(Notes) + Notes(xI1).TempMouseDown = False + Next + + HandleCurrentModeOnClick(e, xHS, xVS, xHeight, NoteIndex) + RefreshPanelAll() + POStatusRefresh() + + Case MouseButtons.Middle + If MiddleButtonMoveMethod = 1 Then + tempX = e.X + tempY = e.Y + tempV = xVS + tempH = xHS + Else + MiddleButtonLocation = Cursor.Position + MiddleButtonClicked = True + TimerMiddle.Enabled = True + End If + + Case MouseButtons.Right + DeselectOrRemove(e, xHS, xVS, xHeight) + End Select + End Sub + + Private Sub DeselectOrRemove(e As MouseEventArgs, xHS As Long, xVS As Long, xHeight As Integer) + KMouseOver = -1 + 'KMouseDown = -1 + ReDim SelectedNotes(-1) + 'If K Is Nothing Then pMouseDown = e.Location : Exit Select + + If Not tempFirstMouseDown Then + + Dim xI1 As Integer + For xI1 = UBound(Notes) To 1 Step -1 + 'If mouse is clicking on a K + If MouseInNote(e, xHS, xVS, xHeight, Notes(xI1)) Then + + If My.Computer.Keyboard.ShiftKeyDown Then + If Not IsColumnNumeric(Notes(xI1).ColumnIndex) Then + If IsColumnSound(Notes(xI1).ColumnIndex) Then + LWAV.SelectedIndices.Clear() + LWAV.SelectedIndex = C36to10(C10to36(Notes(xI1).Value \ 10000)) - 1 + ValidateWavListView() + Else + LBMP.SelectedIndices.Clear() + LBMP.SelectedIndex = C36to10(C10to36(Notes(xI1).Value \ 10000)) - 1 + ValidateBmpListView() + End If + End If + Else + Dim xUndo As UndoRedo.LinkedURCmd = Nothing + Dim xRedo As UndoRedo.LinkedURCmd = Nothing + + RedoRemoveNote(Notes(xI1), xUndo, xRedo) + RemoveNote(xI1) + + AddUndo(xUndo, xRedo) + RefreshPanelAll() + End If + + Exit For + End If + Next + + CalculateTotalPlayableNotes() + End If + End Sub + + Private Function GetClickedNote(e As MouseEventArgs, xHS As Long, xVS As Long, xHeight As Integer) As Integer + Dim NoteIndex As Integer = -1 + For xI1 = UBound(Notes) To 0 Step -1 + 'If mouse is clicking on a K + If MouseInNote(e, xHS, xVS, xHeight, Notes(xI1)) Then + ' found it! + NoteIndex = xI1 + deltaVPosition = IIf(NTInput, GetMouseVPosition(False) - Notes(xI1).VPosition, 0) + + If NTInput And My.Computer.Keyboard.ShiftKeyDown Then + bAdjustUpper = e.Y <= NoteRowToPanelHeight(Notes(xI1).VPosition + Notes(xI1).Length, xVS, xHeight) + bAdjustLength = e.Y >= NoteRowToPanelHeight(Notes(xI1).VPosition, xVS, xHeight) - vo.kHeight Or bAdjustUpper + End If + + Exit For + + End If + Next + + Return NoteIndex + End Function + + Private Sub PanelPreviewNoteIndex(NoteIndex As Integer) + 'Play wav + If ClickStopPreview Then PreviewNote(String.Empty, True) + 'My.Computer.Audio.Stop() + If NoteIndex > 0 And PreviewOnClick AndAlso IsColumnSound(Notes(NoteIndex).ColumnIndex) Then + Dim xI2 As Integer = Notes(NoteIndex).Value \ 10000 + If Notes(NoteIndex).Landmine Then + xI2 = 0 + Else + If xI2 <= 0 Then xI2 = 1 + If xI2 >= 1296 Then xI2 = 1295 + End If + + If Not hWAV(xI2) = String.Empty Then ' AndAlso Path.GetExtension(hWAV(xI2)).ToLower = ".wav" Then + Dim xFileLocation As String = IIf(ExcludeFileName(FileName) = String.Empty, InitPath, ExcludeFileName(FileName)) & "\" & hWAV(xI2) + If Not ClickStopPreview Then PreviewNote(String.Empty, True) + PreviewNote(xFileLocation, False) + End If + End If + End Sub + + Private Sub HandleCurrentModeOnClick(e As MouseEventArgs, xHS As Long, xVS As Long, xHeight As Integer, ByRef NoteIndex As Integer) + If TBSelect.Checked Then + OnSelectModeLeftClick(e, NoteIndex, xHeight, xVS) + ElseIf NTInput And TBWrite.Checked Then + TempVPosition = -1 + SelectedColumn = -1 + ShouldDrawTempNote = False + + Dim xVPosition = GetMouseVPosition(gSnap) + + If xVPosition < 0 Or xVPosition >= GetMaxVPosition() Then Exit Sub + + Dim xColumn = GetColumnAtEvent(e, xHS) + + For xI2 As Integer = UBound(Notes) To 1 Step -1 + If Notes(xI2).VPosition = xVPosition And Notes(xI2).ColumnIndex = xColumn Then NoteIndex = xI2 : Exit For + Next + + Dim Hidden As Boolean = ModifierHiddenActive() + + If NoteIndex > 0 Then + ReDim SelectedNotes(0) + SelectedNotes(0) = Notes(NoteIndex) + Notes(NoteIndex).TempIndex = 0 + + 'KMouseDown = xITemp + Notes(NoteIndex).TempMouseDown = True + Notes(NoteIndex).Length = xVPosition - Notes(NoteIndex).VPosition + + 'uVPos = K(xITemp).VPosition + bAdjustUpper = True + + Dim xUndo As UndoRedo.LinkedURCmd = Nothing + Dim xRedo As UndoRedo.LinkedURCmd = Nothing + + + RedoLongNoteModify(SelectedNotes(0), Notes(NoteIndex).VPosition, Notes(NoteIndex).Length, xUndo, xRedo) + AddUndo(xUndo, xRedo) + 'With uNote + ' AddUndo(sCmdKL(.ColumnIndex, .VPosition, .Value, K(xITemp).Length, .Hidden, .Length, True, True), _ + ' sCmdKL(.ColumnIndex, .VPosition, .Value, .Length, .Hidden, K(xITemp).Length, True, True)) + 'End With + + ElseIf IsColumnNumeric(xColumn) Then + + Dim xMessage As String = Strings.Messages.PromptEnterNumeric + If xColumn = niBPM Then xMessage = Strings.Messages.PromptEnterBPM + If xColumn = niSTOP Then xMessage = Strings.Messages.PromptEnterSTOP + If xColumn = niSCROLL Then xMessage = Strings.Messages.PromptEnterSCROLL + + Dim valstr As String = InputBox(xMessage, Text) + Dim value As Double = Val(valstr) * 10000 + + If (xColumn = niSCROLL And valstr = "0") Or value <> 0 Then + If xColumn <> niSCROLL And value <= 0 Then value = 1 + + Dim xUndo As UndoRedo.LinkedURCmd = Nothing + Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void + Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo + + For xI1 = 1 To UBound(Notes) + If Notes(xI1).VPosition = xVPosition AndAlso Notes(xI1).ColumnIndex = xColumn Then _ + RedoRemoveNote(Notes(xI1), xUndo, xRedo) + Next + + Dim n = New Note(xColumn, xVPosition, value, 0, Hidden) + RedoAddNote(n, xUndo, xRedo) + + AddNote(n) + AddUndo(xUndo, xBaseRedo.Next) + End If + + ShouldDrawTempNote = True + + Else + Dim xLbl = If(IsColumnSound(xColumn), (LWAV.SelectedIndex + 1) * 10000, (LBMP.SelectedIndex + 1) * 10000) + + Dim Landmine As Boolean = ModifierLandmineActive() + + ReDim Preserve Notes(UBound(Notes) + 1) + With Notes(UBound(Notes)) + .VPosition = xVPosition + .ColumnIndex = xColumn + .Value = xLbl + .Hidden = Hidden + .Landmine = Landmine + .TempMouseDown = True + End With + + ReDim SelectedNotes(0) + SelectedNotes(0) = Notes(UBound(Notes)) + SelectedNotes(0).LNPair = -1 + + If TBWavIncrease.Checked Then + If IsColumnSound(xColumn) Then + IncreaseCurrentWav() + Else + IncreaseCurrentBmp() + End If + End If + + 'KMouseDown = 1 + + 'uNote.Value = 0 + 'uVPos = xVPosition + uAdded = False + + Dim xUndo As UndoRedo.LinkedURCmd = Nothing + Dim xRedo As UndoRedo.LinkedURCmd = Nothing + RedoAddNote(Notes(UBound(Notes)), xUndo, xRedo, TBWavIncrease.Checked) + AddUndo(xUndo, xRedo) + End If + + SortByVPositionInsertion() + UpdatePairing() + CalculateTotalPlayableNotes() + + ElseIf TBTimeSelect.Checked Then + + Dim xL1 As Double + If NoteIndex >= 0 Then xL1 = Notes(NoteIndex).VPosition _ + Else xL1 = (xHeight - (xVS * gxHeight) - e.Y - 1) / gxHeight + + vSelAdjust = ModifierLongNoteActive() + + vSelMouseOverLine = 0 + If Math.Abs(e.Y - NoteRowToPanelHeight(vSelStart + vSelLength, xVS, xHeight)) <= vo.PEDeltaMouseOver Then + vSelMouseOverLine = 3 + ElseIf Math.Abs(e.Y - NoteRowToPanelHeight(vSelStart + vSelHalf, xVS, xHeight)) <= vo.PEDeltaMouseOver Then + vSelMouseOverLine = 2 + ElseIf Math.Abs(e.Y - NoteRowToPanelHeight(vSelStart, xVS, xHeight)) <= vo.PEDeltaMouseOver Then + vSelMouseOverLine = 1 + End If + + If Not vSelAdjust Then + If vSelMouseOverLine = 1 Then + If gSnap And NoteIndex <= 0 Then xL1 = SnapToGrid(xL1) + vSelLength += vSelStart - xL1 + vSelHalf += vSelStart - xL1 + vSelStart = xL1 + + ElseIf vSelMouseOverLine = 2 Then + vSelHalf = xL1 + If gSnap And NoteIndex <= 0 Then vSelHalf = SnapToGrid(vSelHalf) + vSelHalf -= vSelStart + + ElseIf vSelMouseOverLine = 3 Then + vSelLength = xL1 + If gSnap And NoteIndex <= 0 Then vSelLength = SnapToGrid(vSelLength) + vSelLength -= vSelStart + + Else + vSelLength = 0 + vSelStart = xL1 + If gSnap And NoteIndex <= 0 Then vSelStart = SnapToGrid(vSelStart) + End If + ValidateSelection() + + Else + If vSelMouseOverLine = 2 Then + SortByVPositionInsertion() + vSelPStart = vSelStart + vSelPLength = vSelLength + vSelPHalf = vSelHalf + vSelK = Notes + ReDim Preserve vSelK(UBound(vSelK)) + + If gSnap And NoteIndex <= 0 And Not My.Computer.Keyboard.CtrlKeyDown Then xL1 = SnapToGrid(xL1) + AddUndo(New UndoRedo.Void, New UndoRedo.Void) + BPMChangeHalf(xL1 - vSelHalf - vSelStart, , True) + SortByVPositionInsertion() + UpdatePairing() + CalculateGreatestVPosition() + + ElseIf vSelMouseOverLine = 3 Or vSelMouseOverLine = 1 Then + SortByVPositionInsertion() + vSelPStart = vSelStart + vSelPLength = vSelLength + vSelPHalf = vSelHalf + vSelK = Notes + ReDim Preserve vSelK(UBound(vSelK)) + + If gSnap And NoteIndex <= 0 And Not My.Computer.Keyboard.CtrlKeyDown Then xL1 = SnapToGrid(xL1) + AddUndo(New UndoRedo.Void, New UndoRedo.Void) + BPMChangeTop(IIf(vSelMouseOverLine = 3, xL1 - vSelStart, vSelStart + vSelLength - xL1) / vSelLength, , True) + SortByVPositionInsertion() + UpdatePairing() + CalculateGreatestVPosition() + + Else + vSelLength = xL1 + If gSnap And NoteIndex <= 0 And Not My.Computer.Keyboard.CtrlKeyDown Then vSelLength = SnapToGrid(vSelLength) + vSelLength -= vSelStart + End If + + End If + + If vSelLength Then + Dim xVLower As Double = IIf(vSelLength > 0, vSelStart, vSelStart + vSelLength) + Dim xVUpper As Double = IIf(vSelLength < 0, vSelStart, vSelStart + vSelLength) + If NTInput Then + For xI2 As Integer = 1 To UBound(Notes) + Notes(xI2).Selected = Not Notes(xI2).VPosition >= xVUpper And Not Notes(xI2).VPosition + Notes(xI2).Length < xVLower And nEnabled(Notes(xI2).ColumnIndex) + Next + Else + For xI2 As Integer = 1 To UBound(Notes) + Notes(xI2).Selected = Notes(xI2).VPosition >= xVLower And Notes(xI2).VPosition < xVUpper And nEnabled(Notes(xI2).ColumnIndex) + Next + End If + Else + For xI2 As Integer = 1 To UBound(Notes) + Notes(xI2).Selected = False + Next + End If + + End If + End Sub + + Private Sub OnSelectModeLeftClick(e As MouseEventArgs, NoteIndex As Integer, xTHeight As Integer, xVS As Integer) + If NoteIndex >= 0 And e.Clicks = 2 Then + DoubleClickNoteIndex(NoteIndex) + ElseIf NoteIndex > 0 Then + 'KMouseDown = -1 + ReDim SelectedNotes(-1) + + 'KMouseDown = xITemp + Notes(NoteIndex).TempMouseDown = True + + If My.Computer.Keyboard.CtrlKeyDown And Not ModifierMultiselectActive() Then + 'If Not K(xITemp).Selected Then K(xITemp).Selected = True + ctrlPressed = True + + ElseIf ModifierMultiselectActive() Then + For xI1 = 0 To UBound(Notes) + If IsNoteVisible(xI1, xTHeight, xVS) Then + If IsLabelMatch(Notes(xI1), NoteIndex) Then + Notes(xI1).Selected = Not Notes(xI1).Selected + End If + End If + Next + Else + ' az description: If the clicked note is not selected, select only this one. + 'Otherwise, we clicked an already selected note + 'and we should rebuild the selected note array. + If Not Notes(NoteIndex).Selected Then + For xI1 = 0 To UBound(Notes) + If Notes(xI1).Selected Then Notes(xI1).Selected = False + Next + Notes(NoteIndex).Selected = True + End If + + Dim SelectedCount As Integer = 0 + For xI1 = 0 To UBound(Notes) + If Notes(xI1).Selected Then SelectedCount += 1 + Next + + ' adjustsingle if selectedcount is 1 + bAdjustSingle = SelectedCount = 1 + + ReDim SelectedNotes(SelectedCount) + SelectedNotes(0) = Notes(NoteIndex) + Notes(NoteIndex).TempIndex = 0 + Dim idx = 1 + + ' Add already selected notes including this one + For xI1 = 1 To NoteIndex - 1 + If Notes(xI1).Selected Then + Notes(xI1).TempIndex = idx + SelectedNotes(idx) = Notes(xI1) + idx += 1 + End If + Next + For xI1 = NoteIndex + 1 To UBound(Notes) + If Notes(xI1).Selected Then + Notes(xI1).TempIndex = idx + SelectedNotes(idx) = Notes(xI1) + idx += 1 + End If + Next + + 'uCol = RealColumnToEnabled(K(xITemp).ColumnIndex) + 'uVPos = K(xITemp).VPosition + 'uNote = K(xITemp) + uAdded = False + + End If + + Else + ReDim SelectedNotes(-1) + LastMouseDownLocation = e.Location + If Not My.Computer.Keyboard.CtrlKeyDown Then + For xI1 = 0 To UBound(Notes) + Notes(xI1).Selected = False + Notes(xI1).TempSelected = False + Next + Else + For xI1 = 0 To UBound(Notes) + Notes(xI1).TempSelected = Notes(xI1).Selected + Next + End If + End If + End Sub + + ' Handles a double click on a note in select mode. + Private Sub DoubleClickNoteIndex(NoteIndex As Integer) + Dim Note As Note = Notes(NoteIndex) + Dim NoteColumn As Integer = Note.ColumnIndex + + If IsColumnNumeric(NoteColumn) Then + 'BPM/Stop prompt + Dim xMessage As String = Strings.Messages.PromptEnterNumeric + If NoteColumn = niBPM Then xMessage = Strings.Messages.PromptEnterBPM + If NoteColumn = niSTOP Then xMessage = Strings.Messages.PromptEnterSTOP + If NoteColumn = niSCROLL Then xMessage = Strings.Messages.PromptEnterSCROLL + + + Dim valstr As String = InputBox(xMessage, Text) + Dim PromptValue As Double = Val(valstr) * 10000 + If (NoteColumn = niSCROLL And valstr = "0") Or PromptValue <> 0 Then + + Dim xUndo As UndoRedo.LinkedURCmd = Nothing + Dim xRedo As UndoRedo.LinkedURCmd = Nothing + RedoRelabelNote(Note, PromptValue, xUndo, xRedo) + If NoteIndex = 0 Then + THBPM.Value = PromptValue / 10000 + Else + Notes(NoteIndex).Value = PromptValue + End If + AddUndo(xUndo, xRedo) + End If + Else + 'Label prompt + Dim xStr As String = UCase(Trim(InputBox(Strings.Messages.PromptEnter, Text))) + + If Len(xStr) = 0 Then Return + + If IsBase36(xStr) And Not (xStr = "00" Or xStr = "0") Then + Dim xUndo As UndoRedo.LinkedURCmd = Nothing + Dim xRedo As UndoRedo.LinkedURCmd = Nothing + RedoRelabelNote(Note, C36to10(xStr) * 10000, xUndo, xRedo) + Notes(NoteIndex).Value = C36to10(xStr) * 10000 + AddUndo(xUndo, xRedo) + Return + Else + Dim unused = MsgBox(Strings.Messages.InvalidLabel, MsgBoxStyle.Critical, Strings.Messages.Err) + End If + + End If + End Sub + + Private Function MouseInNote(e As MouseEventArgs, xHS As Long, xVS As Long, xHeight As Integer, note As Note) As Boolean + Return e.X >= HorizontalPositiontoDisplay(nLeft(note.ColumnIndex), xHS) + 1 And + e.X <= HorizontalPositiontoDisplay(nLeft(note.ColumnIndex) + GetColumnWidth(note.ColumnIndex), xHS) - 1 And + e.Y >= NoteRowToPanelHeight(note.VPosition + IIf(NTInput, note.Length, 0), xVS, xHeight) - vo.kHeight And + e.Y <= NoteRowToPanelHeight(note.VPosition, xVS, xHeight) + End Function + + Private Sub PMainInMouseEnter(sender As Object, e As EventArgs) Handles PMainIn.MouseEnter, PMainInL.MouseEnter, PMainInR.MouseEnter + spMouseOver = sender.Tag + Dim xPMainIn As Panel = sender + If AutoFocusMouseEnter AndAlso Focused Then Dim unused1 = xPMainIn.Focus() : PanelFocus = spMouseOver + If FirstMouseEnter Then FirstMouseEnter = False : Dim unused = xPMainIn.Focus() : PanelFocus = spMouseOver + End Sub + + Private Sub PMainInMouseLeave(sender As Object, e As EventArgs) Handles PMainIn.MouseLeave, PMainInL.MouseLeave, PMainInR.MouseLeave + KMouseOver = -1 + 'KMouseDown = -1 + ReDim SelectedNotes(-1) + TempVPosition = -1 + SelectedColumn = -1 + RefreshPanelAll() + End Sub + + Private Sub PMainInMouseMove(sender As Panel) + Dim p As Point = sender.PointToClient(Cursor.Position) + PMainInMouseMove(sender, New MouseEventArgs(MouseButtons.None, 0, p.X, p.Y, 0)) + End Sub + + Private Sub PMainInMouseMove(sender As Object, e As MouseEventArgs) Handles PMainIn.MouseMove, PMainInL.MouseMove, PMainInR.MouseMove + MouseMoveStatus = e.Location + + Dim iI As Integer = sender.Tag + + Dim xHS As Long = PanelhBMSCROLL(iI) + Dim xVS As Long = PanelVScroll(iI) + Dim xHeight As Integer = spMain(iI).Height + Dim xWidth As Integer = spMain(iI).Width + + Select Case e.Button + Case MouseButtons.None + 'If K Is Nothing Then Exit Select + If MiddleButtonClicked Then Exit Select + + If isFullScreen Then + If e.Y < 5 Then ToolStripContainer1.TopToolStripPanelVisible = True Else ToolStripContainer1.TopToolStripPanelVisible = False + End If + + Dim xMouseRemainInSameRegion As Boolean = False + + Dim noteIndex As Integer + Dim foundNoteIndex As Integer = -1 + For noteIndex = UBound(Notes) To 0 Step -1 + If MouseInNote(e, xHS, xVS, xHeight, Notes(noteIndex)) Then + foundNoteIndex = noteIndex + + xMouseRemainInSameRegion = foundNoteIndex = KMouseOver + If NTInput Then + Dim vy = NoteRowToPanelHeight(Notes(noteIndex).VPosition + Notes(noteIndex).Length, + xVS, xHeight) + + Dim xbAdjustUpper As Boolean = (e.Y <= vy) And ModifierLongNoteActive() + Dim xbAdjustLength As Boolean = (e.Y >= vy - vo.kHeight Or xbAdjustUpper) And ModifierLongNoteActive() + xMouseRemainInSameRegion = xMouseRemainInSameRegion And xbAdjustUpper = bAdjustUpper And xbAdjustLength = bAdjustLength + bAdjustUpper = xbAdjustUpper + bAdjustLength = xbAdjustLength + End If + + Exit For + End If + Next + + Dim xTempbTimeSelectionMode As Boolean = TBTimeSelect.Checked + + If TBSelect.Checked Or xTempbTimeSelectionMode Then + + If xMouseRemainInSameRegion Then Exit Select + If KMouseOver >= 0 Then KMouseOver = -1 + + If xTempbTimeSelectionMode Then + + vSelMouseOverLine = 0 + + If Math.Abs(e.Y - NoteRowToPanelHeight(vSelStart + vSelLength, xVS, xHeight)) <= vo.PEDeltaMouseOver Then + vSelMouseOverLine = 3 + ElseIf Math.Abs(e.Y - NoteRowToPanelHeight(vSelStart + vSelHalf, xVS, xHeight)) <= vo.PEDeltaMouseOver Then + vSelMouseOverLine = 2 + ElseIf Math.Abs(e.Y - NoteRowToPanelHeight(vSelStart, xVS, xHeight)) <= vo.PEDeltaMouseOver Then + vSelMouseOverLine = 1 + End If + + End If + + ' draw green highlight + If foundNoteIndex > -1 Then + DrawNoteHoverHighlight(iI, xHS, xVS, xHeight, foundNoteIndex) + End If + + KMouseOver = foundNoteIndex + + ElseIf TBWrite.Checked Then + TempVPosition = (xHeight - (xVS * gxHeight) - e.Y - 1) / gxHeight 'VPosition of the mouse + If gSnap Then TempVPosition = SnapToGrid(TempVPosition) + + SelectedColumn = GetColumnAtEvent(e, xHS) 'get the enabled column where mouse is + + TempLength = 0 + If foundNoteIndex > -1 Then TempLength = Notes(foundNoteIndex).Length + + RefreshPanelAll() + End If + + Case MouseButtons.Left + If tempFirstMouseDown And Not TBTimeSelect.Checked Then Exit Select - tempX = 0 - tempY = 0 - If e.X < 0 Or e.X > xWidth Or e.Y < 0 Or e.Y > xHeight Then - If e.X < 0 Then tempX = e.X - If e.X > xWidth Then tempX = e.X - xWidth - If e.Y < 0 Then tempY = e.Y - If e.Y > xHeight Then tempY = e.Y - xHeight - Timer1.Enabled = True - Else - Timer1.Enabled = False - End If + tempX = 0 + tempY = 0 + If e.X < 0 Or e.X > xWidth Or e.Y < 0 Or e.Y > xHeight Then + If e.X < 0 Then tempX = e.X + If e.X > xWidth Then tempX = e.X - xWidth + If e.Y < 0 Then tempY = e.Y + If e.Y > xHeight Then tempY = e.Y - xHeight + Timer1.Enabled = True + Else + Timer1.Enabled = False + End If - If TBSelect.Checked Then + If TBSelect.Checked Then - pMouseMove = e.Location + pMouseMove = e.Location - 'If K Is Nothing Then RefreshPanelAll() : Exit Select - - If Not LastMouseDownLocation = New Point(-1, -1) Then - UpdateSelectionBox(xHS, xVS, xHeight) - - 'ElseIf Not KMouseDown = -1 Then - ElseIf SelectedNotes.Length <> 0 Then - UpdateSelectedNotes(xHeight, xVS, xHS, e) - - ElseIf ctrlPressed Then - OnDuplicateSelectedNotes(xHeight, xVS, xHS, e) - End If + 'If K Is Nothing Then RefreshPanelAll() : Exit Select + + If Not LastMouseDownLocation = New Point(-1, -1) Then + UpdateSelectionBox(xHS, xVS, xHeight) + + 'ElseIf Not KMouseDown = -1 Then + ElseIf SelectedNotes.Length <> 0 Then + UpdateSelectedNotes(xHeight, xVS, xHS, e) + + ElseIf ctrlPressed Then + OnDuplicateSelectedNotes(xHeight, xVS, xHS, e) + End If - ElseIf TBWrite.Checked Then + ElseIf TBWrite.Checked Then - If NTInput Then - OnWriteModeMouseMove(xHeight, xVS, e) + If NTInput Then + OnWriteModeMouseMove(xHeight, xVS, e) - Else - TempVPosition = (xHeight - (xVS * gxHeight) - e.Y - 1) / gxHeight 'VPosition of the mouse - If gSnap Then TempVPosition = SnapToGrid(TempVPosition) - SelectedColumn = GetColumnAtEvent(e, xHS) 'get the enabled column where mouse is + Else + TempVPosition = (xHeight - (xVS * gxHeight) - e.Y - 1) / gxHeight 'VPosition of the mouse + If gSnap Then TempVPosition = SnapToGrid(TempVPosition) + SelectedColumn = GetColumnAtEvent(e, xHS) 'get the enabled column where mouse is - End If + End If - ElseIf TBTimeSelect.Checked Then - OnTimeSelectClick(xHeight, xHS, xVS, e) - End If + ElseIf TBTimeSelect.Checked Then + OnTimeSelectClick(xHeight, xHS, xVS, e) + End If - Case MouseButtons.Middle - OnPanelMousePan(e) - End Select - Dim col = GetColumnAtEvent(e, xHS) - Dim vps = GetMouseVPosition(gSnap) - If vps <> lastVPos Or col <> lastColumn Then - lastVPos = vps - lastColumn = col - POStatusRefresh() - RefreshPanelAll() 'az: refreshing the line is important now... - End If - - End Sub - - Private lastVPos = -1 - Private lastColumn = -1 - - Private Sub UpdateSelectedNotes(xHeight As Double, xvs As Double, xhs As Double, e As MouseEventArgs) - Dim mouseVPosition As Double - - Dim xITemp As Integer - For xI1 = 1 To UBound(Notes) - If Notes(xI1).TempMouseDown Then xITemp = xI1 : Exit For - Next - - mouseVPosition = GetMouseVPosition(gSnap) - - If bAdjustLength And bAdjustSingle Then - If bAdjustUpper AndAlso mouseVPosition < Notes(xITemp).VPosition Then - bAdjustUpper = False - Notes(xITemp).VPosition += Notes(xITemp).Length - Notes(xITemp).Length *= -1 - ElseIf Not bAdjustUpper AndAlso mouseVPosition > Notes(xITemp).VPosition + Notes(xITemp).Length Then - bAdjustUpper = True - Notes(xITemp).VPosition += Notes(xITemp).Length - Notes(xITemp).Length *= -1 - End If - End If - - 'If moving - If Not bAdjustLength Then - OnSelectModeMoveNotes(e, xhs, xITemp) - - ElseIf bAdjustUpper Then 'If adjusting upper end - Dim dVPosition = mouseVPosition - Notes(xITemp).VPosition - Notes(xITemp).Length 'delta Length - '< 0 means shorten, > 0 means lengthen - - OnAdjustUpperEnd(dVPosition) - - Else 'If adjusting lower end - Dim dVPosition = mouseVPosition - Notes(xITemp).VPosition 'delta VPosition - '> 0 means shorten, < 0 means lengthen - - OnAdjustLowerEnd(dVPosition) - End If - - SortByVPositionInsertion() - UpdatePairing() - CalculateTotalPlayableNotes() - 'Label1.Text = KInfo(KMouseDown) - End Sub - - Private Sub OnPanelMousePan(e As MouseEventArgs) - If MiddleButtonMoveMethod = 1 Then - Dim xI1 As Integer = tempV + ((tempY - e.Y) / gxHeight) - Dim xI2 As Integer = tempH + ((tempX - e.X) / gxWidth) - If xI1 > 0 Then xI1 = 0 - If xI2 < 0 Then xI2 = 0 - - Select Case PanelFocus - Case 0 - If xI1 < LeftPanelScroll.Minimum Then xI1 = LeftPanelScroll.Minimum - LeftPanelScroll.Value = xI1 - - If xI2 > HSL.Maximum - HSL.LargeChange + 1 Then xI2 = HSL.Maximum - HSL.LargeChange + 1 - HSL.Value = xI2 - - Case 1 - If xI1 < MainPanelScroll.Minimum Then xI1 = MainPanelScroll.Minimum - MainPanelScroll.Value = xI1 - - If xI2 > HS.Maximum - HS.LargeChange + 1 Then xI2 = HS.Maximum - HS.LargeChange + 1 - HS.Value = xI2 - - Case 2 - If xI1 < RightPanelScroll.Minimum Then xI1 = RightPanelScroll.Minimum - RightPanelScroll.Value = xI1 - - If xI2 > HSR.Maximum - HSR.LargeChange + 1 Then xI2 = HSR.Maximum - HSR.LargeChange + 1 - HSR.Value = xI2 - - End Select - End If - End Sub - - Private Sub OnTimeSelectClick(xHeight As Double, xHS As Double, xvs As Double, e As MouseEventArgs) - Dim xI1 As Integer - Dim xITemp As Integer = -1 - If Notes IsNot Nothing Then - For xI1 = UBound(Notes) To 0 Step -1 ' az: MouseInNote implied, but I'm not sure yet - If MouseInNote(e, xHS, xvs, xHeight, Notes(xI1)) Then - xITemp = xI1 - Exit For - End If - Next - End If - - If Not vSelAdjust Then - If vSelMouseOverLine = 1 Then - Dim xV As Double = (xHeight - (xvs * gxHeight) - e.Y - 1) / gxHeight - If xITemp >= 0 Then xV = Notes(xITemp).VPosition - If gSnap And xITemp <= 0 And Not My.Computer.Keyboard.CtrlKeyDown Then xV = SnapToGrid(xV) - vSelLength += vSelStart - xV - vSelHalf += vSelStart - xV - vSelStart = xV - - ElseIf vSelMouseOverLine = 2 Then - vSelHalf = (xHeight - (xvs * gxHeight) - e.Y - 1) / gxHeight - If xITemp >= 0 Then vSelHalf = Notes(xITemp).VPosition - If gSnap And xITemp <= 0 And Not My.Computer.Keyboard.CtrlKeyDown Then vSelHalf = SnapToGrid(vSelHalf) - vSelHalf -= vSelStart - - ElseIf vSelMouseOverLine = 3 Then - vSelLength = (xHeight - (xvs * gxHeight) - e.Y - 1) / gxHeight - If xITemp >= 0 Then vSelLength = Notes(xITemp).VPosition - If gSnap And xITemp <= 0 And Not My.Computer.Keyboard.CtrlKeyDown Then vSelLength = SnapToGrid(vSelLength) - vSelLength -= vSelStart - - Else - If xITemp >= 0 Then - vSelLength = Notes(xITemp).VPosition - Else - vSelLength = (xHeight - (xvs * gxHeight) - e.Y - 1) / gxHeight - If gSnap And Not My.Computer.Keyboard.CtrlKeyDown Then vSelLength = SnapToGrid(vSelLength) - End If - vSelLength -= vSelStart - vSelHalf = vSelLength / 2 - End If - ValidateSelection() - - Else - Dim xL1 As Double = (xHeight - (xvs * gxHeight) - e.Y - 1) / gxHeight - - If vSelMouseOverLine = 2 Then - vSelStart = vSelPStart - vSelLength = vSelPLength - vSelHalf = vSelPHalf - Notes = vSelK - ReDim Preserve Notes(UBound(Notes)) - - If gSnap And Not My.Computer.Keyboard.CtrlKeyDown Then xL1 = SnapToGrid(xL1) - BPMChangeHalf(xL1 - vSelHalf - vSelStart, , True) - SortByVPositionInsertion() - UpdatePairing() - CalculateGreatestVPosition() - - ElseIf vSelMouseOverLine = 3 Or vSelMouseOverLine = 1 Then - vSelStart = vSelPStart - vSelLength = vSelPLength - vSelHalf = vSelPHalf - Notes = vSelK - ReDim Preserve Notes(UBound(Notes)) - - If gSnap And Not My.Computer.Keyboard.CtrlKeyDown Then xL1 = SnapToGrid(xL1) - BPMChangeTop(IIf(vSelMouseOverLine = 3, xL1 - vSelStart, vSelStart + vSelLength - xL1) / vSelLength, , True) - SortByVPositionInsertion() - UpdatePairing() - CalculateGreatestVPosition() - - Else - vSelLength = xL1 - If gSnap And Not My.Computer.Keyboard.CtrlKeyDown Then vSelLength = SnapToGrid(vSelLength) - If xITemp >= 0 Then vSelLength = Notes(xITemp).VPosition - vSelLength -= vSelStart - ValidateSelection() - End If - End If - - If vSelLength Then - Dim xVLower As Double = IIf(vSelLength > 0, vSelStart, vSelStart + vSelLength) - Dim xVUpper As Double = IIf(vSelLength < 0, vSelStart, vSelStart + vSelLength) - If NTInput Then - For xI2 As Integer = 1 To UBound(Notes) - Notes(xI2).Selected = Notes(xI2).VPosition < xVUpper And Notes(xI2).VPosition + Notes(xI2).Length >= xVLower And nEnabled(Notes(xI2).ColumnIndex) - Next - Else - For xI2 As Integer = 1 To UBound(Notes) - Notes(xI2).Selected = Notes(xI2).VPosition >= xVLower And Notes(xI2).VPosition < xVUpper And nEnabled(Notes(xI2).ColumnIndex) - Next - End If - Else - For xI2 As Integer = 1 To UBound(Notes) - Notes(xI2).Selected = False - Next - End If - - End Sub - - Private Sub OnAdjustUpperEnd(dVPosition As Double) - Dim minLength As Double = 0 - Dim maxHeight As Double = 191999 - For xI1 = 1 To UBound(Notes) - If Not Notes(xI1).Selected Then Continue For - If Notes(xI1).Length + dVPosition < minLength Then minLength = Notes(xI1).Length + dVPosition - If Notes(xI1).Length + Notes(xI1).VPosition + dVPosition > maxHeight Then maxHeight = Notes(xI1).Length + Notes(xI1).VPosition + dVPosition - Next - maxHeight -= 191999 - - 'declare undo variables - Dim xUndo As UndoRedo.LinkedURCmd = Nothing - Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void - Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo - - 'start moving - Dim xLen As Double - For xI1 = 1 To UBound(Notes) - If Not Notes(xI1).Selected Then Continue For - - xLen = Notes(xI1).Length + dVPosition - minLength - maxHeight - RedoLongNoteModify(SelectedNotes(Notes(xI1).TempIndex), Notes(xI1).VPosition, xLen, xUndo, xRedo) - - Notes(xI1).Length = xLen - Next - - 'Add undo - If dVPosition - minLength - maxHeight <> 0 Then - AddUndo(xUndo, xBaseRedo.Next, uAdded) - If Not uAdded Then uAdded = True - End If - End Sub - - - Private Sub OnAdjustLowerEnd(dVPosition As Double) - Dim xI1 As Integer - Dim minLength As Double = 0 - Dim minVPosition As Double = 0 - For xI1 = 1 To UBound(Notes) - If Notes(xI1).Selected AndAlso Notes(xI1).Length - dVPosition < minLength Then - minLength = Notes(xI1).Length - dVPosition - End If - If Notes(xI1).Selected AndAlso Notes(xI1).VPosition + dVPosition < minVPosition Then - minVPosition = Notes(xI1).VPosition + dVPosition - End If - Next - - 'declare undo variables - Dim xUndo As UndoRedo.LinkedURCmd = Nothing - Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void - Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo - - 'start moving - Dim xVPos As Double - Dim xLen As Double - For xI1 = 0 To UBound(Notes) - If Not Notes(xI1).Selected Then Continue For - - xVPos = Notes(xI1).VPosition + dVPosition + minLength - minVPosition - xLen = Notes(xI1).Length - dVPosition - minLength + minVPosition - RedoLongNoteModify(SelectedNotes(Notes(xI1).TempIndex), xVPos, xLen, xUndo, xRedo) - - Notes(xI1).VPosition = xVPos - Notes(xI1).Length = xLen - Next - - 'Add undo - If dVPosition + minLength - minVPosition <> 0 Then - AddUndo(xUndo, xBaseRedo.Next, uAdded) - If Not uAdded Then uAdded = True - End If - End Sub - - Private Sub OnDuplicateSelectedNotes(xHeight As Double, xVS As Double, xHS As Double, e As MouseEventArgs) - Dim tempNoteIndex As Integer - For tempNoteIndex = 1 To UBound(Notes) - If Notes(tempNoteIndex).TempMouseDown Then Exit For - Next - - Dim mouseVPosition = GetMouseVPosition(gSnap) - If DisableVerticalMove Then mouseVPosition = Notes(tempNoteIndex).VPosition - - Dim dVPosition As Double = mouseVPosition - Notes(tempNoteIndex).VPosition 'delta VPosition - - Dim currCol = ColumnArrayIndexToEnabledColumnIndex(GetColumnAtEvent(e, xHS)) - Dim noteCol = ColumnArrayIndexToEnabledColumnIndex(Notes(tempNoteIndex).ColumnIndex) - Dim colChange As Integer = currCol - noteCol 'delta Column - - 'Ks cannot be beyond the left, the upper and the lower boundary - Dim dstColumn As Integer = 0 - Dim mVPosition As Double = 0 - Dim muVPosition As Double = 191999 - For xI1 = 1 To UBound(Notes) - If Not Notes(xI1).Selected Then Continue For - - If ColumnArrayIndexToEnabledColumnIndex(Notes(xI1).ColumnIndex) + colChange < dstColumn Then _ - dstColumn = ColumnArrayIndexToEnabledColumnIndex(Notes(xI1).ColumnIndex) + colChange - - If Notes(xI1).VPosition + dVPosition < mVPosition Then _ - mVPosition = Notes(xI1).VPosition + dVPosition - - If Notes(xI1).VPosition + IIf(NTInput, Notes(xI1).Length, 0) + dVPosition > muVPosition Then _ - muVPosition = Notes(xI1).VPosition + IIf(NTInput, Notes(xI1).Length, 0) + dVPosition - - Next - muVPosition -= 191999 - - 'If not moving then exit - If (Not DuplicatedSelectedNotes) And colChange - dstColumn = 0 And dVPosition - mVPosition - muVPosition = 0 Then _ - Return - - Dim xUndo As UndoRedo.LinkedURCmd = Nothing - Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void - Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo - - If Not DuplicatedSelectedNotes Then 'If uAdded = False - DuplicateSelectedNotes(tempNoteIndex, dVPosition, colChange, dstColumn, mVPosition, muVPosition) - DuplicatedSelectedNotes = True - - Else - For i As Integer = 1 To UBound(Notes) - If Not Notes(i).Selected Then Continue For - - Notes(i).ColumnIndex = EnabledColumnIndexToColumnArrayIndex(ColumnArrayIndexToEnabledColumnIndex(Notes(i).ColumnIndex) + colChange - dstColumn) - Notes(i).VPosition = Notes(i).VPosition + dVPosition - mVPosition - muVPosition - RedoAddNote(Notes(i), xUndo, xRedo) - Next - - AddUndo(xUndo, xBaseRedo.Next, True) - End If - - SortByVPositionInsertion() - UpdatePairing() - CalculateTotalPlayableNotes() - End Sub - - - Private Sub OnWriteModeMouseMove(xHeight As Integer, xVS As Long, e As MouseEventArgs) - 'If Not KMouseDown = -1 Then - If SelectedNotes.Length <> 0 Then - - Dim xI1 As Integer - Dim xITemp As Integer - For xI1 = 1 To UBound(Notes) - If Notes(xI1).TempMouseDown Then xITemp = xI1 : Exit For - Next - - Dim mouseVPosition = GetMouseVPosition(gSnap) - - With Notes(xITemp) - If bAdjustUpper AndAlso mouseVPosition < .VPosition Then - bAdjustUpper = False - .VPosition += .Length - .Length *= -1 - ElseIf Not bAdjustUpper AndAlso mouseVPosition > .VPosition + .Length Then - bAdjustUpper = True - .VPosition += .Length - .Length *= -1 - End If - - If bAdjustUpper Then - .Length = mouseVPosition - .VPosition - Else - .Length = .VPosition + .Length - mouseVPosition - .VPosition = mouseVPosition - End If - - If .VPosition < 0 Then .Length += .VPosition : .VPosition = 0 - If .VPosition + .Length >= GetMaxVPosition() Then .Length = GetMaxVPosition() - 1 - .VPosition - - If SelectedNotes(0).LNPair = -1 Then 'If new note - Dim xUndo As UndoRedo.LinkedURCmd = Nothing - Dim xRedo As UndoRedo.LinkedURCmd = Nothing - RedoAddNote(Notes(xITemp), xUndo, xRedo) - AddUndo(xUndo, xRedo, True) - - Else 'If existing note - Dim xUndo As UndoRedo.LinkedURCmd = Nothing - Dim xRedo As UndoRedo.LinkedURCmd = Nothing - RedoLongNoteModify(SelectedNotes(0), .VPosition, .Length, xUndo, xRedo) - AddUndo(xUndo, xRedo, True) - End If - - SelectedColumn = .ColumnIndex - TempVPosition = mouseVPosition - TempLength = .Length - - End With - - SortByVPositionInsertion() - UpdatePairing() - CalculateTotalPlayableNotes() - - End If - End Sub - - Private Sub OnSelectModeMoveNotes(e As MouseEventArgs, xHS As Long, xITemp As Integer) - Dim mouseVPosition = GetMouseVPosition(gSnap) - If DisableVerticalMove Then mouseVPosition = SelectedNotes(0).VPosition - Dim dVPosition = mouseVPosition - Notes(xITemp).VPosition 'delta VPosition - - Dim mouseColumn As Integer - Dim xI1 = 0 - Dim mLeft As Integer = (e.X / gxWidth) + xHS 'horizontal position of the mouse - If mLeft >= 0 Then - Do - If mLeft < nLeft(xI1 + 1) Or xI1 >= gColumns Then mouseColumn = ColumnArrayIndexToEnabledColumnIndex(xI1) : Exit Do 'get the column where mouse is - xI1 += 1 - Loop - End If - - Dim dColumn = mouseColumn - ColumnArrayIndexToEnabledColumnIndex(Notes(xITemp).ColumnIndex) 'get the enabled delta column where mouse is - - 'Ks cannot be beyond the left, the upper and the lower boundary - mLeft = 0 - Dim mVPosition As Double = 0 - Dim muVPosition As Double = 191999 - For xI1 = 1 To UBound(Notes) - If Notes(xI1).Selected Then - mLeft = IIf(ColumnArrayIndexToEnabledColumnIndex(Notes(xI1).ColumnIndex) + dColumn < mLeft, - ColumnArrayIndexToEnabledColumnIndex(Notes(xI1).ColumnIndex) + dColumn, - mLeft) - mVPosition = IIf(Notes(xI1).VPosition + dVPosition < mVPosition, - Notes(xI1).VPosition + dVPosition, - mVPosition) - muVPosition = IIf(Notes(xI1).VPosition + IIf(NTInput, Notes(xI1).Length, 0) + dVPosition > muVPosition, - Notes(xI1).VPosition + IIf(NTInput, Notes(xI1).Length, 0) + dVPosition, - muVPosition) - End If - Next - muVPosition -= 191999 - - Dim xCol As Integer - Dim xVPos As Double - - Dim xUndo As UndoRedo.LinkedURCmd = Nothing - Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void - Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo - - 'start moving - For xI1 = 1 To UBound(Notes) - If Not Notes(xI1).Selected Then Continue For - - xCol = EnabledColumnIndexToColumnArrayIndex(ColumnArrayIndexToEnabledColumnIndex(Notes(xI1).ColumnIndex) + dColumn - mLeft) - xVPos = Notes(xI1).VPosition + dVPosition - mVPosition - muVPosition - RedoMoveNote(SelectedNotes(Notes(xI1).TempIndex), xCol, xVPos, xUndo, xRedo) - - Notes(xI1).ColumnIndex = xCol - Notes(xI1).VPosition = xVPos - Next - - 'If mouseColumn - uNotes(0).ColumnIndex - mLeft <> 0 Or mouseVPosition - uNotes(0).VPosition - mVPosition - muVPosition <> 0 Then - AddUndo(xUndo, xBaseRedo.Next, uAdded) - If Not uAdded Then uAdded = True - - 'End If - End Sub - - Private Sub UpdateSelectionBox(xHS As Long, xVS As Long, xHeight As Integer) - Dim SelectionBox As New Rectangle(IIf(pMouseMove.X > LastMouseDownLocation.X, LastMouseDownLocation.X, pMouseMove.X), - IIf(pMouseMove.Y > LastMouseDownLocation.Y, LastMouseDownLocation.Y, pMouseMove.Y), - Math.Abs(pMouseMove.X - LastMouseDownLocation.X), - Math.Abs(pMouseMove.Y - LastMouseDownLocation.Y)) - Dim NoteRect As Rectangle - - Dim xI1 As Integer - For xI1 = 1 To UBound(Notes) - NoteRect = New Rectangle(HorizontalPositiontoDisplay(nLeft(Notes(xI1).ColumnIndex), xHS) + 1, - NoteRowToPanelHeight(Notes(xI1).VPosition + IIf(NTInput, Notes(xI1).Length, 0), xVS, xHeight) - vo.kHeight, - (GetColumnWidth(Notes(xI1).ColumnIndex) * gxWidth) - 2, - vo.kHeight + IIf(NTInput, Notes(xI1).Length * gxHeight, 0)) - - - Notes(xI1).Selected = If(NoteRect.IntersectsWith(SelectionBox), - Not Notes(xI1).TempSelected And nEnabled(Notes(xI1).ColumnIndex), - Notes(xI1).TempSelected And nEnabled(Notes(xI1).ColumnIndex)) - Next - End Sub - - Private Sub DuplicateSelectedNotes(tempNoteIndex As Integer, dVPosition As Double, dColumn As Integer, mLeft As Integer, mVPosition As Double, muVPosition As Double) - Dim xUndo As UndoRedo.LinkedURCmd = Nothing - Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void - Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo - - Notes(tempNoteIndex).Selected = True - - Dim xSelectedNotesCount As Integer = 0 - For i As Integer = 1 To UBound(Notes) - If Notes(i).Selected Then xSelectedNotesCount += 1 - Next - - Dim xTempNotes(xSelectedNotesCount - 1) As Note - Dim xI2 As Integer = 0 - For i As Integer = 1 To UBound(Notes) - If Not Notes(i).Selected Then Continue For - - xTempNotes(xI2) = Notes(i) - xTempNotes(xI2).ColumnIndex = EnabledColumnIndexToColumnArrayIndex(ColumnArrayIndexToEnabledColumnIndex(Notes(i).ColumnIndex) + dColumn - mLeft) - xTempNotes(xI2).VPosition = Notes(i).VPosition + dVPosition - mVPosition - muVPosition - RedoAddNote(xTempNotes(xI2), xUndo, xRedo) - - Notes(i).Selected = False - xI2 += 1 - Next - Notes(tempNoteIndex).TempMouseDown = False - - 'copy to K - Dim xOrigUBound As Integer = UBound(Notes) - ReDim Preserve Notes(xOrigUBound + xSelectedNotesCount) - xI2 = 0 - For i As Integer = xOrigUBound + 1 To UBound(Notes) - Notes(i) = xTempNotes(xI2) - xI2 += 1 - Next - - AddUndo(xUndo, xBaseRedo.Next) - End Sub - - Private Sub DrawNoteHoverHighlight(iI As Integer, xHS As Long, xVS As Long, xHeight As Integer, foundNoteIndex As Integer) - Dim xDispX As Integer = HorizontalPositiontoDisplay(nLeft(Notes(foundNoteIndex).ColumnIndex), xHS) - Dim xDispY As Integer = IIf(Not NTInput Or (bAdjustLength And Not bAdjustUpper), - NoteRowToPanelHeight(Notes(foundNoteIndex).VPosition, xVS, xHeight) - vo.kHeight - 1, - NoteRowToPanelHeight(Notes(foundNoteIndex).VPosition + Notes(foundNoteIndex).Length, xVS, xHeight) - vo.kHeight - 1) - Dim xDispW As Integer = (GetColumnWidth(Notes(foundNoteIndex).ColumnIndex) * gxWidth) + 1 - Dim xDispH As Integer = IIf(Not NTInput Or bAdjustLength, - vo.kHeight + 3, - (Notes(foundNoteIndex).Length * gxHeight) + vo.kHeight + 3) - - Dim e1 As BufferedGraphics = BufferedGraphicsManager.Current.Allocate(spMain(iI).CreateGraphics, New Rectangle(xDispX, xDispY, xDispW, xDispH)) - e1.Graphics.FillRectangle(vo.Bg, New Rectangle(xDispX, xDispY, xDispW, xDispH)) - - If NTInput Then DrawNoteNT(Notes(foundNoteIndex), e1, xHS, xVS, xHeight) Else DrawNote(Notes(foundNoteIndex), e1, xHS, xVS, xHeight) - - Dim unused = e1.Graphics.DrawRectangle(IIf(bAdjustLength, vo.kMouseOverE, vo.kMouseOver), xDispX, xDispY, xDispW - 1, xDispH - 1) - - e1.Render(spMain(iI).CreateGraphics) - e1.Dispose() - End Sub - - Private Function GetColumnAtX(x As Integer, xHS As Integer) As Integer - Dim xI1 As Integer = 0 - Dim mLeft As Integer = (x / gxWidth) + xHS 'horizontal position of the mouse - Dim xColumn = 0 - If mLeft >= 0 Then - Do - If mLeft < nLeft(xI1 + 1) Or xI1 >= gColumns Then xColumn = xI1 : Exit Do 'get the column where mouse is - xI1 += 1 - Loop - End If - - Return EnabledColumnIndexToColumnArrayIndex(ColumnArrayIndexToEnabledColumnIndex(xColumn)) 'get the enabled column where mouse is - End Function - - Private Function GetColumnAtEvent(e As MouseEventArgs, xHS As Integer) - Return GetColumnAtX(e.X, xHS) - End Function - - ' az: Handle zoom in/out. Should work with any of the three splitters. - Private Sub PMain_Scroll(sender As Object, e As MouseEventArgs) Handles PMainIn.MouseWheel, PMainInL.MouseWheel, PMainInR.MouseWheel - If Not My.Computer.Keyboard.CtrlKeyDown Then Exit Sub - Dim dv = Math.Round(CGHeight2.Value + (e.Delta / 120)) - CGHeight2.Value = Math.Min(CGHeight2.Maximum, Math.Max(CGHeight2.Minimum, dv)) - CGHeight.Value = CGHeight2.Value / 4 - End Sub - - - Private Sub PMainInMouseUp(sender As Object, e As MouseEventArgs) Handles PMainIn.MouseUp, PMainInL.MouseUp, PMainInR.MouseUp - tempX = 0 - tempY = 0 - tempV = 0 - tempH = 0 - VSValue = -1 - HSValue = -1 - Timer1.Enabled = False - 'KMouseDown = -1 - ReDim SelectedNotes(-1) - - Dim iI As Integer = sender.Tag - - If MiddleButtonClicked AndAlso e.Button = Forms.MouseButtons.Middle AndAlso - ((MiddleButtonLocation.X - Cursor.Position.X) ^ 2) + ((MiddleButtonLocation.Y - Cursor.Position.Y) ^ 2) >= vo.MiddleDeltaRelease Then - MiddleButtonClicked = False - End If - - If TBSelect.Checked Then - LastMouseDownLocation = New Point(-1, -1) - pMouseMove = New Point(-1, -1) - - If ctrlPressed And Not DuplicatedSelectedNotes And Not ModifierMultiselectActive() Then - For i As Integer = 1 To UBound(Notes) - If Notes(i).TempMouseDown Then Notes(i).Selected = Not Notes(i).Selected : Exit For - Next - End If - - ctrlPressed = False - DuplicatedSelectedNotes = False - - ElseIf TBWrite.Checked Then - - If Not NTInput And Not tempFirstMouseDown Then - Dim xVPosition As Double - - - xVPosition = (sender.Height - (PanelVScroll(iI) * gxHeight) - e.Y - 1) / gxHeight 'VPosition of the mouse - If gSnap Then xVPosition = SnapToGrid(xVPosition) - - Dim xColumn = GetColumnAtEvent(e, PanelhBMSCROLL(iI)) - - If e.Button = Forms.MouseButtons.Left Then - Dim HiddenNote As Boolean = ModifierHiddenActive() - Dim LongNote As Boolean = ModifierLongNoteActive() - Dim Landmine As Boolean = ModifierLandmineActive() - Dim xUndo As UndoRedo.LinkedURCmd = Nothing - Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void - Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo - - If IsColumnNumeric(xColumn) Then - Dim xMessage As String = Strings.Messages.PromptEnterNumeric - If xColumn = niBPM Then xMessage = Strings.Messages.PromptEnterBPM - If xColumn = niSTOP Then xMessage = Strings.Messages.PromptEnterSTOP - If xColumn = niSCROLL Then xMessage = Strings.Messages.PromptEnterSCROLL - - Dim valstr As String = InputBox(xMessage, Text) - Dim value As Long = Val(valstr) * 10000 - - If (xColumn = niSCROLL And valstr = "0") Or value <> 0 Then - For xI1 = 1 To UBound(Notes) - If Notes(xI1).VPosition = xVPosition AndAlso Notes(xI1).ColumnIndex = xColumn Then _ - RedoRemoveNote(Notes(xI1), xUndo, xRedo) - Next - - Dim n = New Note(xColumn, xVPosition, value, LongNote, HiddenNote) - RedoAddNote(n, xUndo, xRedo) - AddNote(n) - - AddUndo(xUndo, xBaseRedo.Next) - End If - - Else - Dim xValue = If(IsColumnSound(xColumn), (LWAV.SelectedIndex + 1) * 10000, (LBMP.SelectedIndex + 1) * 10000) - - For xI1 = 1 To UBound(Notes) - If Notes(xI1).VPosition = xVPosition AndAlso Notes(xI1).ColumnIndex = xColumn Then _ - RedoRemoveNote(Notes(xI1), xUndo, xRedo) - Next - - Dim n = New Note(xColumn, xVPosition, xValue, - LongNote, HiddenNote, True, Landmine) - - RedoAddNote(n, xUndo, xRedo) - AddNote(n) - - AddUndo(xUndo, xRedo) - End If - End If - End If - - If Not ShouldDrawTempNote Then ShouldDrawTempNote = True - TempVPosition = -1 - SelectedColumn = -1 - End If - CalculateGreatestVPosition() - RefreshPanelAll() - End Sub - - Private Sub PMainInMouseWheel(sender As Object, e As MouseEventArgs) Handles PMainIn.MouseWheel, PMainInL.MouseWheel, PMainInR.MouseWheel - If MiddleButtonClicked Then MiddleButtonClicked = False - - Dim xI1 As Integer - - Select Case spMouseOver - Case 0 - 'xI1 = spV(iI) - Math.Sign(e.Delta) * VSL.SmallChange * 5 / gxHeight - xI1 = PanelVScroll(spMouseOver) - (Math.Sign(e.Delta) * gWheel) - If xI1 > 0 Then xI1 = 0 - If xI1 < LeftPanelScroll.Minimum Then xI1 = LeftPanelScroll.Minimum - LeftPanelScroll.Value = xI1 - Case 1 - 'xI1 = spV(iI) - Math.Sign(e.Delta) * VS.SmallChange * 5 / gxHeight - xI1 = PanelVScroll(spMouseOver) - (Math.Sign(e.Delta) * gWheel) - If xI1 > 0 Then xI1 = 0 - If xI1 < MainPanelScroll.Minimum Then xI1 = MainPanelScroll.Minimum - MainPanelScroll.Value = xI1 - Case 2 - 'xI1 = spV(iI) - Math.Sign(e.Delta) * VSR.SmallChange * 5 / gxHeight - xI1 = PanelVScroll(spMouseOver) - (Math.Sign(e.Delta) * gWheel) - If xI1 > 0 Then xI1 = 0 - If xI1 < RightPanelScroll.Minimum Then xI1 = RightPanelScroll.Minimum - RightPanelScroll.Value = xI1 - End Select - End Sub - - Private Sub PMainInPaint(sender As Object, e As PaintEventArgs) Handles PMainIn.Paint, PMainInL.Paint, PMainInR.Paint - RefreshPanel(sender.Tag, e.ClipRectangle) - End Sub + Case MouseButtons.Middle + OnPanelMousePan(e) + End Select + Dim col = GetColumnAtEvent(e, xHS) + Dim vps = GetMouseVPosition(gSnap) + If vps <> lastVPos Or col <> lastColumn Then + lastVPos = vps + lastColumn = col + POStatusRefresh() + RefreshPanelAll() 'az: refreshing the line is important now... + End If + + End Sub + + Private lastVPos = -1 + Private lastColumn = -1 + + Private Sub UpdateSelectedNotes(xHeight As Double, xvs As Double, xhs As Double, e As MouseEventArgs) + Dim mouseVPosition As Double + + Dim xITemp As Integer + For xI1 = 1 To UBound(Notes) + If Notes(xI1).TempMouseDown Then xITemp = xI1 : Exit For + Next + + mouseVPosition = GetMouseVPosition(gSnap) + + If bAdjustLength And bAdjustSingle Then + If bAdjustUpper AndAlso mouseVPosition < Notes(xITemp).VPosition Then + bAdjustUpper = False + Notes(xITemp).VPosition += Notes(xITemp).Length + Notes(xITemp).Length *= -1 + ElseIf Not bAdjustUpper AndAlso mouseVPosition > Notes(xITemp).VPosition + Notes(xITemp).Length Then + bAdjustUpper = True + Notes(xITemp).VPosition += Notes(xITemp).Length + Notes(xITemp).Length *= -1 + End If + End If + + 'If moving + If Not bAdjustLength Then + OnSelectModeMoveNotes(e, xhs, xITemp) + + ElseIf bAdjustUpper Then 'If adjusting upper end + Dim dVPosition = mouseVPosition - Notes(xITemp).VPosition - Notes(xITemp).Length 'delta Length + '< 0 means shorten, > 0 means lengthen + + OnAdjustUpperEnd(dVPosition) + + Else 'If adjusting lower end + Dim dVPosition = mouseVPosition - Notes(xITemp).VPosition 'delta VPosition + '> 0 means shorten, < 0 means lengthen + + OnAdjustLowerEnd(dVPosition) + End If + + SortByVPositionInsertion() + UpdatePairing() + CalculateTotalPlayableNotes() + 'Label1.Text = KInfo(KMouseDown) + End Sub + + Private Sub OnPanelMousePan(e As MouseEventArgs) + If MiddleButtonMoveMethod = 1 Then + Dim xI1 As Integer = tempV + ((tempY - e.Y) / gxHeight) + Dim xI2 As Integer = tempH + ((tempX - e.X) / gxWidth) + If xI1 > 0 Then xI1 = 0 + If xI2 < 0 Then xI2 = 0 + + Select Case PanelFocus + Case 0 + If xI1 < LeftPanelScroll.Minimum Then xI1 = LeftPanelScroll.Minimum + LeftPanelScroll.Value = xI1 + + If xI2 > HSL.Maximum - HSL.LargeChange + 1 Then xI2 = HSL.Maximum - HSL.LargeChange + 1 + HSL.Value = xI2 + + Case 1 + If xI1 < MainPanelScroll.Minimum Then xI1 = MainPanelScroll.Minimum + MainPanelScroll.Value = xI1 + + If xI2 > HS.Maximum - HS.LargeChange + 1 Then xI2 = HS.Maximum - HS.LargeChange + 1 + HS.Value = xI2 + + Case 2 + If xI1 < RightPanelScroll.Minimum Then xI1 = RightPanelScroll.Minimum + RightPanelScroll.Value = xI1 + + If xI2 > HSR.Maximum - HSR.LargeChange + 1 Then xI2 = HSR.Maximum - HSR.LargeChange + 1 + HSR.Value = xI2 + + End Select + End If + End Sub + + Private Sub OnTimeSelectClick(xHeight As Double, xHS As Double, xvs As Double, e As MouseEventArgs) + Dim xI1 As Integer + Dim xITemp As Integer = -1 + If Notes IsNot Nothing Then + For xI1 = UBound(Notes) To 0 Step -1 ' az: MouseInNote implied, but I'm not sure yet + If MouseInNote(e, xHS, xvs, xHeight, Notes(xI1)) Then + xITemp = xI1 + Exit For + End If + Next + End If + + If Not vSelAdjust Then + If vSelMouseOverLine = 1 Then + Dim xV As Double = (xHeight - (xvs * gxHeight) - e.Y - 1) / gxHeight + If xITemp >= 0 Then xV = Notes(xITemp).VPosition + If gSnap And xITemp <= 0 And Not My.Computer.Keyboard.CtrlKeyDown Then xV = SnapToGrid(xV) + vSelLength += vSelStart - xV + vSelHalf += vSelStart - xV + vSelStart = xV + + ElseIf vSelMouseOverLine = 2 Then + vSelHalf = (xHeight - (xvs * gxHeight) - e.Y - 1) / gxHeight + If xITemp >= 0 Then vSelHalf = Notes(xITemp).VPosition + If gSnap And xITemp <= 0 And Not My.Computer.Keyboard.CtrlKeyDown Then vSelHalf = SnapToGrid(vSelHalf) + vSelHalf -= vSelStart + + ElseIf vSelMouseOverLine = 3 Then + vSelLength = (xHeight - (xvs * gxHeight) - e.Y - 1) / gxHeight + If xITemp >= 0 Then vSelLength = Notes(xITemp).VPosition + If gSnap And xITemp <= 0 And Not My.Computer.Keyboard.CtrlKeyDown Then vSelLength = SnapToGrid(vSelLength) + vSelLength -= vSelStart + + Else + If xITemp >= 0 Then + vSelLength = Notes(xITemp).VPosition + Else + vSelLength = (xHeight - (xvs * gxHeight) - e.Y - 1) / gxHeight + If gSnap And Not My.Computer.Keyboard.CtrlKeyDown Then vSelLength = SnapToGrid(vSelLength) + End If + vSelLength -= vSelStart + vSelHalf = vSelLength / 2 + End If + ValidateSelection() + + Else + Dim xL1 As Double = (xHeight - (xvs * gxHeight) - e.Y - 1) / gxHeight + + If vSelMouseOverLine = 2 Then + vSelStart = vSelPStart + vSelLength = vSelPLength + vSelHalf = vSelPHalf + Notes = vSelK + ReDim Preserve Notes(UBound(Notes)) + + If gSnap And Not My.Computer.Keyboard.CtrlKeyDown Then xL1 = SnapToGrid(xL1) + BPMChangeHalf(xL1 - vSelHalf - vSelStart, , True) + SortByVPositionInsertion() + UpdatePairing() + CalculateGreatestVPosition() + + ElseIf vSelMouseOverLine = 3 Or vSelMouseOverLine = 1 Then + vSelStart = vSelPStart + vSelLength = vSelPLength + vSelHalf = vSelPHalf + Notes = vSelK + ReDim Preserve Notes(UBound(Notes)) + + If gSnap And Not My.Computer.Keyboard.CtrlKeyDown Then xL1 = SnapToGrid(xL1) + BPMChangeTop(IIf(vSelMouseOverLine = 3, xL1 - vSelStart, vSelStart + vSelLength - xL1) / vSelLength, , True) + SortByVPositionInsertion() + UpdatePairing() + CalculateGreatestVPosition() + + Else + vSelLength = xL1 + If gSnap And Not My.Computer.Keyboard.CtrlKeyDown Then vSelLength = SnapToGrid(vSelLength) + If xITemp >= 0 Then vSelLength = Notes(xITemp).VPosition + vSelLength -= vSelStart + ValidateSelection() + End If + End If + + If vSelLength Then + Dim xVLower As Double = IIf(vSelLength > 0, vSelStart, vSelStart + vSelLength) + Dim xVUpper As Double = IIf(vSelLength < 0, vSelStart, vSelStart + vSelLength) + If NTInput Then + For xI2 As Integer = 1 To UBound(Notes) + Notes(xI2).Selected = Notes(xI2).VPosition < xVUpper And Notes(xI2).VPosition + Notes(xI2).Length >= xVLower And nEnabled(Notes(xI2).ColumnIndex) + Next + Else + For xI2 As Integer = 1 To UBound(Notes) + Notes(xI2).Selected = Notes(xI2).VPosition >= xVLower And Notes(xI2).VPosition < xVUpper And nEnabled(Notes(xI2).ColumnIndex) + Next + End If + Else + For xI2 As Integer = 1 To UBound(Notes) + Notes(xI2).Selected = False + Next + End If + + End Sub + + Private Sub OnAdjustUpperEnd(dVPosition As Double) + Dim minLength As Double = 0 + Dim maxHeight As Double = 191999 + For xI1 = 1 To UBound(Notes) + If Not Notes(xI1).Selected Then Continue For + If Notes(xI1).Length + dVPosition < minLength Then minLength = Notes(xI1).Length + dVPosition + If Notes(xI1).Length + Notes(xI1).VPosition + dVPosition > maxHeight Then maxHeight = Notes(xI1).Length + Notes(xI1).VPosition + dVPosition + Next + maxHeight -= 191999 + + 'declare undo variables + Dim xUndo As UndoRedo.LinkedURCmd = Nothing + Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void + Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo + + 'start moving + Dim xLen As Double + For xI1 = 1 To UBound(Notes) + If Not Notes(xI1).Selected Then Continue For + + xLen = Notes(xI1).Length + dVPosition - minLength - maxHeight + RedoLongNoteModify(SelectedNotes(Notes(xI1).TempIndex), Notes(xI1).VPosition, xLen, xUndo, xRedo) + + Notes(xI1).Length = xLen + Next + + 'Add undo + If dVPosition - minLength - maxHeight <> 0 Then + AddUndo(xUndo, xBaseRedo.Next, uAdded) + If Not uAdded Then uAdded = True + End If + End Sub + + + Private Sub OnAdjustLowerEnd(dVPosition As Double) + Dim xI1 As Integer + Dim minLength As Double = 0 + Dim minVPosition As Double = 0 + For xI1 = 1 To UBound(Notes) + If Notes(xI1).Selected AndAlso Notes(xI1).Length - dVPosition < minLength Then + minLength = Notes(xI1).Length - dVPosition + End If + If Notes(xI1).Selected AndAlso Notes(xI1).VPosition + dVPosition < minVPosition Then + minVPosition = Notes(xI1).VPosition + dVPosition + End If + Next + + 'declare undo variables + Dim xUndo As UndoRedo.LinkedURCmd = Nothing + Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void + Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo + + 'start moving + Dim xVPos As Double + Dim xLen As Double + For xI1 = 0 To UBound(Notes) + If Not Notes(xI1).Selected Then Continue For + + xVPos = Notes(xI1).VPosition + dVPosition + minLength - minVPosition + xLen = Notes(xI1).Length - dVPosition - minLength + minVPosition + RedoLongNoteModify(SelectedNotes(Notes(xI1).TempIndex), xVPos, xLen, xUndo, xRedo) + + Notes(xI1).VPosition = xVPos + Notes(xI1).Length = xLen + Next + + 'Add undo + If dVPosition + minLength - minVPosition <> 0 Then + AddUndo(xUndo, xBaseRedo.Next, uAdded) + If Not uAdded Then uAdded = True + End If + End Sub + + Private Sub OnDuplicateSelectedNotes(xHeight As Double, xVS As Double, xHS As Double, e As MouseEventArgs) + Dim tempNoteIndex As Integer + For tempNoteIndex = 1 To UBound(Notes) + If Notes(tempNoteIndex).TempMouseDown Then Exit For + Next + + Dim mouseVPosition = GetMouseVPosition(gSnap) + If DisableVerticalMove Then mouseVPosition = Notes(tempNoteIndex).VPosition + + Dim dVPosition As Double = mouseVPosition - Notes(tempNoteIndex).VPosition 'delta VPosition + + Dim currCol = ColumnArrayIndexToEnabledColumnIndex(GetColumnAtEvent(e, xHS)) + Dim noteCol = ColumnArrayIndexToEnabledColumnIndex(Notes(tempNoteIndex).ColumnIndex) + Dim colChange As Integer = currCol - noteCol 'delta Column + + 'Ks cannot be beyond the left, the upper and the lower boundary + Dim dstColumn As Integer = 0 + Dim mVPosition As Double = 0 + Dim muVPosition As Double = 191999 + For xI1 = 1 To UBound(Notes) + If Not Notes(xI1).Selected Then Continue For + + If ColumnArrayIndexToEnabledColumnIndex(Notes(xI1).ColumnIndex) + colChange < dstColumn Then _ + dstColumn = ColumnArrayIndexToEnabledColumnIndex(Notes(xI1).ColumnIndex) + colChange + + If Notes(xI1).VPosition + dVPosition < mVPosition Then _ + mVPosition = Notes(xI1).VPosition + dVPosition + + If Notes(xI1).VPosition + IIf(NTInput, Notes(xI1).Length, 0) + dVPosition > muVPosition Then _ + muVPosition = Notes(xI1).VPosition + IIf(NTInput, Notes(xI1).Length, 0) + dVPosition + + Next + muVPosition -= 191999 + + 'If not moving then exit + If (Not DuplicatedSelectedNotes) And colChange - dstColumn = 0 And dVPosition - mVPosition - muVPosition = 0 Then _ + Return + + Dim xUndo As UndoRedo.LinkedURCmd = Nothing + Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void + Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo + + If Not DuplicatedSelectedNotes Then 'If uAdded = False + DuplicateSelectedNotes(tempNoteIndex, dVPosition, colChange, dstColumn, mVPosition, muVPosition) + DuplicatedSelectedNotes = True + + Else + For i As Integer = 1 To UBound(Notes) + If Not Notes(i).Selected Then Continue For + + Notes(i).ColumnIndex = EnabledColumnIndexToColumnArrayIndex(ColumnArrayIndexToEnabledColumnIndex(Notes(i).ColumnIndex) + colChange - dstColumn) + Notes(i).VPosition = Notes(i).VPosition + dVPosition - mVPosition - muVPosition + RedoAddNote(Notes(i), xUndo, xRedo) + Next + + AddUndo(xUndo, xBaseRedo.Next, True) + End If + + SortByVPositionInsertion() + UpdatePairing() + CalculateTotalPlayableNotes() + End Sub + + + Private Sub OnWriteModeMouseMove(xHeight As Integer, xVS As Long, e As MouseEventArgs) + 'If Not KMouseDown = -1 Then + If SelectedNotes.Length <> 0 Then + + Dim xI1 As Integer + Dim xITemp As Integer + For xI1 = 1 To UBound(Notes) + If Notes(xI1).TempMouseDown Then xITemp = xI1 : Exit For + Next + + Dim mouseVPosition = GetMouseVPosition(gSnap) + + With Notes(xITemp) + If bAdjustUpper AndAlso mouseVPosition < .VPosition Then + bAdjustUpper = False + .VPosition += .Length + .Length *= -1 + ElseIf Not bAdjustUpper AndAlso mouseVPosition > .VPosition + .Length Then + bAdjustUpper = True + .VPosition += .Length + .Length *= -1 + End If + + If bAdjustUpper Then + .Length = mouseVPosition - .VPosition + Else + .Length = .VPosition + .Length - mouseVPosition + .VPosition = mouseVPosition + End If + + If .VPosition < 0 Then .Length += .VPosition : .VPosition = 0 + If .VPosition + .Length >= GetMaxVPosition() Then .Length = GetMaxVPosition() - 1 - .VPosition + + If SelectedNotes(0).LNPair = -1 Then 'If new note + Dim xUndo As UndoRedo.LinkedURCmd = Nothing + Dim xRedo As UndoRedo.LinkedURCmd = Nothing + RedoAddNote(Notes(xITemp), xUndo, xRedo) + AddUndo(xUndo, xRedo, True) + + Else 'If existing note + Dim xUndo As UndoRedo.LinkedURCmd = Nothing + Dim xRedo As UndoRedo.LinkedURCmd = Nothing + RedoLongNoteModify(SelectedNotes(0), .VPosition, .Length, xUndo, xRedo) + AddUndo(xUndo, xRedo, True) + End If + + SelectedColumn = .ColumnIndex + TempVPosition = mouseVPosition + TempLength = .Length + + End With + + SortByVPositionInsertion() + UpdatePairing() + CalculateTotalPlayableNotes() + + End If + End Sub + + Private Sub OnSelectModeMoveNotes(e As MouseEventArgs, xHS As Long, xITemp As Integer) + Dim mouseVPosition = GetMouseVPosition(gSnap) + If DisableVerticalMove Then mouseVPosition = SelectedNotes(0).VPosition + Dim dVPosition = mouseVPosition - Notes(xITemp).VPosition 'delta VPosition + + Dim mouseColumn As Integer + Dim xI1 = 0 + Dim mLeft As Integer = (e.X / gxWidth) + xHS 'horizontal position of the mouse + If mLeft >= 0 Then + Do + If mLeft < nLeft(xI1 + 1) Or xI1 >= gColumns Then mouseColumn = ColumnArrayIndexToEnabledColumnIndex(xI1) : Exit Do 'get the column where mouse is + xI1 += 1 + Loop + End If + + Dim dColumn = mouseColumn - ColumnArrayIndexToEnabledColumnIndex(Notes(xITemp).ColumnIndex) 'get the enabled delta column where mouse is + + 'Ks cannot be beyond the left, the upper and the lower boundary + mLeft = 0 + Dim mVPosition As Double = 0 + Dim muVPosition As Double = 191999 + For xI1 = 1 To UBound(Notes) + If Notes(xI1).Selected Then + mLeft = IIf(ColumnArrayIndexToEnabledColumnIndex(Notes(xI1).ColumnIndex) + dColumn < mLeft, + ColumnArrayIndexToEnabledColumnIndex(Notes(xI1).ColumnIndex) + dColumn, + mLeft) + mVPosition = IIf(Notes(xI1).VPosition + dVPosition < mVPosition, + Notes(xI1).VPosition + dVPosition, + mVPosition) + muVPosition = IIf(Notes(xI1).VPosition + IIf(NTInput, Notes(xI1).Length, 0) + dVPosition > muVPosition, + Notes(xI1).VPosition + IIf(NTInput, Notes(xI1).Length, 0) + dVPosition, + muVPosition) + End If + Next + muVPosition -= 191999 + + Dim xCol As Integer + Dim xVPos As Double + + Dim xUndo As UndoRedo.LinkedURCmd = Nothing + Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void + Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo + + 'start moving + For xI1 = 1 To UBound(Notes) + If Not Notes(xI1).Selected Then Continue For + + xCol = EnabledColumnIndexToColumnArrayIndex(ColumnArrayIndexToEnabledColumnIndex(Notes(xI1).ColumnIndex) + dColumn - mLeft) + xVPos = Notes(xI1).VPosition + dVPosition - mVPosition - muVPosition + RedoMoveNote(SelectedNotes(Notes(xI1).TempIndex), xCol, xVPos, xUndo, xRedo) + + Notes(xI1).ColumnIndex = xCol + Notes(xI1).VPosition = xVPos + Next + + 'If mouseColumn - uNotes(0).ColumnIndex - mLeft <> 0 Or mouseVPosition - uNotes(0).VPosition - mVPosition - muVPosition <> 0 Then + AddUndo(xUndo, xBaseRedo.Next, uAdded) + If Not uAdded Then uAdded = True + + 'End If + End Sub + + Private Sub UpdateSelectionBox(xHS As Long, xVS As Long, xHeight As Integer) + Dim SelectionBox As New Rectangle(IIf(pMouseMove.X > LastMouseDownLocation.X, LastMouseDownLocation.X, pMouseMove.X), + IIf(pMouseMove.Y > LastMouseDownLocation.Y, LastMouseDownLocation.Y, pMouseMove.Y), + Math.Abs(pMouseMove.X - LastMouseDownLocation.X), + Math.Abs(pMouseMove.Y - LastMouseDownLocation.Y)) + Dim NoteRect As Rectangle + + Dim xI1 As Integer + For xI1 = 1 To UBound(Notes) + NoteRect = New Rectangle(HorizontalPositiontoDisplay(nLeft(Notes(xI1).ColumnIndex), xHS) + 1, + NoteRowToPanelHeight(Notes(xI1).VPosition + IIf(NTInput, Notes(xI1).Length, 0), xVS, xHeight) - vo.kHeight, + (GetColumnWidth(Notes(xI1).ColumnIndex) * gxWidth) - 2, + vo.kHeight + IIf(NTInput, Notes(xI1).Length * gxHeight, 0)) + + + Notes(xI1).Selected = If(NoteRect.IntersectsWith(SelectionBox), + Not Notes(xI1).TempSelected And nEnabled(Notes(xI1).ColumnIndex), + Notes(xI1).TempSelected And nEnabled(Notes(xI1).ColumnIndex)) + Next + End Sub + + Private Sub DuplicateSelectedNotes(tempNoteIndex As Integer, dVPosition As Double, dColumn As Integer, mLeft As Integer, mVPosition As Double, muVPosition As Double) + Dim xUndo As UndoRedo.LinkedURCmd = Nothing + Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void + Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo + + Notes(tempNoteIndex).Selected = True + + Dim xSelectedNotesCount As Integer = 0 + For i As Integer = 1 To UBound(Notes) + If Notes(i).Selected Then xSelectedNotesCount += 1 + Next + + Dim xTempNotes(xSelectedNotesCount - 1) As Note + Dim xI2 As Integer = 0 + For i As Integer = 1 To UBound(Notes) + If Not Notes(i).Selected Then Continue For + + xTempNotes(xI2) = Notes(i) + xTempNotes(xI2).ColumnIndex = EnabledColumnIndexToColumnArrayIndex(ColumnArrayIndexToEnabledColumnIndex(Notes(i).ColumnIndex) + dColumn - mLeft) + xTempNotes(xI2).VPosition = Notes(i).VPosition + dVPosition - mVPosition - muVPosition + RedoAddNote(xTempNotes(xI2), xUndo, xRedo) + + Notes(i).Selected = False + xI2 += 1 + Next + Notes(tempNoteIndex).TempMouseDown = False + + 'copy to K + Dim xOrigUBound As Integer = UBound(Notes) + ReDim Preserve Notes(xOrigUBound + xSelectedNotesCount) + xI2 = 0 + For i As Integer = xOrigUBound + 1 To UBound(Notes) + Notes(i) = xTempNotes(xI2) + xI2 += 1 + Next + + AddUndo(xUndo, xBaseRedo.Next) + End Sub + + Private Sub DrawNoteHoverHighlight(iI As Integer, xHS As Long, xVS As Long, xHeight As Integer, foundNoteIndex As Integer) + Dim xDispX As Integer = HorizontalPositiontoDisplay(nLeft(Notes(foundNoteIndex).ColumnIndex), xHS) + Dim xDispY As Integer = IIf(Not NTInput Or (bAdjustLength And Not bAdjustUpper), + NoteRowToPanelHeight(Notes(foundNoteIndex).VPosition, xVS, xHeight) - vo.kHeight - 1, + NoteRowToPanelHeight(Notes(foundNoteIndex).VPosition + Notes(foundNoteIndex).Length, xVS, xHeight) - vo.kHeight - 1) + Dim xDispW As Integer = (GetColumnWidth(Notes(foundNoteIndex).ColumnIndex) * gxWidth) + 1 + Dim xDispH As Integer = IIf(Not NTInput Or bAdjustLength, + vo.kHeight + 3, + (Notes(foundNoteIndex).Length * gxHeight) + vo.kHeight + 3) + + Dim e1 As BufferedGraphics = BufferedGraphicsManager.Current.Allocate(spMain(iI).CreateGraphics, New Rectangle(xDispX, xDispY, xDispW, xDispH)) + e1.Graphics.FillRectangle(vo.Bg, New Rectangle(xDispX, xDispY, xDispW, xDispH)) + + If NTInput Then DrawNoteNT(Notes(foundNoteIndex), e1, xHS, xVS, xHeight) Else DrawNote(Notes(foundNoteIndex), e1, xHS, xVS, xHeight) + + Dim unused = e1.Graphics.DrawRectangle(IIf(bAdjustLength, vo.kMouseOverE, vo.kMouseOver), xDispX, xDispY, xDispW - 1, xDispH - 1) + + e1.Render(spMain(iI).CreateGraphics) + e1.Dispose() + End Sub + + Private Function GetColumnAtX(x As Integer, xHS As Integer) As Integer + Dim xI1 As Integer = 0 + Dim mLeft As Integer = (x / gxWidth) + xHS 'horizontal position of the mouse + Dim xColumn = 0 + If mLeft >= 0 Then + Do + If mLeft < nLeft(xI1 + 1) Or xI1 >= gColumns Then xColumn = xI1 : Exit Do 'get the column where mouse is + xI1 += 1 + Loop + End If + + Return EnabledColumnIndexToColumnArrayIndex(ColumnArrayIndexToEnabledColumnIndex(xColumn)) 'get the enabled column where mouse is + End Function + + Private Function GetColumnAtEvent(e As MouseEventArgs, xHS As Integer) + Return GetColumnAtX(e.X, xHS) + End Function + + ' az: Handle zoom in/out. Should work with any of the three splitters. + Private Sub PMain_Scroll(sender As Object, e As MouseEventArgs) Handles PMainIn.MouseWheel, PMainInL.MouseWheel, PMainInR.MouseWheel + If Not My.Computer.Keyboard.CtrlKeyDown Then Exit Sub + Dim dv = Math.Round(CGHeight2.Value + (e.Delta / 120)) + CGHeight2.Value = Math.Min(CGHeight2.Maximum, Math.Max(CGHeight2.Minimum, dv)) + CGHeight.Value = CGHeight2.Value / 4 + End Sub + + + Private Sub PMainInMouseUp(sender As Object, e As MouseEventArgs) Handles PMainIn.MouseUp, PMainInL.MouseUp, PMainInR.MouseUp + tempX = 0 + tempY = 0 + tempV = 0 + tempH = 0 + VSValue = -1 + HSValue = -1 + Timer1.Enabled = False + 'KMouseDown = -1 + ReDim SelectedNotes(-1) + + Dim iI As Integer = sender.Tag + + If MiddleButtonClicked AndAlso e.Button = Forms.MouseButtons.Middle AndAlso + ((MiddleButtonLocation.X - Cursor.Position.X) ^ 2) + ((MiddleButtonLocation.Y - Cursor.Position.Y) ^ 2) >= vo.MiddleDeltaRelease Then + MiddleButtonClicked = False + End If + + If TBSelect.Checked Then + LastMouseDownLocation = New Point(-1, -1) + pMouseMove = New Point(-1, -1) + + If ctrlPressed And Not DuplicatedSelectedNotes And Not ModifierMultiselectActive() Then + For i As Integer = 1 To UBound(Notes) + If Notes(i).TempMouseDown Then Notes(i).Selected = Not Notes(i).Selected : Exit For + Next + End If + + ctrlPressed = False + DuplicatedSelectedNotes = False + + ElseIf TBWrite.Checked Then + + If Not NTInput And Not tempFirstMouseDown Then + Dim xVPosition As Double + + + xVPosition = (sender.Height - (PanelVScroll(iI) * gxHeight) - e.Y - 1) / gxHeight 'VPosition of the mouse + If gSnap Then xVPosition = SnapToGrid(xVPosition) + + Dim xColumn = GetColumnAtEvent(e, PanelhBMSCROLL(iI)) + + If e.Button = Forms.MouseButtons.Left Then + Dim HiddenNote As Boolean = ModifierHiddenActive() + Dim LongNote As Boolean = ModifierLongNoteActive() + Dim Landmine As Boolean = ModifierLandmineActive() + Dim xUndo As UndoRedo.LinkedURCmd = Nothing + Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void + Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo + + If IsColumnNumeric(xColumn) Then + Dim xMessage As String = Strings.Messages.PromptEnterNumeric + If xColumn = niBPM Then xMessage = Strings.Messages.PromptEnterBPM + If xColumn = niSTOP Then xMessage = Strings.Messages.PromptEnterSTOP + If xColumn = niSCROLL Then xMessage = Strings.Messages.PromptEnterSCROLL + + Dim valstr As String = InputBox(xMessage, Text) + Dim value As Long = Val(valstr) * 10000 + + If (xColumn = niSCROLL And valstr = "0") Or value <> 0 Then + For xI1 = 1 To UBound(Notes) + If Notes(xI1).VPosition = xVPosition AndAlso Notes(xI1).ColumnIndex = xColumn Then _ + RedoRemoveNote(Notes(xI1), xUndo, xRedo) + Next + + Dim n = New Note(xColumn, xVPosition, value, LongNote, HiddenNote) + RedoAddNote(n, xUndo, xRedo) + AddNote(n) + + AddUndo(xUndo, xBaseRedo.Next) + End If + + Else + Dim xValue = If(IsColumnSound(xColumn), (LWAV.SelectedIndex + 1) * 10000, (LBMP.SelectedIndex + 1) * 10000) + + For xI1 = 1 To UBound(Notes) + If Notes(xI1).VPosition = xVPosition AndAlso Notes(xI1).ColumnIndex = xColumn Then _ + RedoRemoveNote(Notes(xI1), xUndo, xRedo) + Next + + Dim n = New Note(xColumn, xVPosition, xValue, + LongNote, HiddenNote, True, Landmine) + + RedoAddNote(n, xUndo, xRedo) + AddNote(n) + + AddUndo(xUndo, xRedo) + End If + End If + End If + + If Not ShouldDrawTempNote Then ShouldDrawTempNote = True + TempVPosition = -1 + SelectedColumn = -1 + End If + CalculateGreatestVPosition() + RefreshPanelAll() + End Sub + + Private Sub PMainInMouseWheel(sender As Object, e As MouseEventArgs) Handles PMainIn.MouseWheel, PMainInL.MouseWheel, PMainInR.MouseWheel + If MiddleButtonClicked Then MiddleButtonClicked = False + + Dim xI1 As Integer + + Select Case spMouseOver + Case 0 + 'xI1 = spV(iI) - Math.Sign(e.Delta) * VSL.SmallChange * 5 / gxHeight + xI1 = PanelVScroll(spMouseOver) - (Math.Sign(e.Delta) * gWheel) + If xI1 > 0 Then xI1 = 0 + If xI1 < LeftPanelScroll.Minimum Then xI1 = LeftPanelScroll.Minimum + LeftPanelScroll.Value = xI1 + Case 1 + 'xI1 = spV(iI) - Math.Sign(e.Delta) * VS.SmallChange * 5 / gxHeight + xI1 = PanelVScroll(spMouseOver) - (Math.Sign(e.Delta) * gWheel) + If xI1 > 0 Then xI1 = 0 + If xI1 < MainPanelScroll.Minimum Then xI1 = MainPanelScroll.Minimum + MainPanelScroll.Value = xI1 + Case 2 + 'xI1 = spV(iI) - Math.Sign(e.Delta) * VSR.SmallChange * 5 / gxHeight + xI1 = PanelVScroll(spMouseOver) - (Math.Sign(e.Delta) * gWheel) + If xI1 > 0 Then xI1 = 0 + If xI1 < RightPanelScroll.Minimum Then xI1 = RightPanelScroll.Minimum + RightPanelScroll.Value = xI1 + End Select + End Sub + + Private Sub PMainInPaint(sender As Object, e As PaintEventArgs) Handles PMainIn.Paint, PMainInL.Paint, PMainInR.Paint + RefreshPanel(sender.Tag, e.ClipRectangle) + End Sub End Class diff --git a/iBMSC/PanelKeyStates.vb b/iBMSC/PanelKeyStates.vb index 9849c626f..a0c695b5f 100644 --- a/iBMSC/PanelKeyStates.vb +++ b/iBMSC/PanelKeyStates.vb @@ -1,20 +1,20 @@ Friend Module PanelKeyStates - Public Function ModifierLongNoteActive() As Boolean - Return My.Computer.Keyboard.ShiftKeyDown And - Not My.Computer.Keyboard.CtrlKeyDown - End Function + Public Function ModifierLongNoteActive() As Boolean + Return My.Computer.Keyboard.ShiftKeyDown And + Not My.Computer.Keyboard.CtrlKeyDown + End Function - Public Function ModifierHiddenActive() As Boolean - Return My.Computer.Keyboard.CtrlKeyDown And - Not My.Computer.Keyboard.ShiftKeyDown - End Function + Public Function ModifierHiddenActive() As Boolean + Return My.Computer.Keyboard.CtrlKeyDown And + Not My.Computer.Keyboard.ShiftKeyDown + End Function - Public Function ModifierLandmineActive() As Boolean - Return My.Computer.Keyboard.CtrlKeyDown And - My.Computer.Keyboard.ShiftKeyDown - End Function + Public Function ModifierLandmineActive() As Boolean + Return My.Computer.Keyboard.CtrlKeyDown And + My.Computer.Keyboard.ShiftKeyDown + End Function - Public Function ModifierMultiselectActive() As Boolean - Return My.Computer.Keyboard.ShiftKeyDown And My.Computer.Keyboard.CtrlKeyDown - End Function + Public Function ModifierMultiselectActive() As Boolean + Return My.Computer.Keyboard.ShiftKeyDown And My.Computer.Keyboard.CtrlKeyDown + End Function End Module diff --git a/iBMSC/Strings.vb b/iBMSC/Strings.vb index a808a2c1e..918717d77 100644 --- a/iBMSC/Strings.vb +++ b/iBMSC/Strings.vb @@ -1,230 +1,230 @@ Public Class Strings - Public Shared OK As String = "OK" - Public Shared Cancel As String = "Cancel" - Public Shared None As String = "None" - - Public Class StatusBar - Public Shared Length As String = "Length" - Public Shared LongNote As String = "LongNote" - Public Shared Hidden As String = "Hidden" - Public Shared LandMine As String = "LandMine" - Public Shared Err As String = "Error" - End Class - - Public Class Messages - Public Shared Err As String = "Error" - Public Shared SaveOnExit As String = "Do you want to save changes?" - Public Shared SaveOnExit1 As String = "You should tell me if you want to save changes before closing the computer. -_,-" - Public Shared SaveOnExit2 As String = "You still need to tell me if you want to save changes even though you are closing the application with task manager. -_,-" - Public Shared PromptEnter As String = "Please enter a label." - Public Shared PromptEnterNumeric As String = "Please enter a value." - Public Shared PromptEnterMeasure As String = "Please enter a measure (0-999)." - Public Shared PromptEnterBPM As String = "Please enter a BPM value." - Public Shared PromptEnterSTOP As String = "Please enter a STOP value." - Public Shared PromptEnterSCROLL As String = "Please enter a SCROLL value." - Public Shared PromptSlashValue As String = "When the slash key (""/"") is pressed, change grid division to:" - Public Shared InvalidLabel As String = "Invalid label." - Public Shared CannotFind As String = "Cannot find file {}." - Public Shared PleaseRespecifyPath As String = "Please respecify path." - Public Shared PlayerNotFound As String = "Player not found" - Public Shared PreviewDelError As String = "There must exist at least one player." - Public Shared NegativeFactorError As String = "Factor must be greater than zero." - Public Shared NegativeDivisorError As String = "Divisor must be greater than zero." - Public Shared PreferencePostpone As String = "The preference will take effect on the next start-up of the program." - Public Shared EraserObsolete As String = "The eraser tool has been replaced by right-clicking on the note." - Public Shared SaveWarning As String = "Warning: " - Public Shared NoteOverlapError As String = "Note operlapping detected. Increasing Maximum Grid Partition will resolve this." - Public Shared BPMOverflowError As String = "Numbers of multi-byte BPMs has exceeded supported maximum: " - Public Shared STOPOverflowError As String = "Numbers of STOPs has exceeded supported maximum: " - Public Shared SCROLLOverflowError As String = "Numbers of multi-byte SCROLLs has exceeded supported maximum: " - Public Shared SavedFileWillContainErrors As String = "The saved file will contain errors." - Public Shared FileAssociationPrompt As String = "Do you want to set iBMSC as default program to all {} files?" - Public Shared FileAssociationError As String = "Error changing file type association:" - Public Shared RestoreDefaultSettings As String = "Restore default settings?" - Public Shared RestoreAutosavedFile As String = "{} autosaved file(s) have been found. Do you want to recover these files?" - End Class - - Public Class FileType - Public Shared _all As String = "All files (*.*)" - - Public Shared _bms As String = "Supported BMS Format (*.bms, *.bme, *.bml, *.pms, *.txt)" - Public Shared BMS As String = "Be-Music Script (*.bms)" - Public Shared BME As String = "Be-Music Extended Format (*.bme)" - Public Shared BML As String = "Be-Music Longnote Format (*.bml)" - Public Shared PMS As String = "Po-Mu Script (*.pms)" - Public Shared TXT As String = "Text document (*.txt)" - - Public Shared SM As String = "StepMania Script (*.sm)" - Public Shared IBMSC As String = "iBMSC Binary Format (*.ibmsc)" - Public Shared BMSON As String = "BMS JSON Format (*.bmson)" - Public Shared XML As String = "Extensible Markup Language (*.xml)" - Public Shared THEME_XML As String = "iBMSC Theme File (*.Theme.xml)" - Public Shared TH As String = "iBMSC 2.x Theme File (*.Theme.xml)" - - Public Shared _audio As String = "Supported Audio Format (*.wav, *.ogg, *.mp3, *.flac, *.mid)" - Public Shared _wave As String = "Supported Wave Audio Format (*.wav, *.ogg, *.mp3, *.flac)" - Public Shared WAV As String = "Waveform Audio (*.wav)" - Public Shared OGG As String = "Ogg Vorbis Audio (*.ogg)" - Public Shared MP3 As String = "MPEG Layer-3 Audio (*.mp3)" - Public Shared FLAC As String = "Free Lossless Audio (*.flac)" - Public Shared MID As String = "MIDI (*.mid)" - - Public Shared _image As String = "Supported Image Format (*.png, *.bmp, *.jpg, *.gif)" - Public Shared _movie As String = "Supported Movie Format (*.mpg, *.avi, *.mp4, *.wmv, *.webm)" - Public Shared BMP As String = "Windows bitmap image (*.bmp)" - Public Shared PNG As String = "Portable Network Graphic (*.png)" - Public Shared JPG As String = "Joint Photographic Experts Group (*.jpg)" - Public Shared GIF As String = "Graphics Interchange Format (*.gif)" - Public Shared MPG As String = "Moving Picture Experts Group (*.mpg)" - Public Shared AVI As String = "Audio Video Interleave (*.avi)" - Public Shared MP4 As String = "MPEG phase 4 (*.mp4)" - Public Shared WMV As String = "Windows Media Video (*.wmv)" - Public Shared WEBM As String = "WebM (*.webm)" - - Public Shared EXE As String = "Executable file (*.exe)" - End Class - - Public Class fStatistics - Public Shared Title As String = "Statistics" - Public Shared lBPM As String = "BPM" - Public Shared lSTOP As String = "STOP" - Public Shared lSCROLL As String = "SCROLL" - Public Shared lA As String = "A1-A8" - Public Shared lD As String = "D1-D8" - Public Shared lBGM As String = "BGM" - Public Shared lTotal As String = "Total" - Public Shared lShort As String = "Short" - Public Shared lLong As String = "Long" - Public Shared lLnObj As String = "LnObj" - Public Shared lHidden As String = "Hidden" - Public Shared lLandMine As String = "LandMine" - Public Shared lErrors As String = "Errors" - End Class - - Public Class fopPlayer - Public Shared Title As String = "Player Arguments Options" - Public Shared Add As String = "Add" - Public Shared Remove As String = "Remove" - Public Shared Path As String = "Path" - Public Shared PlayFromBeginning As String = "Play from beginning" - Public Shared PlayFromHere As String = "Play from current measure" - Public Shared StopPlaying As String = "Stop" - Public Shared References As String = "References (case-sensitive):" - Public Shared DirectoryOfApp As String = "Directory of the application" - Public Shared CurrMeasure As String = "Current measure" - Public Shared FileName As String = "File Name" - Public Shared RestoreDefault As String = "Restore Default" - End Class - - Public Class fopVisual - Public Shared Title As String = "Visual Options" - Public Shared Width As String = "Width" - Public Shared Caption As String = "Caption" - Public Shared Note As String = "Note" - Public Shared Label As String = "Label" - Public Shared LongNote As String = "Long Note" - Public Shared LongNoteLabel As String = "Long Note Label" - Public Shared Bg As String = "Bg" - Public Shared ColumnCaption As String = "Column Caption" - Public Shared ColumnCaptionFont As String = "Column Caption Font" - Public Shared Background As String = "Background" - Public Shared Grid As String = "Grid" - Public Shared SubGrid As String = "Sub" - Public Shared VerticalLine As String = "Vertical Line" - Public Shared MeasureBarLine As String = "Measure BarLine" - Public Shared BGMWaveform As String = "BGM Waveform" - Public Shared NoteHeight As String = "Note Height" - Public Shared NoteLabel As String = "Note Label" - Public Shared MeasureLabel As String = "Measure Label" - Public Shared LabelVerticalShift As String = "Note Label Vertical Shift" - Public Shared LabelHorizontalShift As String = "Note Label Horizontal Shift" - Public Shared LongNoteLabelHorizontalShift As String = "LongNote Label Horizontal Shift" - Public Shared HiddenNoteOpacity As String = "Hidden Note Opacity" - Public Shared NoteBorderOnMouseOver As String = "Note Border on MouseOver" - Public Shared NoteBorderOnSelection As String = "Note Border on Selection" - Public Shared NoteBorderOnAdjustingLength As String = "Note Border on Adjusting Length" - Public Shared SelectionBoxBorder As String = "Selection Box Border" - Public Shared TSCursor As String = "Time Selection Cursor" - Public Shared TSSplitter As String = "Time Selection Splitter" - Public Shared TSCursorSensitivity As String = "Time Selection Cursor Sensitivity" - Public Shared TSMouseOverBorder As String = "Time Selection MouseOver Border" - Public Shared TSFill As String = "Time Selection Fill" - Public Shared TSBPM As String = "Time Selection BPM" - Public Shared TSBPMFont As String = "Time Selection BPM Font" - Public Shared MiddleSensitivity As String = "Middle Button Release Sensitivity" - End Class - - Public Class fopGeneral - Public Shared Title As String = "General Options" - Public Shared MouseWheel As String = "Mouse Wheel" - Public Shared TextEncoding As String = "Text Encoding" - 'Public Shared SortingMethod As String = "Sorting Method" - 'Public Shared sortBubble As String = "One-directional Bubble Sort" - 'Public Shared sortInsertion As String = "Insertion Sort" - 'Public Shared sortQuick As String = "Quick Sort" - 'Public Shared sortQuickD3 As String = "Quick Sort d3" - 'Public Shared sortHeap As String = "Heap Sort" - Public Shared PageUpDown As String = "PageUp / PageDown" - Public Shared MiddleButton As String = "Mouse Middle Button" - Public Shared MiddleButtonAuto As String = "Click and Auto Scroll" - Public Shared MiddleButtonDrag As String = "Click and Drag" - Public Shared AssociateFileType As String = "Associate Filetype" - Public Shared MaxGridPartition As String = "Max Grid Partition in BMS" - Public Shared BeepWhileSaved As String = "Beep while saved" - Public Shared ExtendBPM As String = "Extend number of multi-byte BPMs to 1296" - Public Shared ExtendSTOP As String = "Extend number of STOPs to 1296" - Public Shared AutoFocusOnMouseEnter As String = "Automatically set focus to editing panel on mouse enter" - Public Shared DisableFirstClick As String = "Disable first click if the editing panel is not focused" - Public Shared AutoSave As String = "AutoSave" - Public Shared minutes As String = "minutes" - Public Shared StopPreviewOnClick As String = "Stop preview if clicked on the editing panel" - End Class - - Public Class fFind - Public Shared NoteRange As String = "Note Range" - Public Shared MeasureRange As String = "Measure Range" - Public Shared LabelRange As String = "Label Range" - Public Shared ValueRange As String = "Value Range" - Public Shared to_ As String = "to" - Public Shared Selected As String = "Selected" - Public Shared UnSelected As String = "Unselected" - Public Shared ShortNote As String = "Short" - Public Shared LongNote As String = "Long" - Public Shared Hidden As String = "Hidden" - Public Shared LandMine As String = "LandMine" - Public Shared Visible As String = "Visible" - Public Shared Column As String = "Column" - Public Shared SelectAll As String = "Select All" - Public Shared SelectInverse As String = "Select Inverse" - Public Shared UnselectAll As String = "Unselect All" - Public Shared Operation As String = "Operation" - Public Shared ReplaceWithLabel As String = "Replace with Label:" - Public Shared ReplaceWithValue As String = "Replace with Value:" - Public Shared Select_ As String = "Select" - Public Shared Unselect_ As String = "Unselect" - Public Shared Delete_ As String = "Delete" - Public Shared Close_ As String = "Close" - End Class - - Public Class fImportSM - Public Shared Title As String = "Import *.SM file" - Public Shared Difficulty As String = "Difficulty" - Public Shared Note As String = "Please note that bg musics and STOP values will not be imported." - End Class - - Public Class fImportBMSON - Public Shared Message As String = "BMSON Format is write only." - End Class - - Public Class FileAssociation - Public Shared BMS As String = "Be-Music Script" - Public Shared BME As String = "Be-Music Extended Format" - Public Shared BML As String = "Be-Music Longnote Format" - Public Shared PMS As String = "Po-Mu Script" - Public Shared IBMSC As String = "iBMSC Binary Format" - Public Shared Open As String = "Open" - Public Shared Preview As String = "Preview" - Public Shared ViewCode As String = "View Code" - End Class + Public Shared OK As String = "OK" + Public Shared Cancel As String = "Cancel" + Public Shared None As String = "None" + + Public Class StatusBar + Public Shared Length As String = "Length" + Public Shared LongNote As String = "LongNote" + Public Shared Hidden As String = "Hidden" + Public Shared LandMine As String = "LandMine" + Public Shared Err As String = "Error" + End Class + + Public Class Messages + Public Shared Err As String = "Error" + Public Shared SaveOnExit As String = "Do you want to save changes?" + Public Shared SaveOnExit1 As String = "You should tell me if you want to save changes before closing the computer. -_,-" + Public Shared SaveOnExit2 As String = "You still need to tell me if you want to save changes even though you are closing the application with task manager. -_,-" + Public Shared PromptEnter As String = "Please enter a label." + Public Shared PromptEnterNumeric As String = "Please enter a value." + Public Shared PromptEnterMeasure As String = "Please enter a measure (0-999)." + Public Shared PromptEnterBPM As String = "Please enter a BPM value." + Public Shared PromptEnterSTOP As String = "Please enter a STOP value." + Public Shared PromptEnterSCROLL As String = "Please enter a SCROLL value." + Public Shared PromptSlashValue As String = "When the slash key (""/"") is pressed, change grid division to:" + Public Shared InvalidLabel As String = "Invalid label." + Public Shared CannotFind As String = "Cannot find file {}." + Public Shared PleaseRespecifyPath As String = "Please respecify path." + Public Shared PlayerNotFound As String = "Player not found" + Public Shared PreviewDelError As String = "There must exist at least one player." + Public Shared NegativeFactorError As String = "Factor must be greater than zero." + Public Shared NegativeDivisorError As String = "Divisor must be greater than zero." + Public Shared PreferencePostpone As String = "The preference will take effect on the next start-up of the program." + Public Shared EraserObsolete As String = "The eraser tool has been replaced by right-clicking on the note." + Public Shared SaveWarning As String = "Warning: " + Public Shared NoteOverlapError As String = "Note operlapping detected. Increasing Maximum Grid Partition will resolve this." + Public Shared BPMOverflowError As String = "Numbers of multi-byte BPMs has exceeded supported maximum: " + Public Shared STOPOverflowError As String = "Numbers of STOPs has exceeded supported maximum: " + Public Shared SCROLLOverflowError As String = "Numbers of multi-byte SCROLLs has exceeded supported maximum: " + Public Shared SavedFileWillContainErrors As String = "The saved file will contain errors." + Public Shared FileAssociationPrompt As String = "Do you want to set iBMSC as default program to all {} files?" + Public Shared FileAssociationError As String = "Error changing file type association:" + Public Shared RestoreDefaultSettings As String = "Restore default settings?" + Public Shared RestoreAutosavedFile As String = "{} autosaved file(s) have been found. Do you want to recover these files?" + End Class + + Public Class FileType + Public Shared _all As String = "All files (*.*)" + + Public Shared _bms As String = "Supported BMS Format (*.bms, *.bme, *.bml, *.pms, *.txt)" + Public Shared BMS As String = "Be-Music Script (*.bms)" + Public Shared BME As String = "Be-Music Extended Format (*.bme)" + Public Shared BML As String = "Be-Music Longnote Format (*.bml)" + Public Shared PMS As String = "Po-Mu Script (*.pms)" + Public Shared TXT As String = "Text document (*.txt)" + + Public Shared SM As String = "StepMania Script (*.sm)" + Public Shared IBMSC As String = "iBMSC Binary Format (*.ibmsc)" + Public Shared BMSON As String = "BMS JSON Format (*.bmson)" + Public Shared XML As String = "Extensible Markup Language (*.xml)" + Public Shared THEME_XML As String = "iBMSC Theme File (*.Theme.xml)" + Public Shared TH As String = "iBMSC 2.x Theme File (*.Theme.xml)" + + Public Shared _audio As String = "Supported Audio Format (*.wav, *.ogg, *.mp3, *.flac, *.mid)" + Public Shared _wave As String = "Supported Wave Audio Format (*.wav, *.ogg, *.mp3, *.flac)" + Public Shared WAV As String = "Waveform Audio (*.wav)" + Public Shared OGG As String = "Ogg Vorbis Audio (*.ogg)" + Public Shared MP3 As String = "MPEG Layer-3 Audio (*.mp3)" + Public Shared FLAC As String = "Free Lossless Audio (*.flac)" + Public Shared MID As String = "MIDI (*.mid)" + + Public Shared _image As String = "Supported Image Format (*.png, *.bmp, *.jpg, *.gif)" + Public Shared _movie As String = "Supported Movie Format (*.mpg, *.avi, *.mp4, *.wmv, *.webm)" + Public Shared BMP As String = "Windows bitmap image (*.bmp)" + Public Shared PNG As String = "Portable Network Graphic (*.png)" + Public Shared JPG As String = "Joint Photographic Experts Group (*.jpg)" + Public Shared GIF As String = "Graphics Interchange Format (*.gif)" + Public Shared MPG As String = "Moving Picture Experts Group (*.mpg)" + Public Shared AVI As String = "Audio Video Interleave (*.avi)" + Public Shared MP4 As String = "MPEG phase 4 (*.mp4)" + Public Shared WMV As String = "Windows Media Video (*.wmv)" + Public Shared WEBM As String = "WebM (*.webm)" + + Public Shared EXE As String = "Executable file (*.exe)" + End Class + + Public Class fStatistics + Public Shared Title As String = "Statistics" + Public Shared lBPM As String = "BPM" + Public Shared lSTOP As String = "STOP" + Public Shared lSCROLL As String = "SCROLL" + Public Shared lA As String = "A1-A8" + Public Shared lD As String = "D1-D8" + Public Shared lBGM As String = "BGM" + Public Shared lTotal As String = "Total" + Public Shared lShort As String = "Short" + Public Shared lLong As String = "Long" + Public Shared lLnObj As String = "LnObj" + Public Shared lHidden As String = "Hidden" + Public Shared lLandMine As String = "LandMine" + Public Shared lErrors As String = "Errors" + End Class + + Public Class fopPlayer + Public Shared Title As String = "Player Arguments Options" + Public Shared Add As String = "Add" + Public Shared Remove As String = "Remove" + Public Shared Path As String = "Path" + Public Shared PlayFromBeginning As String = "Play from beginning" + Public Shared PlayFromHere As String = "Play from current measure" + Public Shared StopPlaying As String = "Stop" + Public Shared References As String = "References (case-sensitive):" + Public Shared DirectoryOfApp As String = "Directory of the application" + Public Shared CurrMeasure As String = "Current measure" + Public Shared FileName As String = "File Name" + Public Shared RestoreDefault As String = "Restore Default" + End Class + + Public Class fopVisual + Public Shared Title As String = "Visual Options" + Public Shared Width As String = "Width" + Public Shared Caption As String = "Caption" + Public Shared Note As String = "Note" + Public Shared Label As String = "Label" + Public Shared LongNote As String = "Long Note" + Public Shared LongNoteLabel As String = "Long Note Label" + Public Shared Bg As String = "Bg" + Public Shared ColumnCaption As String = "Column Caption" + Public Shared ColumnCaptionFont As String = "Column Caption Font" + Public Shared Background As String = "Background" + Public Shared Grid As String = "Grid" + Public Shared SubGrid As String = "Sub" + Public Shared VerticalLine As String = "Vertical Line" + Public Shared MeasureBarLine As String = "Measure BarLine" + Public Shared BGMWaveform As String = "BGM Waveform" + Public Shared NoteHeight As String = "Note Height" + Public Shared NoteLabel As String = "Note Label" + Public Shared MeasureLabel As String = "Measure Label" + Public Shared LabelVerticalShift As String = "Note Label Vertical Shift" + Public Shared LabelHorizontalShift As String = "Note Label Horizontal Shift" + Public Shared LongNoteLabelHorizontalShift As String = "LongNote Label Horizontal Shift" + Public Shared HiddenNoteOpacity As String = "Hidden Note Opacity" + Public Shared NoteBorderOnMouseOver As String = "Note Border on MouseOver" + Public Shared NoteBorderOnSelection As String = "Note Border on Selection" + Public Shared NoteBorderOnAdjustingLength As String = "Note Border on Adjusting Length" + Public Shared SelectionBoxBorder As String = "Selection Box Border" + Public Shared TSCursor As String = "Time Selection Cursor" + Public Shared TSSplitter As String = "Time Selection Splitter" + Public Shared TSCursorSensitivity As String = "Time Selection Cursor Sensitivity" + Public Shared TSMouseOverBorder As String = "Time Selection MouseOver Border" + Public Shared TSFill As String = "Time Selection Fill" + Public Shared TSBPM As String = "Time Selection BPM" + Public Shared TSBPMFont As String = "Time Selection BPM Font" + Public Shared MiddleSensitivity As String = "Middle Button Release Sensitivity" + End Class + + Public Class fopGeneral + Public Shared Title As String = "General Options" + Public Shared MouseWheel As String = "Mouse Wheel" + Public Shared TextEncoding As String = "Text Encoding" + 'Public Shared SortingMethod As String = "Sorting Method" + 'Public Shared sortBubble As String = "One-directional Bubble Sort" + 'Public Shared sortInsertion As String = "Insertion Sort" + 'Public Shared sortQuick As String = "Quick Sort" + 'Public Shared sortQuickD3 As String = "Quick Sort d3" + 'Public Shared sortHeap As String = "Heap Sort" + Public Shared PageUpDown As String = "PageUp / PageDown" + Public Shared MiddleButton As String = "Mouse Middle Button" + Public Shared MiddleButtonAuto As String = "Click and Auto Scroll" + Public Shared MiddleButtonDrag As String = "Click and Drag" + Public Shared AssociateFileType As String = "Associate Filetype" + Public Shared MaxGridPartition As String = "Max Grid Partition in BMS" + Public Shared BeepWhileSaved As String = "Beep while saved" + Public Shared ExtendBPM As String = "Extend number of multi-byte BPMs to 1296" + Public Shared ExtendSTOP As String = "Extend number of STOPs to 1296" + Public Shared AutoFocusOnMouseEnter As String = "Automatically set focus to editing panel on mouse enter" + Public Shared DisableFirstClick As String = "Disable first click if the editing panel is not focused" + Public Shared AutoSave As String = "AutoSave" + Public Shared minutes As String = "minutes" + Public Shared StopPreviewOnClick As String = "Stop preview if clicked on the editing panel" + End Class + + Public Class fFind + Public Shared NoteRange As String = "Note Range" + Public Shared MeasureRange As String = "Measure Range" + Public Shared LabelRange As String = "Label Range" + Public Shared ValueRange As String = "Value Range" + Public Shared to_ As String = "to" + Public Shared Selected As String = "Selected" + Public Shared UnSelected As String = "Unselected" + Public Shared ShortNote As String = "Short" + Public Shared LongNote As String = "Long" + Public Shared Hidden As String = "Hidden" + Public Shared LandMine As String = "LandMine" + Public Shared Visible As String = "Visible" + Public Shared Column As String = "Column" + Public Shared SelectAll As String = "Select All" + Public Shared SelectInverse As String = "Select Inverse" + Public Shared UnselectAll As String = "Unselect All" + Public Shared Operation As String = "Operation" + Public Shared ReplaceWithLabel As String = "Replace with Label:" + Public Shared ReplaceWithValue As String = "Replace with Value:" + Public Shared Select_ As String = "Select" + Public Shared Unselect_ As String = "Unselect" + Public Shared Delete_ As String = "Delete" + Public Shared Close_ As String = "Close" + End Class + + Public Class fImportSM + Public Shared Title As String = "Import *.SM file" + Public Shared Difficulty As String = "Difficulty" + Public Shared Note As String = "Please note that bg musics and STOP values will not be imported." + End Class + + Public Class fImportBMSON + Public Shared Message As String = "BMSON Format is write only." + End Class + + Public Class FileAssociation + Public Shared BMS As String = "Be-Music Script" + Public Shared BME As String = "Be-Music Extended Format" + Public Shared BML As String = "Be-Music Longnote Format" + Public Shared PMS As String = "Po-Mu Script" + Public Shared IBMSC As String = "iBMSC Binary Format" + Public Shared Open As String = "Open" + Public Shared Preview As String = "Preview" + Public Shared ViewCode As String = "View Code" + End Class End Class diff --git a/iBMSC/TimeSelectionOps.vb b/iBMSC/TimeSelectionOps.vb index 9881850a6..d0af46287 100644 --- a/iBMSC/TimeSelectionOps.vb +++ b/iBMSC/TimeSelectionOps.vb @@ -2,671 +2,671 @@ Imports iBMSC.Editor Partial Public Class MainWindow - Private Sub BVCCalculate_Click(sender As Object, e As EventArgs) Handles BVCCalculate.Click - If Not TBTimeSelect.Checked Then Exit Sub - - SortByVPositionInsertion() - BPMChangeByValue(Val(TVCBPM.Text) * 10000) - - SortByVPositionInsertion() - UpdatePairing() - RefreshPanelAll() - POStatusRefresh() - - Beep() - TVCBPM.Focus() - End Sub - - Private Sub BVCApply_Click(sender As Object, e As EventArgs) Handles BVCApply.Click - If Not TBTimeSelect.Checked Then Exit Sub - - SortByVPositionInsertion() - BPMChangeTop(Val(TVCM.Text) / Val(TVCD.Text)) - - SortByVPositionInsertion() - UpdatePairing() - RefreshPanelAll() - POStatusRefresh() - CalculateGreatestVPosition() - - Beep() - TVCM.Focus() - 'Select Case spFocus - ' Case 0 : PMainInL.Focus() - ' Case 1 : PMainIn.Focus() - ' Case 2 : PMainInR.Focus() - 'End Select - End Sub - - Private Sub BPMChangeTop(xRatio As Double, Optional bAddUndo As Boolean = True, Optional bOverWriteUndo As Boolean = False) - 'Dim xUndo As String = vbCrLf - 'Dim xRedo As String = vbCrLf - Dim xUndo As UndoRedo.LinkedURCmd = Nothing - Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void - Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo - - If vSelLength = 0 Then GoTo EndofSub - If xRatio = 1 Or xRatio <= 0 Then GoTo EndofSub - - Dim xVLower As Double = IIf(vSelLength > 0, vSelStart, vSelStart + vSelLength) - Dim xVUpper As Double = IIf(vSelLength < 0, vSelStart, vSelStart + vSelLength) - If xVLower < 0 Then xVLower = 0 - If xVUpper >= GetMaxVPosition() Then xVUpper = GetMaxVPosition() - 1 - - Dim xBPM As Integer = Notes(0).Value - Dim xI1 As Integer - Dim xI2 As Integer - Dim xI3 As Integer - - Dim xValueL As Integer = xBPM - Dim xValueU As Integer = xBPM - - 'Save undo - 'For xI3 = 1 To UBound(K) - ' K(xI3).Selected = True - 'Next - 'xUndo = "KZ" & vbCrLf & _ - ' sCmdKs(False) & vbCrLf & _ - ' "SA_" & vSelStart & "_" & vSelLength & "_" & vSelHalf & "_1" - - RedoRemoveNoteAll(False, xUndo, xRedo) - - 'Start - If Not NTInput Then - 'Below Selection - For xI1 = 1 To UBound(Notes) - If Notes(xI1).VPosition > xVLower Then Exit For - If Notes(xI1).ColumnIndex = niBPM Then xBPM = Notes(xI1).Value - Next - xValueL = xBPM - xI2 = xI1 - - 'Within Selection - For xI1 = xI2 To UBound(Notes) - If Notes(xI1).VPosition > xVUpper Then Exit For - If Notes(xI1).ColumnIndex = niBPM Then - xBPM = Notes(xI1).Value - Notes(xI1).Value = Notes(xI1).Value * xRatio - End If - Notes(xI1).VPosition = ((Notes(xI1).VPosition - xVLower) * xRatio) + xVLower - Next - xValueU = xBPM - xI2 = xI1 - - 'Above Selection - For xI1 = xI2 To UBound(Notes) - Notes(xI1).VPosition += (xRatio - 1) * (xVUpper - xVLower) - Next - - 'Add BPMs - AddNote(New Note(niBPM, xVLower, xValueL * xRatio), False, True, False) - AddNote(New Note(niBPM, xVUpper + ((xRatio - 1) * (xVUpper - xVLower)), xValueU), False, True, False) - - Else - Dim xAddBPML As Boolean = True - Dim xAddBPMU As Boolean = True - - For xI1 = 1 To UBound(Notes) - 'Modify notes - If Notes(xI1).VPosition <= xVLower Then - 'check BPM - If Notes(xI1).ColumnIndex = niBPM Then - xValueL = Notes(xI1).Value - xValueU = Notes(xI1).Value - If Notes(xI1).VPosition = xVLower Then xAddBPML = False : Notes(xI1).Value = IIf(Notes(xI1).Value * xRatio <= 655359999, Notes(xI1).Value * xRatio, 655359999) - End If - - 'If longnote then adjust length - If Notes(xI1).VPosition + Notes(xI1).Length > xVLower Then - Notes(xI1).Length += (IIf(xVUpper < Notes(xI1).VPosition + Notes(xI1).Length, xVUpper, Notes(xI1).VPosition + Notes(xI1).Length) - xVLower) * (xRatio - 1) - End If - - ElseIf Notes(xI1).VPosition <= xVUpper Then - 'check BPM - If Notes(xI1).ColumnIndex = niBPM Then - xValueU = Notes(xI1).Value - If Notes(xI1).VPosition = xVUpper Then xAddBPMU = False Else Notes(xI1).Value = IIf(Notes(xI1).Value * xRatio <= 655359999, Notes(xI1).Value * xRatio, 655359999) - End If - - 'Adjust Length - Notes(xI1).Length += (IIf(xVUpper < Notes(xI1).Length + Notes(xI1).VPosition, xVUpper, Notes(xI1).Length + Notes(xI1).VPosition) - Notes(xI1).VPosition) * (xRatio - 1) - - 'Adjust VPosition - Notes(xI1).VPosition = ((Notes(xI1).VPosition - xVLower) * xRatio) + xVLower - - Else - Notes(xI1).VPosition += (xVUpper - xVLower) * (xRatio - 1) - End If - Next - - 'Add BPMs - If xAddBPML Then AddNote(New Note(niBPM, xVLower, xValueL * xRatio), False, True, False) - If xAddBPMU Then AddNote(New Note(niBPM, ((xVUpper - xVLower) * xRatio) + xVLower, xValueU), False, True, False) - End If - - 'Check BPM Overflow - For xI3 = 1 To UBound(Notes) - If Notes(xI3).ColumnIndex = niBPM AndAlso Notes(xI3).Value < 1 Then Notes(xI3).Value = 1 - Next - - RedoAddNoteAll(False, xUndo, xRedo) - - 'Restore selection - Dim pSelStart As Double = vSelStart - Dim pSelLength As Double = vSelLength - Dim pSelHalf As Double = vSelHalf - If vSelLength < 0 Then vSelStart += (xRatio - 1) * (xVUpper - xVLower) - vSelLength *= xRatio - vSelHalf *= xRatio - ValidateSelection() - RedoChangeTimeSelection(pSelStart, pSelLength, pSelHalf, vSelStart, vSelLength, vSelHalf, True, xUndo, xRedo) - - 'Save redo - 'For xI3 = 1 To UBound(K) - ' K(xI3).Selected = True - 'Next - 'xRedo = "KZ" & vbCrLf & _ - ' sCmdKs(False) & vbCrLf & _ - ' "SA_" & vSelStart & "_" & vSelLength & "_" & vSelHalf & "_1" - - 'Restore note selection - xVLower = IIf(vSelLength > 0, vSelStart, vSelStart + vSelLength) - xVUpper = IIf(vSelLength < 0, vSelStart, vSelStart + vSelLength) - If Not NTInput Then - For xI3 = 1 To UBound(Notes) - Notes(xI3).Selected = Notes(xI3).VPosition >= xVLower And Notes(xI3).VPosition < xVUpper And nEnabled(Notes(xI3).ColumnIndex) - Next - Else - For xI3 = 1 To UBound(Notes) - Notes(xI3).Selected = Notes(xI3).VPosition < xVUpper And Notes(xI3).VPosition + Notes(xI3).Length >= xVLower And nEnabled(Notes(xI3).ColumnIndex) - Next - End If + Private Sub BVCCalculate_Click(sender As Object, e As EventArgs) Handles BVCCalculate.Click + If Not TBTimeSelect.Checked Then Exit Sub + + SortByVPositionInsertion() + BPMChangeByValue(Val(TVCBPM.Text) * 10000) + + SortByVPositionInsertion() + UpdatePairing() + RefreshPanelAll() + POStatusRefresh() + + Beep() + TVCBPM.Focus() + End Sub + + Private Sub BVCApply_Click(sender As Object, e As EventArgs) Handles BVCApply.Click + If Not TBTimeSelect.Checked Then Exit Sub + + SortByVPositionInsertion() + BPMChangeTop(Val(TVCM.Text) / Val(TVCD.Text)) + + SortByVPositionInsertion() + UpdatePairing() + RefreshPanelAll() + POStatusRefresh() + CalculateGreatestVPosition() + + Beep() + TVCM.Focus() + 'Select Case spFocus + ' Case 0 : PMainInL.Focus() + ' Case 1 : PMainIn.Focus() + ' Case 2 : PMainInR.Focus() + 'End Select + End Sub + + Private Sub BPMChangeTop(xRatio As Double, Optional bAddUndo As Boolean = True, Optional bOverWriteUndo As Boolean = False) + 'Dim xUndo As String = vbCrLf + 'Dim xRedo As String = vbCrLf + Dim xUndo As UndoRedo.LinkedURCmd = Nothing + Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void + Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo + + If vSelLength = 0 Then GoTo EndofSub + If xRatio = 1 Or xRatio <= 0 Then GoTo EndofSub + + Dim xVLower As Double = IIf(vSelLength > 0, vSelStart, vSelStart + vSelLength) + Dim xVUpper As Double = IIf(vSelLength < 0, vSelStart, vSelStart + vSelLength) + If xVLower < 0 Then xVLower = 0 + If xVUpper >= GetMaxVPosition() Then xVUpper = GetMaxVPosition() - 1 + + Dim xBPM As Integer = Notes(0).Value + Dim xI1 As Integer + Dim xI2 As Integer + Dim xI3 As Integer + + Dim xValueL As Integer = xBPM + Dim xValueU As Integer = xBPM + + 'Save undo + 'For xI3 = 1 To UBound(K) + ' K(xI3).Selected = True + 'Next + 'xUndo = "KZ" & vbCrLf & _ + ' sCmdKs(False) & vbCrLf & _ + ' "SA_" & vSelStart & "_" & vSelLength & "_" & vSelHalf & "_1" + + RedoRemoveNoteAll(False, xUndo, xRedo) + + 'Start + If Not NTInput Then + 'Below Selection + For xI1 = 1 To UBound(Notes) + If Notes(xI1).VPosition > xVLower Then Exit For + If Notes(xI1).ColumnIndex = niBPM Then xBPM = Notes(xI1).Value + Next + xValueL = xBPM + xI2 = xI1 + + 'Within Selection + For xI1 = xI2 To UBound(Notes) + If Notes(xI1).VPosition > xVUpper Then Exit For + If Notes(xI1).ColumnIndex = niBPM Then + xBPM = Notes(xI1).Value + Notes(xI1).Value = Notes(xI1).Value * xRatio + End If + Notes(xI1).VPosition = ((Notes(xI1).VPosition - xVLower) * xRatio) + xVLower + Next + xValueU = xBPM + xI2 = xI1 + + 'Above Selection + For xI1 = xI2 To UBound(Notes) + Notes(xI1).VPosition += (xRatio - 1) * (xVUpper - xVLower) + Next + + 'Add BPMs + AddNote(New Note(niBPM, xVLower, xValueL * xRatio), False, True, False) + AddNote(New Note(niBPM, xVUpper + ((xRatio - 1) * (xVUpper - xVLower)), xValueU), False, True, False) + + Else + Dim xAddBPML As Boolean = True + Dim xAddBPMU As Boolean = True + + For xI1 = 1 To UBound(Notes) + 'Modify notes + If Notes(xI1).VPosition <= xVLower Then + 'check BPM + If Notes(xI1).ColumnIndex = niBPM Then + xValueL = Notes(xI1).Value + xValueU = Notes(xI1).Value + If Notes(xI1).VPosition = xVLower Then xAddBPML = False : Notes(xI1).Value = IIf(Notes(xI1).Value * xRatio <= 655359999, Notes(xI1).Value * xRatio, 655359999) + End If + + 'If longnote then adjust length + If Notes(xI1).VPosition + Notes(xI1).Length > xVLower Then + Notes(xI1).Length += (IIf(xVUpper < Notes(xI1).VPosition + Notes(xI1).Length, xVUpper, Notes(xI1).VPosition + Notes(xI1).Length) - xVLower) * (xRatio - 1) + End If + + ElseIf Notes(xI1).VPosition <= xVUpper Then + 'check BPM + If Notes(xI1).ColumnIndex = niBPM Then + xValueU = Notes(xI1).Value + If Notes(xI1).VPosition = xVUpper Then xAddBPMU = False Else Notes(xI1).Value = IIf(Notes(xI1).Value * xRatio <= 655359999, Notes(xI1).Value * xRatio, 655359999) + End If + + 'Adjust Length + Notes(xI1).Length += (IIf(xVUpper < Notes(xI1).Length + Notes(xI1).VPosition, xVUpper, Notes(xI1).Length + Notes(xI1).VPosition) - Notes(xI1).VPosition) * (xRatio - 1) + + 'Adjust VPosition + Notes(xI1).VPosition = ((Notes(xI1).VPosition - xVLower) * xRatio) + xVLower + + Else + Notes(xI1).VPosition += (xVUpper - xVLower) * (xRatio - 1) + End If + Next + + 'Add BPMs + If xAddBPML Then AddNote(New Note(niBPM, xVLower, xValueL * xRatio), False, True, False) + If xAddBPMU Then AddNote(New Note(niBPM, ((xVUpper - xVLower) * xRatio) + xVLower, xValueU), False, True, False) + End If + + 'Check BPM Overflow + For xI3 = 1 To UBound(Notes) + If Notes(xI3).ColumnIndex = niBPM AndAlso Notes(xI3).Value < 1 Then Notes(xI3).Value = 1 + Next + + RedoAddNoteAll(False, xUndo, xRedo) + + 'Restore selection + Dim pSelStart As Double = vSelStart + Dim pSelLength As Double = vSelLength + Dim pSelHalf As Double = vSelHalf + If vSelLength < 0 Then vSelStart += (xRatio - 1) * (xVUpper - xVLower) + vSelLength *= xRatio + vSelHalf *= xRatio + ValidateSelection() + RedoChangeTimeSelection(pSelStart, pSelLength, pSelHalf, vSelStart, vSelLength, vSelHalf, True, xUndo, xRedo) + + 'Save redo + 'For xI3 = 1 To UBound(K) + ' K(xI3).Selected = True + 'Next + 'xRedo = "KZ" & vbCrLf & _ + ' sCmdKs(False) & vbCrLf & _ + ' "SA_" & vSelStart & "_" & vSelLength & "_" & vSelHalf & "_1" + + 'Restore note selection + xVLower = IIf(vSelLength > 0, vSelStart, vSelStart + vSelLength) + xVUpper = IIf(vSelLength < 0, vSelStart, vSelStart + vSelLength) + If Not NTInput Then + For xI3 = 1 To UBound(Notes) + Notes(xI3).Selected = Notes(xI3).VPosition >= xVLower And Notes(xI3).VPosition < xVUpper And nEnabled(Notes(xI3).ColumnIndex) + Next + Else + For xI3 = 1 To UBound(Notes) + Notes(xI3).Selected = Notes(xI3).VPosition < xVUpper And Notes(xI3).VPosition + Notes(xI3).Length >= xVLower And nEnabled(Notes(xI3).ColumnIndex) + Next + End If EndofSub: - If bAddUndo Then AddUndo(xUndo, xBaseRedo.Next, bOverWriteUndo) - End Sub - - Private Sub BPMChangeHalf(dVPosition As Double, Optional bAddUndo As Boolean = True, Optional bOverWriteUndo As Boolean = False) - 'Dim xUndo As String = vbCrLf - 'Dim xRedo As String = vbCrLf - Dim xUndo As UndoRedo.LinkedURCmd = Nothing - Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void - Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo - - If vSelLength = 0 Then GoTo EndofSub - If dVPosition = 0 Then GoTo EndofSub - - Dim xVLower As Double = IIf(vSelLength > 0, vSelStart, vSelStart + vSelLength) - Dim xVHalf As Double = vSelStart + vSelHalf - Dim xVUpper As Double = IIf(vSelLength < 0, vSelStart, vSelStart + vSelLength) - If dVPosition + xVHalf <= xVLower Or dVPosition + xVHalf >= xVUpper Then GoTo EndofSub - - If xVLower < 0 Then xVLower = 0 - If xVUpper >= GetMaxVPosition() Then xVUpper = GetMaxVPosition() - 1 - If xVHalf > xVUpper Then xVHalf = xVUpper - If xVHalf < xVLower Then xVHalf = xVLower - - Dim xBPM As Integer = Notes(0).Value - Dim xI1 As Integer - Dim xI2 As Integer - Dim xI3 As Integer - - Dim xValueL As Integer = xBPM - Dim xValueM As Integer = xBPM - Dim xValueU As Integer = xBPM - - Dim xRatio1 As Double = (xVHalf - xVLower + dVPosition) / (xVHalf - xVLower) - Dim xRatio2 As Double = (xVUpper - xVHalf - dVPosition) / (xVUpper - xVHalf) - - 'Save undo - 'For xI3 = 1 To UBound(K) - 'K(xI3).Selected = True - 'Next - 'xUndo = "KZ" & vbCrLf & _ - ' sCmdKs(False) & vbCrLf & _ - ' "SA_" & vSelStart & "_" & vSelLength & "_" & vSelHalf & "_1" - - RedoRemoveNoteAll(False, xUndo, xRedo) - - If Not NTInput Then - 'Below Selection - For xI1 = 1 To UBound(Notes) - If Notes(xI1).VPosition > xVLower Then Exit For - If Notes(xI1).ColumnIndex = niBPM Then xBPM = Notes(xI1).Value - Next - xValueL = xBPM - xI2 = xI1 - - 'Below Half - For xI1 = xI2 To UBound(Notes) - If Notes(xI1).VPosition > xVHalf Then Exit For - If Notes(xI1).ColumnIndex = niBPM Then - xBPM = Notes(xI1).Value - Notes(xI1).Value = Notes(xI1).Value * xRatio1 - End If - Notes(xI1).VPosition = ((Notes(xI1).VPosition - xVLower) * xRatio1) + xVLower - Next - xValueM = xBPM - xI2 = xI1 - - 'Above Half - For xI1 = xI2 To UBound(Notes) - If Notes(xI1).VPosition > xVUpper Then Exit For - If Notes(xI1).ColumnIndex = niBPM Then - xBPM = Notes(xI1).Value - Notes(xI1).Value = IIf(Notes(xI1).Value * xRatio2 <= 655359999, Notes(xI1).Value * xRatio2, 655359999) - End If - Notes(xI1).VPosition = ((Notes(xI1).VPosition - xVHalf) * xRatio2) + xVHalf + dVPosition - Next - xValueU = xBPM - - 'Above Selection - 'For xI1 = xI2 To UBound(K) - ' K(xI1).VPosition += (xRatio - 1) * (xVUpper - xVLower) - 'Next - - 'Add BPMs - ' az: cond. removed; - ' IIf(xVHalf <> xVLower AndAlso xValueL * xRatio1 <= 655359999, xValueL * xRatio1, 655359999) - AddNote(New Note(niBPM, xVLower, xValueL * xRatio1), False, True, False) - ' az: cond removed; - ' IIf(xVHalf <> xVUpper AndAlso xValueM * xRatio2 <= 655359999, xValueM * xRatio2, 655359999) - AddNote(New Note(niBPM, xVHalf + dVPosition, xValueM * xRatio2), False, True, False) - AddNote(New Note(niBPM, xVUpper, xValueU), False, True, False) - - Else - Dim xAddBPML As Boolean = True - Dim xAddBPMM As Boolean = True - Dim xAddBPMU As Boolean = True - - 'Modify notes - For xI1 = 1 To UBound(Notes) - If Notes(xI1).VPosition <= xVLower Then - 'check BPM - If Notes(xI1).ColumnIndex = niBPM Then - xValueL = Notes(xI1).Value - xValueM = Notes(xI1).Value - xValueU = Notes(xI1).Value - If Notes(xI1).VPosition = xVLower Then - xAddBPML = False - - ' az: condition removed; - ' IIf(xVHalf <> xVLower AndAlso Notes(xI1).Value * xRatio1 <= 655359999, Notes(xI1).Value * xRatio1, 655359999) - Notes(xI1).Value = Notes(xI1).Value * xRatio1 - End If - End If - - 'If longnote then adjust length - Dim xEnd As Double = Notes(xI1).VPosition + Notes(xI1).Length - If xEnd > xVUpper Then - ElseIf xEnd > xVHalf Then - Notes(xI1).Length = ((xEnd - xVHalf) * xRatio2) + xVHalf + dVPosition - Notes(xI1).VPosition - ElseIf xEnd > xVLower Then - Notes(xI1).Length = ((xEnd - xVLower) * xRatio1) + xVLower - Notes(xI1).VPosition - End If - - ElseIf Notes(xI1).VPosition <= xVHalf Then - 'check BPM - If Notes(xI1).ColumnIndex = niBPM Then - xValueM = Notes(xI1).Value - xValueU = Notes(xI1).Value - If Notes(xI1).VPosition = xVHalf Then - xAddBPMM = False - ' az: cond. remove - ' IIf(xVHalf <> xVUpper AndAlso Notes(xI1).Value * xRatio2 <= 655359999, Notes(xI1).Value * xRatio2, 655359999) - Notes(xI1).Value = Notes(xI1).Value * xRatio2 - Else - ' az: cond. remove - ' IIf(Notes(xI1).Value * xRatio1 <= 655359999, Notes(xI1).Value * xRatio1, 655359999) - Notes(xI1).Value = Notes(xI1).Value * xRatio1 - End If - End If - - 'Adjust Length - Dim xEnd As Double = Notes(xI1).VPosition + Notes(xI1).Length - If xEnd > xVUpper Then - Notes(xI1).Length = xEnd - xVLower - ((Notes(xI1).VPosition - xVLower) * xRatio1) - ElseIf xEnd > xVHalf Then - Notes(xI1).Length = ((xVHalf - Notes(xI1).VPosition) * xRatio1) + ((xEnd - xVHalf) * xRatio2) - Else - Notes(xI1).Length *= xRatio1 - End If - - 'Adjust VPosition - Notes(xI1).VPosition = ((Notes(xI1).VPosition - xVLower) * xRatio1) + xVLower - - ElseIf Notes(xI1).VPosition <= xVUpper Then - 'check BPM - If Notes(xI1).ColumnIndex = niBPM Then - xValueU = Notes(xI1).Value - If Notes(xI1).VPosition = xVUpper Then xAddBPMU = False Else Notes(xI1).Value = IIf(Notes(xI1).Value * xRatio2 <= 655359999, Notes(xI1).Value * xRatio2, 655359999) - End If - - 'Adjust Length - Dim xEnd As Double = Notes(xI1).VPosition + Notes(xI1).Length - If xEnd > xVUpper Then - Notes(xI1).Length = ((xVUpper - Notes(xI1).VPosition) * xRatio2) + xEnd - xVUpper - Else - Notes(xI1).Length *= xRatio2 - End If - - 'Adjust VPosition - Notes(xI1).VPosition = ((Notes(xI1).VPosition - xVHalf) * xRatio2) + xVHalf + dVPosition - - 'Else - ' K(xI1).VPosition += (xVUpper - xVLower) * (xRatio - 1) - End If - Next - - 'Add BPMs - ' IIf(xVHalf <> xVLower AndAlso xValueL * xRatio1 <= 655359999, xValueL * xRatio1, 655359999) - If xAddBPML Then AddNote(New Note(niBPM, xVLower, xValueL * xRatio1), False, True, False) - ' IIf(xVHalf <> xVUpper AndAlso xValueM * xRatio2 <= 655359999, xValueM * xRatio2, 655359999) - If xAddBPMM Then AddNote(New Note(niBPM, xVHalf + dVPosition, xValueM * xRatio2), False, True, False) - If xAddBPMU Then AddNote(New Note(niBPM, xVUpper, xValueU), False, True, False) - End If - - 'Check BPM Overflow - 'For xI3 = 1 To UBound(Notes) - ' If Notes(xI3).ColumnIndex = niBPM Then - ' If Notes(xI3).Value > 655359999 Then Notes(xI3).Value = 655359999 - ' If Notes(xI3).Value < 1 Then Notes(xI3).Value = 1 - ' End If - 'Next - - 'Restore selection - 'If vSelLength < 0 Then vSelStart += (xRatio - 1) * (xVUpper - xVLower) - 'vSelLength = vSelLength * xRatio - Dim pSelHalf As Double = vSelHalf - vSelHalf += dVPosition - ValidateSelection() - RedoChangeTimeSelection(vSelStart, vSelLength, pSelHalf, vSelStart, vSelStart, vSelHalf, True, xUndo, xRedo) - - RedoAddNoteAll(False, xUndo, xRedo) - - - 'Restore note selection - xVLower = IIf(vSelLength > 0, vSelStart, vSelStart + vSelLength) - xVUpper = IIf(vSelLength < 0, vSelStart, vSelStart + vSelLength) - If Not NTInput Then - For xI3 = 1 To UBound(Notes) - Notes(xI3).Selected = Notes(xI3).VPosition >= xVLower And Notes(xI3).VPosition < xVUpper And nEnabled(Notes(xI3).ColumnIndex) - Next - Else - For xI3 = 1 To UBound(Notes) - Notes(xI3).Selected = Notes(xI3).VPosition < xVUpper And Notes(xI3).VPosition + Notes(xI3).Length >= xVLower And nEnabled(Notes(xI3).ColumnIndex) - Next - End If + If bAddUndo Then AddUndo(xUndo, xBaseRedo.Next, bOverWriteUndo) + End Sub + + Private Sub BPMChangeHalf(dVPosition As Double, Optional bAddUndo As Boolean = True, Optional bOverWriteUndo As Boolean = False) + 'Dim xUndo As String = vbCrLf + 'Dim xRedo As String = vbCrLf + Dim xUndo As UndoRedo.LinkedURCmd = Nothing + Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void + Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo + + If vSelLength = 0 Then GoTo EndofSub + If dVPosition = 0 Then GoTo EndofSub + + Dim xVLower As Double = IIf(vSelLength > 0, vSelStart, vSelStart + vSelLength) + Dim xVHalf As Double = vSelStart + vSelHalf + Dim xVUpper As Double = IIf(vSelLength < 0, vSelStart, vSelStart + vSelLength) + If dVPosition + xVHalf <= xVLower Or dVPosition + xVHalf >= xVUpper Then GoTo EndofSub + + If xVLower < 0 Then xVLower = 0 + If xVUpper >= GetMaxVPosition() Then xVUpper = GetMaxVPosition() - 1 + If xVHalf > xVUpper Then xVHalf = xVUpper + If xVHalf < xVLower Then xVHalf = xVLower + + Dim xBPM As Integer = Notes(0).Value + Dim xI1 As Integer + Dim xI2 As Integer + Dim xI3 As Integer + + Dim xValueL As Integer = xBPM + Dim xValueM As Integer = xBPM + Dim xValueU As Integer = xBPM + + Dim xRatio1 As Double = (xVHalf - xVLower + dVPosition) / (xVHalf - xVLower) + Dim xRatio2 As Double = (xVUpper - xVHalf - dVPosition) / (xVUpper - xVHalf) + + 'Save undo + 'For xI3 = 1 To UBound(K) + 'K(xI3).Selected = True + 'Next + 'xUndo = "KZ" & vbCrLf & _ + ' sCmdKs(False) & vbCrLf & _ + ' "SA_" & vSelStart & "_" & vSelLength & "_" & vSelHalf & "_1" + + RedoRemoveNoteAll(False, xUndo, xRedo) + + If Not NTInput Then + 'Below Selection + For xI1 = 1 To UBound(Notes) + If Notes(xI1).VPosition > xVLower Then Exit For + If Notes(xI1).ColumnIndex = niBPM Then xBPM = Notes(xI1).Value + Next + xValueL = xBPM + xI2 = xI1 + + 'Below Half + For xI1 = xI2 To UBound(Notes) + If Notes(xI1).VPosition > xVHalf Then Exit For + If Notes(xI1).ColumnIndex = niBPM Then + xBPM = Notes(xI1).Value + Notes(xI1).Value = Notes(xI1).Value * xRatio1 + End If + Notes(xI1).VPosition = ((Notes(xI1).VPosition - xVLower) * xRatio1) + xVLower + Next + xValueM = xBPM + xI2 = xI1 + + 'Above Half + For xI1 = xI2 To UBound(Notes) + If Notes(xI1).VPosition > xVUpper Then Exit For + If Notes(xI1).ColumnIndex = niBPM Then + xBPM = Notes(xI1).Value + Notes(xI1).Value = IIf(Notes(xI1).Value * xRatio2 <= 655359999, Notes(xI1).Value * xRatio2, 655359999) + End If + Notes(xI1).VPosition = ((Notes(xI1).VPosition - xVHalf) * xRatio2) + xVHalf + dVPosition + Next + xValueU = xBPM + + 'Above Selection + 'For xI1 = xI2 To UBound(K) + ' K(xI1).VPosition += (xRatio - 1) * (xVUpper - xVLower) + 'Next + + 'Add BPMs + ' az: cond. removed; + ' IIf(xVHalf <> xVLower AndAlso xValueL * xRatio1 <= 655359999, xValueL * xRatio1, 655359999) + AddNote(New Note(niBPM, xVLower, xValueL * xRatio1), False, True, False) + ' az: cond removed; + ' IIf(xVHalf <> xVUpper AndAlso xValueM * xRatio2 <= 655359999, xValueM * xRatio2, 655359999) + AddNote(New Note(niBPM, xVHalf + dVPosition, xValueM * xRatio2), False, True, False) + AddNote(New Note(niBPM, xVUpper, xValueU), False, True, False) + + Else + Dim xAddBPML As Boolean = True + Dim xAddBPMM As Boolean = True + Dim xAddBPMU As Boolean = True + + 'Modify notes + For xI1 = 1 To UBound(Notes) + If Notes(xI1).VPosition <= xVLower Then + 'check BPM + If Notes(xI1).ColumnIndex = niBPM Then + xValueL = Notes(xI1).Value + xValueM = Notes(xI1).Value + xValueU = Notes(xI1).Value + If Notes(xI1).VPosition = xVLower Then + xAddBPML = False + + ' az: condition removed; + ' IIf(xVHalf <> xVLower AndAlso Notes(xI1).Value * xRatio1 <= 655359999, Notes(xI1).Value * xRatio1, 655359999) + Notes(xI1).Value = Notes(xI1).Value * xRatio1 + End If + End If + + 'If longnote then adjust length + Dim xEnd As Double = Notes(xI1).VPosition + Notes(xI1).Length + If xEnd > xVUpper Then + ElseIf xEnd > xVHalf Then + Notes(xI1).Length = ((xEnd - xVHalf) * xRatio2) + xVHalf + dVPosition - Notes(xI1).VPosition + ElseIf xEnd > xVLower Then + Notes(xI1).Length = ((xEnd - xVLower) * xRatio1) + xVLower - Notes(xI1).VPosition + End If + + ElseIf Notes(xI1).VPosition <= xVHalf Then + 'check BPM + If Notes(xI1).ColumnIndex = niBPM Then + xValueM = Notes(xI1).Value + xValueU = Notes(xI1).Value + If Notes(xI1).VPosition = xVHalf Then + xAddBPMM = False + ' az: cond. remove + ' IIf(xVHalf <> xVUpper AndAlso Notes(xI1).Value * xRatio2 <= 655359999, Notes(xI1).Value * xRatio2, 655359999) + Notes(xI1).Value = Notes(xI1).Value * xRatio2 + Else + ' az: cond. remove + ' IIf(Notes(xI1).Value * xRatio1 <= 655359999, Notes(xI1).Value * xRatio1, 655359999) + Notes(xI1).Value = Notes(xI1).Value * xRatio1 + End If + End If + + 'Adjust Length + Dim xEnd As Double = Notes(xI1).VPosition + Notes(xI1).Length + If xEnd > xVUpper Then + Notes(xI1).Length = xEnd - xVLower - ((Notes(xI1).VPosition - xVLower) * xRatio1) + ElseIf xEnd > xVHalf Then + Notes(xI1).Length = ((xVHalf - Notes(xI1).VPosition) * xRatio1) + ((xEnd - xVHalf) * xRatio2) + Else + Notes(xI1).Length *= xRatio1 + End If + + 'Adjust VPosition + Notes(xI1).VPosition = ((Notes(xI1).VPosition - xVLower) * xRatio1) + xVLower + + ElseIf Notes(xI1).VPosition <= xVUpper Then + 'check BPM + If Notes(xI1).ColumnIndex = niBPM Then + xValueU = Notes(xI1).Value + If Notes(xI1).VPosition = xVUpper Then xAddBPMU = False Else Notes(xI1).Value = IIf(Notes(xI1).Value * xRatio2 <= 655359999, Notes(xI1).Value * xRatio2, 655359999) + End If + + 'Adjust Length + Dim xEnd As Double = Notes(xI1).VPosition + Notes(xI1).Length + If xEnd > xVUpper Then + Notes(xI1).Length = ((xVUpper - Notes(xI1).VPosition) * xRatio2) + xEnd - xVUpper + Else + Notes(xI1).Length *= xRatio2 + End If + + 'Adjust VPosition + Notes(xI1).VPosition = ((Notes(xI1).VPosition - xVHalf) * xRatio2) + xVHalf + dVPosition + + 'Else + ' K(xI1).VPosition += (xVUpper - xVLower) * (xRatio - 1) + End If + Next + + 'Add BPMs + ' IIf(xVHalf <> xVLower AndAlso xValueL * xRatio1 <= 655359999, xValueL * xRatio1, 655359999) + If xAddBPML Then AddNote(New Note(niBPM, xVLower, xValueL * xRatio1), False, True, False) + ' IIf(xVHalf <> xVUpper AndAlso xValueM * xRatio2 <= 655359999, xValueM * xRatio2, 655359999) + If xAddBPMM Then AddNote(New Note(niBPM, xVHalf + dVPosition, xValueM * xRatio2), False, True, False) + If xAddBPMU Then AddNote(New Note(niBPM, xVUpper, xValueU), False, True, False) + End If + + 'Check BPM Overflow + 'For xI3 = 1 To UBound(Notes) + ' If Notes(xI3).ColumnIndex = niBPM Then + ' If Notes(xI3).Value > 655359999 Then Notes(xI3).Value = 655359999 + ' If Notes(xI3).Value < 1 Then Notes(xI3).Value = 1 + ' End If + 'Next + + 'Restore selection + 'If vSelLength < 0 Then vSelStart += (xRatio - 1) * (xVUpper - xVLower) + 'vSelLength = vSelLength * xRatio + Dim pSelHalf As Double = vSelHalf + vSelHalf += dVPosition + ValidateSelection() + RedoChangeTimeSelection(vSelStart, vSelLength, pSelHalf, vSelStart, vSelStart, vSelHalf, True, xUndo, xRedo) + + RedoAddNoteAll(False, xUndo, xRedo) + + + 'Restore note selection + xVLower = IIf(vSelLength > 0, vSelStart, vSelStart + vSelLength) + xVUpper = IIf(vSelLength < 0, vSelStart, vSelStart + vSelLength) + If Not NTInput Then + For xI3 = 1 To UBound(Notes) + Notes(xI3).Selected = Notes(xI3).VPosition >= xVLower And Notes(xI3).VPosition < xVUpper And nEnabled(Notes(xI3).ColumnIndex) + Next + Else + For xI3 = 1 To UBound(Notes) + Notes(xI3).Selected = Notes(xI3).VPosition < xVUpper And Notes(xI3).VPosition + Notes(xI3).Length >= xVLower And nEnabled(Notes(xI3).ColumnIndex) + Next + End If EndofSub: - If bAddUndo Then AddUndo(xUndo, xBaseRedo.Next, bOverWriteUndo) - End Sub - - Private Sub BPMChangeByValue(xValue As Integer) - 'Dim xUndo As String = vbCrLf - 'Dim xRedo As String = vbCrLf - Dim xUndo As UndoRedo.LinkedURCmd = Nothing - Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void - Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo - - If vSelLength = 0 Then Return - - Dim xVLower As Double = IIf(vSelLength > 0, vSelStart, vSelStart + vSelLength) - Dim xVHalf As Double = vSelStart + vSelHalf - Dim xVUpper As Double = IIf(vSelLength < 0, vSelStart, vSelStart + vSelLength) - If xVHalf = xVUpper Then xVHalf = xVLower - 'If dVPosition + xVHalf <= xVLower Or dVPosition + xVHalf >= xVUpper Then GoTo EndofSub - - If xVLower < 0 Then xVLower = 0 - If xVUpper >= GetMaxVPosition() Then xVUpper = GetMaxVPosition() - 1 - If xVHalf > xVUpper Then xVHalf = xVUpper - If xVHalf < xVLower Then xVHalf = xVLower - - Dim xBPM = Notes(0).Value - Dim xI1 As Integer - Dim xI2 As Integer - Dim xI3 As Integer - - Dim xConstBPM As Double = 0 - - 'Below Selection - For xI1 = 1 To UBound(Notes) - If Notes(xI1).VPosition > xVLower Then Exit For - If Notes(xI1).ColumnIndex = niBPM Then xBPM = Notes(xI1).Value - Next - xI2 = xI1 - Dim xVPos() As Double = {xVLower} - Dim xVal() = {xBPM} - - 'Within Selection - Dim xU As Integer = 0 - For xI1 = xI2 To UBound(Notes) - If Notes(xI1).VPosition > xVUpper Then Exit For - - If Notes(xI1).ColumnIndex = niBPM Then - xU = UBound(xVPos) + 1 - ReDim Preserve xVPos(xU) - ReDim Preserve xVal(xU) - xVPos(xU) = Notes(xI1).VPosition - xVal(xU) = Notes(xI1).Value - End If - Next - ReDim Preserve xVPos(xU + 1) - xVPos(xU + 1) = xVUpper - - 'Calculate Constant BPM - For xI1 = 0 To xU - xConstBPM += (xVPos(xI1 + 1) - xVPos(xI1)) / xVal(xI1) - Next - xConstBPM = (xVUpper - xVLower) / xConstBPM - - 'Compare BPM '(xVHalf - xVLower) / xValue + (xVUpper - xVHalf) / xResult = (xVUpper - xVLower) / xConstBPM - If (xVUpper - xVLower) / xConstBPM <= (xVHalf - xVLower) / xValue Then - Dim Limit = (xVHalf - xVLower) * xConstBPM / (xVUpper - xVLower) / 10000 - Dim unused = MsgBox("Please enter a value that is greater than " & Limit & ".", MsgBoxStyle.Critical, Strings.Messages.Err) - Return - End If - Dim xTempDivider As Double = (xConstBPM * (xVHalf - xVLower)) - (xValue * (xVUpper - xVLower)) - - ' az: I want to allow negative values, maybe... - If xTempDivider = 0 Then - Return ' nullop this - End If - - ' apply div. by 10k to nullify mult. caused by divider being divided by 10k - Dim xResult = (xVHalf - xVUpper) * xValue / xTempDivider * xConstBPM ' order here is important to avoid an overflow - - RedoRemoveNoteAll(False, xUndo, xRedo) - - 'Adjust note - If Not NTInput Then - 'Below Selection - For xI1 = 1 To UBound(Notes) - If Notes(xI1).VPosition > xVLower Then Exit For - Next - xI2 = xI1 - If xI2 > UBound(Notes) Then GoTo EndOfAdjustment - - 'Within Selection - Dim xTempTime As Double - Dim xTempVPos As Double - For xI1 = xI2 To UBound(Notes) - If Notes(xI1).VPosition >= xVUpper Then Exit For - xTempTime = 0 - - xTempVPos = Notes(xI1).VPosition - For xI3 = 0 To xU - If xTempVPos < xVPos(xI3 + 1) Then Exit For - xTempTime += (xVPos(xI3 + 1) - xVPos(xI3)) / xVal(xI3) - Next - xTempTime += (xTempVPos - xVPos(xI3)) / xVal(xI3) - - Notes(xI1).VPosition = If(xTempTime - ((xVHalf - xVLower) / xValue) > 0, - ((xTempTime - ((xVHalf - xVLower) / xValue)) * xResult) + xVHalf, - (xTempTime * xValue) + xVLower) - Next - - Else - Dim xTempTime As Double - Dim xTempVPos As Double - Dim xTempEnd As Double - - For xI1 = 1 To UBound(Notes) - If Notes(xI1).Length Then xTempEnd = Notes(xI1).VPosition + Notes(xI1).Length - - If Notes(xI1).VPosition > xVLower And Notes(xI1).VPosition < xVUpper Then - xTempTime = 0 - - xTempVPos = Notes(xI1).VPosition - For xI3 = 0 To xU - If xTempVPos < xVPos(xI3 + 1) Then Exit For - xTempTime += (xVPos(xI3 + 1) - xVPos(xI3)) / xVal(xI3) - Next - xTempTime += (xTempVPos - xVPos(xI3)) / xVal(xI3) - - Notes(xI1).VPosition = If(xTempTime - ((xVHalf - xVLower) / xValue) > 0, - ((xTempTime - ((xVHalf - xVLower) / xValue)) * xResult) + xVHalf, - (xTempTime * xValue) + xVLower) - End If - - If Notes(xI1).Length Then - If xTempEnd > xVLower And xTempEnd < xVUpper Then - xTempTime = 0 - - For xI3 = 0 To xU - If xTempEnd < xVPos(xI3 + 1) Then Exit For - xTempTime += (xVPos(xI3 + 1) - xVPos(xI3)) / xVal(xI3) - Next - xTempTime += (xTempEnd - xVPos(xI3)) / xVal(xI3) - - Notes(xI1).Length = If(xTempTime - ((xVHalf - xVLower) / xValue) > 0, - ((xTempTime - ((xVHalf - xVLower) / xValue)) * xResult) + xVHalf - Notes(xI1).VPosition, - (xTempTime * xValue) + xVLower - Notes(xI1).VPosition) - - Else - Notes(xI1).Length = xTempEnd - Notes(xI1).VPosition - End If - End If - - Next - End If + If bAddUndo Then AddUndo(xUndo, xBaseRedo.Next, bOverWriteUndo) + End Sub + + Private Sub BPMChangeByValue(xValue As Integer) + 'Dim xUndo As String = vbCrLf + 'Dim xRedo As String = vbCrLf + Dim xUndo As UndoRedo.LinkedURCmd = Nothing + Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void + Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo + + If vSelLength = 0 Then Return + + Dim xVLower As Double = IIf(vSelLength > 0, vSelStart, vSelStart + vSelLength) + Dim xVHalf As Double = vSelStart + vSelHalf + Dim xVUpper As Double = IIf(vSelLength < 0, vSelStart, vSelStart + vSelLength) + If xVHalf = xVUpper Then xVHalf = xVLower + 'If dVPosition + xVHalf <= xVLower Or dVPosition + xVHalf >= xVUpper Then GoTo EndofSub + + If xVLower < 0 Then xVLower = 0 + If xVUpper >= GetMaxVPosition() Then xVUpper = GetMaxVPosition() - 1 + If xVHalf > xVUpper Then xVHalf = xVUpper + If xVHalf < xVLower Then xVHalf = xVLower + + Dim xBPM = Notes(0).Value + Dim xI1 As Integer + Dim xI2 As Integer + Dim xI3 As Integer + + Dim xConstBPM As Double = 0 + + 'Below Selection + For xI1 = 1 To UBound(Notes) + If Notes(xI1).VPosition > xVLower Then Exit For + If Notes(xI1).ColumnIndex = niBPM Then xBPM = Notes(xI1).Value + Next + xI2 = xI1 + Dim xVPos() As Double = {xVLower} + Dim xVal() = {xBPM} + + 'Within Selection + Dim xU As Integer = 0 + For xI1 = xI2 To UBound(Notes) + If Notes(xI1).VPosition > xVUpper Then Exit For + + If Notes(xI1).ColumnIndex = niBPM Then + xU = UBound(xVPos) + 1 + ReDim Preserve xVPos(xU) + ReDim Preserve xVal(xU) + xVPos(xU) = Notes(xI1).VPosition + xVal(xU) = Notes(xI1).Value + End If + Next + ReDim Preserve xVPos(xU + 1) + xVPos(xU + 1) = xVUpper + + 'Calculate Constant BPM + For xI1 = 0 To xU + xConstBPM += (xVPos(xI1 + 1) - xVPos(xI1)) / xVal(xI1) + Next + xConstBPM = (xVUpper - xVLower) / xConstBPM + + 'Compare BPM '(xVHalf - xVLower) / xValue + (xVUpper - xVHalf) / xResult = (xVUpper - xVLower) / xConstBPM + If (xVUpper - xVLower) / xConstBPM <= (xVHalf - xVLower) / xValue Then + Dim Limit = (xVHalf - xVLower) * xConstBPM / (xVUpper - xVLower) / 10000 + Dim unused = MsgBox("Please enter a value that is greater than " & Limit & ".", MsgBoxStyle.Critical, Strings.Messages.Err) + Return + End If + Dim xTempDivider As Double = (xConstBPM * (xVHalf - xVLower)) - (xValue * (xVUpper - xVLower)) + + ' az: I want to allow negative values, maybe... + If xTempDivider = 0 Then + Return ' nullop this + End If + + ' apply div. by 10k to nullify mult. caused by divider being divided by 10k + Dim xResult = (xVHalf - xVUpper) * xValue / xTempDivider * xConstBPM ' order here is important to avoid an overflow + + RedoRemoveNoteAll(False, xUndo, xRedo) + + 'Adjust note + If Not NTInput Then + 'Below Selection + For xI1 = 1 To UBound(Notes) + If Notes(xI1).VPosition > xVLower Then Exit For + Next + xI2 = xI1 + If xI2 > UBound(Notes) Then GoTo EndOfAdjustment + + 'Within Selection + Dim xTempTime As Double + Dim xTempVPos As Double + For xI1 = xI2 To UBound(Notes) + If Notes(xI1).VPosition >= xVUpper Then Exit For + xTempTime = 0 + + xTempVPos = Notes(xI1).VPosition + For xI3 = 0 To xU + If xTempVPos < xVPos(xI3 + 1) Then Exit For + xTempTime += (xVPos(xI3 + 1) - xVPos(xI3)) / xVal(xI3) + Next + xTempTime += (xTempVPos - xVPos(xI3)) / xVal(xI3) + + Notes(xI1).VPosition = If(xTempTime - ((xVHalf - xVLower) / xValue) > 0, + ((xTempTime - ((xVHalf - xVLower) / xValue)) * xResult) + xVHalf, + (xTempTime * xValue) + xVLower) + Next + + Else + Dim xTempTime As Double + Dim xTempVPos As Double + Dim xTempEnd As Double + + For xI1 = 1 To UBound(Notes) + If Notes(xI1).Length Then xTempEnd = Notes(xI1).VPosition + Notes(xI1).Length + + If Notes(xI1).VPosition > xVLower And Notes(xI1).VPosition < xVUpper Then + xTempTime = 0 + + xTempVPos = Notes(xI1).VPosition + For xI3 = 0 To xU + If xTempVPos < xVPos(xI3 + 1) Then Exit For + xTempTime += (xVPos(xI3 + 1) - xVPos(xI3)) / xVal(xI3) + Next + xTempTime += (xTempVPos - xVPos(xI3)) / xVal(xI3) + + Notes(xI1).VPosition = If(xTempTime - ((xVHalf - xVLower) / xValue) > 0, + ((xTempTime - ((xVHalf - xVLower) / xValue)) * xResult) + xVHalf, + (xTempTime * xValue) + xVLower) + End If + + If Notes(xI1).Length Then + If xTempEnd > xVLower And xTempEnd < xVUpper Then + xTempTime = 0 + + For xI3 = 0 To xU + If xTempEnd < xVPos(xI3 + 1) Then Exit For + xTempTime += (xVPos(xI3 + 1) - xVPos(xI3)) / xVal(xI3) + Next + xTempTime += (xTempEnd - xVPos(xI3)) / xVal(xI3) + + Notes(xI1).Length = If(xTempTime - ((xVHalf - xVLower) / xValue) > 0, + ((xTempTime - ((xVHalf - xVLower) / xValue)) * xResult) + xVHalf - Notes(xI1).VPosition, + (xTempTime * xValue) + xVLower - Notes(xI1).VPosition) + + Else + Notes(xI1).Length = xTempEnd - Notes(xI1).VPosition + End If + End If + + Next + End If EndOfAdjustment: - 'Delete BPMs - xI1 = 1 - Do While xI1 <= UBound(Notes) - If Notes(xI1).VPosition > xVUpper Then Exit Do - If Notes(xI1).VPosition >= xVLower And Notes(xI1).ColumnIndex = niBPM Then - For xI3 = xI1 + 1 To UBound(Notes) - Notes(xI3 - 1) = Notes(xI3) - Next - ReDim Preserve Notes(UBound(Notes) - 1) - Else - xI1 += 1 - End If - Loop - - 'Add BPMs - ReDim Preserve Notes(UBound(Notes) + 2) - With Notes(UBound(Notes) - 1) - .ColumnIndex = niBPM - .VPosition = xVHalf - .Value = xResult - End With - With Notes(UBound(Notes)) - .ColumnIndex = niBPM - .VPosition = xVUpper - .Value = xVal(xU) - End With - If xVLower <> xVHalf Then - ReDim Preserve Notes(UBound(Notes) + 1) - With Notes(UBound(Notes)) - .ColumnIndex = niBPM - .VPosition = xVLower - .Value = xValue - End With - End If - - 'Save redo - 'For xI3 = 1 To UBound(K) - ' K(xI3).Selected = True - 'Next - 'xRedo = "KZ" & vbCrLf & _ - ' sCmdKs(False) & vbCrLf & _ - ' "SA_" & vSelStart & "_" & vSelLength & "_" & vSelHalf & "_1" - RedoAddNoteAll(False, xUndo, xRedo) - - 'Restore note selection - xVLower = IIf(vSelLength > 0, vSelStart, vSelStart + vSelLength) - xVUpper = IIf(vSelLength < 0, vSelStart, vSelStart + vSelLength) - If Not NTInput Then - For xI3 = 1 To UBound(Notes) - Notes(xI3).Selected = Notes(xI3).VPosition >= xVLower And Notes(xI3).VPosition < xVUpper And nEnabled(Notes(xI3).ColumnIndex) - Next - Else - For xI3 = 1 To UBound(Notes) - Notes(xI3).Selected = Notes(xI3).VPosition < xVUpper And Notes(xI3).VPosition + Notes(xI3).Length >= xVLower And nEnabled(Notes(xI3).ColumnIndex) - Next - End If - - 'EndofSub: - AddUndo(xUndo, xBaseRedo.Next) - End Sub - - Private Sub ConvertAreaToStop() - Dim xUndo As UndoRedo.LinkedURCmd = Nothing - Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void - Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo - - If vSelLength = 0 Then Return - - Dim xVLower As Double = IIf(vSelLength > 0, vSelStart, vSelStart + vSelLength) - Dim xVUpper As Double = IIf(vSelLength < 0, vSelStart, vSelStart + vSelLength) - - Dim notesInRange = From note In Notes - Where note.VPosition > xVLower And note.VPosition <= xVUpper - Select note - - If notesInRange.Count() > 0 Then - Dim unused = MessageBox.Show("The selected area can't have notes anywhere but at the start.") - Return - End If - - RedoRemoveNoteAll(False, xUndo, xRedo) - - ' Translate notes - For I = 1 To UBound(Notes) - If Notes(I).VPosition > xVUpper Then - Notes(I).VPosition -= vSelLength - End If - Next - - ' Add Stop - ReDim Preserve Notes(UBound(Notes) + 1) - With Notes(UBound(Notes)) - .ColumnIndex = niSTOP - .VPosition = xVLower - .Value = vSelLength * 10000 - End With - - RedoAddNoteAll(False, xUndo, xRedo) - - AddUndo(xUndo, xBaseRedo.Next) - - End Sub - - Private Sub BConvertStop_Click(sender As Object, e As EventArgs) Handles BConvertStop.Click - SortByVPositionInsertion() - ConvertAreaToStop() - - SortByVPositionInsertion() - UpdatePairing() - RefreshPanelAll() - POStatusRefresh() - - Beep() - TVCBPM.Focus() - End Sub + 'Delete BPMs + xI1 = 1 + Do While xI1 <= UBound(Notes) + If Notes(xI1).VPosition > xVUpper Then Exit Do + If Notes(xI1).VPosition >= xVLower And Notes(xI1).ColumnIndex = niBPM Then + For xI3 = xI1 + 1 To UBound(Notes) + Notes(xI3 - 1) = Notes(xI3) + Next + ReDim Preserve Notes(UBound(Notes) - 1) + Else + xI1 += 1 + End If + Loop + + 'Add BPMs + ReDim Preserve Notes(UBound(Notes) + 2) + With Notes(UBound(Notes) - 1) + .ColumnIndex = niBPM + .VPosition = xVHalf + .Value = xResult + End With + With Notes(UBound(Notes)) + .ColumnIndex = niBPM + .VPosition = xVUpper + .Value = xVal(xU) + End With + If xVLower <> xVHalf Then + ReDim Preserve Notes(UBound(Notes) + 1) + With Notes(UBound(Notes)) + .ColumnIndex = niBPM + .VPosition = xVLower + .Value = xValue + End With + End If + + 'Save redo + 'For xI3 = 1 To UBound(K) + ' K(xI3).Selected = True + 'Next + 'xRedo = "KZ" & vbCrLf & _ + ' sCmdKs(False) & vbCrLf & _ + ' "SA_" & vSelStart & "_" & vSelLength & "_" & vSelHalf & "_1" + RedoAddNoteAll(False, xUndo, xRedo) + + 'Restore note selection + xVLower = IIf(vSelLength > 0, vSelStart, vSelStart + vSelLength) + xVUpper = IIf(vSelLength < 0, vSelStart, vSelStart + vSelLength) + If Not NTInput Then + For xI3 = 1 To UBound(Notes) + Notes(xI3).Selected = Notes(xI3).VPosition >= xVLower And Notes(xI3).VPosition < xVUpper And nEnabled(Notes(xI3).ColumnIndex) + Next + Else + For xI3 = 1 To UBound(Notes) + Notes(xI3).Selected = Notes(xI3).VPosition < xVUpper And Notes(xI3).VPosition + Notes(xI3).Length >= xVLower And nEnabled(Notes(xI3).ColumnIndex) + Next + End If + + 'EndofSub: + AddUndo(xUndo, xBaseRedo.Next) + End Sub + + Private Sub ConvertAreaToStop() + Dim xUndo As UndoRedo.LinkedURCmd = Nothing + Dim xRedo As UndoRedo.LinkedURCmd = New UndoRedo.Void + Dim xBaseRedo As UndoRedo.LinkedURCmd = xRedo + + If vSelLength = 0 Then Return + + Dim xVLower As Double = IIf(vSelLength > 0, vSelStart, vSelStart + vSelLength) + Dim xVUpper As Double = IIf(vSelLength < 0, vSelStart, vSelStart + vSelLength) + + Dim notesInRange = From note In Notes + Where note.VPosition > xVLower And note.VPosition <= xVUpper + Select note + + If notesInRange.Count() > 0 Then + Dim unused = MessageBox.Show("The selected area can't have notes anywhere but at the start.") + Return + End If + + RedoRemoveNoteAll(False, xUndo, xRedo) + + ' Translate notes + For I = 1 To UBound(Notes) + If Notes(I).VPosition > xVUpper Then + Notes(I).VPosition -= vSelLength + End If + Next + + ' Add Stop + ReDim Preserve Notes(UBound(Notes) + 1) + With Notes(UBound(Notes)) + .ColumnIndex = niSTOP + .VPosition = xVLower + .Value = vSelLength * 10000 + End With + + RedoAddNoteAll(False, xUndo, xRedo) + + AddUndo(xUndo, xBaseRedo.Next) + + End Sub + + Private Sub BConvertStop_Click(sender As Object, e As EventArgs) Handles BConvertStop.Click + SortByVPositionInsertion() + ConvertAreaToStop() + + SortByVPositionInsertion() + UpdatePairing() + RefreshPanelAll() + POStatusRefresh() + + Beep() + TVCBPM.Focus() + End Sub End Class diff --git a/iBMSC/UndoRedo.vb b/iBMSC/UndoRedo.vb index 4b5a6894d..14ae3d398 100644 --- a/iBMSC/UndoRedo.vb +++ b/iBMSC/UndoRedo.vb @@ -1,470 +1,470 @@ Imports iBMSC.Editor Public Class UndoRedo - Public Const opVoid As Byte = 0 - Public Const opAddNote As Byte = 1 - Public Const opRemoveNote As Byte = 2 - Public Const opChangeNote As Byte = 3 - Public Const opMoveNote As Byte = 4 - Public Const opLongNoteModify As Byte = 5 - Public Const opHiddenNoteModify As Byte = 6 - Public Const opRelabelNote As Byte = 7 - Public Const opRemoveAllNotes As Byte = 15 - Public Const opChangeMeasureLength As Byte = 16 - Public Const opChangeTimeSelection As Byte = 17 - Public Const opNT As Byte = 18 - 'Public Const opChangeVisibleColumns As Byte = 19 - Public Const opWavAutoincFlag As Byte = 20 - - Public Const opNoOperation As Byte = 255 - - Private Const trueByte As Byte = 1 - Private Const falseByte As Byte = 0 - - - - Public MustInherit Class LinkedURCmd - Public [Next] As LinkedURCmd = Nothing - Public MustOverride Function ofType() As Byte - Public MustOverride Function toBytes() As Byte() - 'Public MustOverride Sub fromBytes( b As Byte()) - End Class - - - - Public Shared Function fromBytes(b() As Byte) As LinkedURCmd - If b Is Nothing Then Return Nothing - If b.Length = 0 Then Return Nothing - - Select Case b(0) - Case opVoid : Return New Void(b) - Case opAddNote : Return New AddNote(b) - Case opRemoveNote : Return New RemoveNote(b) - Case opChangeNote : Return New ChangeNote(b) - Case opMoveNote : Return New MoveNote(b) - Case opLongNoteModify : Return New LongNoteModify(b) - Case opHiddenNoteModify : Return New HiddenNoteModify(b) - Case opRelabelNote : Return New RelabelNote(b) - Case opRemoveAllNotes : Return New RemoveAllNotes(b) - Case opChangeMeasureLength : Return New ChangeMeasureLength(b) - Case opChangeTimeSelection : Return New ChangeTimeSelection(b) - Case opNT : Return New NT(b) - 'Case opChangeVisibleColumns : Return New ChangeVisibleColumns(b) - Case opWavAutoincFlag : Return New WavAutoincFlag(b) - Case opNoOperation : Return New NoOperation(b) - Case Else : Return Nothing - End Select - End Function - - - Public Class Void : Inherits LinkedURCmd - '1 = 1 - Public Overrides Function toBytes() As Byte() - toBytes = New Byte() {opVoid} - End Function - - Public Sub New() - End Sub - - Public Sub New(b() As Byte) - End Sub - - Public Overrides Function ofType() As Byte - Return opVoid - End Function - End Class - - Public MustInherit Class LinkedURNoteCmd : Inherits LinkedURCmd - Public note As Note - - Public Sub New() - - End Sub - - Public Sub New(b As Note) - note = b - End Sub - - Public Sub New(b() As Byte) - FromBinaryReader(New BinaryReader(New MemoryStream(b))) - End Sub - - Public Sub FromBinaryReader(ByRef br As BinaryReader) - Dim unused = br.ReadByte() - note.FromBinReader(br) - End Sub - - Public Sub WriteBinWriter(ByRef bw As BinaryWriter) - bw.Write(ofType()) - bw.Write(note.ToBytes()) - End Sub - - Public MustOverride Overrides Function ofType() As Byte - - Public Overrides Function toBytes() As Byte() - Dim ms = New MemoryStream() - Dim bw As New BinaryWriter(ms) - WriteBinWriter(bw) + Public Const opVoid As Byte = 0 + Public Const opAddNote As Byte = 1 + Public Const opRemoveNote As Byte = 2 + Public Const opChangeNote As Byte = 3 + Public Const opMoveNote As Byte = 4 + Public Const opLongNoteModify As Byte = 5 + Public Const opHiddenNoteModify As Byte = 6 + Public Const opRelabelNote As Byte = 7 + Public Const opRemoveAllNotes As Byte = 15 + Public Const opChangeMeasureLength As Byte = 16 + Public Const opChangeTimeSelection As Byte = 17 + Public Const opNT As Byte = 18 + 'Public Const opChangeVisibleColumns As Byte = 19 + Public Const opWavAutoincFlag As Byte = 20 + + Public Const opNoOperation As Byte = 255 + + Private Const trueByte As Byte = 1 + Private Const falseByte As Byte = 0 + + + + Public MustInherit Class LinkedURCmd + Public [Next] As LinkedURCmd = Nothing + Public MustOverride Function ofType() As Byte + Public MustOverride Function toBytes() As Byte() + 'Public MustOverride Sub fromBytes( b As Byte()) + End Class + + + + Public Shared Function fromBytes(b() As Byte) As LinkedURCmd + If b Is Nothing Then Return Nothing + If b.Length = 0 Then Return Nothing + + Select Case b(0) + Case opVoid : Return New Void(b) + Case opAddNote : Return New AddNote(b) + Case opRemoveNote : Return New RemoveNote(b) + Case opChangeNote : Return New ChangeNote(b) + Case opMoveNote : Return New MoveNote(b) + Case opLongNoteModify : Return New LongNoteModify(b) + Case opHiddenNoteModify : Return New HiddenNoteModify(b) + Case opRelabelNote : Return New RelabelNote(b) + Case opRemoveAllNotes : Return New RemoveAllNotes(b) + Case opChangeMeasureLength : Return New ChangeMeasureLength(b) + Case opChangeTimeSelection : Return New ChangeTimeSelection(b) + Case opNT : Return New NT(b) + 'Case opChangeVisibleColumns : Return New ChangeVisibleColumns(b) + Case opWavAutoincFlag : Return New WavAutoincFlag(b) + Case opNoOperation : Return New NoOperation(b) + Case Else : Return Nothing + End Select + End Function + + + Public Class Void : Inherits LinkedURCmd + '1 = 1 + Public Overrides Function toBytes() As Byte() + toBytes = New Byte() {opVoid} + End Function + + Public Sub New() + End Sub + + Public Sub New(b() As Byte) + End Sub + + Public Overrides Function ofType() As Byte + Return opVoid + End Function + End Class + + Public MustInherit Class LinkedURNoteCmd : Inherits LinkedURCmd + Public note As Note + + Public Sub New() + + End Sub + + Public Sub New(b As Note) + note = b + End Sub + + Public Sub New(b() As Byte) + FromBinaryReader(New BinaryReader(New MemoryStream(b))) + End Sub + + Public Sub FromBinaryReader(ByRef br As BinaryReader) + Dim unused = br.ReadByte() + note.FromBinReader(br) + End Sub + + Public Sub WriteBinWriter(ByRef bw As BinaryWriter) + bw.Write(ofType()) + bw.Write(note.ToBytes()) + End Sub + + Public MustOverride Overrides Function ofType() As Byte + + Public Overrides Function toBytes() As Byte() + Dim ms = New MemoryStream() + Dim bw As New BinaryWriter(ms) + WriteBinWriter(bw) - Return ms.GetBuffer() - End Function - End Class + Return ms.GetBuffer() + End Function + End Class - Public Class AddNote : Inherits LinkedURNoteCmd - Public Sub New(_note As Note) - note = _note - End Sub - - Public Sub New(b() As Byte) - MyBase.New(b) - End Sub - - Public Overrides Function ofType() As Byte - Return opAddNote - End Function - End Class - - - - Public Class RemoveNote : Inherits LinkedURNoteCmd - Public Sub New(_note As Note) - note = _note - End Sub - - Public Sub New(b() As Byte) - MyBase.New(b) - End Sub - - Public Overrides Function ofType() As Byte - Return opRemoveNote - End Function - End Class + Public Class AddNote : Inherits LinkedURNoteCmd + Public Sub New(_note As Note) + note = _note + End Sub + + Public Sub New(b() As Byte) + MyBase.New(b) + End Sub + + Public Overrides Function ofType() As Byte + Return opAddNote + End Function + End Class + + + + Public Class RemoveNote : Inherits LinkedURNoteCmd + Public Sub New(_note As Note) + note = _note + End Sub + + Public Sub New(b() As Byte) + MyBase.New(b) + End Sub + + Public Overrides Function ofType() As Byte + Return opRemoveNote + End Function + End Class - Public Class ChangeNote : Inherits LinkedURNoteCmd - Public NNote As Note + Public Class ChangeNote : Inherits LinkedURNoteCmd + Public NNote As Note - Public Overrides Function toBytes() As Byte() - Dim ms = New MemoryStream(MyBase.toBytes) - Dim bw = New BinaryWriter(ms) - WriteBinWriter(bw) - NNote.WriteBinWriter(bw) - Return ms.GetBuffer() - End Function + Public Overrides Function toBytes() As Byte() + Dim ms = New MemoryStream(MyBase.toBytes) + Dim bw = New BinaryWriter(ms) + WriteBinWriter(bw) + NNote.WriteBinWriter(bw) + Return ms.GetBuffer() + End Function - Public Sub New(b() As Byte) - Dim br = New BinaryReader(New MemoryStream(b)) - FromBinaryReader(br) - NNote.FromBinReader(br) - End Sub + Public Sub New(b() As Byte) + Dim br = New BinaryReader(New MemoryStream(b)) + FromBinaryReader(br) + NNote.FromBinReader(br) + End Sub - Public Sub New(note1 As Note, note2 As Note) - note = note1 - NNote = note2 - End Sub + Public Sub New(note1 As Note, note2 As Note) + note = note1 + NNote = note2 + End Sub - Public Overrides Function ofType() As Byte - Return opChangeNote - End Function - End Class + Public Overrides Function ofType() As Byte + Return opChangeNote + End Function + End Class - Public Class MoveNote : Inherits LinkedURNoteCmd - Public NColumnIndex As Integer = 0 - Public NVPosition As Double = 0 + Public Class MoveNote : Inherits LinkedURNoteCmd + Public NColumnIndex As Integer = 0 + Public NVPosition As Double = 0 - Public Overrides Function toBytes() As Byte() - Dim ms = New MemoryStream() - Dim bw As New BinaryWriter(ms) - WriteBinWriter(bw) - bw.Write(NColumnIndex) - bw.Write(NVPosition) + Public Overrides Function toBytes() As Byte() + Dim ms = New MemoryStream() + Dim bw As New BinaryWriter(ms) + WriteBinWriter(bw) + bw.Write(NColumnIndex) + bw.Write(NVPosition) - Return ms.GetBuffer() - End Function + Return ms.GetBuffer() + End Function - Public Sub New(b() As Byte) - Dim br As New BinaryReader(New MemoryStream(b)) - FromBinaryReader(br) - NColumnIndex = br.ReadInt32() - NVPosition = br.ReadDouble() - End Sub + Public Sub New(b() As Byte) + Dim br As New BinaryReader(New MemoryStream(b)) + FromBinaryReader(br) + NColumnIndex = br.ReadInt32() + NVPosition = br.ReadDouble() + End Sub - Public Sub New(_note As Note, _ColIndex As Integer, _VPos As Double) - note = _note - NColumnIndex = _ColIndex - NVPosition = _VPos - End Sub + Public Sub New(_note As Note, _ColIndex As Integer, _VPos As Double) + note = _note + NColumnIndex = _ColIndex + NVPosition = _VPos + End Sub - Public Overrides Function ofType() As Byte - Return opMoveNote - End Function - End Class + Public Overrides Function ofType() As Byte + Return opMoveNote + End Function + End Class - Public Class LongNoteModify : Inherits LinkedURNoteCmd - Public NVPosition As Double = 0 - Public NLongNote As Double = 0 + Public Class LongNoteModify : Inherits LinkedURNoteCmd + Public NVPosition As Double = 0 + Public NLongNote As Double = 0 - Public Overrides Function toBytes() As Byte() - Dim ms = New MemoryStream() - Dim bw = New BinaryWriter(ms) - WriteBinWriter(bw) - bw.Write(NVPosition) - bw.Write(NLongNote) + Public Overrides Function toBytes() As Byte() + Dim ms = New MemoryStream() + Dim bw = New BinaryWriter(ms) + WriteBinWriter(bw) + bw.Write(NVPosition) + bw.Write(NLongNote) - Return ms.GetBuffer() - End Function + Return ms.GetBuffer() + End Function - Public Sub New(b() As Byte) - Dim br = New BinaryReader(New MemoryStream(b)) - FromBinaryReader(br) - NLongNote = br.ReadDouble() - NVPosition = br.ReadDouble() - End Sub + Public Sub New(b() As Byte) + Dim br = New BinaryReader(New MemoryStream(b)) + FromBinaryReader(br) + NLongNote = br.ReadDouble() + NVPosition = br.ReadDouble() + End Sub - Public Sub New(_note As Note, xNVPosition As Double, xNLongNote As Double) - note = _note - NVPosition = xNVPosition - NLongNote = xNLongNote - End Sub + Public Sub New(_note As Note, xNVPosition As Double, xNLongNote As Double) + note = _note + NVPosition = xNVPosition + NLongNote = xNLongNote + End Sub - Public Overrides Function ofType() As Byte - Return opLongNoteModify - End Function - End Class - - - - Public Class HiddenNoteModify : Inherits LinkedURNoteCmd - Public NHidden As Boolean = False - - Public Overrides Function toBytes() As Byte() - Dim MS = New MemoryStream() - Dim bw = New BinaryWriter(MS) - WriteBinWriter(bw) - bw.Write(NHidden) - Return MS.GetBuffer() - End Function - - Public Sub New(b() As Byte) - Dim br = New BinaryReader(New MemoryStream(b)) - FromBinaryReader(br) - NHidden = br.ReadBoolean() - End Sub - - Public Sub New(_note As Note, xNHidden As Boolean) - note = _note - NHidden = xNHidden - End Sub - - Public Overrides Function ofType() As Byte - Return opHiddenNoteModify - End Function - End Class - - - - Public Class RelabelNote : Inherits LinkedURNoteCmd - '1 + 25 + 4 + 1 = 31 - - Public NValue As Long = 10000 - - Public Overrides Function toBytes() As Byte() - Dim ms = New MemoryStream() - Dim bw = New BinaryWriter(ms) - WriteBinWriter(bw) - bw.Write(NValue) - - Return ms.GetBuffer() - End Function - - Public Sub New(b() As Byte) - Dim br = New BinaryReader(New MemoryStream(b)) - FromBinaryReader(br) - NValue = br.ReadInt64 - End Sub - - Public Sub New(_note As Note, xNValue As Long) - note = _note - NValue = xNValue - End Sub - - Public Overrides Function ofType() As Byte - Return opRelabelNote - End Function - End Class - - - - Public Class RemoveAllNotes : Inherits LinkedURCmd - '1 = 1 - Public Overrides Function toBytes() As Byte() - toBytes = New Byte() {opRemoveAllNotes} - End Function - - Public Sub New(b() As Byte) - End Sub - - Public Sub New() - End Sub - - Public Overrides Function ofType() As Byte - Return opRemoveAllNotes - End Function - End Class - - - - Public Class ChangeMeasureLength : Inherits LinkedURCmd - '1 + 8 + 4 + 4 * Indices.Length = 13 + 4 * Indices.Length - Public Value As Double = 192 - Public Indices() As Integer = {} - - Public Overrides Function toBytes() As Byte() - Dim xVal() As Byte = BitConverter.GetBytes(Value) - Dim xUbound() As Byte = BitConverter.GetBytes(UBound(Indices)) - Dim xToBytes() As Byte = {opChangeMeasureLength, - xVal(0), xVal(1), xVal(2), xVal(3), xVal(4), xVal(5), xVal(6), xVal(7), - xUbound(0), xUbound(1), xUbound(2), xUbound(3)} - ReDim Preserve xToBytes(12 + (4 * Indices.Length)) - For xI1 As Integer = 13 To UBound(xToBytes) Step 4 - Dim xId() As Byte = BitConverter.GetBytes(Indices((xI1 - 13) \ 4)) - xToBytes(xI1 + 0) = xId(0) - xToBytes(xI1 + 1) = xId(1) - xToBytes(xI1 + 2) = xId(2) - xToBytes(xI1 + 3) = xId(3) - Next - Return xToBytes - End Function - - Public Sub New(b() As Byte) - Value = BitConverter.ToDouble(b, 1) - Dim xUbound As Integer = BitConverter.ToInt32(b, 9) - ReDim Preserve Indices(xUbound) - For xI1 As Integer = 13 To xUbound Step 4 - Indices((xI1 - 13) \ 4) = BitConverter.ToInt32(b, xI1) - Next - End Sub - - Public Sub New(xValue As Double, xIndices() As Integer) - Value = xValue - Indices = xIndices - End Sub - - Public Overrides Function ofType() As Byte - Return opChangeMeasureLength - End Function - End Class - - - - Public Class ChangeTimeSelection : Inherits LinkedURCmd - '1 + 8 + 8 + 8 + 1 = 26 - Public SelStart As Double = 0 - Public SelLength As Double = 0 - Public SelHalf As Double = 0 - Public Selected As Boolean = False - - Public Overrides Function toBytes() As Byte() - Dim xSta() As Byte = BitConverter.GetBytes(SelStart) - Dim xLen() As Byte = BitConverter.GetBytes(SelLength) - Dim xHalf() As Byte = BitConverter.GetBytes(SelLength) - toBytes = New Byte() {opChangeTimeSelection, - xSta(0), xSta(1), xSta(2), xSta(3), xSta(4), xSta(5), xSta(6), xSta(7), - xLen(0), xLen(1), xLen(2), xLen(3), xLen(4), xLen(5), xLen(6), xLen(7), - xHalf(0), xHalf(1), xHalf(2), xHalf(3), xHalf(4), xHalf(5), xHalf(6), xHalf(7), - IIf(Selected, trueByte, falseByte)} - End Function - - Public Sub New(b() As Byte) - SelStart = BitConverter.ToDouble(b, 1) - SelLength = BitConverter.ToDouble(b, 9) - SelHalf = BitConverter.ToDouble(b, 17) - Selected = CBool(b(25)) - End Sub - - Public Sub New(xSelStart As Double, xSelLength As Double, xSelHalf As Double, xSelected As Boolean) - SelStart = xSelStart - SelLength = xSelLength - SelHalf = xSelHalf - Selected = xSelected - End Sub - - Public Overrides Function ofType() As Byte - Return opChangeTimeSelection - End Function - End Class - - - - Public Class NT : Inherits LinkedURCmd - '1 + 1 + 1 = 3 - Public BecomeNT As Boolean = False - Public AutoConvert As Boolean = False - - Public Overrides Function toBytes() As Byte() - toBytes = New Byte() {opNT, - IIf(BecomeNT, trueByte, falseByte), - IIf(AutoConvert, trueByte, falseByte)} - End Function - - Public Sub New(b() As Byte) - BecomeNT = CBool(b(1)) - AutoConvert = CBool(b(2)) - End Sub - - Public Sub New(xBecomeNT As Boolean, xAutoConvert As Boolean) - BecomeNT = xBecomeNT - AutoConvert = xAutoConvert - End Sub - - Public Overrides Function ofType() As Byte - Return opNT - End Function - End Class - - Public Class WavAutoincFlag : Inherits LinkedURCmd - Public Checked As Boolean = False - - Public Sub New(_checked As Boolean) - Checked = _checked - End Sub - Public Overrides Function toBytes() As Byte() - toBytes = New Byte() {opWavAutoincFlag, - IIf(Checked, trueByte, falseByte)} - End Function - - Public Sub New(b() As Byte) - Checked = CBool(b(1)) - End Sub - - Public Overrides Function ofType() As Byte - Return opWavAutoincFlag - End Function - - End Class - - - - - Public Class NoOperation : Inherits LinkedURCmd - '1 = 1 - Public Overrides Function toBytes() As Byte() - toBytes = New Byte() {opNoOperation} - End Function - - Public Sub New() - End Sub - - Public Sub New(b() As Byte) - End Sub - - Public Overrides Function ofType() As Byte - Return opNoOperation - End Function - End Class + Public Overrides Function ofType() As Byte + Return opLongNoteModify + End Function + End Class + + + + Public Class HiddenNoteModify : Inherits LinkedURNoteCmd + Public NHidden As Boolean = False + + Public Overrides Function toBytes() As Byte() + Dim MS = New MemoryStream() + Dim bw = New BinaryWriter(MS) + WriteBinWriter(bw) + bw.Write(NHidden) + Return MS.GetBuffer() + End Function + + Public Sub New(b() As Byte) + Dim br = New BinaryReader(New MemoryStream(b)) + FromBinaryReader(br) + NHidden = br.ReadBoolean() + End Sub + + Public Sub New(_note As Note, xNHidden As Boolean) + note = _note + NHidden = xNHidden + End Sub + + Public Overrides Function ofType() As Byte + Return opHiddenNoteModify + End Function + End Class + + + + Public Class RelabelNote : Inherits LinkedURNoteCmd + '1 + 25 + 4 + 1 = 31 + + Public NValue As Long = 10000 + + Public Overrides Function toBytes() As Byte() + Dim ms = New MemoryStream() + Dim bw = New BinaryWriter(ms) + WriteBinWriter(bw) + bw.Write(NValue) + + Return ms.GetBuffer() + End Function + + Public Sub New(b() As Byte) + Dim br = New BinaryReader(New MemoryStream(b)) + FromBinaryReader(br) + NValue = br.ReadInt64 + End Sub + + Public Sub New(_note As Note, xNValue As Long) + note = _note + NValue = xNValue + End Sub + + Public Overrides Function ofType() As Byte + Return opRelabelNote + End Function + End Class + + + + Public Class RemoveAllNotes : Inherits LinkedURCmd + '1 = 1 + Public Overrides Function toBytes() As Byte() + toBytes = New Byte() {opRemoveAllNotes} + End Function + + Public Sub New(b() As Byte) + End Sub + + Public Sub New() + End Sub + + Public Overrides Function ofType() As Byte + Return opRemoveAllNotes + End Function + End Class + + + + Public Class ChangeMeasureLength : Inherits LinkedURCmd + '1 + 8 + 4 + 4 * Indices.Length = 13 + 4 * Indices.Length + Public Value As Double = 192 + Public Indices() As Integer = {} + + Public Overrides Function toBytes() As Byte() + Dim xVal() As Byte = BitConverter.GetBytes(Value) + Dim xUbound() As Byte = BitConverter.GetBytes(UBound(Indices)) + Dim xToBytes() As Byte = {opChangeMeasureLength, + xVal(0), xVal(1), xVal(2), xVal(3), xVal(4), xVal(5), xVal(6), xVal(7), + xUbound(0), xUbound(1), xUbound(2), xUbound(3)} + ReDim Preserve xToBytes(12 + (4 * Indices.Length)) + For xI1 As Integer = 13 To UBound(xToBytes) Step 4 + Dim xId() As Byte = BitConverter.GetBytes(Indices((xI1 - 13) \ 4)) + xToBytes(xI1 + 0) = xId(0) + xToBytes(xI1 + 1) = xId(1) + xToBytes(xI1 + 2) = xId(2) + xToBytes(xI1 + 3) = xId(3) + Next + Return xToBytes + End Function + + Public Sub New(b() As Byte) + Value = BitConverter.ToDouble(b, 1) + Dim xUbound As Integer = BitConverter.ToInt32(b, 9) + ReDim Preserve Indices(xUbound) + For xI1 As Integer = 13 To xUbound Step 4 + Indices((xI1 - 13) \ 4) = BitConverter.ToInt32(b, xI1) + Next + End Sub + + Public Sub New(xValue As Double, xIndices() As Integer) + Value = xValue + Indices = xIndices + End Sub + + Public Overrides Function ofType() As Byte + Return opChangeMeasureLength + End Function + End Class + + + + Public Class ChangeTimeSelection : Inherits LinkedURCmd + '1 + 8 + 8 + 8 + 1 = 26 + Public SelStart As Double = 0 + Public SelLength As Double = 0 + Public SelHalf As Double = 0 + Public Selected As Boolean = False + + Public Overrides Function toBytes() As Byte() + Dim xSta() As Byte = BitConverter.GetBytes(SelStart) + Dim xLen() As Byte = BitConverter.GetBytes(SelLength) + Dim xHalf() As Byte = BitConverter.GetBytes(SelLength) + toBytes = New Byte() {opChangeTimeSelection, + xSta(0), xSta(1), xSta(2), xSta(3), xSta(4), xSta(5), xSta(6), xSta(7), + xLen(0), xLen(1), xLen(2), xLen(3), xLen(4), xLen(5), xLen(6), xLen(7), + xHalf(0), xHalf(1), xHalf(2), xHalf(3), xHalf(4), xHalf(5), xHalf(6), xHalf(7), + IIf(Selected, trueByte, falseByte)} + End Function + + Public Sub New(b() As Byte) + SelStart = BitConverter.ToDouble(b, 1) + SelLength = BitConverter.ToDouble(b, 9) + SelHalf = BitConverter.ToDouble(b, 17) + Selected = CBool(b(25)) + End Sub + + Public Sub New(xSelStart As Double, xSelLength As Double, xSelHalf As Double, xSelected As Boolean) + SelStart = xSelStart + SelLength = xSelLength + SelHalf = xSelHalf + Selected = xSelected + End Sub + + Public Overrides Function ofType() As Byte + Return opChangeTimeSelection + End Function + End Class + + + + Public Class NT : Inherits LinkedURCmd + '1 + 1 + 1 = 3 + Public BecomeNT As Boolean = False + Public AutoConvert As Boolean = False + + Public Overrides Function toBytes() As Byte() + toBytes = New Byte() {opNT, + IIf(BecomeNT, trueByte, falseByte), + IIf(AutoConvert, trueByte, falseByte)} + End Function + + Public Sub New(b() As Byte) + BecomeNT = CBool(b(1)) + AutoConvert = CBool(b(2)) + End Sub + + Public Sub New(xBecomeNT As Boolean, xAutoConvert As Boolean) + BecomeNT = xBecomeNT + AutoConvert = xAutoConvert + End Sub + + Public Overrides Function ofType() As Byte + Return opNT + End Function + End Class + + Public Class WavAutoincFlag : Inherits LinkedURCmd + Public Checked As Boolean = False + + Public Sub New(_checked As Boolean) + Checked = _checked + End Sub + Public Overrides Function toBytes() As Byte() + toBytes = New Byte() {opWavAutoincFlag, + IIf(Checked, trueByte, falseByte)} + End Function + + Public Sub New(b() As Byte) + Checked = CBool(b(1)) + End Sub + + Public Overrides Function ofType() As Byte + Return opWavAutoincFlag + End Function + + End Class + + + + + Public Class NoOperation : Inherits LinkedURCmd + '1 = 1 + Public Overrides Function toBytes() As Byte() + toBytes = New Byte() {opNoOperation} + End Function + + Public Sub New() + End Sub + + Public Sub New(b() As Byte) + End Sub + + Public Overrides Function ofType() As Byte + Return opNoOperation + End Function + End Class End Class diff --git a/iBMSC/Utilities.vb b/iBMSC/Utilities.vb index 8b91cc333..7fa3f1543 100644 --- a/iBMSC/Utilities.vb +++ b/iBMSC/Utilities.vb @@ -1,234 +1,234 @@ Imports System.Text.RegularExpressions Namespace Editor - Public Module Functions - Public Function WriteDecimalWithDot(v As Double) As String - Static nfi As New Globalization.NumberFormatInfo With { - .NumberDecimalSeparator = "." - } - Return v.ToString(nfi) - End Function - - Public Function Add3Zeros(xNum As Integer) As String - Dim xStr1 As String = "000" & xNum - Return Mid(xStr1, Len(xStr1) - 2) - End Function - - Public Function Add2Zeros(xNum As Integer) As String - Dim xStr1 As String = "00" & xNum - Return Mid(xStr1, Len(xStr1) - 1) - End Function - - Public Function C10to36S(xStart As Integer) As Char - If xStart < 10 Then Return CStr(xStart) Else Return Chr(xStart + 55) - End Function - Public Function C36to10S(xChar As Char) As Integer - Dim xAsc As Integer = Asc(UCase(xChar)) - If xAsc >= 48 And xAsc <= 57 Then - Return xAsc - 48 - ElseIf xAsc >= 65 And xAsc <= 90 Then - Return xAsc - 55 - End If - Return 0 - End Function - Public Function C10to36(xStart As Long) As String - If xStart < 0 Then xStart = 0 - If xStart > 1295 Then xStart = 1295 - Return C10to36S(xStart \ 36) & C10to36S(xStart Mod 36) - End Function - Public Function C36to10(xStart As String) As Integer - xStart = Mid("00" & xStart, Len(xStart) + 1) - Return (C36to10S(xStart.Chars(0)) * 36) + C36to10S(xStart.Chars(1)) - End Function - - Public Function EncodingToString(TextEncoding As Text.Encoding) As String - Select Case TextEncoding.WebName - Case "utf-7" : Return "UTF7" - Case "utf-8" : Return "UTF8" - Case "utf-16" : Return "Little Endian UTF16" - Case "utf-16BE" : Return "Big Endian UTF16" - Case "utf-32" : Return "Little Endian UTF32" - Case "us-ascii" : Return "ASCII" - Case "shift_jis" : Return "SJIS" - Case "euc-kr" : Return "EUC-KR" - Case Else - If TextEncoding Is Text.Encoding.Default Then - Return "System Ansi" - Else - Return "ANSI (" & TextEncoding.EncodingName & ")" - End If - End Select - End Function - - ''' - ''' Adjust the brightness of a color. - ''' - ''' Original Color. - ''' (-100 to 100) Brightness. - ''' (0 - 1) Transparency. - Public Function AdjustBrightness(cStart As Color, iPercent As Single, iTransparency As Single) As Color - Return If(cStart.A = 0, - Color.FromArgb(0), - Color.FromArgb( - cStart.A * iTransparency, - (cStart.R * (100 - Math.Abs(iPercent)) * 0.01) + (Math.Abs(CInt(iPercent >= 0) * iPercent) * 2.55), - (cStart.G * (100 - Math.Abs(iPercent)) * 0.01) + (Math.Abs(CInt(iPercent >= 0) * iPercent) * 2.55), - (cStart.B * (100 - Math.Abs(iPercent)) * 0.01) + (Math.Abs(CInt(iPercent >= 0) * iPercent) * 2.55))) - End Function - - Public Function IdentifiertoLongNote(I As String) As Boolean - Dim xI As Integer = Val(I) - Return xI >= 50 And xI < 90 - End Function - - Public Function IdentifiertoHidden(I As String) As Boolean - Dim xI As Integer = Val(I) - Return (xI >= 30 And xI < 50) Or (xI >= 70 And xI < 90) - End Function - - Public Function RandomFileName(extWithDot As String) As String - Do - Randomize() - RandomFileName = Now.Ticks & Mid(Rnd(), 3) & extWithDot - Loop While File.Exists(RandomFileName) Or Directory.Exists(RandomFileName) - End Function - - ''' Hue (0-359) - ''' Saturation (0-1000) - ''' Lightness (0-1000) - ''' Alpha (0-255) - Public Function HSL2RGB(xH As Integer, xS As Integer, xL As Integer, Optional xA As Integer = 255) As Color - If xH > 360 Or xS > 1000 Or xL > 1000 Or xA > 255 Then Return Color.Black - - 'Dim xxH As Double = xH - Dim xxS As Double = xS / 1000 - Dim xxB As Double = (xL - 500) / 500 - Dim xR As Double - Dim xG As Double - Dim xB As Double - - If xH < 60 Then - xB = -1 : xR = 1 : xG = (xH - 30) / 30 - ElseIf xH < 120 Then - xB = -1 : xG = 1 : xR = (90 - xH) / 30 - ElseIf xH < 180 Then - xR = -1 : xG = 1 : xB = (xH - 150) / 30 - ElseIf xH < 240 Then - xR = -1 : xB = 1 : xG = (210 - xH) / 30 - ElseIf xH < 300 Then - xG = -1 : xB = 1 : xR = (xH - 270) / 30 - Else - xG = -1 : xR = 1 : xB = (330 - xH) / 30 - End If - - xR = ((xR * xxS * (1 - Math.Abs(xxB))) + xxB + 1) * 255 / 2 - xG = ((xG * xxS * (1 - Math.Abs(xxB))) + xxB + 1) * 255 / 2 - xB = ((xB * xxS * (1 - Math.Abs(xxB))) + xxB + 1) * 255 / 2 - - Return Color.FromArgb(xA, xR, xG, xB) - End Function - - Public Function FontToString(xFont As Font) As String - Return xFont.FontFamily.Name & "," & xFont.Size & "," & CInt(xFont.Style) - End Function - - Public Function isFontInstalled(f As String) As Boolean - Dim xFontCollection As New Text.InstalledFontCollection - For Each ff As FontFamily In xFontCollection.Families - If f.Equals(ff.Name, StringComparison.CurrentCultureIgnoreCase) Then Return True - Next - Return False - End Function - - - Public Function StringToFont(xStr As String, xDefault As Font) As Font - Dim xLine() As String = Split(xStr, ",") - If UBound(xLine) = 2 Then - Dim xFontStyle As FontStyle = Val(xLine(2)) - Return New Font(xLine(0), Val(xLine(1)), xFontStyle, GraphicsUnit.Pixel) - Else - Return xDefault - End If - End Function - - Public Function ArrayToString(xInt() As Integer) As String - Dim xStr As String = String.Empty - For xI1 As Integer = 0 To UBound(xInt) - xStr &= xInt(xI1).ToString & IIf(xI1 = UBound(xInt), String.Empty, ",") - Next - Return xStr - End Function - - Public Function ArrayToString(xBool() As Boolean) As String - Dim xStr As String = String.Empty - For xI1 As Integer = 0 To UBound(xBool) - xStr &= CInt(xBool(xI1)).ToString & IIf(xI1 = UBound(xBool), String.Empty, ",") - Next - Return xStr - End Function - - Public Function ArrayToString(xColor() As Color) As String - Dim xStr As String = String.Empty - For xI1 As Integer = 0 To UBound(xColor) - xStr &= xColor(xI1).ToArgb.ToString & IIf(xI1 = UBound(xColor), String.Empty, ",") - Next - Return xStr - End Function - - Public Function StringToArrayInt(xStr As String) As Integer() - Dim xL() As String = Split(xStr, ",") - Dim xInt(UBound(xL)) As Integer - For xI1 As Integer = 0 To UBound(xInt) - xInt(xI1) = Val(xL(xI1)) - Next - Return xInt - End Function - - Public Function StringToArrayBool(xStr As String) As Boolean() - Dim xL() As String = Split(xStr, ",") - Dim xBool(UBound(xL)) As Boolean - - For xI1 As Integer = 0 To UBound(xBool) - Dim value As String = xL(xI1).Trim() - xBool(xI1) = (value = "True") Or (value = "1") - Next - - Return xBool - End Function - - - Public Function GetDenominator(a As Double, Optional maxDenom As Long = &H7FFFFFFF) As Long - Dim m00 As Long = 1 - Dim m01 As Long = 0 - Dim m10 As Long = 0 - Dim m11 As Long = 1 - Dim x As Double = a - Dim ai As Long = Int(x) - - Do While (m10 * ai) + m11 <= maxDenom - Dim t As Long - t = (m00 * ai) + m01 - m01 = m00 - m00 = t - t = (m10 * ai) + m11 - m11 = m10 - m10 = t - - If x = ai Then Exit Do - x = 1 / (x - ai) - - If x > &H7FFFFFFFFFFFFFFF Then Exit Do - ai = Int(x) - Loop - - Return m10 - End Function - - - Public Function IsBase36(str As String) As Boolean - Static re As New Regex("^[A-Za-z0-9]+$") - Return re.IsMatch(str) - End Function - - End Module + Public Module Functions + Public Function WriteDecimalWithDot(v As Double) As String + Static nfi As New Globalization.NumberFormatInfo With { + .NumberDecimalSeparator = "." + } + Return v.ToString(nfi) + End Function + + Public Function Add3Zeros(xNum As Integer) As String + Dim xStr1 As String = "000" & xNum + Return Mid(xStr1, Len(xStr1) - 2) + End Function + + Public Function Add2Zeros(xNum As Integer) As String + Dim xStr1 As String = "00" & xNum + Return Mid(xStr1, Len(xStr1) - 1) + End Function + + Public Function C10to36S(xStart As Integer) As Char + If xStart < 10 Then Return CStr(xStart) Else Return Chr(xStart + 55) + End Function + Public Function C36to10S(xChar As Char) As Integer + Dim xAsc As Integer = Asc(UCase(xChar)) + If xAsc >= 48 And xAsc <= 57 Then + Return xAsc - 48 + ElseIf xAsc >= 65 And xAsc <= 90 Then + Return xAsc - 55 + End If + Return 0 + End Function + Public Function C10to36(xStart As Long) As String + If xStart < 0 Then xStart = 0 + If xStart > 1295 Then xStart = 1295 + Return C10to36S(xStart \ 36) & C10to36S(xStart Mod 36) + End Function + Public Function C36to10(xStart As String) As Integer + xStart = Mid("00" & xStart, Len(xStart) + 1) + Return (C36to10S(xStart.Chars(0)) * 36) + C36to10S(xStart.Chars(1)) + End Function + + Public Function EncodingToString(TextEncoding As Text.Encoding) As String + Select Case TextEncoding.WebName + Case "utf-7" : Return "UTF7" + Case "utf-8" : Return "UTF8" + Case "utf-16" : Return "Little Endian UTF16" + Case "utf-16BE" : Return "Big Endian UTF16" + Case "utf-32" : Return "Little Endian UTF32" + Case "us-ascii" : Return "ASCII" + Case "shift_jis" : Return "SJIS" + Case "euc-kr" : Return "EUC-KR" + Case Else + If TextEncoding Is Text.Encoding.Default Then + Return "System Ansi" + Else + Return "ANSI (" & TextEncoding.EncodingName & ")" + End If + End Select + End Function + + ''' + ''' Adjust the brightness of a color. + ''' + ''' Original Color. + ''' (-100 to 100) Brightness. + ''' (0 - 1) Transparency. + Public Function AdjustBrightness(cStart As Color, iPercent As Single, iTransparency As Single) As Color + Return If(cStart.A = 0, + Color.FromArgb(0), + Color.FromArgb( + cStart.A * iTransparency, + (cStart.R * (100 - Math.Abs(iPercent)) * 0.01) + (Math.Abs(CInt(iPercent >= 0) * iPercent) * 2.55), + (cStart.G * (100 - Math.Abs(iPercent)) * 0.01) + (Math.Abs(CInt(iPercent >= 0) * iPercent) * 2.55), + (cStart.B * (100 - Math.Abs(iPercent)) * 0.01) + (Math.Abs(CInt(iPercent >= 0) * iPercent) * 2.55))) + End Function + + Public Function IdentifiertoLongNote(I As String) As Boolean + Dim xI As Integer = Val(I) + Return xI >= 50 And xI < 90 + End Function + + Public Function IdentifiertoHidden(I As String) As Boolean + Dim xI As Integer = Val(I) + Return (xI >= 30 And xI < 50) Or (xI >= 70 And xI < 90) + End Function + + Public Function RandomFileName(extWithDot As String) As String + Do + Randomize() + RandomFileName = Now.Ticks & Mid(Rnd(), 3) & extWithDot + Loop While File.Exists(RandomFileName) Or Directory.Exists(RandomFileName) + End Function + + ''' Hue (0-359) + ''' Saturation (0-1000) + ''' Lightness (0-1000) + ''' Alpha (0-255) + Public Function HSL2RGB(xH As Integer, xS As Integer, xL As Integer, Optional xA As Integer = 255) As Color + If xH > 360 Or xS > 1000 Or xL > 1000 Or xA > 255 Then Return Color.Black + + 'Dim xxH As Double = xH + Dim xxS As Double = xS / 1000 + Dim xxB As Double = (xL - 500) / 500 + Dim xR As Double + Dim xG As Double + Dim xB As Double + + If xH < 60 Then + xB = -1 : xR = 1 : xG = (xH - 30) / 30 + ElseIf xH < 120 Then + xB = -1 : xG = 1 : xR = (90 - xH) / 30 + ElseIf xH < 180 Then + xR = -1 : xG = 1 : xB = (xH - 150) / 30 + ElseIf xH < 240 Then + xR = -1 : xB = 1 : xG = (210 - xH) / 30 + ElseIf xH < 300 Then + xG = -1 : xB = 1 : xR = (xH - 270) / 30 + Else + xG = -1 : xR = 1 : xB = (330 - xH) / 30 + End If + + xR = ((xR * xxS * (1 - Math.Abs(xxB))) + xxB + 1) * 255 / 2 + xG = ((xG * xxS * (1 - Math.Abs(xxB))) + xxB + 1) * 255 / 2 + xB = ((xB * xxS * (1 - Math.Abs(xxB))) + xxB + 1) * 255 / 2 + + Return Color.FromArgb(xA, xR, xG, xB) + End Function + + Public Function FontToString(xFont As Font) As String + Return xFont.FontFamily.Name & "," & xFont.Size & "," & CInt(xFont.Style) + End Function + + Public Function isFontInstalled(f As String) As Boolean + Dim xFontCollection As New Text.InstalledFontCollection + For Each ff As FontFamily In xFontCollection.Families + If f.Equals(ff.Name, StringComparison.CurrentCultureIgnoreCase) Then Return True + Next + Return False + End Function + + + Public Function StringToFont(xStr As String, xDefault As Font) As Font + Dim xLine() As String = Split(xStr, ",") + If UBound(xLine) = 2 Then + Dim xFontStyle As FontStyle = Val(xLine(2)) + Return New Font(xLine(0), Val(xLine(1)), xFontStyle, GraphicsUnit.Pixel) + Else + Return xDefault + End If + End Function + + Public Function ArrayToString(xInt() As Integer) As String + Dim xStr As String = String.Empty + For xI1 As Integer = 0 To UBound(xInt) + xStr &= xInt(xI1).ToString & IIf(xI1 = UBound(xInt), String.Empty, ",") + Next + Return xStr + End Function + + Public Function ArrayToString(xBool() As Boolean) As String + Dim xStr As String = String.Empty + For xI1 As Integer = 0 To UBound(xBool) + xStr &= CInt(xBool(xI1)).ToString & IIf(xI1 = UBound(xBool), String.Empty, ",") + Next + Return xStr + End Function + + Public Function ArrayToString(xColor() As Color) As String + Dim xStr As String = String.Empty + For xI1 As Integer = 0 To UBound(xColor) + xStr &= xColor(xI1).ToArgb.ToString & IIf(xI1 = UBound(xColor), String.Empty, ",") + Next + Return xStr + End Function + + Public Function StringToArrayInt(xStr As String) As Integer() + Dim xL() As String = Split(xStr, ",") + Dim xInt(UBound(xL)) As Integer + For xI1 As Integer = 0 To UBound(xInt) + xInt(xI1) = Val(xL(xI1)) + Next + Return xInt + End Function + + Public Function StringToArrayBool(xStr As String) As Boolean() + Dim xL() As String = Split(xStr, ",") + Dim xBool(UBound(xL)) As Boolean + + For xI1 As Integer = 0 To UBound(xBool) + Dim value As String = xL(xI1).Trim() + xBool(xI1) = (value = "True") Or (value = "1") + Next + + Return xBool + End Function + + + Public Function GetDenominator(a As Double, Optional maxDenom As Long = &H7FFFFFFF) As Long + Dim m00 As Long = 1 + Dim m01 As Long = 0 + Dim m10 As Long = 0 + Dim m11 As Long = 1 + Dim x As Double = a + Dim ai As Long = Int(x) + + Do While (m10 * ai) + m11 <= maxDenom + Dim t As Long + t = (m00 * ai) + m01 + m01 = m00 + m00 = t + t = (m10 * ai) + m11 + m11 = m10 + m10 = t + + If x = ai Then Exit Do + x = 1 / (x - ai) + + If x > &H7FFFFFFFFFFFFFFF Then Exit Do + ai = Int(x) + Loop + + Return m10 + End Function + + + Public Function IsBase36(str As String) As Boolean + Static re As New Regex("^[A-Za-z0-9]+$") + Return re.IsMatch(str) + End Function + + End Module End Namespace diff --git a/iBMSC/VisualSettings.vb b/iBMSC/VisualSettings.vb index 2d1c22360..456017253 100644 --- a/iBMSC/VisualSettings.vb +++ b/iBMSC/VisualSettings.vb @@ -1,67 +1,67 @@ Namespace Editor - Public Class visualSettings - Public ColumnTitle As SolidBrush - Public ColumnTitleFont As Font - Public Bg As SolidBrush - Public pGrid As Pen - Public pSub As Pen - Public pVLine As Pen - Public pMLine As Pen - Public pBGMWav As Pen + Public Class visualSettings + Public ColumnTitle As SolidBrush + Public ColumnTitleFont As Font + Public Bg As SolidBrush + Public pGrid As Pen + Public pSub As Pen + Public pVLine As Pen + Public pMLine As Pen + Public pBGMWav As Pen - Public SelBox As Pen - Public PECursor As Pen - Public PEHalf As Pen - Public PEDeltaMouseOver As Integer - Public PEMouseOver As Pen - Public PESel As SolidBrush - Public PEBPM As SolidBrush - Public PEBPMFont As Font - Public MiddleDeltaRelease As Integer + Public SelBox As Pen + Public PECursor As Pen + Public PEHalf As Pen + Public PEDeltaMouseOver As Integer + Public PEMouseOver As Pen + Public PESel As SolidBrush + Public PEBPM As SolidBrush + Public PEBPMFont As Font + Public MiddleDeltaRelease As Integer - Public kHeight As Integer - Public kFont As Font - Public kMFont As Font - Public kLabelVShift As Integer - Public kLabelHShift As Integer - Public kLabelHShiftL As Integer - Public kMouseOver As Pen - Public kMouseOverE As Pen - Public kSelected As Pen - Public kOpacity As Single + Public kHeight As Integer + Public kFont As Font + Public kMFont As Font + Public kLabelVShift As Integer + Public kLabelHShift As Integer + Public kLabelHShiftL As Integer + Public kMouseOver As Pen + Public kMouseOverE As Pen + Public kSelected As Pen + Public kOpacity As Single - Public Sub New() - Me.New(New SolidBrush(Color.Lime), - New Font("Tahoma", 11, FontStyle.Regular, GraphicsUnit.Pixel), - New SolidBrush(Color.Black), - New Pen(Color.FromArgb(893008442)), - New Pen(Color.FromArgb(1530542650)), - New Pen(Color.FromArgb(-13158601)), - New Pen(Color.FromArgb(1599230546)), - New Pen(Color.FromArgb(851493056)), - New Pen(Color.FromArgb(-1056964609)), - New Pen(Color.FromArgb(&HC0FF8080)), - New Pen(Color.FromArgb(&H808080FF)), - 5, - New Pen(Color.FromArgb(&H80FF8080)), - New SolidBrush(Color.FromArgb(855605376)), - New SolidBrush(Color.FromArgb(855605376)), - New Font("Verdana", 12, FontStyle.Bold, GraphicsUnit.Pixel), - 10, - 10, - New Font("Verdana", 12, FontStyle.Bold, GraphicsUnit.Pixel), - New Font("Verdana", 12, FontStyle.Regular, GraphicsUnit.Pixel), - -2, - 0, - 2, - New Pen(Color.Lime), - New Pen(Color.FromArgb(-16711681)), - New Pen(Color.Red), - 0.5) - End Sub + Public Sub New() + Me.New(New SolidBrush(Color.Lime), + New Font("Tahoma", 11, FontStyle.Regular, GraphicsUnit.Pixel), + New SolidBrush(Color.Black), + New Pen(Color.FromArgb(893008442)), + New Pen(Color.FromArgb(1530542650)), + New Pen(Color.FromArgb(-13158601)), + New Pen(Color.FromArgb(1599230546)), + New Pen(Color.FromArgb(851493056)), + New Pen(Color.FromArgb(-1056964609)), + New Pen(Color.FromArgb(&HC0FF8080)), + New Pen(Color.FromArgb(&H808080FF)), + 5, + New Pen(Color.FromArgb(&H80FF8080)), + New SolidBrush(Color.FromArgb(855605376)), + New SolidBrush(Color.FromArgb(855605376)), + New Font("Verdana", 12, FontStyle.Bold, GraphicsUnit.Pixel), + 10, + 10, + New Font("Verdana", 12, FontStyle.Bold, GraphicsUnit.Pixel), + New Font("Verdana", 12, FontStyle.Regular, GraphicsUnit.Pixel), + -2, + 0, + 2, + New Pen(Color.Lime), + New Pen(Color.FromArgb(-16711681)), + New Pen(Color.Red), + 0.5) + End Sub - Public Sub New( + Public Sub New( voTitle As SolidBrush, voTitleFont As Font, voBg As SolidBrush, @@ -70,8 +70,8 @@ voSub As Pen, voVLine As Pen, voMLine As Pen, voBGMWav As Pen, _ - _ - voSelBox As Pen, + _ + voSelBox As Pen, voPECursor As Pen, voPEHalf As Pen, voPEDeltaMouseOver As Integer, @@ -80,8 +80,8 @@ voPESel As SolidBrush, voPEBPM As SolidBrush, voPEBPMFont As Font, xMiddleDeltaRelease As Integer, _ - _ - vKHeight As Integer, + _ + vKHeight As Integer, vKFont As Font, vKMFont As Font, vKLabelVShift As Integer, @@ -92,36 +92,36 @@ vKMouseOverE As Pen, vKSelected As Pen, vKOpacity As Single) - ColumnTitle = voTitle - ColumnTitleFont = voTitleFont - Bg = voBg - pGrid = voGrid - pSub = voSub - pVLine = voVLine - pMLine = voMLine - pBGMWav = voBGMWav + ColumnTitle = voTitle + ColumnTitleFont = voTitleFont + Bg = voBg + pGrid = voGrid + pSub = voSub + pVLine = voVLine + pMLine = voMLine + pBGMWav = voBGMWav - SelBox = voSelBox - PECursor = voPECursor - PEHalf = voPEHalf - PEDeltaMouseOver = voPEDeltaMouseOver - PEMouseOver = voPEMouseOver - PESel = voPESel - PEBPM = voPEBPM - PEBPMFont = voPEBPMFont - MiddleDeltaRelease = xMiddleDeltaRelease + SelBox = voSelBox + PECursor = voPECursor + PEHalf = voPEHalf + PEDeltaMouseOver = voPEDeltaMouseOver + PEMouseOver = voPEMouseOver + PESel = voPESel + PEBPM = voPEBPM + PEBPMFont = voPEBPMFont + MiddleDeltaRelease = xMiddleDeltaRelease - kHeight = vKHeight - kFont = vKFont - kMFont = vKMFont - kLabelVShift = vKLabelVShift - kLabelHShift = vKLabelHShift - kLabelHShiftL = vKLabelHShiftL - kMouseOver = vKMouseOver - kMouseOverE = vKMouseOverE - kSelected = vKSelected - kOpacity = vKOpacity - End Sub - End Class + kHeight = vKHeight + kFont = vKFont + kMFont = vKMFont + kLabelVShift = vKLabelVShift + kLabelHShift = vKLabelHShift + kLabelHShiftL = vKLabelHShiftL + kMouseOver = vKMouseOver + kMouseOverE = vKMouseOverE + kSelected = vKSelected + kOpacity = vKOpacity + End Sub + End Class End Namespace diff --git a/iBMSC/Waveform.vb b/iBMSC/Waveform.vb index 0e136f881..20a808152 100644 --- a/iBMSC/Waveform.vb +++ b/iBMSC/Waveform.vb @@ -4,64 +4,64 @@ Imports CSCore.Codecs Partial Public Class MainWindow - '----WaveForm Options - Private wWavL() As Single - Private wWavR() As Single - Private wLock As Boolean = True - Private wSampleRate As Integer - Private wPosition As Double = 0 - Private wLeft As Integer = 50 - Private wWidth As Integer = 100 - Private wPrecision As Integer = 1 + '----WaveForm Options + Private wWavL() As Single + Private wWavR() As Single + Private wLock As Boolean = True + Private wSampleRate As Integer + Private wPosition As Double = 0 + Private wLeft As Integer = 50 + Private wWidth As Integer = 100 + Private wPrecision As Integer = 1 - Private Sub BWLoad_Click(sender As Object, e As EventArgs) Handles BWLoad.Click - Dim xDWAV As New OpenFileDialog With { - .Filter = "Wave files (*.wav, *.ogg)" & "|*.wav;*.ogg", - .DefaultExt = "wav", - .InitialDirectory = IIf(ExcludeFileName(FileName) = String.Empty, InitPath, ExcludeFileName(FileName)) - } + Private Sub BWLoad_Click(sender As Object, e As EventArgs) Handles BWLoad.Click + Dim xDWAV As New OpenFileDialog With { + .Filter = "Wave files (*.wav, *.ogg)" & "|*.wav;*.ogg", + .DefaultExt = "wav", + .InitialDirectory = IIf(ExcludeFileName(FileName) = String.Empty, InitPath, ExcludeFileName(FileName)) + } - If xDWAV.ShowDialog = Forms.DialogResult.Cancel Then Exit Sub - InitPath = ExcludeFileName(xDWAV.FileName) + If xDWAV.ShowDialog = Forms.DialogResult.Cancel Then Exit Sub + InitPath = ExcludeFileName(xDWAV.FileName) - Dim src = CodecFactory.Instance.GetCodec(xDWAV.FileName) + Dim src = CodecFactory.Instance.GetCodec(xDWAV.FileName) - Dim unused1 = src.ToStereo() - Dim samples(src.Length) As Single - Dim unused = src.ToSampleSource().Read(samples, 0, src.Length) + Dim unused1 = src.ToStereo() + Dim samples(src.Length) As Single + Dim unused = src.ToSampleSource().Read(samples, 0, src.Length) - Dim flen = (src.Length - 1) / src.WaveFormat.Channels + Dim flen = (src.Length - 1) / src.WaveFormat.Channels - ' Copy interleaved data - ReDim wWavL(flen + 1) - ReDim wWavR(flen + 1) - For i As Integer = 0 To flen - If 2 * i < src.Length Then - wWavL(i) = samples(2 * i) - End If - If (2 * i) + 1 < src.Length Then - wWavR(i) = samples((2 * i) + 1) - End If - Next + ' Copy interleaved data + ReDim wWavL(flen + 1) + ReDim wWavR(flen + 1) + For i As Integer = 0 To flen + If 2 * i < src.Length Then + wWavL(i) = samples(2 * i) + End If + If (2 * i) + 1 < src.Length Then + wWavR(i) = samples((2 * i) + 1) + End If + Next - wSampleRate = src.WaveFormat.SampleRate - RefreshPanelAll() + wSampleRate = src.WaveFormat.SampleRate + RefreshPanelAll() - TWFileName.Text = xDWAV.FileName - TWFileName.Select(Len(xDWAV.FileName), 0) - End Sub + TWFileName.Text = xDWAV.FileName + TWFileName.Select(Len(xDWAV.FileName), 0) + End Sub - Private Sub BWClear_Click(sender As Object, e As EventArgs) Handles BWClear.Click - Erase wWavL - Erase wWavR - TWFileName.Text = "(" & Strings.None & ")" - RefreshPanelAll() - End Sub + Private Sub BWClear_Click(sender As Object, e As EventArgs) Handles BWClear.Click + Erase wWavL + Erase wWavR + TWFileName.Text = "(" & Strings.None & ")" + RefreshPanelAll() + End Sub - Private Sub BWLock_CheckedChanged(sender As Object, e As EventArgs) Handles BWLock.CheckedChanged - wLock = BWLock.Checked - TWPosition.Enabled = Not wLock - TWPosition2.Enabled = Not wLock - RefreshPanelAll() - End Sub + Private Sub BWLock_CheckedChanged(sender As Object, e As EventArgs) Handles BWLock.CheckedChanged + wLock = BWLock.Checked + TWPosition.Enabled = Not wLock + TWPosition2.Enabled = Not wLock + RefreshPanelAll() + End Sub End Class diff --git a/iBMSC/XMLUtil.vb b/iBMSC/XMLUtil.vb index ac542ccc9..2c1824bf4 100644 --- a/iBMSC/XMLUtil.vb +++ b/iBMSC/XMLUtil.vb @@ -1,63 +1,61 @@ -Imports System.ComponentModel +Friend Module XMLUtil + Public Sub XMLWriteValue(w As XmlTextWriter, local As String, val As String) + w.WriteStartElement(local) + w.WriteAttributeString("Value", Editor.WriteDecimalWithDot(val)) + w.WriteEndElement() + End Sub -Friend Module XMLUtil - Public Sub XMLWriteValue(w As XmlTextWriter, local As String, val As String) - w.WriteStartElement(local) - w.WriteAttributeString("Value", Editor.WriteDecimalWithDot(val)) - w.WriteEndElement() - End Sub + Public Sub XMLLoadAttribute(s As String, ByRef v As String) + If s.Length = 0 Then Exit Sub + v = s + End Sub + Public Sub XMLLoadAttribute(s As String, ByRef v As Boolean) + If s.Length = 0 Then Exit Sub + v = CBool(s) + End Sub + Public Sub XMLLoadAttribute(s As String, ByRef v As Integer) + If s.Length = 0 Then Exit Sub + v = CInt(s) + End Sub + Public Sub XMLLoadAttribute(s As String, ByRef v As Single) + If s.Length = 0 Then Exit Sub - Public Sub XMLLoadAttribute(s As String, ByRef v As String) - If s.Length = 0 Then Exit Sub - v = s - End Sub - Public Sub XMLLoadAttribute(s As String, ByRef v As Boolean) - If s.Length = 0 Then Exit Sub - v = CBool(s) - End Sub - Public Sub XMLLoadAttribute(s As String, ByRef v As Integer) - If s.Length = 0 Then Exit Sub - v = CInt(s) - End Sub - Public Sub XMLLoadAttribute(s As String, ByRef v As Single) - If s.Length = 0 Then Exit Sub + Static nfi As New Globalization.NumberFormatInfo With { + .NumberDecimalSeparator = "." + } + v = Double.Parse(s, nfi) + End Sub + Public Sub XMLLoadAttribute(s As String, ByRef v As Double) + If s.Length = 0 Then Exit Sub - Static nfi As New Globalization.NumberFormatInfo With { - .NumberDecimalSeparator = "." - } - v = Double.Parse(s, nfi) - End Sub - Public Sub XMLLoadAttribute(s As String, ByRef v As Double) - If s.Length = 0 Then Exit Sub + Static nfi As New Globalization.NumberFormatInfo With { + .NumberDecimalSeparator = "." + } + v = Double.Parse(s, nfi) + End Sub + Public Sub XMLLoadAttribute(s As String, ByRef v As Long) + If s.Length = 0 Then Exit Sub + v = CLng(s) + End Sub + Public Sub XMLLoadAttribute(s As String, ByRef v As Decimal) + If s.Length = 0 Then Exit Sub + v = CDec(s) + End Sub + Public Sub XMLLoadAttribute(s As String, ByRef v As Color) + If s.Length = 0 Then Exit Sub + v = Color.FromArgb(s) + End Sub - Static nfi As New Globalization.NumberFormatInfo With { - .NumberDecimalSeparator = "." - } - v = Double.Parse(s, nfi) - End Sub - Public Sub XMLLoadAttribute(s As String, ByRef v As Long) - If s.Length = 0 Then Exit Sub - v = CLng(s) - End Sub - Public Sub XMLLoadAttribute(s As String, ByRef v As Decimal) - If s.Length = 0 Then Exit Sub - v = CDec(s) - End Sub - Public Sub XMLLoadAttribute(s As String, ByRef v As Color) - If s.Length = 0 Then Exit Sub - v = Color.FromArgb(s) - End Sub - - Public Sub XMLLoadElementValue(n As XmlElement, ByRef v As Integer) - If n Is Nothing Then Exit Sub - XMLLoadAttribute(n.GetAttribute("Value"), v) - End Sub - Public Sub XMLLoadElementValue(n As XmlElement, ByRef v As Single) - If n Is Nothing Then Exit Sub - XMLLoadAttribute(n.GetAttribute("Value"), v) - End Sub - Public Sub XMLLoadElementValue(n As XmlElement, ByRef v As Color) - If n Is Nothing Then Exit Sub - XMLLoadAttribute(n.GetAttribute("Value"), v) - End Sub + Public Sub XMLLoadElementValue(n As XmlElement, ByRef v As Integer) + If n Is Nothing Then Exit Sub + XMLLoadAttribute(n.GetAttribute("Value"), v) + End Sub + Public Sub XMLLoadElementValue(n As XmlElement, ByRef v As Single) + If n Is Nothing Then Exit Sub + XMLLoadAttribute(n.GetAttribute("Value"), v) + End Sub + Public Sub XMLLoadElementValue(n As XmlElement, ByRef v As Color) + If n Is Nothing Then Exit Sub + XMLLoadAttribute(n.GetAttribute("Value"), v) + End Sub End Module diff --git a/iBMSC/chartinfo.vb b/iBMSC/chartinfo.vb index 2fab87f6b..1565b0be1 100644 --- a/iBMSC/chartinfo.vb +++ b/iBMSC/chartinfo.vb @@ -1,16 +1,14 @@ -Imports System.Windows.Forms - -Public Class Chartinfo - - Private Sub OK_Button_Click(sender As Object, e As EventArgs) Handles gotost_Button.Click - Me.DialogResult = DialogResult.OK - MainWindow.TBStatistics_Click(sender, e) - Me.Close() - End Sub - - Private Sub Cancel_Button_Click(sender As Object, e As EventArgs) Handles Cancel_Button.Click - Me.DialogResult = DialogResult.Cancel - Me.Close() - End Sub +Public Class Chartinfo + + Private Sub OK_Button_Click(sender As Object, e As EventArgs) Handles gotost_Button.Click + Me.DialogResult = DialogResult.OK + MainWindow.TBStatistics_Click(sender, e) + Me.Close() + End Sub + + Private Sub Cancel_Button_Click(sender As Object, e As EventArgs) Handles Cancel_Button.Click + Me.DialogResult = DialogResult.Cancel + Me.Close() + End Sub End Class diff --git a/iBMSC/iBMSC.vbproj b/iBMSC/iBMSC.vbproj index 0b5bf8b38..b8b304fc9 100644 --- a/iBMSC/iBMSC.vbproj +++ b/iBMSC/iBMSC.vbproj @@ -1,6 +1,6 @@  - net8.0-windows + net9.0-windows WinExe iBMSC.My.MyApplication μBMSC @@ -193,12 +193,12 @@ - - - - - - + + + + + +