diff --git a/Contrib/nsDialogs/Readme.html b/Contrib/nsDialogs/Readme.html index 3095cc15..bc5da664 100644 --- a/Contrib/nsDialogs/Readme.html +++ b/Contrib/nsDialogs/Readme.html @@ -146,8 +146,6 @@ SectionEnd
Now that the foundations are laid, it's time to use nsDialogs. The first call must always be to nsDialogs::Create. It will create a new dialog in the page and return its HWND on the stack. The result must be popped from the stack to prevent stack corruption. If the result is error, the dialog couldn't be created.
-nsDialogs::Create, like every other nsDialogs function but nsDialogs::Show, must always be called with /NOUNLOAD.
-nsDialogs::Create accepts one parameter. It has a very specific function, but to keep things simple for this tutorial, it must always be 1018.
HWND is a number that uniquely identifies the dialog and can be used with SendMessage, SetCtlColors and Win32 API.
@@ -166,7 +164,7 @@ Page instfiles Function nsDialogsPage - nsDialogs::Create /NOUNLOAD 1018 + nsDialogs::Create 1018 Pop $Dialog ${If} $Dialog == error @@ -198,7 +196,7 @@ Page custom nsDialogsPage Page instfiles Function nsDialogsPage - nsDialogs::Create /NOUNLOAD 1018 + nsDialogs::Create 1018 Pop $Dialog ${If} $Dialog == error @@ -240,7 +238,7 @@ Page instfiles Function nsDialogsPage - nsDialogs::Create /NOUNLOAD 1018 + nsDialogs::Create 1018 Pop $Dialog ${If} $Dialog == error @@ -311,7 +309,7 @@ Page instfiles Function nsDialogsPage - nsDialogs::Create /NOUNLOAD 1018 + nsDialogs::Create 1018 Pop $Dialog ${If} $Dialog == error @@ -366,7 +364,7 @@ Page instfiles Function nsDialogsPage - nsDialogs::Create /NOUNLOAD 1018 + nsDialogs::Create 1018 Pop $Dialog ${If} $Dialog == error @@ -444,7 +442,7 @@ FunctionEnd Function nsDialogsPage - nsDialogs::Create /NOUNLOAD 1018 + nsDialogs::Create 1018 Pop $Dialog ${If} $Dialog == error @@ -488,7 +486,7 @@ SectionEndnsDialogs::Create /NOUNLOAD rect
nsDialogs::Create rect
Creates a new dialog. rect specific the identifier of the control whose location will be mimiced. This should usually be 1018, which is control mimiced for creation of built-in pages. The Modern UI also has control 1040 for the welcome and the finish page.
@@ -496,7 +494,7 @@ SectionEndnsDialogs::CreateControl /NOUNLOAD class style extended_style x y width height text
nsDialogs::CreateControl class style extended_style x y width height text
Create a new control in the current dialog. A dialog must exist for this to work, so nsDialogs::Create must be called prior to this function.
@@ -512,7 +510,7 @@ SectionEndnsDialogs::SelectFileDialog /NOUNLOAD mode initial_selection filter
nsDialogs::SelectFileDialog mode initial_selection filter
Displays a file selection dialog to the user. If mode is set to save, displays a file save dialog. If mode is set to open, displays a file open dialog. filter is a list of available file filters separated by pipes. If an empty string is passed, the default is used - All Files|*.*.
@@ -522,7 +520,7 @@ SectionEndnsDialogs::SelectFolderDialog /NOUNLOAD title initial_selection
nsDialogs::SelectFolderDialog title initial_selection
Displays a directory selection dialog to the user.
@@ -530,7 +528,7 @@ SectionEndnsDialogs::SetRTL /NOUNLOAD rtl_setting
nsDialogs::SetRTL rtl_setting
Sets right-to-left mode on or off. If rtl_setting is 0, it's set to off. If rtl_setting is 1, it's set to on. This function must be called before any calls to nsDialogs::CreateControl.
@@ -538,13 +536,13 @@ SectionEndnsDialogs::GetUserData /NOUNLOAD control_HWND
nsDialogs::GetUserData control_HWND
Returns user data associated with the control on the stack. Use nsDialogs::SetUserData to set this data.
nsDialogs::SetUserData /NOUNLOAD control_HWND data
nsDialogs::SetUserData control_HWND data
Associates data with the control. Use nsDialogs::GetUserData to get this data.
@@ -552,7 +550,7 @@ SectionEndnsDialogs::OnBack /NOUNLOAD function_address
nsDialogs::OnBack function_address
Sets the callback function for the Back button. This function will be called when the user clicks the back button. Call Abort in this function to prevent the user from going back to the last page.
@@ -562,7 +560,7 @@ SectionEndnsDialogs::OnChange /NOUNLOAD control_HWND function_address
nsDialogs::OnChange control_HWND function_address
Sets a change notification callback function for the given control. Whenever the control changes, the function will be called and the control's HWND will be waiting on its stack.
@@ -572,7 +570,7 @@ SectionEndnsDialogs::OnClick /NOUNLOAD control_HWND function_address
nsDialogs::OnClick control_HWND function_address
Sets a click notification callback function for the given control. Whenever the control is clicked, the function will be called and the control's HWND will be waiting on its stack.
@@ -582,7 +580,7 @@ SectionEndnsDialogs::OnNotify /NOUNLOAD control_HWND function_address
nsDialogs::OnNotify control_HWND function_address
Sets a notification callback function for the given control. Whenever the control receives the WM_NOTIFY message, the function will be called and the control's HWND, notification code and a pointer to the MNHDR structure will be waiting on its stack.
@@ -592,7 +590,7 @@ SectionEndnsDialogs::OnTimer /NOUNLOAD function_address timer_interval
nsDialogs::OnTimer function_address timer_interval
Sets a timer that'd call the callback function for the given control every in a constant interval. Interval times are specified in milliseconds.
@@ -602,7 +600,7 @@ SectionEndnsDialogs::KillTimer /NOUNLOAD function_address
nsDialogs::KillTimer function_address
Kills a previously set timer.
@@ -838,7 +836,7 @@ FunctionEnd Function nsDialogsImage - nsDialogs::Create /NOUNLOAD 1018 + nsDialogs::Create 1018 Pop $Dialog ${If} $Dialog == error diff --git a/Contrib/nsDialogs/example.nsi b/Contrib/nsDialogs/example.nsi index 370d9760..729918a4 100644 --- a/Contrib/nsDialogs/example.nsi +++ b/Contrib/nsDialogs/example.nsi @@ -15,26 +15,26 @@ Var CHECKBOX Function nsDialogsPage - nsDialogs::Create /NOUNLOAD 1018 + nsDialogs::Create 1018 Pop $0 GetFunctionAddress $0 OnBack - nsDialogs::OnBack /NOUNLOAD $0 + nsDialogs::OnBack $0 ${NSD_CreateButton} 0 0 100% 12u Test Pop $BUTTON GetFunctionAddress $0 OnClick - nsDialogs::OnClick /NOUNLOAD $BUTTON $0 + nsDialogs::OnClick $BUTTON $0 ${NSD_CreateText} 0 35 100% 12u hello Pop $EDIT GetFunctionAddress $0 OnChange - nsDialogs::OnChange /NOUNLOAD $EDIT $0 + nsDialogs::OnChange $EDIT $0 ${NSD_CreateCheckbox} 0 -50 100% 8u Test Pop $CHECKBOX GetFunctionAddress $0 OnCheckbox - nsDialogs::OnClick /NOUNLOAD $CHECKBOX $0 + nsDialogs::OnClick $CHECKBOX $0 ${NSD_CreateLabel} 0 40u 75% 40u "* Type `hello there` above.$\n* Click the button.$\n* Check the checkbox.$\n* Hit the Back button." Pop $0 diff --git a/Contrib/nsDialogs/nsDialogs.c b/Contrib/nsDialogs/nsDialogs.c index 44fc8ac2..ff1f131a 100644 --- a/Contrib/nsDialogs/nsDialogs.c +++ b/Contrib/nsDialogs/nsDialogs.c @@ -237,6 +237,11 @@ BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) return FALSE; } +static UINT_PTR PluginCallback(enum NSPIM msg) +{ + return 0; +} + void __declspec(dllexport) Create(HWND hwndParent, int string_size, char *variables, stack_t **stacktop, extra_parameters *extra) { HWND hwPlacementRect; @@ -244,6 +249,8 @@ void __declspec(dllexport) Create(HWND hwndParent, int string_size, char *variab EXDLL_INIT(); + extra->RegisterPluginCallback(g_hInstance, PluginCallback); + g_dialog.hwParent = hwndParent; g_pluginParms = extra; diff --git a/Contrib/nsDialogs/nsDialogs.nsh b/Contrib/nsDialogs/nsDialogs.nsh index 25c35f13..efdca975 100644 --- a/Contrib/nsDialogs/nsDialogs.nsh +++ b/Contrib/nsDialogs/nsDialogs.nsh @@ -258,7 +258,7 @@ Header file for creating custom installer pages with nsDialogs !macro __NSD_DefineControl NAME - !define NSD_Create${NAME} "nsDialogs::CreateControl /NOUNLOAD ${__NSD_${Name}_CLASS} ${__NSD_${Name}_STYLE} ${__NSD_${Name}_EXSTYLE}" + !define NSD_Create${NAME} "nsDialogs::CreateControl ${__NSD_${Name}_CLASS} ${__NSD_${Name}_STYLE} ${__NSD_${Name}_EXSTYLE}" !macroend @@ -291,7 +291,7 @@ Header file for creating custom installer pages with nsDialogs StrCpy $1 "${HWND}" GetFunctionAddress $0 "${FUNCTION}" - nsDialogs::On${EVENT} /NOUNLOAD $1 $0 + nsDialogs::On${EVENT} $1 $0 Pop $1 Pop $0 @@ -309,7 +309,7 @@ Header file for creating custom installer pages with nsDialogs Push $0 GetFunctionAddress $0 "${FUNCTION}" - nsDialogs::On${EVENT} /NOUNLOAD $0 + nsDialogs::On${EVENT} $0 Pop $0 @@ -331,7 +331,7 @@ Header file for creating custom installer pages with nsDialogs Push $0 GetFunctionAddress $0 "${FUNCTION}" - nsDialogs::CreateTimer /NOUNLOAD $0 "${INTERVAL}" + nsDialogs::CreateTimer $0 "${INTERVAL}" Pop $0 @@ -344,7 +344,7 @@ Header file for creating custom installer pages with nsDialogs Push $0 GetFunctionAddress $0 "${FUNCTION}" - nsDialogs::KillTimer /NOUNLOAD $0 + nsDialogs::KillTimer $0 Pop $0 @@ -634,11 +634,11 @@ Header file for creating custom installer pages with nsDialogs StrCpy $R0 1018 ${EndIf} - nsDialogs::Create /NOUNLOAD $R0 + nsDialogs::Create $R0 Pop $R9 ReadINIStr $R0 $0 Settings RTL - nsDialogs::SetRTL /NOUNLOAD $R0 + nsDialogs::SetRTL $R0 ReadINIStr $R0 $0 Settings NumFields @@ -726,7 +726,7 @@ Header file for creating custom installer pages with nsDialogs ${NSD_CreateBrowseButton} $R8u $R4u 15u $R6u ... Pop $R8 - nsDialogs::SetUserData /NOUNLOAD $R8 $R1 # remember field id + nsDialogs::SetUserData $R8 $R1 # remember field id WriteINIStr $0 "Field $R1" HWND2 $R8 @@ -747,7 +747,7 @@ Header file for creating custom installer pages with nsDialogs ${NSD_CreateBrowseButton} $R8u $R4u 15u $R6u ... Pop $R8 - nsDialogs::SetUserData /NOUNLOAD $R8 $R1 # remember field id + nsDialogs::SetUserData $R8 $R1 # remember field id WriteINIStr $0 "Field $R1" HWND2 $R8 @@ -764,7 +764,7 @@ Header file for creating custom installer pages with nsDialogs Pop $R0 - nsDialogs::GetUserData /NOUNLOAD $R0 + nsDialogs::GetUserData $R0 Pop $R1 ReadINIStr $R2 $0 "Field $R1" HWND @@ -772,7 +772,7 @@ Header file for creating custom installer pages with nsDialogs ${NSD_GetText} $R2 $R3 - nsDialogs::SelectFileDialog /NOUNLOAD save $R3 $R4 + nsDialogs::SelectFileDialog save $R3 $R4 Pop $R3 ${If} $R3 != "" @@ -785,7 +785,7 @@ Header file for creating custom installer pages with nsDialogs Pop $R0 - nsDialogs::GetUserData /NOUNLOAD $R0 + nsDialogs::GetUserData $R0 Pop $R1 ReadINIStr $R2 $0 "Field $R1" HWND @@ -793,7 +793,7 @@ Header file for creating custom installer pages with nsDialogs ${NSD_GetText} $R2 $R4 - nsDialogs::SelectFolderDialog /NOUNLOAD $R3 $R4 + nsDialogs::SelectFolderDialog $R3 $R4 Pop $R3 ${If} $R3 != error @@ -807,7 +807,7 @@ Header file for creating custom installer pages with nsDialogs ${NSD_CreateLink} $R3u $R4u $R5u $R6u $R7 Pop $R9 - nsDialogs::SetUserData /NOUNLOAD $R9 $R1 # remember field id + nsDialogs::SetUserData $R9 $R1 # remember field id ${NSD_OnClick} $R9 ${UNINSTALLER_FUNCPREFIX}OnLink @@ -817,7 +817,7 @@ Header file for creating custom installer pages with nsDialogs Pop $R0 - nsDialogs::GetUserData /NOUNLOAD $R0 + nsDialogs::GetUserData $R0 Pop $R1 ReadINIStr $R1 $0 "Field $R1" STATE diff --git a/Contrib/nsDialogs/timer.nsi b/Contrib/nsDialogs/timer.nsi index 8e386c91..cb6449f8 100644 --- a/Contrib/nsDialogs/timer.nsi +++ b/Contrib/nsDialogs/timer.nsi @@ -67,7 +67,7 @@ FunctionEnd Function nsDialogsPage - nsDialogs::Create /NOUNLOAD 1018 + nsDialogs::Create 1018 Pop $DIALOG ${NSD_CreateLabel} 0u 0u 100% 9u "nsDialogs timer example" diff --git a/Contrib/nsDialogs/welcome.nsi b/Contrib/nsDialogs/welcome.nsi index 206afc1c..7f0c255a 100644 --- a/Contrib/nsDialogs/welcome.nsi +++ b/Contrib/nsDialogs/welcome.nsi @@ -195,10 +195,10 @@ FunctionEnd Function nsDialogsWelcome - nsDialogs::Create /NOUNLOAD 1044 + nsDialogs::Create 1044 Pop $DIALOG - nsDialogs::CreateControl /NOUNLOAD STATIC ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS}|${SS_BITMAP} 0 0 0 109u 193u "" + nsDialogs::CreateControl STATIC ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS}|${SS_BITMAP} 0 0 0 109u 193u "" Pop $IMAGECTL StrCpy $0 $PLUGINSDIR\welcome.bmp @@ -207,12 +207,12 @@ Function nsDialogsWelcome SendMessage $IMAGECTL ${STM_SETIMAGE} ${IMAGE_BITMAP} $IMAGE - nsDialogs::CreateControl /NOUNLOAD STATIC ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS} 0 120u 10u -130u 20u "Welcome to nsDialogs!" + nsDialogs::CreateControl STATIC ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS} 0 120u 10u -130u 20u "Welcome to nsDialogs!" Pop $HEADLINE SendMessage $HEADLINE ${WM_SETFONT} $HEADLINE_FONT 0 - nsDialogs::CreateControl /NOUNLOAD STATIC ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS} 0 120u 32u -130u -32u "nsDialogs is the next generation of user interfaces in NSIS. It gives the developer full control over custom pages. Some of the features include control text containing variables, callbacks directly into script functions and creation of any type of control. Create boring old edit boxes or load some external library and create custom controls with no need of creating your own plug-in.$\r$\n$\r$\nUnlike InstallOptions, nsDialogs doesn't use INI files to communicate with the script. By interacting directly with the script, nsDialogs can perform much faster without the need of costly, old and inefficient INI operations. Direct interaction also allows direct calls to functions defined in the script and removes the need of conversion functions like Io2Nsis.$\r$\n$\r$\nHit the Next button to see how it all fits into a mock directory page." + nsDialogs::CreateControl STATIC ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS} 0 120u 32u -130u -32u "nsDialogs is the next generation of user interfaces in NSIS. It gives the developer full control over custom pages. Some of the features include control text containing variables, callbacks directly into script functions and creation of any type of control. Create boring old edit boxes or load some external library and create custom controls with no need of creating your own plug-in.$\r$\n$\r$\nUnlike InstallOptions, nsDialogs doesn't use INI files to communicate with the script. By interacting directly with the script, nsDialogs can perform much faster without the need of costly, old and inefficient INI operations. Direct interaction also allows direct calls to functions defined in the script and removes the need of conversion functions like Io2Nsis.$\r$\n$\r$\nHit the Next button to see how it all fits into a mock directory page." Pop $TEXT SetCtlColors $DIALOG "" 0xffffff @@ -238,28 +238,28 @@ Function nsDialogsDirectory GetDlgItem $0 $HWNDPARENT 1 EnableWindow $0 0 - nsDialogs::Create /NOUNLOAD 1018 + nsDialogs::Create 1018 Pop $DIALOG - nsDialogs::CreateControl /NOUNLOAD STATIC ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS}|${SS_CENTER} 0 0 0 100% 30 "Directory page" + nsDialogs::CreateControl STATIC ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS}|${SS_CENTER} 0 0 0 100% 30 "Directory page" Pop $HEADLINE SendMessage $HEADLINE ${WM_SETFONT} $HEADLINE_FONT 0 - nsDialogs::CreateControl /NOUNLOAD STATIC ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS} 0 0 30 100% 40 "Select the installation directory of NSIS to continue. $_CLICK" + nsDialogs::CreateControl STATIC ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS} 0 0 30 100% 40 "Select the installation directory of NSIS to continue. $_CLICK" Pop $TEXT - nsDialogs::CreateControl /NOUNLOAD EDIT ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS}|${ES_AUTOHSCROLL}|${WS_TABSTOP} ${WS_EX_CLIENTEDGE} 0 75 100% 12u "" + nsDialogs::CreateControl EDIT ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS}|${ES_AUTOHSCROLL}|${WS_TABSTOP} ${WS_EX_CLIENTEDGE} 0 75 100% 12u "" Pop $DIRECTORY SendMessage $HWNDPARENT ${WM_NEXTDLGCTL} $DIRECTORY 1 GetFunctionAddress $0 DirChange - nsDialogs::OnChange /NOUNLOAD $DIRECTORY $0 + nsDialogs::OnChange $DIRECTORY $0 System::Call shlwapi::SHAutoComplete(i$DIRECTORY,i${SHACF_FILESYSTEM}) - nsDialogs::CreateControl /NOUNLOAD STATIC ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS} 0 0 -10u 100% 10u "" + nsDialogs::CreateControl STATIC ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS} 0 0 -10u 100% 10u "" Pop $FREESPACE Call UpdateFreeSpace