• R/O
  • SSH
  • HTTPS

tortoisesvn: Commit


Commit MetaInfo

Revision28244 (tree)
Time2018-06-02 17:01:17
Authorstefankueng

Log Message

use the caption height of the non-client-metrics instead of misusing a tab control.
This also fixes wrong heights in high-dpi setups.

Change Summary

Incremental Difference

--- trunk/ext/TreePropSheet/TreePropSheet.cpp (revision 28243)
+++ trunk/ext/TreePropSheet/TreePropSheet.cpp (revision 28244)
@@ -801,13 +801,10 @@
801801 rectTree.right = rectTree.left + nTreeWidth - nTreeSpace;
802802
803803 // calculate caption height
804- CTabCtrl wndTabCtrl;
805- wndTabCtrl.Create(WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS, rectFrame, this, 0x1234);
806- wndTabCtrl.InsertItem(0, _T(""));
807- CRect rectFrameCaption;
808- wndTabCtrl.GetItemRect(0, rectFrameCaption);
809- wndTabCtrl.DestroyWindow();
810- m_pFrame->SetCaptionHeight(rectFrameCaption.Height());
804+ NONCLIENTMETRICS metrics = { 0 };
805+ metrics.cbSize = sizeof(NONCLIENTMETRICS);
806+ SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &metrics, FALSE);
807+ m_pFrame->SetCaptionHeight(metrics.iCaptionHeight);
811808
812809 // if no caption should be displayed, make the window smaller in
813810 // height
@@ -816,20 +813,20 @@
816813 // make frame smaller
817814 m_pFrame->GetWnd()->GetWindowRect(rectFrame);
818815 ScreenToClient(rectFrame);
819- rectFrame.top+= rectFrameCaption.Height();
816+ rectFrame.top+= metrics.iCaptionHeight;
820817 m_pFrame->GetWnd()->MoveWindow(rectFrame);
821818
822819 // move all child windows up
823- MoveChildWindows(0, -rectFrameCaption.Height());
820+ MoveChildWindows(0, -metrics.iCaptionHeight);
824821
825822 // modify rectangle for the tree ctrl
826- rectTree.bottom-= rectFrameCaption.Height();
823+ rectTree.bottom-= metrics.iCaptionHeight;
827824
828825 // make us smaller
829826 CRect rect;
830827 GetWindowRect(rect);
831- rect.top+= rectFrameCaption.Height()/2;
832- rect.bottom-= rectFrameCaption.Height()-rectFrameCaption.Height()/2;
828+ rect.top+= metrics.iCaptionHeight /2;
829+ rect.bottom -= metrics.iCaptionHeight - metrics.iCaptionHeight / 2;
833830 if (GetParent())
834831 GetParent()->ScreenToClient(rect);
835832 MoveWindow(rect);
Show on old repository browser