Commit 5468cab

Nick Faro committed on
Pegmode - add mix paste
commit 5468cabe97d35ee5940e0ce1014663f1d1d8add5 parent 067c11b
5 changed files +65−24
ModifiedhUGEDriver +1−1
@@ -1 +1 @@
1 Subproject commit 3d6416a9fa6f6a493a536417cb53f0e50d719ad7 1 Subproject commit 8967274b7be23d911bbb4c242b61d0bc8a51c803
Modifiedoptions.lfm +6−6
@@ -1,11 +1,11 @@
1 object frmOptions: TfrmOptions 1 object frmOptions: TfrmOptions
2 Left = 1741 2 Left = 1675
3 Height = 732 3 Height = 706
4 Top = 120 4 Top = 128
5 Width = 927 5 Width = 927
6 BorderStyle = bsDialog 6 BorderStyle = bsDialog
7 Caption = 'Options' 7 Caption = 'Options'
8 ClientHeight = 732 8 ClientHeight = 706
9 ClientWidth = 927 9 ClientWidth = 927
10 OnClose = FormClose 10 OnClose = FormClose
11 OnCreate = FormCreate 11 OnCreate = FormCreate
@@ -14,9 +14,9 @@ object frmOptions: TfrmOptions
14 object Button1: TButton 14 object Button1: TButton
15 AnchorSideRight.Side = asrBottom 15 AnchorSideRight.Side = asrBottom
16 AnchorSideBottom.Side = asrBottom 16 AnchorSideBottom.Side = asrBottom
17 Left = 791 17 Left = 789
18 Height = 25 18 Height = 25
19 Top = 693 19 Top = 673
20 Width = 123 20 Width = 123
21 Anchors = [akRight, akBottom] 21 Anchors = [akRight, akBottom]
22 Caption = 'OK' 22 Caption = 'OK'
Modifiedtracker.lfm +9−4
@@ -1,7 +1,7 @@
1 object frmTracker: TfrmTracker 1 object frmTracker: TfrmTracker
2 Left = 1857 2 Left = 1101
3 Height = 654 3 Height = 654
4 Top = 477 4 Top = 419
5 Width = 1232 5 Width = 1232
6 AllowDropFiles = True 6 AllowDropFiles = True
7 Caption = 'hUGETracker' 7 Caption = 'hUGETracker'
@@ -62,10 +62,10 @@ object frmTracker: TfrmTracker
62 Height = 522 62 Height = 522
63 Top = 0 63 Top = 0
64 Width = 1034 64 Width = 1034
65 ActivePage = PatternTabSheet 65 ActivePage = InstrumentTabSheet
66 Align = alClient 66 Align = alClient
67 ParentFont = False 67 ParentFont = False
68 TabIndex = 1 68 TabIndex = 2
69 TabOrder = 0 69 TabOrder = 0
70 object GeneralTabSheet: TTabSheet 70 object GeneralTabSheet: TTabSheet
71 Caption = 'General' 71 Caption = 'General'
@@ -2628,6 +2628,11 @@ object frmTracker: TfrmTracker
2628 ShortCut = 8278 2628 ShortCut = 8278
2629 OnClick = TrackerPopupFloodPasteClick 2629 OnClick = TrackerPopupFloodPasteClick
2630 end 2630 end
2631 object TrackerPopupMixPaste: TMenuItem
2632 Caption = 'Mix paste'
2633 ShortCut = 24662
2634 OnClick = TrackerPopupMixPasteClick
2635 end
2631 object TrackerPopupErase: TMenuItem 2636 object TrackerPopupErase: TMenuItem
2632 Caption = 'Erase' 2637 Caption = 'Erase'
2633 ShortCut = 46 2638 ShortCut = 46
Modifiedtracker.pas +7−0
@@ -58,6 +58,7 @@ type
58 InsertRowForAllAction: TAction; 58 InsertRowForAllAction: TAction;
59 InsertRowAction: TAction; 59 InsertRowAction: TAction;
60 Label14: TLabel; 60 Label14: TLabel;
61 TrackerPopupMixPaste: TMenuItem;
61 MenuItem39: TMenuItem; 62 MenuItem39: TMenuItem;
62 ExportCMenuItem: TMenuItem; 63 ExportCMenuItem: TMenuItem;
63 MenuItem40: TMenuItem; 64 MenuItem40: TMenuItem;
@@ -282,6 +283,7 @@ type
282 StatusBar1: TStatusBar; 283 StatusBar1: TStatusBar;
283 TreeView1: TTreeView; 284 TreeView1: TTreeView;
284 TrackerGrid: TTrackerGrid; 285 TrackerGrid: TTrackerGrid;
286 procedure TrackerPopupMixPasteClick(Sender: TObject);
285 procedure TestOctaveButtonClick(Sender: TObject); 287 procedure TestOctaveButtonClick(Sender: TObject);
286 procedure DebugButtonClick(Sender: TObject); 288 procedure DebugButtonClick(Sender: TObject);
287 procedure DecreaseOctaveActionExecute(Sender: TObject); 289 procedure DecreaseOctaveActionExecute(Sender: TObject);
@@ -2026,6 +2028,11 @@ begin
2026 end; 2028 end;
2027 end; 2029 end;
2028 2030
2031 procedure TfrmTracker.TrackerPopupMixPasteClick(Sender: TObject);
2032 begin
2033 TrackerGrid.DoMixPaste
2034 end;
2035
2029 procedure TfrmTracker.DebugButtonClick(Sender: TObject); 2036 procedure TfrmTracker.DebugButtonClick(Sender: TObject);
2030 var 2037 var
2031 S: TStream; 2038 S: TStream;
Modifiedtrackergrid.pas +42−13
@@ -60,8 +60,8 @@ type
60 procedure KeyUp(var Key: Word; Shift: TShiftState); override; 60 procedure KeyUp(var Key: Word; Shift: TShiftState); override;
61 private 61 private
62 function GetSelection: TSelection; 62 function GetSelection: TSelection;
63 procedure PerformPaste(Paste: TSelection); overload; 63 procedure PerformPaste(Paste: TSelection; Mix: Boolean = False); overload;
64 procedure PerformPaste(Paste: TSelection; Where: TSelectionPos); overload; 64 procedure PerformPaste(Paste: TSelection; Where: TSelectionPos; Mix: Boolean = False); overload;
65 procedure PerformCopy; 65 procedure PerformCopy;
66 procedure DoPaste(var Msg: TLMessage); message LM_PASTE; 66 procedure DoPaste(var Msg: TLMessage); message LM_PASTE;
67 procedure DoCopy(var Msg: TLMessage); message LM_COPY; 67 procedure DoCopy(var Msg: TLMessage); message LM_COPY;
@@ -147,6 +147,7 @@ type
147 procedure DoUndo; 147 procedure DoUndo;
148 procedure DoRedo; 148 procedure DoRedo;
149 procedure DoRepeatPaste; 149 procedure DoRepeatPaste;
150 procedure DoMixPaste;
150 procedure TransposeSelection(Semitones: Integer); 151 procedure TransposeSelection(Semitones: Integer);
151 procedure IncrementSelection(Note, Instrument, Volume, EffectCode, EffectParam: Integer); 152 procedure IncrementSelection(Note, Instrument, Volume, EffectCode, EffectParam: Integer);
152 procedure InterpolateSelection; 153 procedure InterpolateSelection;
@@ -513,15 +514,25 @@ begin
513 end; 514 end;
514 end; 515 end;
515 516
516 procedure TTrackerGrid.PerformPaste(Paste: TSelection; Where: TSelectionPos); 517 procedure TTrackerGrid.PerformPaste(Paste: TSelection; Where: TSelectionPos; Mix: Boolean = False);
517 procedure OverlayCell(var Cell1: TCell; const Cell2: TSelectedCell); 518 procedure OverlayCell(var Cell1: TCell; const Cell2: TSelectedCell);
518 begin 519 begin
519 if cpNote in Cell2.Parts then Cell1.Note := Cell2.Cell.Note; 520 if cpNote in Cell2.Parts then
520 if cpInstrument in Cell2.Parts then Cell1.Instrument := Cell2.Cell.Instrument; 521 if (not Mix) or (Mix and (Cell2.Cell.Note <> NO_NOTE)) then
521 if cpEffectCode in Cell2.Parts then Cell1.EffectCode:=Cell2.Cell.EffectCode; 522 Cell1.Note := Cell2.Cell.Note;
522 if cpEffectParams in Cell2.Parts then 523
523 Cell1.EffectParams.Value := Cell2.Cell.EffectParams.Value; 524 if cpInstrument in Cell2.Parts then
524 end; 525 if (not Mix) or (Mix and (Cell2.Cell.Instrument <> 0)) then
526 Cell1.Instrument := Cell2.Cell.Instrument;
527
528 if cpEffectCode in Cell2.Parts then
529 if (not Mix) or (Mix and (Cell2.Cell.EffectCode <> 0)) then
530 Cell1.EffectCode := Cell2.Cell.EffectCode;
531
532 if cpEffectParams in Cell2.Parts then
533 if (not Mix) or (Mix and (Cell2.Cell.EffectParams.Value <> 0)) then
534 Cell1.EffectParams.Value := Cell2.Cell.EffectParams.Value;
535 end;
525 var 536 var
526 X, Y: Integer; 537 X, Y: Integer;
527 begin 538 begin
@@ -544,9 +555,9 @@ begin
544 end; 555 end;
545 end; 556 end;
546 557
547 procedure TTrackerGrid.PerformPaste(Paste: TSelection); 558 procedure TTrackerGrid.PerformPaste(Paste: TSelection; Mix: Boolean = False);
548 begin 559 begin
549 PerformPaste(Paste, Cursor); 560 PerformPaste(Paste, Cursor, Mix);
550 end; 561 end;
551 562
552 procedure TTrackerGrid.PerformCopy; 563 procedure TTrackerGrid.PerformCopy;
@@ -581,6 +592,24 @@ begin
581 EndUndoAction; 592 EndUndoAction;
582 end; 593 end;
583 594
595 procedure TTrackerGrid.DoMixPaste;
596 begin
597 BeginUndoAction;
598
599 try
600 PerformPaste(GetPastedCells, True);
601 except
602 on E: EClipboardFormatException do begin
603 WriteLn(StdErr, '[WARNING] ', E.Message);
604 RevertUndoAction;
605 Exit
606 end;
607 end;
608
609 Invalidate;
610 EndUndoAction;
611 end;
612
584 procedure TTrackerGrid.DoPaste(var Msg: TLMessage); 613 procedure TTrackerGrid.DoPaste(var Msg: TLMessage);
585 begin 614 begin
586 BeginUndoAction; 615 BeginUndoAction;