From 4fbd8b1991c37b6ddce160c987f7e06752f5c0ff Mon Sep 17 00:00:00 2001 From: kichik Date: Fri, 18 Jul 2003 17:39:45 +0000 Subject: [PATCH] Fixed bug #769598 - problems with InstType /COMPONENTSONLYONCUSTOM git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@2746 212acab6-be3b-0410-9dea-997c60f758d6 --- Source/exehead/Ui.c | 17 +++++++---------- Source/exehead/fileform.h | 2 +- Source/lang.cpp | 4 ++++ 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/Source/exehead/Ui.c b/Source/exehead/Ui.c index 7c2a9c6c..b36f255b 100644 --- a/Source/exehead/Ui.c +++ b/Source/exehead/Ui.c @@ -1009,7 +1009,7 @@ static BOOL CALLBACK SelProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar DeleteObject(hBMcheck1); - for (i = 0; i < NSIS_MAX_INST_TYPES; i++) + for (i = 0; i < NSIS_MAX_INST_TYPES+1; i++) { if (g_inst_header->install_types[i]) { @@ -1018,13 +1018,10 @@ static BOOL CALLBACK SelProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar process_string_fromtab(g_tmp,g_inst_header->install_types[i]); j=SendMessage(hwndCombo1,CB_ADDSTRING,0,(LPARAM)ps_tmpbuf); SendMessage(hwndCombo1,CB_SETITEMDATA,j,i); + if (i == g_flags.cur_insttype) + SendMessage(hwndCombo1, CB_SETCURSEL, j, 0); } } - if (!(inst_flags&CH_FLAGS_NO_CUSTOM)) - { - int j=SendMessage(hwndCombo1,CB_ADDSTRING,0,(LPARAM)LANG_STR(LANG_COMP_CUSTOM)); - SendMessage(hwndCombo1,CB_SETITEMDATA,j,NSIS_MAX_INST_TYPES); - } if (doCombo) { @@ -1260,11 +1257,11 @@ static BOOL CALLBACK SelProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar ExecuteCodeSegment(g_inst_header->code_onSelChange,NULL); #endif//NSIS_SUPPORT_CODECALLBACKS && NSIS_CONFIG_COMPONENTPAGE - if (inst_flags&CH_FLAGS_COMP_ONLY_ON_CUSTOM) + if (inst_flags & CH_FLAGS_COMP_ONLY_ON_CUSTOM) { - int c=(g_flags.cur_insttype == NSIS_MAX_INST_TYPES)<<3;// SW_SHOWNA=8, SW_HIDE=0 - ShowWindow(hwndTree1,c); - ShowWindow(GetUIItem(IDC_TEXT2),c); + int c = (g_flags.cur_insttype == NSIS_MAX_INST_TYPES) << 3;// SW_SHOWNA=8, SW_HIDE=0 + ShowWindow(hwndTree1, c); + ShowWindow(GetUIItem(IDC_TEXT2), c); } else if (!lParam) { diff --git a/Source/exehead/fileform.h b/Source/exehead/fileform.h index 47bc9669..eb953397 100644 --- a/Source/exehead/fileform.h +++ b/Source/exehead/fileform.h @@ -390,7 +390,7 @@ typedef struct int install_reg_key_ptr, install_reg_value_ptr; #ifdef NSIS_CONFIG_COMPONENTPAGE - int install_types[NSIS_MAX_INST_TYPES]; + int install_types[NSIS_MAX_INST_TYPES+1]; #endif #ifdef NSIS_CONFIG_LICENSEPAGE diff --git a/Source/lang.cpp b/Source/lang.cpp index 359b230a..3e7c409e 100644 --- a/Source/lang.cpp +++ b/Source/lang.cpp @@ -4,6 +4,7 @@ #include "build.h" #include "DialogTemplate.h" #include "exehead\resource.h" +#include "exehead\lang.h" extern const char *NSIS_VERSION; @@ -432,6 +433,9 @@ void CEXEBuild::FillStringTable(StringTable *table, NLF *nlf/*=0*/) { table->installer.componentsubtext[0]=add_string_main(str(NLF_COMP_SUBTEXT1),0); 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); + + if (!(build_header.common.flags&CH_FLAGS_NO_CUSTOM)) + build_header.install_types[NSIS_MAX_INST_TYPES] = LANG_COMP_CUSTOM; } else table->installer.componenttext=0; }