[ui] prevent the toolbars from disappearing

* Seriously, who at Microsoft devised this utterly broken TB_GETIDEALSIZE call?
This commit is contained in:
Pete Batard 2019-07-05 12:24:50 +01:00
parent 180e6d4364
commit 0186949255
No known key found for this signature in database
GPG key ID: 38E0CF5E69EDD671
2 changed files with 10 additions and 5 deletions

View file

@ -595,6 +595,9 @@ void ToggleAdvancedDeviceOptions(BOOL enable)
GetWindowRect(hAdvancedDeviceToolbar, &rc);
MapWindowPoints(NULL, hMainDialog, (POINT*)&rc, 2);
SendMessage(hAdvancedDeviceToolbar, TB_GETIDEALSIZE, (WPARAM)FALSE, (LPARAM)&sz);
// TB_GETIDEALSIZE may act up and report negative values
if (sz.cx < 16)
sz.cx = fw;
SetWindowPos(hAdvancedDeviceToolbar, hTargetSystem, rc.left, rc.top, sz.cx, rc.bottom - rc.top, 0);
// Move the controls up or down
@ -637,6 +640,8 @@ void ToggleAdvancedFormatOptions(BOOL enable)
GetWindowRect(hAdvancedFormatToolbar, &rc);
MapWindowPoints(NULL, hMainDialog, (POINT*)&rc, 2);
SendMessage(hAdvancedFormatToolbar, TB_GETIDEALSIZE, (WPARAM)FALSE, (LPARAM)&sz);
if (sz.cx < 16)
sz.cx = fw;
SetWindowPos(hAdvancedFormatToolbar, hClusterSize, rc.left, rc.top, sz.cx, rc.bottom - rc.top, 0);
// Move the controls up or down