Changeset 414 for trunk/ConfigApps/MainFormUnit.pas
- Timestamp:
- Feb 24, 2019, 5:24:45 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ConfigApps/MainFormUnit.pas
r413 r414 4 4 5 5 Uses 6 Classes, Forms, Graphics, StdCtrls, Buttons, MultiColumnListBox, Dialogs ;6 Classes, Forms, Graphics, StdCtrls, Buttons, MultiColumnListBox, Dialogs, ACLLanguageUnit; 7 7 8 8 const 9 AppVersion = 'V1. 1.1'; // $SS_REQUIRE_NEW_VERSION$9 AppVersion = 'V1.2.0'; // $SS_REQUIRE_NEW_VERSION$ 10 10 11 11 type … … 36 36 ParametersLabel: TLabel; 37 37 VersionLabel: TLabel; 38 LngItems: String; 39 LngPath: String; 40 LngWebBrowser: String; 41 LngEmail: String; 42 LngNewsgroups: String; 43 LngFtp: String; 44 LngIrc: String; 45 LngDiscardChanges: String; 46 LngExitAndDiscardChanges: String; 47 LngFileDoesNotExist: String; 48 LngProgramNotFoundInPath: String; 49 LngDirectoryDoesNotExist: String; 50 LngSaveAnyway: String; 38 51 Procedure ParametersEditOnChange (Sender: TObject); 39 52 Procedure RestoreButtonOnClick (Sender: TObject); … … 52 65 Displaying: boolean; 53 66 Changed: boolean; 67 Protected 68 Procedure OnLanguageEvent( Language: TLanguageFile; const Apply: boolean ); 54 69 Public 55 70 {Insert public declarations here} … … 69 84 ACLFileUtility, ACLUtility, ACLStringUtility, 70 85 ControlsUtility, ACLDialogs; 86 87 {$R Images} 71 88 72 89 type … … 116 133 117 134 var 135 ProgramNames: array[ Low( TProgramType ).. High( TProgramType ) ] of String = ( 136 'Web Browser', 'Email', 'Newsgroups', 'FTP', 'IRC' 137 ); 138 118 139 CurrentSettings: array[ Low( TProgramType ).. High( TProgramType ) ] of TCurrentSettings;; 119 140 … … 178 199 Begin 179 200 if Changed then 180 if not DoConfirmDlg( 'Discard changes?',181 'Exit and discard changes?') then201 if not DoConfirmDlg( LngDiscardChanges, 202 LngExitAndDiscardChanges ) then 182 203 CanClose := false; 183 204 … … 211 232 // they specified a path... 212 233 if not FileExists( Path ) then 213 if not DoConfirmDlg( p.Name,214 'File does not exist: '+ EndLine234 if not DoConfirmDlg( ProgramNames[ ProgramType ], 235 LngFileDoesNotExist + EndLine 215 236 + Path + EndLine 216 + 'Save anyway?') then237 + LngSaveAnyway ) then 217 238 exit; 218 239 end … … 223 244 Path, 224 245 FoundPath ) then 225 if not DoConfirmDlg( p.Name,226 'Program not found in path: '+ EndLine246 if not DoConfirmDlg( ProgramNames[ ProgramType ], 247 LngProgramNotFoundInPath + EndLine 227 248 + Path + EndLine 228 + 'Save anyway?') then249 + LngSaveAnyway ) then 229 250 exit; 230 251 end; 231 252 if not DirectoryExists( WorkingDirectory ) then 232 if not DoConfirmDlg( p.Name,233 'Directory does not exist: '234 + WorkingDirectory 235 + '. Save anyway?') then253 if not DoConfirmDlg( ProgramNames[ ProgramType ], 254 LngDirectoryDoesNotExist + EndLine 255 + WorkingDirectory + EndLine 256 + LngSaveAnyway ) then 236 257 exit; 237 258 end; … … 292 313 for i := 0 to ItemsListBox.Items.Count - 1 do 293 314 if TProgramType( ItemsListBox.Items.Objects[ i ] ) = p then 294 ItemsListBox.Items[ i ] := Program s[ p ].Name315 ItemsListBox.Items[ i ] := ProgramNames[ p ] 295 316 + #9 296 317 + PathEdit.Text; … … 318 339 Font := GetNiceDefaultFont; 319 340 341 Forms.FormIconResourceID := 1; 342 343 RegisterForLanguages( OnLanguageEvent ); 344 320 345 VersionLabel.Caption := AppVersion; 346 LoadDefaultLanguage('cfgapps'); 321 347 LoadCurrentSettings; 348 322 349 end; 323 350 … … 335 362 CurrentSettings[ ProgramType ].Parameters := GetParameters( p ); 336 363 337 ItemsListBox.Items.AddObject( P .Name364 ItemsListBox.Items.AddObject( ProgramNames[ ProgramType ] 338 365 + #9 339 366 + CurrentSettings[ ProgramType ].Path, … … 347 374 End; 348 375 376 Procedure TMainForm.OnLanguageEvent( Language: TLanguageFile; 377 const Apply: boolean ); 378 Var 379 ProgramType: TProgramType; 380 P: TProgramSettings; 381 Begin 382 Language.LoadComponentLanguage( self, Apply ); 383 384 Language.LL( Apply, LngWebBrowser, 'ProgramWebBrowser', 'Web Browser' ); 385 Language.LL( Apply, LngEmail, 'ProgramEmail', 'Email' ); 386 Language.LL( Apply, LngNewsgroups, 'ProgramNewsgroups', 'Newsgroups' ); 387 Language.LL( Apply, LngFtp, 'ProgramFTP', 'FTP' ); 388 Language.LL( Apply, LngIrc, 'ProgramIRC', 'IRC' ); 389 Language.LL( Apply, LngDiscardChanges, 'DiscardChanges', 'Discard changes?' ); 390 Language.LL( Apply, LngExitAndDiscardChanges, 'ExitAndDiscardChanges', 'Exit and discard changes?' ); 391 Language.LL( Apply, LngFileDoesNotExist, 'FileDoesNotExist', 'File does not exist: ' ); 392 Language.LL( Apply, LngProgramNotFoundInPath, 'ProgramNotFoundInPath', 'Program not found in path: ' ); 393 Language.LL( Apply, LngDirectoryDoesNotExist, 'DirectoryDoesNotExist', 'Directory does not exist: ' ); 394 Language.LL( Apply, LngSaveAnyway, 'SaveAnyway', 'Save anyway?' ); 395 396 ProgramNames[ idBrowser ] := LngWebBrowser; 397 ProgramNames[ idMail ] := LngEmail; 398 ProgramNames[ idNews ] := LngNewsgroups; 399 ProgramNames[ idFTP ] := LngFtp; 400 ProgramNames[ idIRC ] := LngIrc; 401 402 End; 403 349 404 Initialization 350 405 RegisterClasses ([TMainForm, TEdit, TButton, TMultiColumnListBox, TLabel,
Note:
See TracChangeset
for help on using the changeset viewer.