blob: 439f55b04fb2c8b29b12b7c7a96dfe00db3a9a60 (
plain) (
blame)
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
|
!ifndef NULLSOFT_WINAMP_INSTALLER_EXPRESS_MODE_PAGE_HEADER
!define NULLSOFT_WINAMP_INSTALLER_EXPRESS_MODE_PAGE_HEADER
!include "LogicLib.nsh"
!include "express_mode.nsh"
!include "nx.nsh"
!include "fileFunc.nsh"
!ifdef EXPRESS_MODE
Var expressMode.page.radiobuttonFont
Var expressMode.page.dialog
Var expressMode.page.descriptionText
Var expressMode.page.standardRadiobutton
Var expressMode.page.standardText
Var expressMode.page.customRadiobutton
Var expressMode.page.customText
!macro ExpressMode_InitializePage
StrCpy $expressMode.page.radiobuttonFont 0
StrCpy $expressMode.page.dialog 0
StrCpy $expressMode.page.descriptionText 0
StrCpy $expressMode.page.standardRadiobutton 0
StrCpy $expressMode.page.standardText 0
StrCpy $expressMode.page.customRadiobutton 0
StrCpy $expressMode.page.customText 0
!macroend
!define ExpressMode_InitializePage "!insertmacro 'ExpressMode_InitializePage'"
!macro ExpressMode_InsertPage
PageEx custom
PageCallbacks ExpressMode_OnPageCreate ExpressMode_OnPageLeave
PageExEnd
!macroend
!define ExpressMode_InsertPage "!insertmacro 'ExpressMode_InsertPage'"
Function ExpressMode_OnPageCreate
${If} ${AtLeastWinVista}
!insertmacro MUI_HEADER_TEXT $(IDS_EXPRESS_MODE_HEADER) $(IDS_EXPRESS_MODE_SUBHEADER)
nsDialogs::Create /NOUNLOAD 1018
Pop $expressMode.page.dialog
${If} $expressMode.page.dialog == error
Abort
Return
${EndIf}
nsDialogs::SetRTL $(^RTL)
Push $R0
Push $R1
StrCpy $R0 0 ;next avaliable top position
; Create Radio Button Font
${If} $expressMode.page.radiobuttonFont = 0
IntOp $0 $(^FontSize) + 0
CreateFont $expressMode.page.radiobuttonFont $(^Font) $0 600
${EndIf}
; Calculate Radio Button Text Offset
${NX_ConvertHorzDLU} $expressMode.page.dialog 12 $R2
IntOp $R2 $R2 + 1
; Description Text
StrCpy $0 ""
${If} $0 != ""
${NSD_CreateLabel} 0u $R0 100% 20u $0
Pop $expressMode.page.descriptionText
${NX_GetWindowSize} $expressMode.page.descriptionText $0 $1
${NX_GetLabelIdealSize} $expressMode.page.descriptionText $0 $2 $3
${If} $3 <= $1
${NX_SetWindowSize} $expressMode.page.descriptionText $2 $3
IntOp $R0 $R0 + $3
${Else}
IntOp $R0 $R0 + $1
${EndIf}
${EndIf}
StrCpy $R1 $R0
; Standard Installation Radio Button
${NSD_CreateRadioButton} 0u $R0 100% 10u "$(IDS_EXPRESS_MODE_STANDARD_INSTALL_RADIO)"
Pop $expressMode.page.standardRadiobutton
${If} $expressMode.page.standardRadiobutton <> 0
${NSD_AddStyle} $expressMode.page.standardRadiobutton ${WS_GROUP}
${NSD_OnClick} $expressMode.page.standardRadiobutton \
ExpressMode_OnStandardRadiobuttonClick
${If} $expressMode.page.radiobuttonFont <> 0
SendMessage $expressMode.page.standardRadiobutton \
${WM_SETFONT} \
$expressMode.page.radiobuttonFont 0
${EndIf}
${NX_GetWindowSize} $expressMode.page.standardRadiobutton $0 $1
IntOp $0 $0 - $R2
${NSD_GetText} $expressMode.page.standardRadiobutton $4
${NX_CalculateTextRect} $expressMode.page.standardRadiobutton \
$4 ${DT_WORDBREAK} \
$0 $2 $3
${If} $3 < $1
StrCpy $3 $1
${EndIf}
IntOp $2 $2 + $R2
${NX_SetWindowSize} $expressMode.page.standardRadiobutton $2 $3
IntOp $R0 $R0 + $3
; Standard Installation Text
${NX_ConvertVertDLU} $expressMode.page.dialog 3 $3
IntOp $R0 $R0 + $3
${IfNot} ${FileExists} "$INSTDIR\install.ini"
; we don't have previous selection
StrCpy $0 "$(IDS_EXPRESS_MODE_STANDARD_INSTALL_TEXT)"
${Else}
StrCpy $0 "$(IDS_EXPRESS_MODE_STANDARD_REINSTALL_TEXT)"
${EndIf}
${NSD_CreateLabel} 11u $R0 289u 30u $0
Pop $expressMode.page.standardText
${If} $expressMode.page.standardText <> 0
${NSD_AddStyle} $expressMode.page.standardText ${WS_GROUP}
${NX_GetWindowSize} $expressMode.page.standardText $0 $1
${NX_GetLabelIdealSize} $expressMode.page.standardText $0 $2 $3
${If} $3 > $1
StrCpy $3 $1
${EndIf}
${NX_SetWindowSize} $expressMode.page.standardText $2 $3
IntOp $R0 $R0 + $3
${Else}
IntOp $R0 $R0 - $3
${EndIf}
${NX_ConvertVertDLU} $expressMode.page.dialog 12 $0
IntOp $R0 $R0 + $0
${EndIf}
; Custom Installation Radio Button
${NSD_CreateRadioButton} 0u $R0 100% 10u "$(IDS_EXPRESS_MODE_CUSTOM_INSTALL_RADIO)"
Pop $expressMode.page.customRadiobutton
${If} $expressMode.page.customRadiobutton <> 0
${NSD_OnClick} $expressMode.page.customRadiobutton \
ExpressMode_OnCustomRadiobuttonClick
${If} $expressMode.page.radiobuttonFont <> 0
SendMessage $expressMode.page.customRadiobutton \
${WM_SETFONT} \
$expressMode.page.radiobuttonFont 0
${EndIf}
${NX_GetWindowSize} $expressMode.page.customRadiobutton $0 $1
IntOp $0 $0 - $R2
${NSD_GetText} $expressMode.page.customRadiobutton $4
${NX_CalculateTextRect} $expressMode.page.customRadiobutton \
$4 ${DT_WORDBREAK} \
$0 $2 $3
${If} $3 < $1
StrCpy $3 $1
${EndIf}
IntOp $2 $2 + $R2
${NX_SetWindowSize} $expressMode.page.customRadiobutton $2 $3
IntOp $R0 $R0 + $3
${If} $expressMode.page.standardText <> 0
${NX_SetWindowOrder} $expressMode.page.standardText \
$expressMode.page.customRadiobutton
${EndIf}
; Custom Installation Text
${NX_ConvertVertDLU} $expressMode.page.dialog 3 $3
IntOp $R0 $R0 + $3
${NSD_CreateLabel} 11u $R0 289u 30u "$(IDS_EXPRESS_MODE_CUSTOM_INSTALL_TEXT)"
Pop $expressMode.page.customText
${If} $expressMode.page.customText <> 0
${NX_GetWindowSize} $expressMode.page.customText $0 $1
${NX_GetLabelIdealSize} $expressMode.page.customText $0 $2 $3
${If} $3 > $1
StrCpy $3 $1
${EndIf}
${NX_SetWindowSize} $expressMode.page.customText $2 $3
IntOp $R0 $R0 + $3
${Else}
IntOp $R0 $R0 - $3
${EndIf}
${EndIf}
${NX_GetWindowSize} $expressMode.page.dialog $1 $0
IntOp $0 $0 - $R1
IntOp $1 $R0 - $R1
${If} $0 > $1
IntOp $0 $0 - $1
IntOp $0 $0 / 3
${If} $expressMode.page.standardRadiobutton <> 0
${NX_OffsetWindowPos} $expressMode.page.standardRadiobutton 0 $0
${EndIf}
${If} $expressMode.page.standardText <> 0
${NX_OffsetWindowPos} $expressMode.page.standardText 0 $0
${EndIf}
${If} $expressMode.page.customRadiobutton <> 0
${NX_OffsetWindowPos} $expressMode.page.customRadiobutton 0 $0
${EndIf}
${If} $expressMode.page.customText <> 0
${NX_OffsetWindowPos} $expressMode.page.customText 0 $0
${EndIf}
${EndIf}
Pop $R1
Pop $R0
Call ExpressMode_UpdatePage
; Show Dialog
nsDialogs::Show ; not return until the user clicks Next, Back or Cancel.
${EndIf}
Return
FunctionEnd
Function ExpressMode_UpdatePage
Push $0
${ExpressMode_IsEnabled} $0
${If} $0 == "yes"
${NSD_Check} $expressMode.page.standardRadiobutton
${NSD_Uncheck} $expressMode.page.customRadiobutton
${NextButton_SetNextPageMode} $0
${Else}
${NSD_Uncheck} $expressMode.page.standardRadiobutton
${NSD_Check} $expressMode.page.customRadiobutton
${NextButton_SetLastPageMode} "no"
${EndIf}
Pop $0
FunctionEnd
!define ExpressMode_UpdatePage 'call ExpressMode_UpdatePage'
Function ExpressMode_OnStandardRadiobuttonClick
Exch $0
${NSD_GetState} $expressMode.page.standardRadiobutton $0
${If} $0 = ${BST_CHECKED}
${ExpressMode_IsEnabled} $0
${If} $0 != "yes"
${ExpressMode_Enable}
${ExpressMode_UpdatePage}
${EndIf}
${Else}
${ExpressMode_IsEnabled} $0
${If} $0 == "yes"
${ExpressMode_Disable}
${ExpressMode_UpdatePage}
${EndIf}
${EndIf}
Pop $0
FunctionEnd
Function ExpressMode_OnCustomRadiobuttonClick
Exch $0
${NSD_GetState} $expressMode.page.customRadiobutton $0
${If} $0 = ${BST_CHECKED}
${ExpressMode_IsEnabled} $0
${If} $0 == "yes"
${ExpressMode_Disable}
${ExpressMode_UpdatePage}
${EndIf}
${Else}
${ExpressMode_IsEnabled} $0
${If} $0 != "yes"
${ExpressMode_Enable}
${ExpressMode_UpdatePage}
${EndIf}
${EndIf}
Pop $0
FunctionEnd
Function ExpressMode_OnPageLeave
${If} $expressMode.page.radiobuttonFont <> 0
System::Call "${fnDeleteObject}($expressMode.page.radiobuttonFont)"
StrCpy $expressMode.page.radiobuttonFont 0
${EndIf}
StrCpy $expressMode.page.dialog 0
StrCpy $expressMode.page.descriptionText 0
StrCpy $expressMode.page.standardRadiobutton 0
StrCpy $expressMode.page.standardText 0
StrCpy $expressMode.page.customRadiobutton 0
StrCpy $expressMode.page.customText 0
FunctionEnd
!else ; defined(EXPRESS_MODE)
!define ExpressMode_InitializePage ""
!define ExpressMode_InsertPage ""
!endif ; defined(EXPRESS_MODE)
!endif ; defined(NULLSOFT_WINAMP_INSTALLER_EXPRESS_MODE_PAGE_HEADER)
|