• R/O
  • SSH
  • HTTPS

tortoisesvn: Commit


Commit MetaInfo

Revision28273 (tree)
Time2018-07-08 22:06:32
Authorstefankueng

Log Message

Scale the buttons and icons for high-dpi screens.

Change Summary

Incremental Difference

--- trunk/src/TortoiseProc/RepositoryBar.cpp (revision 28272)
+++ trunk/src/TortoiseProc/RepositoryBar.cpp (revision 28273)
@@ -1,6 +1,6 @@
1-// TortoiseSVN - a Windows shell extension for easy version control
1+// TortoiseSVN - a Windows shell extension for easy version control
22
3-// Copyright (C) 2003-2017 - TortoiseSVN
3+// Copyright (C) 2003-2018 - TortoiseSVN
44
55 // This program is free software; you can redistribute it and/or
66 // modify it under the terms of the GNU General Public License
@@ -25,6 +25,7 @@
2525 #include "SVNHelpers.h"
2626 #include "WaitCursorEx.h"
2727 #include "CommonAppUtils.h"
28+#include "DPIAware.h"
2829
2930 #define IDC_URL_COMBO 10000
3031 #define IDC_REVISION_BTN 10001
@@ -100,9 +101,11 @@
100101 rbbi.fMask |= RBBS_CHILDEDGE;
101102 int bandpos = 0;
102103 // Create the "Back" button control to be added
103- rect = CRect(0, 0, 24, 24);
104+ auto size = CDPIAware::Instance().Scale(24);
105+ auto iconSize = GetSystemMetrics(SM_CXSMICON);
106+ rect = CRect(0, 0, size, size);
104107 m_btnBack.Create(L"BACK", WS_CHILD | WS_TABSTOP | BS_PUSHBUTTON | BS_ICON, rect, this, IDC_BACK_BTN);
105- m_btnBack.SetImage(CCommonAppUtils::LoadIconEx(IDI_BACKWARD, 16, 16, LR_DEFAULTCOLOR));
108+ m_btnBack.SetImage(CCommonAppUtils::LoadIconEx(IDI_BACKWARD, iconSize, iconSize, LR_DEFAULTCOLOR));
106109 m_btnBack.SetWindowText(L"");
107110 m_btnBack.Invalidate();
108111 rbbi.lpText = L"";
@@ -115,9 +118,9 @@
115118 if (!InsertBand(bandpos++, &rbbi))
116119 return false;
117120 // Create the "Forward" button control to be added
118- rect = CRect(0, 0, 24, 24);
121+ rect = CRect(0, 0, size, size);
119122 m_btnForward.Create(L"FORWARD", WS_CHILD | WS_TABSTOP | BS_PUSHBUTTON | BS_ICON, rect, this, IDC_FORWARD_BTN);
120- m_btnForward.SetImage(CCommonAppUtils::LoadIconEx(IDI_FORWARD, 16, 16, LR_DEFAULTCOLOR));
123+ m_btnForward.SetImage(CCommonAppUtils::LoadIconEx(IDI_FORWARD, iconSize, iconSize, LR_DEFAULTCOLOR));
121124 m_btnForward.SetWindowText(L"");
122125 m_btnForward.Invalidate();
123126 rbbi.lpText = L"";
@@ -131,7 +134,7 @@
131134 return false;
132135
133136 // Create the "URL" combo box control to be added
134- rect = CRect(0, 0, 100, 400);
137+ rect = CRect(0, 0, CDPIAware::Instance().Scale(100), CDPIAware::Instance().Scale(400));
135138 m_cbxUrl.Create(WS_CHILD | WS_TABSTOP | CBS_DROPDOWN, rect, this, IDC_URL_COMBO);
136139 m_cbxUrl.SetURLHistory(true, false);
137140 m_cbxUrl.SetFont(font);
@@ -143,18 +146,18 @@
143146 rbbi.clrBack = ::GetSysColor(COLOR_BTNFACE);
144147 rbbi.cx = rect.Width();
145148 rbbi.cxMinChild = rect.Width();
146- rbbi.cyMinChild = m_cbxUrl.GetItemHeight(-1) + 10;
149+ rbbi.cyMinChild = m_cbxUrl.GetItemHeight(-1) + CDPIAware::Instance().Scale(10);
147150 if (!InsertBand(bandpos++, &rbbi))
148151 return false;
149152
150153 // Reposition the combobox for correct redrawing
151154 m_cbxUrl.GetWindowRect(rect);
152- m_cbxUrl.MoveWindow(rect.left, rect.top, rect.Width(), 300);
155+ m_cbxUrl.MoveWindow(rect.left, rect.top, rect.Width(), CDPIAware::Instance().Scale(300));
153156
154157 // Create the "Up" button control to be added
155- rect = CRect(0, 0, 24, m_cbxUrl.GetItemHeight(-1) + 8);
158+ rect = CRect(0, 0, size, m_cbxUrl.GetItemHeight(-1) + CDPIAware::Instance().Scale(8));
156159 m_btnUp.Create(L"UP", WS_CHILD | WS_TABSTOP | BS_PUSHBUTTON | BS_ICON, rect, this, IDC_UP_BTN);
157- m_btnUp.SetImage(CCommonAppUtils::LoadIconEx(IDI_UP, 16, 16, LR_DEFAULTCOLOR));
160+ m_btnUp.SetImage(CCommonAppUtils::LoadIconEx(IDI_UP, iconSize, iconSize, LR_DEFAULTCOLOR));
158161 m_btnUp.SetWindowText(L"");
159162 m_btnUp.Invalidate();
160163 rbbi.lpText = L"";
@@ -168,7 +171,7 @@
168171 return false;
169172
170173 // Create the "Revision" button control to be added
171- rect = CRect(0, 0, 60, m_cbxUrl.GetItemHeight(-1) + 10);
174+ rect = CRect(0, 0, CDPIAware::Instance().Scale(60), m_cbxUrl.GetItemHeight(-1) + CDPIAware::Instance().Scale(10));
172175 m_btnRevision.Create(L"HEAD", WS_CHILD | WS_TABSTOP | BS_PUSHBUTTON, rect, this, IDC_REVISION_BTN);
173176 m_btnRevision.SetFont(font);
174177 temp.LoadString(IDS_REPO_BROWSEREV);
Show on old repository browser