Now works with DIALOGEX (not thanks to MS docs)

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@1781 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2002-11-18 14:19:45 +00:00
parent 4a82110f9c
commit 04fbea4aef
3 changed files with 26 additions and 11 deletions

View file

@ -127,13 +127,21 @@ CDialogTemplate::CDialogTemplate(BYTE* pbData) {
// Read title variant length array
ReadVarLenArr(seeker, m_szTitle);
// Read font size and variant length array (only if style DS_SETFONT is used!)
if (m_dwStyle & DS_SETFONT) {
if (m_dwStyle & DS_SETFONT || m_dwStyle & DS_SHELLFONT) {
m_sFontSize = *(short*)seeker;
seeker += sizeof(short);
if (m_bExtended) {
m_sFontWeight = *(short*)seeker;
seeker += sizeof(short);
m_bItalic = *(BYTE*)seeker;
seeker += sizeof(BYTE);
m_bCharset = *(BYTE*)seeker;
seeker += sizeof(BYTE);
}
ReadVarLenArr(seeker, m_szFont);
}
// Read items
// Read items
for (int i = 0; i < wItems; i++) {
// DLGITEMTEMPLATE[EX]s must be aligned on DWORD boundry
if (DWORD(seeker - pbData) % sizeof(DWORD))
@ -457,15 +465,17 @@ BYTE* CDialogTemplate::Save(DWORD& dwSize) {
WriteStringOrId(m_szTitle);
// Write font variant length array, size, and extended info (if needed)
if (m_dwStyle & DS_SETFONT) {
if (m_dwStyle & DS_SETFONT || m_dwStyle & DS_SHELLFONT) {
*(short*)seeker = m_sFontSize;
seeker += sizeof(short);
if (m_bExtended) {
*(short*)seeker = m_sFontWeight;
seeker += sizeof(short);
*(short*)seeker = m_bItalic ? TRUE : FALSE;
seeker += sizeof(short);
}
*(BYTE*)seeker = m_bItalic;
seeker += sizeof(BYTE);
*(BYTE*)seeker = m_bCharset;
seeker += sizeof(BYTE);
}
WriteStringOrId(m_szFont);
}
@ -538,8 +548,8 @@ DWORD CDialogTemplate::GetSize() {
AddStringOrIdSize(m_szTitle);
// Font
if (m_dwStyle & DS_SETFONT) {
dwSize += sizeof(WORD) + (m_bExtended ? 2*sizeof(short) : 0);
if (m_dwStyle & DS_SETFONT || m_dwStyle & DS_SHELLFONT) {
dwSize += sizeof(WORD) + (m_bExtended ? sizeof(short) + 2*sizeof(BYTE) : 0);
AddStringOrIdSize(m_szFont);
}

View file

@ -58,6 +58,8 @@ struct DialogItemTemplate {
WORD wCreateDataSize;
};
#pragma pack(push, 1)
typedef struct {
WORD dlgVer;
WORD signature;
@ -73,15 +75,17 @@ typedef struct {
typedef struct {
DWORD helpID;
DWORD exStyle;
DWORD exStyle;
DWORD style;
short x;
short y;
short cx;
short cy;
WORD id;
WORD _miscrosoft_docs_are_wrong;
} DLGITEMTEMPLATEEX;
#pragma pack(pop)
class CDialogTemplate {
public:
@ -124,7 +128,8 @@ private:
// Only if DS_FONT style is set
short m_sFontSize;
short m_sFontWeight; // Extended only
bool m_bItalic; // Extended only
BYTE m_bItalic; // Extended only
BYTE m_bCharset; // Extended only
char* m_szFont;
// Items vector

View file

@ -1236,7 +1236,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
init_res_editor();
// Search for required items
#define SEARCH(x) if (!UIDlg.GetItem(x)) {ERROR_MSG("Error: Can't find %s (%u) in the custom UI!\n", #x, x);return 0;}
#define SEARCH(x) if (!UIDlg.GetItem(x)) {ERROR_MSG("Error: Can't find %s (%u) in the custom UI!\n", #x, x);return PS_ERROR;}
#define SAVE(x) if (rtl) {UIDlg.ConvertToRTL(); dlg = UIDlg.Save(dwSize);} else dwSize = UIDlg.GetSize(); res_editor->UpdateResource(RT_DIALOG, x, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), dlg, dwSize);
BYTE* dlg = 0;