Commit 067a7be

Nick committed on
Converting Pixelite to a TTF file (finally!!!)
commit 067a7becacaae5527c3be1b02a925fa0454d42fe parent 7667ae2
8 changed files +174−38
ModifiedGBEmu.lpi +7−1
@@ -97,7 +97,7 @@
97 <PackageName Value="LCL"/> 97 <PackageName Value="LCL"/>
98 </Item5> 98 </Item5>
99 </RequiredPackages> 99 </RequiredPackages>
100 <Units Count="22"> 100 <Units Count="23">
101 <Unit0> 101 <Unit0>
102 <Filename Value="GBEmu.lpr"/> 102 <Filename Value="GBEmu.lpr"/>
103 <IsPartOfProject Value="True"/> 103 <IsPartOfProject Value="True"/>
@@ -212,6 +212,12 @@
212 <HasResources Value="True"/> 212 <HasResources Value="True"/>
213 <ResourceBaseClass Value="Form"/> 213 <ResourceBaseClass Value="Form"/>
214 </Unit21> 214 </Unit21>
215 <Unit22>
216 <Filename Value="options.pas"/>
217 <IsPartOfProject Value="True"/>
218 <ComponentName Value="frmOptions"/>
219 <ResourceBaseClass Value="Form"/>
220 </Unit22>
215 </Units> 221 </Units>
216 </ProjectOptions> 222 </ProjectOptions>
217 <CompilerOptions> 223 <CompilerOptions>
ModifiedGBEmu.lpr +2−1
@@ -14,7 +14,7 @@ uses
14 Z80CPU in 'CPU\z80cpu.pas', 14 Z80CPU in 'CPU\z80cpu.pas',
15 sound in 'Sound\sound.pas', 15 sound in 'Sound\sound.pas',
16 vars in 'Global\vars.pas', 16 vars in 'Global\vars.pas',
17 mainloop in 'mainloop.pas'; 17 mainloop in 'mainloop.pas', options;
18 18
19 {.$R *.RES} 19 {.$R *.RES}
20 20
@@ -25,5 +25,6 @@ begin
25 Application.Title:='hUGETracker'; 25 Application.Title:='hUGETracker';
26 Application.Initialize; 26 Application.Initialize;
27 Application.CreateForm(TfrmTracker, frmTracker); 27 Application.CreateForm(TfrmTracker, frmTracker);
28 Application.CreateForm(TfrmOptions, frmOptions);
28 Application.Run; 29 Application.Run;
29 end. 30 end.
Addedoptions.lfm +37−0
@@ -0,0 +1,37 @@
1 object frmOptions: TfrmOptions
2 Left = 739
3 Height = 300
4 Top = 371
5 Width = 614
6 BorderStyle = bsDialog
7 Caption = 'Options'
8 ClientHeight = 300
9 ClientWidth = 614
10 DesignTimePPI = 168
11 LCLVersion = '2.0.6.0'
12 object Label1: TLabel
13 Left = 24
14 Height = 30
15 Top = 24
16 Width = 211
17 Caption = 'Pattern editor font size'
18 ParentColor = False
19 end
20 object Button1: TButton
21 Left = 200
22 Height = 44
23 Top = 224
24 Width = 216
25 Caption = 'OK'
26 OnClick = Button1Click
27 TabOrder = 0
28 end
29 object FontSizeSpinner: TSpinEdit
30 Left = 272
31 Height = 38
32 Top = 16
33 Width = 216
34 TabOrder = 1
35 Value = 12
36 end
37 end
Addedoptions.pas +40−0
@@ -0,0 +1,40 @@
1 unit options;
2
3 {$mode objfpc}{$H+}
4
5 interface
6
7 uses
8 Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, Spin;
9
10 type
11
12 { TfrmOptions }
13
14 TfrmOptions = class(TForm)
15 Button1: TButton;
16 Label1: TLabel;
17 FontSizeSpinner: TSpinEdit;
18 procedure Button1Click(Sender: TObject);
19 private
20
21 public
22
23 end;
24
25 var
26 frmOptions: TfrmOptions;
27
28 implementation
29
30 {$R *.lfm}
31
32 { TfrmOptions }
33
34 procedure TfrmOptions.Button1Click(Sender: TObject);
35 begin
36 Close;
37 end;
38
39 end.
40
Modifiedtracker.lfm +23−17
@@ -1,7 +1,7 @@
1 object frmTracker: TfrmTracker 1 object frmTracker: TfrmTracker
2 Left = 825 2 Left = 998
3 Height = 1250 3 Height = 1250
4 Top = 233 4 Top = 237
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 = GeneralTabSheet 60 ActivePage = PatternTabSheet
61 Align = alClient 61 Align = alClient
62 ParentFont = False 62 ParentFont = False
63 TabIndex = 0 63 TabIndex = 1
64 TabOrder = 0 64 TabOrder = 0
65 object GeneralTabSheet: TTabSheet 65 object GeneralTabSheet: TTabSheet
66 Caption = 'General' 66 Caption = 'General'
@@ -906,16 +906,16 @@ object frmTracker: TfrmTracker
906 end 906 end
907 object WavesTabSheet: TTabSheet 907 object WavesTabSheet: TTabSheet
908 Caption = 'Waves' 908 Caption = 'Waves'
909 ClientHeight = 802 909 ClientHeight = 777
910 ClientWidth = 1701 910 ClientWidth = 1712
911 ParentFont = False 911 ParentFont = False
912 object WaveEditPaintBox: TPaintBox 912 object WaveEditPaintBox: TPaintBox
913 AnchorSideTop.Control = WaveEditGroupBox 913 AnchorSideTop.Control = WaveEditGroupBox
914 AnchorSideTop.Side = asrBottom 914 AnchorSideTop.Side = asrBottom
915 Left = 0 915 Left = 0
916 Height = 522 916 Height = 497
917 Top = 280 917 Top = 280
918 Width = 1701 918 Width = 1712
919 Align = alBottom 919 Align = alBottom
920 Anchors = [akTop, akLeft, akRight, akBottom] 920 Anchors = [akTop, akLeft, akRight, akBottom]
921 BorderSpacing.Top = 23 921 BorderSpacing.Top = 23
@@ -980,17 +980,17 @@ object frmTracker: TfrmTracker
980 end 980 end
981 object CommentsTabSheet: TTabSheet 981 object CommentsTabSheet: TTabSheet
982 Caption = 'Comments' 982 Caption = 'Comments'
983 ClientHeight = 802 983 ClientHeight = 777
984 ClientWidth = 1701 984 ClientWidth = 1712
985 ParentFont = False 985 ParentFont = False
986 object CommentMemo: TMemo 986 object CommentMemo: TMemo
987 AnchorSideTop.Control = Label17 987 AnchorSideTop.Control = Label17
988 AnchorSideTop.Side = asrBottom 988 AnchorSideTop.Side = asrBottom
989 Left = 0 989 Left = 0
990 Height = 735 990 Height = 710
991 Hint = 'The comments section for your song. Greetings/links/etc' 991 Hint = 'The comments section for your song. Greetings/links/etc'
992 Top = 67 992 Top = 67
993 Width = 1701 993 Width = 1712
994 Align = alBottom 994 Align = alBottom
995 Anchors = [akTop, akLeft, akRight, akBottom] 995 Anchors = [akTop, akLeft, akRight, akBottom]
996 BorderSpacing.Top = 23 996 BorderSpacing.Top = 23
@@ -1010,17 +1010,16 @@ object frmTracker: TfrmTracker
1010 end 1010 end
1011 object RoutinesTabSheet: TTabSheet 1011 object RoutinesTabSheet: TTabSheet
1012 Caption = 'Routines' 1012 Caption = 'Routines'
1013 ClientHeight = 802 1013 ClientHeight = 777
1014 ClientWidth = 1701 1014 ClientWidth = 1712
1015 Enabled = False
1016 ParentFont = False 1015 ParentFont = False
1017 inline RoutineSynedit: TSynEdit 1016 inline RoutineSynedit: TSynEdit
1018 AnchorSideTop.Control = Label19 1017 AnchorSideTop.Control = Label19
1019 AnchorSideTop.Side = asrBottom 1018 AnchorSideTop.Side = asrBottom
1020 Left = 0 1019 Left = 0
1021 Height = 559 1020 Height = 534
1022 Top = 243 1021 Top = 243
1023 Width = 1701 1022 Width = 1712
1024 Align = alBottom 1023 Align = alBottom
1025 BorderSpacing.Top = 23 1024 BorderSpacing.Top = 23
1026 Anchors = [akTop, akLeft, akRight, akBottom] 1025 Anchors = [akTop, akLeft, akRight, akBottom]
@@ -1902,6 +1901,13 @@ object frmTracker: TfrmTracker
1902 ShortCut = 16473 1901 ShortCut = 16473
1903 OnClick = MenuItem8Click 1902 OnClick = MenuItem8Click
1904 end 1903 end
1904 object MenuItem25: TMenuItem
1905 Caption = '-'
1906 end
1907 object MenuItem26: TMenuItem
1908 Caption = 'Options ...'
1909 OnClick = MenuItem26Click
1910 end
1905 end 1911 end
1906 object MenuItem10: TMenuItem 1912 object MenuItem10: TMenuItem
1907 Caption = 'View' 1913 Caption = 'View'
Modifiedtracker.pas +31−6
@@ -9,8 +9,8 @@ uses
9 Menus, Spin, StdCtrls, ActnList, StdActns, SynEdit, math, Instruments, Waves, 9 Menus, Spin, StdCtrls, ActnList, StdActns, SynEdit, math, Instruments, Waves,
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, 12 HugeDatatypes, LCLType, IniPropStorage, RackCtls, Codegen,
13 SymParser; 13 SymParser, options, IniFiles;
14 14
15 type 15 type
16 { TfrmTracker } 16 { TfrmTracker }
@@ -29,6 +29,8 @@ type
29 MenuItem23: TMenuItem; 29 MenuItem23: TMenuItem;
30 MenuItem24: TMenuItem; 30 MenuItem24: TMenuItem;
31 FontSizeToggleMenuItem: TMenuItem; 31 FontSizeToggleMenuItem: TMenuItem;
32 MenuItem25: TMenuItem;
33 MenuItem26: TMenuItem;
32 MenuItem8: TMenuItem; 34 MenuItem8: TMenuItem;
33 NoteHaltTimer: TTimer; 35 NoteHaltTimer: TTimer;
34 StartVolTrackbar: TTrackBar; 36 StartVolTrackbar: TTrackBar;
@@ -224,6 +226,7 @@ type
224 procedure MenuItem21Click(Sender: TObject); 226 procedure MenuItem21Click(Sender: TObject);
225 procedure MenuItem22Click(Sender: TObject); 227 procedure MenuItem22Click(Sender: TObject);
226 procedure FontSizeToggleMenuItemClick(Sender: TObject); 228 procedure FontSizeToggleMenuItemClick(Sender: TObject);
229 procedure MenuItem26Click(Sender: TObject);
227 procedure MenuItem5Click(Sender: TObject); 230 procedure MenuItem5Click(Sender: TObject);
228 procedure MenuItem8Click(Sender: TObject); 231 procedure MenuItem8Click(Sender: TObject);
229 procedure NoiseVisualizerPaint(Sender: TObject); 232 procedure NoiseVisualizerPaint(Sender: TObject);
@@ -292,6 +295,7 @@ type
292 {PatternsNode, }InstrumentsNode, WavesNode, RoutinesNode: TTreeNode; 295 {PatternsNode, }InstrumentsNode, WavesNode, RoutinesNode: TTreeNode;
293 296
294 SymbolTable: TSymbolMap; 297 SymbolTable: TSymbolMap;
298 OptionsFile: TIniFile;
295 299
296 procedure ChangeToSquare; 300 procedure ChangeToSquare;
297 procedure ChangeToWave; 301 procedure ChangeToWave;
@@ -322,6 +326,7 @@ type
322 procedure PreviewC5; 326 procedure PreviewC5;
323 procedure Panic; 327 procedure Panic;
324 public 328 public
329 procedure OnTrackerGridResize(Sender: TObject);
325 330
326 end; 331 end;
327 332
@@ -501,6 +506,15 @@ begin
501 Spokeb(NR44, %10000000); 506 Spokeb(NR44, %10000000);
502 end; 507 end;
503 508
509 procedure TfrmTracker.OnTrackerGridResize(Sender: TObject);
510 var
511 Section: TCollectionItem;
512 begin
513 // Fix the size of the channel headers
514 for Section in HeaderControl1.Sections do
515 (Section as THeaderSection).Width := TrackerGrid.ColumnWidth;
516 end;
517
504 procedure TfrmTracker.LoadWave(Wave: Integer); 518 procedure TfrmTracker.LoadWave(Wave: Integer);
505 begin 519 begin
506 CurrentWave := @Song.Waves[Wave]; 520 CurrentWave := @Song.Waves[Wave];
@@ -665,6 +679,9 @@ var
665 begin 679 begin
666 if Assigned(TrackerGrid) then TrackerGrid.Free; 680 if Assigned(TrackerGrid) then TrackerGrid.Free;
667 TrackerGrid := TTrackerGrid.Create(Self, ScrollBox1, Song.Patterns); 681 TrackerGrid := TTrackerGrid.Create(Self, ScrollBox1, Song.Patterns);
682 TrackerGrid.OnResize:=@OnTrackerGridResize;
683
684 TrackerGrid.FontSize := OptionsFile.ReadInteger('hUGETracker', 'fontsize', 12);
668 685
669 // Fix the size of the channel headers 686 // Fix the size of the channel headers
670 for Section in HeaderControl1.Sections do 687 for Section in HeaderControl1.Sections do
@@ -875,6 +892,7 @@ begin
875 892
876 ReturnNilIfGrowHeapFails := False; 893 ReturnNilIfGrowHeapFails := False;
877 PreviewingInstrument := -1; 894 PreviewingInstrument := -1;
895 OptionsFile := TINIFile.Create('options.ini');
878 896
879 InitializeSong(Song); 897 InitializeSong(Song);
880 898
@@ -918,7 +936,7 @@ begin
918 EmulationThread.Start; 936 EmulationThread.Start;
919 ResetEmulationThread; //TODO: remove this hack 937 ResetEmulationThread; //TODO: remove this hack
920 938
921 if (not FileExists('firstrun')) and FileExists('Sample Songs\Cognition.uge') then begin 939 if (not OptionsFile.ReadBool('hUGETracker', 'firstrun', False)) and FileExists('Sample Songs\Cognition.uge') then begin
922 stream := TFileStream.Create('Sample Songs\Cognition.uge', fmOpenRead); 940 stream := TFileStream.Create('Sample Songs\Cognition.uge', fmOpenRead);
923 try 941 try
924 ReadSongFromStream(stream, Song); 942 ReadSongFromStream(stream, Song);
@@ -927,9 +945,7 @@ begin
927 end; 945 end;
928 UpdateUIAfterLoad; 946 UpdateUIAfterLoad;
929 947
930 AssignFile(F, 'firstrun'); 948 OptionsFile.WriteBool('hUGETracker', 'firstrun', True);
931 Rewrite(F);
932 CloseFile(F);
933 end; 949 end;
934 end; 950 end;
935 951
@@ -1319,6 +1335,15 @@ begin
1319 1335
1320 end; 1336 end;
1321 1337
1338 procedure TfrmTracker.MenuItem26Click(Sender: TObject);
1339 begin
1340 frmOptions.FontSizeSpinner.Value := TrackerGrid.FontSize;
1341 frmOptions.ShowModal;
1342 TrackerGrid.FontSize := frmOptions.FontSizeSpinner.Value;
1343
1344 OptionsFile.WriteInteger('hUGETracker', 'fontsize', TrackerGrid.FontSize);
1345 end;
1346
1322 procedure TfrmTracker.MenuItem5Click(Sender: TObject); 1347 procedure TfrmTracker.MenuItem5Click(Sender: TObject);
1323 var 1348 var
1324 AboutForm: TfrmAboutHugeTracker; 1349 AboutForm: TfrmAboutHugeTracker;
Modifiedtrackergrid.pas +34−13
@@ -99,6 +99,8 @@ type
99 function MousePosToSelection(X, Y: Integer): TSelectionPos; 99 function MousePosToSelection(X, Y: Integer): TSelectionPos;
100 function KeycodeToHexNumber(Key: Word; out Num: Nibble): Boolean; overload; 100 function KeycodeToHexNumber(Key: Word; out Num: Nibble): Boolean; overload;
101 function KeycodeToHexNumber(Key: Word; out Num: Integer): Boolean; overload; 101 function KeycodeToHexNumber(Key: Word; out Num: Integer): Boolean; overload;
102
103 procedure ChangeFontSize;
102 private 104 private
103 PatternMap: TPatternMap; 105 PatternMap: TPatternMap;
104 Patterns: TPatternGrid; 106 Patterns: TPatternGrid;
@@ -114,6 +116,8 @@ type
114 Recall: TRedoStack; 116 Recall: TRedoStack;
115 117
116 FHighlightedRow: Integer; 118 FHighlightedRow: Integer;
119 FFontSize: Integer;
120 procedure SetFontSize(AValue: Integer);
117 public 121 public
118 Cursor, Other: TSelectionPos; 122 Cursor, Other: TSelectionPos;
119 ColumnWidth, RowHeight: Integer; 123 ColumnWidth, RowHeight: Integer;
@@ -122,6 +126,7 @@ type
122 126
123 property HighlightedRow: Integer read FHighlightedRow write SetHighlightedRow; 127 property HighlightedRow: Integer read FHighlightedRow write SetHighlightedRow;
124 property SelectionGridRect: TRect read GetSelectionGridRect write SetSelectionGridRect; 128 property SelectionGridRect: TRect read GetSelectionGridRect write SetSelectionGridRect;
129 property FontSize: Integer read FFontSize write SetFontSize;
125 procedure LoadPattern(Idx: Integer; PatternNumber: Integer); 130 procedure LoadPattern(Idx: Integer; PatternNumber: Integer);
126 131
127 function GetAt(SelectionPos: TSelectionPos): Integer; 132 function GetAt(SelectionPos: TSelectionPos): Integer;
@@ -200,6 +205,8 @@ constructor TTrackerGrid.Create(
200 begin 205 begin
201 inherited Create(AOwner); 206 inherited Create(AOwner);
202 207
208 FFontSize := 12;
209
203 Self.PatternMap := PatternMap; 210 Self.PatternMap := PatternMap;
204 211
205 Performed := TUndoDeque.Create; 212 Performed := TUndoDeque.Create;
@@ -209,19 +216,7 @@ begin
209 ControlStyle := ControlStyle + [csCaptureMouse, csClickEvents, csDoubleClicks]; 216 ControlStyle := ControlStyle + [csCaptureMouse, csClickEvents, csDoubleClicks];
210 Self.Parent := Parent; 217 Self.Parent := Parent;
211 218
212 // Kind of a hack 219 ChangeFontSize;
213 with Canvas.Font do begin
214 Name := 'Pixelite';
215 Size := 12;
216 ColumnWidth := GetTextWidth('C-5 01v64C01 ');
217 RowHeight := GetTextHeight('C-5 01v64C01 ');
218
219 CharHeight := RowHeight;
220 CharWidth := GetTextWidth('C');
221 end;
222
223 Width := ColumnWidth*4;
224 Height := RowHeight*64;
225 220
226 SelectedInstrument := 0; 221 SelectedInstrument := 0;
227 SelectedOctave := 0; 222 SelectedOctave := 0;
@@ -960,6 +955,32 @@ begin
960 Num := X; 955 Num := X;
961 end; 956 end;
962 957
958 procedure TTrackerGrid.ChangeFontSize;
959 begin
960 // Kind of a hack
961 with Canvas.Font do begin
962 Name := 'PixeliteTTF';
963 Size := FontSize;
964 ColumnWidth := GetTextWidth('C-5 01v64C01 ');
965 RowHeight := GetTextHeight('C-5 01v64C01 ');
966
967 CharHeight := RowHeight;
968 CharWidth := GetTextWidth('C');
969 end;
970
971 Width := ColumnWidth*4;
972 Height := RowHeight*64;
973 end;
974
975 procedure TTrackerGrid.SetFontSize(AValue: Integer);
976 begin
977 if FFontSize=AValue then Exit;
978 FFontSize:=AValue;
979
980 ChangeFontSize;
981 Invalidate;
982 end;
983
963 function TTrackerGrid.GetAt(SelectionPos: TSelectionPos): Integer; 984 function TTrackerGrid.GetAt(SelectionPos: TSelectionPos): Integer;
964 begin 985 begin
965 with Patterns[SelectionPos.X]^[SelectionPos.Y] do 986 with Patterns[SelectionPos.X]^[SelectionPos.Y] do