Added RemoveSection and UnremoveSection macros to hide+unselect and show+select a section. Removed some unnecessary StrCpy ops from the other macros.

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6074 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
afrow_uk 2010-04-30 18:36:36 +00:00
parent d96bd3cb6e
commit b28daffd60

View file

@ -116,12 +116,12 @@
; A radio button
!macro RadioButton SECTION_NAME
!macro RadioButton SECTION
SectionGetFlags ${SECTION_NAME} $R0
SectionGetFlags "${SECTION}" $R0
IntOp $R0 $R0 & ${SF_SELECTED}
IntCmp $R0 ${SF_SELECTED} 0 +2 +2
StrCpy "${StartRadioButtons_Var}" ${SECTION_NAME}
StrCpy "${StartRadioButtons_Var}" "${SECTION}"
!macroend
@ -185,31 +185,25 @@
!define INSTTYPE_31 1073741824
!define INSTTYPE_32 2147483648
!macro SetSectionInInstType SECTION_NAME WANTED_INSTTYPE
!macro SetSectionInInstType SECTION WANTED_INSTTYPE
Push $0
Push $1
StrCpy $1 "${SECTION_NAME}"
SectionGetInstTypes $1 $0
SectionGetInstTypes "${SECTION}" $0
IntOp $0 $0 | ${WANTED_INSTTYPE}
SectionSetInstTypes $1 $0
Pop $1
SectionSetInstTypes "${SECTION}" $0
Pop $0
!macroend
!macro ClearSectionInInstType SECTION_NAME WANTED_INSTTYPE
!macro ClearSectionInInstType SECTION WANTED_INSTTYPE
Push $0
Push $1
Push $2
StrCpy $2 "${SECTION_NAME}"
SectionGetInstTypes $2 $0
SectionGetInstTypes "${SECTION}" $0
StrCpy $1 ${WANTED_INSTTYPE}
IntOp $1 $1 ~
IntOp $0 $0 & $1
SectionSetInstTypes $2 $0
Pop $2
SectionSetInstTypes "${SECTION}" $0
Pop $1
Pop $0
@ -225,12 +219,9 @@
!macro SetSectionFlag SECTION BITS
Push $R0
Push $R1
StrCpy $R1 "${SECTION}"
SectionGetFlags $R1 $R0
SectionGetFlags "${SECTION}" $R0
IntOp $R0 $R0 | "${BITS}"
SectionSetFlags $R1 $R0
Pop $R1
SectionSetFlags "${SECTION}" $R0
Pop $R0
!macroend
@ -241,13 +232,10 @@
Push $R0
Push $R1
Push $R2
StrCpy $R2 "${SECTION}"
SectionGetFlags $R2 $R0
SectionGetFlags "${SECTION}" $R0
IntOp $R1 "${BITS}" ~
IntOp $R0 $R0 & $R1
SectionSetFlags $R2 $R0
Pop $R2
SectionSetFlags "${SECTION}" $R0
Pop $R1
Pop $R0
@ -270,4 +258,32 @@
;--------------------------------
!endif
; Removes a section by unselecting and hiding it
!macro RemoveSection SECTION
Push $R0
SectionGetFlags `${SECTION}` $R0
IntOp $R0 $R0 & ${SECTION_OFF}
SectionSetFlags `${SECTION}` $R0
SectionSetText `${SECTION}` ``
Pop $R0
!macroend
; Undoes the RemoveSection action
!macro UnremoveSection SECTION SECTION_TEXT
Push $R0
SectionGetFlags `${SECTION}` $R0
IntOp $R0 $R0 | ${SF_SELECTED}
SectionSetFlags `${SECTION}` $R0
SectionSetText `${SECTION}` `${SECTION_TEXT}`
Pop $R0
!macroend
!endif
;--------------------------------