Enhance ShortcutMapper resizing

- keep centered buttons while resizing
- set minimum width and height

Close #4178
This commit is contained in:
Christophe Meriaux 2018-02-12 23:44:52 +01:00 committed by Don HO
parent 883045d96f
commit 7572015bda
2 changed files with 21 additions and 1 deletions

View File

@ -425,8 +425,24 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
_clientWidth = rect.right - rect.left;
_clientHeight = rect.bottom - rect.top;
int cy_border = GetSystemMetrics(SM_CYFRAME);
int cy_caption = GetSystemMetrics(SM_CYCAPTION);
_initClientWidth = _clientWidth;
_initClientHeight = _clientHeight + cy_caption + cy_border;
_dialogInitDone = true;
return TRUE;
}
case WM_GETMINMAXINFO :
{
MINMAXINFO* mmi = (MINMAXINFO*)lParam;
if (_dialogInitDone)
{
mmi->ptMinTrackSize.x = _initClientWidth;
mmi->ptMinTrackSize.y = _initClientHeight;
}
return 0;
}
case WM_DESTROY:
{
@ -464,7 +480,7 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
HWND moveHwnd = ::GetDlgItem(_hSelf, moveWndID);
::GetWindowRect(moveHwnd, &rect);
::MapWindowPoints(NULL, _hSelf, (LPPOINT)&rect, 2);
::SetWindowPos(moveHwnd, NULL, rect.left + addWidth, rect.top + addHeight, 0, 0, SWP_NOSIZE | flags);
::SetWindowPos(moveHwnd, NULL, rect.left + addWidth / 2, rect.top + addHeight, 0, 0, SWP_NOSIZE | flags);
}
HWND moveHwnd = ::GetDlgItem(_hSelf, IDC_BABYGRID_STATIC);
::GetWindowRect(moveHwnd, &rect);

View File

@ -39,6 +39,7 @@ class ShortcutMapper : public StaticDialog {
public:
ShortcutMapper() : _currentState(STATE_MENU), StaticDialog() {
_shortcutFilter = TEXT("");
_dialogInitDone = false;
};
~ShortcutMapper() {};
@ -100,6 +101,9 @@ private:
};
LONG _clientWidth;
LONG _clientHeight;
LONG _initClientWidth;
LONG _initClientHeight;
bool _dialogInitDone;
void initTabs();
void initBabyGrid();