• R/O
  • SSH
  • HTTPS

tortoisesvn: Commit


Commit MetaInfo

Revision28322 (tree)
Time2018-07-28 20:56:40
Authorstefankueng

Log Message

Adjust the three resizable controls and the splitters accordingly when resizing the dialog.

Change Summary

Incremental Difference

--- trunk/src/Changelog.txt (revision 28321)
+++ trunk/src/Changelog.txt (revision 28322)
@@ -1,4 +1,8 @@
1-Version 1.10.1
1+Version 1.10.2
2+- BUG: Display issues in the log dialog when
3+ resizing the dialog. (Stefan)
4+
5+Version 1.10.1
26 - BUG: Wrong texts in conflict resolving
37 dialogs. (Stefan)
48 - BUG: Shelving from TSVN dialogs returned
--- trunk/src/TortoiseProc/LogDialog/LogDlg.cpp (revision 28321)
+++ trunk/src/TortoiseProc/LogDialog/LogDlg.cpp (revision 28322)
@@ -6319,9 +6319,9 @@
63196319 void CLogDlg::OnSize(UINT nType, int cx, int cy)
63206320 {
63216321 __super::OnSize(nType, cx, cy);
6322- //set range
63236322 if ((m_LogList) && (m_ChangedFileListCtrl))
63246323 {
6324+ // correct the splitter positions if they're out of bounds
63256325 CRect rcTop;
63266326 m_LogList.GetWindowRect(rcTop);
63276327 ScreenToClient(rcTop);
@@ -6334,38 +6334,108 @@
63346334 m_ChangedFileListCtrl.GetWindowRect(rcBottom);
63356335 ScreenToClient(rcBottom);
63366336
6337- if (rcMiddle.Height() < 100)
6338- {
6339- CRect rc;
6340- m_wndSplitter2.GetWindowRect(&rc);
6341- ScreenToClient(rc);
6342- rc.MoveToY(rc.top + 20);
6343- m_wndSplitter2.MoveWindow(&rc);
6344- DoSizeV2(20);
6345- }
6337+ CRect rcBottomLimit;
6338+ GetDlgItem(IDC_LOGINFO)->GetWindowRect(rcBottomLimit);
6339+ ScreenToClient(rcBottomLimit);
63466340
6347- if (rcTop.Height() < 100)
6341+ auto minCtrlHeight = MIN_CTRL_HEIGHT;
6342+
6343+ // the IDC_LOGINFO and the changed file list control
6344+ // have a space of 3 dlg units between them (check in the dlg resource editor)
6345+ CRect dlgUnitRect(0, 0, 3, 3);
6346+ MapDialogRect(&dlgUnitRect);
6347+
6348+ if ((rcTop.Height() < minCtrlHeight) ||
6349+ (rcMiddle.Height() < minCtrlHeight) ||
6350+ (rcBottom.Height() < minCtrlHeight) ||
6351+ (rcBottom.bottom > rcBottomLimit.top - dlgUnitRect.bottom))
63486352 {
6349- CRect rc;
6350- m_wndSplitter1.GetWindowRect(&rc);
6351- ScreenToClient(rc);
6352- rc.MoveToY(rc.top + 20);
6353- m_wndSplitter1.MoveWindow(&rc);
6354- DoSizeV1(20);
6355- }
6353+ // controls sizes and splitters need adjusting
6354+ RemoveMainAnchors();
63566355
6357- m_LogList.GetWindowRect(rcTop);
6358- ScreenToClient(rcTop);
6356+ auto hdwp = BeginDeferWindowPos(5);
6357+ auto hdwpflags = SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOREDRAW | SWP_NOZORDER;
6358+ auto splitterHeight = MIN_SPLITTER_HEIGHT;
63596359
6360- GetDlgItem(IDC_MSGVIEW)->GetWindowRect(rcMiddle);
6361- ScreenToClient(rcMiddle);
6360+ if ((rcBottom.bottom > rcBottomLimit.top - dlgUnitRect.bottom) || (rcBottom.Height() < minCtrlHeight))
6361+ {
6362+ // the bottom of the changed files list control is
6363+ // below the point it should get, so move it upwards.
6364+ // or the control is too small and needs extending.
6365+ rcBottom.bottom = rcBottomLimit.top + dlgUnitRect.bottom;
6366+ rcBottom.top = min(rcBottom.top, rcBottom.bottom - minCtrlHeight);
6367+ DeferWindowPos(hdwp, m_ChangedFileListCtrl.GetSafeHwnd(), nullptr, rcBottom.left, rcBottom.top, rcBottom.Width(), rcBottom.Height(), hdwpflags);
6368+ if (rcBottom.top < rcMiddle.bottom + splitterHeight)
6369+ {
6370+ // we also need to move splitter2 and rcMiddle.bottom upwards
6371+ CRect rcSplitter2;
6372+ m_wndSplitter2.GetWindowRect(rcSplitter2);
6373+ ScreenToClient(rcSplitter2);
6374+ rcSplitter2.top = rcBottom.top - splitterHeight;
6375+ rcSplitter2.bottom = rcBottom.top;
6376+ DeferWindowPos(hdwp, m_wndSplitter2.GetSafeHwnd(), nullptr, rcSplitter2.left, rcSplitter2.top, rcSplitter2.Width(), rcSplitter2.Height(), hdwpflags);
6377+ rcMiddle.bottom = rcSplitter2.top;
6378+ if (rcMiddle.Height() < minCtrlHeight)
6379+ {
6380+ // now the message view is too small, we have to
6381+ // move splitter1 upwards and resize the top view
6382+ CRect rcSplitter1;
6383+ m_wndSplitter1.GetWindowRect(rcSplitter1);
6384+ ScreenToClient(rcSplitter1);
6385+ rcMiddle.top = min(rcMiddle.top, rcMiddle.bottom - minCtrlHeight);
6386+ rcSplitter1.top = rcMiddle.top - splitterHeight;
6387+ rcSplitter1.bottom = rcMiddle.top;
6388+ DeferWindowPos(hdwp, m_wndSplitter1.GetSafeHwnd(), nullptr, rcSplitter1.left, rcSplitter1.top, rcSplitter1.Width(), rcSplitter1.Height(), hdwpflags);
6389+ rcTop.bottom = rcSplitter1.top;
6390+ DeferWindowPos(hdwp, m_LogList.GetSafeHwnd(), nullptr, rcTop.left, rcTop.top, rcTop.Width(), rcTop.Height(), hdwpflags);
6391+ }
6392+ rcMiddle.top = min(rcMiddle.top, rcMiddle.bottom - minCtrlHeight);
6393+ DeferWindowPos(hdwp, GetDlgItem(IDC_MSGVIEW)->GetSafeHwnd(), nullptr, rcMiddle.left, rcMiddle.top, rcMiddle.Width(), rcMiddle.Height(), hdwpflags);
6394+ }
6395+ }
6396+ if (rcTop.Height() < minCtrlHeight)
6397+ {
6398+ // the log list view is too small. Extend its height down and move splitter1 down.
6399+ rcTop.bottom = rcTop.top + minCtrlHeight;
6400+ DeferWindowPos(hdwp, m_LogList.GetSafeHwnd(), nullptr, rcTop.left, rcTop.top, rcTop.Width(), rcTop.Height(), hdwpflags);
6401+ CRect rcSplitter1;
6402+ m_wndSplitter1.GetWindowRect(rcSplitter1);
6403+ ScreenToClient(rcSplitter1);
6404+ rcSplitter1.top = rcTop.bottom;
6405+ rcSplitter1.bottom = rcSplitter1.top + splitterHeight;
6406+ DeferWindowPos(hdwp, m_wndSplitter1.GetSafeHwnd(), nullptr, rcSplitter1.left, rcSplitter1.top, rcSplitter1.Width(), rcSplitter1.Height(), hdwpflags);
6407+ // since splitter1 moves down, also adjust the message view
6408+ rcMiddle.top = rcSplitter1.bottom;
6409+ DeferWindowPos(hdwp, GetDlgItem(IDC_MSGVIEW)->GetSafeHwnd(), nullptr, rcMiddle.left, rcMiddle.top, rcMiddle.Width(), rcMiddle.Height(), hdwpflags);
6410+ }
6411+ if (rcMiddle.Height() < minCtrlHeight)
6412+ {
6413+ // the message view is too small. Extend its height down and move splitter2 down;
6414+ rcMiddle.bottom = rcMiddle.top + minCtrlHeight;
6415+ DeferWindowPos(hdwp, GetDlgItem(IDC_MSGVIEW)->GetSafeHwnd(), nullptr, rcMiddle.left, rcMiddle.top, rcMiddle.Width(), rcMiddle.Height(), hdwpflags);
6416+ CRect rcSplitter2;
6417+ m_wndSplitter2.GetWindowRect(rcSplitter2);
6418+ ScreenToClient(rcSplitter2);
6419+ rcSplitter2.top = rcMiddle.bottom;
6420+ rcSplitter2.bottom = rcSplitter2.top + splitterHeight;
6421+ DeferWindowPos(hdwp, m_wndSplitter2.GetSafeHwnd(), nullptr, rcSplitter2.left, rcSplitter2.top, rcSplitter2.Width(), rcSplitter2.Height(), hdwpflags);
6422+ // since splitter2 moves down, also adjust the changed files list control
6423+ rcBottom.top = rcSplitter2.bottom;
6424+ DeferWindowPos(hdwp, m_ChangedFileListCtrl.GetSafeHwnd(), nullptr, rcBottom.left, rcBottom.top, rcBottom.Width(), rcBottom.Height(), hdwpflags);
6425+ }
6426+ EndDeferWindowPos(hdwp);
63626427
6363- m_ChangedFileListCtrl.GetWindowRect(rcBottom);
6364- ScreenToClient(rcBottom);
6428+ AddMainAnchors();
6429+ ArrangeLayout();
6430+ }
63656431
63666432 m_wndSplitter1.SetRange(rcTop.top + MIN_CTRL_HEIGHT, rcBottom.bottom - (2 * MIN_CTRL_HEIGHT + MIN_SPLITTER_HEIGHT));
63676433 m_wndSplitter2.SetRange(rcTop.top + (2 * MIN_CTRL_HEIGHT + MIN_SPLITTER_HEIGHT), rcBottom.bottom - MIN_CTRL_HEIGHT);
63686434 m_wndSplitterLeft.SetRange(CDPIAware::Instance().Scale(80), rcTop.right - m_LogListOrigRect.Width());
6435+
6436+ m_LogList.Invalidate();
6437+ m_ChangedFileListCtrl.Invalidate();
6438+ GetDlgItem(IDC_MSGVIEW)->Invalidate();
63696439 }
63706440 }
63716441
Show on old repository browser