From bad48f1a0aca2e14f4b9496cf4b3a2fda16feb44 Mon Sep 17 00:00:00 2001 From: kichik Date: Tue, 18 Mar 2003 20:36:52 +0000 Subject: [PATCH] Some space saving changes, /NOCUSTOM and /COMPONENTSONLYONCUSTOM work together and infastructures for future changes git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@2338 212acab6-be3b-0410-9dea-997c60f758d6 --- Contrib/UIs/UI Holder/resource.h | 3 +- Contrib/UIs/UI Holder/resource.rc | 5 +- Contrib/UIs/default.exe | Bin 6144 -> 5632 bytes Contrib/UIs/modern.exe | Bin 6144 -> 6144 bytes Contrib/UIs/sdbarker_tiny.exe | Bin 6144 -> 5632 bytes Docs/src/attributes.but | 2 +- Source/build.cpp | 35 ++++---- Source/exehead/Main.c | 3 +- Source/exehead/Ui.c | 24 +++--- Source/exehead/fileform.c | 6 +- Source/exehead/fileform.h | 30 ++++--- Source/exehead/resource.h | 3 +- Source/exehead/resource.rc | 5 +- Source/exehead/state.h | 6 +- Source/exehead/util.c | 2 +- Source/lang.cpp | 2 +- Source/script.cpp | 131 +++++++++++++++++++++--------- TODO.txt | 3 - 18 files changed, 159 insertions(+), 101 deletions(-) diff --git a/Contrib/UIs/UI Holder/resource.h b/Contrib/UIs/UI Holder/resource.h index 4341d4da..e3522a98 100644 --- a/Contrib/UIs/UI Holder/resource.h +++ b/Contrib/UIs/UI Holder/resource.h @@ -21,8 +21,7 @@ #define IDC_EDIT1 1000 #define IDC_BROWSE 1001 #define IDC_COPYRIGHT 1003 -#define IDC_PROGRESS1 1004 -#define IDC_PROGRESS2 1005 +#define IDC_PROGRESS 1004 #define IDC_INTROTEXT 1006 #define IDC_WMA 1007 #define IDC_CHECK1 1008 diff --git a/Contrib/UIs/UI Holder/resource.rc b/Contrib/UIs/UI Holder/resource.rc index a761bdbd..a6103e2a 100644 --- a/Contrib/UIs/UI Holder/resource.rc +++ b/Contrib/UIs/UI Holder/resource.rc @@ -84,10 +84,7 @@ IDD_INSTFILES DIALOGEX DISCARDABLE 0, 0, 266, 130 STYLE DS_CONTROL | DS_SHELLFONT | WS_CHILD FONT 8, "MS Shell Dlg" BEGIN - CONTROL "",IDC_PROGRESS1,"msctls_progress32",NOT WS_VISIBLE | - WS_BORDER,24,10,241,11 - CONTROL "",IDC_PROGRESS2,"msctls_progress32",PBS_SMOOTH | NOT - WS_VISIBLE | WS_BORDER,24,10,241,11 + CONTROL "",IDC_PROGRESS,"msctls_progress32",WS_BORDER,24,10,241,11 CONTROL "",IDC_INTROTEXT,"Static",SS_LEFTNOWORDWRAP, 24,0,241,8 CONTROL "",IDC_LIST1,"SysListView32",LVS_REPORT | LVS_SINGLESEL | diff --git a/Contrib/UIs/default.exe b/Contrib/UIs/default.exe index 119c039ba2a786c83b6d61ae285001ba3b0f1ab6..c4bbcbc45a59524ef510131f5f5d7912be770403 100755 GIT binary patch delta 200 zcmZoLXwaGPk&$oWr!1xq?2`+byeF?@oX_=voq>VD0f;#^2Qh8q$*gc>VAuiV!hnGj z1A_}AjK{!G;>^HcgT&w90+d7MyD~7yAo0(*F)$oKXlIz<&cKiW;!idd5Z^q3{|)2j z20Vq|2UJdt07kzsP2fD#J>Lqou19ub?#9U@aED~KKesww~gR?Q|2 delta 220 zcmZqBX)u`Zkx^jcrz|E9j>&~g-ji1{&gb&rU|?Wy0AjAqK}_3tQX3o@74rKbxBWuCPfB+s03=0rEh6S55`SV#BStnl< jwVo^@D$nRJ*+kTamyw~tfq{XGL5Go>;q7Ky(Pkz92hS7M diff --git a/Contrib/UIs/sdbarker_tiny.exe b/Contrib/UIs/sdbarker_tiny.exe index 39cfecd4653fd4e0bc754ded8c2c1c35ccdde0ef..063789c88fcabd580e8547739102cc3545eb9cda 100644 GIT binary patch delta 90 zcmZoLXwaGPk&$oWr!1x`?2`+byeF?@oX>TIoq>VD0f;#^2QmHPkyT&>vY}vu8w0}; f7zap~Y|i92XJKTWyinMVF<|loVVlh{B2O3rB>xqb delta 109 zcmZqBX)u`Zkx^jcrz|EBj>&~g-ji1{&gT;0U|?Wy0AjAqK}^4RWD^*HY$*8P#=vj{ z#sSh>HfQpivoNwvUMOtG=rH+#unjLGLxY0^0~fsilent_install) g_inst_cmnheader->silent_install=silent; + if (silent) inst_flags |= CH_FLAGS_SILENT; #endif//NSIS_CONFIG_SILENT_SUPPORT #endif//NSIS_CONFIG_VISIBLE_SUPPORT diff --git a/Source/exehead/Ui.c b/Source/exehead/Ui.c index 1ccdf0cb..b492e124 100644 --- a/Source/exehead/Ui.c +++ b/Source/exehead/Ui.c @@ -294,7 +294,7 @@ lang_again: int NSISCALL ui_doinstall(void) { num_sections=g_inst_header->num_sections; - g_flags.autoclose=g_inst_cmnheader->misc_flags&1; + g_flags.autoclose=inst_flags&CH_FLAGS_AUTO_CLOSE; #ifdef NSIS_CONFIG_UNINSTALL_SUPPORT if (!g_is_uninstaller) #endif @@ -345,7 +345,7 @@ int NSISCALL ui_doinstall(void) } #ifdef NSIS_CONFIG_LOG - if (g_inst_cmnheader->silent_install==2) + if (inst_flags&CH_FLAGS_SILENT_LOG) { build_g_logfile(); log_dolog=1; @@ -366,7 +366,7 @@ int NSISCALL ui_doinstall(void) #ifdef NSIS_CONFIG_VISIBLE_SUPPORT #ifdef NSIS_CONFIG_SILENT_SUPPORT - if (!g_inst_cmnheader->silent_install) + if (!(inst_flags&(CH_FLAGS_SILENT|CH_FLAGS_SILENT_LOG))) #endif//NSIS_CONFIG_SILENT_SUPPORT { g_hIcon=LoadImage(g_hInstance,MAKEINTRESOURCE(IDI_ICON2),IMAGE_ICON,0,0,LR_DEFAULTSIZE|LR_SHARED); @@ -1002,7 +1002,8 @@ static BOOL CALLBACK SelProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar { SendMessage(hwndCombo1,CB_ADDSTRING,0,(LPARAM)GetStringFromStringTab(g_inst_header->install_types_ptr[m_num_insttypes])); } - if (g_inst_header->no_custom_instmode_flag!=1) SendMessage(hwndCombo1,CB_ADDSTRING,0,(LPARAM)LANG_STR(LANG_COMP_CUSTOM)); + if (!(inst_flags&CH_FLAGS_NO_CUSTOM)) + SendMessage(hwndCombo1,CB_ADDSTRING,0,(LPARAM)LANG_STR(LANG_COMP_CUSTOM)); SendMessage(hwndCombo1,CB_SETCURSEL,m_whichcfg,0); } @@ -1228,7 +1229,7 @@ static BOOL CALLBACK SelProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar { TV_ITEM hItem; hItem.hItem=*ht; - if (g_inst_header->no_custom_instmode_flag==1) + if (inst_flags&CH_FLAGS_NO_CUSTOM) { CheckTreeItem(hwndTree1,&hItem,(t->install_types>>m_whichcfg)&1); } @@ -1245,14 +1246,14 @@ static BOOL CALLBACK SelProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar if (x < 0) break; } - if (!g_inst_header->no_custom_instmode_flag) + if (!(inst_flags&(CH_FLAGS_COMP_ONLY_ON_CUSTOM|CH_FLAGS_NO_CUSTOM))) { SendMessage(hwndCombo1,CB_SETCURSEL,r,0); m_whichcfg=r; } } // end of typecheckshit - if (g_inst_header->no_custom_instmode_flag==2) + if (inst_flags&CH_FLAGS_COMP_ONLY_ON_CUSTOM) { int c=(m_whichcfg == m_num_insttypes && m_num_insttypes)<<3;// SW_SHOWNA=8, SW_HIDE=0 ShowWindow(hwndTree1,c); @@ -1383,18 +1384,17 @@ static BOOL CALLBACK InstProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa ListView_SetTextColor(insthwnd, lb_fg); } my_SetWindowText(insthwndbutton,LANG_STR(LANG_BTN_DETAILS)); - if (g_inst_cmnheader->show_details) + if (inst_flags&(CH_FLAGS_DETAILS_SHOWDETAILS|CH_FLAGS_DETAILS_NEVERSHOW)) { ShowWindow(insthwndbutton,SW_HIDE); - if (g_inst_cmnheader->show_details != 2) ShowWindow(insthwnd,SW_SHOWNA); + if (!(inst_flags&CH_FLAGS_DETAILS_NEVERSHOW)) ShowWindow(insthwnd,SW_SHOWNA); else insthwndbutton=NULL; } progress_bar_len=num; - g_progresswnd=GetUIItem(IDC_PROGRESS1+(g_inst_cmnheader->progress_flags&1)); - ShowWindow(g_progresswnd,SW_SHOWNA); + g_progresswnd=GetUIItem(IDC_PROGRESS); SendMessage(g_progresswnd,PBM_SETRANGE,0,MAKELPARAM(0,30000)); - if (g_inst_cmnheader->progress_flags&2) + if (inst_flags&CH_FLAGS_PROGRESS_COLORED) { SendMessage(g_progresswnd,PBM_SETBARCOLOR,0,lb_fg); SendMessage(g_progresswnd,PBM_SETBKCOLOR,0,lb_bg); diff --git a/Source/exehead/fileform.c b/Source/exehead/fileform.c index c7d38ff2..778a0939 100644 --- a/Source/exehead/fileform.c +++ b/Source/exehead/fileform.c @@ -36,6 +36,8 @@ HANDLE dbd_hFile=INVALID_HANDLE_VALUE; static int dbd_size, dbd_pos, dbd_srcpos, dbd_fulllen; #endif//NSIS_COMPRESS_WHOLE +int inst_flags; + int NSISCALL isheader(firstheader *h) { if ((h->flags & (~FH_FLAGS_MASK)) || @@ -94,6 +96,8 @@ const char * NSISCALL loadHeaders(void) g_inst_combinedheader=data; + inst_flags=((common_header *)data)->flags; + #ifdef NSIS_CONFIG_UNINSTALL_SUPPORT if (h.flags&FH_FLAGS_UNINSTALL) { @@ -254,7 +258,7 @@ static int NSISCALL __ensuredata(int amount) #ifdef NSIS_CONFIG_VISIBLE_SUPPORT if (g_inst_cmnheader) #ifdef NSIS_CONFIG_SILENT_SUPPORT - if (!g_inst_cmnheader->silent_install) + if (!(inst_flags&(CH_FLAGS_SILENT|CH_FLAGS_SILENT_LOG))) #endif { if (hwnd) { diff --git a/Source/exehead/fileform.h b/Source/exehead/fileform.h index a7948097..0e5d7fbd 100644 --- a/Source/exehead/fileform.h +++ b/Source/exehead/fileform.h @@ -206,7 +206,7 @@ enum typedef struct { - int flags; // &1=CRC, &2=uninstall, &4=silent, &8=force CRC + int flags; // FH_FLAGS_* int siginfo; // FH_SIG int nsinst[3]; // FH_INT1,FH_INT2,FH_INT3 @@ -296,6 +296,22 @@ typedef struct int copy_details; } common_strings; +// Flags for common_header.flags +#define CH_FLAGS_DETAILS_SHOWDETAILS 1 +#define CH_FLAGS_DETAILS_NEVERSHOW 2 +#define CH_FLAGS_PROGRESS_COLORED 4 +#ifdef NSIS_CONFIG_SILENT_SUPPORT + #define CH_FLAGS_SILENT 8 + #define CH_FLAGS_SILENT_LOG 16 +#endif +#define CH_FLAGS_AUTO_CLOSE 32 +#define CH_FLAGS_DIR_NO_SHOW 64 +#define CH_FLAGS_NO_ROOT_DIR 128 +#ifdef NSIS_CONFIG_COMPONENTPAGE + #define CH_FLAGS_COMP_ONLY_ON_CUSTOM 256 + #define CH_FLAGS_NO_CUSTOM 512 +#endif + // Settings common to both installers and uninstallers typedef struct { @@ -323,13 +339,7 @@ typedef struct #endif #endif//NSIS_SUPPORT_CODECALLBACKS - char show_details; - char progress_flags; -#ifdef NSIS_CONFIG_SILENT_SUPPORT - char silent_install; -#endif//NSIS_CONFIG_SILENT_SUPPORT - // additional flags - char misc_flags; // auto_close=&1, no_show_dirpage=&2, no_show_icon&4, no_rootdir&8; + int flags; // CH_FLAGS_* } common_header; // Strings specific to installers @@ -382,10 +392,6 @@ typedef struct int uninsticon_size; #endif -#ifdef NSIS_CONFIG_COMPONENTPAGE - int no_custom_instmode_flag; -#endif - int num_sections; // total number of sections #ifdef NSIS_SUPPORT_CODECALLBACKS diff --git a/Source/exehead/resource.h b/Source/exehead/resource.h index 85900225..3fac4775 100644 --- a/Source/exehead/resource.h +++ b/Source/exehead/resource.h @@ -18,8 +18,7 @@ #define IDB_BITMAP1 109 #define IDC_EDIT1 1000 #define IDC_BROWSE 1001 -#define IDC_PROGRESS1 1004 -#define IDC_PROGRESS2 1005 +#define IDC_PROGRESS 1004 #define IDC_INTROTEXT 1006 #define IDC_CHECK1 1008 #define IDC_LIST1 1016 diff --git a/Source/exehead/resource.rc b/Source/exehead/resource.rc index f6f00bac..4580e186 100644 --- a/Source/exehead/resource.rc +++ b/Source/exehead/resource.rc @@ -114,10 +114,7 @@ IDD_INSTFILES DIALOGEX DISCARDABLE 0, 0, 266, 130 STYLE DS_CONTROL | DS_SHELLFONT | WS_CHILD FONT 8, "MS Shell Dlg" BEGIN - CONTROL "",IDC_PROGRESS1,"msctls_progress32",NOT WS_VISIBLE | - WS_BORDER,24,10,241,11 - CONTROL "",IDC_PROGRESS2,"msctls_progress32",PBS_SMOOTH | NOT - WS_VISIBLE | WS_BORDER,24,10,241,11 + CONTROL "",IDC_PROGRESS,"msctls_progress32",WS_BORDER,24,10,241,11 CONTROL "",IDC_INTROTEXT,"Static",SS_LEFTNOWORDWRAP, 24,0,241,8 CONTROL "",IDC_LIST1,"SysListView32",LVS_REPORT | LVS_SINGLESEL | diff --git a/Source/exehead/state.h b/Source/exehead/state.h index 09c1d3d3..a80e8ac8 100644 --- a/Source/exehead/state.h +++ b/Source/exehead/state.h @@ -4,8 +4,6 @@ extern char plugins_temp_dir[NSIS_MAX_STRLEN]; extern char temp_directory[NSIS_MAX_STRLEN]; extern char g_usrvars[25][NSIS_MAX_STRLEN]; -// changed by Amir Szekely 28th August 2002 -// smaller exehead extern char *state_command_line; extern char *state_install_directory; extern char *state_output_directory; @@ -17,4 +15,6 @@ extern HWND g_hwnd; extern int g_filehdrsize; extern HANDLE g_hInstance; extern HWND insthwnd,insthwndbutton; -extern HICON g_hIcon; \ No newline at end of file +extern HICON g_hIcon; + +extern int inst_flags; \ No newline at end of file diff --git a/Source/exehead/util.c b/Source/exehead/util.c index 06e78af4..1fa083e1 100644 --- a/Source/exehead/util.c +++ b/Source/exehead/util.c @@ -139,7 +139,7 @@ int NSISCALL is_valid_instpath(char *s) { int ivp=0; // if 8 is set, req is 0, which means rootdirs are not allowed. - int req=!(g_inst_cmnheader->misc_flags&8); + int req=!(inst_flags&CH_FLAGS_NO_ROOT_DIR); if (*(WORD*)s == CHAR2_TO_WORD('\\','\\')) // \\ path { if (lastchar(s)!='\\') ivp++; diff --git a/Source/lang.cpp b/Source/lang.cpp index 8c609db4..c216f277 100644 --- a/Source/lang.cpp +++ b/Source/lang.cpp @@ -375,7 +375,7 @@ void CEXEBuild::FillDefaultsIfNeeded(StringTable *table, NLF *nlf/*=0*/) { { if (!table->installer.componentsubtext[0]) table->installer.componentsubtext[0]=add_string_main(str(NLF_COMP_SUBTEXT1),0); - if (build_header.no_custom_instmode_flag!=1 && !table->installer.componentsubtext[1]) + if (!(build_header.common.flags&CH_FLAGS_NO_CUSTOM) && !table->installer.componentsubtext[1]) table->installer.componentsubtext[1]=add_string_main(str(NLF_COMP_SUBTEXT2),0); } } diff --git a/Source/script.cpp b/Source/script.cpp index 27c184ca..b145e5e9 100644 --- a/Source/script.cpp +++ b/Source/script.cpp @@ -962,15 +962,16 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char case TOK_INSTTYPE: { int x; + if (strnicmp(line.gettoken_str(1),"/LANG=",6) && line.getnumtokens() > 2) PRINTHELP(); if (!stricmp(line.gettoken_str(1),"/NOCUSTOM")) { - build_header.no_custom_instmode_flag=1; + build_header.common.flags|=CH_FLAGS_NO_CUSTOM; SCRIPT_MSG("InstType: disabling custom install type\n"); } else if (!stricmp(line.gettoken_str(1),"/COMPONENTSONLYONCUSTOM")) { - build_header.no_custom_instmode_flag=2; + build_header.common.flags|=CH_FLAGS_COMP_ONLY_ON_CUSTOM; SCRIPT_MSG("InstType: making components viewable only on custom install type\n"); } else if (!strnicmp(line.gettoken_str(1),"/LANG=",6)) { @@ -1024,7 +1025,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char return make_sure_not_in_secorfunc(line.gettoken_str(0)); case TOK_LICENSEDATA: #ifdef NSIS_CONFIG_SILENT_SUPPORT - if (build_header.common.silent_install) + if (build_header.common.flags&(CH_FLAGS_SILENT|CH_FLAGS_SILENT_LOG)) { warning("LicenseData: SilentInstall enabled, wasting space (%s:%d)",curfilename,linecnt); } @@ -1077,10 +1078,11 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char #endif//!NSIS_CONFIG_LICENSEPAGE #ifdef NSIS_CONFIG_SILENT_SUPPORT case TOK_SILENTINST: - build_header.common.silent_install=line.gettoken_enum(1,"normal\0silent\0silentlog\0"); - if (build_header.common.silent_install<0) PRINTHELP() + { + int k=line.gettoken_enum(1,"normal\0silent\0silentlog\0"); + if (k<0) PRINTHELP() #ifndef NSIS_CONFIG_LOG - if (build_header.common.silent_install == 2) + if (k == 2) { ERROR_MSG("SilentInstall: silentlog specified, no log support compiled in (use NSIS_CONFIG_LOG)\n"); return PS_ERROR; @@ -1088,17 +1090,33 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char #endif//NSIS_CONFIG_LOG SCRIPT_MSG("SilentInstall: %s\n",line.gettoken_str(1)); #ifdef NSIS_CONFIG_LICENSEPAGE - if (build_header.common.silent_install && !IsNotSet(installer.licensedata)) + if (k && !IsNotSet(installer.licensedata)) { warning("SilentInstall: LicenseData already specified. wasting space (%s:%d)",curfilename,linecnt); } + if (k) { + build_header.common.flags|=CH_FLAGS_SILENT; + if (k == 2) + build_header.common.flags|=CH_FLAGS_SILENT_LOG; + } + else { + build_header.common.flags&=~CH_FLAGS_SILENT; + build_header.common.flags&=~CH_FLAGS_SILENT_LOG; + } #endif//NSIS_CONFIG_LICENSEPAGE + } return make_sure_not_in_secorfunc(line.gettoken_str(0)); case TOK_SILENTUNINST: + { #ifdef NSIS_CONFIG_UNINSTALL_SUPPORT - build_uninst.common.silent_install=line.gettoken_enum(1,"normal\0silent\0"); - if (build_uninst.common.silent_install<0) PRINTHELP() + int k=line.gettoken_enum(1,"normal\0silent\0"); + if (k<0) PRINTHELP() + if (k) + build_uninst.common.flags|=CH_FLAGS_SILENT; + else + build_uninst.common.flags&=~CH_FLAGS_SILENT; SCRIPT_MSG("SilentUnInstall: %s\n",line.gettoken_str(1)); + } return make_sure_not_in_secorfunc(line.gettoken_str(0)); #else ERROR_MSG("Error: %s specified, NSIS_CONFIG_UNINSTALL_SUPPORT not defined.\n", line.gettoken_str(0)); @@ -1146,24 +1164,52 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char case TOK_INSTPROGRESSFLAGS: { int x; - build_header.common.progress_flags=0; + int smooth=0; + build_header.common.flags&=~CH_FLAGS_PROGRESS_COLORED; for (x = 1; x < line.getnumtokens(); x ++) { - if (!stricmp(line.gettoken_str(x),"smooth")) build_header.common.progress_flags|=1; - else if (!stricmp(line.gettoken_str(x),"colored")) build_header.common.progress_flags|=2; + if (!stricmp(line.gettoken_str(x),"smooth")) smooth=1; + else if (!stricmp(line.gettoken_str(x),"colored")) build_header.common.flags|=CH_FLAGS_PROGRESS_COLORED; else PRINTHELP() } - SCRIPT_MSG("InstProgressFlags: %d (smooth=%d,colored=%d)\n",build_header.common.progress_flags, - build_header.common.progress_flags&1, - (build_header.common.progress_flags&2)>>1); + try { + init_res_editor(); + + BYTE* dlg = res_editor->GetResource(RT_DIALOG, MAKEINTRESOURCE(IDD_INSTFILES), MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); + if (!dlg) throw runtime_error("IDD_INSTFILES doesn't exist!"); + CDialogTemplate dt(dlg); + free(dlg); + DialogItemTemplate* progress = dt.GetItem(IDC_PROGRESS); + if (!progress) { + throw runtime_error("IDC_PROGRESS doesn't exist!"); + } + + if (smooth) + progress->dwStyle |= PBS_SMOOTH; + else + progress->dwStyle &= ~PBS_SMOOTH; + + DWORD dwSize; + dlg = dt.Save(dwSize); + res_editor->UpdateResource(RT_DIALOG, MAKEINTRESOURCE(IDD_INSTFILES), MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), dlg, dwSize); + free(dlg); + } + catch (exception& err) { + ERROR_MSG("Error setting smooth progress bar: %s\n", err.what()); + return PS_ERROR; + } + SCRIPT_MSG("InstProgressFlags: smooth=%d, colored=%d\n",smooth, + !!(build_header.common.flags&CH_FLAGS_PROGRESS_COLORED)); } return make_sure_not_in_secorfunc(line.gettoken_str(0)); case TOK_AUTOCLOSE: { int k=line.gettoken_enum(1,"false\0true\0"); - if (k == -1) PRINTHELP() - build_header.common.misc_flags&=~1; - build_header.common.misc_flags|=k; + if (k == -1) PRINTHELP(); + if (k) + build_header.common.flags|=CH_FLAGS_AUTO_CLOSE; + else + build_header.common.flags&=~CH_FLAGS_AUTO_CLOSE; SCRIPT_MSG("AutoCloseWindow: %s\n",k?"true":"false"); } return make_sure_not_in_secorfunc(line.gettoken_str(0)); @@ -1186,19 +1232,14 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char free(dlg); \ dt.RemoveItem(IDC_ULICON); \ DialogItemTemplate* text = dt.GetItem(IDC_INTROTEXT); \ - DialogItemTemplate* prog1 = dt.GetItem(IDC_PROGRESS1); \ - DialogItemTemplate* prog2 = dt.GetItem(IDC_PROGRESS2); \ + DialogItemTemplate* prog = dt.GetItem(IDC_PROGRESS); \ if (text) { \ text->sWidth += text->sX; \ text->sX = 0; \ } \ - if (prog1) { \ - prog1->sWidth += prog1->sX; \ - prog1->sX = 0; \ - } \ - if (prog2) { \ - prog2->sWidth += prog2->sX; \ - prog2->sX = 0; \ + if (prog) { \ + prog->sWidth += prog->sX; \ + prog->sX = 0; \ } \ \ DWORD dwSize; \ @@ -1241,28 +1282,45 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char int k=line.gettoken_enum(1,"hide\0show\0nevershow\0"); if (k == -1) PRINTHELP() #ifdef NSIS_CONFIG_UNINSTALL_SUPPORT - if (which_token == TOK_SHOWDETAILSUNINST) build_uninst.common.show_details=k; + if (which_token == TOK_SHOWDETAILSUNINST) + { + build_uninst.common.flags&=~(CH_FLAGS_DETAILS_NEVERSHOW|CH_FLAGS_DETAILS_SHOWDETAILS); + if (k==1) + build_uninst.common.flags|=CH_FLAGS_DETAILS_SHOWDETAILS; + else if (k==2) + build_uninst.common.flags|=CH_FLAGS_DETAILS_NEVERSHOW; + } else #endif - build_header.common.show_details=k; + { + build_header.common.flags&=~(CH_FLAGS_DETAILS_NEVERSHOW|CH_FLAGS_DETAILS_SHOWDETAILS); + if (k==1) + build_header.common.flags|=CH_FLAGS_DETAILS_SHOWDETAILS; + else if (k==2) + build_header.common.flags|=CH_FLAGS_DETAILS_NEVERSHOW; + } SCRIPT_MSG("%s: %s\n",line.gettoken_str(0),line.gettoken_str(1)); } return make_sure_not_in_secorfunc(line.gettoken_str(0)); case TOK_DIRSHOW: { int k=line.gettoken_enum(1,"show\0hide\0"); - if (k == -1) PRINTHELP() - build_header.common.misc_flags&=~2; - build_header.common.misc_flags|=(k<<1); + if (k == -1) PRINTHELP(); + if (k) + build_header.common.flags|=CH_FLAGS_DIR_NO_SHOW; + else + build_header.common.flags&=~CH_FLAGS_DIR_NO_SHOW; SCRIPT_MSG("DirShow: %s\n",k?"hide":"show"); } return make_sure_not_in_secorfunc(line.gettoken_str(0)); case TOK_ROOTDIRINST: { int k=line.gettoken_enum(1,"true\0false\0"); - if (k == -1) PRINTHELP() - build_header.common.misc_flags&=~8; - build_header.common.misc_flags|=(k<<3); + if (k == -1) PRINTHELP(); + if (k) + build_header.common.flags|=CH_FLAGS_NO_ROOT_DIR; + else + build_header.common.flags&=~CH_FLAGS_NO_ROOT_DIR; SCRIPT_MSG("AllowRootDirInstall: %s\n",k?"false":"true"); } return make_sure_not_in_secorfunc(line.gettoken_str(0)); @@ -1446,8 +1504,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char if (!dlg) return PS_ERROR; CDialogTemplate UIDlg(dlg); SEARCH(IDC_LIST1); - SEARCH(IDC_PROGRESS1); - SEARCH(IDC_PROGRESS2); + SEARCH(IDC_PROGRESS); SEARCH(IDC_SHOWDETAILS); SAVE(IDD_INSTFILES); } diff --git a/TODO.txt b/TODO.txt index df2dc1e3..e0412967 100644 --- a/TODO.txt +++ b/TODO.txt @@ -4,12 +4,9 @@ TODO NSIS -* pre-leave for custom pages - * skip plugin calls, file instructions that add more than one file with +1 with goto * move more ui changes to compile time. - make progress bar flags be written directly in the UI (PBS_SMOOTH) inst details could be changed in compile time too * component page for uninstaller, multiple sections