Changeset 499
- Timestamp:
- Jan 19, 2018, 5:11:01 PM (7 years ago)
- Location:
- ProjectTemplates/FileMenuProject
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
ProjectTemplates/FileMenuProject/FileMenuProject.lpi
r498 r499 27 27 <PathDelim Value="\"/> 28 28 <Target> 29 <Filename Value=" FileMenuProject"/>29 <Filename Value="lib\$(TargetCPU)-$(TargetOS)-${BuildMode}\FileMenuProject"/> 30 30 </Target> 31 31 <SearchPaths> 32 32 <IncludeFiles Value="$(ProjOutDir)"/> 33 <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> 33 <OtherUnitFiles Value="Forms"/> 34 <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)-${BuildMode}"/> 34 35 </SearchPaths> 35 36 <Parsing> … … 62 63 <IgnoredMessages idx5024="True"/> 63 64 </CompilerMessages> 65 <ExecuteBefore> 66 <Command Value="prepare.bat lib\$(TargetCPU)-$(TargetOS)-${BuildMode}"/> 67 <CompileReasons Compile="False" Build="False"/> 68 </ExecuteBefore> 64 69 </Other> 65 70 </CompilerOptions> … … 138 143 <PathDelim Value="\"/> 139 144 <Target> 140 <Filename Value=" FileMenuProject"/>145 <Filename Value="lib\$(TargetCPU)-$(TargetOS)-${BuildMode}\FileMenuProject"/> 141 146 </Target> 142 147 <SearchPaths> 143 148 <IncludeFiles Value="$(ProjOutDir)"/> 144 149 <OtherUnitFiles Value="Forms"/> 145 <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS) "/>150 <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)-${BuildMode}"/> 146 151 </SearchPaths> 147 152 <Parsing> … … 178 183 </CompilerMessages> 179 184 <CustomOptions Value="-dDEBUG"/> 185 <ExecuteBefore> 186 <Command Value="prepare.bat lib\$(TargetCPU)-$(TargetOS)-${BuildMode}"/> 187 <CompileReasons Compile="False" Build="False"/> 188 </ExecuteBefore> 180 189 </Other> 181 190 </CompilerOptions> -
ProjectTemplates/FileMenuProject/Forms/UFormMain.pas
r497 r499 74 74 procedure TFormMain.FormCloseQuery(Sender: TObject; var CanClose: boolean); 75 75 begin 76 Core. AFileClose.Execute;76 Core.FileClose; 77 77 CanClose := Core.FileClosed; 78 78 end; -
ProjectTemplates/FileMenuProject/Install/win/Application.iss
r497 r499 68 68 69 69 [Files] 70 Source: "{#MyAppSubDir}\lib\x86_64-win64 \{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion; Check: Is64BitInstallMode71 Source: "{#MyAppSubDir}\lib\i386-win32 \{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion; Check: not Is64BitInstallMode70 Source: "{#MyAppSubDir}\lib\x86_64-win64-Release\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion; Check: Is64BitInstallMode 71 Source: "{#MyAppSubDir}\lib\i386-win32-Release\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion; Check: not Is64BitInstallMode 72 72 Source: "{#MyAppSubDir}\Languages\*.po"; DestDir: "{app}\Languages"; Flags: ignoreversion 73 73 -
ProjectTemplates/FileMenuProject/UCore.pas
r497 r499 52 52 procedure FileModified(Sender: TObject); 53 53 function FindFirstNonOption: string; 54 procedure FileOpen(FileName: string);55 procedure FileNew;56 54 procedure UpdateFile; 57 55 procedure LoadConfig; … … 62 60 ReopenLastFileOnStart: Boolean; 63 61 ToolbarVisible: Boolean; 62 procedure FileNew; 63 procedure FileOpen(FileName: string); 64 procedure FileClose; 64 65 procedure Initialize; 65 66 procedure UpdateInterface; … … 100 101 101 102 procedure TCore.AFileCloseExecute(Sender: TObject); 103 begin 104 FileClose; 105 UpdateFile; 106 end; 107 108 procedure TCore.AHomePageExecute(Sender: TObject); 109 begin 110 OpenWebPage(ApplicationInfo1.HomePage); 111 end; 112 113 procedure TCore.ASettingsExecute(Sender: TObject); 114 begin 115 FormSettings := TFormSettings.Create(nil); 116 try 117 FormSettings.LoadData; 118 if FormSettings.ShowModal = mrOK then 119 FormSettings.SaveData; 120 finally 121 FormSettings.Free; 122 end; 123 end; 124 125 procedure TCore.AFileNewExecute(Sender: TObject); 126 begin 127 FileNew; 128 UpdateFile; 129 end; 130 131 procedure TCore.AFileOpenExecute(Sender: TObject); 132 begin 133 OpenDialog1.DefaultExt := ''; 134 if Assigned(DataFile) then begin 135 OpenDialog1.InitialDir := ExtractFileDir(DataFile.FileName); 136 OpenDialog1.FileName := ExtractFileName(DataFile.FileName); 137 end; 138 if OpenDialog1.Execute then begin 139 FileOpen(OpenDialog1.FileName); 140 UpdateFile; 141 end; 142 end; 143 144 procedure TCore.AFileOpenRecentExecute(Sender: TObject); 145 begin 146 FileOpen(TMenuItem(Sender).Caption); 147 UpdateFile; 148 end; 149 150 procedure TCore.AFileSaveAsExecute(Sender: TObject); 151 begin 152 SaveDialog1.DefaultExt := DataFile.GetFileExt; 153 SaveDialog1.InitialDir := ExtractFileDir(DataFile.FileName); 154 SaveDialog1.FileName := ExtractFileName(DataFile.FileName); 155 if SaveDialog1.Execute then begin 156 DataFile.SaveToFile(SaveDialog1.FileName); 157 LastOpenedList1.AddItem(SaveDialog1.FileName); 158 UpdateFile; 159 end; 160 end; 161 162 procedure TCore.AFileSaveExecute(Sender: TObject); 163 begin 164 if FileExists(DataFile.FileName) then begin 165 DataFile.SaveToFile(DataFile.FileName); 166 LastOpenedList1.AddItem(DataFile.FileName); 167 UpdateFile; 168 end else AFileSaveAs.Execute; 169 end; 170 171 procedure TCore.DataModuleCreate(Sender: TObject); 172 begin 173 DataFile := nil; 174 FileClosed := True; 175 end; 176 177 procedure TCore.DataModuleDestroy(Sender: TObject); 178 begin 179 SaveConfig; 180 end; 181 182 procedure TCore.LastOpenedList1Change(Sender: TObject); 183 begin 184 LastOpenedList1.LoadToMenuItem(FormMain.MenuItemFileOpenRecent, AFileOpenRecentExecute); 185 LastOpenedList1.LoadToMenuItem(FormMain.PopupMenuOpenRecent.Items, AFileOpenRecentExecute); 186 end; 187 188 procedure TCore.FileModified(Sender: TObject); 189 begin 190 UpdateFile; 191 end; 192 193 procedure TCore.FileOpen(FileName: string); 194 begin 195 FileClose; 196 if FileClosed then begin 197 FileNew; 198 DataFile.LoadFromFile(FileName); 199 LastOpenedList1.AddItem(FileName); 200 end; 201 end; 202 203 procedure TCore.FileClose; 102 204 var 103 205 ModalResult: TModalResult; … … 120 222 if DoClose then begin 121 223 FreeAndNil(DataFile); 122 UpdateFile;123 224 FileClosed := True; 124 225 end; 125 226 end; 126 227 127 procedure TCore.AHomePageExecute(Sender: TObject);128 begin129 OpenWebPage(ApplicationInfo1.HomePage);130 end;131 132 procedure TCore.ASettingsExecute(Sender: TObject);133 begin134 FormSettings := TFormSettings.Create(nil);135 try136 FormSettings.LoadData;137 if FormSettings.ShowModal = mrOK then138 FormSettings.SaveData;139 finally140 FormSettings.Free;141 end;142 end;143 144 procedure TCore.AFileNewExecute(Sender: TObject);145 begin146 FileNew;147 UpdateFile;148 end;149 150 procedure TCore.AFileOpenExecute(Sender: TObject);151 begin152 OpenDialog1.DefaultExt := '';153 if Assigned(DataFile) then begin154 OpenDialog1.InitialDir := ExtractFileDir(DataFile.FileName);155 OpenDialog1.FileName := ExtractFileName(DataFile.FileName);156 end;157 if OpenDialog1.Execute then begin158 FileOpen(OpenDialog1.FileName);159 end;160 end;161 162 procedure TCore.AFileOpenRecentExecute(Sender: TObject);163 begin164 FileOpen(TMenuItem(Sender).Caption);165 end;166 167 procedure TCore.AFileSaveAsExecute(Sender: TObject);168 begin169 SaveDialog1.DefaultExt := DataFile.GetFileExt;170 SaveDialog1.InitialDir := ExtractFileDir(DataFile.FileName);171 SaveDialog1.FileName := ExtractFileName(DataFile.FileName);172 if SaveDialog1.Execute then begin173 DataFile.SaveToFile(SaveDialog1.FileName);174 LastOpenedList1.AddItem(SaveDialog1.FileName);175 UpdateFile;176 end;177 end;178 179 procedure TCore.AFileSaveExecute(Sender: TObject);180 begin181 if FileExists(DataFile.FileName) then begin182 DataFile.SaveToFile(DataFile.FileName);183 LastOpenedList1.AddItem(DataFile.FileName);184 UpdateFile;185 end else AFileSaveAs.Execute;186 end;187 188 procedure TCore.DataModuleCreate(Sender: TObject);189 begin190 DataFile := nil;191 FileClosed := True;192 end;193 194 procedure TCore.DataModuleDestroy(Sender: TObject);195 begin196 SaveConfig;197 end;198 199 procedure TCore.LastOpenedList1Change(Sender: TObject);200 begin201 LastOpenedList1.LoadToMenuItem(FormMain.MenuItemFileOpenRecent, AFileOpenRecentExecute);202 LastOpenedList1.LoadToMenuItem(FormMain.PopupMenuOpenRecent.Items, AFileOpenRecentExecute);203 end;204 205 procedure TCore.FileModified(Sender: TObject);206 begin207 UpdateFile;208 end;209 210 procedure TCore.FileOpen(FileName: string);211 begin212 AFileClose.Execute;213 if FileClosed then214 try215 FileNew;216 DataFile.LoadFromFile(FileName);217 LastOpenedList1.AddItem(FileName);218 finally219 UpdateFile;220 end;221 end;222 223 228 procedure TCore.FileNew; 224 229 begin 225 AFileClose.Execute;230 FileClose; 226 231 if FileClosed then begin 227 232 DataFile := TDataFile.Create;
Note:
See TracChangeset
for help on using the changeset viewer.