Commit 2b858bb

Nick committed on
Workaround for showmodal
commit 2b858bb5097edbf9a47cc6774051dbed778cfc4f parent 2470ca3
6 changed files +41−55
ModifiedGBEmu.lpr +1−0
@@ -71,5 +71,6 @@ begin
71 Application.CreateForm(TfrmTracker, frmTracker); 71 Application.CreateForm(TfrmTracker, frmTracker);
72 Application.CreateForm(TfrmOptions, frmOptions); 72 Application.CreateForm(TfrmOptions, frmOptions);
73 Application.CreateForm(TfrmAboutHugeTracker, frmAboutHugetracker); 73 Application.CreateForm(TfrmAboutHugeTracker, frmAboutHugetracker);
74 Application.CreateForm(TfrmEffectEditor, frmEffectEditor);
74 Application.Run; 75 Application.Run;
75 end. 76 end.
Modifiedeffecteditor.lfm +4−4
@@ -1,7 +1,7 @@
1 object frmEffectEditor: TfrmEffectEditor 1 object frmEffectEditor: TfrmEffectEditor
2 Left = 621 2 Left = 1488
3 Height = 416 3 Height = 416
4 Top = 389 4 Top = 230
5 Width = 684 5 Width = 684
6 BorderIcons = [biSystemMenu, biMinimize] 6 BorderIcons = [biSystemMenu, biMinimize]
7 BorderStyle = bsDialog 7 BorderStyle = bsDialog
@@ -12,7 +12,7 @@ object frmEffectEditor: TfrmEffectEditor
12 FormStyle = fsStayOnTop 12 FormStyle = fsStayOnTop
13 OnClose = FormClose 13 OnClose = FormClose
14 OnCloseQuery = FormCloseQuery 14 OnCloseQuery = FormCloseQuery
15 OnCreate = FormCreate 15 OnShow = FormCreate
16 ShowInTaskBar = stNever 16 ShowInTaskBar = stNever
17 LCLVersion = '2.0.6.0' 17 LCLVersion = '2.0.6.0'
18 object ComboBox1: TComboBox 18 object ComboBox1: TComboBox
@@ -59,7 +59,7 @@ object frmEffectEditor: TfrmEffectEditor
59 Height = 320 59 Height = 320
60 Top = 80 60 Top = 80
61 Width = 642 61 Width = 642
62 PageIndex = 1 62 PageIndex = 0
63 TabOrder = 1 63 TabOrder = 1
64 object OneParamPage: TPage 64 object OneParamPage: TPage
65 object OneParamTrackBar: TTrackBar 65 object OneParamTrackBar: TTrackBar
Modifiedeffecteditor.pas +9−12
@@ -65,8 +65,6 @@ type
65 procedure VibratoDepthTrackBarChange(Sender: TObject); 65 procedure VibratoDepthTrackBarChange(Sender: TObject);
66 procedure VibratoRateRadioGroupSelectionChanged(Sender: TObject); 66 procedure VibratoRateRadioGroupSelectionChanged(Sender: TObject);
67 private 67 private
68 Cell: PCell;
69
70 procedure LoadEffect; 68 procedure LoadEffect;
71 procedure LoadOneParamData; 69 procedure LoadOneParamData;
72 procedure LoadTwoParamData; 70 procedure LoadTwoParamData;
@@ -92,9 +90,12 @@ type
92 procedure fxE; 90 procedure fxE;
93 procedure fxF; 91 procedure fxF;
94 public 92 public
95 constructor Create(Cell_: PCell); reintroduce; 93 Cell: PCell;
96 end; 94 end;
97 95
96 var
97 frmEffectEditor: TfrmEffectEditor;
98
98 implementation 99 implementation
99 100
100 {$R *.lfm} 101 {$R *.lfm}
@@ -166,9 +167,11 @@ end;
166 167
167 procedure TfrmEffectEditor.FormCreate(Sender: TObject); 168 procedure TfrmEffectEditor.FormCreate(Sender: TObject);
168 begin 169 begin
169 ComboBox1.ItemIndex := Cell^.EffectCode; 170 if Assigned(Cell) then begin
170 LoadEffect; 171 ComboBox1.ItemIndex := Cell^.EffectCode;
171 Value.Caption := EffectToExplanation(Cell^.EffectCode, Cell^.EffectParams); 172 LoadEffect;
173 Value.Caption := EffectToExplanation(Cell^.EffectCode, Cell^.EffectParams);
174 end;
172 end; 175 end;
173 176
174 procedure TfrmEffectEditor.OneParamTrackBarChange(Sender: TObject); 177 procedure TfrmEffectEditor.OneParamTrackBarChange(Sender: TObject);
@@ -397,11 +400,5 @@ begin
397 LoadOneParamData; 400 LoadOneParamData;
398 end; 401 end;
399 402
400 constructor TfrmEffectEditor.Create(Cell_: PCell);
401 begin
402 inherited Create(nil);
403 Self.Cell := Cell_;
404 end;
405
406 end. 403 end.
407 404
Modifiedtracker.lfm +17−17
@@ -1,7 +1,7 @@
1 object frmTracker: TfrmTracker 1 object frmTracker: TfrmTracker
2 Left = 514 2 Left = 789
3 Height = 1250 3 Height = 1250
4 Top = 188 4 Top = 314
5 Width = 2067 5 Width = 2067
6 Caption = 'hUGETracker' 6 Caption = 'hUGETracker'
7 ClientHeight = 1216 7 ClientHeight = 1216
@@ -57,10 +57,10 @@ object frmTracker: TfrmTracker
57 Height = 820 57 Height = 820
58 Top = 0 58 Top = 0
59 Width = 1720 59 Width = 1720
60 ActivePage = PatternTabSheet 60 ActivePage = InstrumentTabSheet
61 Align = alClient 61 Align = alClient
62 ParentFont = False 62 ParentFont = False
63 TabIndex = 1 63 TabIndex = 2
64 TabOrder = 0 64 TabOrder = 0
65 object GeneralTabSheet: TTabSheet 65 object GeneralTabSheet: TTabSheet
66 Caption = 'General' 66 Caption = 'General'
@@ -1562,19 +1562,19 @@ object frmTracker: TfrmTracker
1562 ParentFont = False 1562 ParentFont = False
1563 TabOrder = 3 1563 TabOrder = 3
1564 object Panel6: TPanel 1564 object Panel6: TPanel
1565 Left = 1377 1565 Left = 1372
1566 Height = 312 1566 Height = 312
1567 Top = 0 1567 Top = 0
1568 Width = 690 1568 Width = 695
1569 Align = alRight 1569 Align = alRight
1570 AutoSize = True 1570 AutoSize = True
1571 ClientHeight = 312 1571 ClientHeight = 312
1572 ClientWidth = 690 1572 ClientWidth = 695
1573 ParentFont = False 1573 ParentFont = False
1574 TabOrder = 0 1574 TabOrder = 0
1575 object Duty1Visualizer: TPaintBox 1575 object Duty1Visualizer: TPaintBox
1576 Left = 1 1576 Left = 1
1577 Height = 152 1577 Height = 156
1578 Top = 1 1578 Top = 1
1579 Width = 345 1579 Width = 345
1580 ParentFont = False 1580 ParentFont = False
@@ -1582,17 +1582,17 @@ object frmTracker: TfrmTracker
1582 OnPaint = Duty1VisualizerPaint 1582 OnPaint = Duty1VisualizerPaint
1583 end 1583 end
1584 object WaveVisualizer: TPaintBox 1584 object WaveVisualizer: TPaintBox
1585 Left = 1 1585 Left = 2
1586 Height = 159 1586 Height = 156
1587 Top = 149 1587 Top = 152
1588 Width = 345 1588 Width = 345
1589 ParentFont = False 1589 ParentFont = False
1590 OnClick = Duty1VisualizerClick 1590 OnClick = Duty1VisualizerClick
1591 OnPaint = WaveVisualizerPaint 1591 OnPaint = WaveVisualizerPaint
1592 end 1592 end
1593 object Duty2Visualizer: TPaintBox 1593 object Duty2Visualizer: TPaintBox
1594 Left = 344 1594 Left = 349
1595 Height = 152 1595 Height = 156
1596 Top = 1 1596 Top = 1
1597 Width = 345 1597 Width = 345
1598 ParentFont = False 1598 ParentFont = False
@@ -1600,9 +1600,9 @@ object frmTracker: TfrmTracker
1600 OnPaint = Duty2VisualizerPaint 1600 OnPaint = Duty2VisualizerPaint
1601 end 1601 end
1602 object NoiseVisualizer: TPaintBox 1602 object NoiseVisualizer: TPaintBox
1603 Left = 344 1603 Left = 349
1604 Height = 159 1604 Height = 156
1605 Top = 149 1605 Top = 152
1606 Width = 345 1606 Width = 345
1607 ParentFont = False 1607 ParentFont = False
1608 OnClick = Duty1VisualizerClick 1608 OnClick = Duty1VisualizerClick
@@ -4875,7 +4875,7 @@ object frmTracker: TfrmTracker
4875 } 4875 }
4876 end 4876 end
4877 object OscilloscopeUpdateTimer: TTimer 4877 object OscilloscopeUpdateTimer: TTimer
4878 Interval = 15 4878 Interval = 1
4879 OnTimer = OscilloscopeUpdateTimerTimer 4879 OnTimer = OscilloscopeUpdateTimerTimer
4880 left = 512 4880 left = 512
4881 top = 64 4881 top = 64
Modifiedtracker.pas +3−7
@@ -10,7 +10,7 @@ uses
10 Song, EmulationThread, Utils, Constants, sound, vars, machine, 10 Song, EmulationThread, Utils, Constants, sound, vars, machine,
11 about_hugetracker, TrackerGrid, lclintf, lmessages, Buttons, Grids, DBCtrls, 11 about_hugetracker, TrackerGrid, lclintf, lmessages, Buttons, Grids, DBCtrls,
12 HugeDatatypes, LCLType, RackCtls, Codegen, SymParser, options, IniFiles, 12 HugeDatatypes, LCLType, RackCtls, Codegen, SymParser, options, IniFiles,
13 bgrabitmap; 13 bgrabitmap, effecteditor;
14 14
15 type 15 type
16 { TfrmTracker } 16 { TfrmTracker }
@@ -325,7 +325,6 @@ type
325 DrawingWave: Boolean; 325 DrawingWave: Boolean;
326 Playing: Boolean; 326 Playing: Boolean;
327 LoadingFile: Boolean; 327 LoadingFile: Boolean;
328 RedrawingOscillators: Boolean;
329 328
330 {PatternsNode, }InstrumentsNode, WavesNode, RoutinesNode: TTreeNode; 329 {PatternsNode, }InstrumentsNode, WavesNode, RoutinesNode: TTreeNode;
331 330
@@ -1525,8 +1524,8 @@ var
1525 I: Integer; 1524 I: Integer;
1526 Samp: Integer; 1525 Samp: Integer;
1527 begin 1526 begin
1528 //if RedrawingOscillators then Exit; 1527 // HACK: Avoid LCL bug where modal windows can't close.
1529 //RedrawingOscillators := True; 1528 if frmOptions.Visible or frmEffectEditor.Visible then Exit;
1530 {if Playing then 1529 {if Playing then
1531 OscilloscopeUpdateTimer.Interval := 25 1530 OscilloscopeUpdateTimer.Interval := 25
1532 else 1531 else
@@ -1553,9 +1552,6 @@ begin
1553 Max2 := Trunc((Max2/512)*100); 1552 Max2 := Trunc((Max2/512)*100);
1554 if Max1 > LEDMeter1.Position then LEDMeter1.Position := Max1; 1553 if Max1 > LEDMeter1.Position then LEDMeter1.Position := Max1;
1555 if Max2 > LEDMeter2.Position then LEDMeter2.Position := Max2; 1554 if Max2 > LEDMeter2.Position then LEDMeter2.Position := Max2;
1556
1557 //Application.ProcessMessages;
1558 //RedrawingOscillators := False;
1559 end; 1555 end;
1560 1556
1561 procedure TfrmTracker.ExportGBSButtonClick(Sender: TObject); 1557 procedure TfrmTracker.ExportGBSButtonClick(Sender: TObject);
Modifiedtrackergrid.pas +7−15
@@ -322,7 +322,11 @@ end;
322 322
323 procedure TTrackerGrid.DblClick; 323 procedure TTrackerGrid.DblClick;
324 begin 324 begin
325 OpenEffectEditor 325 OpenEffectEditor;
326
327 NormalizeCursors;
328 MouseButtonDown := False;
329 Invalidate;
326 end; 330 end;
327 331
328 procedure TTrackerGrid.KeyDown(var Key: Word; Shift: TShiftState); 332 procedure TTrackerGrid.KeyDown(var Key: Word; Shift: TShiftState);
@@ -574,23 +578,11 @@ begin
574 end; 578 end;
575 579
576 procedure TTrackerGrid.OpenEffectEditor; 580 procedure TTrackerGrid.OpenEffectEditor;
577 var
578 FXEditor: TfrmEffectEditor;
579 begin 581 begin
580 inherited DblClick; 582 inherited DblClick;
581 583
582 FXEditor := TfrmEffectEditor.Create(@Patterns[Cursor.X]^[Cursor.Y]); 584 frmEffectEditor.Cell := @Patterns[Cursor.X]^[Cursor.Y];
583 try 585 frmEffectEditor.ShowModal;
584 FXEditor.ShowModal;
585 finally
586 FXEditor.Free;
587 end;
588
589 NormalizeCursors;
590
591 MouseButtonDown := False;
592
593 Invalidate;
594 end; 586 end;
595 587
596 procedure TTrackerGrid.EraseSelection; 588 procedure TTrackerGrid.EraseSelection;