From 0bc11984135d42f947c6d5c04512c1db6c5d8f99 Mon Sep 17 00:00:00 2001 From: anders_k Date: Sat, 16 Sep 2017 14:01:44 +0000 Subject: [PATCH] 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 --- Contrib/nsDialogs/Readme.html | 64 ++++++++++++++++- Contrib/nsDialogs/nsDialogs.nsh | 117 ++++++++++++++++++++++++++++++++ Docs/src/history.but | 2 +- Include/WinMessages.nsh | 64 +++++++++++++---- 4 files changed, 229 insertions(+), 18 deletions(-) diff --git a/Contrib/nsDialogs/Readme.html b/Contrib/nsDialogs/Readme.html index 2af83d28..09ca84ff 100644 --- a/Contrib/nsDialogs/Readme.html +++ b/Contrib/nsDialogs/Readme.html @@ -94,6 +94,18 @@ code NSD_LB_SelectString, NSD_LB_GetSelection +
  • Animation: +NSD_Anim_OpenFile, +NSD_Anim_Play, +NSD_Anim_Stop +
  • +
  • HTrackBar & VTrackBar: +NSD_TrackBar_GetPos, +NSD_TrackBar_SetPos, +NSD_TrackBar_SetRangeMin, +NSD_TrackBar_SetRangeMax, +NSD_TrackBar_SetTicFreq +
  • NSD_SetImage
  • NSD_SetStretchedImage
  • NSD_SetIcon
  • @@ -298,6 +310,9 @@ SectionEnd
  • ListBox
  • SortedListBox
  • ProgressBar
  • +
  • Animation
  • +
  • HTrackBar
  • +
  • VTrackBar
  • Control State

    @@ -656,6 +671,9 @@ SectionEnd
  • ${NSD_CreateListBox}
  • ${NSD_CreateSortedListBox}
  • ${NSD_CreateProgressBar}
  • +
  • ${NSD_CreateAnimation}
  • +
  • ${NSD_CreateHTrackBar}
  • +
  • ${NSD_CreateVTrackBar}
  • Returns the new control's HWND on the stack or error

    @@ -688,6 +706,12 @@ SectionEnd

    See OnNotify for more details.

    +

    NSD_SetFocus

    + +

    ${NSD_SetFocus} control_HWND

    + +

    Sets focus to a control.

    +

    NSD_CreateTimer

    ${NSD_CreateTimer} function_name timer_interval

    @@ -830,11 +854,45 @@ SectionEnd

    Retrieves the selected stringed from a list box. Returns an empty string if no string is selected.

    -

    NSD_SetFocus

    +

    NSD_Anim_OpenFile

    -

    ${NSD_SetFocus} control_HWND

    +

    ${NSD_Anim_OpenFile} anim_HWND avi_path

    -

    Sets focus to a control.

    +

    Opens the specified (silent) .AVI movie clip.

    + +

    NSD_Anim_Play

    + +

    ${NSD_Anim_Play} anim_HWND

    + +

    Plays the movie clip repeatedly.

    + +

    NSD_Anim_Stop

    + +

    ${NSD_Anim_Stop} anim_HWND

    + +

    Stops playback.

    + +

    NSD_TrackBar_GetPos

    + +

    ${NSD_TrackBar_GetPos} track_HWND output

    + +

    NSD_TrackBar_SetPos

    + +

    ${NSD_TrackBar_SetPos} track_HWND pos

    + +

    NSD_TrackBar_SetRangeMin

    + +

    ${NSD_TrackBar_SetRangeMin} track_HWND minpos

    + +

    NSD_TrackBar_SetRangeMax

    + +

    ${NSD_TrackBar_SetRangeMax} track_HWND maxpos

    + +

    NSD_TrackBar_SetTicFreq

    + +

    ${NSD_TrackBar_SetTicFreq} track_HWND

    + +

    Sets the interval frequency for tick marks.

    NSD_SetImage

    diff --git a/Contrib/nsDialogs/nsDialogs.nsh b/Contrib/nsDialogs/nsDialogs.nsh index 55a96bd7..c8f275aa 100644 --- a/Contrib/nsDialogs/nsDialogs.nsh +++ b/Contrib/nsDialogs/nsDialogs.nsh @@ -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 diff --git a/Docs/src/history.but b/Docs/src/history.but index b592587b..161bb0dd 100644 --- a/Docs/src/history.but +++ b/Docs/src/history.but @@ -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 diff --git a/Include/WinMessages.nsh b/Include/WinMessages.nsh index cd9c1745..c9954670 100644 --- a/Include/WinMessages.nsh +++ b/Include/WinMessages.nsh @@ -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 \ No newline at end of file