Added LicenseForceSelection radiobuttons|checkbox

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@2362 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2003-03-26 17:47:46 +00:00
parent 8d4d9c0856
commit 5afc7ec7d4
13 changed files with 175 additions and 47 deletions

View file

@ -1,5 +1,5 @@
# Header, don't edit
NLF v2
NLF v3
# Language ID
1033
# Translation by ..... (any credits should go here)
@ -17,6 +17,8 @@ Nullsoft Install System %s
< &Back
&Next >
I &Agree
I &accept the terms in the License Agreement
I &do not accept the terms in the License Agreement
&Install
&Uninstall
Cancel

View file

@ -1,5 +1,5 @@
# Hebrew NSIS language file
NLF v2
NLF v3
# Language ID
1037
# Translation by Amir Szekely (aka KiCHiK)
@ -14,15 +14,17 @@ Nullsoft Install System %s
: אישור הסרה
: מסיר קבצים
: ההסרה הושלמה
< הקודם
הבא >
אני מסכים
התקן
הסר
< ה&קודם
ה&בא >
אני &מסכים
אני &מסכים לתנאי הסכם הרישוי
אני &לא מסכים לתנאי הסכם הרישוי
&התקן
&הסר
ביטול
סגור
עיין...
הצג פרטים
סגור&
&עיין...
ה&צג פרטים
שם
הפעולה הושלמה
מותאם אישית

View file

@ -279,7 +279,7 @@ CEXEBuild::CEXEBuild()
m_inst_fileused=0;
m_uninst_fileused=0;
branding_image_found=false; // Added by Amir Szekely 22nd July 2002
branding_image_found=false;
no_space_texts=false;
@ -304,6 +304,11 @@ CEXEBuild::CEXEBuild()
enable_last_page_cancel=0;
uenable_last_page_cancel=0;
next_used=false;
install_used=false;
comppage_used=false;
license_force_radio_used=false;
notify_hwnd=0;
}
@ -1394,8 +1399,12 @@ int CEXEBuild::write_output(void)
install_used = true;
}
#ifdef NSIS_CONFIG_LICENSEPAGE
if (p->id==NSIS_PAGE_LICENSE)
p->next=LANG_BTN_LICENSE;
if (p->id==NSIS_PAGE_LICENSE) {
if (build_header.common.flags&CH_FLAGS_LICENSE_FORCE_SELECTION)
p->button_states|=16;
else
p->next=LANG_BTN_LICENSE;
}
#endif
if (p->id==NSIS_PAGE_INSTFILES || p->id==NSIS_PAGE_COMPLETED)
p->button_states&=~6;

View file

@ -146,7 +146,7 @@ class CEXEBuild {
int uninstall_generate();
void set_uninstall_mode(int un);
// lang.cpp by Amir Szekely 3rd August 2002
// lang.cpp functions and vars
StringTable *GetTable(LANGID &lang);
int SetString(char *string, int id, int process, LANGID lang=0);
int SetString(char *string, int id, int process, StringTable *table);
@ -159,7 +159,7 @@ class CEXEBuild {
#define IsSet(s,lang) _IsSet(string_tables.size()?&(string_tables[0]->s):0,lang)
bool _IsSet(int *str, LANGID lang); // Checks if a string is set in a given string table
bool next_used, install_used, comppage_used;
bool next_used, install_used, comppage_used, license_force_radio_used;
// a whole bunch O data.

View file

@ -553,7 +553,7 @@ nextPage:
SetWindowLong(hwndtmp,GWL_STYLE,GetWindowLong(hwndtmp,GWL_STYLE)&~BS_DEFPUSHBUTTON);
ShowWindow(hwndtmp,this_page->button_states&SW_SHOWNA);// SW_HIDE = 0, SW_SHOWNA = 8
EnableWindow(hwndtmp,this_page->button_states&2);
EnableWindow(m_hwndOK,1);
EnableWindow(m_hwndOK,!(this_page->button_states&16));
EnableWindow(m_hwndCancel,this_page->button_states&4);
mystrcpy(g_tmp,g_caption);
@ -678,6 +678,12 @@ static BOOL CALLBACK LicenseProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
if (uMsg == WM_INITDIALOG)
{
EDITSTREAM es={(DWORD)LANG_STR(LANG_LICENSE_DATA),0,StreamLicense};
SetUITextFromLang(IDC_LICENSEAGREE,LANG_BTN_LICENSE_AGREE);
SetUITextFromLang(IDC_LICENSEDISAGREE,LANG_BTN_LICENSE_DISAGREE);
SendMessage(GetUIItem(IDC_LICENSEAGREE+!hwLicense), BM_SETCHECK, BST_CHECKED, 0);
EnableWindow(m_hwndOK, (BOOL)hwLicense | !(inst_flags&CH_FLAGS_LICENSE_FORCE_SELECTION));
hwLicense=GetUIItem(IDC_EDIT1);
SendMessage(hwLicense,EM_AUTOURLDETECT,TRUE,0);
SendMessage(hwLicense,EM_SETBKGNDCOLOR,0,g_inst_header->license_bg>=0?g_inst_header->license_bg:GetSysColor(COLOR_BTNFACE));
@ -692,6 +698,10 @@ static BOOL CALLBACK LicenseProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
return FALSE;
//End Xge
}
if (uMsg == WM_COMMAND && HIWORD(wParam) == BN_CLICKED) {
if (inst_flags&CH_FLAGS_LICENSE_FORCE_SELECTION)
EnableWindow(m_hwndOK, IsDlgButtonChecked(hwndDlg, IDC_LICENSEAGREE) & BST_CHECKED);
}
if (uMsg == WM_NOTIFY) {
#define nmhdr ((NMHDR *)lParam)
#define enlink ((ENLINK *)lParam)

View file

@ -310,6 +310,9 @@ typedef struct
#define CH_FLAGS_COMP_ONLY_ON_CUSTOM 256
#define CH_FLAGS_NO_CUSTOM 512
#endif
#ifdef NSIS_CONFIG_LICENSEPAGE
#define CH_FLAGS_LICENSE_FORCE_SELECTION 1024
#endif
// Settings common to both installers and uninstallers
typedef struct
@ -361,6 +364,8 @@ typedef struct
int licensetext; // license page text
int licensedata; // license text
int licensebutton; // license button text
int licensebuttonagree; // agree check box/radio button
int licensebuttondisagree; // disagree check box/radio button
#endif//NSIS_CONFIG_LICENSEPAGE
#else
int foo;

View file

@ -58,6 +58,8 @@
#define LANG_LICENSE_TEXT (INSTALL_STR(licensetext))
#define LANG_LICENSE_DATA (INSTALL_STR(licensedata))
#define LANG_BTN_LICENSE (INSTALL_STR(licensebutton))
#define LANG_BTN_LICENSE_AGREE (INSTALL_STR(licensebuttonagree))
#define LANG_BTN_LICENSE_DISAGREE (INSTALL_STR(licensebuttondisagree))
#define UNINSTALL_STR(x) (~((sizeof(common_strings) + FIELD_OFFSET(uninstall_strings, x)) / sizeof(int)))

View file

@ -37,6 +37,8 @@
#define IDC_ULICON 1031
#define IDC_TREE1 1032
#define IDC_BRANDIMAGE 1033
#define IDC_LICENSEAGREE 1034
#define IDC_LICENSEDISAGREE 1035
// Next default values for new objects
//
@ -44,7 +46,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 112
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1034
#define _APS_NEXT_CONTROL_VALUE 1036
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View file

@ -7,7 +7,7 @@
extern const char *NSIS_VERSION;
extern char *english_strings[] = {
char *english_strings[] = {
"Nullsoft Install System %s",
"%s Setup",
"%s Uninstall",
@ -22,6 +22,8 @@ extern char *english_strings[] = {
"< &Back",
"&Next >",
"I &Agree",
"I &accept the terms in the License Agreement",
"I &do not accept the terms in the License Agreement",
"&Install",
"&Uninstall",
"Cancel",
@ -125,32 +127,31 @@ int CEXEBuild::SetString(char *string, int id, int process, StringTable *table)
HANDLE_STRING_C(NLF_BTN_CANCEL, common.cancelbutton);
HANDLE_STRING_C(NLF_BTN_CLOSE, common.closebutton);
HANDLE_STRING_C(NLF_BTN_DETAILS, common.showdetailsbutton);
#endif
#ifdef NSIS_CONFIG_LICENSEPAGE
#ifdef NSIS_SUPPORT_FILE
HANDLE_STRING_C(NLF_FILE_ERROR, common.fileerrtext);
#endif
#ifdef NSIS_CONFIG_VISIBLE_SUPPORT
HANDLE_STRING_I(NLF_CAPTION, common.caption);
HANDLE_STRING_I(NLF_SUBCAPTION_LICENSE, common.subcaptions[0]);
HANDLE_STRING_I(NLF_SUBCAPTION_OPTIONS, common.subcaptions[1]);
HANDLE_STRING_I(NLF_SUBCAPTION_DIR, common.subcaptions[2]);
HANDLE_STRING_I(NLF_SUBCAPTION_INSTFILES, common.subcaptions[3]);
HANDLE_STRING_I(NLF_SUBCAPTION_COMPLETED, common.subcaptions[4]);
HANDLE_STRING_I(NLF_BTN_LICENSE, installer.licensebutton);
#endif
HANDLE_STRING_I(NLF_BTN_INSTALL, installer.installbutton);
HANDLE_STRING_I(NLF_BTN_BROWSE, installer.browse);
#ifdef NSIS_CONFIG_COMPONENTPAGE
HANDLE_STRING_I(NLF_COMP_SUBTEXT1, installer.componentsubtext[0]);
HANDLE_STRING_I(NLF_COMP_SUBTEXT2, installer.componentsubtext[1]);
HANDLE_STRING_I(SLANG_COMP_TEXT, installer.componenttext);
#endif
#ifdef NSIS_CONFIG_LICENSEPAGE
HANDLE_STRING_I(NLF_BTN_LICENSE, installer.licensebutton);
HANDLE_STRING_I(NLF_BTN_LICENSE_AGREE, installer.licensebuttonagree);
HANDLE_STRING_I(NLF_BTN_LICENSE_DISAGREE, installer.licensebuttondisagree);
HANDLE_STRING_I(SLANG_LICENSE_TEXT, installer.licensetext);
HANDLE_STRING_I(SLANG_LICENSE_DATA, installer.licensedata);
#endif
HANDLE_STRING_I(SLANG_DIR_TEXT, installer.text);
HANDLE_STRING_I(NLF_COMP_CUSTOM, installer.custom);
HANDLE_STRING_I(NLF_DIR_SUBTEXT, installer.dirsubtext);
HANDLE_STRING_I(NLF_SPACE_AVAIL, installer.spaceavailable);
HANDLE_STRING_I(NLF_SPACE_REQ, installer.spacerequired);
#ifdef NSIS_CONFIG_UNINSTALL_SUPPORT
HANDLE_STRING_U(NLF_UCAPTION, ucommon.caption);
HANDLE_STRING_U(NLF_USUBCAPTION_CONFIRM, ucommon.subcaptions[0]);
@ -158,27 +159,15 @@ int CEXEBuild::SetString(char *string, int id, int process, StringTable *table)
HANDLE_STRING_U(NLF_USUBCAPTION_COMPLETED, ucommon.subcaptions[2]);
HANDLE_STRING_U(NLF_BTN_UNINSTALL, uninstall.uninstbutton);
HANDLE_STRING_U(NLF_UNINST_SUBTEXT, uninstall.uninstalltext2);
HANDLE_STRING_U(SLANG_UNINST_TEXT, uninstall.uninstalltext);
#endif
#endif
#endif //NSIS_CONFIG_VISIBLE_SUPPORT
HANDLE_STRING_C(SLANG_NAME, common.name);
#ifdef NSIS_CONFIG_COMPONENTPAGE
HANDLE_STRING_I(SLANG_COMP_TEXT, installer.componenttext);
#endif
#ifdef NSIS_CONFIG_LICENSEPAGE
HANDLE_STRING_I(SLANG_LICENSE_TEXT, installer.licensetext);
HANDLE_STRING_I(SLANG_LICENSE_DATA, installer.licensedata);
#endif
#ifdef NSIS_CONFIG_VISIBLE_SUPPORT
HANDLE_STRING_I(SLANG_DIR_TEXT, installer.text);
#endif
#ifdef NSIS_CONFIG_UNINSTALL_SUPPORT
HANDLE_STRING_U(SLANG_UNINST_TEXT, uninstall.uninstalltext);
#ifdef NSIS_SUPPORT_FILE
HANDLE_STRING_C(NLF_FILE_ERROR, common.fileerrtext);
#endif
default:
@ -400,6 +389,8 @@ void CEXEBuild::FillDefaultsIfNeeded(StringTable *table, NLF *nlf/*=0*/) {
{
table->installer.licensedata=0;
table->installer.licensetext=0;
table->installer.licensebuttonagree=0;
table->installer.licensebuttondisagree=0;
}
if (table->installer.licensedata)
@ -408,6 +399,12 @@ void CEXEBuild::FillDefaultsIfNeeded(StringTable *table, NLF *nlf/*=0*/) {
table->common.subcaptions[0]=add_string_main(str(NLF_SUBCAPTION_LICENSE));
if (!table->installer.licensebutton)
table->installer.licensebutton=add_string_main(str(NLF_BTN_LICENSE),0);
if (build_header.common.flags&CH_FLAGS_LICENSE_FORCE_SELECTION) {
if (!table->installer.licensebuttonagree)
table->installer.licensebuttonagree=add_string_main(str(NLF_BTN_LICENSE_AGREE),0);
if (!table->installer.licensebuttondisagree && license_force_radio_used)
table->installer.licensebuttondisagree=add_string_main(str(NLF_BTN_LICENSE_DISAGREE),0);
}
}
#endif //NSIS_CONFIG_LICENSEPAGE

View file

@ -17,8 +17,8 @@ struct StringTable {
GrowBuf user_ustrings;
};
#define NLF_VERSION 2
#define NLF_STRINGS 57
#define NLF_VERSION 3
#define NLF_STRINGS 59
enum {
NLF_BRANDING,
@ -35,6 +35,8 @@ enum {
NLF_BTN_BACK,
NLF_BTN_NEXT,
NLF_BTN_LICENSE,
NLF_BTN_LICENSE_AGREE,
NLF_BTN_LICENSE_DISAGREE,
NLF_BTN_INSTALL,
NLF_BTN_UNINSTALL,
NLF_BTN_CANCEL,

View file

@ -1060,7 +1060,102 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
SCRIPT_MSG("LicenseData: \"%s\"\n",line.gettoken_str(a));
}
return make_sure_not_in_secorfunc(line.gettoken_str(0));
// Added by Amir Szekely 30th July 2002
case TOK_LICENSEFORCESELECTION:
{
int k=line.gettoken_enum(1,"off\0checkbox\0radiobuttons\0");
if (k == -1) PRINTHELP()
try {
init_res_editor();
BYTE* dlg = res_editor->GetResource(RT_DIALOG, MAKEINTRESOURCE(IDD_LICENSE), MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
if (!dlg) throw runtime_error("IDD_LICENSE doesn't exist!");
CDialogTemplate dt(dlg);
free(dlg);
switch (k) {
case 0:
build_header.common.flags&=~CH_FLAGS_LICENSE_FORCE_SELECTION;
dt.RemoveItem(IDC_LICENSEAGREE);
dt.RemoveItem(IDC_LICENSEDISAGREE);
break;
case 1:
{
build_header.common.flags|=CH_FLAGS_LICENSE_FORCE_SELECTION;
DialogItemTemplate *licenseData = dt.GetItem(IDC_EDIT1);
DialogItemTemplate *item;
for (int i = 0; item = dt.GetItemByIdx(i); i++) {
if (item->sY >= licenseData->sY + licenseData->sHeight) {
item->sY -= 10;
}
}
licenseData->sHeight -= 10;
DialogItemTemplate checkBox = {
0,
0,
dt.GetHeight() - 9,
dt.GetWidth(),
9,
0,
BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP,
IDC_LICENSEAGREE,
MAKEINTRESOURCE(0x0080),
};
dt.AddItem(checkBox);
break;
}
case 2:
{
build_header.common.flags|=CH_FLAGS_LICENSE_FORCE_SELECTION;
license_force_radio_used=true;
DialogItemTemplate *licenseData = dt.GetItem(IDC_EDIT1);
DialogItemTemplate *item;
for (int i = 0; item = dt.GetItemByIdx(i); i++) {
if (item->sY >= licenseData->sY + licenseData->sHeight) {
item->sY -= 20;
}
}
licenseData->sHeight -= 20;
DialogItemTemplate radionButton = {
0,
0,
dt.GetHeight() - 9,
dt.GetWidth(),
9,
0,
BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP,
IDC_LICENSEDISAGREE,
MAKEINTRESOURCE(0x0080),
};
dt.AddItem(radionButton);
radionButton.sY -= 10;
radionButton.wId = IDC_LICENSEAGREE;
dt.AddItem(radionButton);
}
}
DWORD dwSize;
dlg = dt.Save(dwSize);
res_editor->UpdateResource(RT_DIALOG, MAKEINTRESOURCE(IDD_LICENSE), 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;
}
}
return make_sure_not_in_secorfunc(line.gettoken_str(0));
case TOK_LICENSEBKCOLOR:
{
char *p = line.gettoken_str(1);

View file

@ -97,6 +97,7 @@ static tokenType tokenlist[TOK__LAST] =
{TOK_LANGSTRING,"LangString",3,0,"[un.]name lang_id string"},
{TOK_LANGSTRINGUP,"LangStringUP",3,0,"[un.]name lang_id string"},
{TOK_LICENSEDATA,"LicenseData",1,1,"[/LANG=lang_id] local_file_that_has_license_text.txt"},
{TOK_LICENSEFORCESELECTION,"LicenseForceSelection",1,0,"checkbox|radiobuttons|off"},
{TOK_LICENSETEXT,"LicenseText",1,2,"[/LANG=lang_id] license_page_description [license_button_text]"},
{TOK_LICENSEBKCOLOR,"LicenseBkColor",1,0,"background_color"},
{TOK_LOADNLF,"LoadLanguageFile",1,0,"language.nlf"},

View file

@ -16,6 +16,7 @@ enum
TOK_COMPTEXT,
TOK_LICENSETEXT,
TOK_LICENSEDATA,
TOK_LICENSEFORCESELECTION,
TOK_LICENSEBKCOLOR,
TOK_UNINSTTEXT,
TOK_SILENTINST,