cleanup
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@3310 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
48fcee1824
commit
f01376b166
1 changed files with 163 additions and 96 deletions
|
@ -1,11 +1,19 @@
|
||||||
; Some sections defines
|
; Sections.nsh
|
||||||
|
;
|
||||||
|
; Defines and macros for section control
|
||||||
|
;
|
||||||
; Include in your script using:
|
; Include in your script using:
|
||||||
; !include "Sections.nsh"
|
; !include "Sections.nsh"
|
||||||
|
|
||||||
!ifndef SECTIONS_NSH_INCLUDED
|
;--------------------------------
|
||||||
|
|
||||||
!define SECTIONS_NSH_INCLUDED
|
!ifndef SECTIONS_INCLUDED
|
||||||
|
|
||||||
|
!define SECTIONS_INCLUDED
|
||||||
|
|
||||||
|
;--------------------------------
|
||||||
|
|
||||||
|
; Generic section defines
|
||||||
|
|
||||||
!define SF_SELECTED 1
|
!define SF_SELECTED 1
|
||||||
!define SF_SUBSEC 2
|
!define SF_SUBSEC 2
|
||||||
|
@ -17,90 +25,110 @@
|
||||||
|
|
||||||
!define SECTION_OFF 0xFFFFFFFE
|
!define SECTION_OFF 0xFFFFFFFE
|
||||||
|
|
||||||
|
;--------------------------------
|
||||||
|
|
||||||
|
; Select / unselect / reserve section
|
||||||
|
|
||||||
!macro SelectSection SECTION
|
!macro SelectSection SECTION
|
||||||
Push $0
|
|
||||||
SectionGetFlags "${SECTION}" $0
|
Push $0
|
||||||
IntOp $0 $0 | ${SF_SELECTED}
|
SectionGetFlags "${SECTION}" $0
|
||||||
SectionSetFlags "${SECTION}" $0
|
IntOp $0 $0 | ${SF_SELECTED}
|
||||||
Pop $0
|
SectionSetFlags "${SECTION}" $0
|
||||||
|
Pop $0
|
||||||
|
|
||||||
!macroend
|
!macroend
|
||||||
|
|
||||||
!macro UnselectSection SECTION
|
!macro UnselectSection SECTION
|
||||||
Push $0
|
|
||||||
SectionGetFlags "${SECTION}" $0
|
Push $0
|
||||||
IntOp $0 $0 & ${SECTION_OFF}
|
SectionGetFlags "${SECTION}" $0
|
||||||
SectionSetFlags "${SECTION}" $0
|
IntOp $0 $0 & ${SECTION_OFF}
|
||||||
Pop $0
|
SectionSetFlags "${SECTION}" $0
|
||||||
|
Pop $0
|
||||||
|
|
||||||
!macroend
|
!macroend
|
||||||
|
|
||||||
# if section selected, will unselect, if unselected, will select
|
; If section selected, will unselect, if unselected, will select
|
||||||
|
|
||||||
!macro ReverseSection SECTION
|
!macro ReverseSection SECTION
|
||||||
Push $0
|
|
||||||
SectionGetFlags "${SECTION}" $0
|
Push $0
|
||||||
IntOp $0 $0 ^ ${SF_SELECTED}
|
SectionGetFlags "${SECTION}" $0
|
||||||
SectionSetFlags "${SECTION}" $0
|
IntOp $0 $0 ^ ${SF_SELECTED}
|
||||||
Pop $0
|
SectionSetFlags "${SECTION}" $0
|
||||||
|
Pop $0
|
||||||
|
|
||||||
!macroend
|
!macroend
|
||||||
|
|
||||||
# macros for mutually exclusive section selection
|
;--------------------------------
|
||||||
# written by Tim Gallagher
|
|
||||||
|
|
||||||
#### usage example (see one-section.nsi too):
|
; Macros for mutually exclusive section selection
|
||||||
|
; Written by Tim Gallagher
|
||||||
|
;
|
||||||
|
; See one-section.nsi for an example of usage
|
||||||
|
|
||||||
# Var SomeVar
|
; Starts the Radio Button Block
|
||||||
#
|
; You should pass a variable that keeps the selected section
|
||||||
# Function .onSelChange
|
; as the first parameter for this macro. This variable should
|
||||||
# !insertmacro StartRadioButtons $SomeVar
|
; be initialized to the default section's index.
|
||||||
# !insertmacro RadioButton ${sec1}
|
;
|
||||||
# !insertmacro RadioButton ${sec2}
|
; As this macro uses $R0 and $R1 you can't use those two as the
|
||||||
# !insertmacro RadioButton ${sec3}
|
; varible which will keep the selected section.
|
||||||
# !insertmacro EndRadioButtons
|
|
||||||
# FunctionEnd
|
|
||||||
#
|
|
||||||
# Function .onInit
|
|
||||||
# StrCpy $SomeVar ${sec1} ; default section
|
|
||||||
# !insertmacro UnselectSection ${sec2}
|
|
||||||
# !insertmacro UnselectSection ${sec3}
|
|
||||||
# FunctionEnd
|
|
||||||
|
|
||||||
# Starts the Radio Button Block.
|
|
||||||
# You should pass a variable that keeps the selected section
|
|
||||||
# as the first parameter for this macro. This variable should
|
|
||||||
# be initialized to the default section's index. As this macro
|
|
||||||
# uses $R0 and $R1 you can't use those two as the varible
|
|
||||||
# which will keep the selected section.
|
|
||||||
!macro StartRadioButtons var
|
!macro StartRadioButtons var
|
||||||
!define StartRadioButtons_Var "${var}"
|
|
||||||
Push $R0
|
|
||||||
SectionGetFlags "${StartRadioButtons_Var}" $R0
|
|
||||||
IntOp $R0 $R0 & ${SECTION_OFF}
|
|
||||||
SectionSetFlags "${StartRadioButtons_Var}" $R0
|
|
||||||
|
|
||||||
Push $R1
|
!define StartRadioButtons_Var "${var}"
|
||||||
StrCpy $R1 "${StartRadioButtons_Var}"
|
|
||||||
|
Push $R0
|
||||||
|
|
||||||
|
SectionGetFlags "${StartRadioButtons_Var}" $R0
|
||||||
|
IntOp $R0 $R0 & ${SECTION_OFF}
|
||||||
|
SectionSetFlags "${StartRadioButtons_Var}" $R0
|
||||||
|
|
||||||
|
Push $R1
|
||||||
|
|
||||||
|
StrCpy $R1 "${StartRadioButtons_Var}"
|
||||||
|
|
||||||
!macroend
|
!macroend
|
||||||
|
|
||||||
|
; A radio button
|
||||||
|
|
||||||
!macro RadioButton SECTION_NAME
|
!macro RadioButton SECTION_NAME
|
||||||
SectionGetFlags ${SECTION_NAME} $R0
|
|
||||||
IntOp $R0 $R0 & ${SF_SELECTED}
|
SectionGetFlags ${SECTION_NAME} $R0
|
||||||
IntCmp $R0 ${SF_SELECTED} 0 +2 +2
|
IntOp $R0 $R0 & ${SF_SELECTED}
|
||||||
StrCpy "${StartRadioButtons_Var}" ${SECTION_NAME}
|
IntCmp $R0 ${SF_SELECTED} 0 +2 +2
|
||||||
|
StrCpy "${StartRadioButtons_Var}" ${SECTION_NAME}
|
||||||
|
|
||||||
!macroend
|
!macroend
|
||||||
|
|
||||||
# ends the radio button block
|
; Ends the radio button block
|
||||||
|
|
||||||
!macro EndRadioButtons
|
!macro EndRadioButtons
|
||||||
StrCmp $R1 "${StartRadioButtons_Var}" 0 +4 ; selection hasn't changed
|
|
||||||
SectionGetFlags "${StartRadioButtons_Var}" $R0
|
StrCmp $R1 "${StartRadioButtons_Var}" 0 +4 ; selection hasn't changed
|
||||||
IntOp $R0 $R0 | ${SF_SELECTED}
|
SectionGetFlags "${StartRadioButtons_Var}" $R0
|
||||||
SectionSetFlags "${StartRadioButtons_Var}" $R0
|
IntOp $R0 $R0 | ${SF_SELECTED}
|
||||||
|
SectionSetFlags "${StartRadioButtons_Var}" $R0
|
||||||
|
|
||||||
|
Pop $R1
|
||||||
|
Pop $R0
|
||||||
|
|
||||||
|
!undef StartRadioButtons_Var
|
||||||
|
|
||||||
Pop $R1
|
|
||||||
Pop $R0
|
|
||||||
!undef StartRadioButtons_Var
|
|
||||||
!macroend
|
!macroend
|
||||||
|
|
||||||
; For details about SetSectionInInstType and ClearSectionInInstType, see
|
;--------------------------------
|
||||||
; http://nsis.sourceforge.net/archive/nsisweb.php?page=287
|
|
||||||
|
; These are two macros you can use to set a Section in an InstType
|
||||||
|
; or clear it from an InstType.
|
||||||
|
;
|
||||||
|
; Written by Robert Kehl
|
||||||
|
;
|
||||||
|
; For details, see http://nsis.sourceforge.net/archive/nsisweb.php?page=287
|
||||||
|
;
|
||||||
|
; Use the defines below for the WANTED_INSTTYPE paramter.
|
||||||
|
|
||||||
!define INSTTYPE_1 1
|
!define INSTTYPE_1 1
|
||||||
!define INSTTYPE_2 2
|
!define INSTTYPE_2 2
|
||||||
|
@ -110,53 +138,91 @@
|
||||||
!define INSTTYPE_6 32
|
!define INSTTYPE_6 32
|
||||||
!define INSTTYPE_7 64
|
!define INSTTYPE_7 64
|
||||||
!define INSTTYPE_8 128
|
!define INSTTYPE_8 128
|
||||||
|
!define INSTTYPE_9 256
|
||||||
|
!define INSTTYPE_10 512
|
||||||
|
!define INSTTYPE_11 1024
|
||||||
|
!define INSTTYPE_12 2048
|
||||||
|
!define INSTTYPE_13 4096
|
||||||
|
!define INSTTYPE_14 8192
|
||||||
|
!define INSTTYPE_15 16384
|
||||||
|
!define INSTTYPE_16 32768
|
||||||
|
!define INSTTYPE_17 65536
|
||||||
|
!define INSTTYPE_18 131072
|
||||||
|
!define INSTTYPE_19 262144
|
||||||
|
!define INSTTYPE_20 524288
|
||||||
|
!define INSTTYPE_21 1048576
|
||||||
|
!define INSTTYPE_22 2097152
|
||||||
|
!define INSTTYPE_23 4194304
|
||||||
|
!define INSTTYPE_24 8388608
|
||||||
|
!define INSTTYPE_25 16777216
|
||||||
|
!define INSTTYPE_26 33554432
|
||||||
|
!define INSTTYPE_27 67108864
|
||||||
|
!define INSTTYPE_28 134217728
|
||||||
|
!define INSTTYPE_29 268435456
|
||||||
|
!define INSTTYPE_30 536870912
|
||||||
|
!define INSTTYPE_31 1073741824
|
||||||
|
!define INSTTYPE_32 2147483648
|
||||||
|
|
||||||
!macro SetSectionInInstType SECTION_NAME WANTED_INSTTYPE
|
!macro SetSectionInInstType SECTION_NAME WANTED_INSTTYPE
|
||||||
Push $0
|
|
||||||
SectionGetInstTypes "${SECTION_NAME}" $0
|
Push $0
|
||||||
IntOp $0 $0 | ${WANTED_INSTTYPE}
|
SectionGetInstTypes "${SECTION_NAME}" $0
|
||||||
SectionSetInstTypes "${SECTION_NAME}" $0
|
IntOp $0 $0 | ${WANTED_INSTTYPE}
|
||||||
Pop $0
|
SectionSetInstTypes "${SECTION_NAME}" $0
|
||||||
|
Pop $0
|
||||||
|
|
||||||
!macroend
|
!macroend
|
||||||
|
|
||||||
!macro ClearSectionInInstType SECTION_NAME WANTED_INSTTYPE
|
!macro ClearSectionInInstType SECTION_NAME WANTED_INSTTYPE
|
||||||
Push $0
|
|
||||||
Push $1
|
Push $0
|
||||||
SectionGetInstTypes "${SECTION_NAME}" $0
|
Push $1
|
||||||
StrCpy $1 ${WANTED_INSTTYPE}
|
SectionGetInstTypes "${SECTION_NAME}" $0
|
||||||
IntOp $1 $1 ~
|
StrCpy $1 ${WANTED_INSTTYPE}
|
||||||
IntOp $0 $0 & $1
|
IntOp $1 $1 ~
|
||||||
SectionSetInstTypes "${SECTION_NAME}" $0
|
IntOp $0 $0 & $1
|
||||||
Pop $1
|
SectionSetInstTypes "${SECTION_NAME}" $0
|
||||||
Pop $0
|
Pop $1
|
||||||
|
Pop $0
|
||||||
|
|
||||||
!macroend
|
!macroend
|
||||||
|
|
||||||
# more macros by derekrprice
|
;--------------------------------
|
||||||
|
|
||||||
|
; Set / clear / check bits in a section's flags
|
||||||
|
; Written by derekrprice
|
||||||
|
|
||||||
|
; Set one or more bits in a sections's flags
|
||||||
|
|
||||||
; Set one or more BITS in SECTION's flags.
|
|
||||||
!macro SetSectionFlag SECTION BITS
|
!macro SetSectionFlag SECTION BITS
|
||||||
Push $R0
|
|
||||||
SectionGetFlags "${SECTION}" $R0
|
Push $R0
|
||||||
IntOp $R0 $R0 | "${BITS}"
|
SectionGetFlags "${SECTION}" $R0
|
||||||
SectionSetFlags "${SECTION}" $R0
|
IntOp $R0 $R0 | "${BITS}"
|
||||||
Pop $R0
|
SectionSetFlags "${SECTION}" $R0
|
||||||
|
Pop $R0
|
||||||
|
|
||||||
!macroend
|
!macroend
|
||||||
|
|
||||||
; Clear one or more BITS in SECTION's flags.
|
; Clear one or more bits in section's flags
|
||||||
|
|
||||||
!macro ClearSectionFlag SECTION BITS
|
!macro ClearSectionFlag SECTION BITS
|
||||||
Push $R0
|
|
||||||
Push $R1
|
Push $R0
|
||||||
SectionGetFlags "${SECTION}" $R0
|
Push $R1
|
||||||
IntOp $R1 "${BITS}" ~
|
SectionGetFlags "${SECTION}" $R0
|
||||||
IntOp $R0 $R0 & $R1
|
IntOp $R1 "${BITS}" ~
|
||||||
SectionSetFlags "${SECTION}" $R0
|
IntOp $R0 $R0 & $R1
|
||||||
Pop $R1
|
SectionSetFlags "${SECTION}" $R0
|
||||||
Pop $R0
|
Pop $R1
|
||||||
|
Pop $R0
|
||||||
|
|
||||||
!macroend
|
!macroend
|
||||||
|
|
||||||
; Check if one or more BITS in SECTION's flags are set.
|
; Check if one or more bits in section's flags are set
|
||||||
; If they are, jump to JUMPIFSET
|
; If they are, jump to JUMPIFSET
|
||||||
; If not, jump to JUMPIFNOTSET
|
; If not, jump to JUMPIFNOTSET
|
||||||
|
|
||||||
!macro SectionFlagIsSet SECTION BITS JUMPIFSET JUMPIFNOTSET
|
!macro SectionFlagIsSet SECTION BITS JUMPIFSET JUMPIFNOTSET
|
||||||
Push $R0
|
Push $R0
|
||||||
SectionGetFlags "${SECTION}" $R0
|
SectionGetFlags "${SECTION}" $R0
|
||||||
|
@ -168,5 +234,6 @@
|
||||||
Goto "${JUMPIFSET}"
|
Goto "${JUMPIFSET}"
|
||||||
!macroend
|
!macroend
|
||||||
|
|
||||||
|
;--------------------------------
|
||||||
|
|
||||||
!endif
|
!endif
|
Loading…
Add table
Add a link
Reference in a new issue