28 bytes down
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@1308 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
9e23d348ef
commit
c9f0b33f2d
2 changed files with 15 additions and 21 deletions
|
@ -731,15 +731,14 @@ static BOOL CALLBACK UninstProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static void NSISCALL inttosizestr(int kb, char *str)
|
static char * NSISCALL inttosizestr(int kb, char *str)
|
||||||
{
|
{
|
||||||
char sh=20;
|
char sh=20;
|
||||||
char c='G';
|
char c='G';
|
||||||
char *s="";
|
|
||||||
if (kb < 1024) { sh=0; c='K'; }
|
if (kb < 1024) { sh=0; c='K'; }
|
||||||
else if (kb < 1024*1024) { sh=10; c='M'; }
|
else if (kb < 1024*1024) { sh=10; c='M'; }
|
||||||
else if (GetVersion()&0x80000000) s="+";
|
wsprintf(str+mystrlen(str),"%d.%d%cB%c",kb>>sh,((kb*10)>>sh)%10,c,GetVersion()&0x80000000?'+':' ');
|
||||||
wsprintf(str+mystrlen(str),"%d.%d%cB%s",kb>>sh,((kb*10)>>sh)%10,c,s);
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL CALLBACK DirProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
static BOOL CALLBACK DirProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
|
@ -749,7 +748,7 @@ static BOOL CALLBACK DirProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
|
||||||
GetUIText(IDC_DIR,state_install_directory,NSIS_MAX_STRLEN);
|
GetUIText(IDC_DIR,state_install_directory,NSIS_MAX_STRLEN);
|
||||||
#ifdef NSIS_CONFIG_LOG
|
#ifdef NSIS_CONFIG_LOG
|
||||||
build_g_logfile();
|
build_g_logfile();
|
||||||
log_dolog = !!IsDlgButtonChecked(hwndDlg,IDC_CHECK1);
|
log_dolog = IsDlgButtonChecked(hwndDlg,IDC_CHECK1);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
if (uMsg == WM_INITDIALOG)
|
if (uMsg == WM_INITDIALOG)
|
||||||
|
@ -857,13 +856,9 @@ static BOOL CALLBACK DirProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
|
||||||
// Added by Amir Szekely 24th July 2002
|
// Added by Amir Szekely 24th July 2002
|
||||||
// Allows 'SpaceTexts none'
|
// Allows 'SpaceTexts none'
|
||||||
if (LANG_STR_TAB(LANG_SPACE_REQ)) {
|
if (LANG_STR_TAB(LANG_SPACE_REQ)) {
|
||||||
inttosizestr(total,mystrcpy(s,LANG_STR(LANG_SPACE_REQ)));
|
SetUITextNT(IDC_SPACEREQUIRED,inttosizestr(total,mystrcpy(s,LANG_STR(LANG_SPACE_REQ))));
|
||||||
SetUITextNT(IDC_SPACEREQUIRED,s);
|
|
||||||
if (available != -1)
|
if (available != -1)
|
||||||
{
|
SetUITextNT(IDC_SPACEAVAILABLE,inttosizestr(available,mystrcpy(s,LANG_STR(LANG_SPACE_AVAIL))));
|
||||||
inttosizestr(available,mystrcpy(s,LANG_STR(LANG_SPACE_AVAIL)));
|
|
||||||
SetUITextNT(IDC_SPACEAVAILABLE,s);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
SetUITextNT(IDC_SPACEAVAILABLE,"");
|
SetUITextNT(IDC_SPACEAVAILABLE,"");
|
||||||
}
|
}
|
||||||
|
@ -1074,7 +1069,7 @@ static BOOL CALLBACK SelProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
|
||||||
tv.pszText=process_string_fromtab(ps_tmpbuf,ns);
|
tv.pszText=process_string_fromtab(ps_tmpbuf,ns);
|
||||||
TreeView_SetItem(hwndTree1,&tv);
|
TreeView_SetItem(hwndTree1,&tv);
|
||||||
}
|
}
|
||||||
SendMessage(hwndDlg,WM_USER+0x18,x,(LPARAM)!!(g_inst_section[x].flags&SF_SELECTED));
|
SendMessage(hwndDlg,WM_USER+0x18,x,(LPARAM)(g_inst_section[x].flags&SF_SELECTED));
|
||||||
}
|
}
|
||||||
if (uMsg == WM_USER+0x18) // select
|
if (uMsg == WM_USER+0x18) // select
|
||||||
{
|
{
|
||||||
|
@ -1246,8 +1241,7 @@ static BOOL CALLBACK SelProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
|
||||||
if (g_inst_section[x].flags&SF_SELECTED)
|
if (g_inst_section[x].flags&SF_SELECTED)
|
||||||
total+=g_inst_section[x].size_kb;
|
total+=g_inst_section[x].size_kb;
|
||||||
}
|
}
|
||||||
inttosizestr(total,mystrcpy(s,LANG_STR(LANG_SPACE_REQ)));
|
SetUITextNT(IDC_SPACEREQUIRED,inttosizestr(total,mystrcpy(s,LANG_STR(LANG_SPACE_REQ))));
|
||||||
SetUITextNT(IDC_SPACEREQUIRED,s);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return HandleStaticBkColor();
|
return HandleStaticBkColor();
|
||||||
|
@ -1446,10 +1440,10 @@ static BOOL CALLBACK InstProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
|
||||||
0,insthwnd,0))
|
0,insthwnd,0))
|
||||||
{
|
{
|
||||||
char textBuf[1024];
|
char textBuf[1024];
|
||||||
int i,total = 1;
|
int i,total = 1; // 1 for the null char
|
||||||
LVITEM item;
|
LVITEM item;
|
||||||
HGLOBAL memory;
|
HGLOBAL memory;
|
||||||
LPTSTR ptr,endPtr;
|
LPTSTR ptr;//,endPtr;
|
||||||
|
|
||||||
// 1st pass - determine clipboard memory required.
|
// 1st pass - determine clipboard memory required.
|
||||||
item.iSubItem = 0;
|
item.iSubItem = 0;
|
||||||
|
@ -1464,17 +1458,17 @@ static BOOL CALLBACK InstProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
|
||||||
// Clipboard MSDN docs say mem must be GMEM_MOVEABLE
|
// Clipboard MSDN docs say mem must be GMEM_MOVEABLE
|
||||||
OpenClipboard(0);
|
OpenClipboard(0);
|
||||||
EmptyClipboard();
|
EmptyClipboard();
|
||||||
memory = GlobalAlloc(GMEM_MOVEABLE,total);
|
memory = GlobalAlloc(GHND,total);
|
||||||
ptr = GlobalLock(memory);
|
ptr = GlobalLock(memory);
|
||||||
endPtr = ptr+total-2; // -2 to allow for CR/LF
|
//endPtr = ptr+total-2; // -2 to allow for CR/LF
|
||||||
i = 0;
|
i = 0;
|
||||||
do {
|
do {
|
||||||
ListView_GetItemText(insthwnd,i,0,ptr,endPtr-ptr);
|
ListView_GetItemText(insthwnd,i,0,ptr,total);
|
||||||
while (*ptr) ptr++;
|
while (*ptr) ptr++;
|
||||||
*(WORD*)ptr = CHAR2_TO_WORD('\r','\n');
|
*(WORD*)ptr = CHAR2_TO_WORD('\r','\n');
|
||||||
ptr+=2;
|
ptr+=2;
|
||||||
} while (++i < count);
|
} while (++i < count);
|
||||||
*ptr = 0;
|
// memory is auto zeroed when allocated with GHND - *ptr = 0;
|
||||||
GlobalUnlock(memory);
|
GlobalUnlock(memory);
|
||||||
SetClipboardData(CF_TEXT,memory);
|
SetClipboardData(CF_TEXT,memory);
|
||||||
CloseClipboard();
|
CloseClipboard();
|
||||||
|
|
|
@ -1514,7 +1514,7 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
||||||
g_inst_section[x].flags=process_string_fromparm_toint(2);
|
g_inst_section[x].flags=process_string_fromparm_toint(2);
|
||||||
if (g_SectionHack)
|
if (g_SectionHack)
|
||||||
{
|
{
|
||||||
SendMessage(g_SectionHack,WM_USER+0x18,x,(LPARAM)!!(g_inst_section[x].flags&SF_SELECTED));
|
SendMessage(g_SectionHack,WM_USER+0x18,x,(LPARAM)(g_inst_section[x].flags&SF_SELECTED));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // get flags
|
else // get flags
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue