summaryrefslogtreecommitdiff
path: root/plugins/MirandaNGHistoryToDB/About.pas
blob: 7d175adb84f0bd76f6c7bddea4f269401be8640e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
{ ############################################################################ }
{ #                                                                          # }
{ #  MirandaNG HistoryToDB Plugin v2.5                                       # }
{ #                                                                          # }
{ #  License: GPLv3                                                          # }
{ #                                                                          # }
{ #  Author: Grigorev Michael (icq: 161867489, email: sleuthhound@gmail.com) # }
{ #                                                                          # }
{ ############################################################################ }

unit About;

interface

uses Windows, Messages, SysUtils, Classes, Graphics, Forms, Controls, StdCtrls,
  Buttons, ExtCtrls, ShellAPI, Global, ComCtrls;

type
  TAboutForm = class(TForm)
    AboutImage: TImage;
    CloseButton: TButton;
    AboutPageControl: TPageControl;
    VersionTabSheet: TTabSheet;
    ThankYouTabSheet: TTabSheet;
    BAbout: TBevel;
    LProgramName: TLabel;
    LCopyright: TLabel;
    LabelAuthor: TLabel;
    LVersionNum: TLabel;
    LVersion: TLabel;
    LLicense: TLabel;
    LLicenseType: TLabel;
    LWeb: TLabel;
    LabelWebSite: TLabel;
    BThankYou: TBevel;
    ThankYou: TLabel;
    procedure FormCreate(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure CloseButtonClick(Sender: TObject);
    procedure LabelAuthorClick(Sender: TObject);
    procedure LabelWebSiteClick(Sender: TObject);
    procedure MemoThankYouEnter(Sender: TObject);
  private
    { Private declarations }
    // Äëÿ ìóëüòèÿçûêîâîé ïîääåðæêè
    procedure OnLanguageChanged(var Msg: TMessage); message WM_LANGUAGECHANGED;
    procedure LoadLanguageStrings;
  public
    { Public declarations }
  end;

var
  AboutForm: TAboutForm;

implementation

{$R *.dfm}
{$R icons.res}

procedure TAboutForm.CloseButtonClick(Sender: TObject);
begin
  Close;
end;

procedure TAboutForm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  // Ïåðåìåííàÿ äëÿ ðåæèìà àíòè-áîññ
  Global_AboutForm_Showing := False;
end;

procedure TAboutForm.FormCreate(Sender: TObject);
var
  AboutBitmap: TBitmap;
begin
  // Äëÿ ìóëüòèÿçûêîâîé ïîääåðæêè
  AboutFormHandle := Handle;
  SetWindowLong(Handle, GWL_HWNDPARENT, 0);
  SetWindowLong(Handle, GWL_EXSTYLE, GetWindowLong(Handle, GWL_EXSTYLE) or WS_EX_APPWINDOW);
  // Ãðóçèì áèòîâûé îáðàçû èç ôàéëà ðåñóðñîâ
  AboutBitmap := TBitmap.Create;
  try
    AboutBitmap.LoadFromResourceName(HInstance, 'About');
    AboutImage.Picture.Assign(AboutBitmap);
  finally
    AboutBitmap.Free;
  end;
  LabelAuthor.Cursor := crHandPoint;
  LabelWebSite.Cursor := crHandPoint;
  // Çàãðóæàåì ÿçûê èíòåðôåéñà
  LoadLanguageStrings;
end;

procedure TAboutForm.FormShow(Sender: TObject);
begin
  // Ïåðåìåííàÿ äëÿ ðåæèìà àíòè-áîññ
  Global_AboutForm_Showing := True;
  // Óêàçûâàåì âåðñèþ â îêíå "Î ïëàãèíå"
  LVersionNum.Caption := IntToStr(htdVerMajor) + '.' + IntToStr(htdVerMinor) + '.' + IntToStr(htdVerRelease) + '.' + IntToStr(htdVerBuild) + ' ' + htdPlatform;
end;

procedure TAboutForm.LabelAuthorClick(Sender: TObject);
begin
  ShellExecute(0, 'open', 'mailto:sleuthhound@gmail.com', nil, nil, SW_RESTORE);
end;

procedure TAboutForm.LabelWebSiteClick(Sender: TObject);
begin
  ShellExecute(0, 'open', 'http://www.im-history.ru', nil, nil, SW_RESTORE);
end;

// Ìåãà-õàê äëÿ çàïðåòà âûäåëåíèÿ â Memo :-D
procedure TAboutForm.MemoThankYouEnter(Sender: TObject);
begin
  CloseButton.SetFocus;
end;

// Äëÿ ìóëüòèÿçûêîâîé ïîääåðæêè
procedure TAboutForm.OnLanguageChanged(var Msg: TMessage);
begin
  LoadLanguageStrings;
end;

// Äëÿ ìóëüòèÿçûêîâîé ïîääåðæêè
procedure TAboutForm.LoadLanguageStrings;
begin
  Caption := GetLangStr('AboutFormCaption');
  LProgramName.Caption := htdPluginShortName;
  CloseButton.Caption := GetLangStr('CloseButton');
  LVersion.Caption := GetLangStr('Version');
  LLicense.Caption := GetLangStr('License');
  VersionTabSheet.Caption := GetLangStr('AboutFormCaption');
  ThankYouTabSheet.Caption := GetLangStr('LThankYou');
  // Ïîçèöèîíèðóåì ëåéáëû
  LVersionNum.Left := LVersion.Left + 1 + LVersion.Width;
  LLicenseType.Left := LLicense.Left + 1 + LLicense.Width;
  // Áëàãîäàðíîñòè
  if CoreLanguage = 'Russian' then
    ThankYou.Caption := ThankYouText_Rus
  else
    ThankYou.Caption := ThankYouText_Eng;
  // End
end;

end.