Changeset 681


Ignore:
Timestamp:
Jul 26, 2025, 6:31:47 PM (12 hours ago)
Author:
chronos
Message:
  • Added: Separate music enable and volume controls in Settings dialog.
Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Language.txt

    r676 r681  
    968968DPI
    969969Music
     970Volume
  • trunk/Localization/cs/Language.txt

    r676 r681  
    968968DPI
    969969Hudba
     970Hlasitost
  • trunk/Localization/de/Language.txt

    r676 r681  
    986986DPI
    987987Musik
     988Volume
  • trunk/Localization/fr/Language.txt

    r676 r681  
    968968DPI
    969969Musique
     970Volume
  • trunk/Localization/it/Language.txt

    r676 r681  
    958958DPI
    959959Musica
     960Volume
  • trunk/Localization/ru/Language.txt

    r676 r681  
    993993DPI
    994994Музыка
     995Volume
  • trunk/Localization/zh-Hans/Language.txt

    r676 r681  
    985985DPI
    986986Music
     987Volume
  • trunk/Localization/zh-Hant/Language.txt

    r676 r681  
    985985DPI
    986986Music
     987Volume
  • trunk/Settings.lfm

    r674 r681  
    1515  FormStyle = fsStayOnTop
    1616  Position = poScreenCenter
    17   LCLVersion = '4.0.0.4'
     17  LCLVersion = '4.2.0.0'
    1818  Scaled = False
    1919  OnClose = FormClose
     
    6363  end
    6464  object ButtonFullscreen: TButtonC
    65     Left = 16
     65    Left = 176
    6666    Height = 18
    67     Top = 368
     67    Top = 366
    6868    Width = 18
    6969    Down = False
     
    161161  object ButtonMusicVolumeDown: TButtonC
    162162    Tag = 6912
    163     Left = 136
    164     Height = 12
    165     Top = 340
     163    Left = 144
     164    Height = 12
     165    Top = 372
    166166    Width = 12
    167167    Down = False
     
    172172  object ButtonMusicVolumeUp: TButtonC
    173173    Tag = 6912
    174     Left = 136
    175     Height = 12
    176     Top = 328
     174    Left = 144
     175    Height = 12
     176    Top = 360
    177177    Width = 12
    178178    Down = False
     
    180180    OnClick = ButtonMusicVolumeUpClick
    181181    ButtonIndex = 1
     182  end
     183  object ButtonMusic: TButtonC
     184    Left = 16
     185    Height = 18
     186    Top = 334
     187    Width = 18
     188    Down = False
     189    Permanent = False
     190    OnClick = ButtonMusicClick
     191    ButtonIndex = 0
    182192  end
    183193  object EditShortCutPrimary: TEdit
  • trunk/Settings.pas

    r674 r681  
    1313
    1414  TSettingsDlg = class(TDrawDlg)
     15    ButtonMusic: TButtonC;
    1516    ButtonMusicVolumeDown: TButtonC;
    1617    ButtonMusicVolumeUp: TButtonC;
     
    3334    procedure ButtonFullscreenClick(Sender: TObject);
    3435    procedure ButtonCancelClick(Sender: TObject);
     36    procedure ButtonMusicClick(Sender: TObject);
    3537    procedure ButtonMusicVolumeDownClick(Sender: TObject);
    3638    procedure ButtonMusicVolumeUpClick(Sender: TObject);
     
    5456    LocalGamma: Integer;
    5557    LocalKeyBindings: TKeyBindings;
     58    LocalMusicEnabled: Integer;
    5659    LocalMusicVolume: Integer;
    5760    CurrentKeyBinding: TKeyBinding;
     
    5962    procedure UpdateShortCutItem;
    6063    function GetLocalCustomDpiEnabled: Boolean;
     64    function GetLocalMusicEnabled: Boolean;
    6165    procedure UpdateInterface;
    6266  public
     
    8690var
    8791  SFullScreen, SGamma, SRestartMsg, SShortCutPrimary, SShortCutSecondary,
    88   SLanguages, SKeyBindings, SCustomDpi, SDpi, SMusic: string;
     92  SLanguages, SKeyBindings, SCustomDpi, SDpi, SMusic, SMusicVolume: string;
    8993
    9094procedure ReloadLanguages;
     
    100104  SDpi := Phrases.Lookup('SETTINGS', 8);
    101105  SMusic := Phrases.Lookup('SETTINGS', 9);
     106  SMusicVolume := Phrases.Lookup('SETTINGS', 10);
    102107end;
    103108
     
    123128end;
    124129
     130procedure TSettingsDlg.ButtonMusicClick(Sender: TObject);
     131begin
     132  ButtonMusic.ButtonIndex := ButtonMusic.ButtonIndex xor 1;
     133  UpdateInterface;
     134end;
     135
    125136procedure TSettingsDlg.ButtonMusicVolumeDownClick(Sender: TObject);
    126137begin
     
    142153  ListLanguages.ItemIndex := 0;
    143154  ButtonFullscreen.ButtonIndex := 3;
     155  ButtonMusic.ButtonIndex := 3;
    144156  LocalMusicVolume := 50;
    145157  ButtonCustomDpi.ButtonIndex := 2;
     
    258270  {$ENDIF}
    259271
    260   UnderlinedTitleValue(Canvas, SMusic, IntToStr(LocalMusicVolume) + '%',
     272  RFrame(Canvas, ButtonMusic.Left - 1, ButtonMusic.Top - 1,
     273    ButtonMusic.Left + 12, ButtonMusic.Top + 12, MainTexture.ColorBevelShade,
     274    MainTexture.ColorBevelLight);
     275  LoweredTextOut(Canvas, -2, MainTexture, ButtonMusic.Left + TextDistanceX,
     276    ButtonMusic.Top - 4, SMusic);
     277  UnderlinedTitleValue(Canvas, SMusicVolume, IntToStr(LocalMusicVolume) + '%',
    261278    ButtonMusicVolumeUp.Left - UpDownTextWidth - 4, ButtonMusicVolumeUp.Top + 2, UpDownTextWidth);
    262279
     
    367384end;
    368385
     386function TSettingsDlg.GetLocalMusicEnabled: Boolean;
     387begin
     388  Result := (ButtonMusic.ButtonIndex and 1) = 1;
     389end;
     390
    369391procedure TSettingsDlg.UpdateInterface;
    370392begin
    371393  ButtonDpiUp.Enabled := GetLocalCustomDpiEnabled;
    372394  ButtonDpiDown.Enabled := GetLocalCustomDpiEnabled;
     395  ButtonMusicVolumeDown.Enabled := GetLocalMusicEnabled;
     396  ButtonMusicVolumeUp.Enabled := GetLocalMusicEnabled;
    373397end;
    374398
     
    381405  if FullScreen then ButtonFullscreen.ButtonIndex := 3
    382406    else ButtonFullscreen.ButtonIndex := 2;
    383   if MusicEnabled then LocalMusicVolume := Round(MusicVolume * 100)
    384     else LocalMusicVolume := 0;
     407  if MusicEnabled then ButtonMusic.ButtonIndex := 3
     408    else ButtonMusic.ButtonIndex := 2;
     409  LocalMusicVolume := Round(MusicVolume * 100);
    385410  LocalGamma := Gamma;
    386411  LocalKeyBindings.Assign(KeyBindings.KeyBindings);
     
    406431  end;
    407432  FullScreen := (ButtonFullscreen.ButtonIndex and 1) = 1;
    408   MusicEnabled := LocalMusicVolume > 0;
     433  MusicEnabled := GetLocalMusicEnabled;
    409434  MusicVolume := LocalMusicVolume / 100;
    410435  Gamma := LocalGamma;
Note: See TracChangeset for help on using the changeset viewer.