Now works when you select a selected section

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@672 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2002-08-09 13:00:17 +00:00
parent 9b96207e6e
commit d9fe9f1282

View file

@ -1,7 +1,7 @@
Name example Name example
OutFile setup.exe OutFile setup.exe
ComponentText "please choose just one but the the default" ComponentText "please choose just one but the default"
Section !Required Section !Required
SectionIn RO SectionIn RO
@ -19,12 +19,15 @@ SectionEnd
Section "optional #4" sec4 Section "optional #4" sec4
SectionEnd SectionEnd
!define SECTION_ON 0x80000000
!define SECTION_OFF 0x7FFFFFFF !define SECTION_OFF 0x7FFFFFFF
Function .onInit Function .onInit
Push $0
StrCpy $1 ${sec1} ; Gotta remember which section we are at now... StrCpy $1 ${sec1} ; Gotta remember which section we are at now...
SectionGetFlags ${sec1} $0 SectionGetFlags ${sec1} $0
IntOp $0 $0 | 0x80000000 IntOp $0 $0 | ${SECTION_ON}
SectionSetFlags ${sec1} $0 SectionSetFlags ${sec1} $0
SectionGetFlags ${sec2} $0 SectionGetFlags ${sec2} $0
@ -38,42 +41,43 @@ Function .onInit
SectionGetFlags ${sec4} $0 SectionGetFlags ${sec4} $0
IntOp $0 $0 & ${SECTION_OFF} IntOp $0 $0 & ${SECTION_OFF}
SectionSetFlags ${sec4} $0 SectionSetFlags ${sec4} $0
Pop $0
FunctionEnd FunctionEnd
Function .onSelChange Function .onSelChange
Push $0
; Turn off old selected section ; Turn off old selected section
StrCmp $1 ${sec1} 0 +4 SectionGetFlags $1 $0
SectionGetFlags ${sec1} $0 IntOp $0 $0 & ${SECTION_OFF}
IntOp $0 $0 & ${SECTION_OFF} SectionSetFlags $1 $0
SectionSetFlags ${sec1} $0
StrCmp $1 ${sec2} 0 +4
SectionGetFlags ${sec2} $0
IntOp $0 $0 & ${SECTION_OFF}
SectionSetFlags ${sec2} $0
StrCmp $1 ${sec3} 0 +4
SectionGetFlags ${sec3} $0
IntOp $0 $0 & ${SECTION_OFF}
SectionSetFlags ${sec3} $0
StrCmp $1 ${sec4} 0 +4
SectionGetFlags ${sec4} $0
IntOp $0 $0 & ${SECTION_OFF}
SectionSetFlags ${sec4} $0
; Now remember the current selection ; Now remember the current selection
Push $2
StrCpy $2 $1
SectionGetFlags ${sec1} $0 SectionGetFlags ${sec1} $0
IntOp $0 $0 & 0x80000000 IntOp $0 $0 & ${SECTION_ON}
IntCmp $0 0x80000000 0 +2 +2 IntCmp $0 ${SECTION_ON} 0 +2 +2
StrCpy $1 ${sec1} StrCpy $1 ${sec1}
SectionGetFlags ${sec2} $0 SectionGetFlags ${sec2} $0
IntOp $0 $0 & 0x80000000 IntOp $0 $0 & ${SECTION_ON}
IntCmp $0 0x80000000 0 +2 +2 IntCmp $0 ${SECTION_ON} 0 +2 +2
StrCpy $1 ${sec2} StrCpy $1 ${sec2}
SectionGetFlags ${sec3} $0 SectionGetFlags ${sec3} $0
IntOp $0 $0 & 0x80000000 IntOp $0 $0 & ${SECTION_ON}
IntCmp $0 0x80000000 0 +2 +2 IntCmp $0 ${SECTION_ON} 0 +2 +2
StrCpy $1 ${sec3} StrCpy $1 ${sec3}
SectionGetFlags ${sec4} $0 SectionGetFlags ${sec4} $0
IntOp $0 $0 & 0x80000000 IntOp $0 $0 & ${SECTION_ON}
IntCmp $0 0x80000000 0 +2 +2 IntCmp $0 ${SECTION_ON} 0 +2 +2
StrCpy $1 ${sec4} StrCpy $1 ${sec4}
StrCmp $2 $1 0 +2 ; selection hasn't changed
SectionGetFlags $1 $0
IntOp $0 $0 | ${SECTION_ON}
SectionSetFlags $1 $0
Pop $2
Pop $0
FunctionEnd FunctionEnd