Changeset 91 for trunk/UCore.pas


Ignore:
Timestamp:
Dec 4, 2014, 10:18:13 PM (10 years ago)
Author:
chronos
Message:
  • Added: Partial support for high DPI screens. Disabled.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UCore.pas

    r83 r91  
    77uses
    88  Classes, SysUtils, XMLConf, FileUtil, ActnList, Controls, Dialogs, Forms,
    9   UGame, UApplicationInfo, UPersistentForm, UCoolTranslator;
     9  UGame, UApplicationInfo, UPersistentForm, UScaleDPI, UCoolTranslator;
    1010
    1111type
     
    3131    PersistentForm: TPersistentForm;
    3232    SaveDialog1: TSaveDialog;
     33    ScaleDPI1: TScaleDPI;
    3334    XMLConfig1: TXMLConfig;
    3435    procedure AAboutExecute(Sender: TObject);
     
    4647  private
    4748    FInitialized: Boolean;
     49    StoredDimension: TControlDimension;
    4850    procedure DoOnMove(CellFrom, CellTo: TCell; var CountOnce,
    4951      CountRepeat: Integer; Update: Boolean; var Confirm: Boolean);
     
    157159  AutoSaveEnabled := XMLConfig1.GetValue('AutoSave', True);
    158160  CoolTranslator1.Language := CoolTranslator1.Languages.SearchByCode(XMLConfig1.GetValue('Language', ''));
     161  ScaleDPI1.DPI := Point(XMLConfig1.GetValue('DPIX', 96), XMLConfig1.GetValue('DPIY', 96));
     162  ScaleDPI1.AutoDetect := XMLConfig1.GetValue('DPIAuto', True);
    159163end;
    160164
     
    166170  XMLConfig1.SetValue('AnimationSpeed', AnimationSpeed);
    167171  XMLConfig1.SetValue('AutoSave', AutoSaveEnabled);
     172  XMLConfig1.SetValue('DPIX', ScaleDPI1.DPI.X);
     173  XMLConfig1.SetValue('DPIY', ScaleDPI1.DPI.Y);
     174  XMLConfig1.SetValue('DPIAuto', ScaleDPI1.AutoDetect);
    168175end;
    169176
     
    291298  Game.OnWin := DoOnWin;
    292299  Game.OnNewTurn := GameNewTurnExecute;
     300  StoredDimension := TControlDimension.Create;
    293301end;
    294302
    295303procedure TCore.DataModuleDestroy(Sender: TObject);
    296304begin
     305  StoredDimension.Free;;
    297306  Game.SaveConfig(XMLConfig1, 'Game');
    298307  SaveConfig;
     
    314323  Game.Running := True;
    315324  FormMain.AZoomAll.Execute;
     325  {with Core.ScaleDPI1 do begin
     326    //ApplyToAll(DesignDPI);
     327    FormNew.Show;
     328    for I := 0 to Screen.FormCount - 1 do begin
     329      StoreDimensions(Screen.Forms[I], StoredDimension);
     330      ScaleDimensions(Screen.Forms[I], StoredDimension);
     331    end;
     332    FormNew.Hide;
     333    ScaleImageList(Core.ImageListSmall, DesignDPI);
     334    ScaleImageList(Core.ImageListLarge, DesignDPI);
     335  end;}
    316336end;
    317337
Note: See TracChangeset for help on using the changeset viewer.