- Fixed and improved SetFont
- Fixed WindowIcon git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@2852 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
f1a8c1950a
commit
04234ccac2
7 changed files with 140 additions and 124 deletions
|
@ -251,10 +251,15 @@ DialogItemTemplate* CDialogTemplate::GetItemByIdx(DWORD i) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Removes an item
|
// Removes an item
|
||||||
void CDialogTemplate::RemoveItem(WORD wId) {
|
// Returns 1 if removed, 0 otherwise
|
||||||
for (unsigned int i = 0; i < m_vItems.size(); i++)
|
int CDialogTemplate::RemoveItem(WORD wId) {
|
||||||
if (m_vItems[i]->wId == wId)
|
for (unsigned int i = 0; i < m_vItems.size(); i++) {
|
||||||
|
if (m_vItems[i]->wId == wId) {
|
||||||
m_vItems.erase(m_vItems.begin() + i);
|
m_vItems.erase(m_vItems.begin() + i);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef DS_SHELLFONT
|
#ifndef DS_SHELLFONT
|
||||||
|
|
|
@ -96,7 +96,7 @@ public:
|
||||||
short GetHeight();
|
short GetHeight();
|
||||||
DialogItemTemplate* GetItem(WORD wId);
|
DialogItemTemplate* GetItem(WORD wId);
|
||||||
DialogItemTemplate* GetItemByIdx(DWORD i);
|
DialogItemTemplate* GetItemByIdx(DWORD i);
|
||||||
void RemoveItem(WORD wId);
|
int RemoveItem(WORD wId);
|
||||||
void SetFont(char* szFaceName, WORD wFontSize);
|
void SetFont(char* szFaceName, WORD wFontSize);
|
||||||
void AddItem(DialogItemTemplate item);
|
void AddItem(DialogItemTemplate item);
|
||||||
HWND CreateDummyDialog();
|
HWND CreateDummyDialog();
|
||||||
|
|
|
@ -8,8 +8,9 @@
|
||||||
#include "build.h"
|
#include "build.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
#include "ResourceEditor.h"
|
|
||||||
#include "exehead/resource.h"
|
#include "exehead/resource.h"
|
||||||
|
#include "ResourceEditor.h"
|
||||||
|
#include "DialogTemplate.h"
|
||||||
#include "ResourceVersionInfo.h"
|
#include "ResourceVersionInfo.h"
|
||||||
|
|
||||||
bool isSimpleChar(char ch)
|
bool isSimpleChar(char ch)
|
||||||
|
@ -337,6 +338,9 @@ CEXEBuild::CEXEBuild()
|
||||||
build_langstring_num=0;
|
build_langstring_num=0;
|
||||||
ubuild_langstring_num=0;
|
ubuild_langstring_num=0;
|
||||||
|
|
||||||
|
build_font[0]=NULL;
|
||||||
|
build_font_size=0;
|
||||||
|
|
||||||
m_unicon_data=(unsigned char *)malloc(unicondata_size+3*sizeof(DWORD));
|
m_unicon_data=(unsigned char *)malloc(unicondata_size+3*sizeof(DWORD));
|
||||||
memcpy(m_unicon_data+2*sizeof(DWORD),unicon_data+22,unicondata_size);
|
memcpy(m_unicon_data+2*sizeof(DWORD),unicon_data+22,unicondata_size);
|
||||||
*(DWORD*)(m_unicon_data) = unicondata_size;
|
*(DWORD*)(m_unicon_data) = unicondata_size;
|
||||||
|
@ -344,9 +348,6 @@ CEXEBuild::CEXEBuild()
|
||||||
*(DWORD*)(m_unicon_data + 2*sizeof(DWORD) + unicondata_size) = 0;
|
*(DWORD*)(m_unicon_data + 2*sizeof(DWORD) + unicondata_size) = 0;
|
||||||
unicondata_size += 3*sizeof(DWORD);
|
unicondata_size += 3*sizeof(DWORD);
|
||||||
|
|
||||||
m_inst_fileused=0;
|
|
||||||
m_uninst_fileused=0;
|
|
||||||
|
|
||||||
branding_image_found=false;
|
branding_image_found=false;
|
||||||
|
|
||||||
no_space_texts=false;
|
no_space_texts=false;
|
||||||
|
@ -364,6 +365,8 @@ CEXEBuild::CEXEBuild()
|
||||||
|
|
||||||
license_res_id=IDD_LICENSE;
|
license_res_id=IDD_LICENSE;
|
||||||
|
|
||||||
|
disable_window_icon=0;
|
||||||
|
|
||||||
notify_hwnd=0;
|
notify_hwnd=0;
|
||||||
|
|
||||||
defcodepage_set=false;
|
defcodepage_set=false;
|
||||||
|
@ -1828,6 +1831,31 @@ again:
|
||||||
|
|
||||||
SCRIPT_MSG("Done!\n");
|
SCRIPT_MSG("Done!\n");
|
||||||
|
|
||||||
|
#define REMOVE_ICON(id) if (disable_window_icon) { \
|
||||||
|
BYTE* dlg = res_editor->GetResource(RT_DIALOG, MAKEINTRESOURCE(id), MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); \
|
||||||
|
if (dlg) { \
|
||||||
|
CDialogTemplate dt(dlg,uDefCodePage); \
|
||||||
|
free(dlg); \
|
||||||
|
if (dt.RemoveItem(IDC_ULICON)) { \
|
||||||
|
DialogItemTemplate* text = dt.GetItem(IDC_INTROTEXT); \
|
||||||
|
DialogItemTemplate* prog = dt.GetItem(IDC_PROGRESS); \
|
||||||
|
if (text) { \
|
||||||
|
text->sWidth += text->sX; \
|
||||||
|
text->sX = 0; \
|
||||||
|
} \
|
||||||
|
if (prog) { \
|
||||||
|
prog->sWidth += prog->sX; \
|
||||||
|
prog->sX = 0; \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
DWORD dwSize; \
|
||||||
|
dlg = dt.Save(dwSize); \
|
||||||
|
res_editor->UpdateResource(RT_DIALOG, MAKEINTRESOURCE(id), MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), dlg, dwSize); \
|
||||||
|
} \
|
||||||
|
free(dlg); \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
SCRIPT_MSG("Removing unused resources... ");
|
SCRIPT_MSG("Removing unused resources... ");
|
||||||
init_res_editor();
|
init_res_editor();
|
||||||
|
@ -1835,30 +1863,37 @@ again:
|
||||||
if (!license_normal) {
|
if (!license_normal) {
|
||||||
res_editor->UpdateResource(RT_DIALOG, IDD_LICENSE, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), 0, 0);
|
res_editor->UpdateResource(RT_DIALOG, IDD_LICENSE, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), 0, 0);
|
||||||
}
|
}
|
||||||
|
else REMOVE_ICON(IDD_LICENSE);
|
||||||
if (!license_fsrb) {
|
if (!license_fsrb) {
|
||||||
res_editor->UpdateResource(RT_DIALOG, IDD_LICENSE_FSRB, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), 0, 0);
|
res_editor->UpdateResource(RT_DIALOG, IDD_LICENSE_FSRB, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), 0, 0);
|
||||||
}
|
}
|
||||||
|
else REMOVE_ICON(IDD_LICENSE_FSRB);
|
||||||
if (!license_fscb) {
|
if (!license_fscb) {
|
||||||
res_editor->UpdateResource(RT_DIALOG, IDD_LICENSE_FSCB, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), 0, 0);
|
res_editor->UpdateResource(RT_DIALOG, IDD_LICENSE_FSCB, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), 0, 0);
|
||||||
}
|
}
|
||||||
|
else REMOVE_ICON(IDD_LICENSE_FSCB);
|
||||||
#endif // NSIS_CONFIG_LICENSEPAGE
|
#endif // NSIS_CONFIG_LICENSEPAGE
|
||||||
#ifdef NSIS_CONFIG_COMPONENTPAGE
|
#ifdef NSIS_CONFIG_COMPONENTPAGE
|
||||||
if (!selcom) {
|
if (!selcom) {
|
||||||
res_editor->UpdateResource(RT_DIALOG, IDD_SELCOM, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), 0, 0);
|
res_editor->UpdateResource(RT_DIALOG, IDD_SELCOM, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), 0, 0);
|
||||||
res_editor->UpdateResource(RT_BITMAP, IDB_BITMAP1, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), 0, 0);
|
res_editor->UpdateResource(RT_BITMAP, IDB_BITMAP1, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), 0, 0);
|
||||||
}
|
}
|
||||||
|
else REMOVE_ICON(IDD_SELCOM);
|
||||||
#endif // NSIS_CONFIG_COMPONENTPAGE
|
#endif // NSIS_CONFIG_COMPONENTPAGE
|
||||||
if (!dir) {
|
if (!dir) {
|
||||||
res_editor->UpdateResource(RT_DIALOG, IDD_DIR, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), 0, 0);
|
res_editor->UpdateResource(RT_DIALOG, IDD_DIR, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), 0, 0);
|
||||||
}
|
}
|
||||||
|
else REMOVE_ICON(IDD_DIR);
|
||||||
#ifdef NSIS_CONFIG_UNINSTALL_SUPPORT
|
#ifdef NSIS_CONFIG_UNINSTALL_SUPPORT
|
||||||
if (!uninstconfirm) {
|
if (!uninstconfirm) {
|
||||||
res_editor->UpdateResource(RT_DIALOG, IDD_UNINST, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), 0, 0);
|
res_editor->UpdateResource(RT_DIALOG, IDD_UNINST, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), 0, 0);
|
||||||
}
|
}
|
||||||
|
else REMOVE_ICON(IDD_UNINST);
|
||||||
#endif // NSIS_CONFIG_UNINSTALL_SUPPORT
|
#endif // NSIS_CONFIG_UNINSTALL_SUPPORT
|
||||||
if (!instlog) {
|
if (!instlog) {
|
||||||
res_editor->UpdateResource(RT_DIALOG, IDD_INSTFILES, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), 0, 0);
|
res_editor->UpdateResource(RT_DIALOG, IDD_INSTFILES, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), 0, 0);
|
||||||
}
|
}
|
||||||
|
else REMOVE_ICON(IDD_INSTFILES);
|
||||||
if (!main) {
|
if (!main) {
|
||||||
res_editor->UpdateResource(RT_DIALOG, IDD_INST, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), 0, 0);
|
res_editor->UpdateResource(RT_DIALOG, IDD_INST, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), 0, 0);
|
||||||
if (!build_compress_whole && !build_crcchk)
|
if (!build_compress_whole && !build_crcchk)
|
||||||
|
|
|
@ -234,6 +234,8 @@ class CEXEBuild {
|
||||||
LANGID last_used_lang;
|
LANGID last_used_lang;
|
||||||
LangStringList build_langstrings;
|
LangStringList build_langstrings;
|
||||||
int build_langstring_num, ubuild_langstring_num;
|
int build_langstring_num, ubuild_langstring_num;
|
||||||
|
char build_font[1024];
|
||||||
|
int build_font_size;
|
||||||
|
|
||||||
unsigned int uDefCodePage;
|
unsigned int uDefCodePage;
|
||||||
|
|
||||||
|
@ -243,6 +245,8 @@ class CEXEBuild {
|
||||||
int cur_page_type;
|
int cur_page_type;
|
||||||
int enable_last_page_cancel, uenable_last_page_cancel;
|
int enable_last_page_cancel, uenable_last_page_cancel;
|
||||||
|
|
||||||
|
int disable_window_icon;
|
||||||
|
|
||||||
// User variables stuff
|
// User variables stuff
|
||||||
int GetUserVarIndex(LineParser &line, int token);
|
int GetUserVarIndex(LineParser &line, int token);
|
||||||
// Added by ramon 3 jun 2003
|
// Added by ramon 3 jun 2003
|
||||||
|
@ -320,8 +324,6 @@ class CEXEBuild {
|
||||||
unsigned char *header_data_new;
|
unsigned char *header_data_new;
|
||||||
int exeheader_size_new;
|
int exeheader_size_new;
|
||||||
int icon_offset;
|
int icon_offset;
|
||||||
int m_inst_fileused;
|
|
||||||
int m_uninst_fileused;
|
|
||||||
bool branding_image_found; // Added by Amir Szekely 29nd July 2002
|
bool branding_image_found; // Added by Amir Szekely 29nd July 2002
|
||||||
WORD branding_image_id; // Added by Amir Szekely 29nd July 2002
|
WORD branding_image_id; // Added by Amir Szekely 29nd July 2002
|
||||||
unsigned char *m_unicon_data;
|
unsigned char *m_unicon_data;
|
||||||
|
|
|
@ -292,6 +292,50 @@ int CEXEBuild::GenerateLangTables() {
|
||||||
lt = (LanguageTable*)lang_tables.get();
|
lt = (LanguageTable*)lang_tables.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Apply default font
|
||||||
|
if (*build_font)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
init_res_editor();
|
||||||
|
|
||||||
|
#define ADD_FONT(id) { \
|
||||||
|
BYTE* dlg = res_editor->GetResource(RT_DIALOG, MAKEINTRESOURCE(id), MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); \
|
||||||
|
if (dlg) { \
|
||||||
|
CDialogTemplate td(dlg); \
|
||||||
|
free(dlg); \
|
||||||
|
td.SetFont(build_font, build_font_size); \
|
||||||
|
DWORD dwSize; \
|
||||||
|
dlg = td.Save(dwSize); \
|
||||||
|
res_editor->UpdateResource(RT_DIALOG, MAKEINTRESOURCE(id), MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), dlg, dwSize); \
|
||||||
|
free(dlg); \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef NSIS_CONFIG_LICENSEPAGE
|
||||||
|
ADD_FONT(IDD_LICENSE);
|
||||||
|
ADD_FONT(IDD_LICENSE_FSRB);
|
||||||
|
ADD_FONT(IDD_LICENSE_FSCB);
|
||||||
|
#endif
|
||||||
|
ADD_FONT(IDD_DIR);
|
||||||
|
#ifdef NSIS_CONFIG_COMPONENTPAGE
|
||||||
|
ADD_FONT(IDD_SELCOM);
|
||||||
|
#endif
|
||||||
|
ADD_FONT(IDD_INST);
|
||||||
|
ADD_FONT(IDD_INSTFILES);
|
||||||
|
#ifdef NSIS_CONFIG_UNINSTALL_SUPPORT
|
||||||
|
ADD_FONT(IDD_UNINST);
|
||||||
|
#endif
|
||||||
|
#ifdef NSIS_CONFIG_CRC_SUPPORT
|
||||||
|
ADD_FONT(IDD_VERIFY);
|
||||||
|
#endif
|
||||||
|
#undef ADD_FONT
|
||||||
|
}
|
||||||
|
catch (exception& err) {
|
||||||
|
ERROR_MSG("Error while applying font: %s\n", err.what());
|
||||||
|
return PS_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Fill tables with defaults (if needed) and with instruction strings
|
// Fill tables with defaults (if needed) and with instruction strings
|
||||||
// Create language specific resources (currently only dialogs with different fonts)
|
// Create language specific resources (currently only dialogs with different fonts)
|
||||||
int num_lang_tables = lang_tables.getlen() / sizeof(LanguageTable);
|
int num_lang_tables = lang_tables.getlen() / sizeof(LanguageTable);
|
||||||
|
@ -299,11 +343,14 @@ int CEXEBuild::GenerateLangTables() {
|
||||||
int cur_offset = num_lang_tables == 1 ? 0 : 100;
|
int cur_offset = num_lang_tables == 1 ? 0 : 100;
|
||||||
for (i = 0; i < num_lang_tables; i++)
|
for (i = 0; i < num_lang_tables; i++)
|
||||||
{
|
{
|
||||||
if (lt[i].nlf.m_bLoaded && (lt[i].nlf.m_szFont || lt[i].nlf.m_bRTL))
|
if ((lt[i].nlf.m_szFont && !*build_font) || lt[i].nlf.m_bRTL)
|
||||||
{
|
{
|
||||||
lt[i].dlg_offset = cur_offset;
|
lt[i].dlg_offset = cur_offset;
|
||||||
|
|
||||||
char *font = lt[i].nlf.m_szFont;
|
char *font = lt[i].nlf.m_szFont;
|
||||||
|
if (*build_font) font = 0;
|
||||||
|
|
||||||
|
SCRIPT_MSG("setting %d to %s\n", lt[i].lang_id, font);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
init_res_editor();
|
init_res_editor();
|
||||||
|
@ -342,7 +389,7 @@ int CEXEBuild::GenerateLangTables() {
|
||||||
#undef ADD_FONT
|
#undef ADD_FONT
|
||||||
}
|
}
|
||||||
catch (exception& err) {
|
catch (exception& err) {
|
||||||
ERROR_MSG("Error while applying NLF font/RTL for %s: %s\n", err.what());
|
ERROR_MSG("Error while applying NLF font/RTL: %s\n", err.what());
|
||||||
return PS_ERROR;
|
return PS_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -627,59 +674,56 @@ LanguageTable * CEXEBuild::LoadLangFile(char *filename) {
|
||||||
char *p, *p2, t;
|
char *p, *p2, t;
|
||||||
|
|
||||||
p = strrchr(filename, '.');
|
p = strrchr(filename, '.');
|
||||||
if (p)
|
if (p) {
|
||||||
{
|
|
||||||
t = *p;
|
t = *p;
|
||||||
*p = 0;
|
*p = 0;
|
||||||
}
|
}
|
||||||
p2 = strrchr(filename, '\\');
|
p2 = strrchr(filename, '\\');
|
||||||
if (p2)
|
if (p2) {
|
||||||
{
|
|
||||||
p2++;
|
p2++;
|
||||||
nlf->m_szName = (char*)malloc(strlen(p2)+1);
|
nlf->m_szName = (char*)malloc(strlen(p2)+1);
|
||||||
strcpy(nlf->m_szName, p2);
|
strcpy(nlf->m_szName, p2);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
nlf->m_szName = (char*)malloc(strlen(filename)+1);
|
nlf->m_szName = (char*)malloc(strlen(filename)+1);
|
||||||
strcpy(nlf->m_szName, filename);
|
strcpy(nlf->m_szName, filename);
|
||||||
}
|
}
|
||||||
if (p) *p = t;
|
if (p) *p = t;
|
||||||
|
|
||||||
if (nlf_version != NLF_VERSION)
|
if (nlf_version != NLF_VERSION) {
|
||||||
{
|
|
||||||
warning_fl("%s language file version doesn't match. Using default English texts for missing strings.", nlf->m_szName);
|
warning_fl("%s language file version doesn't match. Using default English texts for missing strings.", nlf->m_szName);
|
||||||
}
|
}
|
||||||
|
|
||||||
int temp;
|
int temp;
|
||||||
|
|
||||||
// Get font
|
// Get font
|
||||||
nlf->m_szFont = NULL;
|
|
||||||
nlf->m_iFontSize = 0;
|
|
||||||
|
|
||||||
buf[0] = SkipComments(f);
|
buf[0] = SkipComments(f);
|
||||||
fgets(buf+1, NSIS_MAX_STRLEN, f);
|
fgets(buf+1, NSIS_MAX_STRLEN, f);
|
||||||
temp=strlen(buf);
|
if (!nlf->m_szFont) {
|
||||||
while (buf[temp-1] == '\n' || buf[temp-1] == '\r') {
|
temp=strlen(buf);
|
||||||
buf[temp-1] = 0;
|
while (buf[temp-1] == '\n' || buf[temp-1] == '\r') {
|
||||||
temp--;
|
buf[temp-1] = 0;
|
||||||
}
|
temp--;
|
||||||
if (buf[0] != '-' && buf [1] != 0) {
|
}
|
||||||
nlf->m_szFont = (char*)malloc(strlen(buf)+1);;
|
if (buf[0] != '-' || buf[1] != 0) {
|
||||||
strcpy(nlf->m_szFont, buf);
|
nlf->m_szFont = (char*)malloc(strlen(buf)+1);
|
||||||
|
strcpy(nlf->m_szFont, buf);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
buf[0] = SkipComments(f);
|
buf[0] = SkipComments(f);
|
||||||
fgets(buf+1, NSIS_MAX_STRLEN, f);
|
fgets(buf+1, NSIS_MAX_STRLEN, f);
|
||||||
if (buf[0] != '-' && buf [1] != 0) {
|
if (!nlf->m_iFontSize) {
|
||||||
nlf->m_iFontSize = atoi(buf);
|
if (buf[0] != '-' || buf[1] != 0) {
|
||||||
|
nlf->m_iFontSize = atoi(buf);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get code page
|
// Get code page
|
||||||
nlf->m_uCodePage = CP_ACP;
|
nlf->m_uCodePage = CP_ACP;
|
||||||
buf[0] = SkipComments(f);
|
buf[0] = SkipComments(f);
|
||||||
fgets(buf+1, NSIS_MAX_STRLEN, f);
|
fgets(buf+1, NSIS_MAX_STRLEN, f);
|
||||||
if (buf[0] != '-' && buf [1] != 0) {
|
if (buf[0] != '-' || buf[1] != 0) {
|
||||||
nlf->m_uCodePage = atoi(buf);
|
nlf->m_uCodePage = atoi(buf);
|
||||||
if (!IsValidCodePage(nlf->m_uCodePage))
|
if (!IsValidCodePage(nlf->m_uCodePage))
|
||||||
nlf->m_uCodePage = CP_ACP;
|
nlf->m_uCodePage = CP_ACP;
|
||||||
|
|
|
@ -1778,58 +1778,9 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
||||||
return make_sure_not_in_secorfunc(line.gettoken_str(0));
|
return make_sure_not_in_secorfunc(line.gettoken_str(0));
|
||||||
case TOK_WINDOWICON:
|
case TOK_WINDOWICON:
|
||||||
#ifdef NSIS_CONFIG_VISIBLE_SUPPORT
|
#ifdef NSIS_CONFIG_VISIBLE_SUPPORT
|
||||||
// Changed by Amir Szekely 30th July 2002
|
disable_window_icon=line.gettoken_enum(1,"on\0off\0");
|
||||||
try {
|
if (disable_window_icon == -1) PRINTHELP();
|
||||||
int k=line.gettoken_enum(1,"on\0off\0");
|
SCRIPT_MSG("WindowIcon: %s\n",line.gettoken_str(1));
|
||||||
if (k == -1) PRINTHELP();
|
|
||||||
SCRIPT_MSG("WindowIcon: %s\n",line.gettoken_str(1));
|
|
||||||
|
|
||||||
if (!k) return make_sure_not_in_secorfunc(line.gettoken_str(0));
|
|
||||||
|
|
||||||
init_res_editor();
|
|
||||||
|
|
||||||
#define REMOVE_ICON(id) { \
|
|
||||||
BYTE* dlg = res_editor->GetResource(RT_DIALOG, MAKEINTRESOURCE(id), MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); \
|
|
||||||
if (!dlg) throw runtime_error(#id " doesn't exist!"); \
|
|
||||||
CDialogTemplate dt(dlg,uDefCodePage); \
|
|
||||||
free(dlg); \
|
|
||||||
dt.RemoveItem(IDC_ULICON); \
|
|
||||||
DialogItemTemplate* text = dt.GetItem(IDC_INTROTEXT); \
|
|
||||||
DialogItemTemplate* prog = dt.GetItem(IDC_PROGRESS); \
|
|
||||||
if (text) { \
|
|
||||||
text->sWidth += text->sX; \
|
|
||||||
text->sX = 0; \
|
|
||||||
} \
|
|
||||||
if (prog) { \
|
|
||||||
prog->sWidth += prog->sX; \
|
|
||||||
prog->sX = 0; \
|
|
||||||
} \
|
|
||||||
\
|
|
||||||
DWORD dwSize; \
|
|
||||||
dlg = dt.Save(dwSize); \
|
|
||||||
res_editor->UpdateResource(RT_DIALOG, MAKEINTRESOURCE(id), MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), dlg, dwSize); \
|
|
||||||
free(dlg); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef NSIS_CONFIG_LICENSEPAGE
|
|
||||||
REMOVE_ICON(IDD_LICENSE);
|
|
||||||
#endif
|
|
||||||
REMOVE_ICON(IDD_DIR);
|
|
||||||
#ifdef NSIS_CONFIG_COMPONENTPAGE
|
|
||||||
REMOVE_ICON(IDD_SELCOM);
|
|
||||||
#endif
|
|
||||||
REMOVE_ICON(IDD_INSTFILES);
|
|
||||||
#ifdef NSIS_CONFIG_UNINSTALL_SUPPORT
|
|
||||||
REMOVE_ICON(IDD_UNINST);
|
|
||||||
#endif
|
|
||||||
#ifdef NSIS_CONFIG_CRC_SUPPORT
|
|
||||||
REMOVE_ICON(IDD_VERIFY);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
catch (exception& err) {
|
|
||||||
ERROR_MSG("Error removing window icon: %s\n", err.what());
|
|
||||||
return PS_ERROR;
|
|
||||||
}
|
|
||||||
return make_sure_not_in_secorfunc(line.gettoken_str(0));
|
return make_sure_not_in_secorfunc(line.gettoken_str(0));
|
||||||
#else
|
#else
|
||||||
ERROR_MSG("Error: %s specified, NSIS_CONFIG_VISIBLE_SUPPORT not defined.\n",line.gettoken_str(0));
|
ERROR_MSG("Error: %s specified, NSIS_CONFIG_VISIBLE_SUPPORT not defined.\n",line.gettoken_str(0));
|
||||||
|
@ -2186,43 +2137,25 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
||||||
}
|
}
|
||||||
return make_sure_not_in_secorfunc(line.gettoken_str(0));
|
return make_sure_not_in_secorfunc(line.gettoken_str(0));
|
||||||
case TOK_SETFONT:
|
case TOK_SETFONT:
|
||||||
SCRIPT_MSG("SetFont: \"%s\" %s\n", line.gettoken_str(1), line.gettoken_str(2));
|
{
|
||||||
try {
|
if (!strnicmp(line.gettoken_str(1), "/LANG=", 6))
|
||||||
init_res_editor();
|
{
|
||||||
|
LANGID lang_id = atoi(line.gettoken_str(1) + 6);
|
||||||
|
LanguageTable *table = GetLangTable(lang_id);
|
||||||
|
table->nlf.m_szFont = (char*)malloc(strlen(line.gettoken_str(2))+1);
|
||||||
|
strcpy(table->nlf.m_szFont, line.gettoken_str(2));
|
||||||
|
table->nlf.m_iFontSize = line.gettoken_int(3);
|
||||||
|
|
||||||
#define SET_FONT(id) { \
|
SCRIPT_MSG("SetFont: lang=%d \"%s\" %s\n", lang_id, line.gettoken_str(2), line.gettoken_str(3));
|
||||||
BYTE* dlg = res_editor->GetResource(RT_DIALOG, MAKEINTRESOURCE(id), MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); \
|
}
|
||||||
if (!dlg) throw runtime_error(#id " doesn't exist!"); \
|
else
|
||||||
CDialogTemplate td(dlg,uDefCodePage); \
|
{
|
||||||
free(dlg); \
|
strncpy(build_font, line.gettoken_str(1), sizeof(build_font));
|
||||||
td.SetFont(line.gettoken_str(1), line.gettoken_int(2)); \
|
build_font_size = line.gettoken_int(2);
|
||||||
DWORD dwSize; \
|
|
||||||
dlg = td.Save(dwSize); \
|
|
||||||
res_editor->UpdateResource(RT_DIALOG, MAKEINTRESOURCE(id), MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), dlg, dwSize); \
|
|
||||||
free(dlg); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef NSIS_CONFIG_LICENSEPAGE
|
SCRIPT_MSG("SetFont: \"%s\" %s\n", line.gettoken_str(1), line.gettoken_str(2));
|
||||||
SET_FONT(IDD_LICENSE);
|
|
||||||
#endif
|
|
||||||
SET_FONT(IDD_DIR);
|
|
||||||
#ifdef NSIS_CONFIG_COMPONENTPAGE
|
|
||||||
SET_FONT(IDD_SELCOM);
|
|
||||||
#endif
|
|
||||||
SET_FONT(IDD_INST);
|
|
||||||
SET_FONT(IDD_INSTFILES);
|
|
||||||
#ifdef NSIS_CONFIG_UNINSTALL_SUPPORT
|
|
||||||
SET_FONT(IDD_UNINST);
|
|
||||||
#endif
|
|
||||||
#ifdef NSIS_CONFIG_CRC_SUPPORT
|
|
||||||
SET_FONT(IDD_VERIFY);
|
|
||||||
#endif
|
|
||||||
#undef SET_FONT
|
|
||||||
}
|
|
||||||
catch (exception& err) {
|
|
||||||
ERROR_MSG("Error while changing font: %s\n", err.what());
|
|
||||||
return PS_ERROR;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return make_sure_not_in_secorfunc(line.gettoken_str(0));
|
return make_sure_not_in_secorfunc(line.gettoken_str(0));
|
||||||
#else
|
#else
|
||||||
case TOK_INSTCOLORS:
|
case TOK_INSTCOLORS:
|
||||||
|
@ -5204,9 +5137,6 @@ int CEXEBuild::do_add_file(const char *lgss, int attrib, int recurse, int linecn
|
||||||
// overwrite flag can be 0, 1, 2 or 3. in all cases, 2 bits
|
// overwrite flag can be 0, 1, 2 or 3. in all cases, 2 bits
|
||||||
ent.offsets[0] |= ((build_allowskipfiles ? MB_ABORTRETRYIGNORE : MB_RETRYCANCEL) | MB_ICONSTOP) << 2;
|
ent.offsets[0] |= ((build_allowskipfiles ? MB_ABORTRETRYIGNORE : MB_RETRYCANCEL) | MB_ICONSTOP) << 2;
|
||||||
ent.offsets[5] = DefineInnerLangString(build_allowskipfiles ? NLF_FILE_ERROR : NLF_FILE_ERROR_NOIGNORE);
|
ent.offsets[5] = DefineInnerLangString(build_allowskipfiles ? NLF_FILE_ERROR : NLF_FILE_ERROR_NOIGNORE);
|
||||||
|
|
||||||
if (uninstall_mode) m_uninst_fileused++;
|
|
||||||
else m_inst_fileused++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CloseHandle(hFile);
|
CloseHandle(hFile);
|
||||||
|
|
|
@ -161,7 +161,7 @@ static tokenType tokenlist[TOK__LAST] =
|
||||||
{TOK_SETDETAILSPRINT,"SetDetailsPrint",1,0,"(none|listonly|textonly|both)"},
|
{TOK_SETDETAILSPRINT,"SetDetailsPrint",1,0,"(none|listonly|textonly|both)"},
|
||||||
{TOK_SETERRORS,"SetErrors",0,0,""},
|
{TOK_SETERRORS,"SetErrors",0,0,""},
|
||||||
{TOK_SETFILEATTRIBUTES,"SetFileAttributes",2,0,"file attribute[|attribute[...]]\n attribute=(NORMAL|ARCHIVE|HIDDEN|OFFLINE|READONLY|SYSTEM|TEMPORARY|0)"},
|
{TOK_SETFILEATTRIBUTES,"SetFileAttributes",2,0,"file attribute[|attribute[...]]\n attribute=(NORMAL|ARCHIVE|HIDDEN|OFFLINE|READONLY|SYSTEM|TEMPORARY|0)"},
|
||||||
{TOK_SETFONT,"SetFont",2,0,"font_face_name font_size"},
|
{TOK_SETFONT,"SetFont",2,1,"[/LANG=lang_id] font_face_name font_size"},
|
||||||
{TOK_SETOUTPATH,"SetOutPath",1,0,"output_path"},
|
{TOK_SETOUTPATH,"SetOutPath",1,0,"output_path"},
|
||||||
{TOK_SETOVERWRITE,"SetOverwrite",1,0,"(on|off|try|ifnewer)"},
|
{TOK_SETOVERWRITE,"SetOverwrite",1,0,"(on|off|try|ifnewer)"},
|
||||||
{TOK_SETPLUGINUNLOAD,"SetPluginUnload",1,0,"(manual|alwaysoff)"},
|
{TOK_SETPLUGINUNLOAD,"SetPluginUnload",1,0,"(manual|alwaysoff)"},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue