Commit f6df302

Nick Faro committed on
Volume tweaks to trackergrid
commit f6df30210607cf21e31d718f8d1747b3bccc58ab parent 118329c
1 changed files +29−14
Modifiedtrackergrid.pas +29−14
@@ -75,7 +75,7 @@ type
75 75
76 procedure InputNote(Key: Word); 76 procedure InputNote(Key: Word);
77 procedure InputInstrument(Key: Word); 77 procedure InputInstrument(Key: Word);
78 procedure InputVolume(Key: Word); 78 procedure InputVolume(Key: Word); virtual;
79 procedure InputEffectCode(Key: Word); 79 procedure InputEffectCode(Key: Word);
80 procedure InputEffectParams(Key: Word); 80 procedure InputEffectParams(Key: Word);
81 81
@@ -164,6 +164,7 @@ type
164 164
165 TTableGrid = class(TTrackerGrid) 165 TTableGrid = class(TTrackerGrid)
166 procedure RenderCell(const Cell: TCell); override; 166 procedure RenderCell(const Cell: TCell); override;
167 procedure InputVolume(Key: Word); override;
167 end; 168 end;
168 169
169 var 170 var
@@ -193,8 +194,6 @@ implementation
193 { TTableGrid } 194 { TTableGrid }
194 195
195 procedure TTableGrid.RenderCell(const Cell: TCell); 196 procedure TTableGrid.RenderCell(const Cell: TCell);
196 var
197 NoteString: ShortString;
198 begin 197 begin
199 with Canvas do begin 198 with Canvas do begin
200 Font.Color := clNote; 199 Font.Color := clNote;
@@ -203,9 +202,9 @@ begin
203 Font.Color := clDots; 202 Font.Color := clDots;
204 TextOut(PenPos.X, PenPos.Y, '...') 203 TextOut(PenPos.X, PenPos.Y, '...')
205 end 204 end
206 else if Cell.Note > 36 then 205 else if Cell.Note > MIDDLE_NOTE then
207 TextOut(PenPos.X, PenPos.Y, '+'+FormatFloat('00', Cell.Note - MIDDLE_NOTE)) 206 TextOut(PenPos.X, PenPos.Y, '+'+FormatFloat('00', Cell.Note - MIDDLE_NOTE))
208 else if Cell.Note < 36 then 207 else if Cell.Note < MIDDLE_NOTE then
209 TextOut(PenPos.X, PenPos.Y, '-'+FormatFloat('00', MIDDLE_NOTE - Cell.Note)); 208 TextOut(PenPos.X, PenPos.Y, '-'+FormatFloat('00', MIDDLE_NOTE - Cell.Note));
210 209
211 TextOut(PenPos.X, PenPos.Y, ' '); 210 TextOut(PenPos.X, PenPos.Y, ' ');
@@ -242,6 +241,21 @@ begin
242 end; 241 end;
243 end; 242 end;
244 243
244 procedure TTableGrid.InputVolume(Key: Word);
245 var
246 Temp: Nibble;
247 begin
248 BeginUndoAction;
249 with Patterns[Cursor.X]^[Cursor.Y] do begin
250 if Key = VK_DELETE then Volume := 0
251 else if KeycodeToHexNumber(Key, Temp) and InRange(Temp, 0, 9) then
252 Volume := ((Volume mod 10) * 10) + Temp;
253 end;
254
255 Invalidate;
256 EndUndoAction;
257 end;
258
245 { TSelectionEnumerator } 259 { TSelectionEnumerator }
246 260
247 constructor TSelectionEnumerator.Create(Grid: TPatternGrid; Cursor, 261 constructor TSelectionEnumerator.Create(Grid: TPatternGrid; Cursor,
@@ -579,14 +593,15 @@ begin
579 end; 593 end;
580 594
581 procedure TTrackerGrid.PerformPaste(Paste: TSelection; Where: TSelectionPos); 595 procedure TTrackerGrid.PerformPaste(Paste: TSelection; Where: TSelectionPos);
582 procedure OverlayCell(var Cell1: TCell; const Cell2: TSelectedCell); 596 procedure OverlayCell(var Cell1: TCell; const Cell2: TSelectedCell);
583 begin 597 begin
584 if cpNote in Cell2.Parts then Cell1.Note := Cell2.Cell.Note; 598 if cpNote in Cell2.Parts then Cell1.Note := Cell2.Cell.Note;
585 if cpInstrument in Cell2.Parts then Cell1.Instrument := Cell2.Cell.Instrument; 599 if cpInstrument in Cell2.Parts then Cell1.Instrument := Cell2.Cell.Instrument;
586 if cpEffectCode in Cell2.Parts then Cell1.EffectCode:=Cell2.Cell.EffectCode; 600 if cpVolume in Cell2.Parts then Cell1.Volume := Cell2.Cell.Volume;
587 if cpEffectParams in Cell2.Parts then 601 if cpEffectCode in Cell2.Parts then Cell1.EffectCode:=Cell2.Cell.EffectCode;
588 Cell1.EffectParams.Value := Cell2.Cell.EffectParams.Value; 602 if cpEffectParams in Cell2.Parts then
589 end; 603 Cell1.EffectParams.Value := Cell2.Cell.EffectParams.Value;
604 end;
590 var 605 var
591 X, Y: Integer; 606 X, Y: Integer;
592 begin 607 begin
@@ -1344,7 +1359,7 @@ begin
1344 case SelectionPos.SelectedPart of 1359 case SelectionPos.SelectedPart of
1345 cpNote: Note := NO_NOTE; 1360 cpNote: Note := NO_NOTE;
1346 cpInstrument: Instrument := 0; 1361 cpInstrument: Instrument := 0;
1347 cpVolume:; 1362 cpVolume: Volume := 0;
1348 cpEffectCode: EffectCode := 0; 1363 cpEffectCode: EffectCode := 0;
1349 cpEffectParams: EffectParams.Value := 0; 1364 cpEffectParams: EffectParams.Value := 0;
1350 end; 1365 end;