Commit d33bdd3

Nick committed on
Add color customization
commit d33bdd31a91a4b03f77d221344c91e7b2ec42346 parent 2d0656f
4 changed files +348−71
Modifiedoptions.lfm +91−30
@@ -178,11 +178,11 @@ object frmOptions: TfrmOptions
178 end 178 end
179 object CustomizationGroupBox: TGroupBox 179 object CustomizationGroupBox: TGroupBox
180 Left = 320 180 Left = 320
181 Height = 512 181 Height = 576
182 Top = 8 182 Top = 8
183 Width = 297 183 Width = 297
184 Caption = 'Customization' 184 Caption = 'Customization'
185 ClientHeight = 492 185 ClientHeight = 556
186 ClientWidth = 293 186 ClientWidth = 293
187 TabOrder = 3 187 TabOrder = 3
188 object Label1: TLabel 188 object Label1: TLabel
@@ -199,11 +199,12 @@ object frmOptions: TfrmOptions
199 Height = 23 199 Height = 23
200 Top = 9 200 Top = 9
201 Width = 123 201 Width = 123
202 OnChange = FontSizeSpinnerChange
202 ParentFont = False 203 ParentFont = False
203 TabOrder = 0 204 TabOrder = 0
204 Value = 12 205 Value = 12
205 end 206 end
206 object ColorButton1: TColorButton 207 object NoteTextColorButton: TColorButton
207 Left = 155 208 Left = 155
208 Height = 25 209 Height = 25
209 Top = 40 210 Top = 40
@@ -211,16 +212,17 @@ object frmOptions: TfrmOptions
211 BorderWidth = 2 212 BorderWidth = 2
212 ButtonColorSize = 16 213 ButtonColorSize = 16
213 ButtonColor = 8342016 214 ButtonColor = 8342016
215 OnColorChanged = NoteTextColorButtonColorChanged
214 end 216 end
215 object Label2: TLabel 217 object Label2: TLabel
216 Left = 16 218 Left = 14
217 Height = 15 219 Height = 15
218 Top = 40 220 Top = 40
219 Width = 79 221 Width = 79
220 Caption = 'Note text color' 222 Caption = 'Note text color'
221 ParentColor = False 223 ParentColor = False
222 end 224 end
223 object ColorButton2: TColorButton 225 object InstrumentTextColorButton: TColorButton
224 Left = 155 226 Left = 155
225 Height = 25 227 Height = 25
226 Top = 72 228 Top = 72
@@ -228,8 +230,9 @@ object frmOptions: TfrmOptions
228 BorderWidth = 2 230 BorderWidth = 2
229 ButtonColorSize = 16 231 ButtonColorSize = 16
230 ButtonColor = 8355584 232 ButtonColor = 8355584
233 OnColorChanged = NoteTextColorButtonColorChanged
231 end 234 end
232 object ColorButton3: TColorButton 235 object MiscEffectTextColorButton: TColorButton
233 Left = 155 236 Left = 155
234 Height = 25 237 Height = 25
235 Top = 104 238 Top = 104
@@ -237,8 +240,9 @@ object frmOptions: TfrmOptions
237 BorderWidth = 2 240 BorderWidth = 2
238 ButtonColorSize = 16 241 ButtonColorSize = 16
239 ButtonColor = 4145020 242 ButtonColor = 4145020
243 OnColorChanged = NoteTextColorButtonColorChanged
240 end 244 end
241 object ColorButton4: TColorButton 245 object PitchEffectTextColorButton: TColorButton
242 Left = 155 246 Left = 155
243 Height = 25 247 Height = 25
244 Top = 136 248 Top = 136
@@ -246,8 +250,9 @@ object frmOptions: TfrmOptions
246 BorderWidth = 2 250 BorderWidth = 2
247 ButtonColorSize = 16 251 ButtonColorSize = 16
248 ButtonColor = 25186 252 ButtonColor = 25186
253 OnColorChanged = NoteTextColorButtonColorChanged
249 end 254 end
250 object ColorButton5: TColorButton 255 object VolumeEffectTextColorButton: TColorButton
251 Left = 155 256 Left = 155
252 Height = 25 257 Height = 25
253 Top = 168 258 Top = 168
@@ -255,8 +260,9 @@ object frmOptions: TfrmOptions
255 BorderWidth = 2 260 BorderWidth = 2
256 ButtonColorSize = 16 261 ButtonColorSize = 16
257 ButtonColor = 32550 262 ButtonColor = 32550
263 OnColorChanged = NoteTextColorButtonColorChanged
258 end 264 end
259 object ColorButton6: TColorButton 265 object PanningEffectTextColorButton: TColorButton
260 Left = 155 266 Left = 155
261 Height = 25 267 Height = 25
262 Top = 200 268 Top = 200
@@ -264,8 +270,9 @@ object frmOptions: TfrmOptions
264 BorderWidth = 2 270 BorderWidth = 2
265 ButtonColorSize = 16 271 ButtonColorSize = 16
266 ButtonColor = 8355584 272 ButtonColor = 8355584
273 OnColorChanged = NoteTextColorButtonColorChanged
267 end 274 end
268 object ColorButton7: TColorButton 275 object SongEffectTextColorButton: TColorButton
269 Left = 155 276 Left = 155
270 Height = 25 277 Height = 25
271 Top = 232 278 Top = 232
@@ -273,9 +280,10 @@ object frmOptions: TfrmOptions
273 BorderWidth = 2 280 BorderWidth = 2
274 ButtonColorSize = 16 281 ButtonColorSize = 16
275 ButtonColor = 127 282 ButtonColor = 127
283 OnColorChanged = NoteTextColorButtonColorChanged
276 end 284 end
277 object Label3: TLabel 285 object Label3: TLabel
278 Left = 16 286 Left = 14
279 Height = 15 287 Height = 15
280 Top = 72 288 Top = 72
281 Width = 111 289 Width = 111
@@ -283,7 +291,7 @@ object frmOptions: TfrmOptions
283 ParentColor = False 291 ParentColor = False
284 end 292 end
285 object Label4: TLabel 293 object Label4: TLabel
286 Left = 16 294 Left = 14
287 Height = 15 295 Height = 15
288 Top = 104 296 Top = 104
289 Width = 114 297 Width = 114
@@ -291,7 +299,7 @@ object frmOptions: TfrmOptions
291 ParentColor = False 299 ParentColor = False
292 end 300 end
293 object Label5: TLabel 301 object Label5: TLabel
294 Left = 16 302 Left = 14
295 Height = 15 303 Height = 15
296 Top = 136 304 Top = 136
297 Width = 113 305 Width = 113
@@ -299,7 +307,7 @@ object frmOptions: TfrmOptions
299 ParentColor = False 307 ParentColor = False
300 end 308 end
301 object Label6: TLabel 309 object Label6: TLabel
302 Left = 16 310 Left = 14
303 Height = 15 311 Height = 15
304 Top = 168 312 Top = 168
305 Width = 126 313 Width = 126
@@ -307,7 +315,7 @@ object frmOptions: TfrmOptions
307 ParentColor = False 315 ParentColor = False
308 end 316 end
309 object Label7: TLabel 317 object Label7: TLabel
310 Left = 16 318 Left = 14
311 Height = 15 319 Height = 15
312 Top = 200 320 Top = 200
313 Width = 130 321 Width = 130
@@ -315,14 +323,14 @@ object frmOptions: TfrmOptions
315 ParentColor = False 323 ParentColor = False
316 end 324 end
317 object Label8: TLabel 325 object Label8: TLabel
318 Left = 16 326 Left = 14
319 Height = 15 327 Height = 15
320 Top = 232 328 Top = 232
321 Width = 113 329 Width = 113
322 Caption = 'Song effect text color' 330 Caption = 'Song effect text color'
323 ParentColor = False 331 ParentColor = False
324 end 332 end
325 object ColorButton8: TColorButton 333 object BackgroundColorButton: TColorButton
326 Left = 155 334 Left = 155
327 Height = 25 335 Height = 25
328 Top = 264 336 Top = 264
@@ -330,8 +338,9 @@ object frmOptions: TfrmOptions
330 BorderWidth = 2 338 BorderWidth = 2
331 ButtonColorSize = 16 339 ButtonColorSize = 16
332 ButtonColor = 13687777 340 ButtonColor = 13687777
341 OnColorChanged = NoteTextColorButtonColorChanged
333 end 342 end
334 object ColorButton9: TColorButton 343 object HighlightedColorButton: TColorButton
335 Left = 155 344 Left = 155
336 Height = 25 345 Height = 25
337 Top = 296 346 Top = 296
@@ -339,8 +348,9 @@ object frmOptions: TfrmOptions
339 BorderWidth = 2 348 BorderWidth = 2
340 ButtonColorSize = 16 349 ButtonColorSize = 16
341 ButtonColor = 8034729 350 ButtonColor = 8034729
351 OnColorChanged = NoteTextColorButtonColorChanged
342 end 352 end
343 object ColorButton10: TColorButton 353 object SelectedColorButton: TColorButton
344 Left = 155 354 Left = 155
345 Height = 25 355 Height = 25
346 Top = 328 356 Top = 328
@@ -348,8 +358,9 @@ object frmOptions: TfrmOptions
348 BorderWidth = 2 358 BorderWidth = 2
349 ButtonColorSize = 16 359 ButtonColorSize = 16
350 ButtonColor = 10400960 360 ButtonColor = 10400960
361 OnColorChanged = NoteTextColorButtonColorChanged
351 end 362 end
352 object ColorButton11: TColorButton 363 object FourthRowColorButton: TColorButton
353 Left = 155 364 Left = 155
354 Height = 25 365 Height = 25
355 Top = 360 366 Top = 360
@@ -357,8 +368,9 @@ object frmOptions: TfrmOptions
357 BorderWidth = 2 368 BorderWidth = 2
358 ButtonColorSize = 16 369 ButtonColorSize = 16
359 ButtonColor = 12833240 370 ButtonColor = 12833240
371 OnColorChanged = NoteTextColorButtonColorChanged
360 end 372 end
361 object ColorButton12: TColorButton 373 object SixteenthRowColorButton: TColorButton
362 Left = 155 374 Left = 155
363 Height = 25 375 Height = 25
364 Top = 392 376 Top = 392
@@ -366,9 +378,10 @@ object frmOptions: TfrmOptions
366 BorderWidth = 2 378 BorderWidth = 2
367 ButtonColorSize = 16 379 ButtonColorSize = 16
368 ButtonColor = 11912654 380 ButtonColor = 11912654
381 OnColorChanged = NoteTextColorButtonColorChanged
369 end 382 end
370 object Label9: TLabel 383 object Label9: TLabel
371 Left = 16 384 Left = 14
372 Height = 15 385 Height = 15
373 Top = 264 386 Top = 264
374 Width = 64 387 Width = 64
@@ -376,7 +389,7 @@ object frmOptions: TfrmOptions
376 ParentColor = False 389 ParentColor = False
377 end 390 end
378 object Label10: TLabel 391 object Label10: TLabel
379 Left = 16 392 Left = 14
380 Height = 15 393 Height = 15
381 Top = 296 394 Top = 296
382 Width = 63 395 Width = 63
@@ -384,7 +397,7 @@ object frmOptions: TfrmOptions
384 ParentColor = False 397 ParentColor = False
385 end 398 end
386 object Label11: TLabel 399 object Label11: TLabel
387 Left = 16 400 Left = 14
388 Height = 15 401 Height = 15
389 Top = 328 402 Top = 328
390 Width = 44 403 Width = 44
@@ -392,7 +405,7 @@ object frmOptions: TfrmOptions
392 ParentColor = False 405 ParentColor = False
393 end 406 end
394 object Label12: TLabel 407 object Label12: TLabel
395 Left = 16 408 Left = 14
396 Height = 15 409 Height = 15
397 Top = 360 410 Top = 360
398 Width = 87 411 Width = 87
@@ -407,7 +420,7 @@ object frmOptions: TfrmOptions
407 Caption = 'Every sixteenth row' 420 Caption = 'Every sixteenth row'
408 ParentColor = False 421 ParentColor = False
409 end 422 end
410 object ColorButton13: TColorButton 423 object DotsColorButton: TColorButton
411 Left = 155 424 Left = 155
412 Height = 25 425 Height = 25
413 Top = 424 426 Top = 424
@@ -415,8 +428,9 @@ object frmOptions: TfrmOptions
415 BorderWidth = 2 428 BorderWidth = 2
416 ButtonColorSize = 16 429 ButtonColorSize = 16
417 ButtonColor = clGray 430 ButtonColor = clGray
431 OnColorChanged = NoteTextColorButtonColorChanged
418 end 432 end
419 object ColorButton14: TColorButton 433 object DividersColorButton: TColorButton
420 Left = 155 434 Left = 155
421 Height = 25 435 Height = 25
422 Top = 456 436 Top = 456
@@ -424,6 +438,7 @@ object frmOptions: TfrmOptions
424 BorderWidth = 2 438 BorderWidth = 2
425 ButtonColorSize = 16 439 ButtonColorSize = 16
426 ButtonColor = 11253692 440 ButtonColor = 11253692
441 OnColorChanged = NoteTextColorButtonColorChanged
427 end 442 end
428 object Label14: TLabel 443 object Label14: TLabel
429 Left = 14 444 Left = 14
@@ -434,21 +449,59 @@ object frmOptions: TfrmOptions
434 ParentColor = False 449 ParentColor = False
435 end 450 end
436 object Label15: TLabel 451 object Label15: TLabel
437 Left = 16 452 Left = 14
438 Height = 15 453 Height = 15
439 Top = 456 454 Top = 456
440 Width = 42 455 Width = 42
441 Caption = 'Dividers' 456 Caption = 'Dividers'
442 ParentColor = False 457 ParentColor = False
443 end 458 end
459 object Button6: TButton
460 Left = 56
461 Height = 25
462 Top = 520
463 Width = 188
464 Caption = 'Reset palette to default'
465 OnClick = Button6Click
466 TabOrder = 1
467 end
468 object Button7: TButton
469 Left = 56
470 Height = 25
471 Top = 493
472 Width = 90
473 Caption = 'Load palette'
474 OnClick = Button7Click
475 TabOrder = 2
476 end
477 object Button8: TButton
478 Left = 154
479 Height = 25
480 Top = 493
481 Width = 90
482 Caption = 'Save palette'
483 OnClick = Button8Click
484 TabOrder = 3
485 end
444 end 486 end
445 object Panel1: TPanel 487 object Panel1: TPanel
446 Left = 632 488 Left = 632
447 Height = 625 489 Height = 618
448 Top = 8 490 Top = 8
449 Width = 282 491 Width = 280
450 BevelWidth = 3 492 BevelWidth = 3
493 ClientHeight = 618
494 ClientWidth = 280
451 TabOrder = 4 495 TabOrder = 4
496 object SampleTrackerGridPanel: TPanel
497 Left = 3
498 Height = 612
499 Top = 3
500 Width = 274
501 Align = alClient
502 BevelOuter = bvNone
503 TabOrder = 0
504 end
452 end 505 end
453 object SaveDialog1: TSaveDialog 506 object SaveDialog1: TSaveDialog
454 Left = 56 507 Left = 56
@@ -485,4 +538,12 @@ object frmOptions: TfrmOptions
485 Left = 96 538 Left = 96
486 Top = 640 539 Top = 640
487 end 540 end
541 object SaveDialog2: TSaveDialog
542 Left = 400
543 Top = 592
544 end
545 object OpenDialog2: TOpenDialog
546 Left = 504
547 Top = 592
548 end
488 end 549 end
Modifiedoptions.pas +232−16
@@ -6,7 +6,8 @@ interface
6 6
7 uses 7 uses
8 Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, Spin, Grids, 8 Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, Spin, Grids,
9 LCLProc, Buttons, ExtCtrls, Constants, Keymap, hUGESettings; 9 LCLProc, Buttons, ExtCtrls, Constants, Keymap, hUGESettings, hUGEDataTypes,
10 TrackerGrid;
10 11
11 type 12 type
12 13
@@ -18,20 +19,26 @@ type
18 Button3: TButton; 19 Button3: TButton;
19 Button4: TButton; 20 Button4: TButton;
20 Button5: TButton; 21 Button5: TButton;
21 ColorButton1: TColorButton; 22 Button6: TButton;
22 ColorButton10: TColorButton; 23 Button7: TButton;
23 ColorButton11: TColorButton; 24 Button8: TButton;
24 ColorButton12: TColorButton; 25 NoteTextColorButton: TColorButton;
25 ColorButton13: TColorButton; 26 OpenDialog2: TOpenDialog;
26 ColorButton14: TColorButton; 27 Panel1: TPanel;
27 ColorButton2: TColorButton; 28 SaveDialog2: TSaveDialog;
28 ColorButton3: TColorButton; 29 SelectedColorButton: TColorButton;
29 ColorButton4: TColorButton; 30 FourthRowColorButton: TColorButton;
30 ColorButton5: TColorButton; 31 SixteenthRowColorButton: TColorButton;
31 ColorButton6: TColorButton; 32 DotsColorButton: TColorButton;
32 ColorButton7: TColorButton; 33 DividersColorButton: TColorButton;
33 ColorButton8: TColorButton; 34 InstrumentTextColorButton: TColorButton;
34 ColorButton9: TColorButton; 35 MiscEffectTextColorButton: TColorButton;
36 PitchEffectTextColorButton: TColorButton;
37 VolumeEffectTextColorButton: TColorButton;
38 PanningEffectTextColorButton: TColorButton;
39 SongEffectTextColorButton: TColorButton;
40 BackgroundColorButton: TColorButton;
41 HighlightedColorButton: TColorButton;
35 ColorDialog1: TColorDialog; 42 ColorDialog1: TColorDialog;
36 DisplayHexRowNumbersCheck: TCheckBox; 43 DisplayHexRowNumbersCheck: TCheckBox;
37 CustomizationGroupBox: TGroupBox; 44 CustomizationGroupBox: TGroupBox;
@@ -50,7 +57,7 @@ type
50 Label8: TLabel; 57 Label8: TLabel;
51 Label9: TLabel; 58 Label9: TLabel;
52 OptionsGroupBox: TGroupBox; 59 OptionsGroupBox: TGroupBox;
53 Panel1: TPanel; 60 SampleTrackerGridPanel: TPanel;
54 PreviewWhenPlacingCheck: TCheckBox; 61 PreviewWhenPlacingCheck: TCheckBox;
55 PreviewWhenBumpingCheck: TCheckBox; 62 PreviewWhenBumpingCheck: TCheckBox;
56 KeymapCheckbox: TCheckBox; 63 KeymapCheckbox: TCheckBox;
@@ -66,13 +73,25 @@ type
66 procedure Button3Click(Sender: TObject); 73 procedure Button3Click(Sender: TObject);
67 procedure Button4Click(Sender: TObject); 74 procedure Button4Click(Sender: TObject);
68 procedure Button5Click(Sender: TObject); 75 procedure Button5Click(Sender: TObject);
76 procedure Button6Click(Sender: TObject);
77 procedure Button7Click(Sender: TObject);
78 procedure Button8Click(Sender: TObject);
79 procedure FontSizeSpinnerChange(Sender: TObject);
69 procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); 80 procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
70 procedure FormCreate(Sender: TObject); 81 procedure FormCreate(Sender: TObject);
71 procedure KeymapCheckboxChange(Sender: TObject); 82 procedure KeymapCheckboxChange(Sender: TObject);
72 procedure KeyMapStringGridValidateEntry(sender: TObject; aCol, aRow: Integer; 83 procedure KeyMapStringGridValidateEntry(sender: TObject; aCol, aRow: Integer;
73 const OldValue: string; var NewValue: String); 84 const OldValue: string; var NewValue: String);
85 procedure NoteTextColorButtonColorChanged(Sender: TObject);
74 private 86 private
87 SamplePatternMap: TPatternMap;
88 SampleTrackerGrid: TTrackerGrid;
89 LoadingColors: Boolean;
75 90
91 procedure RecreateTrackerGrid;
92 procedure UpdateTrackerGridColors;
93 procedure SaveColorsToFile(Filename: String);
94 procedure LoadColorsFromFile(Filename: String);
76 public 95 public
77 96
78 end; 97 end;
@@ -114,9 +133,49 @@ begin
114 KeyMapStringGrid.InsertRowWithValues(KeyMapStringGrid.RowCount, ['', '']); 133 KeyMapStringGrid.InsertRowWithValues(KeyMapStringGrid.RowCount, ['', '']);
115 end; 134 end;
116 135
136 procedure TfrmOptions.Button6Click(Sender: TObject);
137 begin
138 NoteTextColorButton.ButtonColor := $007F4A00;
139 InstrumentTextColorButton.ButtonColor := $007F7F00;
140 MiscEffectTextColorButton.ButtonColor := $003F3F7C;
141 PitchEffectTextColorButton.ButtonColor := $00006262;
142 VolumeEffectTextColorButton.ButtonColor := $00007F26;
143 PanningEffectTextColorButton.ButtonColor := $007F7F00;
144 SongEffectTextColorButton.ButtonColor := $0000007F;
145 BackgroundColorButton.ButtonColor := $00D0DBE1;
146 HighlightedColorButton.ButtonColor := $007A99A9;
147 SelectedColorButton.ButtonColor := $009EB4C0;
148 FourthRowColorButton.ButtonColor := $00C3D1D8;
149 SixteenthRowColorButton.ButtonColor := $00B5C5CE;
150 DotsColorButton.ButtonColor := clGray;
151 DividersColorButton.ButtonColor := $00ABB7BC;
152
153 UpdateTrackerGridColors;
154 end;
155
156 procedure TfrmOptions.Button7Click(Sender: TObject);
157 begin
158 if OpenDialog2.Execute then
159 LoadColorsFromFile(OpenDialog2.FileName);
160 end;
161
162 procedure TfrmOptions.Button8Click(Sender: TObject);
163 begin
164 if SaveDialog2.Execute then
165 SaveColorsToFile(SaveDialog2.FileName);
166 end;
167
168 procedure TfrmOptions.FontSizeSpinnerChange(Sender: TObject);
169 begin
170 if Visible then // Don't do this while the form is being constructed.
171 RecreateTrackerGrid;
172 end;
173
117 procedure TfrmOptions.FormClose(Sender: TObject; var CloseAction: TCloseAction); 174 procedure TfrmOptions.FormClose(Sender: TObject; var CloseAction: TCloseAction);
118 begin 175 begin
119 KeyMapStringGrid.SaveToFile('custom_keymap.km'); 176 KeyMapStringGrid.SaveToFile('custom_keymap.km');
177 SaveColorsToFile('color_scheme.col');
178
120 TrackerSettings.PatternEditorFontSize := FontSizeSpinner.Value; 179 TrackerSettings.PatternEditorFontSize := FontSizeSpinner.Value;
121 TrackerSettings.UseScopes := ScopesCheck.Checked; 180 TrackerSettings.UseScopes := ScopesCheck.Checked;
122 TrackerSettings.UseCustomKeymap := KeymapCheckbox.Checked; 181 TrackerSettings.UseCustomKeymap := KeymapCheckbox.Checked;
@@ -126,18 +185,36 @@ begin
126 end; 185 end;
127 186
128 procedure TfrmOptions.FormCreate(Sender: TObject); 187 procedure TfrmOptions.FormCreate(Sender: TObject);
188 var
189 SamplePattern: PPattern;
190 I: Integer;
129 begin 191 begin
130 KeyMapStringGrid.SaveOptions := soAll; 192 KeyMapStringGrid.SaveOptions := soAll;
131 193
132 if FileExists('custom_keymap.km') then 194 if FileExists('custom_keymap.km') then
133 KeyMapStringGrid.LoadFromFile('custom_keymap.km'); 195 KeyMapStringGrid.LoadFromFile('custom_keymap.km');
134 196
197 if FileExists('color_scheme.col') then
198 LoadColorsFromFile('color_scheme.col');
199
135 FontSizeSpinner.Value := TrackerSettings.PatternEditorFontSize; 200 FontSizeSpinner.Value := TrackerSettings.PatternEditorFontSize;
136 ScopesCheck.Checked := TrackerSettings.UseScopes; 201 ScopesCheck.Checked := TrackerSettings.UseScopes;
137 KeymapCheckbox.Checked := TrackerSettings.UseCustomKeymap; 202 KeymapCheckbox.Checked := TrackerSettings.UseCustomKeymap;
138 PreviewWhenPlacingCheck.Checked := TrackerSettings.PreviewWhenPlacing; 203 PreviewWhenPlacingCheck.Checked := TrackerSettings.PreviewWhenPlacing;
139 PreviewWhenBumpingCheck.Checked := TrackerSettings.PreviewWhenBumping; 204 PreviewWhenBumpingCheck.Checked := TrackerSettings.PreviewWhenBumping;
140 DisplayHexRowNumbersCheck.Checked := TrackerSettings.DisplayRowNumbersAsHex; 205 DisplayHexRowNumbersCheck.Checked := TrackerSettings.DisplayRowNumbersAsHex;
206
207 SamplePatternMap := TPatternMap.Create;
208 SamplePattern := SamplePatternMap.GetOrCreateNew(0);
209
210 for I := $0 to $F do begin
211 SamplePattern^[I*2].Note := I;
212 SamplePattern^[I*2].Instrument := Random(15);
213 SamplePattern^[I*2].EffectCode := I;
214 SamplePattern^[I*2].EffectParams.Value := Random($FF);
215 end;
216
217 RecreateTrackerGrid;
141 end; 218 end;
142 219
143 procedure TfrmOptions.KeymapCheckboxChange(Sender: TObject); 220 procedure TfrmOptions.KeymapCheckboxChange(Sender: TObject);
@@ -159,5 +236,144 @@ begin
159 end; 236 end;
160 end; 237 end;
161 238
239 procedure TfrmOptions.NoteTextColorButtonColorChanged(Sender: TObject);
240 begin
241 if not LoadingColors then
242 UpdateTrackerGridColors;
243 end;
244
245 procedure TfrmOptions.RecreateTrackerGrid;
246 var
247 I: Integer;
248 begin
249 if Assigned(SampleTrackerGrid) then
250 SampleTrackerGrid.Free;
251
252 SampleTrackerGrid := TTrackerGrid.Create(Self, SampleTrackerGridPanel, SamplePatternMap);
253 SampleTrackerGrid.FontSize := FontSizeSpinner.Value;
254 for I := 0 to 3 do
255 SampleTrackerGrid.LoadPattern(I, 0);
256
257 SampleTrackerGridPanel.Invalidate;
258 end;
259
260 procedure TfrmOptions.UpdateTrackerGridColors;
261 begin
262 clNote := NoteTextColorButton.ButtonColor;
263 clInstrument := InstrumentTextColorButton.ButtonColor;
264
265 clFxMisc := MiscEffectTextColorButton.ButtonColor;
266 clFxPitch := PitchEffectTextColorButton.ButtonColor;
267 clFxVolume := VolumeEffectTextColorButton.ButtonColor;
268 clFxPan := PanningEffectTextColorButton.ButtonColor;
269 clFxSong := SongEffectTextColorButton.ButtonColor;
270
271 clBackground := BackgroundColorButton.ButtonColor;
272 clHighlighted := HighlightedColorButton.ButtonColor;
273 clSelected := SelectedColorButton.ButtonColor;
274
275 clLineFour := FourthRowColorButton.ButtonColor;
276 clLineSixteen := SixteenthRowColorButton.ButtonColor;
277
278 clDots := DotsColorButton.ButtonColor;
279 clDividers := DividersColorButton.ButtonColor;
280
281 SampleTrackerGridPanel.Invalidate;
282 end;
283
284 procedure TfrmOptions.SaveColorsToFile(Filename: String);
285 var
286 F: file of TColor;
287 begin
288 try
289 AssignFile(F, Filename);
290 Rewrite(F);
291
292 Write(F, clNote);
293 Write(F, clInstrument);
294
295 Write(F, clFxMisc);
296 Write(F, clFxPitch);
297 Write(F, clFxVolume);
298 Write(F, clFxPan);
299 Write(F, clFxSong);
300
301 Write(F, clBackground);
302 Write(F, clHighlighted);
303 Write(F, clSelected);
304
305 Write(F, clLineFour);
306 Write(F, clLineSixteen);
307
308 Write(F, clDots);
309 Write(F, clDividers);
310
311 CloseFile(F);
312 except
313 on E: Exception do begin
314 ShowMessage('Couldn''t load colors from ' + Filename);
315 end;
316 end;
317 end;
318
319 procedure TfrmOptions.LoadColorsFromFile(Filename: String);
320 var
321 F: file of TColor;
322 begin
323 LoadingColors := True;
324 try
325 AssignFile(F, Filename);
326 Reset(F);
327
328 Read(F, clNote);
329 Read(F, clInstrument);
330
331 Read(F, clFxMisc);
332 Read(F, clFxPitch);
333 Read(F, clFxVolume);
334 Read(F, clFxPan);
335 Read(F, clFxSong);
336
337 Read(F, clBackground);
338 Read(F, clHighlighted);
339 Read(F, clSelected);
340
341 Read(F, clLineFour);
342 Read(F, clLineSixteen);
343
344 Read(F, clDots);
345 Read(F, clDividers);
346
347 CloseFile(F);
348 except
349 on E: Exception do begin
350 ShowMessage('Couldn''t load colors from ' + Filename);
351 end;
352 end;
353
354 NoteTextColorButton.ButtonColor := clNote;
355 InstrumentTextColorButton.ButtonColor := clInstrument;
356
357 MiscEffectTextColorButton.ButtonColor := clFxMisc;
358 PitchEffectTextColorButton.ButtonColor := clFxPitch;
359 VolumeEffectTextColorButton.ButtonColor := clFxVolume;
360 PanningEffectTextColorButton.ButtonColor := clFxPan;
361 SongEffectTextColorButton.ButtonColor := clFxSong;
362
363 BackgroundColorButton.ButtonColor := clBackground;
364 HighlightedColorButton.ButtonColor := clHighlighted;
365 SelectedColorButton.ButtonColor := clSelected;
366
367 FourthRowColorButton.ButtonColor := clLineFour;
368 SixteenthRowColorButton.ButtonColor := clLineSixteen;
369
370 DotsColorButton.ButtonColor := clDots;
371 DividersColorButton.ButtonColor := clDividers;
372
373 LoadingColors := False;
374
375 SampleTrackerGridPanel.Invalidate;
376 end;
377
162 end. 378 end.
163 379
Modifiedtrackergrid.pas +20−20
@@ -11,26 +11,6 @@ uses
11 11
12 // TODO: Maybe read these from a config file 12 // TODO: Maybe read these from a config file
13 const 13 const
14 clNote = TColor($7F4A00);
15 clInstrument = TColor($7F7F00);
16 //clVolume = TColor($99FFB7); unused
17
18 clFxMisc = TColor($3F3F7C);
19 clFxPitch = TColor($006262);
20 clFxVolume = TColor($007F26);
21 clFxPan = TColor($7F7F00);
22 clFxSong = TColor($00007F);
23
24 clBackground = TColor($D0DBE1);
25 clHighlighted = TColor($7A99A9);
26 clSelected = TColor($9EB4C0);
27
28 clLineFour = TColor($C3D1D8);
29 clLineSixteen = TColor($B5C5CE);
30
31 clDots = clGray;
32 clDividers = TColor($ABB7BC);
33
34 NUM_COLUMNS = 4; 14 NUM_COLUMNS = 4;
35 NUM_ROWS = 64; 15 NUM_ROWS = 64;
36 UNDO_STACK_SIZE = 100; 16 UNDO_STACK_SIZE = 100;
@@ -179,6 +159,26 @@ type
179 destructor Destroy; override; 159 destructor Destroy; override;
180 end; 160 end;
181 161
162 var
163 clNote: TColor = TColor($7F4A00);
164 clInstrument: TColor = TColor($7F7F00);
165
166 clFxMisc: TColor = TColor($3F3F7C);
167 clFxPitch: TColor = TColor($006262);
168 clFxVolume: TColor = TColor($007F26);
169 clFxPan: TColor = TColor($7F7F00);
170 clFxSong: TColor = TColor($00007F);
171
172 clBackground: TColor = TColor($D0DBE1);
173 clHighlighted: TColor = TColor($7A99A9);
174 clSelected: TColor = TColor($9EB4C0);
175
176 clLineFour: TColor = TColor($C3D1D8);
177 clLineSixteen: TColor = TColor($B5C5CE);
178
179 clDots: TColor = clGray;
180 clDividers: TColor = TColor($ABB7BC);
181
182 implementation 182 implementation
183 183
184 { TSelectionEnumerator } 184 { TSelectionEnumerator }
Modifiedutils.pas +5−5
@@ -93,11 +93,11 @@ begin
93 $A: Result := 'Increase volume by '+IntToStr(Params.Param1)+' units, decrease volume by '+IntToStr(Params.Param2)+' units'; 93 $A: Result := 'Increase volume by '+IntToStr(Params.Param1)+' units, decrease volume by '+IntToStr(Params.Param2)+' units';
94 $B: Result := 'Jump to order '+P; 94 $B: Result := 'Jump to order '+P;
95 $C: begin 95 $C: begin
96 if (Params.Value < 16) then Result := 'Keep envelope, Set volume to '+IntToStr(Params.Param2)+'/15' 96 if (Params.Value < 16) then Result := 'Keep envelope, Set volume to '+IntToStr(Params.Param2)+'/15'
97 else if (Params.Value < 128) then Result := 'Envelope Down '+IntToStr(Params.Param1)+'/64Hz, Set volume to '+IntToStr(Params.Param2)+'/15' 97 else if (Params.Value < 128) then Result := 'Envelope Down '+IntToStr(Params.Param1)+'/64Hz, Set volume to '+IntToStr(Params.Param2)+'/15'
98 else if (Params.Value < 144) then Result := 'Envelope Off, Set volume to '+IntToStr(Params.Param2)+'/15' 98 else if (Params.Value < 144) then Result := 'Envelope Off, Set volume to '+IntToStr(Params.Param2)+'/15'
99 else Result := 'Envelope Up '+IntToStr(Params.Param1-8)+'/64Hz, Set volume to '+IntToStr(Params.Param2)+'/15' 99 else Result := 'Envelope Up '+IntToStr(Params.Param1-8)+'/64Hz, Set volume to '+IntToStr(Params.Param2)+'/15'
100 end; 100 end;
101 $D: Result := 'Jump to row '+P+' on the next pattern'; 101 $D: Result := 'Jump to row '+P+' on the next pattern';
102 $E: Result := 'Cut note after '+P+' ticks'; 102 $E: Result := 'Cut note after '+P+' ticks';
103 $F: Result := 'Set speed to '+P+' ticks'; 103 $F: Result := 'Set speed to '+P+' ticks';