We now centre bitmaps manually, to avoid differences in behaviour between XP and everything else.
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@3496 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
c3ce5271a3
commit
6f96381818
2 changed files with 24 additions and 25 deletions
|
@ -896,11 +896,11 @@ int WINAPI createCfgDlg()
|
||||||
// Prevent WM_COMMANDs from being processed while we are building
|
// Prevent WM_COMMANDs from being processed while we are building
|
||||||
g_done = 1;
|
g_done = 1;
|
||||||
|
|
||||||
RECT dialog_r;
|
|
||||||
int mainWndWidth, mainWndHeight;
|
int mainWndWidth, mainWndHeight;
|
||||||
hConfigWindow=CreateDialog(m_hInstance,MAKEINTRESOURCE(IDD_DIALOG1),mainwnd,cfgDlgProc);
|
hConfigWindow=CreateDialog(m_hInstance,MAKEINTRESOURCE(IDD_DIALOG1),mainwnd,cfgDlgProc);
|
||||||
if (hConfigWindow)
|
if (hConfigWindow)
|
||||||
{
|
{
|
||||||
|
RECT dialog_r;
|
||||||
GetWindowRect(childwnd,&dialog_r);
|
GetWindowRect(childwnd,&dialog_r);
|
||||||
MapWindowPoints(0, mainwnd, (LPPOINT) &dialog_r, 2);
|
MapWindowPoints(0, mainwnd, (LPPOINT) &dialog_r, 2);
|
||||||
mainWndWidth = dialog_r.right - dialog_r.left;
|
mainWndWidth = dialog_r.right - dialog_r.left;
|
||||||
|
@ -924,21 +924,6 @@ int WINAPI createCfgDlg()
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Init dialog unit conversion
|
|
||||||
|
|
||||||
HDC memDC = CreateCompatibleDC(GetDC(hConfigWindow));
|
|
||||||
SelectObject(memDC, hFont);
|
|
||||||
|
|
||||||
TEXTMETRIC tm;
|
|
||||||
GetTextMetrics(memDC, &tm);
|
|
||||||
int baseUnitY = tm.tmHeight;
|
|
||||||
|
|
||||||
SIZE size;
|
|
||||||
GetTextExtentPoint32(memDC,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", 52, &size);
|
|
||||||
int baseUnitX = (size.cx / 26 + 1) / 2;
|
|
||||||
|
|
||||||
DeleteDC(memDC);
|
|
||||||
|
|
||||||
BOOL fFocused = FALSE;
|
BOOL fFocused = FALSE;
|
||||||
|
|
||||||
#define DEFAULT_STYLES (WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS)
|
#define DEFAULT_STYLES (WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS)
|
||||||
|
@ -962,8 +947,8 @@ int WINAPI createCfgDlg()
|
||||||
0,
|
0,
|
||||||
WS_EX_RTLREADING },
|
WS_EX_RTLREADING },
|
||||||
{ "STATIC", // FIELD_BITMAP
|
{ "STATIC", // FIELD_BITMAP
|
||||||
DEFAULT_STYLES | SS_BITMAP | SS_CENTERIMAGE,
|
DEFAULT_STYLES | SS_BITMAP,
|
||||||
DEFAULT_STYLES | SS_BITMAP | SS_CENTERIMAGE,
|
DEFAULT_STYLES | SS_BITMAP,
|
||||||
0,
|
0,
|
||||||
WS_EX_RTLREADING },
|
WS_EX_RTLREADING },
|
||||||
{ "BUTTON", // FIELD_BROWSEBUTTON
|
{ "BUTTON", // FIELD_BROWSEBUTTON
|
||||||
|
@ -1042,12 +1027,11 @@ int WINAPI createCfgDlg()
|
||||||
|
|
||||||
// Convert from dialog units
|
// Convert from dialog units
|
||||||
|
|
||||||
RECT rect;
|
RECT rect = pField->rect;
|
||||||
|
// MapDialogRect uses the font used when a dialog is created, and ignores
|
||||||
rect.left = MulDiv(pField->rect.left, baseUnitX, 4);
|
// any subsequent WM_SETFONT messages (like we used above); so use the main
|
||||||
rect.right = MulDiv(pField->rect.right, baseUnitX, 4);
|
// NSIS window for the conversion, instead of this one.
|
||||||
rect.top = MulDiv(pField->rect.top, baseUnitY, 8);
|
MapDialogRect(mainwnd, &rect);
|
||||||
rect.bottom = MulDiv(pField->rect.bottom, baseUnitY, 8);
|
|
||||||
|
|
||||||
if (pField->rect.left < 0)
|
if (pField->rect.left < 0)
|
||||||
rect.left += mainWndWidth;
|
rect.left += mainWndWidth;
|
||||||
|
@ -1234,6 +1218,18 @@ int WINAPI createCfgDlg()
|
||||||
nImageType,
|
nImageType,
|
||||||
nImage
|
nImage
|
||||||
);
|
);
|
||||||
|
if (pField->nType == FIELD_BITMAP)
|
||||||
|
{
|
||||||
|
// Centre the image in the requested space.
|
||||||
|
// Cannot use SS_CENTERIMAGE because it behaves differently on XP to
|
||||||
|
// everything else. (Thank you Microsoft.)
|
||||||
|
RECT bmp_rect;
|
||||||
|
GetClientRect(hwCtrl, &bmp_rect);
|
||||||
|
bmp_rect.left = (rect.left + rect.right - bmp_rect.right) / 2;
|
||||||
|
bmp_rect.top = (rect.top + rect.bottom - bmp_rect.bottom) / 2;
|
||||||
|
SetWindowPos(hwCtrl, NULL, bmp_rect.left, bmp_rect.top, 0, 0,
|
||||||
|
SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1283,8 +1279,11 @@ void WINAPI showCfgDlg()
|
||||||
while (!g_done) {
|
while (!g_done) {
|
||||||
MSG msg;
|
MSG msg;
|
||||||
int nResult = GetMessage(&msg, NULL, 0, 0);
|
int nResult = GetMessage(&msg, NULL, 0, 0);
|
||||||
if (!IsDialogMessage(hConfigWindow,&msg) && !IsDialogMessage(hMainWindow,&msg) && !TranslateMessage(&msg))
|
if (!IsDialogMessage(hConfigWindow,&msg) && !IsDialogMessage(hMainWindow,&msg))
|
||||||
|
{
|
||||||
|
TranslateMessage(&msg);
|
||||||
DispatchMessage(&msg);
|
DispatchMessage(&msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// we don't save settings on cancel since that means your installer will likely
|
// we don't save settings on cancel since that means your installer will likely
|
||||||
|
|
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue