New Sections.nsh
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@2160 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
c59f187c74
commit
858c86cbdc
2 changed files with 54 additions and 8 deletions
|
@ -18,14 +18,8 @@ OutFile one-section.exe
|
||||||
|
|
||||||
ComponentText "please choose just one but the default"
|
ComponentText "please choose just one but the default"
|
||||||
|
|
||||||
!define SF_SELECTED 1
|
# defines SF_*, SECTION_OFF and some macros
|
||||||
!define SF_SUBSEC 2
|
!include Sections.nsh
|
||||||
!define SF_SUBSECEND 4
|
|
||||||
!define SF_BOLD 8
|
|
||||||
!define SF_RO 16
|
|
||||||
!define SF_EXPAND 32
|
|
||||||
|
|
||||||
!define SECTION_OFF 0xFFFFFFFE
|
|
||||||
|
|
||||||
Section !Required
|
Section !Required
|
||||||
SectionIn RO
|
SectionIn RO
|
||||||
|
@ -50,18 +44,22 @@ Function .onInit
|
||||||
SectionGetFlags ${sec1} $0
|
SectionGetFlags ${sec1} $0
|
||||||
IntOp $0 $0 | ${SF_SELECTED}
|
IntOp $0 $0 | ${SF_SELECTED}
|
||||||
SectionSetFlags ${sec1} $0
|
SectionSetFlags ${sec1} $0
|
||||||
|
# !insertmacro SelectSection ${sec1}
|
||||||
|
|
||||||
SectionGetFlags ${sec2} $0
|
SectionGetFlags ${sec2} $0
|
||||||
IntOp $0 $0 & ${SECTION_OFF}
|
IntOp $0 $0 & ${SECTION_OFF}
|
||||||
SectionSetFlags ${sec2} $0
|
SectionSetFlags ${sec2} $0
|
||||||
|
# !insertmacro UnselectSection ${sec2}
|
||||||
|
|
||||||
SectionGetFlags ${sec3} $0
|
SectionGetFlags ${sec3} $0
|
||||||
IntOp $0 $0 & ${SECTION_OFF}
|
IntOp $0 $0 & ${SECTION_OFF}
|
||||||
SectionSetFlags ${sec3} $0
|
SectionSetFlags ${sec3} $0
|
||||||
|
# !insertmacro UnselectSection ${sec3}
|
||||||
|
|
||||||
SectionGetFlags ${sec4} $0
|
SectionGetFlags ${sec4} $0
|
||||||
IntOp $0 $0 & ${SECTION_OFF}
|
IntOp $0 $0 & ${SECTION_OFF}
|
||||||
SectionSetFlags ${sec4} $0
|
SectionSetFlags ${sec4} $0
|
||||||
|
# !insertmacro UnselectSection ${sec4}
|
||||||
|
|
||||||
Pop $0
|
Pop $0
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
@ -73,6 +71,7 @@ Function .onSelChange
|
||||||
SectionGetFlags $1 $0
|
SectionGetFlags $1 $0
|
||||||
IntOp $0 $0 & ${SECTION_OFF}
|
IntOp $0 $0 & ${SECTION_OFF}
|
||||||
SectionSetFlags $1 $0
|
SectionSetFlags $1 $0
|
||||||
|
# !insertmacro UnselectSection $1
|
||||||
|
|
||||||
; Now remember the current selection
|
; Now remember the current selection
|
||||||
Push $2
|
Push $2
|
||||||
|
@ -99,6 +98,7 @@ Function .onSelChange
|
||||||
SectionGetFlags $1 $0
|
SectionGetFlags $1 $0
|
||||||
IntOp $0 $0 | ${SF_SELECTED}
|
IntOp $0 $0 | ${SF_SELECTED}
|
||||||
SectionSetFlags $1 $0
|
SectionSetFlags $1 $0
|
||||||
|
# !insertmacro SelectSection $1
|
||||||
Pop $2
|
Pop $2
|
||||||
Pop $0
|
Pop $0
|
||||||
FunctionEnd
|
FunctionEnd
|
46
Include/Sections.nsh
Normal file
46
Include/Sections.nsh
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
; Some sections defines
|
||||||
|
|
||||||
|
; Include in your script using:
|
||||||
|
; !include "Sections.nsh"
|
||||||
|
|
||||||
|
!ifndef SECTIONS_NSH_INCLUDED
|
||||||
|
|
||||||
|
!define SECTIONS_NSH_INCLUDED
|
||||||
|
|
||||||
|
!define HWND_BROADCAST 0xFFFF
|
||||||
|
|
||||||
|
!define SF_SELECTED 1
|
||||||
|
!define SF_SUBSEC 2
|
||||||
|
!define SF_SUBSECEND 4
|
||||||
|
!define SF_BOLD 8
|
||||||
|
!define SF_RO 16
|
||||||
|
!define SF_EXPAND 32
|
||||||
|
|
||||||
|
!define SECTION_OFF 0xFFFFFFFE
|
||||||
|
|
||||||
|
!macro SelectSection SECTION
|
||||||
|
Push $0
|
||||||
|
SectionGetFlags "${SECTION}" $0
|
||||||
|
IntOp $0 $0 & ${SF_SELECTED}
|
||||||
|
SectionSetFlags "${SECTION}" $0
|
||||||
|
Pop $0
|
||||||
|
!macroend
|
||||||
|
|
||||||
|
!macro UnselectSection SECTION
|
||||||
|
Push $0
|
||||||
|
SectionGetFlags "${SECTION}" $0
|
||||||
|
IntOp $0 $0 & ${SECTION_OFF}
|
||||||
|
SectionSetFlags "${SECTION}" $0
|
||||||
|
Pop $0
|
||||||
|
!macroend
|
||||||
|
|
||||||
|
# if section selected, will unselect, if unselected, will select
|
||||||
|
!macro ReverseSection SECTION
|
||||||
|
Push $0
|
||||||
|
SectionGetFlags "${SECTION}" $0
|
||||||
|
IntOp $0 $0 ^ ${SF_SELECTED}
|
||||||
|
SectionSetFlags "${SECTION}" $0
|
||||||
|
Pop $0
|
||||||
|
!macroend
|
||||||
|
|
||||||
|
!endif
|
Loading…
Add table
Add a link
Reference in a new issue