LangDLL now accepts A too. A for auto count, it looks for the first empty string ("") pushed.
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@2260 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
84cf81e764
commit
496874b242
3 changed files with 22 additions and 39 deletions
|
@ -99,7 +99,20 @@ void __declspec(dllexport) LangDialog(HWND hwndParent, int string_size,
|
||||||
if (popstring(g_wndtext)) return;
|
if (popstring(g_wndtext)) return;
|
||||||
|
|
||||||
if (popstring(temp)) return;
|
if (popstring(temp)) return;
|
||||||
langs_num = myatoi(temp);
|
if (*temp == 'A')
|
||||||
|
{
|
||||||
|
stack_t *th;
|
||||||
|
langs_num=0;
|
||||||
|
th=(*g_stacktop);
|
||||||
|
while (th && th->text[0]) {
|
||||||
|
langs_num++;
|
||||||
|
th = th->next;
|
||||||
|
}
|
||||||
|
if (!th) return;
|
||||||
|
langs_num /= 2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
langs_num = myatoi(temp);
|
||||||
{
|
{
|
||||||
char *p=temp;
|
char *p=temp;
|
||||||
while (*p) if (*p++ == 'F') dofont=1;
|
while (*p) if (*p++ == 'F') dofont=1;
|
||||||
|
@ -132,44 +145,12 @@ BOOL WINAPI _DllMainCRTStartup(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lp
|
||||||
int myatoi(char *s)
|
int myatoi(char *s)
|
||||||
{
|
{
|
||||||
unsigned int v=0;
|
unsigned int v=0;
|
||||||
if (*s == '0' && (s[1] == 'x' || s[1] == 'X'))
|
for (;;)
|
||||||
{
|
{
|
||||||
s+=2;
|
int c=*s++ - '0';
|
||||||
for (;;)
|
if (c < 0 || c > 9) break;
|
||||||
{
|
v*=10;
|
||||||
int c=*s++;
|
v+=c;
|
||||||
if (c >= '0' && c <= '9') c-='0';
|
|
||||||
else if (c >= 'a' && c <= 'f') c-='a'-10;
|
|
||||||
else if (c >= 'A' && c <= 'F') c-='A'-10;
|
|
||||||
else break;
|
|
||||||
v<<=4;
|
|
||||||
v+=c;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (*s == '0' && s[1] <= '7' && s[1] >= '0')
|
|
||||||
{
|
|
||||||
s++;
|
|
||||||
for (;;)
|
|
||||||
{
|
|
||||||
int c=*s++;
|
|
||||||
if (c >= '0' && c <= '7') c-='0';
|
|
||||||
else break;
|
|
||||||
v<<=3;
|
|
||||||
v+=c;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int sign=0;
|
|
||||||
if (*s == '-') { s++; sign++; }
|
|
||||||
for (;;)
|
|
||||||
{
|
|
||||||
int c=*s++ - '0';
|
|
||||||
if (c < 0 || c > 9) break;
|
|
||||||
v*=10;
|
|
||||||
v+=c;
|
|
||||||
}
|
|
||||||
if (sign) return -(int) v;
|
|
||||||
}
|
}
|
||||||
return (int)v;
|
return (int)v;
|
||||||
}
|
}
|
|
@ -95,6 +95,7 @@ Section "Section number two"
|
||||||
SectionEnd
|
SectionEnd
|
||||||
|
|
||||||
Function .onInit
|
Function .onInit
|
||||||
|
Push ""
|
||||||
Push ${LANG_ENGLISH}
|
Push ${LANG_ENGLISH}
|
||||||
Push English
|
Push English
|
||||||
Push ${LANG_DUTCH}
|
Push ${LANG_DUTCH}
|
||||||
|
@ -117,7 +118,8 @@ Function .onInit
|
||||||
Push "Simplified Chinese"
|
Push "Simplified Chinese"
|
||||||
Push ${LANG_SLOVAK}
|
Push ${LANG_SLOVAK}
|
||||||
Push Slovak
|
Push Slovak
|
||||||
Push 11 ; 11 is the number of languages
|
Push A ; A means auto count languages
|
||||||
|
; for the auto count to work the first empty push (Push "") must remain
|
||||||
LangDLL::LangDialog "Installer Language" "Please select the language of the installer"
|
LangDLL::LangDialog "Installer Language" "Please select the language of the installer"
|
||||||
|
|
||||||
Pop $LANGUAGE
|
Pop $LANGUAGE
|
||||||
|
|
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue