@@ -361,7 +361,12 @@ type |
| 361 |
LoadingFile: Boolean; |
361 |
LoadingFile: Boolean; |
| 362 |
SaveSucceeded: Boolean; |
362 |
SaveSucceeded: Boolean; |
| 363 |
|
363 |
|
| 364 |
{PatternsNode, }InstrumentsNode, WavesNode, RoutinesNode: TTreeNode; |
364 |
{PatternsNode, } |
|
|
365 |
WaveInstrumentsNode, |
|
|
366 |
NoiseInstrumentsNode, |
|
|
367 |
DutyInstrumentsNode, |
|
|
368 |
WavesNode, |
|
|
369 |
RoutinesNode: TTreeNode; |
| 365 |
|
370 |
|
| 366 |
OptionsFile: TIniFile; |
371 |
OptionsFile: TIniFile; |
| 367 |
|
372 |
|
@@ -370,7 +375,7 @@ type |
| 370 |
procedure ChangeToSquare; |
375 |
procedure ChangeToSquare; |
| 371 |
procedure ChangeToWave; |
376 |
procedure ChangeToWave; |
| 372 |
procedure ChangeToNoise; |
377 |
procedure ChangeToNoise; |
| 373 |
procedure LoadInstrument(Instr: Integer); |
378 |
procedure LoadInstrument(Bank: TInstrumentType; Instr: Integer); |
| 374 |
procedure LoadWave(Wave: Integer); |
379 |
procedure LoadWave(Wave: Integer); |
| 375 |
procedure LoadSong(Filename: String); |
380 |
procedure LoadSong(Filename: String); |
| 376 |
procedure ReloadPatterns; |
381 |
procedure ReloadPatterns; |
@@ -415,7 +420,7 @@ begin |
| 415 |
ResetEmulationThread; |
420 |
ResetEmulationThread; |
| 416 |
|
421 |
|
| 417 |
LoadingFile := True; // HACK!!!!! |
422 |
LoadingFile := True; // HACK!!!!! |
| 418 |
LoadInstrument(1); |
423 |
LoadInstrument(itSquare, 1); |
| 419 |
LoadWave(0); |
424 |
LoadWave(0); |
| 420 |
|
425 |
|
| 421 |
RoutineSynedit.Text := Song.Routines[0]; |
426 |
RoutineSynedit.Text := Song.Routines[0]; |
@@ -431,11 +436,21 @@ begin |
| 431 |
CopyOrderMatrixToOrderGrid; |
436 |
CopyOrderMatrixToOrderGrid; |
| 432 |
|
437 |
|
| 433 |
// PLACEHOLDER |
438 |
// PLACEHOLDER |
| 434 |
for I := Low(Song.Instruments.All) to High(song.Instruments.All) do |
439 |
while InstrumentComboBox.Items.Count > 1 do |
| 435 |
InstrumentComboBox.Items[I] := IntToStr(ModInst(I))+': '+Song.Instruments.All[ModInst(I)].Name; |
440 |
InstrumentComboBox.Items.Delete(1); |
| 436 |
|
441 |
|
| 437 |
for I := Low(Song.Instruments.All) to High(song.Instruments.All) do |
442 |
for I := Low(Song.Instruments.Duty) to High(song.Instruments.Duty) do |
| 438 |
InstrumentsNode.Items[I-1].Text := IntToStr(ModInst(I))+': '+Song.Instruments.All[ModInst(I)].Name; |
443 |
InstrumentComboBox.Items.Add('Square '+IntToStr(I)+': '+Song.Instruments.Duty[ModInst(I)].Name); |
|
|
444 |
for I := Low(Song.Instruments.Wave) to High(song.Instruments.Wave) do |
|
|
445 |
InstrumentComboBox.Items.Add('Wave '+IntToStr(I)+': '+Song.Instruments.Wave[ModInst(I)].Name); |
|
|
446 |
for I := Low(Song.Instruments.Noise) to High(song.Instruments.Noise) do |
|
|
447 |
InstrumentComboBox.Items.Add('Noise '+IntToStr(I)+': '+Song.Instruments.Noise[ModInst(I)].Name); |
|
|
448 |
|
|
|
449 |
for I := Low(TInstrumentBank) to High(TInstrumentBank) do begin |
|
|
450 |
DutyInstrumentsNode.Items[I-1].Text := IntToStr(I)+': '+Song.Instruments.Duty[I].Name; |
|
|
451 |
WaveInstrumentsNode.Items[I-1].Text := IntToStr(I)+': '+Song.Instruments.Wave[I].Name; |
|
|
452 |
NoiseInstrumentsNode.Items[I-1].Text := IntToStr(I)+': '+Song.Instruments.Noise[I].Name; |
|
|
453 |
end; |
| 439 |
|
454 |
|
| 440 |
LoadingFile := False; // HACK!!!! |
455 |
LoadingFile := False; // HACK!!!! |
| 441 |
|
456 |
|
@@ -786,17 +801,19 @@ begin |
| 786 |
TrackerGrid.PopupMenu := TrackerGridPopup; |
801 |
TrackerGrid.PopupMenu := TrackerGridPopup; |
| 787 |
end; |
802 |
end; |
| 788 |
|
803 |
|
| 789 |
procedure TfrmTracker.LoadInstrument(Instr: Integer); |
804 |
procedure TfrmTracker.LoadInstrument(Bank: TInstrumentType; Instr: Integer); |
| 790 |
var |
805 |
var |
| 791 |
CI: ^TInstrument; |
806 |
CI: ^TInstrument; |
| 792 |
begin |
807 |
begin |
| 793 |
case CurrentInstrumentBank of |
808 |
CurrentInstrumentBank := Bank; |
|
|
809 |
case Bank of |
| 794 |
itSquare: CurrentInstrument := @Song.Instruments.Duty[Instr]; |
810 |
itSquare: CurrentInstrument := @Song.Instruments.Duty[Instr]; |
| 795 |
itWave: CurrentInstrument := @Song.Instruments.Wave[Instr]; |
811 |
itWave: CurrentInstrument := @Song.Instruments.Wave[Instr]; |
| 796 |
itNoise: CurrentInstrument := @Song.Instruments.Noise[Instr]; |
812 |
itNoise: CurrentInstrument := @Song.Instruments.Noise[Instr]; |
| 797 |
end; |
813 |
end; |
| 798 |
CI := CurrentInstrument; |
814 |
CI := CurrentInstrument; |
| 799 |
|
815 |
|
|
|
816 |
InstrumentTypeComboBox.ItemIndex := Integer(CurrentInstrumentBank); |
| 800 |
InstrumentNumberSpinner.Value := Instr; |
817 |
InstrumentNumberSpinner.Value := Instr; |
| 801 |
InstrumentNameEdit.Text := CI^.Name; |
818 |
InstrumentNameEdit.Text := CI^.Name; |
| 802 |
LengthEnabledCheckbox.Checked := CI^.LengthEnabled; |
819 |
LengthEnabledCheckbox.Checked := CI^.LengthEnabled; |
@@ -960,7 +977,7 @@ begin |
| 960 |
1: CurrentInstrumentBank := itWave; |
977 |
1: CurrentInstrumentBank := itWave; |
| 961 |
2: CurrentInstrumentBank := itNoise; |
978 |
2: CurrentInstrumentBank := itNoise; |
| 962 |
end; |
979 |
end; |
| 963 |
LoadInstrument(InstrumentNumberSpinner.Value); |
980 |
LoadInstrument(CurrentInstrumentBank, InstrumentNumberSpinner.Value); |
| 964 |
end; |
981 |
end; |
| 965 |
|
982 |
|
| 966 |
procedure TfrmTracker.RandomizeNoiseButtonClick(Sender: TObject); |
983 |
procedure TfrmTracker.RandomizeNoiseButtonClick(Sender: TObject); |
@@ -1014,32 +1031,33 @@ begin |
| 1014 |
// Initialize ticks per row |
1031 |
// Initialize ticks per row |
| 1015 |
Song.TicksPerRow := TicksPerRowSpinEdit.Value; |
1032 |
Song.TicksPerRow := TicksPerRowSpinEdit.Value; |
| 1016 |
|
1033 |
|
| 1017 |
CurrentInstrumentBank := itSquare; |
1034 |
LoadInstrument(itSquare, 1); |
| 1018 |
LoadInstrument(1); |
|
|
| 1019 |
LoadWave(0); |
1035 |
LoadWave(0); |
| 1020 |
|
1036 |
|
| 1021 |
// Fetch the tree items |
1037 |
// Fetch the tree items |
| 1022 |
with TreeView1 do begin |
1038 |
with TreeView1 do begin |
| 1023 |
//PatternsNode := Items[0]; |
1039 |
//PatternsNode := Items[0]; |
| 1024 |
InstrumentsNode := Items[0]; |
1040 |
DutyInstrumentsNode := Items[0].Items[0]; |
| 1025 |
WavesNode := Items[1]; |
1041 |
WaveInstrumentsNode := Items[0].Items[1]; |
| 1026 |
RoutinesNode := Items[2]; |
1042 |
NoiseInstrumentsNode := Items[0].Items[2]; |
|
|
1043 |
|
|
|
1044 |
// TODO: Find out how to actually do this... WTF? |
|
|
1045 |
WavesNode := Items[4]; |
|
|
1046 |
RoutinesNode := Items[5]; |
| 1027 |
end; |
1047 |
end; |
| 1028 |
|
1048 |
|
| 1029 |
for PUI := 1 to 15 do |
1049 |
for PUI := 1 to 15 do begin |
| 1030 |
TreeView1.Items.AddChild(InstrumentsNode, IntToStr(PUI)+':').Data := {%H-}Pointer(PUI); |
1050 |
TreeView1.Items.AddChild(DutyInstrumentsNode, IntToStr(PUI)+':').Data := {%H-}Pointer(PUI); |
|
|
1051 |
TreeView1.Items.AddChild(WaveInstrumentsNode, IntToStr(PUI)+':').Data := {%H-}Pointer(PUI); |
|
|
1052 |
TreeView1.Items.AddChild(NoiseInstrumentsNode, IntToStr(PUI)+':').Data := {%H-}Pointer(PUI); |
|
|
1053 |
end; |
| 1031 |
|
1054 |
|
| 1032 |
for PUI := 0 to 15 do begin |
1055 |
for PUI := 0 to 15 do begin |
| 1033 |
TreeView1.Items.AddChild(WavesNode, 'Wave '+IntToStr(PUI)).Data := {%H-}Pointer(PUI); |
1056 |
TreeView1.Items.AddChild(WavesNode, 'Wave '+IntToStr(PUI)).Data := {%H-}Pointer(PUI); |
| 1034 |
TreeView1.Items.AddChild(RoutinesNode, 'Routine '+IntToStr(PUI)).Data := {%H-}Pointer(PUI); |
1057 |
TreeView1.Items.AddChild(RoutinesNode, 'Routine '+IntToStr(PUI)).Data := {%H-}Pointer(PUI); |
| 1035 |
end; |
1058 |
end; |
| 1036 |
|
1059 |
|
| 1037 |
// Initialize order table |
1060 |
// Initialize order table (InitializeSong creates the default order table) |
| 1038 |
{for I := 0 to 3 do begin |
|
|
| 1039 |
OrderEditStringGrid.Cells[I+1, 1] := IntToStr(I); |
|
|
| 1040 |
TrackerGrid.LoadPattern(I, I); |
|
|
| 1041 |
end;} |
|
|
| 1042 |
//CopyOrderGridToOrderMatrix; |
|
|
| 1043 |
CopyOrderMatrixToOrderGrid; |
1061 |
CopyOrderMatrixToOrderGrid; |
| 1044 |
|
1062 |
|
| 1045 |
// Manually resize the fixed column in the order editor |
1063 |
// Manually resize the fixed column in the order editor |
@@ -1281,7 +1299,7 @@ end; |
| 1281 |
|
1299 |
|
| 1282 |
procedure TfrmTracker.InstrumentComboBoxChange(Sender: TObject); |
1300 |
procedure TfrmTracker.InstrumentComboBoxChange(Sender: TObject); |
| 1283 |
begin |
1301 |
begin |
| 1284 |
TrackerGrid.SelectedInstrument := InstrumentComboBox.ItemIndex; |
1302 |
TrackerGrid.SelectedInstrument := ModInst(InstrumentComboBox.ItemIndex); |
| 1285 |
end; |
1303 |
end; |
| 1286 |
|
1304 |
|
| 1287 |
procedure TfrmTracker.EditDelete1Execute(Sender: TObject); |
1305 |
procedure TfrmTracker.EditDelete1Execute(Sender: TObject); |
@@ -1406,17 +1424,30 @@ begin |
| 1406 |
end; |
1424 |
end; |
| 1407 |
|
1425 |
|
| 1408 |
procedure TfrmTracker.InstrumentNameEditChange(Sender: TObject); |
1426 |
procedure TfrmTracker.InstrumentNameEditChange(Sender: TObject); |
|
|
1427 |
var |
|
|
1428 |
S: String; |
| 1409 |
begin |
1429 |
begin |
|
|
1430 |
S := IntToStr(InstrumentNumberSpinner.Value) + ': ' + InstrumentNameEdit.Text; |
| 1410 |
CurrentInstrument^.Name := InstrumentNameEdit.Text; |
1431 |
CurrentInstrument^.Name := InstrumentNameEdit.Text; |
| 1411 |
InstrumentComboBox.Items[InstrumentNumberSpinner.Value] := |
1432 |
case CurrentInstrumentBank of |
| 1412 |
IntToStr(InstrumentNumberSpinner.Value) + ': ' + InstrumentNameEdit.Text; |
1433 |
itSquare: begin |
| 1413 |
InstrumentsNode.Items[InstrumentNumberSpinner.Value-1].Text := |
1434 |
InstrumentComboBox.Items[(0*15) + InstrumentNumberSpinner.Value] := 'Square '+S; |
| 1414 |
InstrumentComboBox.Items[InstrumentNumberSpinner.Value]; |
1435 |
DutyInstrumentsNode.Items[InstrumentNumberSpinner.Value-1].Text := S; |
|
|
1436 |
end; |
|
|
1437 |
itWave: begin |
|
|
1438 |
InstrumentComboBox.Items[(1*15) + InstrumentNumberSpinner.Value] := 'Wave '+S; |
|
|
1439 |
WaveInstrumentsNode.Items[InstrumentNumberSpinner.Value-1].Text := S; |
|
|
1440 |
end; |
|
|
1441 |
itNoise: begin |
|
|
1442 |
InstrumentComboBox.Items[(2*15) + InstrumentNumberSpinner.Value] := 'Noise '+S; |
|
|
1443 |
NoiseInstrumentsNode.Items[InstrumentNumberSpinner.Value-1].Text := S; |
|
|
1444 |
end; |
|
|
1445 |
end; |
| 1415 |
end; |
1446 |
end; |
| 1416 |
|
1447 |
|
| 1417 |
procedure TfrmTracker.InstrumentNumberSpinnerChange(Sender: TObject); |
1448 |
procedure TfrmTracker.InstrumentNumberSpinnerChange(Sender: TObject); |
| 1418 |
begin |
1449 |
begin |
| 1419 |
LoadInstrument(InstrumentNumberSpinner.Value); |
1450 |
LoadInstrument(CurrentInstrumentBank, InstrumentNumberSpinner.Value); |
| 1420 |
end; |
1451 |
end; |
| 1421 |
|
1452 |
|
| 1422 |
procedure TfrmTracker.LengthSpinnerChange(Sender: TObject); |
1453 |
procedure TfrmTracker.LengthSpinnerChange(Sender: TObject); |
@@ -1921,8 +1952,18 @@ end; |
| 1921 |
|
1952 |
|
| 1922 |
procedure TfrmTracker.TreeView1DblClick(Sender: TObject); |
1953 |
procedure TfrmTracker.TreeView1DblClick(Sender: TObject); |
| 1923 |
begin |
1954 |
begin |
| 1924 |
if TreeView1.Selected.Parent = InstrumentsNode then begin |
1955 |
if TreeView1.Selected.Parent = DutyInstrumentsNode then begin |
| 1925 |
InstrumentNumberSpinner.Value := {%H-}PtrUInt(TreeView1.Selected.Data); |
1956 |
LoadInstrument(itSquare, {%H-}PtrUInt(TreeView1.Selected.Data)); |
|
|
1957 |
PageControl1.ActivePage := InstrumentTabSheet; |
|
|
1958 |
end; |
|
|
1959 |
|
|
|
1960 |
if TreeView1.Selected.Parent = WaveInstrumentsNode then begin |
|
|
1961 |
LoadInstrument(itWave, {%H-}PtrUInt(TreeView1.Selected.Data)); |
|
|
1962 |
PageControl1.ActivePage := InstrumentTabSheet; |
|
|
1963 |
end; |
|
|
1964 |
|
|
|
1965 |
if TreeView1.Selected.Parent = NoiseInstrumentsNode then begin |
|
|
1966 |
LoadInstrument(itNoise, {%H-}PtrUInt(TreeView1.Selected.Data)); |
| 1926 |
PageControl1.ActivePage := InstrumentTabSheet; |
1967 |
PageControl1.ActivePage := InstrumentTabSheet; |
| 1927 |
end; |
1968 |
end; |
| 1928 |
|
1969 |
|