| 1 | Unit ProductInformationFormUnit; | 
|---|
| 2 |  | 
|---|
| 3 | // NewView - a new OS/2 Help Viewer | 
|---|
| 4 | // Copyright 2003 Aaron Lawrence (aaronl at consultant dot com) | 
|---|
| 5 | // This software is released under the Gnu Public License - see readme.txt | 
|---|
| 6 |  | 
|---|
| 7 | Interface | 
|---|
| 8 |  | 
|---|
| 9 | Uses | 
|---|
| 10 | Classes, | 
|---|
| 11 | Forms, | 
|---|
| 12 | Buttons, | 
|---|
| 13 | StdCtrls, | 
|---|
| 14 | ExtCtrls, | 
|---|
| 15 | ACLLanguageUnit; | 
|---|
| 16 |  | 
|---|
| 17 | Type | 
|---|
| 18 | TProductInformationForm = Class (TForm) | 
|---|
| 19 | OKButton: TButton; | 
|---|
| 20 | NameAndVersionEdit: TEdit; | 
|---|
| 21 | CopyrightEdit: TEdit; | 
|---|
| 22 | Image1: TImage; | 
|---|
| 23 | Bevel1: TBevel; | 
|---|
| 24 | LicenseEdit: TEdit; | 
|---|
| 25 | TranslationInfoLabel: TLabel; | 
|---|
| 26 | WebPageEdit: TEdit; | 
|---|
| 27 | EmailEdit: TEdit; | 
|---|
| 28 | Procedure EmailEditOnClick (Sender: TObject); | 
|---|
| 29 | Procedure WebPageEditOnClick (Sender: TObject); | 
|---|
| 30 | Procedure ProductInformationFormOnSetupShow (Sender: TObject); | 
|---|
| 31 | Procedure AboutBoxOnCreate (Sender: TObject); | 
|---|
| 32 | Public | 
|---|
| 33 | Procedure OnLanguageEvent( Language: TLanguageFile; | 
|---|
| 34 | const Apply: boolean ); | 
|---|
| 35 | VersionMsg: string; | 
|---|
| 36 | End; | 
|---|
| 37 |  | 
|---|
| 38 | Var | 
|---|
| 39 | ProductInformationForm: TProductInformationForm; | 
|---|
| 40 |  | 
|---|
| 41 | procedure EnsureProductInformationFormLoaded; | 
|---|
| 42 |  | 
|---|
| 43 | Implementation | 
|---|
| 44 |  | 
|---|
| 45 | uses | 
|---|
| 46 | VersionUnit, | 
|---|
| 47 | ControlsUtility, | 
|---|
| 48 | WebBrowserUnit, | 
|---|
| 49 | DebugUnit, | 
|---|
| 50 | StringUtilsUnit; | 
|---|
| 51 |  | 
|---|
| 52 | Procedure TProductInformationForm.EmailEditOnClick (Sender: TObject); | 
|---|
| 53 | Begin | 
|---|
| 54 | LaunchURL('"mailto:' + EmailEdit.Text + '"'); | 
|---|
| 55 | End; | 
|---|
| 56 |  | 
|---|
| 57 | Procedure TProductInformationForm.WebPageEditOnClick (Sender: TObject); | 
|---|
| 58 | Begin | 
|---|
| 59 | LaunchURL('"http://' + WebPageEdit.Text + '"'); | 
|---|
| 60 | End; | 
|---|
| 61 |  | 
|---|
| 62 |  | 
|---|
| 63 | Procedure TProductInformationForm.ProductInformationFormOnSetupShow (Sender: TObject); | 
|---|
| 64 | Begin | 
|---|
| 65 | ScaleForm( self, 10, 16 ); | 
|---|
| 66 | End; | 
|---|
| 67 |  | 
|---|
| 68 |  | 
|---|
| 69 | Procedure TProductInformationForm.OnLanguageEvent( Language: TLanguageFile; | 
|---|
| 70 | const Apply: boolean ); | 
|---|
| 71 | begin | 
|---|
| 72 | LogEvent(LogI18n, 'TProductInformationForm.OnLanguageEvent apply: "' + BoolToStr(Apply) + '"'); | 
|---|
| 73 | Language.LoadComponentLanguage( self, Apply ); | 
|---|
| 74 |  | 
|---|
| 75 | Language.LL( Apply, VersionMsg, 'VersionMsg', 'Version: ' ); | 
|---|
| 76 | end; | 
|---|
| 77 |  | 
|---|
| 78 | Procedure TProductInformationForm.AboutBoxOnCreate (Sender: TObject); | 
|---|
| 79 | Begin | 
|---|
| 80 | RegisterForLanguages( OnLanguageEvent ); | 
|---|
| 81 |  | 
|---|
| 82 | NameAndVersionEdit.Text := 'NewView ' + GetAppVersion; | 
|---|
| 83 |  | 
|---|
| 84 | NameAndVersionEdit.Font := Screen.CreateCompatibleFont( Font ); | 
|---|
| 85 | NameAndVersionEdit.Font.Attributes := [ faBold ]; | 
|---|
| 86 |  | 
|---|
| 87 | WebPageEdit.Font := Screen.CreateCompatibleFont( Font ); | 
|---|
| 88 | WebPageEdit.Font.Attributes := [ faUnderscore ]; | 
|---|
| 89 | EmailEdit.Font := WebPageEdit.Font; | 
|---|
| 90 |  | 
|---|
| 91 | CopyrightEdit.Text := GetCopyrightMsg; | 
|---|
| 92 | LicenseEdit.Text := GetLicenseMsg; | 
|---|
| 93 |  | 
|---|
| 94 | WebPageEdit.Cursor := GetLinkCursor; | 
|---|
| 95 | EmailEdit.Cursor := GetLinkCursor; | 
|---|
| 96 | End; | 
|---|
| 97 |  | 
|---|
| 98 | procedure EnsureProductInformationFormLoaded; | 
|---|
| 99 | begin | 
|---|
| 100 | if ProductInformationForm = nil then | 
|---|
| 101 | ProductInformationForm := TProductInformationForm.Create( nil ); | 
|---|
| 102 | end; | 
|---|
| 103 |  | 
|---|
| 104 | Initialization | 
|---|
| 105 | RegisterClasses ([TProductInformationForm, TButton, | 
|---|
| 106 | TEdit, TImage, TLabel, TBevel]); | 
|---|
| 107 | RegisterUpdateProcForLanguages( EnsureProductInformationFormLoaded ); | 
|---|
| 108 | End. | 
|---|