Commit 0806385

Nick Faro committed on
Reduce subpattern size to 32, add dynamic pattern sizes
commit 08063856b19db2b777b971ff39599bab0167d7dc parent 3174d0a
5 changed files +38−36
Modifiedcodegen.pas +2−2
@@ -360,8 +360,8 @@ begin
360 SL := TStringList.Create; 360 SL := TStringList.Create;
361 SL.Add(Name + ':'); 361 SL.Add(Name + ':');
362 362
363 for I := Low(TPattern) to High(TPattern) do 363 for I := 0 to 31 do
364 SL.Add(RenderTableCell(Pattern[I], I = High(TPattern))); 364 SL.Add(RenderTableCell(Pattern[I], I = 31)); // TODO: hardcoded value
365 365
366 Result := SL.Text; 366 Result := SL.Text;
367 SL.Free; 367 SL.Free;
ModifiedhUGEDriver +1−1
@@ -1 +1 @@
1 Subproject commit 41a9dfd11054f0282778f3a1dbc13e3f9551174b 1 Subproject commit ace91e11513f30a4cb31bb932dd898e5dd89abac
Modifiedtracker.lfm +3−3
@@ -1,7 +1,7 @@
1 object frmTracker: TfrmTracker 1 object frmTracker: TfrmTracker
2 Left = 1448 2 Left = 926
3 Height = 857 3 Height = 857
4 Top = 284 4 Top = 196
5 Width = 1318 5 Width = 1318
6 AllowDropFiles = True 6 AllowDropFiles = True
7 Caption = 'hUGETracker' 7 Caption = 'hUGETracker'
@@ -974,7 +974,7 @@ object frmTracker: TfrmTracker
974 DefaultColWidth = 32 974 DefaultColWidth = 32
975 Enabled = False 975 Enabled = False
976 ParentFont = False 976 ParentFont = False
977 RowCount = 64 977 RowCount = 32
978 ScrollBars = ssNone 978 ScrollBars = ssNone
979 TabOrder = 0 979 TabOrder = 0
980 end 980 end
Modifiedtracker.pas +11−10
@@ -1127,7 +1127,7 @@ begin
1127 1127
1128 // Recreate TableGrid 1128 // Recreate TableGrid
1129 if Assigned(TableGrid) then TableGrid.Free; 1129 if Assigned(TableGrid) then TableGrid.Free;
1130 TableGrid := TTableGrid.Create(Self, ScrollBox2, SubpatternMap, 1); 1130 TableGrid := TTableGrid.Create(Self, ScrollBox2, SubpatternMap, 1, 32);
1131 1131
1132 TableGrid.FontSize := TrackerSettings.PatternEditorFontSize; 1132 TableGrid.FontSize := TrackerSettings.PatternEditorFontSize;
1133 TableGrid.Left := RowNumberStringGrid1.Left - TableGrid.Width; 1133 TableGrid.Left := RowNumberStringGrid1.Left - TableGrid.Width;
@@ -1147,16 +1147,17 @@ begin
1147 RowNumberStringGrid.Clean; 1147 RowNumberStringGrid.Clean;
1148 RowNumberStringGrid1.Clean; 1148 RowNumberStringGrid1.Clean;
1149 // Add the row numbers to the string grid 1149 // Add the row numbers to the string grid
1150 for I := 0 to RowNumberStringGrid.RowCount-1 do begin 1150 for I := 0 to RowNumberStringGrid.RowCount-1 do
1151 if TrackerSettings.DisplayRowNumbersAsHex then begin 1151 if TrackerSettings.DisplayRowNumbersAsHex then
1152 RowNumberStringGrid.Cells[0, I] := IntToHex(I, 2); 1152 RowNumberStringGrid.Cells[0, I] := IntToHex(I, 2)
1153 RowNumberStringGrid1.Cells[0, I] := IntToHex(I, 2) 1153 else
1154 end
1155 else begin
1156 RowNumberStringGrid.Cells[0, I] := IntToStr(I); 1154 RowNumberStringGrid.Cells[0, I] := IntToStr(I);
1157 RowNumberStringGrid1.Cells[0, I] := IntToStr(I) 1155
1158 end; 1156 for I := 0 to RowNumberStringGrid1.RowCount-1 do
1159 end; 1157 if TrackerSettings.DisplayRowNumbersAsHex then
1158 RowNumberStringGrid1.Cells[0, I] := IntToHex(I, 2)
1159 else
1160 RowNumberStringGrid1.Cells[0, I] := IntToStr(I);
1160 end; 1161 end;
1161 1162
1162 procedure TfrmTracker.LoadInstrument(Bank: TInstrumentType; Instr: Integer); 1163 procedure TfrmTracker.LoadInstrument(Bank: TInstrumentType; Instr: Integer);
Modifiedtrackergrid.pas +21−20
@@ -9,9 +9,7 @@ uses
9 LMessages, HugeDatatypes, ClipboardUtils, gdeque, gstack, utils, effecteditor, 9 LMessages, HugeDatatypes, ClipboardUtils, gdeque, gstack, utils, effecteditor,
10 Keymap; 10 Keymap;
11 11
12 // TODO: Maybe read these from a config file
13 const 12 const
14 NUM_ROWS = 64;
15 UNDO_STACK_SIZE = 100; 13 UNDO_STACK_SIZE = 100;
16 14
17 type 15 type
@@ -120,7 +118,7 @@ type
120 public 118 public
121 Cursor, Other: TSelectionPos; 119 Cursor, Other: TSelectionPos;
122 ColumnWidth, RowHeight: Integer; 120 ColumnWidth, RowHeight: Integer;
123 NumColumns: Integer; 121 NumColumns, NumRows: Integer;
124 122
125 SelectedInstrument, SelectedOctave, Step: Integer; 123 SelectedInstrument, SelectedOctave, Step: Integer;
126 124
@@ -156,7 +154,8 @@ type
156 AOwner: TComponent; 154 AOwner: TComponent;
157 Parent: TWinControl; 155 Parent: TWinControl;
158 PatternMap: TPatternMap; 156 PatternMap: TPatternMap;
159 NumColumns: Integer); reintroduce; 157 NumColumns: Integer;
158 NumRows: Integer = 64); reintroduce;
160 destructor Destroy; override; 159 destructor Destroy; override;
161 end; 160 end;
162 161
@@ -311,7 +310,8 @@ constructor TTrackerGrid.Create(
311 AOwner: TComponent; 310 AOwner: TComponent;
312 Parent: TWinControl; 311 Parent: TWinControl;
313 PatternMap: TPatternMap; 312 PatternMap: TPatternMap;
314 NumColumns: Integer); 313 NumColumns: Integer;
314 NumRows: Integer);
315 begin 315 begin
316 inherited Create(AOwner); 316 inherited Create(AOwner);
317 317
@@ -319,6 +319,7 @@ begin
319 319
320 Self.PatternMap := PatternMap; 320 Self.PatternMap := PatternMap;
321 Self.NumColumns := NumColumns; 321 Self.NumColumns := NumColumns;
322 Self.NumRows := NumRows;
322 323
323 SetLength(Patterns, NumColumns); 324 SetLength(Patterns, NumColumns);
324 SetLength(PatternNumbers, NumColumns); 325 SetLength(PatternNumbers, NumColumns);
@@ -357,7 +358,7 @@ begin
357 Brush.Color := clBackground; 358 Brush.Color := clBackground;
358 Clear; 359 Clear;
359 360
360 for I := 0 to High(TPattern) do begin 361 for I := 0 to NumRows-1 do begin
361 if (I mod 4) = 0 then 362 if (I mod 4) = 0 then
362 Brush.Color := clLineFour; 363 Brush.Color := clLineFour;
363 if (I mod 16) = 0 then 364 if (I mod 16) = 0 then
@@ -526,8 +527,8 @@ begin
526 VK_NEXT: Inc(Cursor.Y, 16); 527 VK_NEXT: Inc(Cursor.Y, 16);
527 VK_LEFT: DecSelectionPos(Cursor); 528 VK_LEFT: DecSelectionPos(Cursor);
528 VK_RIGHT: IncSelectionPos(Cursor); 529 VK_RIGHT: IncSelectionPos(Cursor);
529 VK_HOME: Cursor.Y := Low(TPattern); 530 VK_HOME: Cursor.Y := 0;
530 VK_END: Cursor.Y := High(TPattern); 531 VK_END: Cursor.Y := NumRows-1;
531 VK_TAB: begin 532 VK_TAB: begin
532 if ssShift in Shift then begin 533 if ssShift in Shift then begin
533 Dec(Cursor.X); 534 Dec(Cursor.X);
@@ -554,7 +555,7 @@ begin
554 end; 555 end;
555 end; 556 end;
556 557
557 if (Cursor.Y > High(TPattern)) or (Cursor.Y < Low(TPattern)) then 558 if (Cursor.Y > NumRows-1) or (Cursor.Y < 0) then
558 if Assigned(OnCursorOutOfBounds) then OnCursorOutOfBounds; 559 if Assigned(OnCursorOutOfBounds) then OnCursorOutOfBounds;
559 560
560 if Shift = [] then 561 if Shift = [] then
@@ -604,7 +605,7 @@ var
604 begin 605 begin
605 try 606 try
606 for Y := 0 to High(Paste) do begin 607 for Y := 0 to High(Paste) do begin
607 if not InRange(Where.Y+Y, Low(TPattern), High(TPattern)) then Continue; 608 if not InRange(Where.Y+Y, 0, NumRows-1) then Continue;
608 for X := 0 to High(Paste[Y]) do begin 609 for X := 0 to High(Paste[Y]) do begin
609 if not InRange(Where.X+X, Low(Patterns), High(Patterns)) then Continue; 610 if not InRange(Where.X+X, Low(Patterns), High(Patterns)) then Continue;
610 OverlayCell(Patterns[Where.X + X]^[Where.Y + Y], Paste[Y, X]); 611 OverlayCell(Patterns[Where.X + X]^[Where.Y + Y], Paste[Y, X]);
@@ -641,7 +642,7 @@ begin
641 try 642 try
642 Selection := GetPastedCells; 643 Selection := GetPastedCells;
643 I := Cursor.Y; 644 I := Cursor.Y;
644 while I <= High(TPattern) do begin 645 while I < NumRows do begin
645 Cursor.Y := I; 646 Cursor.Y := I;
646 PerformPaste(Selection); 647 PerformPaste(Selection);
647 Inc(I, High(Selection)+1); 648 Inc(I, High(Selection)+1);
@@ -812,9 +813,9 @@ begin
812 if Other.X > (NumColumns-1) then 813 if Other.X > (NumColumns-1) then
813 Other.SelectedPart := High(TCellPart); 814 Other.SelectedPart := High(TCellPart);
814 815
815 Cursor.Y := EnsureRange(Cursor.Y, Low(TPattern), High(TPattern)); 816 Cursor.Y := EnsureRange(Cursor.Y, 0, NumRows-1);
816 Cursor.X := EnsureRange(Cursor.X, Low(TPatternGrid), (NumColumns-1)); 817 Cursor.X := EnsureRange(Cursor.X, Low(TPatternGrid), (NumColumns-1));
817 Other.Y := EnsureRange(Other.Y, Low(TPattern), High(TPattern)); 818 Other.Y := EnsureRange(Other.Y, 0, NumRows-1);
818 Other.X := EnsureRange(Other.X, Low(TPatternGrid), (NumColumns-1)); 819 Other.X := EnsureRange(Other.X, Low(TPatternGrid), (NumColumns-1));
819 end; 820 end;
820 821
@@ -1211,7 +1212,7 @@ begin
1211 Y := EnsureRange(Height-1, 0, Y); 1212 Y := EnsureRange(Height-1, 0, Y);
1212 1213
1213 Result.X := Trunc((X/Width)*NumColumns); 1214 Result.X := Trunc((X/Width)*NumColumns);
1214 Result.Y := Trunc((Y/Height)*NUM_ROWS); 1215 Result.Y := Trunc((Y/Height)*NumRows);
1215 1216
1216 if OrigX <= 0 then 1217 if OrigX <= 0 then
1217 Result.SelectedPart := cpNote 1218 Result.SelectedPart := cpNote
@@ -1285,7 +1286,7 @@ begin
1285 end; 1286 end;
1286 1287
1287 Width := ColumnWidth*NumColumns; 1288 Width := ColumnWidth*NumColumns;
1288 Height := RowHeight*64; 1289 Height := RowHeight*NumRows;
1289 end; 1290 end;
1290 1291
1291 procedure TTrackerGrid.SetFontSize(AValue: Integer); 1292 procedure TTrackerGrid.SetFontSize(AValue: Integer);
@@ -1369,7 +1370,7 @@ begin
1369 BeginUndoAction; 1370 BeginUndoAction;
1370 NormalizeCursors; 1371 NormalizeCursors;
1371 1372
1372 for I := High(TPattern) downto Cursor.Y do 1373 for I := NumRows-1 downto Cursor.Y do
1373 Patterns[Pattern]^[I] := Patterns[Pattern]^[I-1]; 1374 Patterns[Pattern]^[I] := Patterns[Pattern]^[I-1];
1374 1375
1375 BlankCell(Patterns[Pattern]^[Cursor.Y]); 1376 BlankCell(Patterns[Pattern]^[Cursor.Y]);
@@ -1398,10 +1399,10 @@ begin
1398 BeginUndoAction; 1399 BeginUndoAction;
1399 NormalizeCursors; 1400 NormalizeCursors;
1400 1401
1401 for I := Cursor.Y to High(TPattern)-1 do 1402 for I := Cursor.Y to NumRows-2 do
1402 Patterns[Pattern]^[I] := Patterns[Pattern]^[I+1]; 1403 Patterns[Pattern]^[I] := Patterns[Pattern]^[I+1];
1403 1404
1404 BlankCell(Patterns[Pattern]^[High(TPattern)]); 1405 BlankCell(Patterns[Pattern]^[NumRows-1]);
1405 1406
1406 Invalidate; 1407 Invalidate;
1407 EndUndoAction; 1408 EndUndoAction;
@@ -1426,7 +1427,7 @@ begin
1426 Cursor.Y := 0; 1427 Cursor.Y := 0;
1427 Cursor.SelectedPart := cpNote; 1428 Cursor.SelectedPart := cpNote;
1428 Other.X := High(Patterns); 1429 Other.X := High(Patterns);
1429 Other.Y := High(TPattern); 1430 Other.Y := NumRows-1;
1430 Other.SelectedPart := cpEffectParams; 1431 Other.SelectedPart := cpEffectParams;
1431 1432
1432 Invalidate; 1433 Invalidate;
@@ -1435,7 +1436,7 @@ end;
1435 procedure TTrackerGrid.SelectColumn; 1436 procedure TTrackerGrid.SelectColumn;
1436 begin 1437 begin
1437 Cursor.Y := 0; 1438 Cursor.Y := 0;
1438 Other.Y := High(TPattern); 1439 Other.Y := NumRows-1;
1439 Cursor.SelectedPart := Low(TCellPart); 1440 Cursor.SelectedPart := Low(TCellPart);
1440 Other.SelectedPart := High(TCellPart); 1441 Other.SelectedPart := High(TCellPart);
1441 1442