1##########################
2# Included files
3##########################
4!addincludedir ${NSIDIR}
5!addplugindir ${NSIDIR}/plugin
6
7!include Sections.nsh
8!include MUI2.nsh
9!include nsDialogs.nsh
10!include Memento.nsh
11!include FileFunc.nsh
12!include UAC.nsh
13!include WinVer.nsh
14!include WordFunc.nsh
15#!include revision.nsh
16
17SetCompressor /SOLID lzma
18SetCompressorDictSize 96
19RequestExecutionLevel user
20
21##########################
22# Defines
23##########################
24!define BUILD_BITS 64
25!define QT_DIR /mingw/Qt/current/bin/
26!define ADM_SYSDIR /mingw/bin
27!define ADM_DIR /mingw/Release
28#!define NSIDIR "/home/fx/hudson/workspace/mingw_2.6.2_nsis/avidemux/winInstaller"
29#!define SVN_VERSION 6
30!define REVISION ${SVN_VERSION}
31!define EXEDIR "${NSIDIR}/install"
32
33!define CORE_VERSION "2.6"
34!define POINT_RELEASE "8"
35!define PRODUCT_VERSION "${CORE_VERSION}.${POINT_RELEASE}.${SVN_VERSION}"
36!define PRODUCT_NAME "Avidemux ${CORE_VERSION} - 64bits"
37!define PRODUCT_FULLNAME "Avidemux ${PRODUCT_VERSION} (${BUILD_BITS}-bit Release)"
38
39!if ${BUILD_BITS} == 64
40	!define SHORTCUT_NAME "${PRODUCT_NAME}"
41	!define REG_GROUPNAME "${PRODUCT_NAME} (${BUILD_BITS}-bit)"
42!else
43	!define SHORTCUT_NAME "${PRODUCT_NAME} (${BUILD_BITS}-bit)"
44	!define REG_GROUPNAME "${PRODUCT_NAME}"
45!endif
46
47!define REGKEY "SOFTWARE\${REG_GROUPNAME}"
48!define UNINST_REGKEY "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_GROUPNAME}"
49!define COMPANY "Free Software Foundation"
50!define URL "http://www.avidemux.org"
51
52OutFile "${EXEDIR}/avidemux_${CORE_VERSION}.${POINT_RELEASE}_r${REVISION}_win${BUILD_BITS}.exe"
53Name "${PRODUCT_FULLNAME}"
54
55##########################
56# Memento defines
57##########################
58!define MEMENTO_REGISTRY_ROOT HKLM
59!define MEMENTO_REGISTRY_KEY "${REGKEY}"
60
61##########################
62# MUI defines
63##########################
64!define MUI_ICON "${NSIDIR}/../common/xpm/adm.ico"
65!define MUI_HEADERIMAGE
66!define MUI_HEADERIMAGE_RIGHT
67!define MUI_HEADERIMAGE_BITMAP "${NSIDIR}/PageHeader.bmp"
68!define MUI_STARTMENUPAGE_REGISTRY_ROOT HKLM
69!define MUI_STARTMENUPAGE_REGISTRY_KEY "${REGKEY}"
70!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME StartMenuGroup
71!define MUI_STARTMENUPAGE_DEFAULTFOLDER "Avidemux (64bits)"
72!define MUI_STARTMENUPAGE_NODISABLE
73!define MUI_WELCOMEFINISHPAGE_BITMAP "${NSIDIR}/WelcomeFinishStrip.bmp"
74!define MUI_UNWELCOMEFINISHPAGE_BITMAP "${NSIDIR}/WelcomeFinishStrip.bmp"
75!define MUI_UNICON "${NSIDIR}/../common/xpm/adm.ico"
76!define MUI_COMPONENTSPAGE_NODESC
77
78##########################
79# Variables
80##########################
81Var CreateDesktopIcon
82Var CreateStartMenuGroup
83Var CreateQuickLaunchIcon
84Var StartMenuGroup
85Var PreviousVersion
86Var PreviousVersionState
87Var ReinstallUninstall
88
89##########################
90# Installer pages
91##########################
92!define MUI_WELCOMEPAGE_TITLE "${PRODUCT_FULLNAME} Setup Wizard"
93!insertmacro MUI_PAGE_WELCOME
94!insertmacro MUI_PAGE_LICENSE "${NSIDIR}/License.rtf"
95 Page custom ReinstallPage ReinstallPageLeave
96!insertmacro MUI_PAGE_COMPONENTS
97Page custom InstallOptionsPage
98!define MUI_PAGE_CUSTOMFUNCTION_PRE IsStartMenuRequired
99!insertmacro MUI_PAGE_STARTMENU Application $StartMenuGroup
100!insertmacro MUI_PAGE_DIRECTORY
101!define MUI_PAGE_CUSTOMFUNCTION_PRE ActivateInternalSections
102!define MUI_PAGE_CUSTOMFUNCTION_SHOW InstFilesPageShow
103!define MUI_PAGE_CUSTOMFUNCTION_LEAVE InstFilesPageLeave
104!insertmacro MUI_PAGE_INSTFILES
105!define MUI_FINISHPAGE_RUN
106!define MUI_FINISHPAGE_RUN_FUNCTION RunAvidemux
107!define MUI_FINISHPAGE_RUN_TEXT "Run ${PRODUCT_NAME} now"
108!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR/Change Log.html"
109!define MUI_FINISHPAGE_SHOWREADME_TEXT "View Change Log now"
110!define MUI_FINISHPAGE_LINK "Visit the Avidemux website"
111!define MUI_FINISHPAGE_LINK_LOCATION "http://www.avidemux.org"
112!define MUI_PAGE_CUSTOMFUNCTION_PRE ConfigureFinishPage
113!insertmacro MUI_PAGE_FINISH
114
115!define MUI_PAGE_CUSTOMFUNCTION_PRE un.ConfirmPagePre
116!insertmacro MUI_UNPAGE_CONFIRM
117!insertmacro MUI_UNPAGE_INSTFILES
118!define MUI_PAGE_CUSTOMFUNCTION_PRE un.FinishPagePre
119!insertmacro MUI_UNPAGE_FINISH
120
121##########################
122# Installer languages
123##########################
124!insertmacro MUI_LANGUAGE English
125
126##########################
127# Installer attributes
128##########################
129!if ${BUILD_BITS} == 64
130	InstallDir "$PROGRAMFILES64\${PRODUCT_NAME}"
131!else
132	InstallDir "$PROGRAMFILES\${PRODUCT_NAME}"
133!endif
134
135CRCCheck on
136XPStyle on
137ShowInstDetails nevershow
138ShowUninstDetails nevershow
139VIProductVersion ${PRODUCT_VERSION}
140VIAddVersionKey ProductName Avidemux
141VIAddVersionKey ProductVersion "${PRODUCT_VERSION}"
142VIAddVersionKey FileVersion ""
143VIAddVersionKey FileDescription ""
144VIAddVersionKey LegalCopyright ""
145InstallDirRegKey HKLM "${REGKEY}" Path
146BrandingText "Packaged by Gruntster"
147InstType Standard
148InstType Full
149#########################################
150#
151#########################################
152Function GetAfterChar
153  Exch $0 ; chop char
154  Exch
155  Exch $1 ; input string
156  Push $2
157  Push $3
158  StrCpy $2 0
159  loop:
160    IntOp $2 $2 - 1
161    StrCpy $3 $1 1 $2
162    StrCmp $3 "" 0 +3
163      StrCpy $0 ""
164      Goto exit2
165    StrCmp $3 $0 exit1
166    Goto loop
167  exit1:
168    IntOp $2 $2 + 1
169    StrCpy $0 $1 "" $2
170  exit2:
171    Pop $3
172    Pop $2
173    Pop $1
174    Exch $0 ; output
175FunctionEnd
176#####################################################################�
177!define StrReplace '!insertmacro "_Name"'
178
179##########################
180# Uninstaller macros
181##########################
182!insertmacro un.GetOptions
183!insertmacro un.GetParameters
184
185!define UninstallLogPath "$INSTDIR\uninstall.log"
186Var UninstallLogHandle
187
188; Uninstall log file missing.
189LangString UninstallLogMissing ${LANG_ENGLISH} "uninstall.log not found!$\r$\nUninstallation cannot proceed!"
190# Regexep Does not work with cross
191# Use only one file at a time
192!macro InstallFile FILEZ
193	File "${FILEZ}"
194	Push "${FILEZ}"
195	Push "/"
196	Call GetAfterChar
197	Pop $R0
198	FileWrite $UninstallLogHandle "$OUTDIR\$R0$\r$\n"
199!macroend
200!define File "!insertmacro InstallFile"
201
202!macro InstallFolder FILEREGEX
203	File /r "${FILEREGEX}/*"
204	Push "$OUTDIR"
205	Call InstallFolderInternal
206!macroend
207!define Folder "!insertmacro InstallFolder"
208
209Function InstallFolderInternal
210	Pop $9
211	!define Index 'Line${__LINE__}'
212	FindFirst $0 $1 "$9/*"
213	StrCmp $0 "" "${Index}-End"
214"${Index}-Loop:"
215	StrCmp $1 "" "${Index}-End"
216	StrCmp $1 "." "${Index}-Next"
217	StrCmp $1 ".." "${Index}-Next"
218	IfFileExists "$9\$1\*" 0 "${Index}-Write"
219		Push $0
220		Push $9
221		Push "$9\$1"
222		Call InstallFolderInternal
223		Pop $9
224		Pop $0
225		Goto "${Index}-Next"
226"${Index}-Write:"
227	FileWrite $UninstallLogHandle "$9\$1$\r$\n"
228"${Index}-Next:"
229	FindNext $0 $1
230	Goto "${Index}-Loop"
231"${Index}-End:"
232	!undef Index
233FunctionEnd
234
235; WriteUninstaller macro
236!macro WriteUninstaller Path
237	WriteUninstaller "${Path}"
238	FileWrite $UninstallLogHandle "${Path}$\r$\n"
239!macroend
240!define WriteUninstaller "!insertmacro WriteUninstaller"
241
242##########################
243# Macros
244##########################
245
246!macro InstallQtLanguage LANG_NAME LANG_CODE
247	SetOverwrite on
248
249	!insertmacro SectionFlagIsSet ${SecUiQt} ${SF_SELECTED} installQt${LANG_CODE} endQt${LANG_CODE}
250
251installQt${LANG_CODE}:
252	SetOutPath $INSTDIR\i18n
253    ${File} i18n/avidemux_${LANG_CODE}.qm
254    ${File} i18n/qt_${LANG_CODE}.qm
255
256endQt${LANG_CODE}:
257!macroend
258
259##########################
260# Installer sections
261##########################
262Section -OpenLogFile
263	CreateDirectory "$INSTDIR"
264	FileOpen $UninstallLogHandle ${UninstallLogPath} a
265	FileSeek $UninstallLogHandle 0 END
266SectionEnd
267
268Section "Avidemux Core" SecCore
269    SectionIn 1 2 RO
270    SetOutPath $INSTDIR
271    SetOverwrite on
272    ${File} "./Build Info.txt"
273    ${File} "./Change Log.html"
274    ${File} ${ADM_SYSDIR}/libexpat-1.dll
275    #${File} ${ADM_SYSDIR}/mgwz.dll
276    ${File} ${ADM_SYSDIR}/libfreetype-6.dll
277    ${File} ${ADM_SYSDIR}/libsqlite3-0.dll
278    ${File} ${ADM_SYSDIR}/libstdc++-6.dll
279    ${File} ${ADM_SYSDIR}/libgcc_s_seh-1.dll
280    ${File} ${ADM_SYSDIR}/libwinpthread-1.dll
281    ${File} ${ADM_SYSDIR}/libpng16-16.dll
282    ${File} ${ADM_SYSDIR}/SDL.dll
283    ${File} ${ADM_SYSDIR}/libz.dll
284    ${File} ${ADM_SYSDIR}/libz.dll.1.2.8
285    ${File} ${ADM_DIR}/libADM_audioParser6.dll
286    ${File} ${ADM_DIR}/libADM_core6.dll
287    ${File} ${ADM_DIR}/libADM_coreAudio6.dll
288    ${File} ${ADM_DIR}/libADM_coreAudioDevice6.dll
289    ${File} ${ADM_DIR}/libADM_coreAudioEncoder6.dll
290    ${File} ${ADM_DIR}/libADM_coreAudioFilterAPI6.dll
291    ${File} ${ADM_DIR}/libADM_coreDemuxer6.dll
292    ${File} ${ADM_DIR}/libADM_coreDemuxerMpeg6.dll
293    ${File} ${ADM_DIR}/libADM_coreImage6.dll
294    ${File} ${ADM_DIR}/libADM_coreImageLoader6.dll
295    ${File} ${ADM_DIR}/libADM_coreJobs.dll
296    ${File} ${ADM_DIR}/libADM_coreMuxer6.dll
297    ${File} ${ADM_DIR}/libADM_coreScript.dll
298    ${File} ${ADM_DIR}/libADM_coreSocket6.dll
299    ${File} ${ADM_DIR}/libADM_coreSqlLight3.dll
300    ${File} ${ADM_DIR}/libADM_coreUI6.dll
301    ${File} ${ADM_DIR}/libADM_coreUtils6.dll
302    ${File} ${ADM_DIR}/libADM_coreVideoCodec6.dll
303    ${File} ${ADM_DIR}/libADM_coreVideoEncoder6.dll
304    ${File} ${ADM_DIR}/libADM_coreVideoFilter6.dll
305    ${File} ${ADM_DIR}/libADM_coreSubtitle.dll
306    ${File} ${QT_DIR}/QtCore4.dll
307    ${File} ${QT_DIR}/QtGui4.dll
308    ${File} ${NSIDIR}/../../AUTHORS.
309    ${File} ${NSIDIR}/../../COPYING.
310    ${File} ${NSIDIR}/../../README.
311    ${File} ${ADM_DIR}/avcodec-*.dll
312    ${File} ${ADM_DIR}/avformat-*.dll
313    ${File} ${ADM_DIR}/avutil-*.dll
314    ${File} ${ADM_DIR}/postproc-*.dll
315    ${File} ${ADM_DIR}/swscale-*.dll
316
317	WriteRegStr HKLM "${REGKEY}" CreateDesktopIcon $CreateDesktopIcon
318	WriteRegStr HKLM "${REGKEY}" CreateStartMenuGroup $CreateStartMenuGroup
319
320	${If} ${AtMostWinVista}
321		WriteRegStr HKLM "${REGKEY}" CreateQuickLaunchIcon $CreateQuickLaunchIcon
322	${EndIf}
323SectionEnd
324
325SectionGroup /e "User interfaces" SecGrpUI
326    ${MementoUnselectedSection} "Command Line" SecUiCli
327        SectionIn 2
328        SetOutPath $INSTDIR
329        SetOverwrite on
330        ${File} ${ADM_DIR}/avidemux_cli.exe
331        ${File} ${ADM_DIR}/libADM_render6_cli.dll
332        ${File} ${ADM_DIR}/libADM_UI_Cli6.dll
333    ${MementoSectionEnd}
334
335    ${MementoSection} Qt SecUiQt
336	SectionIn 1 2 RO
337        SetOutPath $INSTDIR
338        SetOverwrite on
339        ${File} ${ADM_DIR}/avidemux.exe
340        ${File} ${ADM_DIR}/avidemux_jobs.exe
341        ${File} ${ADM_DIR}/libADM_render6_QT4.dll
342        ${File} ${ADM_DIR}/libADM_UIQT46.dll
343        ${File} ${QT_DIR}/QtOpenGL4.dll
344        #${File} ${QT_DIR}/libgcc_s_dw2-1.dll
345        #${File} ${QT_DIR}/mingwm10.dll
346    ${MementoSectionEnd}
347SectionGroupEnd
348
349SectionGroup "Audio Decoders" SecGrpAudioDecoder
350	${MementoSection} "�-law" SecAudDecUlaw
351		SectionIn 1 2
352		SetOverwrite on
353		SetOutPath $INSTDIR\plugins\audioDecoder
354		${File} ${ADM_DIR}/plugins/audioDecoder/libADM_ad_ulaw.dll
355	${MementoSectionEnd}
356	${MementoSection} "AAC (FAAD)" SecAudDecFaad
357		SectionIn 1 2
358		SetOverwrite on
359		SetOutPath $INSTDIR\plugins\audioDecoder
360		${File} ${ADM_DIR}/plugins/audioDecoder/libADM_ad_faad.dll
361		#SetOutPath $INSTDIR
362		#${File} ${ADM_SYSDIR}/libfaad2.dll
363	${MementoSectionEnd}
364	${MementoSection} "AAC, AC-3, ADPCM IMA AMV, DTS, E-AC-3, MP2, MP3, Nellymoser, QDesign, WMA (libavcodec)" SecAudDecAvcodec
365		SectionIn 1 2
366		SetOverwrite on
367		SetOutPath $INSTDIR\plugins\audioDecoder
368		${File} ${ADM_DIR}/plugins/audioDecoder/libADM_ad_lav.dll
369	${MementoSectionEnd}
370	${MementoSection} "AC-3 (liba52)" SecAudDecA52
371		SectionIn 1 2
372		SetOverwrite on
373		SetOutPath $INSTDIR\plugins\audioDecoder
374		${File} ${ADM_DIR}/plugins/audioDecoder/libADM_ad_a52.dll
375	${MementoSectionEnd}
376	${MementoSection} "ADPCM IMA" SecAudDecImaAdpcm
377		SectionIn 1 2
378		SetOverwrite on
379		SetOutPath $INSTDIR\plugins\audioDecoder
380		${File} ${ADM_DIR}/plugins/audioDecoder/libADM_ad_ima_adpcm.dll
381	${MementoSectionEnd}
382	${MementoSection} "ADPCM Microsoft" SecAudDecMsAdpcm
383		SectionIn 1 2
384		SetOverwrite on
385		SetOutPath $INSTDIR\plugins\audioDecoder
386		${File} ${ADM_DIR}/plugins/audioDecoder/libADM_ad_ms_adpcm.dll
387	${MementoSectionEnd}
388	${MementoSection} "AMR-NB" SecAudDecOpencoreAmrNb
389		SectionIn 1 2
390		SetOverwrite on
391		SetOutPath $INSTDIR\plugins\audioDecoder
392		${File} ${ADM_DIR}/plugins/audioDecoder/libADM_ad_opencore_amrnb.dll
393		SetOutPath $INSTDIR
394		${File} ${ADM_SYSDIR}/libopencore-amrnb-*.dll
395	${MementoSectionEnd}
396	${MementoSection} "AMR-WB" SecAudDecOpencoreAmrWb
397		SectionIn 1 2
398		SetOverwrite on
399		SetOutPath $INSTDIR\plugins\audioDecoder
400		${File} ${ADM_DIR}/plugins/audioDecoder/libADM_ad_opencore_amrwb.dll
401		SetOutPath $INSTDIR
402		${File} ${ADM_SYSDIR}/libopencore-amrwb-*.dll
403	${MementoSectionEnd}
404	${MementoSection} "MP2, MP3 (MAD)" SecAudDecMad
405		SectionIn 1 2
406		SetOverwrite on
407		SetOutPath $INSTDIR\plugins\audioDecoder
408		${File} ${ADM_DIR}/plugins/audioDecoder/libADM_ad_Mad.dll
409	${MementoSectionEnd}
410	${MementoSection} "Vorbis" SecAudDecVorbis
411		SectionIn 1 2
412		SetOverwrite on
413		SetOutPath $INSTDIR\plugins\audioDecoder
414		${File} ${ADM_DIR}/plugins/audioDecoder/libADM_ad_vorbis.dll
415		SetOutPath $INSTDIR
416		${File} ${ADM_SYSDIR}/libogg-0.dll
417		${File} ${ADM_SYSDIR}/libvorbis-0.dll
418	${MementoSectionEnd}
419SectionGroupEnd
420SectionGroup "Audio Devices" SecGrpAudioDevice
421	${MementoSection} "Waveform" SecAudDevWaveform
422		SectionIn 1 2
423		SetOverwrite on
424		SetOutPath $INSTDIR\plugins\audioDevices
425		${File} ${ADM_DIR}/plugins/audioDevices/libADM_av_win32.dll
426	${MementoSectionEnd}
427SectionGroupEnd
428SectionGroup "Audio Encoders" SecGrpAudioEncoder
429	${MementoSection} "AAC (FAAC)" SecAudEncFaac
430		SectionIn 1 2
431		SetOverwrite on
432		SetOutPath $INSTDIR\plugins\audioEncoders
433		${File} ${ADM_DIR}/plugins/audioEncoders/libADM_ae_faac.dll
434		#SetOutPath $INSTDIR
435		#${File} ${ADM_SYSDIR}libfaac.dll
436	${MementoSectionEnd}
437	${MementoSection} "AAC (libavcodec)" SecAudEncLavAac
438		SectionIn 1 2
439		SetOverwrite on
440		SetOutPath $INSTDIR\plugins\audioEncoders
441		${File} ${ADM_DIR}/plugins/audioEncoders/libADM_ae_lav_aac.dll
442	${MementoSectionEnd}
443	${MementoSection} "AC-3 (Aften)" SecAudDecAften
444		SectionIn 1 2
445		SetOverwrite on
446		SetOutPath $INSTDIR\plugins\audioEncoders
447		${File} ${ADM_DIR}/plugins/audioEncoders/libADM_ae_aften.dll
448		SetOutPath $INSTDIR
449		${File} ${ADM_SYSDIR}/libaften.dll
450	${MementoSectionEnd}
451	${MementoSection} "AC-3 (libavcodec)" SecAudEncLavAc3
452		SectionIn 1 2
453		SetOverwrite on
454		SetOutPath $INSTDIR\plugins\audioEncoders
455		${File} ${ADM_DIR}/plugins/audioEncoders/libADM_ae_lav_ac3.dll
456	${MementoSectionEnd}
457	#${MementoSection} "DTS (dcaenc)" SecAudDecDcaEnc
458		#SectionIn 1 2
459		#SetOverwrite on
460		#SetOutPath $INSTDIR\plugins\audioEncoders
461		#${File} ${ADM_DIR}/plugins/audioEncoders/libADM_ae_dcaenc.dll
462		#SetOutPath $INSTDIR
463		#${File} libdcaenc-0.dll
464	#${MementoSectionEnd}
465	${MementoSection} "MP2 (libavcodec)" SecAudEncLavMp2
466		SectionIn 1 2
467		SetOverwrite on
468		SetOutPath $INSTDIR\plugins\audioEncoders
469		${File} ${ADM_DIR}/plugins/audioEncoders/libADM_ae_lav_mp2.dll
470		SetOutPath $INSTDIR
471		#${File} ${ADM_SYSDIR}/libtwolame-*.dll
472	${MementoSectionEnd}
473	#${MementoSection} "MP2 (TwoLAME)" SecAudEncTwoLame
474		#SectionIn 1 2
475		#SetOverwrite on
476		#SetOutPath $INSTDIR\plugins\audioEncoders
477		#${File} ${ADM_DIR}/plugins/audioEncoders/libADM_ae_twolame.dll
478	#${MementoSectionEnd}
479	${MementoSection} "MP3" SecAudEncLame
480		SectionIn 1 2
481		SetOverwrite on
482		SetOutPath $INSTDIR\plugins\audioEncoders
483		${File} ${ADM_DIR}/plugins/audioEncoders/libADM_ae_lame.dll
484		SetOutPath $INSTDIR
485		${File} ${ADM_SYSDIR}/libmp3lame-0.dll
486	${MementoSectionEnd}
487	${MementoSection} "PCM" SecAudEncPcm
488		SectionIn 1 2
489		SetOverwrite on
490		SetOutPath $INSTDIR\plugins\audioEncoders
491		${File} ${ADM_DIR}/plugins/audioEncoders/libADM_ae_pcm.dll
492	${MementoSectionEnd}
493	${MementoSection} "Vorbis" SecAudEncVorbis
494		SectionIn 1 2
495		SetOverwrite on
496		SetOutPath $INSTDIR\plugins\audioEncoders
497		${File} ${ADM_DIR}/plugins/audioEncoders/libADM_ae_vorbis.dll
498		SetOutPath $INSTDIR
499		${File} ${ADM_SYSDIR}/libogg-0.dll
500		${File} ${ADM_SYSDIR}/libvorbis-0.dll
501		${File} ${ADM_SYSDIR}/libvorbisenc-2.dll
502		${File} ${ADM_SYSDIR}/libvorbisfile-3.dll
503	${MementoSectionEnd}
504SectionGroupEnd
505SectionGroup "Avisynth" SecGrpAvisynth
506	${MementoUnselectedSection} "Avisynth Proxy" SecAvsProxy
507		SectionIn 2
508		SetOutPath $INSTDIR
509		SetOverwrite on
510		${File} ${ADM_SYSDIR}/avsproxy.exe
511		${File} ${ADM_SYSDIR}/avsproxy_gui.exe
512	${MementoSectionEnd}
513	${MementoUnselectedSection} "Avisynth Proxy Demuxer" SecDemuxAvisynth
514		SectionIn 2
515		SetOverwrite on
516		SetOutPath $INSTDIR\plugins\demuxers
517		${File} ${ADM_DIR}/plugins/demuxers/libADM_dm_avsproxy.dll
518	${MementoSectionEnd}
519SectionGroupEnd
520SectionGroup "Demuxers" SecGrpDemuxers
521	${MementoSection} "ASF" SecDemuxAsf
522		SectionIn 1 2
523		SetOverwrite on
524		SetOutPath $INSTDIR\plugins\demuxers
525		${File} ${ADM_DIR}/plugins/demuxers/libADM_dm_asf.dll
526	${MementoSectionEnd}
527	${MementoSection} "BMP, JPEG, PNG Images" SecDemuxImage
528		SectionIn 1 2
529		SetOverwrite on
530		SetOutPath $INSTDIR\plugins\demuxers
531		${File} ${ADM_DIR}/plugins/demuxers/libADM_dm_pic.dll
532	${MementoSectionEnd}
533	${MementoSection} "Flash Video" SecDemuxFlv
534		SectionIn 1 2
535		SetOverwrite on
536		SetOutPath $INSTDIR\plugins\demuxers
537		${File} ${ADM_DIR}/plugins/demuxers/libADM_dm_flv.dll
538	${MementoSectionEnd}
539	${MementoSection} "Matroska" SecDemuxMatroska
540		SectionIn 1 2
541		SetOverwrite on
542		SetOutPath $INSTDIR\plugins\demuxers
543		${File} ${ADM_DIR}/plugins/demuxers/libADM_dm_matroska.dll
544	${MementoSectionEnd}
545	${MementoSection} "MP4" SecDemuxMp4
546		SectionIn 1 2
547		SetOverwrite on
548		SetOutPath $INSTDIR\plugins\demuxers
549		${File} ${ADM_DIR}/plugins/demuxers/libADM_dm_mp4.dll
550	${MementoSectionEnd}
551	${MementoSection} "MPEG-PS" SecDemuxMpegPs
552		SectionIn 1 2
553		SetOverwrite on
554		SetOutPath $INSTDIR\plugins\demuxers
555		${File} ${ADM_DIR}/plugins/demuxers/libADM_dm_ps.dll
556	${MementoSectionEnd}
557	${MementoSection} "MPEG-TS" SecDemuxMpegTs
558		SectionIn 1 2
559		SetOverwrite on
560		SetOutPath $INSTDIR\plugins\demuxers
561		${File} ${ADM_DIR}/plugins/demuxers/libADM_dm_ts.dll
562	${MementoSectionEnd}
563	${MementoSection} "MXF" SecDemuxMxf
564		SectionIn 1 2
565		SetOverwrite on
566		SetOutPath $INSTDIR\plugins\demuxers
567		${File} ${ADM_DIR}/plugins/demuxers/libADM_dm_mxf.dll
568	${MementoSectionEnd}
569	${MementoSection} "OpenDML AVI" SecDemuxOpenDml
570		SectionIn 1 2
571		SetOverwrite on
572		SetOutPath $INSTDIR\plugins\demuxers
573		${File} ${ADM_DIR}/plugins/demuxers/libADM_dm_opendml.dll
574	${MementoSectionEnd}
575SectionGroupEnd
576SectionGroup "Muxers" SecGrpMuxers
577	${MementoSection} "Dummy [Raw Audio/Video]" SecMuxDummy
578		SectionIn 1 2
579		SetOverwrite on
580		SetOutPath $INSTDIR\plugins\muxers
581		${File} ${ADM_DIR}/plugins/muxers/libADM_mx_dummy.dll
582	${MementoSectionEnd}
583	${MementoSection} "Flash Video" SecMuxLavFlv
584		SectionIn 1 2
585		SetOverwrite on
586		SetOutPath $INSTDIR\plugins\muxers
587		${File} ${ADM_DIR}/plugins/muxers/libADM_mx_flv.dll
588	${MementoSectionEnd}
589	${MementoSection} "Matroska" SecMuxLavMatroska
590		SectionIn 1 2
591		SetOverwrite on
592		SetOutPath $INSTDIR\plugins\muxers
593		${File} ${ADM_DIR}/plugins/muxers/libADM_mx_Mkv.dll
594	${MementoSectionEnd}
595	${MementoSection} "MP4 (libavcodec)" SecMuxLavMp4
596		SectionIn 1 2
597		SetOverwrite on
598		SetOutPath $INSTDIR\plugins\muxers
599		${File} ${ADM_DIR}/plugins/muxers/libADM_mx_mp4.dll
600	${MementoSectionEnd}
601	${MementoSection} "MP4 (MP4v2)" SecMuxMp4v2
602		SectionIn 1 2
603		SetOverwrite on
604		SetOutPath $INSTDIR\plugins\muxers
605		${File} ${ADM_DIR}/plugins/muxers/libADM_mx_mp4v2.dll
606	${MementoSectionEnd}
607	${MementoSection} "MPEG-PS" SecMuxLavMpegPs
608		SectionIn 1 2
609		SetOverwrite on
610		SetOutPath $INSTDIR\plugins\muxers
611		${File} ${ADM_DIR}/plugins/muxers/libADM_mx_ffPS.dll
612	${MementoSectionEnd}
613	${MementoSection} "MPEG-TS" SecMuxLavMpegTs
614		SectionIn 1 2
615		SetOverwrite on
616		SetOutPath $INSTDIR\plugins\muxers
617		${File} ${ADM_DIR}/plugins/muxers/libADM_mx_ffTS.dll
618	${MementoSectionEnd}
619	${MementoSection} "OpenDML AVI" SecMuxOpenDml
620		SectionIn 1 2
621		SetOverwrite on
622		SetOutPath $INSTDIR\plugins\muxers
623		${File} ${ADM_DIR}/plugins/muxers/libADM_mx_avi.dll
624	${MementoSectionEnd}
625	${MementoSection} "Raw Video" SecMuxRaw
626		SectionIn 1 2
627		SetOverwrite on
628		SetOutPath $INSTDIR\plugins\muxers
629		${File} ${ADM_DIR}/plugins/muxers/libADM_mx_raw.dll
630	${MementoSectionEnd}
631SectionGroupEnd
632SectionGroup "Script Engines" SecGrpScriptEngine
633	#${MementoSection} "QtScript" SecScriptQt
634		#SectionIn 1 2
635		#SetOverwrite on
636		#SetOutPath $INSTDIR
637		#${File} ${QT_DIR}/QtScript4.dll
638		#${File} ${QT_DIR}/QtScriptTools4.dll
639		#SetOutPath $INSTDIR\plugins\scriptEngines
640		#${File} ${ADM_DIR}/plugins/scriptEngines/libADM_script_qt.dll
641		#SetOutPath $INSTDIR\help\QtScript
642		#${Folder} help/QtScript
643	#${MementoSectionEnd}
644	${MementoSection} "Tinypy" SecScriptTinypy
645		SectionIn 1 2
646		SetOverwrite on
647		SetOutPath $INSTDIR\plugins\scriptEngines
648		${File} ${ADM_DIR}/plugins/scriptEngines/libADM_script_tinyPy.dll
649		SetOutPath $INSTDIR\plugins\autoScripts
650		${Folder} ${ADM_DIR}/plugins/autoScripts
651	${MementoSectionEnd}
652SectionGroupEnd
653#SectionGroup "Video Decoders" SecGrpVideoDecoder
654	#${MementoSection} "VP8" SecVidDecVpx
655		#SectionIn 1 2
656		#SetOverwrite on
657		#SetOutPath $INSTDIR\plugins\videoDecoders
658		#${File} ${ADM_DIR}/plugins/videoDecoders/libADM_vd_vpx.dll
659	#${MementoSectionEnd}
660#SectionGroupEnd
661SectionGroup "Video Encoders" SecGrpVideoEncoder
662	${MementoSection} "[Null]" SecVidEncNull
663		SectionIn 1 2
664		SetOverwrite on
665		SetOutPath $INSTDIR\plugins\videoEncoders
666		${File} ${ADM_DIR}/plugins/videoEncoders/libADM_ve_null.dll
667	${MementoSectionEnd}
668	${MementoSection} "Huffyuv, FFVHuff" SecVidEncLavHuffyuv
669		SectionIn 1 2
670		SetOverwrite on
671		SetOutPath $INSTDIR\plugins\videoEncoders
672		${File} ${ADM_DIR}/plugins/videoEncoders/libADM_ve_huff.dll
673	${MementoSectionEnd}
674	${MementoSection} "JPEG" SecVidEncLavJpeg
675		SectionIn 1 2
676		SetOverwrite on
677		SetOutPath $INSTDIR\plugins\videoEncoders
678		${File} ${ADM_DIR}/plugins/videoEncoders/libADM_ve_jpeg.dll
679	${MementoSectionEnd}
680	${MementoSection} "MPEG-2" SecVidEncLavMpeg2
681		SectionIn 1 2
682		SetOverwrite on
683		SetOutPath $INSTDIR\plugins\videoEncoders
684		${File} ${ADM_DIR}/plugins/videoEncoders/libADM_ve_ffMpeg2.dll
685	${MementoSectionEnd}
686	${MementoSection} "MPEG-4 ASP (libavcodec)" SecVidEncLavMpeg4asp
687		SectionIn 1 2
688		SetOverwrite on
689		SetOutPath $INSTDIR\plugins\videoEncoders
690		${File} ${ADM_DIR}/plugins/videoEncoders/libADM_ve_ffMpeg4.dll
691	${MementoSectionEnd}
692	${MementoSection} "MPEG-4 ASP (Xvid)" SecVidEncXvid
693		SectionIn 1 2
694		SetOverwrite on
695		SetOutPath $INSTDIR\plugins\videoEncoders
696		${File} ${ADM_DIR}/plugins/videoEncoders/libADM_ve_xvid4.dll
697		SetOutPath $INSTDIR
698		${File} ${ADM_SYSDIR}/xvidcore.dll
699	${MementoSectionEnd}
700	${MementoSection} "MPEG-4 AVC" SecVidEncX264
701		SectionIn 1 2
702		SetOverwrite on
703		SetOutPath $INSTDIR\plugins\videoEncoders
704
705		${File} ${ADM_DIR}/plugins/videoEncoders/libADM_ve_x264_other.dll
706
707		SetOutPath $INSTDIR\plugins\videoEncoders\qt4
708		${File} ${ADM_DIR}/plugins/videoEncoders/qt4/libADM_ve_x264_QT4.dll
709
710		SetOutPath $INSTDIR\plugins\pluginSettings\x264
711		${Folder} ${ADM_DIR}/plugins/pluginSettings/x264
712		SetOutPath $INSTDIR
713		${File} ${ADM_SYSDIR}/libx264-*.dll
714		#${File} ${ADM_SYSDIR}/pthreadGC2-w64.dll
715	${MementoSectionEnd}
716	${MementoSection} "MPEG-4 HEC" SecVidEncX265
717		SectionIn 1 2
718		SetOverwrite on
719		SetOutPath $INSTDIR\plugins\videoEncoders
720
721		${File} ${ADM_DIR}/plugins/videoEncoders/libADM_ve_x265_other.dll
722
723		SetOutPath $INSTDIR\plugins\videoEncoders\qt4
724		${File} ${ADM_DIR}/plugins/videoEncoders/qt4/libADM_ve_x265_QT4.dll
725
726		SetOutPath $INSTDIR
727		${File} ${ADM_SYSDIR}/libx265*.dll
728		#${File} ${ADM_SYSDIR}/pthreadGC2-w64.dll
729	${MementoSectionEnd}
730${MementoSection} "PNG" SecVidEncLavPng
731		SectionIn 1 2
732		SetOverwrite on
733		SetOutPath $INSTDIR\plugins\videoEncoders
734		${File} ${ADM_DIR}/plugins/videoEncoders/libADM_ve_png.dll
735	${MementoSectionEnd}
736	${MementoSection} "Sorenson Spark" SecVidEncSorenson
737		SectionIn 1 2
738		SetOverwrite on
739		SetOutPath $INSTDIR\plugins\videoEncoders
740		${File} ${ADM_DIR}/plugins/videoEncoders/libADM_ve_ffFlv1.dll
741	${MementoSectionEnd}
742	${MementoSection} "YV12" SecVidEncYv12
743		SectionIn 1 2
744		SetOverwrite on
745		SetOutPath $INSTDIR\plugins\videoEncoders
746		${File} ${ADM_DIR}/plugins/videoEncoders/libADM_ve_yv12.dll
747	${MementoSectionEnd}
748SectionGroupEnd
749SectionGroup "Video Filters" SecGrpVideoFilter
750	SectionGroup "Transform Filters" SecGrpVideoFilterTransform
751		${MementoSection} "Add Black Borders" SecVidFltBlackBorders
752			SectionIn 1 2
753			SetOverwrite on
754			SetOutPath $INSTDIR\plugins\videoFilters
755			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_addBorders.dll
756		${MementoSectionEnd}
757		${MementoSection} "Add Logo" SecVidFltLogo
758			SectionIn 1 2
759			SetOverwrite on
760			SetOutPath $INSTDIR\plugins\videoFilters
761			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_logo.dll
762		${MementoSectionEnd}
763		${MementoSection} "Blacken Borders" SecVidFltBlackenBorders
764			SectionIn 1 2
765			SetOverwrite on
766			SetOutPath $INSTDIR\plugins\videoFilters
767			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_blackenBorders.dll
768		${MementoSectionEnd}
769		${MementoSection} "Change FPS" SecVidFltChangeFps
770			SectionIn 1 2
771			SetOverwrite on
772			SetOutPath $INSTDIR\plugins\videoFilters
773			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_changeFps.dll
774		${MementoSectionEnd}
775		${MementoSection} "Crop" SecVidFltCrop
776			SectionIn 1 2
777			SetOverwrite on
778			SetOutPath $INSTDIR\plugins\videoFilters
779			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_CropCli.dll
780			SetOutPath $INSTDIR\plugins\videoFilters\qt4
781			${File} ${ADM_DIR}/plugins/videoFilters/qt4/libADM_vf_cropQT4.dll
782		${MementoSectionEnd}
783		${MementoSection} "Fade" SecVidFltFade
784			SectionIn 1 2
785			SetOverwrite on
786			SetOutPath $INSTDIR\plugins\videoFilters
787			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_fadeToBlack.dll
788		${MementoSectionEnd}
789		${MementoSection} "Greyscale" SecVidFltLumaOnly
790			SectionIn 1 2
791			SetOverwrite on
792			SetOutPath $INSTDIR\plugins\videoFilters
793			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_lumaOnly.dll
794		${MementoSectionEnd}
795		${MementoSection} "Horizontal Flip" SecVidFltHorizontalFlip
796			SectionIn 1 2
797			SetOverwrite on
798			SetOutPath $INSTDIR\plugins\videoFilters
799			${File} ${ADM_DIR}/plugins/videoFilters/libADM_hf_hflip.dll
800		${MementoSectionEnd}
801		${MementoSection} "libswscale Resize" SecVidFltSwscaleResize
802			SectionIn 1 2
803			SetOverwrite on
804			SetOutPath $INSTDIR\plugins\videoFilters
805			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_swscaleResize_cli.dll
806			SetOutPath $INSTDIR\plugins\videoFilters\qt4
807			${File} ${ADM_DIR}/plugins/videoFilters/qt4/libADM_vf_swscaleResizeQT4.dll
808		${MementoSectionEnd}
809		${MementoSection} "Resample FPS" SecVidFltResampleFps
810			SectionIn 1 2
811			SetOverwrite on
812			SetOutPath $INSTDIR\plugins\videoFilters
813			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_resampleFps.dll
814		${MementoSectionEnd}
815		${MementoSection} "Rotate" SecVidFltRotate
816			SectionIn 1 2
817			SetOverwrite on
818			SetOutPath $INSTDIR\plugins\videoFilters
819			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_rotate.dll
820		${MementoSectionEnd}
821		${MementoSection} "Vertical Flip" SecVidFltVerticalFlip
822			SectionIn 1 2
823			SetOverwrite on
824			SetOutPath $INSTDIR\plugins\videoFilters
825			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_vflip.dll
826		${MementoSectionEnd}
827	SectionGroupEnd
828	SectionGroup "Interlacing Filters" SecGrpVideoFilterInterlacing
829		${MementoSection} "Decomb Decimate" SecVidFltDecombDecimate
830			SectionIn 1 2
831			SetOverwrite on
832			SetOutPath $INSTDIR\plugins\videoFilters
833			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_decimate.dll
834		${MementoSectionEnd}
835		${MementoSection} "Decomb Telecide" SecVidFltDecombTelecide
836			SectionIn 1 2
837			SetOverwrite on
838			SetOutPath $INSTDIR\plugins\videoFilters
839			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_telecide.dll
840		${MementoSectionEnd}
841		${MementoSection} "DGBob" SecVidFltDgbob
842			SectionIn 1 2
843			SetOverwrite on
844			SetOutPath $INSTDIR\plugins\videoFilters
845			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_DgBob.dll
846		${MementoSectionEnd}
847		${MementoSection} "Horizontal Stack Fields" SecVidFltHzStackFields
848			SectionIn 1 2
849			SetOverwrite on
850			SetOutPath $INSTDIR\plugins\videoFilters
851			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_hzstackField.dll
852		${MementoSectionEnd}
853		${MementoSection} "Kernel Deint" SecVidFltKernelDeint
854			SectionIn 1 2
855			SetOverwrite on
856			SetOutPath $INSTDIR\plugins\videoFilters
857			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_kernelDeint.dll
858		${MementoSectionEnd}
859		${MementoSection} "libavcodec Deinterlacers" SecVidFltLavDeinterlacers
860			SectionIn 1 2
861			SetOverwrite on
862			SetOutPath $INSTDIR\plugins\videoFilters
863			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_lavDeint.dll
864		${MementoSectionEnd}
865		${MementoSection} "Merge Fields" SecVidFltMergeFields
866			SectionIn 1 2
867			SetOverwrite on
868			SetOutPath $INSTDIR\plugins\videoFilters
869			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_mergeField.dll
870		${MementoSectionEnd}
871		${MementoSection} "Separate Fields" SecVidFltSeparateFields
872			SectionIn 1 2
873			SetOverwrite on
874			SetOutPath $INSTDIR\plugins\videoFilters
875			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_separateField.dll
876		${MementoSectionEnd}
877		${MementoSection} "Stack Fields" SecVidFltStackFields
878			SectionIn 1 2
879			SetOverwrite on
880			SetOutPath $INSTDIR\plugins\videoFilters
881			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_stackField.dll
882		${MementoSectionEnd}
883		${MementoSection} "Unstack Fields" SecVidFltUnstackFields
884			SectionIn 1 2
885			SetOverwrite on
886			SetOutPath $INSTDIR\plugins\videoFilters
887			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_unstackField.dll
888		${MementoSectionEnd}
889		${MementoSection} "Yadif" SecVidFltYadif
890			SectionIn 1 2
891			SetOverwrite on
892			SetOutPath $INSTDIR\plugins\videoFilters
893			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_yadif.dll
894		${MementoSectionEnd}
895	SectionGroupEnd
896	SectionGroup "Colour Filters" SecGrpVideoFilterColour
897		${MementoSection} "Avisynth Colour YUV" SecVidFltAvisynthColourYuv
898			SectionIn 1 2
899			SetOverwrite on
900			SetOutPath $INSTDIR\plugins\videoFilters
901			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_colorYuv.dll
902		${MementoSectionEnd}
903		${MementoSection} "ChromaShift" SecVidFltChromaShift
904			SectionIn 1 2
905			SetOverwrite on
906			SetOutPath $INSTDIR\plugins\videoFilters
907			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_chromaShiftCli.dll
908			SetOutPath $INSTDIR\plugins\videoFilters\qt4
909			${File} ${ADM_DIR}/plugins/videoFilters/qt4/libADM_vf_chromaShiftQT4.dll
910		${MementoSectionEnd}
911		${MementoSection} "Contrast" SecVidFltContrast
912			SectionIn 1 2
913			SetOverwrite on
914			SetOutPath $INSTDIR\plugins\videoFilters
915			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_contrastCli.dll
916			SetOutPath $INSTDIR\plugins\videoFilters\qt4
917			${File} ${ADM_DIR}/plugins/videoFilters/qt4/libADM_vf_contrastQT4.dll
918		${MementoSectionEnd}
919		${MementoSection} "MPlater Eq2" SecVidFltMplayerEq2
920			SectionIn 1 2
921			SetOverwrite on
922			SetOutPath $INSTDIR\plugins\videoFilters
923			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_eq2Cli.dll
924			SetOutPath $INSTDIR\plugins\videoFilters\qt4
925			${File} ${ADM_DIR}/plugins/videoFilters/qt4/libADM_vf_eq2QT4.dll
926		${MementoSectionEnd}
927		${MementoSection} "MPlater Hue" SecVidFltMplayerHue
928			SectionIn 1 2
929			SetOverwrite on
930			SetOutPath $INSTDIR\plugins\videoFilters
931			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_HueCli.dll
932			SetOutPath $INSTDIR\plugins\videoFilters\qt4
933			${File} ${ADM_DIR}/plugins/videoFilters/qt4/libADM_vf_HueQT4.dll
934		${MementoSectionEnd}
935		${MementoSection} "Remove Plane" SecVidFltRemovePlane
936			SectionIn 1 2
937			SetOverwrite on
938			SetOutPath $INSTDIR\plugins\videoFilters
939			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_removePlane.dll
940		${MementoSectionEnd}
941		${MementoSection} "Swap U and V" SecVidFltSwapUandV
942			SectionIn 1 2
943			SetOverwrite on
944			SetOutPath $INSTDIR\plugins\videoFilters
945			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_swapUV.dll
946		${MementoSectionEnd}
947	SectionGroupEnd
948	SectionGroup "Noise Filters" SecGrpVideoFilterNoise
949		${MementoSection} "FluxSmooth" SecVidFltFluxSmooth
950			SectionIn 1 2
951			SetOverwrite on
952			SetOutPath $INSTDIR\plugins\videoFilters
953			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_FluxSmooth.dll
954		${MementoSectionEnd}
955		${MementoSection} "Gaussian Convolution" SecVidFltGauss
956			SectionIn 1 2
957			SetOverwrite on
958			SetOutPath $INSTDIR\plugins\videoFilters
959			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_gauss.dll
960		${MementoSectionEnd}
961		${MementoSection} "Large Median (5x5)" SecVidFltMediam5x5
962			SectionIn 1 2
963			SetOverwrite on
964			SetOutPath $INSTDIR\plugins\videoFilters
965			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_largeMedian.dll
966		${MementoSectionEnd}
967		${MementoSection} "Mean Convolution" SecVidFltMean
968			SectionIn 1 2
969			SetOverwrite on
970			SetOutPath $INSTDIR\plugins\videoFilters
971			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_mean.dll
972		${MementoSectionEnd}
973		${MementoSection} "Median Convolution" SecVidFltMedian
974			SectionIn 1 2
975			SetOverwrite on
976			SetOutPath $INSTDIR\plugins\videoFilters
977			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_median.dll
978		${MementoSectionEnd}
979		${MementoSection} "MPlayer Denoise 3D" SecVidFltMPlayerDenoise3d
980			SectionIn 1 2
981			SetOverwrite on
982			SetOutPath $INSTDIR\plugins\videoFilters
983			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_denoise3d.dll
984		${MementoSectionEnd}
985		${MementoSection} "MPlayer Denoise 3D HQ" SecVidFltMPlayerDenoise3dHq
986			SectionIn 1 2
987			SetOverwrite on
988			SetOutPath $INSTDIR\plugins\videoFilters
989			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_denoise3dhq.dll
990		${MementoSectionEnd}
991		${MementoSection} "MSharpen" SecVidFltMSharpen
992			SectionIn 1 2
993			SetOverwrite on
994			SetOutPath $INSTDIR\plugins\videoFilters
995			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_msharpen.dll
996		${MementoSectionEnd}
997	SectionGroupEnd
998	SectionGroup "Sharpness Filters" SecGrpVideoFilterSharpness
999		${MementoSection} "asharp" SecVidFltAsharp
1000			SectionIn 1 2
1001			SetOverwrite on
1002			SetOutPath $INSTDIR\plugins\videoFilters
1003			SetOutPath $INSTDIR\plugins\videoFilters\qt4
1004			${File} ${ADM_DIR}/plugins/videoFilters/qt4/libADM_vf_asharpQT4.dll
1005		${MementoSectionEnd}
1006		${MementoSection} "MPlayer Delogo" SecVidFltMPlayerDelogo
1007			SectionIn 1 2
1008			SetOverwrite on
1009			SetOutPath $INSTDIR\plugins\videoFilters
1010			SetOutPath $INSTDIR\plugins\videoFilters\qt4
1011			${File} ${ADM_DIR}/plugins/videoFilters/qt4/libADM_vf_mpdelogoQT4.dll
1012		${MementoSectionEnd}
1013		${MementoSection} "Sharpen" SecVidFltSharpen
1014			SectionIn 1 2
1015			SetOverwrite on
1016			SetOutPath $INSTDIR\plugins\videoFilters
1017			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_sharpen.dll
1018		${MementoSectionEnd}
1019	SectionGroupEnd
1020	SectionGroup "Subtitle Filters" SecGrpVideoFilterSubtitle
1021		${MementoSection} "ASS, SSA" SecVidFltAssSsa
1022			SectionIn 1 2
1023			SetOverwrite on
1024			SetOutPath $INSTDIR\plugins\videoFilters
1025			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_ssa.dll
1026			SetOutPath $INSTDIR
1027			${File} ${ADM_SYSDIR}/libfribidi-0.dll
1028			${File} ${ADM_SYSDIR}/libiconv-2.dll
1029			${File} ${ADM_SYSDIR}/libfontconfig-1.dll
1030			#${File} ${ADM_SYSDIR}/libexpat-1.dll
1031			SetOutPath $INSTDIR\etc\fonts
1032			${Folder} ${ADM_DIR}/etc/fonts
1033		${MementoSectionEnd}
1034	SectionGroupEnd
1035	#SectionGroup "OpenGL Filters" SecGrpVideoFilterOpenGl
1036		#${MementoSection} "Fragment Shader" SecVidFltOpenGlFragmentShader
1037			#SectionIn 1 2
1038			#SetOverwrite on
1039			#SetOutPath $INSTDIR\plugins\videoFilters
1040			#${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_sampleGlFrag2.dll
1041		#${MementoSectionEnd}
1042		#${MementoSection} "Read Back Benchmark" SecVidFltOpenGlReadBack
1043			#SectionIn 1 2
1044			#SetOverwrite on
1045			#SetOutPath $INSTDIR\plugins\videoFilters
1046			#${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_glBenchmark.dll
1047		#${MementoSectionEnd}
1048		#${MementoSection} "Resize" SecVidFltOpenGlResize
1049			#SectionIn 1 2
1050			#SetOverwrite on
1051			#SetOutPath $INSTDIR\plugins\videoFilters
1052			#${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_glResize.dll
1053		#${MementoSectionEnd}
1054		#${MementoSection} "Rotate" SecVidFltOpenGlRotate
1055			#SectionIn 1 2
1056			#SetOverwrite on
1057			#SetOutPath $INSTDIR\plugins\videoFilters
1058			#${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_rotateGlFrag2.dll
1059		#${MementoSectionEnd}
1060		#${MementoSection} "Wave" SecVidFltOpenGlWave
1061			#SectionIn 1 2
1062			#SetOverwrite on
1063			#SetOutPath $INSTDIR\plugins\videoFilters
1064			#${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_sampleGlVertex.dll
1065		#${MementoSectionEnd}
1066	#SectionGroupEnd
1067	SectionGroup "Miscellaneous Filters" SecGrpVideoFilterMiscellaneous
1068		${MementoSection} "Print Information" SecVidFltPrintInfo
1069			SectionIn 1 2
1070			SetOverwrite on
1071			SetOutPath $INSTDIR\plugins\videoFilters
1072			${File} ${ADM_DIR}/plugins/videoFilters/libADM_vf_printInfo.dll
1073		${MementoSectionEnd}
1074	SectionGroupEnd
1075SectionGroupEnd
1076
1077${MementoSection} "-Start menu Change Log" SecStartMenuChangeLog
1078    CreateDirectory $SMPROGRAMS\$StartMenuGroup
1079    !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
1080    SetOutPath $INSTDIR
1081    CreateShortcut "$SMPROGRAMS\$StartMenuGroup\Change Log ${CORE_VERSION}.lnk" "$INSTDIR\Change Log.html"
1082    !insertmacro MUI_STARTMENU_WRITE_END
1083${MementoSectionEnd}
1084
1085
1086${MementoSection} "-Start menu Qt" SecStartMenuQt
1087    CreateDirectory $SMPROGRAMS\$StartMenuGroup
1088    !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
1089    SetOutPath $INSTDIR
1090    CreateShortcut "$SMPROGRAMS\$StartMenuGroup\${SHORTCUT_NAME}.lnk" $INSTDIR\avidemux.exe
1091    CreateShortcut "$SMPROGRAMS\$StartMenuGroup\Avidemux job control (64 Bits).lnk" $INSTDIR\avidemux_jobs.exe
1092    !insertmacro MUI_STARTMENU_WRITE_END
1093${MementoSectionEnd}
1094
1095${MementoSection} "-Start menu AVS Proxy GUI" SecStartMenuAvsProxyGui
1096    CreateDirectory $SMPROGRAMS\$StartMenuGroup
1097    !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
1098    SetOutPath $INSTDIR
1099    CreateShortcut "$SMPROGRAMS\$StartMenuGroup\AVS Proxy GUI ${CORE_VERSION}.lnk" "$INSTDIR\avsproxy_gui.exe"
1100    !insertmacro MUI_STARTMENU_WRITE_END
1101${MementoSectionEnd}
1102
1103
1104${MementoSection} "-Quick Launch Qt" SecQuickLaunchQt
1105    SetOutPath $INSTDIR
1106    CreateShortcut "$QUICKLAUNCH\${SHORTCUT_NAME}.lnk" $INSTDIR\avidemux.exe
1107${MementoSectionEnd}
1108
1109
1110${MementoSection} "-Desktop Qt" SecDesktopQt
1111    SetOutPath $INSTDIR
1112    CreateShortcut "$DESKTOP\${SHORTCUT_NAME}.lnk" $INSTDIR\avidemux.exe
1113${MementoSectionEnd}
1114
1115${MementoSectionDone}
1116
1117Section -post SecUninstaller
1118    SectionIn 1 2
1119    WriteRegStr HKLM "${REGKEY}" Path $INSTDIR
1120    WriteRegStr HKLM "${REGKEY}" Version ${PRODUCT_VERSION}
1121    SetOutPath $INSTDIR
1122    WriteUninstaller $INSTDIR\uninstall.exe
1123    WriteRegStr HKLM "${UNINST_REGKEY}" DisplayName "${SHORTCUT_NAME}"
1124    WriteRegStr HKLM "${UNINST_REGKEY}" DisplayVersion "${PRODUCT_VERSION}"
1125    WriteRegStr HKLM "${UNINST_REGKEY}" DisplayIcon $INSTDIR\uninstall.exe
1126    WriteRegStr HKLM "${UNINST_REGKEY}" UninstallString $INSTDIR\uninstall.exe
1127    WriteRegDWORD HKLM "${UNINST_REGKEY}" NoModify 1
1128    WriteRegDWORD HKLM "${UNINST_REGKEY}" NoRepair 1
1129SectionEnd
1130
1131Section -CloseLogFile
1132	FileClose $UninstallLogHandle
1133	SetFileAttributes ${UninstallLogPath} HIDDEN
1134SectionEnd
1135
1136Section Uninstall
1137	!insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuGroup
1138
1139
1140    Delete /REBOOTOK "$QUICKLAUNCH\${SHORTCUT_NAME}.lnk"
1141    Delete /REBOOTOK "$DESKTOP\${SHORTCUT_NAME}.lnk"
1142    Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\${SHORTCUT_NAME}.lnk"
1143    Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\Avidemux job control (64 Bits).lnk"
1144    Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\Change Log ${CORE_VERSION}.lnk"
1145    Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\AVS Proxy GUI ${CORE_VERSION}.lnk"
1146    RmDir /REBOOTOK $SMPROGRAMS\$StartMenuGroup
1147    DeleteRegValue HKLM "${REGKEY}" StartMenuGroup
1148
1149    DeleteRegKey HKLM "${UNINST_REGKEY}"
1150    DeleteRegValue HKLM "${REGKEY}" Path
1151	DeleteRegValue HKLM "${REGKEY}" CreateDesktopIcon
1152	DeleteRegValue HKLM "${REGKEY}" CreateStartMenuGroup
1153	DeleteRegValue HKLM "${REGKEY}" CreateQuickLaunchIcon
1154    DeleteRegKey /IfEmpty HKLM "${REGKEY}"
1155
1156	FileOpen $UninstallLogHandle "${UninstallLogPath}" r
1157UninstallLoop:
1158    ClearErrors
1159    FileRead $UninstallLogHandle $R0
1160    IfErrors UninstallEnd
1161	Push $R0
1162    Call un.TrimNewLines
1163    Pop $R0
1164    Delete "$R0"
1165    Goto UninstallLoop
1166UninstallEnd:
1167	FileClose $UninstallLogHandle
1168	Delete "${UninstallLogPath}"
1169	Delete "$INSTDIR\uninstall.exe"
1170	Push "\"
1171	Call un.RemoveEmptyDirs
1172	RMDir "$INSTDIR"
1173SectionEnd
1174
1175##########################
1176# Installer functions
1177##########################
1178Function .onInit
1179UAC_Elevate:
1180	!insertmacro UAC_RunElevated
1181	StrCmp 1223 $0 UAC_ElevationAborted
1182	StrCmp 0 $0 0 UAC_Err
1183	StrCmp 1 $1 0 UAC_Success
1184	Quit
1185
1186UAC_Err:
1187	MessageBox MB_ICONSTOP "Unable to elevate, error $0"
1188	Abort
1189
1190UAC_ElevationAborted:
1191	Abort
1192
1193UAC_Success:
1194	StrCmp 1 $3 +4
1195	StrCmp 3 $1 0 UAC_ElevationAborted
1196	MessageBox MB_ICONSTOP "This installer requires admin access."
1197	Goto UAC_Elevate
1198
1199	Call LoadPreviousSettings
1200	ReadRegStr $PreviousVersion HKLM "${REGKEY}" Version
1201
1202	${If} $PreviousVersion != ""
1203		${VersionCompare} ${PRODUCT_VERSION} $PreviousVersion $PreviousVersionState
1204	${EndIf}
1205
1206    InitPluginsDir
1207    SetShellVarContext all
1208FunctionEnd
1209
1210Function .onInstSuccess
1211	${MementoSectionSave}
1212FunctionEnd
1213
1214Function LoadPreviousSettings
1215    ${MementoSectionRestore}
1216	!insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuGroup
1217
1218	ReadRegStr $CreateStartMenuGroup HKLM "${REGKEY}" CreateStartMenuGroup
1219
1220	${If} $CreateStartMenuGroup == ""
1221		StrCpy $CreateStartMenuGroup 1
1222	${EndIf}
1223
1224	ReadRegStr $CreateDesktopIcon HKLM "${REGKEY}" CreateDesktopIcon
1225
1226	${If} $CreateDesktopIcon == ""
1227		StrCpy $CreateDesktopIcon 1
1228	${EndIf}
1229
1230	${If} ${AtMostWinVista}
1231		ReadRegStr $CreateQuickLaunchIcon HKLM "${REGKEY}" CreateQuickLaunchIcon
1232
1233		${If} $CreateQuickLaunchIcon == ""
1234			StrCpy $CreateQuickLaunchIcon 1
1235		${EndIf}
1236	${EndIf}
1237
1238FunctionEnd
1239
1240Function RunUninstaller
1241    ReadRegStr $R1  HKLM "${UNINST_REGKEY}" "UninstallString"
1242
1243	${If} $R1 == ""
1244		Return
1245	${EndIf}
1246
1247	;Run uninstaller
1248	HideWindow
1249	ClearErrors
1250
1251	${If} $PreviousVersionState == 0
1252	${AndIf} $ReinstallUninstall == 1
1253		ExecWait '$R1 _?=$INSTDIR'
1254	${Else}
1255		ExecWait '$R1 /frominstall _?=$INSTDIR'
1256	${EndIf}
1257
1258	IfErrors NoRemoveUninstaller
1259	IfFileExists "$INSTDIR\uninstall.exe" 0 NoRemoveUninstaller
1260		Delete "$R1"
1261		RMDir $INSTDIR
1262
1263NoRemoveUninstaller:
1264FunctionEnd
1265
1266Function CheckSelectedUIs
1267	!insertmacro SectionFlagIsSet ${SecGrpUI} ${SF_SELECTED} end checkPartial
1268checkPartial:
1269	!insertmacro SectionFlagIsSet ${SecGrpUI} ${SF_PSELECTED} end displayError
1270displayError:
1271    MessageBox MB_OK|MB_ICONSTOP "At least one User Interface must be selected."
1272    Abort
1273end:
1274FunctionEnd
1275
1276LangString INSTALL_OPTS_PAGE_TITLE ${LANG_ENGLISH} "Choose Install Options"
1277LangString INSTALL_OPTS_PAGE_SUBTITLE ${LANG_ENGLISH} "Choose where to install Avidemux icons."
1278Var dlgInstallOptions
1279Var lblCreateIcons
1280Var chkDesktop
1281Var chkStartMenu
1282Var chkQuickLaunch
1283
1284Function InstallOptionsPage
1285	Call IsInstallOptionsRequired
1286	!insertmacro MUI_HEADER_TEXT "$(INSTALL_OPTS_PAGE_TITLE)" "$(INSTALL_OPTS_PAGE_SUBTITLE)"
1287
1288	nsDialogs::Create 1018
1289	Pop $dlgInstallOptions
1290
1291	${If} $dlgInstallOptions == error
1292		Abort
1293	${EndIf}
1294
1295	${NSD_CreateLabel} 0 0u 100% 12u "Create icons for Avidemux:"
1296	Pop $lblCreateIcons
1297
1298	${NSD_CreateCheckBox} 0 18u 100% 12u "On my &Desktop"
1299	Pop $chkDesktop
1300	${NSD_SetState} $chkDesktop $CreateDesktopIcon
1301	${NSD_OnClick} $chkDesktop UpdateInstallOptions
1302
1303	${NSD_CreateCheckBox} 0 36u 100% 12u "In my &Start Menu Programs folder"
1304	Pop $chkStartMenu
1305	${NSD_SetState} $chkStartMenu $CreateStartMenuGroup
1306	${NSD_OnClick} $chkStartMenu UpdateInstallOptions
1307
1308	${If} ${AtMostWinVista}
1309		${NSD_CreateCheckBox} 0 54u 100% 12u "In my &Quick Launch bar"
1310		Pop $chkQuickLaunch
1311		${NSD_SetState} $chkQuickLaunch $CreateQuickLaunchIcon
1312		${NSD_OnClick} $chkQuickLaunch UpdateInstallOptions
1313	${EndIf}
1314  	#${If} ${IsWin2003}
1315		#WriteRegStr HKCU "Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" "$INSTDIR\avidemux.exe" "WIN2000"
1316	#${EndIf}
1317  	#${If} ${IsWinXp}
1318		#WriteRegStr HKCU "Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" "$INSTDIR\avidemux.exe" "WIN2000"
1319	#${EndIf}
1320	nsDialogs::Show
1321FunctionEnd
1322
1323Function UpdateInstallOptions
1324	${NSD_GetState} $chkDesktop $CreateDesktopIcon
1325	${NSD_GetState} $chkStartMenu $CreateStartMenuGroup
1326	${NSD_GetState} $chkQuickLaunch $CreateQuickLaunchIcon
1327FunctionEnd
1328
1329Function IsInstallOptionsRequired
1330Goto end
1331	!insertmacro SectionFlagIsSet ${SecUiQt} ${SF_SELECTED} end resetOptions
1332resetOptions:
1333
1334    StrCpy $CreateDesktopIcon 0
1335    StrCpy $CreateStartMenuGroup 0
1336    StrCpy $CreateQuickLaunchIcon 0
1337    Abort
1338
1339end:
1340FunctionEnd
1341
1342Function IsStartMenuRequired
1343    StrCmp $CreateStartMenuGroup 1 +2
1344        Abort
1345FunctionEnd
1346
1347Function ActivateInternalSections
1348    #AVS Proxy GUI shortcut:
1349    SectionGetFlags ${SecAvsProxy} $0
1350    IntOp $0 $0 & ${SF_SELECTED}
1351    IntOp $0 $0 & $CreateStartMenuGroup
1352    SectionSetFlags ${SecStartMenuAvsProxyGui} $0
1353
1354    #Change Log shortcut:
1355    SectionSetFlags ${SecStartMenuChangeLog} $CreateStartMenuGroup
1356
1357    #Qt shortcuts:
1358    SectionGetFlags ${SecUiQt} $0
1359    IntOp $0 $0 & ${SF_SELECTED}
1360
1361    IntOp $1 $0 & $CreateDesktopIcon
1362    SectionSetFlags ${SecDesktopQt} $1
1363
1364    IntOp $1 $0 & $CreateQuickLaunchIcon
1365    SectionSetFlags ${SecQuickLaunchQt} $1
1366
1367    IntOp $1 $0 & $CreateStartMenuGroup
1368    SectionSetFlags ${SecStartMenuQt} $1
1369FunctionEnd
1370
1371Function InstFilesPageShow
1372	${If} $ReinstallUninstall != ""
1373		Call RunUninstaller
1374		BringToFront
1375	${EndIf}
1376FunctionEnd
1377
1378Function InstFilesPageLeave
1379	; Don't advance automatically if details expanded
1380	FindWindow $R0 "#32770" "" $HWNDPARENT
1381	GetDlgItem $R0 $R0 1016
1382	System::Call user32::IsWindowVisible(i$R0)i.s
1383	Pop $R0
1384
1385	StrCmp $R0 0 +2
1386	SetAutoClose false
1387FunctionEnd
1388
1389Function ConfigureFinishPage
1390
1391    SectionGetFlags ${SecUiQt} $0
1392    IntOp $0 $0 & ${SF_SELECTED}
1393    StrCmp $0 ${SF_SELECTED} end
1394
1395    DeleteINISec "$PLUGINSDIR\ioSpecial.ini" "Field 4"
1396
1397end:
1398FunctionEnd
1399
1400Function RunAvidemux
1401    SetOutPath $INSTDIR
1402
1403    SectionGetFlags ${SecUiQt} $0
1404    IntOp $0 $0 & ${SF_SELECTED}
1405
1406	!insertmacro UAC_AsUser_ExecShell "" "$INSTDIR\avidemux.exe" "" "" ""
1407
1408    Goto end
1409
1410
1411end:
1412FunctionEnd
1413
1414Var ReinstallUninstallButton
1415
1416Function ReinstallPage
1417	${If} $PreviousVersion == ""
1418		Abort
1419	${EndIf}
1420
1421	nsDialogs::Create /NOUNLOAD 1018
1422	Pop $0
1423
1424	${If} $PreviousVersionState == 1
1425		!insertmacro MUI_HEADER_TEXT "Already Installed" "Choose how you want to install ${PRODUCT_FULLNAME}."
1426		nsDialogs::CreateItem /NOUNLOAD STATIC ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS} 0 0 0 100% 40 "An older version of Avidemux is installed on your system.  Select the operation you want to perform and click Next to continue."
1427		Pop $R0
1428		nsDialogs::CreateItem /NOUNLOAD BUTTON ${BS_AUTORADIOBUTTON}|${BS_VCENTER}|${BS_MULTILINE}|${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS}|${WS_GROUP}|${WS_TABSTOP} 0 10 55 100% 30 "Upgrade Avidemux using previous settings (recommended)"
1429		Pop $ReinstallUninstallButton
1430		nsDialogs::CreateItem /NOUNLOAD BUTTON ${BS_AUTORADIOBUTTON}|${BS_TOP}|${BS_MULTILINE}|${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS} 0 10 85 100% 50 "Change settings (advanced)"
1431		Pop $R0
1432
1433		${If} $ReinstallUninstall == ""
1434			StrCpy $ReinstallUninstall 1
1435		${EndIf}
1436	${ElseIf} $PreviousVersionState == 2
1437		!insertmacro MUI_HEADER_TEXT "Already Installed" "Choose how you want to install ${PRODUCT_FULLNAME}."
1438		nsDialogs::CreateItem /NOUNLOAD STATIC ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS} 0 0 0 100% 40 "A newer version of Avidemux is already installed! It is not recommended that you downgrade to an older version. Select the operation you want to perform and click Next to continue."
1439		Pop $R0
1440		nsDialogs::CreateItem /NOUNLOAD BUTTON ${BS_AUTORADIOBUTTON}|${BS_VCENTER}|${BS_MULTILINE}|${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS}|${WS_GROUP}|${WS_TABSTOP} 0 10 55 100% 30 "Downgrade Avidemux using previous settings (recommended)"
1441		Pop $ReinstallUninstallButton
1442		nsDialogs::CreateItem /NOUNLOAD BUTTON ${BS_AUTORADIOBUTTON}|${BS_TOP}|${BS_MULTILINE}|${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS} 0 10 85 100% 50 "Change settings (advanced)"
1443		Pop $R0
1444
1445		${If} $ReinstallUninstall == ""
1446			StrCpy $ReinstallUninstall 1
1447		${EndIf}
1448	${ElseIf} $PreviousVersionState == 0
1449		!insertmacro MUI_HEADER_TEXT "Already Installed" "Choose the maintenance option to perform."
1450		nsDialogs::CreateItem /NOUNLOAD STATIC ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS} 0 0 0 100% 40 "${PRODUCT_FULLNAME} is already installed. Select the operation you want to perform and click Next to continue."
1451		Pop $R0
1452		nsDialogs::CreateItem /NOUNLOAD BUTTON ${BS_AUTORADIOBUTTON}|${BS_VCENTER}|${BS_MULTILINE}|${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS}|${WS_GROUP}|${WS_TABSTOP} 0 10 55 100% 30 "Add/Remove/Reinstall components"
1453		Pop $R0
1454		nsDialogs::CreateItem /NOUNLOAD BUTTON ${BS_AUTORADIOBUTTON}|${BS_TOP}|${BS_MULTILINE}|${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS} 0 10 85 100% 50 "Uninstall Avidemux"
1455		Pop $ReinstallUninstallButton
1456
1457		${If} $ReinstallUninstall == ""
1458			StrCpy $ReinstallUninstall 2
1459		${EndIf}
1460	${Else}
1461		MessageBox MB_ICONSTOP "Unknown value of PreviousVersionState, aborting" /SD IDOK
1462		Abort
1463	${EndIf}
1464
1465	${If} $ReinstallUninstall == "1"
1466		SendMessage $ReinstallUninstallButton ${BM_SETCHECK} 1 0
1467	${Else}
1468		SendMessage $R0 ${BM_SETCHECK} 1 0
1469	${EndIf}
1470
1471	nsDialogs::Show
1472FunctionEnd
1473
1474Function ReinstallPageLeave
1475	SendMessage $ReinstallUninstallButton ${BM_GETCHECK} 0 0 $R0
1476
1477	${If} $R0 == 1
1478		; Option to uninstall old version selected
1479		StrCpy $ReinstallUninstall 1
1480	${Else}
1481		; Custom up/downgrade or add/remove/reinstall
1482		StrCpy $ReinstallUninstall 2
1483	${EndIf}
1484
1485	${If} $ReinstallUninstall == 1
1486		${If} $PreviousVersionState == 0
1487			Call RunUninstaller
1488			Quit
1489		${Else}
1490			; Need to reload defaults. User could have
1491			; chosen custom, change something, went back and selected
1492			; the express option.
1493			Call LoadPreviousSettings
1494		${EndIf}
1495	${EndIf}
1496FunctionEnd
1497
1498
1499##########################
1500# Uninstaller functions
1501##########################
1502Function un.onInit
1503	SetShellVarContext all
1504
1505UAC_Elevate:
1506	!insertmacro UAC_RunElevated
1507	StrCmp 1223 $0 UAC_ElevationAborted
1508	StrCmp 0 $0 0 UAC_Err
1509	StrCmp 1 $1 0 UAC_Success
1510	Quit
1511
1512UAC_Err:
1513	MessageBox MB_ICONSTOP "Unable to elevate, error $0"
1514	Abort
1515
1516UAC_ElevationAborted:
1517	Abort
1518
1519UAC_Success:
1520	StrCmp 1 $3 +4
1521	StrCmp 3 $1 0 UAC_ElevationAborted
1522	MessageBox MB_ICONSTOP "This installer requires admin access."
1523	Goto UAC_Elevate
1524FunctionEnd
1525
1526; TrimNewlines (copied from NSIS documentation)
1527; input, top of stack  (e.g. whatever$/r$/n)
1528; output, top of stack (replaces, with e.g. whatever)
1529; modifies no other variables.
1530Function un.TrimNewlines
1531	Exch $R0
1532	Push $R1
1533	Push $R2
1534	StrCpy $R1 0
1535
1536loop:
1537	IntOp $R1 $R1 - 1
1538	StrCpy $R2 $R0 1 $R1
1539	StrCmp $R2 "$\r" loop
1540	StrCmp $R2 "$\n" loop
1541	IntOp $R1 $R1 + 1
1542	IntCmp $R1 0 no_trim_needed
1543	StrCpy $R0 $R0 $R1
1544
1545no_trim_needed:
1546	Pop $R2
1547	Pop $R1
1548	Exch $R0
1549FunctionEnd
1550
1551Function un.RemoveEmptyDirs
1552	Pop $9
1553	!define Index 'Line${__LINE__}'
1554	FindFirst $0 $1 "$INSTDIR$9*"
1555	StrCmp $0 "" "${Index}-End"
1556"${Index}-Loop:"
1557	StrCmp $1 "" "${Index}-End"
1558	StrCmp $1 "." "${Index}-Next"
1559	StrCmp $1 ".." "${Index}-Next"
1560	Push $0
1561	Push $1
1562	Push $9
1563	Push "$9$1\"
1564	Call un.RemoveEmptyDirs
1565	Pop $9
1566	Pop $1
1567	Pop $0
1568;"${Index}-Remove:"
1569	RMDir "$INSTDIR$9$1"
1570"${Index}-Next:"
1571	FindNext $0 $1
1572	Goto "${Index}-Loop"
1573"${Index}-End:"
1574	FindClose $0
1575	!undef Index
1576FunctionEnd
1577
1578Function un.ConfirmPagePre
1579	${un.GetParameters} $R0
1580	${un.GetOptions} $R0 "/frominstall" $R1
1581	${Unless} ${Errors}
1582		Abort
1583	${EndUnless}
1584FunctionEnd
1585
1586Function un.FinishPagePre
1587	${un.GetParameters} $R0
1588	${un.GetOptions} $R0 "/frominstall" $R1
1589	${Unless} ${Errors}
1590		SetRebootFlag false
1591		Abort
1592	${EndUnless}
1593FunctionEnd
1594