Changeset 88 for trunk/UCore.pas
- Timestamp:
- Aug 29, 2017, 10:33:39 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UCore.pas
r87 r88 7 7 uses 8 8 Classes, SysUtils, FileUtil, UApplicationInfo, ULastOpenedList, UProject, 9 UCoolTranslator, UTarget, URegistry, Registry, Graphics, UScaleDPI,9 UCoolTranslator, UTarget, URegistry, Registry, Graphics, Controls, UScaleDPI, 10 10 UPersistentForm; 11 11 … … 17 17 ApplicationInfo: TApplicationInfo; 18 18 CoolTranslator1: TCoolTranslator; 19 ImageListMain: TImageList; 19 20 LastOpenedList: TLastOpenedList; 20 21 PersistentForm1: TPersistentForm; 22 ScaleDPI1: TScaleDPI; 21 23 procedure DataModuleCreate(Sender: TObject); 22 24 procedure DataModuleDestroy(Sender: TObject); 23 25 private 24 26 FCurrentTarget: TTarget; 27 StoredDimension: TControlDimension; 25 28 procedure SetCurrentTarget(AValue: TTarget); 29 procedure ScaleDPI; 26 30 public 27 ScaleDPI: TScaleDPI;28 31 Project: TProject; 29 32 Targets: TTargetList; … … 32 35 CellSize: Integer; 33 36 MemorySize: Integer; 37 procedure Init; 34 38 procedure LoadFromRegistry(Root: HKEY; Key: string); 35 39 procedure SaveToRegistry(Root: HKEY; Key: string); … … 59 63 begin 60 64 Project := TProject.Create; 61 ScaleDPI := TScaleDPI.Create(nil);62 65 Targets := TTargetList.Create; 66 StoredDimension := TControlDimension.Create; 67 63 68 // Init targets list 64 69 Targets.Add(TTargetInterpretter.Create); … … 83 88 begin 84 89 SaveToRegistry(HKEY(ApplicationInfo.RegistryRoot), ApplicationInfo.RegistryKey); 85 Targets.Free;86 Project.Free;87 ScaleDPI.Free;90 FreeAndNil(Targets); 91 FreeAndNil(Project); 92 FreeAndNil(StoredDimension); 88 93 end; 89 94 … … 98 103 CoolTranslator1.Language := CoolTranslator1.Languages.SearchByCode(ReadStringWithDefault('LanguageCode', '')) 99 104 else CoolTranslator1.Language := CoolTranslator1.Languages.SearchByCode(''); 100 ScaleDPI .DPI := Point(ReadIntegerWithDefault('DPIX', 96),105 ScaleDPI1.DPI := Point(ReadIntegerWithDefault('DPIX', 96), 101 106 ReadIntegerWithDefault('DPIY', 96)); 102 ScaleDPI .AutoDetect := ReadBoolWithDefault('DPIAuto', True);107 ScaleDPI1.AutoDetect := ReadBoolWithDefault('DPIAuto', True); 103 108 OptimizationLevel := TCompilerOptimization(ReadIntegerWithDefault('OptimizationLevel', Integer(coNormal))); 104 109 MemorySize := ReadIntegerWithDefault('MemorySize', 30000); … … 121 126 OpenKey(Key, True); 122 127 WriteBool('OpenProjectOnStart', OpenProjectOnStart); 123 WriteBool('DPIAuto', ScaleDPI .AutoDetect);124 WriteInteger('DPIX', ScaleDPI .DPI.X);125 WriteInteger('DPIY', ScaleDPI .DPI.Y);128 WriteBool('DPIAuto', ScaleDPI1.AutoDetect); 129 WriteInteger('DPIX', ScaleDPI1.DPI.X); 130 WriteInteger('DPIY', ScaleDPI1.DPI.Y); 126 131 WriteInteger('OptimizationLevel', Integer(OptimizationLevel)); 127 132 WriteInteger('MemorySize', MemorySize); … … 157 162 end; 158 163 164 procedure TCore.ScaleDPI; 165 var 166 I: Integer; 167 begin 168 with ScaleDPI1 do begin 169 //DesignDPI := Point(144, 144); 170 if (DesignDPI.X <> DPI.X) or (DesignDPI.Y <> DPI.Y) then begin 171 //ApplyToAll(DesignDPI); 172 for I := 0 to Screen.FormCount - 1 do 173 if (Screen.Forms[I].WindowState = wsNormal) or 174 (Screen.Forms[I].WindowState = wsMinimized) then begin 175 StoreDimensions(Screen.Forms[I], StoredDimension); 176 ScaleDimensions(Screen.Forms[I], StoredDimension); 177 end; 178 ScaleImageList(ImageListMain, DesignDPI); 179 end; 180 end; 181 end; 182 183 procedure TCore.Init; 184 begin 185 ScaleDPI; 186 CoolTranslator1.Translate; 187 end; 159 188 160 189 end.
Note:
See TracChangeset
for help on using the changeset viewer.