Skip to content

Commit

Permalink
Enhance ShortcutMapper resizing
Browse files Browse the repository at this point in the history
- keep centered buttons while resizing
- set minimum width and height

Close #4178
  • Loading branch information
cmeriaux authored and donho committed Feb 19, 2018
1 parent 883045d commit 7572015
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
18 changes: 17 additions & 1 deletion PowerEditor/src/WinControls/Grid/ShortcutMapper.cpp
Expand Up @@ -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:
{
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 4 additions & 0 deletions PowerEditor/src/WinControls/Grid/ShortcutMapper.h
Expand Up @@ -39,6 +39,7 @@ class ShortcutMapper : public StaticDialog {
public:
ShortcutMapper() : _currentState(STATE_MENU), StaticDialog() {
_shortcutFilter = TEXT("");
_dialogInitDone = false;
};
~ShortcutMapper() {};

Expand Down Expand Up @@ -100,6 +101,9 @@ protected :
};
LONG _clientWidth;
LONG _clientHeight;
LONG _initClientWidth;
LONG _initClientHeight;
bool _dialogInitDone;

void initTabs();
void initBabyGrid();
Expand Down

0 comments on commit 7572015

Please sign in to comment.