-
Notifications
You must be signed in to change notification settings - Fork 0
/
SIL-EL-Ethiopian-LatinInstall.iss
381 lines (312 loc) · 15.7 KB
/
SIL-EL-Ethiopian-LatinInstall.iss
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
; -- Install the FreeKey keyboard.iss --
[Code]
var
SourceName : string;
KeyingDoc : string;
InstallFont : boolean;
LicenseText : string;
{ Some predefined variables, so that you dont need to mess with the code section below}
procedure InitializeVariables;
begin
SourceName := 'SIL-EL-Ethiopian-Latin'; // Folder name where the source code should be installed into (only last subfolder)
KeyingDoc := 'SIL-EL-Ethiopian-LatinKeyboardMap.pdf'; // Use the name of keying document
InstallFont := True; // Should fonts be installed with the program?
LicenseText := 'The MIT License (MIT)' + #13#10 + #13#10 +
'Permission is hereby granted, free of charge, to any person obtaining a copy of this software ' +
'and associated documentation files (the "Software"), to deal in the Software without ' +
'restriction, including without limitation the rights to use, copy, modify, merge, publish, ' +
'distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the ' +
'Software is furnished to do so, subject to the following conditions: The above copyright notice ' +
'and this permission notice shall be included in all copies or substantial portions of the Software. ' +
'THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT ' +
'NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ' +
'NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, ' +
'DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, ' +
'OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.';
end;
[Setup]
OutputBaseFilename=FreeKey SIL EL - Ethiopian Latin Keyboard v-1-4-0
AppName=SIL EL - Ethiopian Latin
AppVersion=1.4.0
AppVerName=SIL EL - Ethiopian Latin Version 1.4.0
DefaultDirName={pf}\FreeKey
DefaultGroupName=FreeKey
UninstallDisplayName=FreeKey SIL EL - Ethiopian Latin Keyboard
AppPublisher=SIL Ethiopia
AppPublisherURL=http://www.silethiopia.org/
AppCopyright=(c) SIL Ethiopia
DirExistsWarning=No
[Files]
; The program files themself:
Source: "SIL-EL-Ethiopian-Latin.exe"; DestDir: "{app}";
Source: "SIL-EL-Ethiopian-LatinOn.ico"; DestDir: "{app}";
Source: "SIL-EL-Ethiopian-LatinOff.ico"; DestDir: "{app}";
Source: "SIL-EL-Ethiopian-LatinKeyboardMap.pdf"; DestDir: "{app}";
Source: "SIL-EL-Ethiopian-LatinKeyboard.txt"; DestDir: "{app}"; Flags: onlyifdoesntexist
; Documentation:
Source: "The free keyboards.doc"; DestDir: {code:GetDocFolder};
Source: "SIL-EL-Ethiopian-LatinKeyboardMap.pdf"; DestDir: {code:GetDocFolder};
; Source Code:
Source: "SIL-EL-Ethiopian-Latin.ahk"; DestDir: {code:GetSourceFolder}; Check: Check2State;
Source: "BasicRoutines.ahk"; DestDir: {code:GetSourceFolder}; Check: Check2State;
Source: "SIL-EL-Ethiopian-LatinOn.ico"; DestDir: {code:GetSourceFolder}; Check: Check2State;
Source: "SIL-EL-Ethiopian-LatinOff.ico"; DestDir: {code:GetSourceFolder}; Check: Check2State;
Source: "SIL-EL-Ethiopian-LatinInstall.iss"; DestDir: {code:GetSourceFolder}; Check: Check2State;
Source: "SIL-EL-Ethiopian-LatinKeyboard.txt"; DestDir: {code:GetSourceFolder}; Check: Check2State;
Source: "SIL-EL-Ethiopian-LatinKeyboardMap.odt"; DestDir: {code:GetSourceFolder}; Check: Check2State;
Source: "How to prepare a keyboard.doc"; DestDir: {code:GetSourceFolder}; Check: Check2State;
; Install the font:
Source: "AndikaCompact-R.ttf"; DestDir: "{fonts}"; FontInstall: "Andika Compact Regular"; Flags: uninsneveruninstall; Check: Check4State;
Source: "Andika-R.ttf"; DestDir: "{fonts}"; FontInstall: "Andika Regular"; Flags: uninsneveruninstall; Check: Check4State;
Source: "CharisSIL-B.ttf"; DestDir: "{fonts}"; FontInstall: "Charis SIL Bold"; Flags: uninsneveruninstall; Check: Check4State;
Source: "CharisSIL-BI.ttf"; DestDir: "{fonts}"; FontInstall: "Charis SIL Bold Italic"; Flags: uninsneveruninstall; Check: Check4State;
Source: "CharisSIL-I.ttf"; DestDir: "{fonts}"; FontInstall: "Charis SIL Italic"; Flags: uninsneveruninstall; Check: Check4State;
Source: "CharisSIL-R.ttf"; DestDir: "{fonts}"; FontInstall: "Charis SIL Regular"; Flags: uninsneveruninstall; Check: Check4State;
Source: "DoulosSIL-R.ttf"; DestDir: "{fonts}"; FontInstall: "Doulos SIL Regular"; Flags: uninsneveruninstall; Check: Check4State;
Source: "GentiumPlus-I.ttf"; DestDir: "{fonts}"; FontInstall: "Gentium Plus Italic"; Flags: uninsneveruninstall; Check: Check4State;
Source: "GentiumPlus-R.ttf"; DestDir: "{fonts}"; FontInstall: "Gentium Plus Regular"; Flags: uninsneveruninstall; Check: Check4State;
[Icons]
Name: "{group}\SIL-EL-Ethiopian-Latin"; Filename: "{app}\SIL-EL-Ethiopian-Latin.exe"; IconFilename: "{app}\SIL-EL-Ethiopian-LatinOn.ico"
Name: "{group}\Documents\SIL-EL-Ethiopian-LatinKeyboardMap.pdf"; Filename: "{app}\Documents\SIL-EL-Ethiopian-LatinKeyboardMap.pdf"
Name: "{group}\Documents\The free keyboards.doc"; Filename: "{app}\Documents\The free keyboards.doc"
Name: "{commondesktop}\SIL-EL-Ethiopian-Latin.exe"; Filename: "{app}\SIL-EL-Ethiopian-Latin.exe"; IconFilename: "{app}\SIL-EL-Ethiopian-LatinOn.ico"; WorkingDir: "{app}"; Check: Check3State;
[Registry]
; Start this program with Windows:
Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\Run"; ValueType: string; ValueName: "SIL-EL-Ethiopian-Latin.exe"; ValueData: "{app}\SIL-EL-Ethiopian-Latin.exe"; Check: Check1State;
[Run]
; Start the program when the installation finished
Filename: "{app}\SIL-EL-Ethiopian-Latin.exe"; Flags: postinstall nowait;
; ************************************************************************************************************************************
; ************************************************************************************************************************************
[Code]
var
SelectInstallPage : TInputOptionWizardPage;
BasicInstallPage : TWizardPage;
DocDirPage : TInputDirWizardPage;
SourceDirPage : TInputDirWizardPage;
InstallType : integer;
CB1 : TCheckBox; // Start with windows
CB2 : TCheckBox; // Install source code
CB3 : TCheckBox; // create shortcut
CB4 : TCheckBox; // Install Font
function CreateButton(const X, Y, Width: integer; Caption: string; Parent: TWinControl; ClickEvent: TNotifyEvent): TButton; forward;
function CreateCheckBox(const X, Y, Width: integer; Caption: string; checked : boolean; Parent: TWinControl; ClickEvent: TNotifyEvent): TCheckBox; forward;
procedure Button1Click(Sender: TObject); forward;
procedure Button2Click(Sender: TObject); forward;
procedure CheckBox5Click(Sender: TObject); forward;
procedure CheckBox6Click(Sender: TObject); forward;
procedure CreateAboutButton(ParentForm: TSetupForm; CancelButton: TNewButton); forward;
procedure InitializeWizard;
var
button1 : TButton;
button2 : TButton;
But5 : TButton; // Show user manual
But6 : TButton; // Show keying manual
begin
{ Create the pages }
InitializeVariables;
CreateAboutButton(WizardForm, WizardForm.CancelButton);
// --------------------------------------------------------------------------------
SelectInstallPage := CreateInputOptionPage(wpWelcome, 'Select installation type', '',
'Please select the way how you would like to do the installation',
True, False);
button1 := CreateButton(10, 30, 120, 'Default installation', SelectInstallPage.Surface, @Button1Click);
button1.Height := 50; // Enlarge button
button2 := CreateButton(10, 90, 120, 'Custom installation', SelectInstallPage.Surface, @Button2Click);
button2.Height := 50;
// --------------------------------------------------------------------------------
BasicInstallPage := CreateCustomPage(SelectInstallPage.ID, 'Basic settings', '');
cb1 := CreateCheckBox(10, 30, 180, 'Start program with windows', true, BasicInstallPage.Surface, nil);
cb2 := CreateCheckBox(10, 80, 180, 'Install source code', true, BasicInstallPage.Surface, nil);
cb3 := CreateCheckBox(10, 130, 180, 'Create shortcut on desktop', true, BasicInstallPage.Surface, nil);
if Installfont = True then
cb4 := CreateCheckBox(10, 180, 180, 'Install font', true, BasicInstallPage.Surface, nil);
// --------------------------------------------------------------------------------
DocDirPage := CreateInputDirPage(wpSelectDir,
'Install Documentation', 'Where should the documentation files be installed?',
'Select the folder in which Setup should install documentation files' + #13#10#13#10 +
'To continue, click Next. If you would like to select a different folder, click Browse.',
False, 'Documents');
DocDirPage.Add('');
DocDirPage.Values[0] := ExpandConstant('{pf}\FreeKey\Documents');
// --------------------------------------------------------------------------------
SourceDirPage := CreateInputDirPage(DocDirPage.ID,
'Install Source code', 'Where should the source code be installed?',
'Select the folder in which Setup should install the source code' + #13#10#13#10 +
'To continue, click Next. If you would like to select a different folder, click Browse.',
False, 'Source code');
SourceDirPage.Add('');
SourceDirPage.Values[0] := ExpandConstant('{pf}\FreeKey\Source\' + SourceName );
// --------------------------------------------------------------------------------
// Add extra buttons on last page:
But5 := CreateButton(200, 180, 180, 'Show user manual', WizardForm.FinishedPage, @CheckBox5Click);
But6 := CreateButton(200, 240, 180, 'Show keying manual', WizardForm.FinishedPage, @CheckBox6Click);
end;
function ShouldSkipPage(PageID: Integer): Boolean;
begin
{ Skip pages that shouldn't be shown }
if PageID = SelectInstallPage.ID then result := False // Always show this page
//
else if InstallType = 1 then // Default installation
begin
if (PageID = wpReady) or (PageID = wpFinished) then result := False
else result := True
end
else // custom installation
begin
if (cb2.checked = false) and (PageID = SourceDirPage.ID) then result := true
else result := False;
end;
end;
procedure CurPageChanged(CurrentPage: integer);
begin
if CurrentPage = SelectInstallPage.ID then
begin
WizardForm.NextButton.Visible := False;
end;
end;
function CreateButton(const X, Y, Width: integer; Caption: string;
Parent: TWinControl; ClickEvent: TNotifyEvent): TButton;
begin
Result := TButton.Create(WizardForm);
if Result <> nil then
begin
Result.Left := X;
Result.Top := Y;
Result.Width := Width;
Result.Caption := Caption;
Result.Parent := Parent;
Result.OnClick := ClickEvent;
end;
end;
function CreateCheckBox(const X, Y, Width: integer; Caption: string; checked : boolean;
Parent: TWinControl; ClickEvent: TNotifyEvent): TCheckBox;
begin
Result := TCheckBox.Create(WizardForm);
if Result <> nil then
begin
Result.Left := X;
Result.Top := Y;
Result.Width := Width;
Result.Caption := Caption;
Result.Checked := checked;
Result.Parent := Parent;
Result.OnClick := ClickEvent;
end;
end;
procedure Button1Click(Sender: TObject);
begin
InstallType := 1;
WizardForm.NextButton.OnClick(nil);
end;
procedure Button2Click(Sender: TObject);
begin
InstallType := 2;
WizardForm.NextButton.OnClick(nil);
end;
procedure CheckBox5Click(Sender: TObject);
var
ErrorCode: Integer;
begin
if not ShellExec('', ExpandConstant(DocDirPage.Values[0] + '\The free keyboards.doc'),
'', '', SW_SHOW, ewNoWait, ErrorCode) then
begin
// handle failure if necessary
end;
end;
procedure CheckBox6Click(Sender: TObject);
var
ErrorCode: Integer;
begin
if not ShellExec('', ExpandConstant(DocDirPage.Values[0] + '\' + KeyingDoc),
'', '', SW_SHOW, ewNoWait, ErrorCode) then
begin
// handle failure if necessary
end;
end;
{Check parameter funktions}
function Check1State : boolean; // Start with Windows
begin
result := cb1.checked;
end;
function Check2State : boolean; // Install Source Code
begin
result := cb2.checked;
end;
function Check3State : boolean; // Create desktop shortcut
begin
result := cb3.checked;
end;
function Check4State : boolean; // Create desktop shortcut
begin
if InstallFont = True then result := cb4.checked
else result := False;
end;
{Functions used for selecting the correct directories for installation}
function GetSourceFolder(get: string) : string;
begin
result := SourceDirPage.Values[0];
end;
function GetDocFolder(get: string) : string;
begin
result := DocDirPage.Values[0];
end;
{Update the text in the "Ready page"}
function UpdateReadyMemo(Space, NewLine, MemoUserInfoInfo, MemoDirInfo, MemoTypeInfo,
MemoComponentsInfo, MemoGroupInfo, MemoTasksInfo: String): String;
var
S: String;
begin
// Fill the 'Ready Memo' with the normal settings and the custom settings
If InstallType = 1 Then // Default Installation
begin
S := 'Default installation: ' + NewLine + NewLine;
S := S + MemoDirInfo + NewLine + NewLine;
S := S + MemoGroupInfo + NewLine + NewLine;
S := S + 'Documentation installed into:' + NewLine;
S := S + ' ' + DocDirPage.Values[0] + NewLine + NewLine;
S := S + 'Source code installed into:' + NewLine;
S := S + ' ' + SourceDirPage.Values[0] + NewLine + NewLine;
S := S + 'Program will start with Windows' + NewLine + NewLine;
S := S + 'Program shortcut will be placed onto desktop' + NewLine + NewLine;
if InstallFont = True then S := S + 'Font(s) will be installed'
end
else // Custom installation
begin
S := 'Custom installation:' + NewLine + NewLine;
S := S + MemoDirInfo + NewLine + NewLine;
S := S + MemoGroupInfo + NewLine + NewLine;
S := S + 'Documentation installed into:' + NewLine;
S := S + ' ' + DocDirPage.Values[0] + NewLine + NewLine;
if cb1.checked = true then
begin
S := S + 'Source code installed into:' + NewLine;
S := S + ' ' + SourceDirPage.Values[0] + NewLine + NewLine;
end
else
S := 'No source code installed' + NewLine;
if cb1.Checked = true then S := S + 'Program will start with Windows' + NewLine + NewLine;
if cb3.checked = True then S := S + 'Program shortcut will be placed onto desktop' + NewLine + NewLine;
if InstallFont = True then
S := S + 'Font(s) will be installed'
end;
Result := S;
end;
procedure AboutButtonOnClick(Sender: TObject);
begin
MsgBox(LicenseText, mbInformation, mb_Ok);
end;
procedure CreateAboutButton(ParentForm: TSetupForm; CancelButton: TNewButton);
var
AboutButton: TNewButton;
URLLabel: TNewStaticText;
begin
AboutButton := TNewButton.Create(ParentForm);
AboutButton.Left := ParentForm.ClientWidth - CancelButton.Left - CancelButton.Width;
AboutButton.Top := CancelButton.Top;
AboutButton.Width := CancelButton.Width;
AboutButton.Height := CancelButton.Height;
AboutButton.Caption := '&License...';
AboutButton.OnClick := @AboutButtonOnClick;
AboutButton.Parent := ParentForm;
end;