Commit 0ceb289

Nick committed on
Implement #10
commit 0ceb289318b5fb8341990a9572afc0102921d5de parent 573f7a0
2 changed files +61−29
Modifiedtracker.lfm +18−18
@@ -1,11 +1,11 @@
1 object frmTracker: TfrmTracker 1 object frmTracker: TfrmTracker
2 Left = 453 2 Left = 1763
3 Height = 701 3 Height = 687
4 Top = 598 4 Top = 320
5 Width = 1145 5 Width = 1145
6 AllowDropFiles = True 6 AllowDropFiles = True
7 Caption = 'hUGETracker' 7 Caption = 'hUGETracker'
8 ClientHeight = 681 8 ClientHeight = 667
9 ClientWidth = 1145 9 ClientWidth = 1145
10 KeyPreview = True 10 KeyPreview = True
11 Menu = MainMenu1 11 Menu = MainMenu1
@@ -21,7 +21,7 @@ object frmTracker: TfrmTracker
21 LCLVersion = '2.0.6.0' 21 LCLVersion = '2.0.6.0'
22 object TreeView1: TTreeView 22 object TreeView1: TTreeView
23 Left = 0 23 Left = 0
24 Height = 569 24 Height = 555
25 Top = 89 25 Top = 89
26 Width = 193 26 Width = 193
27 Align = alLeft 27 Align = alLeft
@@ -42,34 +42,34 @@ object frmTracker: TfrmTracker
42 end 42 end
43 object Splitter1: TSplitter 43 object Splitter1: TSplitter
44 Left = 193 44 Left = 193
45 Height = 569 45 Height = 555
46 Top = 89 46 Top = 89
47 Width = 5 47 Width = 5
48 end 48 end
49 object Panel1: TPanel 49 object Panel1: TPanel
50 Left = 198 50 Left = 198
51 Height = 569 51 Height = 555
52 Top = 89 52 Top = 89
53 Width = 947 53 Width = 947
54 Align = alClient 54 Align = alClient
55 BevelOuter = bvNone 55 BevelOuter = bvNone
56 ClientHeight = 569 56 ClientHeight = 555
57 ClientWidth = 947 57 ClientWidth = 947
58 ParentFont = False 58 ParentFont = False
59 TabOrder = 2 59 TabOrder = 2
60 object PageControl1: TPageControl 60 object PageControl1: TPageControl
61 Left = 0 61 Left = 0
62 Height = 569 62 Height = 555
63 Top = 0 63 Top = 0
64 Width = 947 64 Width = 947
65 ActivePage = PatternTabSheet 65 ActivePage = GeneralTabSheet
66 Align = alClient 66 Align = alClient
67 ParentFont = False 67 ParentFont = False
68 TabIndex = 1 68 TabIndex = 0
69 TabOrder = 0 69 TabOrder = 0
70 object GeneralTabSheet: TTabSheet 70 object GeneralTabSheet: TTabSheet
71 Caption = 'General' 71 Caption = 'General'
72 ClientHeight = 502 72 ClientHeight = 527
73 ClientWidth = 939 73 ClientWidth = 939
74 ParentFont = False 74 ParentFont = False
75 object SongInformationGroupbox: TGroupBox 75 object SongInformationGroupbox: TGroupBox
@@ -146,16 +146,16 @@ object frmTracker: TfrmTracker
146 end 146 end
147 object PatternTabSheet: TTabSheet 147 object PatternTabSheet: TTabSheet
148 Caption = 'Patterns' 148 Caption = 'Patterns'
149 ClientHeight = 541 149 ClientHeight = 527
150 ClientWidth = 939 150 ClientWidth = 939
151 ParentFont = False 151 ParentFont = False
152 object Panel3: TPanel 152 object Panel3: TPanel
153 Left = 224 153 Left = 224
154 Height = 541 154 Height = 527
155 Top = 0 155 Top = 0
156 Width = 715 156 Width = 715
157 Align = alClient 157 Align = alClient
158 ClientHeight = 541 158 ClientHeight = 527
159 ClientWidth = 715 159 ClientWidth = 715
160 ParentFont = False 160 ParentFont = False
161 TabOrder = 0 161 TabOrder = 0
@@ -204,7 +204,7 @@ object frmTracker: TfrmTracker
204 end 204 end
205 object ScrollBox1: TScrollBox 205 object ScrollBox1: TScrollBox
206 Left = 1 206 Left = 1
207 Height = 509 207 Height = 495
208 Top = 31 208 Top = 31
209 Width = 713 209 Width = 713
210 HorzScrollBar.Increment = 1 210 HorzScrollBar.Increment = 1
@@ -225,7 +225,7 @@ object frmTracker: TfrmTracker
225 end 225 end
226 object OrderEditStringGrid: TStringGrid 226 object OrderEditStringGrid: TStringGrid
227 Left = 0 227 Left = 0
228 Height = 541 228 Height = 527
229 Top = 0 229 Top = 0
230 Width = 224 230 Width = 224
231 Align = alLeft 231 Align = alLeft
@@ -1689,7 +1689,7 @@ object frmTracker: TfrmTracker
1689 object StatusBar1: TStatusBar 1689 object StatusBar1: TStatusBar
1690 Left = 0 1690 Left = 0
1691 Height = 23 1691 Height = 23
1692 Top = 658 1692 Top = 644
1693 Width = 1145 1693 Width = 1145
1694 AutoHint = True 1694 AutoHint = True
1695 Panels = < 1695 Panels = <
Modifiedtracker.pas +43−11
@@ -368,6 +368,7 @@ type
368 CurrentInstrument: ^TInstrument; 368 CurrentInstrument: ^TInstrument;
369 CurrentWave: ^TWave; 369 CurrentWave: ^TWave;
370 CurrentInstrumentBank: TInstrumentType; 370 CurrentInstrumentBank: TInstrumentType;
371 LoadedFileName: String;
371 372
372 EmulationThread: TThread; 373 EmulationThread: TThread;
373 374
@@ -409,7 +410,8 @@ type
409 procedure OnSampleSongMenuItemClicked(Sender: TObject); 410 procedure OnSampleSongMenuItemClicked(Sender: TObject);
410 411
411 procedure RecreateTrackerGrid; 412 procedure RecreateTrackerGrid;
412 procedure UpdateUIAfterLoad; 413 procedure UpdateUIAfterLoad(FileName: String = '');
414 procedure UpdateWindowTitle;
413 procedure UpdateHexWaveTextbox; 415 procedure UpdateHexWaveTextbox;
414 function CheckUnsavedChanges: Boolean; 416 function CheckUnsavedChanges: Boolean;
415 417
@@ -435,7 +437,7 @@ implementation
435 437
436 { TfrmTracker } 438 { TfrmTracker }
437 439
438 procedure TfrmTracker.UpdateUIAfterLoad; 440 procedure TfrmTracker.UpdateUIAfterLoad(FileName: String = '');
439 var 441 var
440 I: Integer; 442 I: Integer;
441 begin 443 begin
@@ -454,6 +456,9 @@ begin
454 456
455 TicksPerRowSpinEdit.Value := Song.TicksPerRow; 457 TicksPerRowSpinEdit.Value := Song.TicksPerRow;
456 458
459 LoadedFilename := FileName;
460 UpdateWindowTitle;
461
457 RecreateTrackerGrid; 462 RecreateTrackerGrid;
458 CopyOrderMatrixToOrderGrid; 463 CopyOrderMatrixToOrderGrid;
459 464
@@ -483,6 +488,26 @@ begin
483 PageControl1.ActivePageIndex := 0; 488 PageControl1.ActivePageIndex := 0;
484 end; 489 end;
485 490
491 procedure TfrmTracker.UpdateWindowTitle;
492 var
493 S: String;
494 begin
495 S := 'hUGETracker';
496
497 if Trim(LoadedFileName) <> '' then
498 S += ' - '+LoadedFilename;
499
500 if Trim(Song.Name) <> '' then begin
501 S += ' - [';
502 if Trim(Song.Artist) <> '' then
503 S += Song.Artist+' - ';
504
505 S += Song.Name+']';
506 end;
507
508 Self.Caption := S;
509 end;
510
486 procedure TfrmTracker.UpdateHexWaveTextbox; 511 procedure TfrmTracker.UpdateHexWaveTextbox;
487 begin 512 begin
488 HexWaveEdit.Text := ConvertWaveToHexString(WaveEditNumberSpinner.Value); 513 HexWaveEdit.Text := ConvertWaveToHexString(WaveEditNumberSpinner.Value);
@@ -744,7 +769,7 @@ begin
744 end; 769 end;
745 FileSaveAs1.Dialog.FileName := FileName; 770 FileSaveAs1.Dialog.FileName := FileName;
746 771
747 UpdateUIAfterLoad; 772 UpdateUIAfterLoad(Filename);
748 end; 773 end;
749 774
750 procedure TfrmTracker.ReloadPatterns; 775 procedure TfrmTracker.ReloadPatterns;
@@ -1052,6 +1077,7 @@ end;
1052 procedure TfrmTracker.SongEditChange(Sender: TObject); 1077 procedure TfrmTracker.SongEditChange(Sender: TObject);
1053 begin 1078 begin
1054 Song.Name := SongEdit.Text; 1079 Song.Name := SongEdit.Text;
1080 UpdateWindowTitle;
1055 end; 1081 end;
1056 1082
1057 procedure TfrmTracker.StartVolSpinnerChange(Sender: TObject); 1083 procedure TfrmTracker.StartVolSpinnerChange(Sender: TObject);
@@ -1129,7 +1155,7 @@ begin
1129 'the tracker. This likely means that you haven''t extracted the program ' + 1155 'the tracker. This likely means that you haven''t extracted the program ' +
1130 'before running it. Please do so, and relaunch. Thanks!', 1156 'before running it. Please do so, and relaunch. Thanks!',
1131 mtError, [mbOk], 0); 1157 mtError, [mbOk], 0);
1132 Halt; 1158 Application.Terminate;
1133 end; 1159 end;
1134 1160
1135 VisualizerBuffer := TBGRABitmap.Create(Duty1Visualizer.Width, Duty1Visualizer.Height); 1161 VisualizerBuffer := TBGRABitmap.Create(Duty1Visualizer.Width, Duty1Visualizer.Height);
@@ -1185,7 +1211,7 @@ begin
1185 1211
1186 // Start the Oscilloscope repaint timer 1212 // Start the Oscilloscope repaint timer
1187 OscilloscopeUpdateTimer.Enabled := ScopesOn; 1213 OscilloscopeUpdateTimer.Enabled := ScopesOn;
1188 Panel2.height := IfThen(ScopesOn, 64, 0); 1214 Panel2.Visible := ScopesOn;
1189 1215
1190 // Switch to general tab sheet 1216 // Switch to general tab sheet
1191 PageControl1.ActivePageIndex := 0; 1217 PageControl1.ActivePageIndex := 0;
@@ -1208,10 +1234,12 @@ begin
1208 SampleSongsMenuItem.Enabled := False; 1234 SampleSongsMenuItem.Enabled := False;
1209 1235
1210 // If a command line param was passed, try to open it 1236 // If a command line param was passed, try to open it
1211 if FileExists(ParamStr(1)) and (ExtractFileExt(ParamStr(1)) = '.uge') then 1237 if FileExists(ParamStr(1)) and (ExtractFileExt(ParamStr(1)) = '.uge') then begin
1212 LoadSong(ParamStr(1)); 1238 LoadSong(ParamStr(1));
1213 1239 UpdateUIAfterLoad(ParamStr(1));
1214 UpdateUIAfterLoad; 1240 end
1241 else
1242 UpdateUIAfterLoad;
1215 end; 1243 end;
1216 1244
1217 procedure TfrmTracker.FormKeyDown(Sender: TObject; var Key: Word; 1245 procedure TfrmTracker.FormKeyDown(Sender: TObject; var Key: Word;
@@ -1327,6 +1355,7 @@ end;
1327 procedure TfrmTracker.ArtistEditChange(Sender: TObject); 1355 procedure TfrmTracker.ArtistEditChange(Sender: TObject);
1328 begin 1356 begin
1329 Song.Artist := ArtistEdit.Text; 1357 Song.Artist := ArtistEdit.Text;
1358 UpdateWindowTitle;
1330 end; 1359 end;
1331 1360
1332 procedure TfrmTracker.HelpLookupManualExecute(Sender: TObject); 1361 procedure TfrmTracker.HelpLookupManualExecute(Sender: TObject);
@@ -1351,6 +1380,8 @@ begin
1351 try 1380 try
1352 WriteSongToStream(stream, Song); 1381 WriteSongToStream(stream, Song);
1353 SaveSucceeded := True; 1382 SaveSucceeded := True;
1383 LoadedFileName := FileSaveAs1.Dialog.FileName;
1384 UpdateWindowTitle;
1354 finally 1385 finally
1355 stream.Free; 1386 stream.Free;
1356 end; 1387 end;
@@ -1364,6 +1395,7 @@ end;
1364 procedure TfrmTracker.FileOpen1Accept(Sender: TObject); 1395 procedure TfrmTracker.FileOpen1Accept(Sender: TObject);
1365 begin 1396 begin
1366 LoadSong(FileOpen1.Dialog.FileName); 1397 LoadSong(FileOpen1.Dialog.FileName);
1398 UpdateUIAfterLoad(FileOpen1.Dialog.FileName);
1367 end; 1399 end;
1368 1400
1369 procedure TfrmTracker.HeaderControl1MouseDown(Sender: TObject; 1401 procedure TfrmTracker.HeaderControl1MouseDown(Sender: TObject;
@@ -1669,7 +1701,7 @@ end;
1669 procedure TfrmTracker.MenuItem14Click(Sender: TObject); 1701 procedure TfrmTracker.MenuItem14Click(Sender: TObject);
1670 begin 1702 begin
1671 if CheckUnsavedChanges then 1703 if CheckUnsavedChanges then
1672 Halt; 1704 Application.Terminate;
1673 end; 1705 end;
1674 1706
1675 procedure TfrmTracker.MenuItem17Click(Sender: TObject); 1707 procedure TfrmTracker.MenuItem17Click(Sender: TObject);
@@ -1810,7 +1842,7 @@ begin
1810 OptionsFile.WriteInteger('hUGETracker', 'fontsize', TrackerGrid.FontSize); 1842 OptionsFile.WriteInteger('hUGETracker', 'fontsize', TrackerGrid.FontSize);
1811 OptionsFile.WriteBool('hUGETracker', 'ScopesOn', ScopesOn); 1843 OptionsFile.WriteBool('hUGETracker', 'ScopesOn', ScopesOn);
1812 OscilloscopeUpdateTimer.Enabled := ScopesOn; 1844 OscilloscopeUpdateTimer.Enabled := ScopesOn;
1813 Panel2.height := IfThen(ScopesOn, 64, 0); 1845 Panel2.Visible := ScopesOn;
1814 1846
1815 end; 1847 end;
1816 1848
@@ -1846,7 +1878,7 @@ begin
1846 1878
1847 Stream.Free; 1879 Stream.Free;
1848 1880
1849 UpdateUIAfterLoad; 1881 UpdateUIAfterLoad(MODOpenDialog.FileName);
1850 end; 1882 end;
1851 end; 1883 end;
1852 1884