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:
parent
4a82110f9c
commit
04fbea4aef
3 changed files with 26 additions and 11 deletions
|
@ -127,13 +127,21 @@ CDialogTemplate::CDialogTemplate(BYTE* pbData) {
|
||||||
// Read title variant length array
|
// Read title variant length array
|
||||||
ReadVarLenArr(seeker, m_szTitle);
|
ReadVarLenArr(seeker, m_szTitle);
|
||||||
// Read font size and variant length array (only if style DS_SETFONT is used!)
|
// 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;
|
m_sFontSize = *(short*)seeker;
|
||||||
seeker += sizeof(short);
|
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);
|
ReadVarLenArr(seeker, m_szFont);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read items
|
// Read items
|
||||||
for (int i = 0; i < wItems; i++) {
|
for (int i = 0; i < wItems; i++) {
|
||||||
// DLGITEMTEMPLATE[EX]s must be aligned on DWORD boundry
|
// DLGITEMTEMPLATE[EX]s must be aligned on DWORD boundry
|
||||||
if (DWORD(seeker - pbData) % sizeof(DWORD))
|
if (DWORD(seeker - pbData) % sizeof(DWORD))
|
||||||
|
@ -457,15 +465,17 @@ BYTE* CDialogTemplate::Save(DWORD& dwSize) {
|
||||||
WriteStringOrId(m_szTitle);
|
WriteStringOrId(m_szTitle);
|
||||||
|
|
||||||
// Write font variant length array, size, and extended info (if needed)
|
// 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;
|
*(short*)seeker = m_sFontSize;
|
||||||
seeker += sizeof(short);
|
seeker += sizeof(short);
|
||||||
if (m_bExtended) {
|
if (m_bExtended) {
|
||||||
*(short*)seeker = m_sFontWeight;
|
*(short*)seeker = m_sFontWeight;
|
||||||
seeker += sizeof(short);
|
seeker += sizeof(short);
|
||||||
*(short*)seeker = m_bItalic ? TRUE : FALSE;
|
*(BYTE*)seeker = m_bItalic;
|
||||||
seeker += sizeof(short);
|
seeker += sizeof(BYTE);
|
||||||
}
|
*(BYTE*)seeker = m_bCharset;
|
||||||
|
seeker += sizeof(BYTE);
|
||||||
|
}
|
||||||
WriteStringOrId(m_szFont);
|
WriteStringOrId(m_szFont);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -538,8 +548,8 @@ DWORD CDialogTemplate::GetSize() {
|
||||||
AddStringOrIdSize(m_szTitle);
|
AddStringOrIdSize(m_szTitle);
|
||||||
|
|
||||||
// Font
|
// Font
|
||||||
if (m_dwStyle & DS_SETFONT) {
|
if (m_dwStyle & DS_SETFONT || m_dwStyle & DS_SHELLFONT) {
|
||||||
dwSize += sizeof(WORD) + (m_bExtended ? 2*sizeof(short) : 0);
|
dwSize += sizeof(WORD) + (m_bExtended ? sizeof(short) + 2*sizeof(BYTE) : 0);
|
||||||
AddStringOrIdSize(m_szFont);
|
AddStringOrIdSize(m_szFont);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,6 +58,8 @@ struct DialogItemTemplate {
|
||||||
WORD wCreateDataSize;
|
WORD wCreateDataSize;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#pragma pack(push, 1)
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
WORD dlgVer;
|
WORD dlgVer;
|
||||||
WORD signature;
|
WORD signature;
|
||||||
|
@ -73,15 +75,17 @@ typedef struct {
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
DWORD helpID;
|
DWORD helpID;
|
||||||
DWORD exStyle;
|
DWORD exStyle;
|
||||||
DWORD style;
|
DWORD style;
|
||||||
short x;
|
short x;
|
||||||
short y;
|
short y;
|
||||||
short cx;
|
short cx;
|
||||||
short cy;
|
short cy;
|
||||||
WORD id;
|
WORD id;
|
||||||
|
WORD _miscrosoft_docs_are_wrong;
|
||||||
} DLGITEMTEMPLATEEX;
|
} DLGITEMTEMPLATEEX;
|
||||||
|
|
||||||
|
#pragma pack(pop)
|
||||||
|
|
||||||
class CDialogTemplate {
|
class CDialogTemplate {
|
||||||
public:
|
public:
|
||||||
|
@ -124,7 +128,8 @@ private:
|
||||||
// Only if DS_FONT style is set
|
// Only if DS_FONT style is set
|
||||||
short m_sFontSize;
|
short m_sFontSize;
|
||||||
short m_sFontWeight; // Extended only
|
short m_sFontWeight; // Extended only
|
||||||
bool m_bItalic; // Extended only
|
BYTE m_bItalic; // Extended only
|
||||||
|
BYTE m_bCharset; // Extended only
|
||||||
char* m_szFont;
|
char* m_szFont;
|
||||||
|
|
||||||
// Items vector
|
// Items vector
|
||||||
|
|
|
@ -1236,7 +1236,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
|
||||||
init_res_editor();
|
init_res_editor();
|
||||||
|
|
||||||
// Search for required items
|
// 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);
|
#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;
|
BYTE* dlg = 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue