BrandingText control trimming option added

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@763 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2002-08-28 10:07:18 +00:00
parent 23a2d14a80
commit df398575ae
2 changed files with 38 additions and 3 deletions

View file

@ -1751,9 +1751,44 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
{
int a = 1;
WORD lang = 0;
if (!strnicmp(line.gettoken_str(a),"/LANG=",6)) lang=atoi(line.gettoken_str(a++)+6);
int trim = 0;
while (line.gettoken_str(a)[0] == '/') {
if (!strnicmp(line.gettoken_str(a),"/LANG=",6)) lang=atoi(line.gettoken_str(a++)+6);
if (!strnicmp(line.gettoken_str(a),"/TRIM",5)) {
if (!stricmp(line.gettoken_str(a)+5,"LEFT")) trim = 1;
else if (!stricmp(line.gettoken_str(a)+5,"RIGHT")) trim = 2;
else if (!stricmp(line.gettoken_str(a)+5,"CENTER")) trim = 3;
a++;
}
}
if (line.getnumtokens()!=a+1) PRINTHELP();
SetString(line.gettoken_str(a),NLF_BRANDING,0,lang);
if (trim) try {
build_compressor_set=true;
CResourceEditor re(header_data_new, exeheader_size_new);
BYTE* dlg = re.GetResource(RT_DIALOG, MAKEINTRESOURCE(IDD_INST), MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
CDialogTemplate td(dlg);
free(dlg);
switch (trim) {
case 1: td.LTrimToString(IDC_VERSTR, line.gettoken_str(a), 1); break;
case 2: td.RTrimToString(IDC_VERSTR, line.gettoken_str(a), 1); break;
case 3: td.CTrimToString(IDC_VERSTR, line.gettoken_str(a), 1); break;
}
DWORD dwSize;
dlg = td.Save(dwSize);
re.UpdateResource(RT_DIALOG, MAKEINTRESOURCE(IDD_INST), MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), dlg, dwSize);
free(dlg);
free(header_data_new);
header_data_new = re.Save((DWORD&)exeheader_size_new);
}
catch (exception& err) {
ERROR_MSG("Error while triming branding text control: %s\n", err.what());
return PS_ERROR;
}
SCRIPT_MSG("BrandingText: \"%s\"\n",line.gettoken_str(a));
}
return make_sure_not_in_secorfunc(line.gettoken_str(0));
@ -3357,7 +3392,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
case TOK_SETLANG:
ent.which=EW_SETLANG;
ent.offsets[0]=add_string(line.gettoken_str(1));
SCRIPT_MSG("SetLanguage: language=%s", line.gettoken_str(1));
SCRIPT_MSG("SetLanguage: language=%s\n", line.gettoken_str(1));
return add_entry(&ent);
// end of instructions

View file

@ -22,7 +22,7 @@ static tokenType tokenlist[TOK__LAST] =
{TOK_ADDSIZE,"AddSize",1,0,"size_to_add_to_section_in_kb"},
{TOK_AUTOCLOSE,"AutoCloseWindow",1,0,"(false|true)"},
{TOK_BGGRADIENT,"BGGradient",0,3,"(off | [top_color [bottom_color [text_color]]])"},
{TOK_BRANDINGTEXT,"BrandingText",1,1,"[/LANG=lang_id] installer_text"},
{TOK_BRANDINGTEXT,"BrandingText",1,2,"[/LANG=lang_id] [/TRIM(LEFT|RIGHT|CENTER)] installer_text"},
{TOK_BRINGTOFRONT,"BringToFront",0,0,""},
{TOK_CALL,"Call",1,0,"function_name | [:label_name]"},
{TOK_CALLINSTDLL,"CallInstDLL",2,0,"dll_path_on_target.dll function"},