Transparent static controls

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@670 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2002-08-08 19:41:21 +00:00
parent 096e3c04f5
commit 759b1ee2a1

View file

@ -113,20 +113,36 @@ BOOL my_SetDlgItemText(HWND dlg, WORD id, int strtab) {
} }
BOOL SetUIText(HWND defhw, WORD def, WORD custom, int strtab) { BOOL SetUIText(HWND defhw, WORD def, WORD custom, int strtab) {
return my_SetDlgItemText(custom?g_hwnd:defhw,custom?custom:def,strtab); if (custom)
return my_SetDlgItemText(g_hwnd,custom,strtab);
else
return my_SetDlgItemText(defhw,def,strtab);
//my_SetDlgItemText(custom?g_hwnd:defhw,custom?custom:def,strtab);
} }
// no tab // no tab
BOOL SetUITextNT(HWND defhw, WORD def, WORD custom, const char *text) { BOOL SetUITextNT(HWND defhw, WORD def, WORD custom, const char *text) {
return SetDlgItemText(custom?g_hwnd:defhw,custom?custom:def,text); if (custom)
return SetDlgItemText(g_hwnd,custom,text);
else
return SetDlgItemText(defhw,def,text);
//return SetDlgItemText(custom?g_hwnd:defhw,custom?custom:def,text);
} }
UINT GetUIText(WORD def, WORD custom, char *str, int max_size) { UINT GetUIText(WORD def, WORD custom, char *str, int max_size) {
return GetDlgItemText(custom?g_hwnd:m_curwnd,custom?custom:def,str,max_size); if (custom)
return GetDlgItemText(g_hwnd,custom,str,max_size);
else
return GetDlgItemText(m_curwnd,def,str,max_size);
//return GetDlgItemText(custom?g_hwnd:m_curwnd,custom?custom:def,str,max_size);
} }
HWND GetUIItem(HWND defhw, WORD def, WORD custom) { HWND GetUIItem(HWND defhw, WORD def, WORD custom) {
return GetDlgItem(custom?g_hwnd:defhw,custom?custom:def); if (custom)
return GetDlgItem(g_hwnd,custom);
else
return GetDlgItem(defhw,def);
//return GetDlgItem(custom?g_hwnd:defhw,custom?custom:def);
} }
#endif #endif
@ -304,39 +320,42 @@ int ui_doinstall(void)
{ {
// Added by Amir Szekely 3rd August 2002 // Added by Amir Szekely 3rd August 2002
// Multilingual support // Multilingual support
char c=0; char pa=0;
int num=g_inst_header->str_tables_num;
LANGID user_lang=GetUserDefaultLangID(); LANGID user_lang=GetUserDefaultLangID();
int size=g_inst_header->str_tables_num*sizeof(common_strings); int size=num*sizeof(common_strings);
cur_common_strings_table=common_strings_tables=(common_strings*)GlobalAlloc(GPTR,size); cur_common_strings_table=common_strings_tables=(common_strings*)GlobalAlloc(GPTR,size);
GetCompressedDataFromDataBlockToMemory(g_inst_header->common.str_tables,(char*)common_strings_tables,size); GetCompressedDataFromDataBlockToMemory(g_inst_header->common.str_tables,(char*)common_strings_tables,size);
#ifdef NSIS_CONFIG_UNINSTALL_SUPPORT #ifdef NSIS_CONFIG_UNINSTALL_SUPPORT
if (!g_is_uninstaller) { if (!g_is_uninstaller) {
#endif #endif
size=g_inst_header->str_tables_num*sizeof(installer_strings); size=num*sizeof(installer_strings);
cur_install_strings_table=install_strings_tables=(installer_strings*)GlobalAlloc(GPTR,size); cur_install_strings_table=install_strings_tables=(installer_strings*)GlobalAlloc(GPTR,size);
GetCompressedDataFromDataBlockToMemory(g_inst_header->str_tables,(char*)install_strings_tables,size); GetCompressedDataFromDataBlockToMemory(g_inst_header->str_tables,(char*)install_strings_tables,size);
#ifdef NSIS_CONFIG_UNINSTALL_SUPPORT #ifdef NSIS_CONFIG_UNINSTALL_SUPPORT
} }
else { else {
size=g_inst_uninstheader->str_tables_num*sizeof(uninstall_strings); size=num*sizeof(uninstall_strings);
cur_uninstall_strings_table=uninstall_strings_tables=(uninstall_strings*)GlobalAlloc(GPTR,size); cur_uninstall_strings_table=uninstall_strings_tables=(uninstall_strings*)GlobalAlloc(GPTR,size);
GetCompressedDataFromDataBlockToMemory(g_inst_uninstheader->str_tables,(char*)uninstall_strings_tables,size); GetCompressedDataFromDataBlockToMemory(g_inst_uninstheader->str_tables,(char*)uninstall_strings_tables,size);
} }
#endif #endif
lang_again: lang_again:
for (size=0; size<g_inst_header->str_tables_num; size++) { for (size=0; size < num; size++) {
if (user_lang == common_strings_tables[size].lang_id if (user_lang == common_strings_tables[size].lang_id) {
|| (c && PRIMARYLANGID(user_lang) == PRIMARYLANGID(common_strings_tables[size].lang_id))) {
cur_install_strings_table = &install_strings_tables[size]; cur_install_strings_table = &install_strings_tables[size];
cur_common_strings_table = &common_strings_tables[size]; cur_common_strings_table = &common_strings_tables[size];
#ifdef NSIS_CONFIG_UNINSTALL_SUPPORT #ifdef NSIS_CONFIG_UNINSTALL_SUPPORT
cur_uninstall_strings_table = &uninstall_strings_tables[size]; cur_uninstall_strings_table = &uninstall_strings_tables[size];
#endif #endif
pa++;
break; break;
} }
common_strings_tables[size].lang_id&=0x3ff; // primary lang
} }
if (size==g_inst_header->str_tables_num && !c) { if (!pa) {
c=1; user_lang&=0x3ff; // primary lang
pa++;
goto lang_again; goto lang_again;
} }
} }
@ -585,6 +604,11 @@ static BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
} }
} }
} }
if (uMsg == WM_CTLCOLORSTATIC) {
SetTextColor((HDC)wParam, RGB(0,0,0));
SetBkMode((HDC)wParam, TRANSPARENT);
return (long)GetStockObject(NULL_BRUSH);
}
if (uMsg == WM_CLOSE) if (uMsg == WM_CLOSE)
{ {
if (!IsWindowEnabled(GetDlgItem(hwndDlg,IDCANCEL)) && IsWindowEnabled(GetDlgItem(hwndDlg,IDOK))) if (!IsWindowEnabled(GetDlgItem(hwndDlg,IDCANCEL)) && IsWindowEnabled(GetDlgItem(hwndDlg,IDOK)))