- fixed bug #848868 - StartMenu trims 3 lines of text
- made StartMenu treat different fonts better, it will not resize according to the selected font git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@3261 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
1ad157554c
commit
45c040b909
2 changed files with 72 additions and 59 deletions
|
@ -118,18 +118,27 @@ static BOOL CALLBACK ParentWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARA
|
||||||
return bRes;
|
return bRes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AddRTLStyle(HWND hWnd, long dwStyle)
|
||||||
|
{
|
||||||
|
long s;
|
||||||
|
|
||||||
|
s = GetWindowLong(hWnd, GWL_STYLE);
|
||||||
|
SetWindowLong(hWnd, GWL_STYLE, s | dwStyle);
|
||||||
|
s = GetWindowLong(hWnd, GWL_EXSTYLE);
|
||||||
|
SetWindowLong(hWnd, GWL_EXSTYLE, s | WS_EX_RIGHT | WS_EX_RTLREADING);
|
||||||
|
}
|
||||||
|
|
||||||
#define ProgressiveSetWindowPos(hwWindow, x, cx, cy) \
|
#define ProgressiveSetWindowPos(hwWindow, x, cx, cy) \
|
||||||
SetWindowPos( \
|
MoveWindow( \
|
||||||
hwWindow, \
|
hwWindow, \
|
||||||
0, \
|
|
||||||
x, \
|
x, \
|
||||||
y_offset, \
|
y_offset, \
|
||||||
cx, \
|
cx, \
|
||||||
cy, \
|
cy, \
|
||||||
SWP_NOACTIVATE | SWP_NOZORDER \
|
FALSE \
|
||||||
); \
|
); \
|
||||||
\
|
\
|
||||||
y_offset += cy + 5;
|
y_offset += cy + 3;
|
||||||
|
|
||||||
BOOL CALLBACK dlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
BOOL CALLBACK dlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
|
@ -146,27 +155,43 @@ BOOL CALLBACK dlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
|
|
||||||
RECT dialog_r, temp_r;
|
RECT dialog_r, temp_r;
|
||||||
|
|
||||||
HFONT hFont = (HFONT)SendMessage(hwParent, WM_GETFONT, 0, 0);
|
HFONT hFont = (HFONT) SendMessage(hwParent, WM_GETFONT, 0, 0);
|
||||||
|
|
||||||
int y_offset = 0;
|
int y_offset = 0;
|
||||||
|
|
||||||
int width, height;
|
int width, height;
|
||||||
|
|
||||||
|
int baseUnitY;
|
||||||
|
|
||||||
|
// Init dialog unit conversion
|
||||||
|
|
||||||
|
{
|
||||||
|
TEXTMETRIC tm;
|
||||||
|
HDC hDC;
|
||||||
|
|
||||||
|
hDC = GetDC(hwndDlg);
|
||||||
|
SelectObject(hDC, hFont);
|
||||||
|
|
||||||
|
GetTextMetrics(hDC, &tm);
|
||||||
|
baseUnitY = tm.tmHeight;
|
||||||
|
|
||||||
|
ReleaseDC(hwndDlg, hDC);
|
||||||
|
}
|
||||||
|
|
||||||
GetWindowRect(hwChild, &dialog_r);
|
GetWindowRect(hwChild, &dialog_r);
|
||||||
ScreenToClient(hwParent, (LPPOINT) &dialog_r);
|
ScreenToClient(hwParent, (LPPOINT) &dialog_r);
|
||||||
ScreenToClient(hwParent, ((LPPOINT) &dialog_r)+1);
|
ScreenToClient(hwParent, ((LPPOINT) &dialog_r) + 1);
|
||||||
|
|
||||||
width = dialog_r.right - dialog_r.left;
|
width = dialog_r.right - dialog_r.left;
|
||||||
height = dialog_r.bottom - dialog_r.top;
|
height = dialog_r.bottom - dialog_r.top;
|
||||||
|
|
||||||
SetWindowPos(
|
MoveWindow(
|
||||||
hwndDlg,
|
hwndDlg,
|
||||||
0,
|
|
||||||
dialog_r.left,
|
dialog_r.left,
|
||||||
dialog_r.top,
|
dialog_r.top,
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
SWP_NOZORDER | SWP_NOACTIVATE
|
FALSE
|
||||||
);
|
);
|
||||||
|
|
||||||
hwIcon = GetDlgItem(hwndDlg, IDC_NSISICON);
|
hwIcon = GetDlgItem(hwndDlg, IDC_NSISICON);
|
||||||
|
@ -182,27 +207,14 @@ BOOL CALLBACK dlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
|
|
||||||
if (rtl)
|
if (rtl)
|
||||||
{
|
{
|
||||||
long s;
|
AddRTLStyle(hwText, SS_RIGHT);
|
||||||
|
AddRTLStyle(hwLocation, ES_RIGHT);
|
||||||
s = GetWindowLong(hwText, GWL_STYLE);
|
AddRTLStyle(hwDirList, 0);
|
||||||
SetWindowLong(hwText, GWL_STYLE, (s & ~SS_LEFT) | SS_RIGHT);
|
AddRTLStyle(hwCheckBox, BS_RIGHT | BS_LEFTTEXT);
|
||||||
s = GetWindowLong(hwText, GWL_EXSTYLE);
|
|
||||||
SetWindowLong(hwText, GWL_EXSTYLE, s | WS_EX_RTLREADING);
|
|
||||||
|
|
||||||
s = GetWindowLong(hwLocation, GWL_STYLE);
|
|
||||||
SetWindowLong(hwLocation, GWL_STYLE, (s & ~ES_LEFT) | ES_RIGHT);
|
|
||||||
s = GetWindowLong(hwLocation, GWL_EXSTYLE);
|
|
||||||
SetWindowLong(hwLocation, GWL_EXSTYLE, s | WS_EX_RTLREADING);
|
|
||||||
|
|
||||||
s = GetWindowLong(hwDirList, GWL_EXSTYLE);
|
|
||||||
SetWindowLong(hwDirList, GWL_EXSTYLE, s | WS_EX_RIGHT | WS_EX_RTLREADING);
|
|
||||||
|
|
||||||
s = GetWindowLong(hwCheckBox, GWL_STYLE);
|
|
||||||
SetWindowLong(hwCheckBox, GWL_STYLE, s | BS_RIGHT | BS_LEFTTEXT);
|
|
||||||
s = GetWindowLong(hwCheckBox, GWL_EXSTYLE);
|
|
||||||
SetWindowLong(hwCheckBox, GWL_EXSTYLE, s | WS_EX_RTLREADING);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GetClientRect(hwIcon, &temp_r);
|
||||||
|
|
||||||
if (!noicon)
|
if (!noicon)
|
||||||
{
|
{
|
||||||
SendMessage(
|
SendMessage(
|
||||||
|
@ -211,48 +223,51 @@ BOOL CALLBACK dlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
IMAGE_ICON,
|
IMAGE_ICON,
|
||||||
(LPARAM)LoadIcon(GetModuleHandle(0), MAKEINTRESOURCE(103))
|
(LPARAM)LoadIcon(GetModuleHandle(0), MAKEINTRESOURCE(103))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
MoveWindow(
|
||||||
|
hwIcon,
|
||||||
|
rtl ? width - temp_r.right : 0,
|
||||||
|
0,
|
||||||
|
temp_r.right,
|
||||||
|
temp_r.bottom,
|
||||||
|
FALSE
|
||||||
|
);
|
||||||
|
|
||||||
|
temp_r.right += 3;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ShowWindow(hwIcon, SW_HIDE);
|
||||||
|
|
||||||
|
temp_r.right = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetClientRect(hwIcon, &temp_r);
|
|
||||||
|
|
||||||
SetWindowPos(
|
|
||||||
hwIcon,
|
|
||||||
0,
|
|
||||||
rtl ? width - temp_r.right : 0,
|
|
||||||
0,
|
|
||||||
temp_r.right,
|
|
||||||
temp_r.bottom,
|
|
||||||
SWP_NOZORDER | SWP_NOACTIVATE | (noicon ? SWP_HIDEWINDOW : 0)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (rtl)
|
if (rtl)
|
||||||
{
|
{
|
||||||
ProgressiveSetWindowPos(
|
ProgressiveSetWindowPos(
|
||||||
hwText,
|
hwText,
|
||||||
0,
|
0,
|
||||||
width - (noicon ? 0 : temp_r.right + 5),
|
width - temp_r.right,
|
||||||
temp_r.bottom + 2
|
3 * baseUnitY //MulDiv(24, baseUnitY, 8);
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ProgressiveSetWindowPos(
|
ProgressiveSetWindowPos(
|
||||||
hwText,
|
hwText,
|
||||||
noicon ? 0 : temp_r.right + 5,
|
temp_r.right,
|
||||||
width - (noicon ? 0 : temp_r.right + 5),
|
width - temp_r.right + 3,
|
||||||
temp_r.bottom + 2
|
3 * baseUnitY //MulDiv(24, baseUnitY, 8);
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SetWindowText(hwText, *text ? text : "Select the Start Menu folder in which you would like to create the program's shortcuts:");
|
SetWindowText(hwText, *text ? text : "Select the Start Menu folder in which you would like to create the program's shortcuts:");
|
||||||
|
|
||||||
GetWindowRect(hwLocation, &temp_r);
|
|
||||||
|
|
||||||
ProgressiveSetWindowPos(
|
ProgressiveSetWindowPos(
|
||||||
hwLocation,
|
hwLocation,
|
||||||
0,
|
0,
|
||||||
width,
|
width,
|
||||||
temp_r.bottom - temp_r.top
|
MulDiv(12, baseUnitY, 8)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (*lastused == '>')
|
if (*lastused == '>')
|
||||||
|
@ -265,26 +280,24 @@ BOOL CALLBACK dlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
|
|
||||||
SetWindowText(hwLocation, *lastused ? lastused : progname);
|
SetWindowText(hwLocation, *lastused ? lastused : progname);
|
||||||
|
|
||||||
GetWindowRect(hwCheckBox, &temp_r);
|
temp_r.bottom = MulDiv(8, baseUnitY, 8);
|
||||||
ScreenToClient(hwndDlg, ((LPPOINT) &temp_r));
|
|
||||||
ScreenToClient(hwndDlg, ((LPPOINT) &temp_r) + 1);
|
|
||||||
|
|
||||||
ProgressiveSetWindowPos(
|
ProgressiveSetWindowPos(
|
||||||
hwDirList,
|
hwDirList,
|
||||||
0,
|
0,
|
||||||
width,
|
width,
|
||||||
height - y_offset - (*checkbox ? temp_r.bottom - temp_r.top + 5 : 0)
|
height - y_offset - (*checkbox ? temp_r.bottom + 3 : 0)
|
||||||
);
|
|
||||||
|
|
||||||
ProgressiveSetWindowPos(
|
|
||||||
hwCheckBox,
|
|
||||||
0,
|
|
||||||
width,
|
|
||||||
temp_r.bottom - temp_r.top
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if (*checkbox)
|
if (*checkbox)
|
||||||
{
|
{
|
||||||
|
ProgressiveSetWindowPos(
|
||||||
|
hwCheckBox,
|
||||||
|
0,
|
||||||
|
width,
|
||||||
|
temp_r.bottom
|
||||||
|
);
|
||||||
|
|
||||||
ShowWindow(hwCheckBox, SW_SHOWNA);
|
ShowWindow(hwCheckBox, SW_SHOWNA);
|
||||||
SetWindowText(hwCheckBox, checkbox);
|
SetWindowText(hwCheckBox, checkbox);
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue