Added Animation and TrackBar NSD controls

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6901 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
anders_k 2017-09-16 14:01:44 +00:00
parent 98e614d955
commit 0bc1198413
4 changed files with 229 additions and 18 deletions

View file

@ -94,6 +94,18 @@ code
<a href="#mref-lbselectstring">NSD_LB_SelectString</a>,
<a href="#mref-lbgetselection">NSD_LB_GetSelection</a>
</li>
<li>Animation:
<a href="#mref-animopenfile">NSD_Anim_OpenFile</a>,
<a href="#mref-animplay">NSD_Anim_Play</a>,
<a href="#mref-animstop">NSD_Anim_Stop</a>
</li>
<li>HTrackBar &amp; VTrackBar:
<a href="#mref-trackgetpos">NSD_TrackBar_GetPos</a>,
<a href="#mref-tracksetpos">NSD_TrackBar_SetPos</a>,
<a href="#mref-tracksetrmin">NSD_TrackBar_SetRangeMin</a>,
<a href="#mref-tracksetrmax">NSD_TrackBar_SetRangeMax</a>,
<a href="#mref-tracksetticfr">NSD_TrackBar_SetTicFreq</a>
</li>
<li><a href="#mref-setimage">NSD_SetImage</a></li>
<li><a href="#mref-setsimage">NSD_SetStretchedImage</a></li>
<li><a href="#mref-seticon">NSD_SetIcon</a></li>
@ -298,6 +310,9 @@ SectionEnd</pre></blockquote>
<li>ListBox</li>
<li>SortedListBox</li>
<li>ProgressBar</li>
<li>Animation</li>
<li>HTrackBar</li>
<li>VTrackBar</li>
</ul>
<h3><a name="step-state"></a>Control State</h3>
@ -656,6 +671,9 @@ SectionEnd</pre></blockquote>
<li>${NSD_CreateListBox}</li>
<li>${NSD_CreateSortedListBox}</li>
<li>${NSD_CreateProgressBar}</li>
<li>${NSD_CreateAnimation}</li>
<li>${NSD_CreateHTrackBar}</li>
<li>${NSD_CreateVTrackBar}</li>
</ul>
<p>Returns the new control's HWND on the stack or <i>error</i></p>
@ -688,6 +706,12 @@ SectionEnd</pre></blockquote>
<p>See <a href="#ref-onnotify">OnNotify</a> for more details.</p>
<h3><a name="mref-setfocus"></a>NSD_SetFocus</h3>
<p><code>${NSD_SetFocus} <i>control_HWND</i></code></p>
<p>Sets focus to a control.</p>
<h3><a name="mref-createtimer"></a>NSD_CreateTimer</h3>
<p><code>${NSD_CreateTimer} <i>function_name</i> <i>timer_interval</i></code></p>
@ -830,11 +854,45 @@ SectionEnd</pre></blockquote>
<p>Retrieves the selected stringed from a list box. Returns an empty string if no string is selected.</p>
<h3><a name="mref-setfocus"></a>NSD_SetFocus</h3>
<h3><a name="mref-animopenfile">NSD_Anim_OpenFile</a></h3>
<p><code>${NSD_SetFocus} <i>control_HWND</i></code></p>
<p><code>${NSD_Anim_OpenFile} <i>anim_HWND</i> <i>avi_path</i></code></p>
<p>Sets focus to a control.</p>
<p>Opens the specified (silent) .AVI movie clip.</p>
<h3><a name="mref-animplay">NSD_Anim_Play</a></h3>
<p><code>${NSD_Anim_Play} <i>anim_HWND</i></code></p>
<p>Plays the movie clip repeatedly.</p>
<h3><a name="mref-animstop">NSD_Anim_Stop</a></h3>
<p><code>${NSD_Anim_Stop} <i>anim_HWND</i></code></p>
<p>Stops playback.</p>
<h3><a name="mref-trackgetpos">NSD_TrackBar_GetPos</a></h3>
<p><code>${NSD_TrackBar_GetPos} <i>track_HWND</i> <i>output</i></code></p>
<h3><a name="mref-tracksetpos">NSD_TrackBar_SetPos</a></h3>
<p><code>${NSD_TrackBar_SetPos} <i>track_HWND</i> <i>pos</i></code></p>
<h3><a name="mref-tracksetrmin">NSD_TrackBar_SetRangeMin</a></h3>
<p><code>${NSD_TrackBar_SetRangeMin} <i>track_HWND</i> <i>minpos</i></code></p>
<h3><a name="mref-tracksetrmax">NSD_TrackBar_SetRangeMax</a></h3>
<p><code>${NSD_TrackBar_SetRangeMax} <i>track_HWND</i> <i>maxpos</i></code></p>
<h3><a name="mref-tracksetticfr">NSD_TrackBar_SetTicFreq</a></h3>
<p><code>${NSD_TrackBar_SetTicFreq} <i>track_HWND</i></code></p>
<p>Sets the interval frequency for tick marks.</p>
<h3><a name="mref-setimage"></a>NSD_SetImage</h3>

View file

@ -152,6 +152,29 @@ Header file for creating custom installer pages with nsDialogs
!define LBS_NOSEL 0x4000
!define LBS_COMBOBOX 0x8000
!define ACS_CENTER 0x0001
!define ACS_TRANSPARENT 0x0002 ; The parent of the animation control must not have the WS_CLIPCHILDREN style
!define ACS_AUTOPLAY 0x0004
!define ACS_TIMER 0x0008 ; < CC6
!define TBS_AUTOTICKS 0x0001
!define TBS_VERT 0x0002
!define TBS_HORZ 0x0000
!define TBS_TOP 0x0004
!define TBS_BOTTOM 0x0000
!define TBS_LEFT 0x0004
!define TBS_RIGHT 0x0000
!define TBS_BOTH 0x0008
!define TBS_NOTICKS 0x0010
!define TBS_ENABLESELRANGE 0x0020
!define TBS_FIXEDLENGTH 0x0040
!define TBS_NOTHUMB 0x0080
!define TBS_TOOLTIPS 0x0100 ; IE3
!define TBS_REVERSED 0x0200 ; IE5
!define TBS_DOWNISLEFT 0x0400 ; _WIN32_IE >= 0x0501
!define TBS_NOTIFYBEFOREMOVE 0x0800 ; IE6?
!define TBS_TRANSPARENTBKGND 0x1000 ; Vista
!define /ifndef LR_DEFAULTCOLOR 0x0000
!define /ifndef LR_MONOCHROME 0x0001
!define /ifndef LR_COLOR 0x0002
@ -174,6 +197,16 @@ Header file for creating custom installer pages with nsDialogs
!define /ifndef GWL_STYLE -16
!define /ifndef GWL_EXSTYLE -20
!define /ifndef ICC_BAR_CLASSES 0x0004
!define /ifndef ICC_UPDOWN_CLASS 0x0010
!define /ifndef ICC_HOTKEY_CLASS 0x0040
!define /ifndef ICC_ANIMATE_CLASS 0x0080
!define /ifndef ICC_DATE_CLASSES 0x0100
!define /ifndef ICC_USEREX_CLASSES 0x0200
!define /ifndef ICC_INTERNET_CLASSES 0x0800
!define /ifndef ICC_LINK_CLASS 0x8000
!define DEFAULT_STYLES ${WS_CHILD}|${WS_VISIBLE}|${WS_CLIPSIBLINGS}
!define __NSD_HLine_CLASS STATIC
@ -260,6 +293,19 @@ Header file for creating custom installer pages with nsDialogs
!define __NSD_ProgressBar_STYLE ${DEFAULT_STYLES}
!define __NSD_ProgressBar_EXSTYLE ${WS_EX_WINDOWEDGE}|${WS_EX_CLIENTEDGE}
!define __NSD_Animation_CLASS SysAnimate32
!define __NSD_Animation_STYLE ${DEFAULT_STYLES}|${ACS_TRANSPARENT}|${ACS_AUTOPLAY}
!define __NSD_Animation_EXSTYLE 0
!define __NSD_HTrackBar_CLASS msctls_trackbar32
!define __NSD_HTrackBar_STYLE ${DEFAULT_STYLES}|${TBS_HORZ}|${TBS_AUTOTICKS}|${TBS_TOOLTIPS}
!define __NSD_HTrackBar_EXSTYLE 0
!define __NSD_VTrackBar_CLASS msctls_trackbar32
!define __NSD_VTrackBar_STYLE ${DEFAULT_STYLES}|${TBS_VERT}|${TBS_AUTOTICKS}|${TBS_TOOLTIPS}
!define __NSD_VTrackBar_EXSTYLE 0
!macro __NSD_DefineControl NAME
!define NSD_Create${NAME} "nsDialogs::CreateControl ${__NSD_${Name}_CLASS} ${__NSD_${Name}_STYLE} ${__NSD_${Name}_EXSTYLE}"
!macroend
@ -284,6 +330,10 @@ Header file for creating custom installer pages with nsDialogs
!insertmacro __NSD_DefineControl ListBox
!insertmacro __NSD_DefineControl SortedListBox
!insertmacro __NSD_DefineControl ProgressBar
!insertmacro __NSD_DefineControl Animation
!insertmacro __NSD_DefineControl HTrackBar
!insertmacro __NSD_DefineControl VTrackBar
!macro __NSD_OnControlEvent EVENT HWND FUNCTION
Push $0
@ -320,6 +370,35 @@ Header file for creating custom installer pages with nsDialogs
!insertmacro __NSD_DefineDialogCallback Back
!define __NSD_MkCtlCmd "!insertmacro __NSD_MkCtlCmd "
!macro __NSD_MkCtlCmd msg wp lp hCtl
SendMessage ${hCtl} ${${msg}} ${wp} ${lp}
!macroend
!define __NSD_MkCtlCmd_WP "!insertmacro __NSD_MkCtlCmd_WP "
!macro __NSD_MkCtlCmd_WP msg lp hCtl wp
SendMessage ${hCtl} ${${msg}} ${wp} ${lp}
!macroend
!define __NSD_MkCtlCmd_LP "!insertmacro __NSD_MkCtlCmd_LP "
!macro __NSD_MkCtlCmd_LP msg wp hCtl lp
SendMessage ${hCtl} ${${msg}} ${wp} ${lp}
!macroend
!define __NSD_MkCtlCmd_WPLP "!insertmacro __NSD_MkCtlCmd_WPLP "
!macro __NSD_MkCtlCmd_WPLP msg hCtl wp lp
SendMessage ${hCtl} ${${msg}} ${wp} ${lp}
!macroend
!define __NSD_MkCtlCmd_RV "!insertmacro __NSD_MkCtlCmd_RV "
!macro __NSD_MkCtlCmd_RV msg wp lp hCtl VAR
SendMessage ${hCtl} ${${msg}} ${wp} ${lp} ${VAR}
!macroend
!define NSD_InitCommonControlsEx "!insertmacro __NSD_InitCommonControlsEx "
!macro __NSD_InitCommonControlsEx ICC
System::Int64Op ${ICC} << 32
System::Int64Op 0x08 |
System::Call 'COMCTL32::InitCommonControlsEx(*ls)' ; INITCOMMONCONTROLSEX as UINT64
!macroend
!define NSD_CreateTimer `!insertmacro _NSD_CreateTimer `
!macro _NSD_CreateTimer FUNCTION INTERVAL
Push $0
@ -402,6 +481,7 @@ Header file for creating custom installer pages with nsDialogs
!macroend
!define NSD_GetChecked `!insertmacro __NSD_GetState `
!define NSD_SetChecked `!insertmacro __NSD_SetState `
### ComboBox ###
@ -558,6 +638,43 @@ SendMessage ${CONTROL} ${LB_SETITEMDATA} ${INDEX} ${DATA}
!macroend
### Animation ###
!define NSD_Anim_Close `${__NSD_MkCtlCmd} ACM_OPEN 0 0 `
!define NSD_Anim_Play `${__NSD_MkCtlCmd} ACM_PLAY -1 0xFFFF0000 `
!define NSD_Anim_PlayLoops `${__NSD_MkCtlCmd_WP} ACM_PLAY 0xFFFF0000 ` ; WP(UINT16):LoopCount
!define NSD_Anim_Stop `${__NSD_MkCtlCmd} ACM_STOP 0 0 `
!define NSD_Anim_IsPlaying `${__NSD_MkCtlCmd_RV} ACM_ISPLAYING 0 0 `
!define NSD_Anim_OpenFile `!insertmacro __NSD_Anim_OpenFile `
!macro __NSD_Anim_OpenFile CONTROL PATH
SendMessage ${CONTROL} ${ACM_OPEN} 0 "STR:${PATH}"
!macroend
!define NSD_Anim_OpenResource `!insertmacro __NSD_Anim_OpenResource `
!macro __NSD_Anim_OpenResource CONTROL HINSTANCE_CC471 RESID
SendMessage ${CONTROL} ${ACM_OPEN} "${HINSTANCE_CC471}" "${RESID}"
!macroend
### TrackBar ###
!define NSD_TrackBar_GetPos `${__NSD_MkCtlCmd_RV} TBM_GETPOS 0 0 `
!define NSD_TrackBar_SetPos `${__NSD_MkCtlCmd_LP} TBM_SETPOS 1 `
!define NSD_TrackBar_SetRangeMin `${__NSD_MkCtlCmd_LP} TBM_SETRANGEMIN 1 `
!define NSD_TrackBar_SetRangeMax `${__NSD_MkCtlCmd_LP} TBM_SETRANGEMAX 1 `
!define NSD_TrackBar_GetLineSize `${__NSD_MkCtlCmd_RV} TBM_GETLINESIZE 0 0 `
!define NSD_TrackBar_SetLineSize `${__NSD_MkCtlCmd_LP} TBM_SETLINESIZE 0 `
!define NSD_TrackBar_GetPageSize `${__NSD_MkCtlCmd_RV} TBM_GETPAGESIZE 0 0 `
!define NSD_TrackBar_SetPageSize `${__NSD_MkCtlCmd_LP} TBM_SETPAGESIZE 0 `
!define NSD_TrackBar_ClearTics `${__NSD_MkCtlCmd} TBM_CLEARTICS 0 0 `
!define NSD_TrackBar_GetNumTics `${__NSD_MkCtlCmd_RV} TBM_GETNUMTICS 0 0 `
!define NSD_TrackBar_SetTic `${__NSD_MkCtlCmd_LP} TBM_SETTIC 0 `
!define NSD_TrackBar_SetTicFreq `${__NSD_MkCtlCmd_WP} TBM_SETTICFREQ 0 `
!define NSD_TrackBar_GetThumbLength `${__NSD_MkCtlCmd_RV} TBM_GETTHUMBLENGTH 0 0 `
!define NSD_TrackBar_SetBuddy `${__NSD_MkCtlCmd_WPLP} TBM_SETBUDDY ` ; WP(BOOL):Left/Right LP:HWND
### Static ###
!macro __NSD_LoadAndSetImage _LIHINSTMODE _IMGTYPE _LIHINSTSRC _LIFLAGS CONTROL IMAGE HANDLE

View file

@ -8,7 +8,7 @@ Released on ??? ??rd, 20??
\S2{} Minor Changes
\b Added more NSD ListBox macros (\W{http://sf.net/p/nsis/feature-requests/543}{RFE #543})
\b Added more NSD controls and macros (\W{http://sf.net/p/nsis/feature-requests/543}{RFE #543})
\H{v3.02.1} 3.02.1

View file

@ -41,6 +41,8 @@ SBM Scroll bar control
STM Static control
TCM Tab control
PBM Progress bar
ACM Animation control
TBM Track bar
-----------------------------------
NOT included messages (WM_USER + X)
@ -56,7 +58,6 @@ PGM Pager control
PSM Property sheet
RB Rebar control
TB Toolbar
TBM Trackbar
TTM Tooltip control
TVM Tree-view control
UDM Up-down control
@ -637,13 +638,7 @@ ${_NSIS_DEFAW} LVM_INSERTCOLUMN
${_NSIS_DEFAW} LVM_SETITEMTEXT
#Status bar window#
!define SB_CONST_ALPHA 0x00000001
!define SB_GRAD_RECT 0x00000010
!define SB_GRAD_TRI 0x00000020
!define SB_NONE 0x00000000
!define SB_PIXEL_ALPHA 0x00000002
!define SB_PREMULT_ALPHA 0x00000004
!define SB_SIMPLEID 0x00ff
!define SB_SIMPLEID 0x00ff
#Scroll bar control#
!define SBM_ENABLE_ARROWS 0x00E4 # Not in win3.1
@ -657,14 +652,10 @@ ${_NSIS_DEFAW} LVM_SETITEMTEXT
#Static control#
!define STM_GETICON 0x0171
!define STM_GETIMAGE 0x0173
!define STM_MSGMAX 0x0174
!define STM_ONLY_THIS_INTERFACE 0x00000001
!define STM_ONLY_THIS_NAME 0x00000008
!define STM_ONLY_THIS_PROTOCOL 0x00000002
!define STM_ONLY_THIS_TYPE 0x00000004
!define STM_SETICON 0x0170
!define STM_SETIMAGE 0x0172
!define STM_GETIMAGE 0x0173
!define STM_MSGMAX 0x0174
#Tab control#
!define TCS_SCROLLOPPOSITE 0x0001
@ -702,5 +693,50 @@ ${_NSIS_DEFAW} TCM_INSERTITEM
!define PBST_ERROR 2
!define PBST_PAUSED 3
#Animation control#
!define /math ACM_OPENA ${WM_USER} + 100
!define /math ACM_PLAY ${WM_USER} + 101
!define /math ACM_STOP ${WM_USER} + 102
!define /math ACM_OPENW ${WM_USER} + 103
${_NSIS_DEFAW} ACM_OPEN
#TrackBar control#
!define /math TBM_GETPOS ${WM_USER} + 0
!define /math TBM_GETRANGEMIN ${WM_USER} + 1
!define /math TBM_GETRANGEMAX ${WM_USER} + 2
!define /math TBM_GETTIC ${WM_USER} + 3
!define /math TBM_SETTIC ${WM_USER} + 4
!define /math TBM_SETPOS ${WM_USER} + 5
!define /math TBM_SETRANGE ${WM_USER} + 6
!define /math TBM_SETRANGEMIN ${WM_USER} + 7
!define /math TBM_SETRANGEMAX ${WM_USER} + 8
!define /math TBM_CLEARTICS ${WM_USER} + 9
!define /math TBM_SETSEL ${WM_USER} + 10
!define /math TBM_SETSELSTART ${WM_USER} + 11
!define /math TBM_SETSELEND ${WM_USER} + 12
!define /math TBM_GETPTICS ${WM_USER} + 14
!define /math TBM_GETTICPOS ${WM_USER} + 15
!define /math TBM_GETNUMTICS ${WM_USER} + 16
!define /math TBM_GETSELSTART ${WM_USER} + 17
!define /math TBM_GETSELEND ${WM_USER} + 18
!define /math TBM_CLEARSEL ${WM_USER} + 19
!define /math TBM_SETTICFREQ ${WM_USER} + 20 ; TBS_AUTOTICKS required
!define /math TBM_SETPAGESIZE ${WM_USER} + 21
!define /math TBM_GETPAGESIZE ${WM_USER} + 22
!define /math TBM_SETLINESIZE ${WM_USER} + 23
!define /math TBM_GETLINESIZE ${WM_USER} + 24
!define /math TBM_GETTHUMBRECT ${WM_USER} + 25
!define /math TBM_GETCHANNELRECT ${WM_USER} + 26
!define /math TBM_SETTHUMBLENGTH ${WM_USER} + 27
!define /math TBM_GETTHUMBLENGTH ${WM_USER} + 28
!define /math TBM_SETTOOLTIPS ${WM_USER} + 29 ; IE3
!define /math TBM_GETTOOLTIPS ${WM_USER} + 30 ; IE3
!define /math TBM_SETTIPSIDE ${WM_USER} + 31 ; IE3
!define /math TBM_SETBUDDY ${WM_USER} + 32 ; IE3
!define /math TBM_GETBUDDY ${WM_USER} + 33 ; IE3
!define TBM_SETUNICODEFORMAT ${CCM_SETUNICODEFORMAT} ; IE4
!define TBM_GETUNICODEFORMAT ${CCM_GETUNICODEFORMAT} ; IE4
!define /math TBM_SETPOSNOTIFY ${WM_USER} + 34 ; 7?
!verbose pop
!endif