| 51883 |
ripley |
1 |
|
|
|
2 |
[Code]
|
|
|
3 |
|
|
|
4 |
var
|
|
|
5 |
NoAdminPage: TOutputMsgWizardPage;
|
|
|
6 |
SelectOptionsPage: TInputOptionWizardPage;
|
|
|
7 |
MDISDIPage: TInputOptionWizardPage;
|
|
|
8 |
HelpStylePage: TInputOptionWizardPage;
|
|
|
9 |
InternetPage: TInputOptionWizardPage;
|
|
|
10 |
INIFilename: String;
|
|
|
11 |
|
|
|
12 |
function IsAdmin: boolean;
|
|
|
13 |
begin
|
|
|
14 |
Result := IsAdminLoggedOn or IsPowerUserLoggedOn;
|
|
|
15 |
end;
|
|
|
16 |
|
|
|
17 |
function NonAdmin: boolean;
|
|
|
18 |
begin
|
|
|
19 |
Result := not IsAdmin;
|
|
|
20 |
end;
|
|
|
21 |
|
|
|
22 |
procedure InitializeWizard;
|
|
|
23 |
var
|
|
|
24 |
option : String;
|
|
|
25 |
index : Integer;
|
|
|
26 |
begin
|
|
|
27 |
NoAdminPage := CreateOutputMsgPage(wpWelcome, SetupMessage(msgInformationTitle),
|
|
|
28 |
CustomMessage('adminprivilegesrequired'), CustomMessage('adminexplanation'));
|
|
|
29 |
|
|
|
30 |
SelectOptionsPage := CreateInputOptionPage(wpSelectComponents,
|
|
|
31 |
CustomMessage('startupt'), CustomMessage('startupq'),
|
|
|
32 |
CustomMessage('startupi'), True, False);
|
|
|
33 |
SelectOptionsPage.Add(CustomMessage('startup0'));
|
|
|
34 |
SelectOptionsPage.Add(CustomMessage('startup1'));
|
|
|
35 |
SelectOptionsPage.SelectedValueIndex := 1;
|
|
|
36 |
|
|
|
37 |
MDISDIPage := CreateInputOptionPage(SelectOptionsPage.ID,
|
|
|
38 |
CustomMessage('MDIt'), CustomMessage('MDIq'),
|
|
|
39 |
CustomMessage('MDIi'), True, False);
|
|
|
40 |
MDISDIPage.Add(CustomMessage('MDI0'));
|
|
|
41 |
MDISDIPage.Add(CustomMessage('MDI1'));
|
|
|
42 |
|
|
|
43 |
HelpStylePage := CreateInputOptionPage(MDISDIPage.ID,
|
|
|
44 |
CustomMessage('HelpStylet'), CustomMessage('HelpStyleq'),
|
|
|
45 |
CustomMessage('HelpStylei'), True, False);
|
|
|
46 |
HelpStylePage.Add(CustomMessage('HelpStyle0'));
|
|
|
47 |
HelpStylePage.Add(CustomMessage('HelpStyle1'));
|
|
|
48 |
|
|
|
49 |
InternetPage := CreateInputOptionPage(HelpStylePage.ID,
|
|
|
50 |
CustomMessage('Internett'), CustomMessage('Internetq'),
|
|
|
51 |
CustomMessage('Interneti'), True, False);
|
|
|
52 |
InternetPage.Add(CustomMessage('Internet0'));
|
|
|
53 |
InternetPage.Add(CustomMessage('Internet1'));
|
|
|
54 |
|
|
|
55 |
INIFilename := ExpandConstant('{param:LOADINF}');
|
|
|
56 |
if INIFilename <> '' then INIFilename := ExpandFilename(INIFilename);
|
|
|
57 |
|
|
|
58 |
{ From highest to lowest, priority is:
|
|
|
59 |
LOADINF value
|
|
|
60 |
PreviousData value
|
|
|
61 |
Default from build }
|
|
|
62 |
|
|
|
63 |
option := GetPreviousData('MDISDI', '');
|
|
|
64 |
if INIFilename <> '' then
|
|
|
65 |
option := GetIniString('R', 'MDISDI', option, INIFilename);
|
|
|
66 |
case option of
|
|
|
67 |
'MDI': index := 0;
|
|
|
68 |
'SDI': index := 1;
|
|
|
69 |
else
|
|
|
70 |
index := @MDISDI@;
|
|
|
71 |
end;
|
|
|
72 |
MDISDIPage.SelectedValueIndex := index;
|
|
|
73 |
|
|
|
74 |
option := GetPreviousData('HelpStyle', '');
|
|
|
75 |
if INIFilename <> '' then
|
|
|
76 |
option := GetIniString('R', 'HelpStyle', option, INIFilename);
|
|
|
77 |
case option of
|
|
|
78 |
'plain': index := 0;
|
|
|
79 |
'CHM': index := 1;
|
|
|
80 |
'HTML': index := 1;
|
|
|
81 |
else
|
|
|
82 |
index := @HelpStyle@;
|
|
|
83 |
end;
|
|
|
84 |
HelpStylePage.SelectedValueIndex := index;
|
|
|
85 |
|
|
|
86 |
option := GetPreviousData('Internet', '');
|
|
|
87 |
if INIFilename <> '' then
|
|
|
88 |
option := GetIniString('R', 'Internet', option, INIFilename);
|
|
|
89 |
case option of
|
|
|
90 |
'Standard': index := 0;
|
|
|
91 |
'Internet2': index := 1;
|
|
|
92 |
else
|
|
|
93 |
index := @Internet@;
|
|
|
94 |
end;
|
|
|
95 |
InternetPage.SelectedValueIndex := index;
|
|
|
96 |
|
|
|
97 |
{ Get the save name now, because the current dir might change }
|
|
|
98 |
INIFilename := ExpandConstant('{param:SAVEINF}');
|
|
|
99 |
if INIFilename <> '' then INIFilename := ExpandFilename(INIFilename);
|
|
|
100 |
end;
|
|
|
101 |
|
|
|
102 |
procedure RegisterPreviousData(PreviousDataKey: Integer);
|
|
|
103 |
var
|
|
|
104 |
MDISDI: String;
|
|
|
105 |
HelpStyle: String;
|
|
|
106 |
Internet: String;
|
|
|
107 |
begin
|
|
|
108 |
|
|
|
109 |
|
|
|
110 |
{ Store the settings so we can restore them next time }
|
|
|
111 |
case MDISDIPage.SelectedValueIndex of
|
|
|
112 |
0: MDISDI := 'MDI';
|
|
|
113 |
1: MDISDI := 'SDI';
|
|
|
114 |
end;
|
|
|
115 |
SetPreviousData(PreviousDataKey, 'MDISDI', MDISDI);
|
|
|
116 |
if INIFilename <> '' then
|
|
|
117 |
SetIniString('R', 'MDISDI', MDISDI, INIFilename);
|
|
|
118 |
|
|
|
119 |
case HelpStylePage.SelectedValueIndex of
|
|
|
120 |
0: HelpStyle := 'plain';
|
|
|
121 |
1: HelpStyle := 'HTML';
|
|
|
122 |
end;
|
|
|
123 |
SetPreviousData(PreviousDataKey, 'HelpStyle', HelpStyle);
|
|
|
124 |
if INIFilename <> '' then
|
|
|
125 |
SetIniString('R', 'HelpStyle', HelpStyle, INIFilename);
|
|
|
126 |
|
|
|
127 |
case InternetPage.SelectedValueIndex of
|
|
|
128 |
0: Internet := 'Standard';
|
|
|
129 |
1: Internet := 'Internet2';
|
|
|
130 |
end;
|
|
|
131 |
SetPreviousData(PreviousDataKey, 'Internet', Internet);
|
|
|
132 |
if INIFilename <> '' then
|
|
|
133 |
SetIniString('R', 'Internet', Internet, INIFilename);
|
|
|
134 |
end;
|
|
|
135 |
|
| 62763 |
murdoch |
136 |
function SetCommentMarker(var lines: TArrayOfString; option: String; active: boolean) : boolean;
|
| 51883 |
ripley |
137 |
var
|
|
|
138 |
i : integer;
|
| 62763 |
murdoch |
139 |
old : string;
|
| 51883 |
ripley |
140 |
begin
|
| 62763 |
murdoch |
141 |
Result := false;
|
| 51883 |
ripley |
142 |
for i := 0 to pred(GetArrayLength(lines)) do
|
|
|
143 |
if pos(option, lines[i]) > 0 then
|
|
|
144 |
begin
|
| 62763 |
murdoch |
145 |
old := lines[i];
|
| 51883 |
ripley |
146 |
if active then
|
|
|
147 |
lines[i][1] := ' '
|
|
|
148 |
else
|
|
|
149 |
lines[i][1] := '#';
|
| 62763 |
murdoch |
150 |
if old <> lines[i] then
|
|
|
151 |
Result := true;
|
| 51883 |
ripley |
152 |
exit;
|
|
|
153 |
end;
|
|
|
154 |
end;
|
|
|
155 |
|
|
|
156 |
procedure EditOptions();
|
|
|
157 |
var
|
|
|
158 |
lines : TArrayOfString;
|
|
|
159 |
filename : String;
|
| 62763 |
murdoch |
160 |
changed : boolean;
|
| 51883 |
ripley |
161 |
begin
|
| 62763 |
murdoch |
162 |
changed := false;
|
| 51883 |
ripley |
163 |
filename := ExpandConstant(CurrentFilename);
|
|
|
164 |
LoadStringsFromFile(filename, lines);
|
|
|
165 |
|
| 63077 |
murdoch |
166 |
if SetCommentMarker(lines, 'MDI = yes', MDISDIPage.SelectedValueIndex = 0) then changed := true;
|
|
|
167 |
if SetCommentMarker(lines, 'MDI = no', MDISDIPage.SelectedValueIndex = 1) then changed := true;
|
| 51883 |
ripley |
168 |
|
| 63077 |
murdoch |
169 |
if SetCommentMarker(lines, 'options(help_type="text"', HelpStylePage.SelectedValueIndex = 0) then changed := true;
|
|
|
170 |
if SetCommentMarker(lines, 'options(help_type="html"', HelpStylePage.SelectedValueIndex = 1) then changed := true;
|
| 51883 |
ripley |
171 |
|
| 62763 |
murdoch |
172 |
if changed then
|
|
|
173 |
SaveStringsToFile(filename, lines, False);
|
| 51883 |
ripley |
174 |
end;
|
|
|
175 |
|
|
|
176 |
function CmdParms(Param:String): String;
|
|
|
177 |
begin
|
|
|
178 |
Result := '';
|
|
|
179 |
if InternetPage.SelectedValueIndex = 1 then
|
|
|
180 |
Result := '--internet2';
|
|
|
181 |
end;
|
|
|
182 |
|
|
|
183 |
function ShouldSkipPage(PageID: Integer): boolean;
|
|
|
184 |
begin
|
|
|
185 |
if PageID = NoAdminPage.ID then Result := IsAdmin
|
|
|
186 |
else if (PageID = MDISDIPage.ID) or (PageID = HelpStylePage.ID) or (PageID = InternetPage.ID) then
|
|
|
187 |
Result := SelectOptionsPage.SelectedValueIndex = 1
|
|
|
188 |
else Result := false;
|
|
|
189 |
end;
|
|
|
190 |
|
|
|
191 |
function UserPF(Param:String): String;
|
|
|
192 |
begin
|
|
|
193 |
Result := ExpandConstant('{pf}');
|
|
|
194 |
if (not IsAdmin) then
|
|
|
195 |
begin
|
|
|
196 |
try
|
|
|
197 |
Result := ExpandConstant('{userdocs}');
|
|
|
198 |
except
|
|
|
199 |
// Do nothing, user doesn't have a My Documents folder
|
|
|
200 |
end;
|
|
|
201 |
end;
|
|
|
202 |
end;
|