diff --git a/Contrib/Language files/Arabic.nlf b/Contrib/Language files/Arabic.nlf index 15f860c1..708337f1 100644 --- a/Contrib/Language files/Arabic.nlf +++ b/Contrib/Language files/Arabic.nlf @@ -2,6 +2,11 @@ NLF v2 # ÑÞã ÇááÛÉ 1025 +# Font and size - dash (-) means default +- +- +# Codepage - dash (-) means ANSI code page +- # Translation by asdfuae@msn.com äÙÇã ÇáÊäÕíÈ äáÓæÝÊ %s ÊäÕíÈ %s diff --git a/Contrib/Language files/Bulgarian.nlf b/Contrib/Language files/Bulgarian.nlf index 2d8cc381..350937ac 100644 --- a/Contrib/Language files/Bulgarian.nlf +++ b/Contrib/Language files/Bulgarian.nlf @@ -2,6 +2,11 @@ NLF v2 # Language ID 1026 +# Font and size - dash (-) means default +- +- +# Codepage - dash (-) means ANSI code page +- # Translation by Asparouh Kalyandjiev Nullsoft èíñòàëàòîð %s %s Èíñòàëèðàíå diff --git a/Contrib/Language files/Catalan.nlf b/Contrib/Language files/Catalan.nlf index dc62226d..cf4f1d56 100644 --- a/Contrib/Language files/Catalan.nlf +++ b/Contrib/Language files/Catalan.nlf @@ -2,6 +2,11 @@ NLF v3 # Language ID 1027 +# Font and size - dash (-) means default +- +- +# Codepage - dash (-) means ANSI code page +- # Translation by falanko Nullsoft Install System %s Instal·lació de %s diff --git a/Contrib/Language files/Croatian.nlf b/Contrib/Language files/Croatian.nlf index b6ccec84..66602c19 100644 --- a/Contrib/Language files/Croatian.nlf +++ b/Contrib/Language files/Croatian.nlf @@ -2,6 +2,11 @@ NLF v2 # Language ID 1050 +# Font and size - dash (-) means default +- +- +# Codepage - dash (-) means ANSI code page +- # Translation by Vedran "RIV@NVX" Miletic Nullsoft Install System %s %s Instalacija diff --git a/Contrib/Language files/Czech.nlf b/Contrib/Language files/Czech.nlf index d575037c..931704f6 100644 --- a/Contrib/Language files/Czech.nlf +++ b/Contrib/Language files/Czech.nlf @@ -2,6 +2,11 @@ NLF v2 # Language ID 1029 +# Font and size - dash (-) means default +- +- +# Codepage - dash (-) means ANSI code page +- # Translation by T.V. Zuggy (http://zuggy.wz.cz/) Nullsoft Install System %s Instalace programu %s diff --git a/Contrib/Language files/Danish.nlf b/Contrib/Language files/Danish.nlf index bd0bd37f..69a1fd4f 100644 --- a/Contrib/Language files/Danish.nlf +++ b/Contrib/Language files/Danish.nlf @@ -2,6 +2,11 @@ NLF v2 # Language ID 1030 +# Font and size - dash (-) means default +- +- +# Codepage - dash (-) means ANSI code page +- # Translation by Casper Bergenstoff Nullsoft Installerings System %s %s Setup diff --git a/Contrib/Language files/Dutch.nlf b/Contrib/Language files/Dutch.nlf index 20747198..11238466 100644 --- a/Contrib/Language files/Dutch.nlf +++ b/Contrib/Language files/Dutch.nlf @@ -2,6 +2,11 @@ NLF v3 # Language ID 1043 +# Font and size - dash (-) means default +- +- +# Codepage - dash (-) means ANSI code page +- # Translation by Hendri Adriaens & Joost Verburg Nullsoft Install System %s %s Installatie diff --git a/Contrib/Language files/English.nlf b/Contrib/Language files/English.nlf index 1e688d9f..077f6600 100644 --- a/Contrib/Language files/English.nlf +++ b/Contrib/Language files/English.nlf @@ -1,7 +1,13 @@ # Header, don't edit -NLF v3 +NLF v4 +# Start editing here # Language ID 1033 +# Font and size - dash (-) means default +- +- +# Codepage - dash (-) means ANSI code page +- # Translation by ..... (any credits should go here) Nullsoft Install System %s %s Setup @@ -39,6 +45,8 @@ Error opening file for writing: \r\n\t"$0"\r\nHit abort to abort installation,\r Can't write: Copy failed Copy to +Registering: +Unregistering: Could not find symbol: Could not load: Create folder: @@ -61,4 +69,13 @@ Remove folder: Rename on reboot: Rename: Skipped: -Copy Details To Clipboard \ No newline at end of file +Copy Details To Clipboard +Log install process +# byte +B +# kilo +K +# mega +M +# giga +G \ No newline at end of file diff --git a/Contrib/Language files/French.nlf b/Contrib/Language files/French.nlf index f1fb7d95..5f08f2c5 100644 --- a/Contrib/Language files/French.nlf +++ b/Contrib/Language files/French.nlf @@ -2,7 +2,13 @@ NLF v3 # Language ID 1036 -# Translation by the French NSIS team - http://www.winampfr.com/nsis. Updated by Sébastien Delahaye . +# Font and size - dash (-) means default +- +- +# Codepage - dash (-) means ANSI code page +- +# Translation by the French NSIS team - http://www.winampfr.com/nsis +# Updated by Sébastien Delahaye Nullsoft Install System %s Installation de %s Désinstallation de %s diff --git a/Contrib/Language files/German.nlf b/Contrib/Language files/German.nlf index 131e6faa..893ee719 100644 --- a/Contrib/Language files/German.nlf +++ b/Contrib/Language files/German.nlf @@ -2,6 +2,11 @@ NLF v3 # Language ID 1031 +# Font and size - dash (-) means default +- +- +# Codepage - dash (-) means ANSI code page +- # Translation by L.King, changes by R. Bisswanger Nullsoft Install System %s %s Installation diff --git a/Contrib/Language files/Greek.nlf b/Contrib/Language files/Greek.nlf index 632f87fd..3ad0310d 100644 --- a/Contrib/Language files/Greek.nlf +++ b/Contrib/Language files/Greek.nlf @@ -2,6 +2,11 @@ NLF v3 # Language ID 1032 +# Font and size - dash (-) means default +- +- +# Codepage - dash (-) means ANSI code page +- # Translation by Makidis N. Mike Nullsoft Install System %s ÅãêáôÜóôáóç ôïõ '%s' diff --git a/Contrib/Language files/Hebrew.nlf b/Contrib/Language files/Hebrew.nlf index ae6c1367..f939f983 100644 --- a/Contrib/Language files/Hebrew.nlf +++ b/Contrib/Language files/Hebrew.nlf @@ -2,6 +2,11 @@ NLF v3 # Language ID 1037 +# Font and size - dash (-) means default +- +- +# Codepage - dash (-) means ANSI code page +- # Translation by Amir Szekely (aka KiCHiK) Nullsoft Install System %s äú÷ðú %s diff --git a/Contrib/Language files/Hungarian.nlf b/Contrib/Language files/Hungarian.nlf index ffb55c85..e5e3c029 100644 --- a/Contrib/Language files/Hungarian.nlf +++ b/Contrib/Language files/Hungarian.nlf @@ -2,6 +2,11 @@ NLF v3 # Language ID 1038 +# Font and size - dash (-) means default +- +- +# Codepage - dash (-) means ANSI code page +- # Translation by Soft-Trans Bt. (V2) # Translation by Orfanik Kft. (V3) Nullsoft Telepítõrendszer %s diff --git a/Contrib/Language files/Italian.nlf b/Contrib/Language files/Italian.nlf index ebccc203..cdde893a 100644 --- a/Contrib/Language files/Italian.nlf +++ b/Contrib/Language files/Italian.nlf @@ -2,6 +2,11 @@ NLF v2 # Language ID 1040 +# Font and size - dash (-) means default +- +- +# Codepage - dash (-) means ANSI code page +- # Translation by Orfanik - http://www.orfanik.hu Nullsoft Install System %s Installazione di %s diff --git a/Contrib/Language files/Japanese.nlf b/Contrib/Language files/Japanese.nlf index 7d7e478e..744f3f59 100644 --- a/Contrib/Language files/Japanese.nlf +++ b/Contrib/Language files/Japanese.nlf @@ -2,6 +2,11 @@ NLF v2 # Language ID 1041 +# Font and size - dash (-) means default +- +- +# Codepage - dash (-) means ANSI code page +- # Translation by Dnanako Nullsoft Install System %s %s ƒZƒbƒgƒAƒbƒv diff --git a/Contrib/Language files/Korean.nlf b/Contrib/Language files/Korean.nlf index 1efea078..560909ef 100644 --- a/Contrib/Language files/Korean.nlf +++ b/Contrib/Language files/Korean.nlf @@ -2,6 +2,11 @@ NLF v3 # Language ID 1042 +# Font and size - dash (-) means default +- +- +# Codepage - dash (-) means ANSI code page +- # Translation by dTomoyo - http://user.chol.com/~ckgfx # Modified by koder@popdesk.co.kr ³Î¼ÒÇÁÆ® ¼³Ä¡ ½Ã½ºÅÛ %s %s ¼³Ä¡ diff --git a/Contrib/Language files/Lithuanian.nlf b/Contrib/Language files/Lithuanian.nlf index ad870074..0ce67a53 100644 --- a/Contrib/Language files/Lithuanian.nlf +++ b/Contrib/Language files/Lithuanian.nlf @@ -2,6 +2,11 @@ NLF v3 # Language ID 1063 +# Font and size - dash (-) means default +- +- +# Codepage - dash (-) means ANSI code page +- # Translation by NorCis Nullsoft Install System %s %s Idiegimas diff --git a/Contrib/Language files/Macedonian.nlf b/Contrib/Language files/Macedonian.nlf index 39d4f2dc..27d2f472 100644 --- a/Contrib/Language files/Macedonian.nlf +++ b/Contrib/Language files/Macedonian.nlf @@ -2,6 +2,11 @@ NLF v2 # Language ID 1071 +# Font and size - dash (-) means default +- +- +# Codepage - dash (-) means ANSI code page +- # Translation by Sasko Zdravkin [vardarce@mail.com] Nullsoft Install System %s %s Èíñòàëèðàœå diff --git a/Contrib/Language files/Polish.nlf b/Contrib/Language files/Polish.nlf index ac096f88..670e181a 100644 --- a/Contrib/Language files/Polish.nlf +++ b/Contrib/Language files/Polish.nlf @@ -2,6 +2,11 @@ NLF v3 # Language ID 1045 +# Font and size - dash (-) means default +- +- +# Codepage - dash (-) means ANSI code page +- # Translation by Piotr Murawski & Rafa³ Lampe - www.lomsel.prv.pl # corrections, additions by cube cube(at)lp.net.pl Nullsoft Install System %s diff --git a/Contrib/Language files/Portuguese.nlf b/Contrib/Language files/Portuguese.nlf index 643a8be8..d57d2754 100644 --- a/Contrib/Language files/Portuguese.nlf +++ b/Contrib/Language files/Portuguese.nlf @@ -2,6 +2,11 @@ NLF v2 # Language ID 2070 +# Font and size - dash (-) means default +- +- +# Codepage - dash (-) means ANSI code page +- # Translation by DragonSoull version 0.91 Sistema de Instalação Nullsoft %s Instalação de %s diff --git a/Contrib/Language files/PortugueseBR.nlf b/Contrib/Language files/PortugueseBR.nlf index 62a49b06..8f76e58c 100644 --- a/Contrib/Language files/PortugueseBR.nlf +++ b/Contrib/Language files/PortugueseBR.nlf @@ -2,6 +2,11 @@ NLF v3 # Language ID 1046 +# Font and size - dash (-) means default +- +- +# Codepage - dash (-) means ANSI code page +- # Translation by Diego Marcos Sistema de Instalação Nullsoft %s Instalação do %s diff --git a/Contrib/Language files/Romanian.nlf b/Contrib/Language files/Romanian.nlf index 3e58b9c5..92cdd4a5 100644 --- a/Contrib/Language files/Romanian.nlf +++ b/Contrib/Language files/Romanian.nlf @@ -2,6 +2,11 @@ NLF v3 # Language ID 1048 +# Font and size - dash (-) means default +- +- +# Codepage - dash (-) means ANSI code page +- # Translation by Cristian Pirvu (pcristip@yahoo.com) v0.2 Updated by Sorin Sbarnea INTERSOL SRL (sorin@intersol.ro) v0.3 # v0.4 - small grammar corrections Nullsoft Install System %s diff --git a/Contrib/Language files/Russian.nlf b/Contrib/Language files/Russian.nlf index b60952e2..1c997133 100644 --- a/Contrib/Language files/Russian.nlf +++ b/Contrib/Language files/Russian.nlf @@ -2,6 +2,11 @@ NLF v3 # Language ID 1049 +# Font and size - dash (-) means default +- +- +# Codepage - dash (-) means ANSI code page +- # Translation by Sergey `Timon` Kusnetsov Nullsoft Install System %s %s Óñòàíîâêà diff --git a/Contrib/Language files/SimpChinese.nlf b/Contrib/Language files/SimpChinese.nlf index e240e7ef..75f5fb82 100644 --- a/Contrib/Language files/SimpChinese.nlf +++ b/Contrib/Language files/SimpChinese.nlf @@ -2,6 +2,11 @@ NLF v3 # Language ID 2052 +# Font and size - dash (-) means default +- +- +# Codepage - dash (-) means ANSI code page +- # Translation by Kii Ali , Revision Date: 2003-03-29 Nullsoft Install System %s %s °²×° diff --git a/Contrib/Language files/Slovak.nlf b/Contrib/Language files/Slovak.nlf index dae75caa..79f6e4f5 100644 --- a/Contrib/Language files/Slovak.nlf +++ b/Contrib/Language files/Slovak.nlf @@ -2,6 +2,11 @@ NLF v3 # Language ID 1051 +# Font and size - dash (-) means default +- +- +# Codepage - dash (-) means ANSI code page +- # Translation by trace & Kypec Nullsoft Install System %s Inštalácia %s diff --git a/Contrib/Language files/Spanish.nlf b/Contrib/Language files/Spanish.nlf index a33290e3..6de34139 100644 --- a/Contrib/Language files/Spanish.nlf +++ b/Contrib/Language files/Spanish.nlf @@ -2,6 +2,11 @@ NLF v3 # Language ID 1034 +# Font and size - dash (-) means default +- +- +# Codepage - dash (-) means ANSI code page +- # Translation by MoNKi Nullsoft Install System %s Instalación de %s diff --git a/Contrib/Language files/Swedish.nlf b/Contrib/Language files/Swedish.nlf index 5d5b3f28..b136f0d5 100644 --- a/Contrib/Language files/Swedish.nlf +++ b/Contrib/Language files/Swedish.nlf @@ -2,6 +2,11 @@ NLF v2 # Language ID 1053 +# Font and size - dash (-) means default +- +- +# Codepage - dash (-) means ANSI code page +- # Translation by Peter Gustafsson Nullsoft Install System %s %s Installation diff --git a/Contrib/Language files/Thai.nlf b/Contrib/Language files/Thai.nlf index 7ad1a031..86eb919e 100644 --- a/Contrib/Language files/Thai.nlf +++ b/Contrib/Language files/Thai.nlf @@ -2,6 +2,11 @@ NLF v2 # Language ID 1054 +# Font and size - dash (-) means default +- +- +# Codepage - dash (-) means ANSI code page +- # Translation by TuW@nNu tuwannu@hotmail.com (asdfuae) Nullsoft Install System %s %s µÔ´µÑé§ diff --git a/Contrib/Language files/TradChinese.nlf b/Contrib/Language files/TradChinese.nlf index c2cda92c..47f8a8b9 100644 --- a/Contrib/Language files/TradChinese.nlf +++ b/Contrib/Language files/TradChinese.nlf @@ -2,6 +2,11 @@ NLF v3 # Language ID 1028 +# Font and size - dash (-) means default +- +- +# Codepage - dash (-) means ANSI code page +- # Translation by Kii Ali , Revision Date: 2003-03-29 Nullsoft Install System %s %s ¦w¸Ë diff --git a/Contrib/Language files/Turkish.nlf b/Contrib/Language files/Turkish.nlf index 1f77ab28..b20b57a9 100644 --- a/Contrib/Language files/Turkish.nlf +++ b/Contrib/Language files/Turkish.nlf @@ -1,7 +1,12 @@ # Turkish NSIS Language File -NLF v2 +NLF v3 # Language ID 1055 +# Font and size - dash (-) means default +- +- +# Codepage - dash (-) means ANSI code page +- # Translation by Bertan Kodamanoglu (astoichen@soultrap.com) Nullsoft Install System %s %s Kurulumu diff --git a/Contrib/Language files/Ukrainian.nlf b/Contrib/Language files/Ukrainian.nlf index 5675bba4..18e5bde9 100644 --- a/Contrib/Language files/Ukrainian.nlf +++ b/Contrib/Language files/Ukrainian.nlf @@ -2,6 +2,11 @@ NLF v3 # Language ID 1058 +# Font and size - dash (-) means default +- +- +# Codepage - dash (-) means ANSI code page +- # Translation by Yuri Holubow, Our Soft Nullsoft Install System %s %s Óñòàíîâêà diff --git a/Source/DialogTemplate.cpp b/Source/DialogTemplate.cpp index 6de8c86a..2aaba784 100644 --- a/Source/DialogTemplate.cpp +++ b/Source/DialogTemplate.cpp @@ -36,7 +36,7 @@ inline DWORD WCStrLen(WCHAR* szwStr) { } // Reads a variany length array from seeker into readInto and advances seeker -void ReadVarLenArr(BYTE* &seeker, char* &readInto) { +void ReadVarLenArr(BYTE* &seeker, char* &readInto, unsigned int uCodePage) { WORD* arr = (WORD*)seeker; switch (arr[0]) { case 0x0000: @@ -49,9 +49,9 @@ void ReadVarLenArr(BYTE* &seeker, char* &readInto) { break; default: { - int iStrLen = WideCharToMultiByte(CP_ACP, 0, (WCHAR*)arr, -1, 0, 0, 0, 0); + int iStrLen = WideCharToMultiByte(uCodePage, 0, (WCHAR*)arr, -1, 0, 0, 0, 0); readInto = new char[iStrLen]; - WideCharToMultiByte(CP_ACP, 0, (WCHAR*)arr, -1, readInto, iStrLen, 0, 0); + WideCharToMultiByte(uCodePage, 0, (WCHAR*)arr, -1, readInto, iStrLen, 0, 0); seeker += WCStrLen((WCHAR*)arr)*sizeof(WCHAR); } break; @@ -68,7 +68,7 @@ void ReadVarLenArr(BYTE* &seeker, char* &readInto) { seeker += sizeof(WORD); \ } \ else { \ - int us = MultiByteToWideChar(CP_ACP, 0, x, -1, (WCHAR*)seeker, dwSize); \ + int us = MultiByteToWideChar(m_uCodePage, 0, x, -1, (WCHAR*)seeker, dwSize); \ seeker += us*sizeof(WCHAR); \ } \ else \ @@ -81,7 +81,9 @@ void ReadVarLenArr(BYTE* &seeker, char* &readInto) { // Construction/Destruction ////////////////////////////////////////////////////////////////////// -CDialogTemplate::CDialogTemplate(BYTE* pbData) { +CDialogTemplate::CDialogTemplate(BYTE* pbData, unsigned int uCodePage) { + m_uCodePage = uCodePage; + m_szClass = 0; m_szFont = 0; m_szMenu = 0; @@ -121,11 +123,11 @@ CDialogTemplate::CDialogTemplate(BYTE* pbData) { BYTE* seeker = pbData + (m_bExtended ? sizeof(DLGTEMPLATEEX) : sizeof(DLGTEMPLATE)); // Read menu variant length array - ReadVarLenArr(seeker, m_szMenu); + ReadVarLenArr(seeker, m_szMenu, m_uCodePage); // Read class variant length array - ReadVarLenArr(seeker, m_szClass); + ReadVarLenArr(seeker, m_szClass, m_uCodePage); // Read title variant length array - ReadVarLenArr(seeker, m_szTitle); + ReadVarLenArr(seeker, m_szTitle, m_uCodePage); // Read font size and variant length array (only if style DS_SETFONT is used!) if (m_dwStyle & DS_SETFONT) { m_sFontSize = *(short*)seeker; @@ -138,7 +140,7 @@ CDialogTemplate::CDialogTemplate(BYTE* pbData) { m_bCharset = *(BYTE*)seeker; seeker += sizeof(BYTE); } - ReadVarLenArr(seeker, m_szFont); + ReadVarLenArr(seeker, m_szFont, m_uCodePage); } // Read items @@ -179,9 +181,9 @@ CDialogTemplate::CDialogTemplate(BYTE* pbData) { } // Read class variant length array - ReadVarLenArr(seeker, item->szClass); + ReadVarLenArr(seeker, item->szClass, m_uCodePage); // Read title variant length array - ReadVarLenArr(seeker, item->szTitle); + ReadVarLenArr(seeker, item->szTitle, m_uCodePage); // Read creation data variant length array // First read the size of the array (no null termination) diff --git a/Source/DialogTemplate.h b/Source/DialogTemplate.h index 7d71bbbd..44365991 100644 --- a/Source/DialogTemplate.h +++ b/Source/DialogTemplate.h @@ -89,7 +89,7 @@ typedef struct { class CDialogTemplate { public: - CDialogTemplate(BYTE* pbData); + CDialogTemplate(BYTE* pbData, unsigned int uCodePage=CP_ACP); virtual ~CDialogTemplate(); short GetWidth(); @@ -135,6 +135,9 @@ private: BYTE m_bCharset; // Extended only char* m_szFont; + // For (en/de)coding Unicode + unsigned int m_uCodePage; + // Items vector vector m_vItems; }; diff --git a/Source/build.cpp b/Source/build.cpp index 994facd3..7feaaabb 100644 --- a/Source/build.cpp +++ b/Source/build.cpp @@ -17,11 +17,12 @@ void CEXEBuild::define(const char *p, const char *v) definedlist.add(p,v); } - CEXEBuild::~CEXEBuild() { free(header_data_new); free(m_unicon_data); + for (unsigned int i = 0; i < build_nlfs.size(); i++) + delete build_nlfs[i]; } CEXEBuild::CEXEBuild() @@ -308,8 +309,12 @@ CEXEBuild::CEXEBuild() install_used=false; comppage_used=false; license_force_radio_used=false; + register_used=false; + unregister_used=false; notify_hwnd=0; + + uDefCodePage=CP_ACP; } int CEXEBuild::getcurdbsize() { return cur_datablock->getlen(); } @@ -1559,6 +1564,9 @@ int CEXEBuild::write_output(void) } #endif // NSIS_CONFIG_VISIBLE_SUPPORT + // Generate language tables + if (WriteStringTables() == PS_ERROR) return PS_ERROR; + // Save all changes to the exe header try { close_res_editor(); @@ -1568,9 +1576,6 @@ int CEXEBuild::write_output(void) return PS_ERROR; } - // Generate language tables - if (WriteStringTables() == PS_ERROR) return PS_ERROR; - // Pack exe header if asked for if (build_packname[0] && build_packcmd[0]) { diff --git a/Source/build.h b/Source/build.h index 09245236..42672442 100644 --- a/Source/build.h +++ b/Source/build.h @@ -154,13 +154,15 @@ class CEXEBuild { int GetUserString(char *name); int SetUserString(char *name, LANGID lang, char *string, int process=1); int WriteStringTables(); - void FillDefaultsIfNeeded(StringTable *table, NLF *nlf=0); + void FillStringTable(StringTable *table, NLF *nlf=0); #define IsNotSet(s) _IsNotSet(string_tables.size()?&(string_tables[0]->s):0) bool _IsNotSet(int *str); // Checks if a string is not set in all of the string tables #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, license_force_radio_used; + unsigned int uDefCodePage; + + bool next_used, install_used, comppage_used, license_force_radio_used, register_used, unregister_used; // a whole bunch O data. @@ -205,21 +207,21 @@ class CEXEBuild { db_comp_save_u, db_full_size_u; int build_sections_req,build_sections_div; - StringList include_dirs; + FastStringList include_dirs; StringList ns_func; // function namespace StringList ns_label; // label namespace int build_cursection_isfunc; section *build_cursection; - GrowBuf build_sections; + TinyGrowBuf build_sections; GrowBuf build_entries,ubuild_entries, *cur_entries; - GrowBuf build_functions, ubuild_functions, *cur_functions; - GrowBuf build_labels, ubuild_labels, *cur_labels; + TinyGrowBuf build_functions, ubuild_functions, *cur_functions; + TinyGrowBuf build_labels, ubuild_labels, *cur_labels; StringList build_strlist, ubuild_strlist; GrowBuf build_langtables, ubuild_langtables; LangStringList build_userlangstrings, ubuild_userlangstrings; - GrowBuf build_pages, ubuild_pages; + TinyGrowBuf build_pages, ubuild_pages; char build_last_page_define[1024], ubuild_last_page_define[1024]; int build_custom_used, ubuild_custom_used; diff --git a/Source/exehead/Ui.c b/Source/exehead/Ui.c index 2e906a3f..0466ca3a 100644 --- a/Source/exehead/Ui.c +++ b/Source/exehead/Ui.c @@ -43,6 +43,7 @@ HICON g_hIcon; // Added by Amir Szekely 3rd August 2002 char *language_tables; int *cur_language_table; +int dlg_offset; int g_quit_flag; // set when Quit has been called (meaning bail out ASAP) @@ -170,7 +171,8 @@ lang_again: for (i = 0; i < lang_num; i++) { language_table=language_tables+i*g_inst_cmnheader->language_table_size; if (!((lang ^ *(LANGID*)language_table) & lang_mask)) { - cur_language_table=(int*)(language_table+sizeof(LANGID)); + dlg_offset=*(int*)(language_table+sizeof(LANGID)); + cur_language_table=(int*)(language_table+sizeof(LANGID)+sizeof(int)); break; } } @@ -323,7 +325,7 @@ int NSISCALL ui_doinstall(void) } #endif - return DialogBox(g_hInstance,MAKEINTRESOURCE(IDD_INST),0,DialogProc); + return DialogBox(g_hInstance,MAKEINTRESOURCE(IDD_INST+dlg_offset),0,DialogProc); } #endif//NSIS_CONFIG_VISIBLE_SUPPORT #ifdef NSIS_CONFIG_SILENT_SUPPORT @@ -371,22 +373,22 @@ BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) page *this_page; static struct { - char *id; + unsigned int id; DLGPROC proc; } windows[]= { #ifdef NSIS_CONFIG_LICENSEPAGE - {MAKEINTRESOURCE(IDD_LICENSE),LicenseProc}, + {IDD_LICENSE,LicenseProc}, #endif #ifdef NSIS_CONFIG_COMPONENTPAGE - {MAKEINTRESOURCE(IDD_SELCOM),SelProc}, + {IDD_SELCOM,SelProc}, #endif - {MAKEINTRESOURCE(IDD_DIR),DirProc}, - {MAKEINTRESOURCE(IDD_INSTFILES),InstProc}, - {NULL,NULL}, // imaginary completed page + {IDD_DIR,DirProc}, + {IDD_INSTFILES,InstProc}, + {0,NULL}, // imaginary completed page #ifdef NSIS_CONFIG_UNINSTALL_SUPPORT - {MAKEINTRESOURCE(IDD_UNINST),UninstProc} + {IDD_UNINST,UninstProc} #endif }; @@ -400,9 +402,8 @@ BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) SetDlgItemTextFromLang(hwndDlg,IDCANCEL,LANG_BTN_CANCEL); SetDlgItemTextFromLang(hwndDlg,IDC_BACK,LANG_BTN_BACK); #if defined(NSIS_SUPPORT_CODECALLBACKS) && defined(NSIS_CONFIG_ENHANCEDUI_SUPPORT) - if (!(g_quit_flag = ExecuteCodeSegment(g_inst_cmnheader->code_onGUIInit,NULL))) + g_quit_flag = ExecuteCodeSegment(g_inst_cmnheader->code_onGUIInit,NULL); #endif - ShowWindow(hwndDlg,SW_SHOW); } this_page=g_inst_page+m_page; @@ -470,7 +471,11 @@ nextPage: if (this_page->id>=0) // NSIS page { - m_curwnd=CreateDialog(g_hInstance,windows[this_page->id].id,hwndDlg,windows[this_page->id].proc); + m_curwnd=CreateDialog( + g_hInstance, + MAKEINTRESOURCE(windows[this_page->id].id+dlg_offset), + hwndDlg,windows[this_page->id].proc + ); if (m_curwnd) { RECT r; @@ -669,12 +674,12 @@ static BOOL CALLBACK UninstProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l static char * NSISCALL inttosizestr(int kb, char *str) { char sh=20; - char c='G'; - char s=0;; - if (kb < 1024) { sh=0; c='K'; } - else if (kb < 1024*1024) { sh=10; c='M'; } + char s=0; + int scale=LANG_GIGA; + if (kb < 1024) { sh=0; scale=LANG_KILO; } + else if (kb < 1024*1024) { sh=10; scale=LANG_MEGA; } else if (GetVersion()&0x80000000) s='+';//only display the + on GB shown on win9x. - wsprintf(str+mystrlen(str),"%d.%d%cB%c",kb>>sh,((kb*10)>>sh)%10,c,s); + wsprintf(str+mystrlen(str),"%d.%d%s%s%c",kb>>sh,((kb*10)>>sh)%10,LANG_STR(scale),LANG_STR(LANG_BYTE),s); return str; } @@ -695,7 +700,7 @@ static BOOL CALLBACK DirProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar if (GetAsyncKeyState(VK_SHIFT)&0x8000) { HWND h=GetUIItem(IDC_CHECK1); - my_SetWindowText(h,"Log install process"); + my_SetWindowText(h,LANG_STR(LANG_LOG_INSTALL_PROCESS)); ShowWindow(h,SW_SHOWNA); } #endif diff --git a/Source/exehead/exec.c b/Source/exehead/exec.c index 08a5db2a..e23ff0df 100644 --- a/Source/exehead/exec.c +++ b/Source/exehead/exec.c @@ -938,8 +938,7 @@ static int NSISCALL ExecuteEntry(entry *entry_) g_flags.exec_error--; if (parm2) { - char *buf2=process_string_fromparm_tobuf(0x22); - update_status_text(buf2,buf1); + update_status_text_from_lang(parm2,buf1); if (funke()) g_flags.exec_error++; } else diff --git a/Source/exehead/fileform.h b/Source/exehead/fileform.h index 83ac2874..f9accfff 100644 --- a/Source/exehead/fileform.h +++ b/Source/exehead/fileform.h @@ -233,6 +233,13 @@ typedef struct int closebutton; // "Close" int completed; + int copy_details; + + int byte; + int kilo; + int mega; + int giga; + // processed strings int subcaptions[5]; #endif @@ -253,6 +260,8 @@ typedef struct int copy_to; #endif #ifdef NSIS_SUPPORT_ACTIVEXREG + int registering; + int unregistering; int symbol_not_found; int could_not_load; int no_ole; @@ -293,7 +302,9 @@ typedef struct int inst_corrupted; int output_dir; int create_dir; - int copy_details; +#ifdef NSIS_CONFIG_LOG + int log_install_process; +#endif } common_strings; // Flags for common_header.flags diff --git a/Source/exehead/lang.h b/Source/exehead/lang.h index b3f15674..9f8504e8 100644 --- a/Source/exehead/lang.h +++ b/Source/exehead/lang.h @@ -81,6 +81,13 @@ #define LANG_NAME (COMMON_STR(name)) #define LANG_CAPTION (COMMON_STR(caption)) #define LANG_SUBCAPTION(x) (COMMON_STR(subcaptions[x])) +#define LANG_INSTCORRUPTED (COMMON_STR(inst_corrupted)) +#define LANG_COPYDETAILS (COMMON_STR(copy_details)) +#define LANG_LOG_INSTALL_PROCESS (COMMON_STR(log_install_process)) +#define LANG_BYTE (COMMON_STR(byte)) +#define LANG_KILO (COMMON_STR(kilo)) +#define LANG_MEGA (COMMON_STR(mega)) +#define LANG_GIGA (COMMON_STR(giga)) // instruction strings #define LANG_FILEERR (COMMON_STR(fileerrtext)) @@ -108,7 +115,7 @@ #define LANG_COPYFAILED (COMMON_STR(copy_failed)) #define LANG_ERRORCREATING (COMMON_STR(err_creating)) #define LANG_CREATEDUNINST (COMMON_STR(created_uninst)) -#define LANG_INSTCORRUPTED (COMMON_STR(inst_corrupted)) -#define LANG_COPYDETAILS (COMMON_STR(copy_details)) +#define LANG_REGISTERING (COMMON_STR(registering)) +#define LANG_UNREGISTERING (COMMON_STR(unregistering)) #endif//_NSIS_LANG_H_ diff --git a/Source/lang.cpp b/Source/lang.cpp index 1c718d97..0e5b3194 100644 --- a/Source/lang.cpp +++ b/Source/lang.cpp @@ -4,6 +4,8 @@ #include #include #include "build.h" +#include "DialogTemplate.h" +#include "exehead\resource.h" extern const char *NSIS_VERSION; @@ -44,6 +46,8 @@ char *english_strings[] = { "Can't write: ", "Copy failed", "Copy to ", + "Registering: ", + "Unregistering: ", "Could not find symbol: ", "Could not load: ", "Create folder: ", @@ -66,7 +70,12 @@ char *english_strings[] = { "Rename on reboot: ", "Rename: ", "Skipped: ", - "Copy Details To Clipboard" + "Copy Details To Clipboard", + "Log install process", + "B", + "K", + "M", + "G" }; StringTable* CEXEBuild::GetTable(LANGID &lang) { @@ -85,13 +94,15 @@ StringTable* CEXEBuild::GetTable(LANGID &lang) { ERROR_MSG("Internal compiler error #12345: malloc(%d) failed\n",sizeof(StringTable)); return 0; } - memset(table, 0, sizeof(StringTable)-sizeof(GrowBuf)*2); + memset(table, 0, sizeof(LANGID) + sizeof(int) + sizeof(common_strings)*2 + sizeof(installer_strings) + sizeof(uninstall_strings)); + table->nlf = 0; + table->lang_id = lang; table->user_strings.set_zeroing(1); - table->user_ustrings.set_zeroing(1); - table->user_strings.resize(build_userlangstrings.getnum()*sizeof(int)); + + table->user_ustrings.set_zeroing(1); table->user_ustrings.resize(ubuild_userlangstrings.getnum()*sizeof(int)); string_tables.push_back(table); @@ -205,7 +216,7 @@ int CEXEBuild::SetUserString(char *name, LANGID lang, char *string, int process/ if (!table) return PS_ERROR; } - GrowBuf *user_strings = 0; + TinyGrowBuf *user_strings = 0; LangStringList *user_strings_list = 0; bool uninst; if (!(uninst = !strnicmp(name,"un.",3))) { @@ -236,7 +247,7 @@ int CEXEBuild::SetUserString(char *name, LANGID lang, char *string, int process/ bool CEXEBuild::_IsSet(int *str, LANGID lang) { if (!str) return false; - lang = lang?lang:build_nlfs.size()?build_nlfs[build_nlfs.size()-1]->GetLang():0; + lang = lang?lang:build_nlfs.size()?build_nlfs[build_nlfs.size()-1]->m_wLangId:0; lang = lang?lang:string_tables.size()?string_tables[0]->lang_id:1033; // Default is English (1033) unsigned int i; for (i = 0; i < string_tables.size(); i++) { @@ -262,9 +273,58 @@ int CEXEBuild::WriteStringTables() { } // Fill tables with defaults (if needed) and with instruction strings + // Create language specific resources (currently only dialogs with different fonts) int st_num = string_tables.size(); + // if there is one string table then there is no need for two sets of dialogs + int cur_offset = st_num == 1 ? 0 : 100; for (i = 0; i < st_num; i++) - FillDefaultsIfNeeded(string_tables[i]); + { + FillStringTable(string_tables[i]); + if (string_tables[i]->nlf && string_tables[i]->nlf->m_szFont) + { + string_tables[i]->dlg_offset = cur_offset; + + 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,string_tables[i]->nlf->m_uCodePage); \ + free(dlg); \ + td.SetFont(string_tables[i]->nlf->m_szFont, string_tables[i]->nlf->m_iFontSize); \ + DWORD dwSize; \ + dlg = td.Save(dwSize); \ + res_editor->UpdateResource(RT_DIALOG, MAKEINTRESOURCE(id+cur_offset), string_tables[i]->lang_id, dlg, dwSize); \ + free(dlg); \ + } \ + } + +#ifdef NSIS_CONFIG_LICENSEPAGE + ADD_FONT(IDD_LICENSE); +#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 SET_FONT + } + catch (exception& err) { + ERROR_MSG("Error while applying NLF font for %s: %s\n", err.what()); + return PS_ERROR; + } + + cur_offset += 100; + } + } // check for missing LangStrings int userstrings_num = build_userlangstrings.getnum(); @@ -296,6 +356,7 @@ int CEXEBuild::WriteStringTables() { // Add string tables into their datablock for (i = 0; i < st_num; i++) { build_langtables.add(&string_tables[i]->lang_id, sizeof(LANGID)); + build_langtables.add(&string_tables[i]->dlg_offset, sizeof(int)); build_langtables.add(&string_tables[i]->common, sizeof(common_strings)); build_langtables.add(&string_tables[i]->installer, sizeof(installer_strings)); if (build_userlangstrings.getnum()) @@ -306,6 +367,7 @@ int CEXEBuild::WriteStringTables() { for (i = 0; i < st_num; i++) { ubuild_langtables.add(&string_tables[i]->lang_id, sizeof(LANGID)); + ubuild_langtables.add(&string_tables[i]->dlg_offset, sizeof(int)); ubuild_langtables.add(&string_tables[i]->ucommon, sizeof(common_strings)); ubuild_langtables.add(&string_tables[i]->uninstall, sizeof(uninstall_strings)); if (ubuild_userlangstrings.getnum()) @@ -318,12 +380,12 @@ int CEXEBuild::WriteStringTables() { return PS_OK; } -void CEXEBuild::FillDefaultsIfNeeded(StringTable *table, NLF *nlf/*=0*/) { +void CEXEBuild::FillStringTable(StringTable *table, NLF *nlf/*=0*/) { if (!nlf) { for (unsigned int i = 0; i < build_nlfs.size(); i++) { - if (build_nlfs[i]->GetLang() == table->lang_id) { - nlf = build_nlfs[i]; - break; + if (build_nlfs[i]->m_wLangId == table->lang_id) { + nlf = table->nlf = build_nlfs[i]; + break; } } } @@ -378,6 +440,22 @@ void CEXEBuild::FillDefaultsIfNeeded(StringTable *table, NLF *nlf/*=0*/) { table->ucommon.name=add_string_uninst(str(NLF_DEF_NAME),0); } #ifdef NSIS_CONFIG_VISIBLE_SUPPORT + table->common.byte=add_string_main(str(NLF_BYTE)); + table->common.kilo=add_string_main(str(NLF_KILO)); + table->common.mega=add_string_main(str(NLF_MEGA)); + table->common.giga=add_string_main(str(NLF_GIGA)); + + /* not yet needed + + table->ucommon.byte=add_string_uninst(str(NLF_BYTE)); + table->ucommon.kilo=add_string_uninst(str(NLF_KILO)); + table->ucommon.mega=add_string_uninst(str(NLF_MEGA)); + table->ucommon.giga=add_string_uninst(str(NLF_GIGA));*/ + +#ifdef NSIS_CONFIG_LOG + table->common.log_install_process=add_string_main(str(NLF_LOG_INSTALL_PROCESS)); + table->ucommon.log_install_process=add_string_uninst(str(NLF_LOG_INSTALL_PROCESS)); +#endif #ifdef NSIS_CONFIG_LICENSEPAGE if (!table->installer.licensedata || !table->installer.licensetext) @@ -522,6 +600,14 @@ void CEXEBuild::FillDefaultsIfNeeded(StringTable *table, NLF *nlf/*=0*/) { SET_INSTRUCTION(NLF_COPY_TO, copy_to); #endif #ifdef NSIS_SUPPORT_ACTIVEXREG + if (register_used) + { + SET_INSTRUCTION(NLF_REGISTERING, registering); + } + if (unregister_used) + { + SET_INSTRUCTION(NLF_UNREGISTERING, unregistering); + } SET_INSTRUCTION(NLF_SYMBOL_NOT_FOUND, symbol_not_found); SET_INSTRUCTION(NLF_COULD_NOT_LOAD, could_not_load); SET_INSTRUCTION(NLF_NO_OLE, no_ole); @@ -601,15 +687,38 @@ NLF::NLF(char *filename) { FILE *f = fopen(filename, "r"); if (!f) throw runtime_error("Can't open language file!"); + // Generate language name + char *p, *p2, t; + + p = strrchr(filename, '.'); + if (p) + { + t = *p; + *p = 0; + } + p2 = strrchr(filename, '\\'); + if (p2) + { + p2++; + m_szName = new char[strlen(p2)+1]; + strcpy(m_szName, p2); + } + else + { + m_szName = new char[strlen(filename)+1]; + strcpy(m_szName, filename); + } + if (p) *p = t; + + // Check header char buf[1024]; buf[0] = SkipComments(f); fgets(buf+1, 1024, f); - // Check header if (strncmp(buf, "NLF v", 5)) throw runtime_error("Invalid language file!"); int nlf_version = atoi(buf+5); if (nlf_version != NLF_VERSION) { - if (nlf_version != 2) + if (nlf_version != 2 && nlf_version != 3) throw runtime_error("Language file version doesn't match NSIS version!"); } @@ -618,25 +727,77 @@ NLF::NLF(char *filename) { fgets(buf+1, 1024, f); m_wLangId = atoi(buf); + int temp; + + // Get font + m_szFont = NULL; + m_iFontSize = 0; + + buf[0] = SkipComments(f); + fgets(buf+1, 1024, f); + temp=strlen(buf); + while (buf[temp-1] == '\n' || buf[temp-1] == '\r') { + buf[temp-1] = 0; + temp--; + } + if (buf[0] != '-' && buf [1] != 0) { + m_szFont = new char[strlen(buf) + 1]; + strcpy(m_szFont, buf); + } + + buf[0] = SkipComments(f); + fgets(buf+1, 1024, f); + if (buf[0] != '-' && buf [1] != 0) { + m_iFontSize = atoi(buf); + } + + // Get code page + m_uCodePage = CP_ACP; + buf[0] = SkipComments(f); + fgets(buf+1, 1024, f); + if (buf[0] != '-' && buf [1] != 0) { + m_uCodePage = atoi(buf); + if (!IsValidCodePage(m_uCodePage)) + m_uCodePage = CP_ACP; + } + // Read strings for (int i = 0; i < NLF_STRINGS; i++) { - buf[0] = SkipComments(f); - - if ((i == NLF_BTN_LICENSE_AGREE || i == NLF_BTN_LICENSE_DISAGREE) && nlf_version == 2) { + if (nlf_version < 3 && (i == NLF_BTN_LICENSE_AGREE || i == NLF_BTN_LICENSE_DISAGREE)) { m_szStrings[i] = new char[1]; m_szStrings[i][0] = 0; continue; } + if (nlf_version < 4) { + switch (i) { + case NLF_LOG_INSTALL_PROCESS: + case NLF_BYTE: + case NLF_KILO: + case NLF_MEGA: + case NLF_GIGA: + case NLF_REGISTERING: + case NLF_UNREGISTERING: + m_szStrings[i] = new char[strlen(english_strings[i]) + 1]; + strcpy(m_szStrings[i], english_strings[i]); + continue; + break; + } + } + + buf[0] = SkipComments(f); + fgets(buf+1, NSIS_MAX_STRLEN, f); - if (lstrlen(buf) == NSIS_MAX_STRLEN-1) { + if (strlen(buf) == NSIS_MAX_STRLEN-1) { wsprintf(buf, "String too long (string #%d)!", i); throw runtime_error(buf); } - while (buf[lstrlen(buf)-1] == '\n' || buf[lstrlen(buf)-1] == '\r') { - buf[lstrlen(buf)-1] = 0; + temp=strlen(buf); + while (buf[temp-1] == '\n' || buf[temp-1] == '\r') { + buf[temp-1] = 0; + temp--; } - m_szStrings[i] = new char[lstrlen(buf)+1]; + m_szStrings[i] = new char[strlen(buf)+1]; for (char *out = m_szStrings[i], *in = buf; *in; in++, out++) { if (*in == '\\') { in++; @@ -663,15 +824,13 @@ NLF::NLF(char *filename) { } NLF::~NLF() { + delete [] m_szName; + delete [] m_szFont; for (int i = 0; i < NLF_STRINGS; i++) { delete [] m_szStrings[i]; } } -LANGID NLF::GetLang() { - return m_wLangId; -} - char* NLF::GetString(int idx) { if (idx < 0 || idx >= NLF_STRINGS) return 0; return m_szStrings[idx]; diff --git a/Source/lang.h b/Source/lang.h index 1a9c532c..4d5e9910 100644 --- a/Source/lang.h +++ b/Source/lang.h @@ -65,18 +65,22 @@ class LangStringList : public SortedStringListND int index; }; +class NLF; + struct StringTable { LANGID lang_id; + int dlg_offset; common_strings common; common_strings ucommon; installer_strings installer; uninstall_strings uninstall; - GrowBuf user_strings; - GrowBuf user_ustrings; + TinyGrowBuf user_strings; + TinyGrowBuf user_ustrings; + + NLF *nlf; }; -#define NLF_VERSION 3 -#define NLF_STRINGS 59 +#define NLF_VERSION 4 enum { NLF_BRANDING, @@ -115,6 +119,8 @@ enum { NLF_CANT_WRITE, NLF_COPY_FAILED, NLF_COPY_TO, + NLF_REGISTERING, + NLF_UNREGISTERING, NLF_SYMBOL_NOT_FOUND, NLF_COULD_NOT_LOAD, NLF_CREATE_DIR, @@ -138,6 +144,13 @@ enum { NLF_RENAME, NLF_SKIPPED, NLF_COPY_DETAILS, + NLF_LOG_INSTALL_PROCESS, + NLF_BYTE, + NLF_KILO, + NLF_MEGA, + NLF_GIGA, + + NLF_STRINGS, SLANG_NAME, SLANG_COMP_TEXT, @@ -155,12 +168,17 @@ class NLF { NLF(char *filename); ~NLF(); - LANGID GetLang(); - char* GetString(int idx); + char *GetString(int idx); + char *m_szName; + + LANGID m_wLangId; + char *m_szFont; + int m_iFontSize; + unsigned int m_uCodePage; + private: - LANGID m_wLangId; - char *m_szStrings[NLF_STRINGS]; + char *m_szStrings[NLF_STRINGS]; }; #endif diff --git a/Source/script.cpp b/Source/script.cpp index b6291379..0e8cca39 100644 --- a/Source/script.cpp +++ b/Source/script.cpp @@ -255,6 +255,11 @@ void CEXEBuild::ps_addtoline(const char *str, GrowBuf &linedata, StringList &his in+=2; c='\n'; } + else if (in[1] == 't') + { + in+=2; + c='\t'; + } } else if (in[0] == '{') { @@ -1089,7 +1094,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char 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); + CDialogTemplate dt(dlg,uDefCodePage); free(dlg); switch (k) { @@ -1292,7 +1297,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char BYTE* dlg = res_editor->GetResource(RT_DIALOG, MAKEINTRESOURCE(IDD_INSTFILES), MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); if (!dlg) throw runtime_error("IDD_INSTFILES doesn't exist!"); - CDialogTemplate dt(dlg); + CDialogTemplate dt(dlg,uDefCodePage); free(dlg); DialogItemTemplate* progress = dt.GetItem(IDC_PROGRESS); if (!progress) { @@ -1343,7 +1348,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char #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); \ + CDialogTemplate dt(dlg,uDefCodePage); \ free(dlg); \ dt.RemoveItem(IDC_ULICON); \ DialogItemTemplate* text = dt.GetItem(IDC_INTROTEXT); \ @@ -1560,7 +1565,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char if (k == 0 || k == 1) { dlg = get_dlg(hUIFile, IDD_LICENSE, line.gettoken_str(2)); if (!dlg) return PS_ERROR; - CDialogTemplate UIDlg(dlg); + CDialogTemplate UIDlg(dlg,uDefCodePage); SEARCH(IDC_EDIT1); SAVE(IDD_LICENSE); } @@ -1568,7 +1573,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char if (k == 0 || k == 2) { dlg = get_dlg(hUIFile, IDD_DIR, line.gettoken_str(2)); if (!dlg) return PS_ERROR; - CDialogTemplate UIDlg(dlg); + CDialogTemplate UIDlg(dlg,uDefCodePage); SEARCH(IDC_DIR); SEARCH(IDC_BROWSE); #ifdef NSIS_CONFIG_LOG @@ -1580,7 +1585,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char if (k == 0 || k == 3) { dlg = get_dlg(hUIFile, IDD_SELCOM, line.gettoken_str(2)); if (!dlg) return PS_ERROR; - CDialogTemplate UIDlg(dlg); + CDialogTemplate UIDlg(dlg,uDefCodePage); SEARCH(IDC_TREE1); SEARCH(IDC_COMBO1); SAVE(IDD_SELCOM); @@ -1589,7 +1594,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char if (k == 0 || k == 4) { dlg = get_dlg(hUIFile, IDD_INST, line.gettoken_str(2)); if (!dlg) return PS_ERROR; - CDialogTemplate UIDlg(dlg); + CDialogTemplate UIDlg(dlg,uDefCodePage); SEARCH(IDC_BACK); SEARCH(IDC_CHILDRECT); SEARCH(IDC_VERSTR); @@ -1617,7 +1622,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char if (k == 0 || k == 5) { dlg = get_dlg(hUIFile, IDD_INSTFILES, line.gettoken_str(2)); if (!dlg) return PS_ERROR; - CDialogTemplate UIDlg(dlg); + CDialogTemplate UIDlg(dlg,uDefCodePage); SEARCH(IDC_LIST1); SEARCH(IDC_PROGRESS); SEARCH(IDC_SHOWDETAILS); @@ -1627,7 +1632,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char if (k == 0 || k == 6) { dlg = get_dlg(hUIFile, IDD_UNINST, line.gettoken_str(2)); if (!dlg) return PS_ERROR; - CDialogTemplate UIDlg(dlg); + CDialogTemplate UIDlg(dlg,uDefCodePage); SEARCH(IDC_EDIT1); SAVE(IDD_UNINST); } @@ -1635,7 +1640,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char if (k == 0 || k == 7) { dlg = get_dlg(hUIFile, IDD_VERIFY, line.gettoken_str(2)); if (!dlg) return PS_ERROR; - CDialogTemplate UIDlg(dlg); + CDialogTemplate UIDlg(dlg,uDefCodePage); SEARCH(IDC_STR); // No RTL here, pure English goes here. //SAVE(IDD_VERIFY); @@ -1711,7 +1716,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char init_res_editor(); BYTE* dlg = res_editor->GetResource(RT_DIALOG, MAKEINTRESOURCE(IDD_INST), MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); - CDialogTemplate dt(dlg); + CDialogTemplate dt(dlg,uDefCodePage); delete [] dlg; DialogItemTemplate *childRect = dt.GetItem(IDC_CHILDRECT); @@ -1785,7 +1790,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char #define SET_FONT(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 td(dlg); \ + CDialogTemplate td(dlg,uDefCodePage); \ free(dlg); \ td.SetFont(line.gettoken_str(1), line.gettoken_int(2)); \ DWORD dwSize; \ @@ -1809,6 +1814,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char #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()); @@ -1887,24 +1893,27 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char NLF *newNLF = new NLF(line.gettoken_str(1)); unsigned int i; for (i = 0; i < build_nlfs.size(); i++) - if (build_nlfs[i]->GetLang() == newNLF->GetLang()) { + { + if (build_nlfs[i]->m_wLangId == newNLF->m_wLangId) + { ERROR_MSG("Error: Can't add same language twice!\n"); return PS_ERROR; } + } + if (!build_nlfs.size()) + { + uDefCodePage = newNLF->m_uCodePage; + } build_nlfs.push_back(newNLF); - LANGID lang = newNLF->GetLang(); + LANGID lang = newNLF->m_wLangId; GetTable(lang); - last_used_lang=newNLF->GetLang(); + last_used_lang = newNLF->m_wLangId; // define LANG_LangName as "####" (lang id) // for example ${LANG_ENGLISH} = 1033 char lang_id[16]; char lang_name[128]; - char *nlf = line.gettoken_str(1); - char *tmp = strrchr(nlf, '.'); - if (tmp) *tmp = 0; - tmp = strrchr(nlf, '\\'); - wsprintf(lang_name, "LANG_%s", tmp?tmp+1:nlf); - wsprintf(lang_id, "%u", newNLF->GetLang()); + wsprintf(lang_name, "LANG_%s", newNLF->m_szName); + wsprintf(lang_id, "%u", newNLF->m_wLangId); definedlist.add(lang_name,lang_id); } catch (exception &err) { @@ -2352,7 +2361,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char init_res_editor(); BYTE* dlg = res_editor->GetResource(RT_DIALOG, MAKEINTRESOURCE(IDD_INST), MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); - CDialogTemplate td(dlg); + CDialogTemplate td(dlg,uDefCodePage); free(dlg); if (trim) { @@ -2603,7 +2612,8 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char if (which_token == TOK_UNREGDLL) { ent.offsets[1]=add_string("DllUnregisterServer"); - ent.offsets[2]=add_string("Unregistering: "); + ent.offsets[2]=LANG_UNREGISTERING; + unregister_used=true; } else if (which_token == TOK_CALLINSTDLL) { @@ -2621,7 +2631,8 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char { ent.offsets[1] = add_string(line.gettoken_str(2)); if (!ent.offsets[1]) ent.offsets[1]=add_string("DllRegisterServer"); - ent.offsets[2]=add_string("Registering: "); + ent.offsets[2]=LANG_REGISTERING; + register_used=true; } SCRIPT_MSG("%s: \"%s\" %s\n",line.gettoken_str(0),line.gettoken_str(1), line.gettoken_str(ent.offsets[3]?3:2)); diff --git a/TODO.txt b/TODO.txt index 981fe433..3e4e946a 100644 --- a/TODO.txt +++ b/TODO.txt @@ -6,6 +6,8 @@ NSIS * Section switch for defaulting to unselected mode +* DATE, FILE, TIME, etc. defines + * different font and code page for every language * MB and friends translatable