Ignore:
Timestamp:
Dec 3, 2014, 9:09:42 PM (10 years ago)
Author:
chronos
Message:
  • Added: Support for high DPI screens. If not detected automatically correctly then user can specify desired values.
  • Updated: Common package to newer version.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormOptions.pas

    r51 r59  
    11unit UFormOptions;
    22
    3 {$mode objfpc}{$H+}
     3{$mode delphi}{$H+}
    44
    55interface
     
    77uses
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
    9   Spin, ComCtrls, UTargetInterpretter;
     9  Spin, UTargetInterpretter;
    1010
    1111type
     
    1717    ButtonCancel: TButton;
    1818    CheckBox1: TCheckBox;
     19    CheckBoxDPIAuto: TCheckBox;
    1920    ComboBoxLanguage: TComboBox;
    2021    Label1: TLabel;
    2122    Label2: TLabel;
    2223    Label3: TLabel;
     24    LabelDPI: TLabel;
     25    LabelX: TLabel;
     26    SpinEditDPIX: TSpinEdit;
     27    SpinEditDPIY: TSpinEdit;
    2328    SpinEditCellSize: TSpinEdit;
    2429    SpinEditMemorySize: TSpinEdit;
    2530    procedure ButtonOkClick(Sender: TObject);
     31    procedure CheckBoxDPIAutoChange(Sender: TObject);
    2632    procedure FormShow(Sender: TObject);
    2733  private
    2834    { private declarations }
    2935  public
     36    procedure UpdateInterface;
     37    procedure Load;
     38    procedure Save;
    3039    procedure LoadFromInterpretter(Interpretter: TTargetInterpretter);
    3140    procedure SaveToInterpretter(Interpretter: TTargetInterpretter);
     
    5261end;
    5362
     63procedure TOptionsForm.UpdateInterface;
     64begin
     65  SpinEditDPIX.Enabled := not CheckBoxDPIAuto.Checked;
     66  SpinEditDPIY.Enabled := not CheckBoxDPIAuto.Checked;
     67  LabelDPI.Enabled := not CheckBoxDPIAuto.Checked;
     68  LabelX.Enabled := not CheckBoxDPIAuto.Checked;
     69  if CheckBoxDPIAuto.Checked then begin
     70    SpinEditDPIX.Value := ScreenInfo.PixelsPerInchX;
     71    SpinEditDPIY.Value := ScreenInfo.PixelsPerInchY;
     72  end;
     73end;
     74
     75procedure TOptionsForm.Load;
     76begin
     77  SpinEditDPIX.Value := Core.ScaleDPI.DPI.X;
     78  SpinEditDPIY.Value := Core.ScaleDPI.DPI.Y;
     79  CheckBoxDPIAuto.Checked := Core.ScaleDPI.AutoDetect;
     80  UpdateInterface;
     81end;
     82
     83procedure TOptionsForm.Save;
     84begin
     85  Core.ScaleDPI.DPI.X := SpinEditDPIX.Value;
     86  Core.ScaleDPI.DPI.Y := SpinEditDPIY.Value;
     87  Core.ScaleDPI.AutoDetect := CheckBoxDPIAuto.Checked;
     88end;
     89
    5490procedure TOptionsForm.ButtonOkClick(Sender: TObject);
    5591begin
     
    5793    Core.CoolTranslator1.Language := TLanguage(ComboBoxLanguage.Items.Objects[ComboBoxLanguage.ItemIndex]);
    5894  Core.OpenProjectOnStart := CheckBox1.Checked;
     95end;
     96
     97procedure TOptionsForm.CheckBoxDPIAutoChange(Sender: TObject);
     98begin
     99  UpdateInterface;
    59100end;
    60101
Note: See TracChangeset for help on using the changeset viewer.