Leave function for custom pages too
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@2335 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
156648c9d5
commit
070d1f136a
10 changed files with 81 additions and 56 deletions
|
@ -1086,9 +1086,9 @@ int CEXEBuild::resolve_coderefs(const char *str)
|
|||
page *p=(page *)ubuild_pages.get();
|
||||
int i = 0;
|
||||
while (i < build_uninst.common.num_pages) {
|
||||
if (resolve_call_int("uninstall pages","pre-page function",p->prefunc,&p->prefunc)) return 1;
|
||||
if (resolve_call_int("uninstall pages","show-page function",p->showfunc,&p->showfunc)) return 1;
|
||||
if (resolve_call_int("uninstall pages","leave-page function",p->leavefunc,&p->leavefunc)) return 1;
|
||||
if (resolve_call_int("uninstall pages","pre-page",p->prefunc,&p->prefunc)) return 1;
|
||||
if (resolve_call_int("uninstall pages","show-page",p->showfunc,&p->showfunc)) return 1;
|
||||
if (resolve_call_int("uninstall pages","leave-page",p->leavefunc,&p->leavefunc)) return 1;
|
||||
p++;
|
||||
i++;
|
||||
}
|
||||
|
|
|
@ -513,13 +513,13 @@ BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
this_page=g_inst_page+m_page;
|
||||
|
||||
if (m_page>=0) {
|
||||
// Call leave function. If Abort used don't move to the next page.
|
||||
if (m_delta==1) if (ExecuteCodeSegment(this_page->leavefunc,NULL)) return 1;
|
||||
|
||||
// if the last page was a custom page, wait for it to finish by itself.
|
||||
// if it doesn't, it's a BAD plugin.
|
||||
// plugins should react to WM_NOTIFY_OUTER_NEXT.
|
||||
if (this_page->id<0) return 0;
|
||||
|
||||
// Call leave function. If Abort used don't move to the next page.
|
||||
if (m_delta==1) if (ExecuteCodeSegment(this_page->leavefunc,NULL)) return 0;
|
||||
}
|
||||
|
||||
nextPage:
|
||||
|
|
|
@ -618,13 +618,14 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
|
|||
// a custom page
|
||||
switch (line.getnumtokens() - enable_last_page_cancel) {
|
||||
case 7:
|
||||
PRINTHELP();
|
||||
case 6:
|
||||
ERROR_MSG("Error: custom page can not have more than the creator function.\n");
|
||||
return PS_ERROR;
|
||||
lstrcpy(build_last_page_define, line.gettoken_str(5));
|
||||
case 5:
|
||||
lstrcpy(build_last_page_define, line.gettoken_str(4));
|
||||
p.caption = add_string_main(line.gettoken_str(4));
|
||||
case 4:
|
||||
p.caption = add_string_main(line.gettoken_str(3));
|
||||
if (*line.gettoken_str(3))
|
||||
p.leavefunc = ns_func.add(line.gettoken_str(3),0);
|
||||
case 3:
|
||||
if (*line.gettoken_str(2))
|
||||
p.prefunc = ns_func.add(line.gettoken_str(2),0);
|
||||
|
@ -678,8 +679,8 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
|
|||
SCRIPT_MSG(" (%s:%s)", k?"pre":"creator", line.gettoken_str(2));
|
||||
if (p.showfunc>=0 && k)
|
||||
SCRIPT_MSG(" (show:%s)", line.gettoken_str(3));
|
||||
if (p.leavefunc>=0 && k)
|
||||
SCRIPT_MSG(" (leave:%s)", line.gettoken_str(4));
|
||||
if (p.leavefunc>=0)
|
||||
SCRIPT_MSG(" (leave:%s)", line.gettoken_str(4-!k));
|
||||
else if (p.caption && !k)
|
||||
SCRIPT_MSG(" (caption:%s)", line.gettoken_str(3));
|
||||
#endif
|
||||
|
@ -776,13 +777,19 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
|
|||
// a custom page
|
||||
switch (line.getnumtokens() - uenable_last_page_cancel) {
|
||||
case 7:
|
||||
PRINTHELP();
|
||||
case 6:
|
||||
ERROR_MSG("Error: custom page can not have more than the creator function.\n");
|
||||
return PS_ERROR;
|
||||
lstrcpy(ubuild_last_page_define, line.gettoken_str(5));
|
||||
case 5:
|
||||
lstrcpy(ubuild_last_page_define, line.gettoken_str(4));
|
||||
p.caption = add_string_uninst(line.gettoken_str(4));
|
||||
case 4:
|
||||
p.caption = add_string_uninst(line.gettoken_str(3));
|
||||
if (*line.gettoken_str(3)) {
|
||||
if (strnicmp(line.gettoken_str(3),"un.",3)) {
|
||||
ERROR_MSG("\nError: uninstall function must have a un. prefix!\n");
|
||||
return PS_ERROR;
|
||||
}
|
||||
p.leavefunc = ns_func.add(line.gettoken_str(3),0);
|
||||
}
|
||||
case 3:
|
||||
if (*line.gettoken_str(2)) {
|
||||
if (strnicmp(line.gettoken_str(2),"un.",3)) {
|
||||
|
@ -822,8 +829,8 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
|
|||
SCRIPT_MSG(" (%s:%s)", k?"pre":"creator", line.gettoken_str(2));
|
||||
if (p.showfunc>=0 && k)
|
||||
SCRIPT_MSG(" (show:%s)", line.gettoken_str(3));
|
||||
if (p.leavefunc>=0 && k)
|
||||
SCRIPT_MSG(" (leave:%s)", line.gettoken_str(4));
|
||||
if (p.leavefunc>=0)
|
||||
SCRIPT_MSG(" (leave:%s)", line.gettoken_str(4-!k));
|
||||
else if (p.caption && !k)
|
||||
SCRIPT_MSG(" (caption:%s)", line.gettoken_str(3));
|
||||
#endif
|
||||
|
|
|
@ -108,7 +108,7 @@ static tokenType tokenlist[TOK__LAST] =
|
|||
{TOK_NAME,"Name",1,1,"[/LANG=lang_id] installer_name"},
|
||||
{TOK_OUTFILE,"OutFile",1,0,"install_output.exe"},
|
||||
#ifdef NSIS_SUPPORT_CODECALLBACKS
|
||||
{TOK_PAGE,"Page",1,5,"((custom [function] [caption]) | ((license|components|directory|instfiles) [pre_function] [show_function] [leave_function])) [define_if_last]"},
|
||||
{TOK_PAGE,"Page",1,5,"((custom [creator_function] [leave_function] [caption]) | ((license|components|directory|instfiles) [pre_function] [show_function] [leave_function])) [define_if_last]"},
|
||||
#else
|
||||
{TOK_PAGE,"Page",1,1,"license|components|directory|instfiles"},
|
||||
#endif
|
||||
|
@ -168,7 +168,7 @@ static tokenType tokenlist[TOK__LAST] =
|
|||
{TOK_UNINSTCAPTION,"UninstallCaption",1,1,"[/LANG=lang_id] uninstaller_caption"},
|
||||
{TOK_UNINSTICON,"UninstallIcon",1,0,"icon_on_local_system.ico"},
|
||||
#ifdef NSIS_SUPPORT_CODECALLBACKS
|
||||
{TOK_UNINSTPAGE,"UninstPage",1,5,"((custom [function] [caption]) | ((uninstConfirm|instfiles) [pre_function] [show_function] [leave_function])) [define_if_last]"},
|
||||
{TOK_UNINSTPAGE,"UninstPage",1,5,"((custom [creator_function] [leave_function] [caption]) | ((uninstConfirm|instfiles) [pre_function] [show_function] [leave_function])) [define_if_last]"},
|
||||
#else
|
||||
{TOK_UNINSTPAGE,"UninstPage",1,1,"uninstConfirm|instfiles"},
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue