Changeset 28 for trunk/UCore.pas
- Timestamp:
- Dec 22, 2016, 6:01:41 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UCore.pas
r27 r28 6 6 7 7 uses 8 Classes, SysUtils, FileUtil, ActnList, UProject, UFGraphics, Controls, Graphics,9 ExtDlgs, ExtCtrls;8 Classes, SysUtils, FileUtil, ActnList, UProject, UFGraphics, UPersistentForm, 9 Controls, Graphics, ExtDlgs, ExtCtrls, UREgistry, UApplicationInfo, Registry; 10 10 11 11 const … … 29 29 AFileClose: TAction; 30 30 AFileOpen: TAction; 31 ApplicationInfo1: TApplicationInfo; 31 32 AZoomNormal: TAction; 32 33 AZoomAll: TAction; … … 39 40 ImageList1: TImageList; 40 41 OpenPictureDialog1: TOpenPictureDialog; 42 PersistentForm1: TPersistentForm; 41 43 SavePictureDialog1: TSavePictureDialog; 42 44 procedure AExitExecute(Sender: TObject); … … 59 61 procedure DataModuleDestroy(Sender: TObject); 60 62 private 61 { private declarations }62 63 public 63 64 Project: TProject; 65 procedure ProjectOpen(FileName: string); 64 66 procedure Init; 65 67 end; … … 94 96 end; 95 97 98 procedure TCore.ProjectOpen(FileName: string); 99 var 100 Image: TImage; 101 begin 102 FormMain.LastOpenedList1.AddItem(FileName); 103 Image := TImage.Create(nil); 104 Image.Picture.LoadFromFile(FileName); 105 Image.Picture.Bitmap.BeginUpdate(True); 106 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; 109 Image.Free; 110 AZoomAll.Execute; 111 FormMain.Redraw; 112 Project.FileName := FileName; 113 end; 114 96 115 procedure TCore.Init; 97 116 begin 117 PersistentForm1.RegistryContext := RegContext(HKEY(ApplicationInfo1.RegistryRoot), 118 ApplicationInfo1.RegistryKey); 119 98 120 // Set default 99 121 Project.Bitmap.ColorFormat := ColorFormatManager.Formats[0]; … … 162 184 163 185 procedure TCore.AFileOpenExecute(Sender: TObject); 164 var165 Image: TImage;166 186 begin 167 187 if OpenPictureDialog1.Execute then begin 168 Image := TImage.Create(nil); 169 Image.Picture.LoadFromFile(OpenPictureDialog1.FileName); 170 Image.Picture.Bitmap.BeginUpdate(True); 171 Project.Bitmap.Size := Point(Image.Picture.Bitmap.Width, Image.Picture.Bitmap.Height); 172 Project.Bitmap.LoadFromCanvas(Image.Picture.Bitmap.Canvas); 173 Image.Picture.Bitmap.EndUpdate; 174 Image.Free; 175 AZoomAll.Execute; 176 FormMain.Redraw; 177 Project.FileName := OpenPictureDialog1.FileName; 188 ProjectOpen(OpenPictureDialog1.FileName); 178 189 end; 179 190 end; … … 184 195 if SavePictureDialog1.Execute then begin 185 196 Project.FileName := SavePictureDialog1.FileName; 197 FormMain.LastOpenedList1.AddItem(SavePictureDialog1.FileName); 186 198 AFileSave.Execute; 187 199 end; … … 194 206 if Project.FileName = '' then AFileSaveAs.Execute 195 207 else begin 208 FormMain.LastOpenedList1.AddItem(SavePictureDialog1.FileName); 196 209 Image := TImage.Create(nil); 197 210 Image.Picture.Bitmap.SetSize(Project.Bitmap.Size.X, Project.Bitmap.Size.Y);
Note:
See TracChangeset
for help on using the changeset viewer.