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
This commit is contained in:
kichik 2003-03-18 20:36:52 +00:00
parent a46ab81918
commit bad48f1a0a
18 changed files with 159 additions and 101 deletions

View file

@ -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

View file

@ -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 |

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -56,7 +56,7 @@ Replaces dialog (\e{IDD_LICENSE}, \e{IDD_DIR}, \e{IDD_SELCOM}, \e{IDD_INST}, \e{
\b \e{IDD_INST} must contain \e{IDC_BACK} (button), \e{IDC_CHILDRECT} (static control the size of all other dialogs), \e{IDC_VERSTR} (static), \e{IDOK} (button), and \e{IDCANCEL} (button). If an image control (static with \e{SS_BITMAP} style) will be found in this dialog it will be used as the default for SetBrandingImage.
\b \e{IDD_INSTFILES} must contain \e{IDC_LIST1} (SysListView32 control), \e{IDC_PROGRESS1} and \e{IDC_PROGRESS2} (msctls_progress32 controls), and \e{IDC_SHOWDETAILS} (button).
\b \e{IDD_INSTFILES} must contain \e{IDC_LIST1} (SysListView32 control), \e{IDC_PROGRESS} (msctls_progress32 control), and \e{IDC_SHOWDETAILS} (button).
\b \e{IDD_UNINST} must contain \e{IDC_EDIT1} (edit box).

View file

@ -239,19 +239,20 @@ CEXEBuild::CEXEBuild()
memset(&build_header,-1,sizeof(build_header));
build_header.install_reg_rootkey=0;
#ifdef NSIS_CONFIG_COMPONENTPAGE
/*#ifdef NSIS_CONFIG_COMPONENTPAGE
build_header.no_custom_instmode_flag=0;
#endif
#endif*/
build_header.num_sections=0;
build_header.common.num_entries=0;
#ifdef NSIS_CONFIG_SILENT_SUPPORT
/*#ifdef NSIS_CONFIG_SILENT_SUPPORT
build_header.common.silent_install=0;
#endif
build_header.common.misc_flags=8;
build_header.common.show_details=0;
#endif*/
build_header.common.flags=CH_FLAGS_NO_ROOT_DIR;
/*build_header.common.misc_flags=8;
build_header.common.show_details=0;*/
build_header.common.lb_bg=RGB(0,0,0);
build_header.common.lb_fg=RGB(0,255,0);
build_header.common.progress_flags=0;
/*build_header.common.progress_flags=0;*/
uninstall_mode=0;
uninstall_size_full=0;
@ -261,13 +262,14 @@ CEXEBuild::CEXEBuild()
build_uninst.common.lb_bg=RGB(0,0,0);
build_uninst.common.lb_fg=RGB(0,255,0);
build_uninst.common.num_entries=0;
#ifdef NSIS_CONFIG_SILENT_SUPPORT
/*#ifdef NSIS_CONFIG_SILENT_SUPPORT
build_uninst.common.silent_install=0;
#endif
#endif*/
build_uninst.code=0;
build_uninst.code_size=-1;
build_uninst.common.show_details=0;
build_uninst.common.misc_flags=0;
/*build_uninst.common.show_details=0;
build_uninst.common.misc_flags=0;*/
build_header.common.flags=0;
uninstaller_writes_used=0;
@ -1239,8 +1241,7 @@ int CEXEBuild::write_output(void)
}
else
{
build_uninst.common.progress_flags=build_header.common.progress_flags;
build_uninst.common.misc_flags|=build_header.common.misc_flags&(4|8);
build_uninst.common.flags|=build_header.common.flags&(CH_FLAGS_PROGRESS_COLORED|CH_FLAGS_NO_ROOT_DIR);
set_uninstall_mode(1);
#ifdef NSIS_SUPPORT_CODECALLBACKS
@ -1305,7 +1306,7 @@ int CEXEBuild::write_output(void)
int main=2;
#ifdef NSIS_CONFIG_SILENT_SUPPORT
if (!build_header.common.silent_install)
if (!(build_header.common.flags&(CH_FLAGS_SILENT|CH_FLAGS_SILENT_LOG)))
#endif
{
#ifdef NSIS_CONFIG_LICENSEPAGE
@ -1429,7 +1430,7 @@ int CEXEBuild::write_output(void)
#ifdef NSIS_CONFIG_UNINSTALL_SUPPORT
#ifdef NSIS_CONFIG_SILENT_SUPPORT
if (!build_uninst.common.silent_install && uninstaller_writes_used)
if (!(build_header.common.flags&(CH_FLAGS_SILENT|CH_FLAGS_SILENT_LOG)) && uninstaller_writes_used)
#endif
{
if (!IsNotSet(uninstall.uninstalltext)) uninst++;
@ -1670,7 +1671,7 @@ int CEXEBuild::write_output(void)
fh.flags=(build_crcchk?FH_FLAGS_CRC:0);
fh.flags|=(build_crcchk==2?FH_FLAGS_FORCE_CRC:0);
#ifdef NSIS_CONFIG_SILENT_SUPPORT
if (build_header.common.silent_install) fh.flags |= FH_FLAGS_SILENT;
if (build_header.common.flags&(CH_FLAGS_SILENT|CH_FLAGS_SILENT_LOG)) fh.flags |= FH_FLAGS_SILENT;
#endif
fh.siginfo=FH_SIG;
@ -2040,7 +2041,7 @@ int CEXEBuild::uninstall_generate()
fh.flags = FH_FLAGS_UNINSTALL | (build_crcchk?FH_FLAGS_CRC:0);
fh.flags |= (build_crcchk==2?FH_FLAGS_FORCE_CRC:0);
#ifdef NSIS_CONFIG_SILENT_SUPPORT
if (build_uninst.common.silent_install) fh.flags |= FH_FLAGS_SILENT;
if (build_uninst.common.flags&(CH_FLAGS_SILENT|CH_FLAGS_SILENT_LOG)) fh.flags |= FH_FLAGS_SILENT;
#endif
fh.siginfo=FH_SIG;
fh.length_of_all_following_data=

View file

@ -32,6 +32,7 @@
#include "state.h"
#include "ui.h"
#include "lang.h"
#include "state.h"
extern unsigned long NSISCALL CRC32(unsigned long crc, const unsigned char *buf, unsigned int len);
@ -343,7 +344,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst,LPSTR lpszCmdParam,
#endif//NSIS_CONFIG_UNINSTALL_SUPPORT
#ifdef NSIS_CONFIG_VISIBLE_SUPPORT
#ifdef NSIS_CONFIG_SILENT_SUPPORT
if (!g_inst_cmnheader->silent_install) g_inst_cmnheader->silent_install=silent;
if (silent) inst_flags |= CH_FLAGS_SILENT;
#endif//NSIS_CONFIG_SILENT_SUPPORT
#endif//NSIS_CONFIG_VISIBLE_SUPPORT

View file

@ -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);

View file

@ -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) {

View file

@ -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

View file

@ -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

View file

@ -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 |

View file

@ -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;
extern HICON g_hIcon;
extern int inst_flags;

View file

@ -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++;

View file

@ -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);
}
}

View file

@ -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);
}

View file

@ -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