From 85ee7cbd0a26619b0741cd0817bfb2022a091fcb Mon Sep 17 00:00:00 2001 From: kichik Date: Mon, 11 Nov 2002 19:19:02 +0000 Subject: [PATCH] Some bytes off, zlib is still 34.5 =/ git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@1680 212acab6-be3b-0410-9dea-997c60f758d6 --- Source/build.cpp | 17 ++++++++++++----- Source/exehead/Ui.c | 19 ++----------------- Source/exehead/fileform.h | 9 ++------- Source/lang.cpp | 24 ++++++++++++------------ Source/lang.h | 12 ++++++------ Source/script.cpp | 35 +++++++++++++++++++++++------------ 6 files changed, 57 insertions(+), 59 deletions(-) diff --git a/Source/build.cpp b/Source/build.cpp index fe01bf4c..30cd171d 100644 --- a/Source/build.cpp +++ b/Source/build.cpp @@ -1061,8 +1061,7 @@ int CEXEBuild::resolve_coderefs(const char *str) 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 (p->id != NSIS_PAGE_CUSTOM) - if (resolve_call_int("uninstall pages","post-page function",p->postfunc,&p->postfunc)) return 1; + if (resolve_call_int("uninstall pages","post-page function",p->postfunc,&p->postfunc)) return 1; p++; i++; } @@ -1093,8 +1092,7 @@ int CEXEBuild::resolve_coderefs(const char *str) int i = 0; while (i < build_header.common.num_pages) { if (resolve_call_int("pages","pre-page function",p->prefunc,&p->prefunc)) return 1; - if (p->id != NSIS_PAGE_CUSTOM) - if (resolve_call_int("pages","post-page function",p->postfunc,&p->postfunc)) return 1; + if (resolve_call_int("pages","post-page function",p->postfunc,&p->postfunc)) return 1; p++; i++; } @@ -1265,8 +1263,9 @@ int CEXEBuild::write_output(void) 0, #ifdef NSIS_SUPPORT_CODECALLBACKS -1, - -1 + -1, #endif + 0 }; int add_pages=!build_pages.getlen(); int add_uninst_pages=!ubuild_pages.getlen(); @@ -1336,6 +1335,7 @@ int CEXEBuild::write_output(void) #ifdef NSIS_CONFIG_LICENSEPAGE if (license) { pg.id=NSIS_PAGE_LICENSE; + pg.caption=LANG_SUBCAPTION(0); build_pages.add(&pg,sizeof(page)); build_header.common.num_pages++; } @@ -1343,20 +1343,24 @@ int CEXEBuild::write_output(void) #ifdef NSIS_CONFIG_COMPONENTPAGE if (selcom) { pg.id=NSIS_PAGE_SELCOM; + pg.caption=LANG_SUBCAPTION(1); build_pages.add(&pg,sizeof(page)); build_header.common.num_pages++; } #endif if (dir) { pg.id=NSIS_PAGE_DIR; + pg.caption=LANG_SUBCAPTION(2); build_pages.add(&pg,sizeof(page)); build_header.common.num_pages++; } instlog++; pg.id=NSIS_PAGE_INSTFILES; + pg.caption=LANG_SUBCAPTION(3); build_pages.add(&pg,sizeof(page)); build_header.common.num_pages++; pg.id=NSIS_PAGE_COMPLETED; + pg.caption=LANG_SUBCAPTION(4); build_pages.add(&pg,sizeof(page)); build_header.common.num_pages++; } @@ -1422,14 +1426,17 @@ int CEXEBuild::write_output(void) else { if (uninst) { pg.id=NSIS_PAGE_UNINST; + pg.caption=LANG_SUBCAPTION(0); ubuild_pages.add(&pg,sizeof(page)); build_uninst.common.num_pages++; } instlog++; pg.id=NSIS_PAGE_INSTFILES; + pg.caption=LANG_SUBCAPTION(1); ubuild_pages.add(&pg,sizeof(page)); build_uninst.common.num_pages++; pg.id=NSIS_PAGE_COMPLETED; + pg.caption=LANG_SUBCAPTION(2); ubuild_pages.add(&pg,sizeof(page)); build_uninst.common.num_pages++; } diff --git a/Source/exehead/Ui.c b/Source/exehead/Ui.c index 35253184..13184504 100644 --- a/Source/exehead/Ui.c +++ b/Source/exehead/Ui.c @@ -521,16 +521,8 @@ nextPage: else if (g_autoclose) goto nextPage; mystrcpy(g_tmp,g_caption); - - if (this_page->id==NSIS_PAGE_CUSTOM) // custom page - { - process_string_fromtab( - g_tmp+mystrlen(g_tmp), - this_page->caption - ); - - SetWindowText(hwndDlg,g_tmp); - } + process_string_fromtab(g_tmp+mystrlen(g_tmp),this_page->caption); + SetWindowText(hwndDlg,g_tmp); #ifdef NSIS_SUPPORT_CODECALLBACKS if (ExecuteCodeSegment(this_page->prefunc,NULL) || this_page->id<0) @@ -538,13 +530,6 @@ nextPage: #endif //NSIS_SUPPORT_CODECALLBACKS if (this_page->id>=0) // NSIS page { - process_string_fromtab( - g_tmp+mystrlen(g_tmp), - LANG_SUBCAPTION(this_page->id-(g_is_uninstaller?NSIS_PAGE_INSTFILES:0)) - ); - - SetWindowText(hwndDlg,g_tmp); - gDontFookWithFocus = 0; m_curwnd=CreateDialog(g_hInstance,windows[this_page->id].id,hwndDlg,windows[this_page->id].proc); if (m_curwnd) diff --git a/Source/exehead/fileform.h b/Source/exehead/fileform.h index 7b8a34e5..982bade4 100644 --- a/Source/exehead/fileform.h +++ b/Source/exehead/fileform.h @@ -460,14 +460,9 @@ typedef struct int id; // index in the pages array #ifdef NSIS_SUPPORT_CODECALLBACKS int prefunc; // function to use Abort in, or show the custom page if id == NSIS_PAGE_CUSTOM - union - { - int postfunc; // function to do stuff after the page is shown -#endif //NSIS_SUPPORT_CODECALLBACKS - int caption; // caption for custom pages -#ifdef NSIS_SUPPORT_CODECALLBACKS - }; + int postfunc; // function to do stuff after the page is shown #endif //NSIS_SUPPORT_CODECALLBACKS + int caption; // caption tab int next; int back; } page; diff --git a/Source/lang.cpp b/Source/lang.cpp index ea99e6ca..d7561f20 100644 --- a/Source/lang.cpp +++ b/Source/lang.cpp @@ -159,32 +159,32 @@ int CEXEBuild::SetString(char *string, int id, int process, StringTable *table) #ifdef NSIS_CONFIG_UNINSTALL_SUPPORT HANDLE_STRING_U(NLF_UCAPTION, ucommon.caption); - HANDLE_STRING_U(NLF_USUBCAPTION_INSTFILES, ucommon.subcaptions[0]); - HANDLE_STRING_U(NLF_USUBCAPTION_COMPLETED, ucommon.subcaptions[1]); - HANDLE_STRING_U(NLF_USUBCAPTION_CONFIRM, ucommon.subcaptions[2]); + HANDLE_STRING_U(NLF_USUBCAPTION_CONFIRM, ucommon.subcaptions[0]); + HANDLE_STRING_U(NLF_USUBCAPTION_INSTFILES, ucommon.subcaptions[1]); + HANDLE_STRING_U(NLF_USUBCAPTION_COMPLETED, ucommon.subcaptions[2]); HANDLE_STRING_U(NLF_BTN_UNINSTALL, uninstall.uninstbutton); HANDLE_STRING_U(NLF_UNINST_SUBTEXT, uninstall.uninstalltext2); #endif #endif - HANDLE_STRING_C(LANG_NAME, common.name); + HANDLE_STRING_C(SLANG_NAME, common.name); #ifdef NSIS_CONFIG_COMPONENTPAGE - HANDLE_STRING_I(LANG_COMP_TEXT, installer.componenttext); + HANDLE_STRING_I(SLANG_COMP_TEXT, installer.componenttext); #endif #ifdef NSIS_CONFIG_LICENSEPAGE - HANDLE_STRING_I(LANG_LICENSE_TEXT, installer.licensetext); - HANDLE_STRING_I(LANG_LICENSE_DATA, installer.licensedata); + HANDLE_STRING_I(SLANG_LICENSE_TEXT, installer.licensetext); + HANDLE_STRING_I(SLANG_LICENSE_DATA, installer.licensedata); #endif #ifdef NSIS_CONFIG_VISIBLE_SUPPORT - HANDLE_STRING_I(LANG_DIR_TEXT, installer.text); + HANDLE_STRING_I(SLANG_DIR_TEXT, installer.text); #endif #ifdef NSIS_CONFIG_UNINSTALL_SUPPORT - HANDLE_STRING_U(LANG_UNINST_TEXT, uninstall.uninstalltext); + HANDLE_STRING_U(SLANG_UNINST_TEXT, uninstall.uninstalltext); #endif default: @@ -450,11 +450,11 @@ void CEXEBuild::FillDefaultsIfNeeded(StringTable *table, NLF *nlf/*=0*/) { } #ifdef NSIS_CONFIG_VISIBLE_SUPPORT if (!table->ucommon.subcaptions[0]) - table->ucommon.subcaptions[0]=add_string_uninst(str(NLF_USUBCAPTION_INSTFILES)); + table->ucommon.subcaptions[0]=add_string_uninst(str(NLF_USUBCAPTION_CONFIRM)); if (!table->ucommon.subcaptions[1]) - table->ucommon.subcaptions[1]=add_string_uninst(str(NLF_USUBCAPTION_COMPLETED)); + table->ucommon.subcaptions[1]=add_string_uninst(str(NLF_USUBCAPTION_INSTFILES)); if (!table->ucommon.subcaptions[2]) - table->ucommon.subcaptions[2]=add_string_uninst(str(NLF_USUBCAPTION_CONFIRM)); + table->ucommon.subcaptions[2]=add_string_uninst(str(NLF_USUBCAPTION_COMPLETED)); table->ucommon.branding=add_string_uninst(build_strlist.get() + table->common.branding,0); table->ucommon.backbutton=add_string_uninst(build_strlist.get() + table->common.backbutton,0); table->ucommon.nextbutton=add_string_uninst(build_strlist.get() + table->common.nextbutton,0); diff --git a/Source/lang.h b/Source/lang.h index 3c4f5d12..726657d9 100644 --- a/Source/lang.h +++ b/Source/lang.h @@ -79,12 +79,12 @@ enum { NLF_SKIPPED, NLF_COPY_DETAILS, - LANG_NAME, - LANG_COMP_TEXT, - LANG_LICENSE_TEXT, - LANG_LICENSE_DATA, - LANG_DIR_TEXT, - LANG_UNINST_TEXT + SLANG_NAME, + SLANG_COMP_TEXT, + SLANG_LICENSE_TEXT, + SLANG_LICENSE_DATA, + SLANG_DIR_TEXT, + SLANG_UNINST_TEXT }; extern char *english_strings[NLF_STRINGS]; diff --git a/Source/script.cpp b/Source/script.cpp index 433fea61..cc9f34a3 100644 --- a/Source/script.cpp +++ b/Source/script.cpp @@ -7,8 +7,9 @@ #include "exedata.h" #include "ResourceEditor.h" #include "DialogTemplate.h" -#include "exehead/resource.h" #include "lang.h" +#include "exehead/lang.h" +#include "exehead/resource.h" #ifndef FOF_NOERRORUI #define FOF_NOERRORUI 0x0400 @@ -525,8 +526,9 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char 0, #ifdef NSIS_SUPPORT_CODECALLBACKS -1, - -1 + -1, #endif + 0 }; if (line.getnumtokens()>2) { @@ -561,6 +563,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char case 1: #ifdef NSIS_CONFIG_LICENSEPAGE p.id = NSIS_PAGE_LICENSE; + p.caption = LANG_SUBCAPTION(0); break; #else ERROR_MSG("Error: %s specified, NSIS_CONFIG_LICENSEPAGE not defined.\n", line.gettoken_str(1)); @@ -569,6 +572,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char case 2: #ifdef NSIS_CONFIG_COMPONENTPAGE p.id = NSIS_PAGE_SELCOM; + p.caption = LANG_SUBCAPTION(1); break; #else ERROR_MSG("Error: %s specified, NSIS_CONFIG_COMPONENTPAGE not defined.\n", line.gettoken_str(1)); @@ -576,10 +580,12 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char #endif case 3: p.id = NSIS_PAGE_DIR; + p.caption = LANG_SUBCAPTION(2); break; case 4: if (*build_last_page_define) definedlist.add(build_last_page_define,""); p.id = NSIS_PAGE_INSTFILES; + p.caption = LANG_SUBCAPTION(3); break; default: PRINTHELP(); @@ -597,12 +603,13 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char build_pages.add(&p,sizeof(page)); build_header.common.num_pages++; - if (p.id==NSIS_PAGE_INSTFILES) { + if (p.id == NSIS_PAGE_INSTFILES) { p.id=NSIS_PAGE_COMPLETED; #ifdef NSIS_SUPPORT_CODECALLBACKS - p.prefunc=-1; - p.postfunc=-1; + p.prefunc = -1; + p.postfunc = -1; #endif + p.caption = LANG_SUBCAPTION(4); build_pages.add(&p,sizeof(page)); build_header.common.num_pages++; } @@ -618,8 +625,9 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char 0, #ifdef NSIS_SUPPORT_CODECALLBACKS -1, - -1 + -1, #endif + 0 }; if (line.getnumtokens()>2) { @@ -665,10 +673,12 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char break; case 1: p.id = NSIS_PAGE_UNINST; + p.caption=LANG_SUBCAPTION(0); break; case 2: if (*ubuild_last_page_define) definedlist.add(ubuild_last_page_define,""); p.id = NSIS_PAGE_INSTFILES; + p.caption=LANG_SUBCAPTION(1); break; default: PRINTHELP(); @@ -692,6 +702,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char p.prefunc=-1; p.postfunc=-1; #endif + p.caption=LANG_SUBCAPTION(2); ubuild_pages.add(&p,sizeof(page)); build_uninst.common.num_pages++; } @@ -720,7 +731,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char if (line.getnumtokens()!=a+1) PRINTHELP(); if (IsSet(common.name,lang)) warning("%s: specified multiple times, wasting space (%s:%d)",line.gettoken_str(0),curfilename,linecnt); - SetString(line.gettoken_str(a),LANG_NAME,0,lang); + SetString(line.gettoken_str(a),SLANG_NAME,0,lang); SCRIPT_MSG("Name: \"%s\"\n",line.gettoken_str(a)); } return make_sure_not_in_secorfunc(line.gettoken_str(0)); @@ -780,7 +791,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char if (line.getnumtokens()==a) PRINTHELP(); if (IsSet(installer.text,lang) && line.gettoken_str(a)[0]) warning("%s: specified multiple times, wasting space (%s:%d)",line.gettoken_str(0),curfilename,linecnt); - SetString(line.gettoken_str(a),LANG_DIR_TEXT,0,lang); + SetString(line.gettoken_str(a),SLANG_DIR_TEXT,0,lang); if (line.getnumtokens()>a+1) SetString(line.gettoken_str(a+1),NLF_DIR_SUBTEXT,0,lang); if (line.getnumtokens()>a+2) SetString(line.gettoken_str(a+2),NLF_BTN_BROWSE,0,lang); SCRIPT_MSG("DirText: \"%s\" \"%s\" \"%s\"\n",line.gettoken_str(a),line.gettoken_str(a+1),line.gettoken_str(a+2)); @@ -799,7 +810,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char if (line.getnumtokens()==a) PRINTHELP(); if (IsSet(installer.componenttext,lang) && line.gettoken_str(a)[0]) warning("%s: specified multiple times, wasting space (%s:%d)",line.gettoken_str(0),curfilename,linecnt); - SetString(line.gettoken_str(a),LANG_COMP_TEXT,0,lang); + SetString(line.gettoken_str(a),SLANG_COMP_TEXT,0,lang); if (line.getnumtokens()>a+1) SetString(line.gettoken_str(a+1),NLF_COMP_SUBTEXT1,0,lang); if (line.getnumtokens()>a+2) SetString(line.gettoken_str(a+2),NLF_COMP_SUBTEXT2,0,lang); SCRIPT_MSG("ComponentText: \"%s\" \"%s\" \"%s\"\n",line.gettoken_str(a),line.gettoken_str(a+1),line.gettoken_str(a+2)); @@ -863,7 +874,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char if (line.getnumtokens()==a) PRINTHELP(); if (IsSet(installer.licensetext,lang)) warning("%s: specified multiple times, wasting space (%s:%d)",line.gettoken_str(0),curfilename,linecnt); - SetString(line.gettoken_str(a),LANG_LICENSE_TEXT,0,lang); + SetString(line.gettoken_str(a),SLANG_LICENSE_TEXT,0,lang); if (line.getnumtokens()>a+1) SetString(line.gettoken_str(a+1),NLF_BTN_LICENSE,0,lang); SCRIPT_MSG("LicenseText: \"%s\" \"%s\"\n",line.gettoken_str(a),line.gettoken_str(a+1)); } @@ -901,7 +912,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char } fclose(fp); data[datalen]=0; - SetString(data,LANG_LICENSE_DATA,0,lang); + SetString(data,SLANG_LICENSE_DATA,0,lang); SCRIPT_MSG("LicenseData: \"%s\"\n",line.gettoken_str(a)); } return make_sure_not_in_secorfunc(line.gettoken_str(0)); @@ -1723,7 +1734,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char if (line.getnumtokens()==a) PRINTHELP(); if (IsSet(uninstall.uninstalltext,lang)) warning("%s: specified multiple times, wasting space (%s:%d)",line.gettoken_str(0),curfilename,linecnt); - SetString(line.gettoken_str(a),LANG_UNINST_TEXT,0,lang); + SetString(line.gettoken_str(a),SLANG_UNINST_TEXT,0,lang); if (line.getnumtokens()>a+1) SetString(line.gettoken_str(a+1),NLF_UNINST_SUBTEXT,0,lang); SCRIPT_MSG("UninstallText: \"%s\" \"%s\"\n",line.gettoken_str(a),line.gettoken_str(a+1)); }