Changeset 317 for trunk/Settings.pas


Ignore:
Timestamp:
Mar 19, 2021, 9:59:02 AM (4 years ago)
Author:
chronos
Message:
  • Added: Allow to set gamma corection in settings dialog.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Settings.pas

    r309 r317  
    2828  TSettingsDlg = class(TDrawDlg)
    2929    ButtonFullscreen: TButtonC;
     30    Down2Btn: TButtonC;
    3031    List: TListBox;
    3132    OKBtn: TButtonA;
    3233    CancelBtn: TButtonA;
     34    Up2Btn: TButtonC;
    3335    procedure ButtonFullscreenClick(Sender: TObject);
    3436    procedure CancelBtnClick(Sender: TObject);
     37    procedure Down2BtnClick(Sender: TObject);
    3538    procedure FormCreate(Sender: TObject);
    3639    procedure FormDestroy(Sender: TObject);
     
    3841    procedure FormShow(Sender: TObject);
    3942    procedure OKBtnClick(Sender: TObject);
     43    procedure Up2BtnClick(Sender: TObject);
    4044  private
    41     { private declarations }
     45    LocalGamma: Integer;
    4246  public
    4347    Languages: TLanguages;
     
    111115end;
    112116
     117procedure TSettingsDlg.Down2BtnClick(Sender: TObject);
     118begin
     119  if LocalGamma > 50 then
     120  begin
     121    Dec(LocalGamma);
     122    Invalidate;
     123  end;
     124end;
     125
    113126procedure TSettingsDlg.ButtonFullscreenClick(Sender: TObject);
    114127begin
     
    139152    MainTexture.clBevelLight);
    140153
    141   s := Phrases.Lookup('SETTINGS', 0);
     154  S := Phrases.Lookup('SETTINGS', 0);
    142155  LoweredTextOut(Canvas, -2, MainTexture, ButtonFullscreen.Left + 32,
    143     ButtonFullscreen.Top - 4, s);
     156    ButtonFullscreen.Top - 4, S);
     157
     158  // Gamma
     159  UnderlinedTitleValue(Canvas, Phrases.Lookup('SETTINGS', 1), IntToStr(LocalGamma) + '%',
     160    Up2Btn.Left - 150 - 4, Up2Btn.Top + 2, 150);
    144161end;
    145162
     
    155172  SaveData;
    156173  ModalResult := mrOk;
     174end;
     175
     176procedure TSettingsDlg.Up2BtnClick(Sender: TObject);
     177begin
     178  if LocalGamma < 150 then begin
     179    Inc(LocalGamma);
     180    Invalidate;
     181  end;
    157182end;
    158183
     
    164189  if FullScreen then ButtonFullscreen.ButtonIndex := 3
    165190    else ButtonFullscreen.ButtonIndex := 2;
     191  LocalGamma := Gamma;
    166192end;
    167193
    168194procedure TSettingsDlg.SaveData;
    169 begin
     195var
     196  NeedRestart: Boolean;
     197begin
     198  NeedRestart := Gamma <> LocalGamma;
    170199  LocaleCode := Languages[List.ItemIndex].ShortName;
    171200  FullScreen := (ButtonFullscreen.ButtonIndex and 1) = 1;
     201  Gamma := LocalGamma;
     202  if NeedRestart then SimpleMessage(Phrases.Lookup('SETTINGS', 2));
    172203end;
    173204
Note: See TracChangeset for help on using the changeset viewer.