Commit c37bcdc

Nick committed on
Fix effect value inputting
commit c37bcdcd9a3bfe9dccd6d83978ab6aabdd9938ec parent b343702
3 changed files +10−27
Modifiedemulationthread.pas +2−1
@@ -33,7 +33,7 @@ procedure TEmulationThread.Execute;
33 var 33 var
34 tickFreq, cycles: Extended; 34 tickFreq, cycles: Extended;
35 frameStart, frameEnd: Extended; 35 frameStart, frameEnd: Extended;
36 frameElapsedInSec: Double; 36 frameElapsedInSec: Extended;
37 function GetCounter: Integer; 37 function GetCounter: Integer;
38 begin 38 begin
39 Result := Trunc(ET.Elapsed*1000000); // Convert to microseconds 39 Result := Trunc(ET.Elapsed*1000000); // Convert to microseconds
@@ -52,6 +52,7 @@ begin
52 52
53 cycles -= CyclesPerFrame; 53 cycles -= CyclesPerFrame;
54 54
55 // TODO: Replace this with an actual timing mechanism. This devours CPU.
55 repeat 56 repeat
56 FrameEnd := GetCounter; 57 FrameEnd := GetCounter;
57 58
Modifiedtracker.pas +1−1
@@ -277,7 +277,7 @@ type
277 Playing: Boolean; 277 Playing: Boolean;
278 LoadingFile: Boolean; 278 LoadingFile: Boolean;
279 279
280 PatternsNode, InstrumentsNode, WavesNode, RoutinesNode: TTreeNode; 280 {PatternsNode, }InstrumentsNode, WavesNode, RoutinesNode: TTreeNode;
281 281
282 SymbolTable: TSymbolMap; 282 SymbolTable: TSymbolMap;
283 283
Modifiedtrackergrid.pas +7−25
@@ -113,8 +113,6 @@ type
113 Performed: TUndoDeque; 113 Performed: TUndoDeque;
114 Recall: TRedoStack; 114 Recall: TRedoStack;
115 115
116 DigitInputting: Boolean;
117
118 FHighlightedRow: Integer; 116 FHighlightedRow: Integer;
119 public 117 public
120 Cursor, Other: TSelectionPos; 118 Cursor, Other: TSelectionPos;
@@ -290,7 +288,6 @@ begin
290 if Button = mbLeft then 288 if Button = mbLeft then
291 MouseButtonDown := True; 289 MouseButtonDown := True;
292 Selecting := False; 290 Selecting := False;
293 DigitInputting := False;
294 291
295 if not (csDesigning in ComponentState) and CanFocus then 292 if not (csDesigning in ComponentState) and CanFocus then
296 SetFocus; 293 SetFocus;
@@ -324,7 +321,6 @@ begin
324 NormalizeCursors; 321 NormalizeCursors;
325 322
326 MouseButtonDown := False; 323 MouseButtonDown := False;
327 DigitInputting := False;
328 end; 324 end;
329 325
330 procedure TTrackerGrid.DblClick; 326 procedure TTrackerGrid.DblClick;
@@ -343,7 +339,6 @@ begin
343 NormalizeCursors; 339 NormalizeCursors;
344 340
345 MouseButtonDown := False; 341 MouseButtonDown := False;
346 DigitInputting := False;
347 342
348 Invalidate; 343 Invalidate;
349 end; 344 end;
@@ -385,28 +380,24 @@ begin
385 EraseSelection; 380 EraseSelection;
386 end; 381 end;
387 VK_UP: begin 382 VK_UP: begin
388 Cursor.Y -= 1; 383 Dec(Cursor.Y);
389 DigitInputting := False;
390 end; 384 end;
391 VK_DOWN: begin 385 VK_DOWN: begin
392 Cursor.Y += 1; 386 Inc(Cursor.Y);
393 DigitInputting := False;
394 end; 387 end;
395 VK_LEFT: begin 388 VK_LEFT: begin
396 if ssCtrl in Shift then 389 if ssCtrl in Shift then
397 Cursor.X -= 1 390 Dec(Cursor.X)
398 else if Cursor.SelectedPart > Low(TCellPart) then begin 391 else if Cursor.SelectedPart > Low(TCellPart) then begin
399 Cursor.SelectedPart := Pred(Cursor.SelectedPart); 392 Cursor.SelectedPart := Pred(Cursor.SelectedPart);
400 end; 393 end;
401 DigitInputting := False;
402 end; 394 end;
403 VK_RIGHT: begin 395 VK_RIGHT: begin
404 if ssCtrl in Shift then 396 if ssCtrl in Shift then
405 Cursor.X += 1 397 Inc(Cursor.X)
406 else if Cursor.SelectedPart < High(TCellPart) then begin 398 else if Cursor.SelectedPart < High(TCellPart) then begin
407 Cursor.SelectedPart := Succ(Cursor.SelectedPart); 399 Cursor.SelectedPart := Succ(Cursor.SelectedPart);
408 end; 400 end;
409 DigitInputting := False;
410 end; 401 end;
411 else begin 402 else begin
412 if (not (ssCtrl in Shift)) and (not (ssShift in Shift)) then 403 if (not (ssCtrl in Shift)) and (not (ssShift in Shift)) then
@@ -698,7 +689,7 @@ var
698 begin 689 begin
699 with Patterns[Cursor.X]^[Cursor.Y] do 690 with Patterns[Cursor.X]^[Cursor.Y] do
700 if Key = VK_DELETE then Instrument := 0 691 if Key = VK_DELETE then Instrument := 0
701 else if KeycodeToHexNumber(Key, Temp) and (Temp <= 9) then 692 else if KeycodeToHexNumber(Key, Temp) and InRange(Temp, 0, 9) then
702 Instrument := ((Instrument mod 10) * 10) + Temp; 693 Instrument := ((Instrument mod 10) * 10) + Temp;
703 694
704 Invalidate; 695 Invalidate;
@@ -732,17 +723,8 @@ begin
732 EffectCode := 0; 723 EffectCode := 0;
733 EffectParams.Value := 0; 724 EffectParams.Value := 0;
734 end 725 end
735 else if not DigitInputting then begin 726 else if KeycodeToHexNumber(Key, Temp) then
736 if KeycodeToHexNumber(Key, Temp) then begin 727 EffectParams.Value := ((EffectParams.Value mod $10) * $10) + Temp;
737 EffectParams.Param2 := EffectParams.Param1;
738 EffectParams.Param1 := Temp;
739 DigitInputting := True;
740 end;
741 end
742 else if KeycodeToHexNumber(Key, Temp) then begin
743 EffectParams.Param2 := Temp;
744 DigitInputting := False;
745 end;
746 728
747 Invalidate; 729 Invalidate;
748 SaveUndoState; 730 SaveUndoState;