diff --git a/Docs/src/attributes.but b/Docs/src/attributes.but index 2205ecc2..66ac1f97 100644 --- a/Docs/src/attributes.but +++ b/Docs/src/attributes.but @@ -60,7 +60,7 @@ When used outside a \R{pageex}{PageEx} block: Sets the text for the titlebar of When used inside a \R{pageex}{PageEx} block: Sets the subcaption of the current page. -Accepts variables. If variables are used, they must be initialized on \R{oninit}{.onInit}. +Accepts variables. If variables are used, they must be initialized on \R{oninit}{.onInit} or \R{onguiinit}{.onGUIInit}. \S2{achangeui} ChangeUI diff --git a/Docs/src/history.but b/Docs/src/history.but index 42397a7b..00a49cff 100644 --- a/Docs/src/history.but +++ b/Docs/src/history.but @@ -18,6 +18,8 @@ Released on ? ?th, 2017 \S2{} Minor Changes +\b Variables used in Caption can now be set in .onGuiInit (\W{http://sf.net/p/nsis/feature-requests/539}{RFE #539}) + \b MultiUser now supports $ProgramFiles64 (\W{http://sf.net/p/nsis/bugs/843}{bug #843}) \b Added support for MUI_UNCONFIRMPAGE_VARIABLE (\W{http://sf.net/p/nsis/feature-requests/511}{RFE #511}) and MUI_PAGE_CUSTOMFUNCTION_DESTROYED diff --git a/Source/exehead/Main.c b/Source/exehead/Main.c index d5eb0686..dc2e0fe9 100644 --- a/Source/exehead/Main.c +++ b/Source/exehead/Main.c @@ -58,7 +58,7 @@ extern HANDLE dbd_hFile; #endif -TCHAR g_caption[NSIS_MAX_STRLEN*2]; +TCHAR g_caption[NSIS_MAX_STRLEN*2]; // Why does this have to be NSIS_MAX_STRLEN*2? #ifdef NSIS_CONFIG_VISIBLE_SUPPORT HWND g_hwnd; HANDLE g_hInstance; diff --git a/Source/exehead/Ui.c b/Source/exehead/Ui.c index 6f7bf222..cb36e19e 100644 --- a/Source/exehead/Ui.c +++ b/Source/exehead/Ui.c @@ -170,6 +170,16 @@ void NSISCALL build_g_logfile() int *cur_langtable; +static TCHAR* update_caption() +{ + TCHAR *gcap = g_caption; + GetNSISString(gcap, LANG_CAPTION); +#ifdef NSIS_SUPPORT_BGBG + my_SetWindowText(m_bgwnd, gcap); +#endif + return gcap; +} + static void NSISCALL set_language() { LANGID lang_mask=(LANGID)~0; @@ -200,14 +210,9 @@ lang_again: } cur_langtable = selected_langtable; - myitoa(state_language, *(LANGID*)language_table); - { - TCHAR *caption = GetNSISString(g_caption,LANG_CAPTION); -#ifdef NSIS_SUPPORT_BGBG - my_SetWindowText(m_bgwnd, caption); -#endif - } + + update_caption(); // reload section names { @@ -581,7 +586,7 @@ nextPage: SetActiveCtl(m_hwndOK); } - mystrcpy(g_tmp,g_caption); + mystrcpy(g_tmp,update_caption()); GetNSISString(g_tmp+mystrlen(g_tmp),this_page->caption); my_SetWindowText(hwndDlg,g_tmp); diff --git a/Source/exehead/api.h b/Source/exehead/api.h index 61591d4e..956f763a 100644 --- a/Source/exehead/api.h +++ b/Source/exehead/api.h @@ -36,8 +36,8 @@ enum NSPIM // Should always be __cdecl for future expansion possibilities typedef UINT_PTR (*NSISPLUGINCALLBACK)(enum NSPIM); -// extra_parameters data structures containing other interesting stuff -// but the stack, variables and HWND passed on to plug-ins. +// extra_parameters data structure containing other interesting stuff +// besides the stack, variables and HWND passed on to plug-ins. typedef struct { int autoclose; @@ -83,4 +83,4 @@ typedef struct { // sent as wParam with WM_NOTIFY_OUTER_NEXT when user cancels - heed its warning #define NOTIFY_BYE_BYE 'x' -#endif /* _PLUGIN_H_ */ +#endif /* _NSIS_EXEHEAD_API_H_ */ diff --git a/Source/exehead/util.c b/Source/exehead/util.c index 39e55780..b28c830e 100644 --- a/Source/exehead/util.c +++ b/Source/exehead/util.c @@ -144,7 +144,7 @@ int NSISCALL my_MessageBox(const TCHAR *text, UINT type) { mbp.hwndOwner = g_hwnd; mbp.hInstance = g_hInstance; mbp.lpszText = text; - mbp.lpszCaption = g_caption; + mbp.lpszCaption = g_caption; // Should call update_caption() here? mbp.dwStyle = _type; return MessageBoxIndirect(&mbp);