Hidden sections can now have SectionIn too. Old behaviour retained (hidden sections without SectionIn are in all install types).

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@1449 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2002-10-19 12:02:18 +00:00
parent 3f8a5ccdcc
commit 9ca4265d78
2 changed files with 30 additions and 27 deletions

View file

@ -700,6 +700,8 @@ int CEXEBuild::section_add_install_type(int inst_type)
ERROR_MSG("Error: can't modify flags when no section is open\n"); ERROR_MSG("Error: can't modify flags when no section is open\n");
return PS_ERROR; return PS_ERROR;
} }
if (build_cursection->install_types == ~(int)0)
build_cursection->install_types = 0;
build_cursection->install_types|=inst_type; build_cursection->install_types|=inst_type;
return PS_OK; return PS_OK;
} }
@ -793,7 +795,7 @@ int CEXEBuild::add_section(const char *secname, const char *file, int line, cons
build_cursection->code=cur_entries->getlen()/sizeof(entry); build_cursection->code=cur_entries->getlen()/sizeof(entry);
build_cursection->code_size=0; build_cursection->code_size=0;
build_cursection->size_kb=0; build_cursection->size_kb=0;
build_cursection->install_types=0; build_cursection->install_types=*name?0:~(int)0;
if (secname[0]=='-') if (secname[0]=='-')
{ {

View file

@ -992,48 +992,50 @@ static BOOL CALLBACK SelProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
for (x = 0; x < num_sections; x ++) for (x = 0; x < num_sections; x ++)
{ {
if (g_inst_section[x].name_ptr) section *sec=g_inst_section+x;
if (m_num_insttypes && m_whichcfg != m_num_insttypes && !(sec->flags&SF_RO))
{
if ((sec->install_types>>m_whichcfg) & 1)
sec->flags|=SF_SELECTED;
else
sec->flags&=~SF_SELECTED;
}
if (sec->name_ptr)
{ {
TVINSERTSTRUCT tv; TVINSERTSTRUCT tv;
tv.hParent=Par; tv.hParent=Par;
tv.hInsertAfter=TVI_LAST; tv.hInsertAfter=TVI_LAST;
tv.item.mask=TVIF_PARAM|TVIF_TEXT|TVIF_STATE; tv.item.mask=TVIF_PARAM|TVIF_TEXT|TVIF_STATE;
tv.item.lParam=x; tv.item.lParam=x;
tv.item.pszText=process_string_fromtab(ps_tmpbuf,g_inst_section[x].name_ptr); tv.item.pszText=process_string_fromtab(ps_tmpbuf,sec->name_ptr);
tv.item.stateMask=TVIS_STATEIMAGEMASK|TVIS_EXPANDED; tv.item.stateMask=TVIS_STATEIMAGEMASK|TVIS_EXPANDED;
if (m_num_insttypes && m_whichcfg != m_num_insttypes && !(g_inst_section[x].flags&SF_RO))
{
if ((g_inst_section[x].install_types>>m_whichcfg) & 1)
g_inst_section[x].flags|=SF_SELECTED;
else
g_inst_section[x].flags&=~SF_SELECTED;
}
{ {
int l=1; int l=1;
if (g_inst_section[x].flags & SF_SELECTED) l++; if (sec->flags & SF_SELECTED) l++;
if (g_inst_section[x].flags & SF_RO) l+=3; if (sec->flags & SF_RO) l+=3;
tv.item.state=INDEXTOSTATEIMAGEMASK(l); tv.item.state=INDEXTOSTATEIMAGEMASK(l);
} }
if (g_inst_section[x].flags&SF_BOLD) if (sec->flags&SF_BOLD)
{ {
tv.item.stateMask|=TVIS_BOLD; tv.item.stateMask|=TVIS_BOLD;
tv.item.state|=TVIS_BOLD; tv.item.state|=TVIS_BOLD;
} }
if (g_inst_section[x].flags&SF_SUBSEC) if (sec->flags&SF_SUBSEC)
{ {
tv.item.mask|=TVIF_CHILDREN; tv.item.mask|=TVIF_CHILDREN;
tv.item.cChildren=1; tv.item.cChildren=1;
if (g_inst_section[x].flags&SF_EXPAND) if (sec->flags&SF_EXPAND)
tv.item.state|=TVIS_EXPANDED; tv.item.state|=TVIS_EXPANDED;
Par = hTreeItems[x] = TreeView_InsertItem(hwndTree1,&tv); Par = hTreeItems[x] = TreeView_InsertItem(hwndTree1,&tv);
doLines=1; doLines=1;
} }
else if (g_inst_section[x].flags&SF_SUBSECEND) else if (sec->flags&SF_SUBSECEND)
{ {
TV_ITEM it; TV_ITEM it;
it.hItem = hTreeItems[x-1]; it.hItem = hTreeItems[x-1];
@ -1187,7 +1189,7 @@ static BOOL CALLBACK SelProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
HTREEITEM *ht=hTreeItems; HTREEITEM *ht=hTreeItems;
while (x--) while (x--)
{ {
if (t->name_ptr && !(t->flags & SF_RO)) if (!(t->flags & SF_RO))
{ {
TVITEM tv; TVITEM tv;
int l=1; int l=1;
@ -1199,16 +1201,15 @@ static BOOL CALLBACK SelProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
} }
else t->flags&=~SF_SELECTED; else t->flags&=~SF_SELECTED;
// this can't happen because of the above if() if (t->name_ptr) {
//if (t->flags & SF_RO) l+=3; tv.hItem=*ht;
tv.mask=TVIF_STATE;
tv.state=INDEXTOSTATEIMAGEMASK(l);
tv.stateMask = TVIS_STATEIMAGEMASK;
tv.hItem=*ht; TreeView_SetItem(hwndTree1,&tv);
tv.mask=TVIF_STATE; SetParentState(hwndTree1,&tv);
tv.state=INDEXTOSTATEIMAGEMASK(l); }
tv.stateMask = TVIS_STATEIMAGEMASK;
TreeView_SetItem(hwndTree1,&tv);
SetParentState(hwndTree1,&tv);
} }
t++; t++;
ht++; ht++;