Changeset 104 for trunk/UCore.pas
- Timestamp:
- Oct 11, 2016, 9:49:16 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UCore.pas
r99 r104 7 7 uses 8 8 Classes, SysUtils, FileUtil, UAcronym, UCoolTranslator, UPersistentForm, 9 UJobProgressView, Forms, Controls, LazFileUtils; 9 UJobProgressView, UScaleDPI, Forms, Controls, LazFileUtils, URegistry, 10 Registry; 10 11 11 12 type … … 17 18 JobProgressView1: TJobProgressView; 18 19 PersistentForm1: TPersistentForm; 20 ScaleDPI1: TScaleDPI; 19 21 procedure CoolTranslator1Translate(Sender: TObject); 20 22 procedure DataModuleCreate(Sender: TObject); … … 22 24 private 23 25 FAlwaysOnTop: Boolean; 26 StoredDimension: TControlDimension; 24 27 procedure SetAlwaysOnTop(AValue: Boolean); 25 28 function FindFirstNonOption: string; … … 33 36 procedure LoadConfig; 34 37 procedure SaveConfig; 38 procedure ScaleDPI; 35 39 property AlwaysOnTop: Boolean read FAlwaysOnTop write SetAlwaysOnTop; 36 40 end; … … 38 42 var 39 43 Core: TCore; 44 45 const 46 DefaultRegKey = '\Software\Chronosoft\Acronym Decoder'; 47 40 48 41 49 implementation … … 55 63 InitializeStarted := False; 56 64 InitializeFinished := False; 65 StoredDimension := TControlDimension.Create; 57 66 end; 58 67 59 68 procedure TCore.DataModuleDestroy(Sender: TObject); 60 69 begin 70 FreeAndNil(StoredDimension); 61 71 FreeAndNil(AcronymDb); 62 72 end; … … 116 126 FormMain.ProjectOpen(FileNameOption); 117 127 end; 128 ScaleDPI; 118 129 FormMain.UpdateAcronymsList; 119 130 FormMain.ListViewFilter1.UpdateFromListView(FormMain.ListViewAcronyms); … … 125 136 begin 126 137 FormMain.LoadConfig; 138 139 with TRegistryEx.Create do 140 try 141 RootKey := HKEY_CURRENT_USER; 142 OpenKey(DefaultRegKey, True); 143 ScaleDPI1.DPI := Point(ReadIntegerWithDefault('DPIX', 96), ReadIntegerWithDefault('DPIY', 96)); 144 ScaleDPI1.AutoDetect := ReadBoolWithDefault('DPIAuto', True); 145 finally 146 Free; 147 end; 127 148 end; 128 149 … … 130 151 begin 131 152 FormMain.SaveConfig; 153 154 with TRegistryEx.Create do 155 try 156 RootKey := HKEY_CURRENT_USER; 157 OpenKey(DefaultRegKey, True); 158 WriteInteger('DPIX', ScaleDPI1.DPI.X); 159 WriteInteger('DPIY', ScaleDPI1.DPI.Y); 160 WriteBool('DPIAuto', ScaleDPI1.AutoDetect); 161 finally 162 Free; 163 end; 164 end; 165 166 procedure TCore.ScaleDPI; 167 var 168 I: Integer; 169 begin 170 //ScaleDPI1.DPI := Point(150, 150); 171 with ScaleDPI1 do 172 if (DesignDPI.X <> DPI.X) or (DesignDPI.Y <> DPI.Y) then begin 173 for I := 0 to Screen.FormCount - 1 do begin 174 //StoreDimensions(Screen.Forms[I], StoredDimension); 175 //ScaleDimensions(Screen.Forms[I], StoredDimension); 176 end; 177 end; 132 178 end; 133 179
Note:
See TracChangeset
for help on using the changeset viewer.