Changeset 666 for trunk/Settings.pas
- Timestamp:
- Jul 9, 2025, 10:36:23 PM (17 hours ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Settings.pas
r570 r666 13 13 14 14 TSettingsDlg = class(TDrawDlg) 15 ButtonMusicVolumeDown: TButtonC; 16 ButtonMusicVolumeUp: TButtonC; 15 17 ButtonFullscreen: TButtonC; 16 18 ButtonCustomDpi: TButtonC; … … 31 33 procedure ButtonFullscreenClick(Sender: TObject); 32 34 procedure ButtonCancelClick(Sender: TObject); 35 procedure ButtonMusicVolumeDownClick(Sender: TObject); 36 procedure ButtonMusicVolumeUpClick(Sender: TObject); 33 37 procedure ButtonResetClick(Sender: TObject); 34 38 procedure ButtonGammaDownClick(Sender: TObject); … … 48 52 LocalGamma: Integer; 49 53 LocalKeyBindings: TKeyBindings; 54 LocalMusicVolume: Integer; 50 55 CurrentKeyBinding: TKeyBinding; 51 56 LocalDpi: Integer; … … 65 70 DpiMax = 500; 66 71 DpiStep = 25; 72 MusicVolumeMin = 0; 73 MusicVolumeMax = 100; 74 MusicVolumeStep = 10; 67 75 68 76 … … 76 84 var 77 85 SFullScreen, SGamma, SRestartMsg, SShortCutPrimary, SShortCutSecondary, 78 SLanguages, SKeyBindings, SCustomDpi, SDpi : string;86 SLanguages, SKeyBindings, SCustomDpi, SDpi, SMusic: string; 79 87 80 88 procedure ReloadLanguages; … … 89 97 SCustomDpi := Phrases.Lookup('SETTINGS', 7); 90 98 SDpi := Phrases.Lookup('SETTINGS', 8); 99 SMusic := Phrases.Lookup('SETTINGS', 9); 91 100 end; 92 101 … … 112 121 end; 113 122 123 procedure TSettingsDlg.ButtonMusicVolumeDownClick(Sender: TObject); 124 begin 125 Dec(LocalMusicVolume, MusicVolumeStep); 126 if LocalMusicVolume < MusicVolumeMin then LocalMusicVolume := MusicVolumeMin; 127 Invalidate; 128 end; 129 130 procedure TSettingsDlg.ButtonMusicVolumeUpClick(Sender: TObject); 131 begin 132 Inc(LocalMusicVolume, MusicVolumeStep); 133 if LocalMusicVolume > MusicVolumeMax then LocalMusicVolume := MusicVolumeMax; 134 Invalidate; 135 end; 136 114 137 procedure TSettingsDlg.ButtonResetClick(Sender: TObject); 115 138 begin … … 117 140 ListLanguages.ItemIndex := 0; 118 141 ButtonFullscreen.ButtonIndex := 3; 142 LocalMusicVolume := 50; 119 143 ButtonCustomDpi.ButtonIndex := 2; 120 144 LocalDpi := 100; … … 202 226 203 227 procedure TSettingsDlg.FormPaint(Sender: TObject); 228 const 229 TextDistanceX = 20; 230 UpDownTextWidth = 120; 204 231 begin 205 232 PaintBackground(Canvas, 3, 3, ClientWidth - 6, ClientHeight - 6, … … 223 250 ButtonCustomDpi.Left + 12, ButtonCustomDpi.Top + 12, MainTexture.ColorBevelShade, 224 251 MainTexture.ColorBevelLight); 225 LoweredTextOut(Canvas, -2, MainTexture, ButtonCustomDpi.Left + 32,252 LoweredTextOut(Canvas, -2, MainTexture, ButtonCustomDpi.Left + TextDistanceX, 226 253 ButtonCustomDpi.Top - 4, SCustomDpi); 227 254 UnderlinedTitleValue(Canvas, SDpi, IntToStr(LocalDpi) + '%', 228 ButtonDpiUp.Left - 150 - 4, ButtonDpiUp.Top + 2, 150);255 ButtonDpiUp.Left - UpDownTextWidth - 4, ButtonDpiUp.Top + 2, UpDownTextWidth); 229 256 {$ENDIF} 257 258 UnderlinedTitleValue(Canvas, SMusic, IntToStr(LocalMusicVolume) + '%', 259 ButtonMusicVolumeUp.Left - UpDownTextWidth - 4, ButtonMusicVolumeUp.Top + 2, UpDownTextWidth); 230 260 231 261 LoweredTextOut(Canvas, -2, MainTexture, ListLanguages.Left, … … 233 263 LoweredTextOut(Canvas, -2, MainTexture, ListKeyBindings.Left, 234 264 ListKeyBindings.Top - 26, SKeyBindings); 235 LoweredTextOut(Canvas, -2, MainTexture, ButtonFullscreen.Left + 32,265 LoweredTextOut(Canvas, -2, MainTexture, ButtonFullscreen.Left + TextDistanceX, 236 266 ButtonFullscreen.Top - 4, SFullScreen); 237 267 UnderlinedTitleValue(Canvas, SGamma, IntToStr(LocalGamma) + '%', 238 ButtonGammaUp.Left - 150 - 4, ButtonGammaUp.Top + 2, 150);268 ButtonGammaUp.Left - UpDownTextWidth - 4, ButtonGammaUp.Top + 2, UpDownTextWidth); 239 269 LoweredTextOut(Canvas, -2, MainTexture, EditShortCutPrimary.Left, 240 270 EditShortCutPrimary.Top - 26, SShortCutPrimary); … … 343 373 if FullScreen then ButtonFullscreen.ButtonIndex := 3 344 374 else ButtonFullscreen.ButtonIndex := 2; 375 if MusicEnabled then LocalMusicVolume := Round(MusicVolume * 100) 376 else LocalMusicVolume := 0; 345 377 LocalGamma := Gamma; 346 378 LocalKeyBindings.Assign(KeyBindings.KeyBindings); … … 366 398 end; 367 399 FullScreen := (ButtonFullscreen.ButtonIndex and 1) = 1; 400 MusicEnabled := LocalMusicVolume > 0; 401 MusicVolume := LocalMusicVolume / 100; 368 402 Gamma := LocalGamma; 369 403 ScreenTools.CustomDpiEnabled := CustomDpiEnabled;
Note:
See TracChangeset
for help on using the changeset viewer.