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

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