Changeset 29 for trunk/UCore.pas
- Timestamp:
- Dec 22, 2016, 9:46:17 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UCore.pas
r28 r29 7 7 uses 8 8 Classes, SysUtils, FileUtil, ActnList, UProject, UFGraphics, UPersistentForm, 9 Controls, Graphics, ExtDlgs, ExtCtrls, UR Egistry, UApplicationInfo, Registry;9 Controls, Graphics, ExtDlgs, ExtCtrls, URegistry, UApplicationInfo, Registry; 10 10 11 11 const … … 62 62 private 63 63 public 64 LastColorFormat: string; 64 65 Project: TProject; 66 RegistryContext: TRegistryContext; 65 67 procedure ProjectOpen(FileName: string); 66 68 procedure Init; 69 procedure LoadConfig; 70 procedure SaveConfig; 67 71 end; 68 72 … … 88 92 procedure TCore.DataModuleCreate(Sender: TObject); 89 93 begin 94 RegistryContext := RegContext(HKEY(ApplicationInfo1.RegistryRoot), 95 ApplicationInfo1.RegistryKey); 90 96 Project := TProject.Create; 91 97 end; … … 93 99 procedure TCore.DataModuleDestroy(Sender: TObject); 94 100 begin 95 Project.Free; 101 FreeAndNil(Project); 102 SaveConfig; 96 103 end; 97 104 … … 103 110 Image := TImage.Create(nil); 104 111 Image.Picture.LoadFromFile(FileName); 105 Image.Picture.Bitmap.BeginUpdate(True);112 //Image.Picture.Bitmap.BeginUpdate(True); 106 113 Project.Bitmap.Size := Point(Image.Picture.Bitmap.Width, Image.Picture.Bitmap.Height); 107 Project.Bitmap.LoadFromCanvas(Image.Picture.Bitmap.Canvas); 108 Image.Picture.Bitmap.EndUpdate; 114 //Project.Bitmap.LoadFromCanvas(Image.Picture.Bitmap.Canvas); 115 Project.Bitmap.LoadFromBitmap(Image.Picture.Bitmap); 116 //Image.Picture.Bitmap.EndUpdate; 109 117 Image.Free; 110 118 AZoomAll.Execute; … … 115 123 procedure TCore.Init; 116 124 begin 117 PersistentForm1.RegistryContext := Reg Context(HKEY(ApplicationInfo1.RegistryRoot),118 ApplicationInfo1.RegistryKey);125 PersistentForm1.RegistryContext := RegistryContext; 126 LoadConfig; 119 127 120 128 // Set default … … 123 131 Project.View.DestRect := Bounds(0, 0, FormMain.PaintBox1.Width, FormMain.PaintBox1.Height); 124 132 Core.AZoomAll.Execute; 133 end; 134 135 procedure TCore.LoadConfig; 136 begin 137 with TRegistryEx.Create do 138 try 139 RootKey := RegistryContext.RootKey; 140 OpenKey(RegistryContext.Key, True); 141 142 LastColorFormat := ReadStringWithDefault('LastColorFormat', ''); 143 finally 144 Free; 145 end; 146 end; 147 148 procedure TCore.SaveConfig; 149 begin 150 with TRegistryEx.Create do 151 try 152 RootKey := RegistryContext.RootKey; 153 OpenKey(RegistryContext.Key, True); 154 155 WriteString('LastColorFormat', LastColorFormat); 156 finally 157 Free; 158 end; 125 159 end; 126 160
Note:
See TracChangeset
for help on using the changeset viewer.