Changeset 473 for trunk/Settings.pas
- Timestamp:
- Dec 4, 2023, 12:13:15 PM (12 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Settings.pas
r471 r473 14 14 TSettingsDlg = class(TDrawDlg) 15 15 ButtonFullscreen: TButtonC; 16 Down2Btn: TButtonC; 16 ButtonCustomDpi: TButtonC; 17 ButtonGammaDown: TButtonC; 18 ButtonDpiDown: TButtonC; 17 19 EditShortCutPrimary: TEdit; 18 20 EditShortCutSecondary: TEdit; … … 22 24 ButtonCancel: TButtonA; 23 25 ButtonReset: TButtonA; 24 Up2Btn: TButtonC; 26 ButtonGammaUp: TButtonC; 27 ButtonDpiUp: TButtonC; 28 procedure ButtonCustomDpiClick(Sender: TObject); 29 procedure ButtonDpiDownClick(Sender: TObject); 30 procedure ButtonDpiUpClick(Sender: TObject); 25 31 procedure ButtonFullscreenClick(Sender: TObject); 26 32 procedure ButtonCancelClick(Sender: TObject); 27 33 procedure ButtonResetClick(Sender: TObject); 28 procedure Down2BtnClick(Sender: TObject);34 procedure ButtonGammaDownClick(Sender: TObject); 29 35 procedure EditShortCutPrimaryKeyUp(Sender: TObject; var Key: Word; 30 36 Shift: TShiftState); … … 38 44 procedure ListKeyBindingsSelectionChange(Sender: TObject; User: Boolean); 39 45 procedure ButtonOkClick(Sender: TObject); 40 procedure Up2BtnClick(Sender: TObject);46 procedure ButtonGammaUpClick(Sender: TObject); 41 47 private 42 48 LocalGamma: Integer; 43 49 LocalKeyBindings: TKeyBindings; 44 50 CurrentKeyBinding: TKeyBinding; 51 LocalDpi: Integer; 45 52 procedure UpdateShortCutItem; 53 function GetLocalCustomDpiEnabled: Boolean; 46 54 public 47 55 procedure LoadData; … … 62 70 var 63 71 SFullScreen, SGamma, SRestartMsg, SShortCutPrimary, SShortCutSecondary, 64 SLanguages, SKeyBindings : string;72 SLanguages, SKeyBindings, SCustomDpi, SDpi: string; 65 73 66 74 procedure ReloadLanguages; … … 73 81 SLanguages := Phrases.Lookup('SETTINGS', 5); 74 82 SKeyBindings := Phrases.Lookup('SETTINGS', 6); 83 SCustomDpi := Phrases.Lookup('SETTINGS', 7); 84 SDpi := Phrases.Lookup('SETTINGS', 8); 75 85 end; 76 86 … … 108 118 end; 109 119 110 procedure TSettingsDlg. Down2BtnClick(Sender: TObject);120 procedure TSettingsDlg.ButtonGammaDownClick(Sender: TObject); 111 121 begin 112 122 if LocalGamma > 50 then … … 156 166 end; 157 167 168 procedure TSettingsDlg.ButtonDpiDownClick(Sender: TObject); 169 begin 170 if LocalDpi >= 105 then 171 begin 172 Dec(LocalDpi, 5); 173 Invalidate; 174 end; 175 end; 176 177 procedure TSettingsDlg.ButtonCustomDpiClick(Sender: TObject); 178 begin 179 ButtonCustomDpi.ButtonIndex := ButtonCustomDpi.ButtonIndex xor 1; 180 end; 181 182 procedure TSettingsDlg.ButtonDpiUpClick(Sender: TObject); 183 begin 184 if LocalDpi <= 495 then begin 185 Inc(LocalDpi, 5); 186 Invalidate; 187 end; 188 end; 189 158 190 procedure TSettingsDlg.FormDestroy(Sender: TObject); 159 191 begin … … 163 195 procedure TSettingsDlg.FormPaint(Sender: TObject); 164 196 begin 165 PaintBackground( self, 3, 3, ClientWidth - 6, ClientHeight - 6);197 PaintBackground(Self, 3, 3, ClientWidth - 6, ClientHeight - 6); 166 198 Frame(Canvas, 0, 0, ClientWidth - 1, ClientHeight - 1, 0, 0); 167 199 Frame(Canvas, 1, 1, ClientWidth - 2, ClientHeight - 2, … … 178 210 ButtonFullscreen.Left + 12, ButtonFullscreen.Top + 12, MainTexture.ColorBevelShade, 179 211 MainTexture.ColorBevelLight); 212 {$IFDEF DPI} 213 RFrame(Canvas, ButtonCustomDpi.Left - 1, ButtonCustomDpi.Top - 1, 214 ButtonCustomDpi.Left + 12, ButtonCustomDpi.Top + 12, MainTexture.ColorBevelShade, 215 MainTexture.ColorBevelLight); 216 LoweredTextOut(Canvas, -2, MainTexture, ButtonCustomDpi.Left + 32, 217 ButtonCustomDpi.Top - 4, SCustomDpi); 218 UnderlinedTitleValue(Canvas, SDpi, IntToStr(LocalDpi) + '%', 219 ButtonDpiUp.Left - 150 - 4, ButtonDpiUp.Top + 2, 150); 220 {$ENDIF} 180 221 181 222 LoweredTextOut(Canvas, -2, MainTexture, ListLanguages.Left, … … 186 227 ButtonFullscreen.Top - 4, SFullScreen); 187 228 UnderlinedTitleValue(Canvas, SGamma, IntToStr(LocalGamma) + '%', 188 Up2Btn.Left - 150 - 4, Up2Btn.Top + 2, 150);229 ButtonGammaUp.Left - 150 - 4, ButtonGammaUp.Top + 2, 150); 189 230 LoweredTextOut(Canvas, -2, MainTexture, EditShortCutPrimary.Left, 190 231 EditShortCutPrimary.Top - 26, SShortCutPrimary); … … 204 245 EditShortCutPrimary.Font.Color := MainTexture.ColorMark; 205 246 EditShortCutSecondary.Font.Color := MainTexture.ColorMark; 247 {$IFDEF DPI} 248 ButtonCustomDpi.Visible := True; 249 ButtonDpiDown.Visible := True; 250 ButtonDpiUp.Visible := True; 251 {$ELSE} 252 ButtonCustomDpi.Visible := False; 253 ButtonDpiDown.Visible := False; 254 ButtonDpiUp.Visible := False; 255 {$ENDIF} 206 256 end; 207 257 … … 241 291 end; 242 292 243 procedure TSettingsDlg. Up2BtnClick(Sender: TObject);293 procedure TSettingsDlg.ButtonGammaUpClick(Sender: TObject); 244 294 begin 245 295 if LocalGamma < 150 then begin … … 262 312 end; 263 313 314 function TSettingsDlg.GetLocalCustomDpiEnabled: Boolean; 315 begin 316 Result := (ButtonCustomDpi.ButtonIndex and 1) = 1; 317 end; 318 264 319 procedure TSettingsDlg.LoadData; 265 320 begin … … 272 327 LocalGamma := Gamma; 273 328 LocalKeyBindings.Assign(KeyBindings.KeyBindings); 329 {$IFDEF DPI} 330 if CustomDpiEnabled then ButtonCustomDpi.ButtonIndex := 3 331 else ButtonCustomDpi.ButtonIndex := 2; 332 LocalDpi := Round(CustomDpi * 100 / 96); 333 {$ENDIF} 274 334 end; 275 335 … … 278 338 NeedRestart: Boolean; 279 339 begin 280 NeedRestart := Gamma <> LocalGamma; 340 NeedRestart := (Gamma <> LocalGamma) or (CustomDpiEnabled <> GetLocalCustomDpiEnabled) or 341 ((GetLocalCustomDpiEnabled and (LocalDpi <> CustomDpi))); 281 342 if ListLanguages.ItemIndex <> -1 then begin 282 343 StartDlg.Translator.Language := TLanguage(ListLanguages.Items.Objects[ListLanguages.ItemIndex]); … … 288 349 FullScreen := (ButtonFullscreen.ButtonIndex and 1) = 1; 289 350 Gamma := LocalGamma; 351 ScreenTools.CustomDpiEnabled := CustomDpiEnabled; 290 352 if NeedRestart then SimpleMessage(SRestartMsg); 291 353 KeyBindings.KeyBindings.Assign(LocalKeyBindings); 354 {$IFDEF DPI} 355 CustomDpiEnabled := GetLocalCustomDpiEnabled; 356 CustomDpi := Round(LocalDpi * 96 / 100); 357 {$ENDIF} 292 358 end; 293 359
Note:
See TracChangeset
for help on using the changeset viewer.