Revision | 28203 (tree) |
---|---|
Zeit | 2018-04-21 21:36:38 |
Autor | stefankueng |
Merged revision(s) r28191, r28195, r28196, r28197, r28198, r28199, r28200, r28201, r28202 from trunk:
* doc: compress images losslessly.
* use the correct dialog titles and command button texts when handling different kinds of conflicts.
* extend the label to make room for translated strings.
* mark the 1.9.8 version in the changelog as unreleased.
* When shelving from the status list control, always show the UI because we need a name to store the shelve.
* Return early in case of an error, do not try to access the invalid hash.
* use the improved DPIAware class from the sktoolslib.
* Make the toolbar icons size up for high dpi monitors.
* use the new bigger icons from CommitMonitor.
@@ -1,4 +1,18 @@ | ||
1 | -Version 1.9.8 | |
1 | +Version 1.10.1 | |
2 | +- BUG: Wrong texts in conflict resolving | |
3 | + dialogs. (Stefan) | |
4 | +- BUG: Shelving from TSVN dialogs returned | |
5 | + an error. (Stefan) | |
6 | +- BUG: Crash when trying to unshelve from | |
7 | + an outdated or corrupted working copy. (Stefan) | |
8 | +- CHG: Improved project monitor toolbar for | |
9 | + high dpi monitors. (Stefan) | |
10 | + | |
11 | +Version 1.10.0 | |
12 | +See the release notes here: | |
13 | +http://tortoisesvn.net/tsvn_1.10_releasenotes.html | |
14 | + | |
15 | +Version 1.9.8 (unreleased) | |
2 | 16 | - BUG: GDI leak in repobrowser. (Stefan) |
3 | 17 | - BUG: Endless loop in vendor-branch. (Stefan) |
4 | 18 | - CHG: New line margin icons and minor high dpi refinements |
@@ -262,6 +262,9 @@ | ||
262 | 262 | subpool, subpool), |
263 | 263 | NULL |
264 | 264 | ); |
265 | + if (Err) | |
266 | + return false; | |
267 | + | |
265 | 268 | apr_hash_index_t *hi; |
266 | 269 | for (hi = apr_hash_first(subpool, names_hash); hi; hi = apr_hash_next(hi)) |
267 | 270 | { |
@@ -270,7 +273,7 @@ | ||
270 | 273 | } |
271 | 274 | std::sort(Names.begin(), Names.end()); |
272 | 275 | |
273 | - return (Err == NULL); | |
276 | + return (Err == nullptr); | |
274 | 277 | } |
275 | 278 | |
276 | 279 | bool SVN::Checkout(const CTSVNPath& moduleName, const CTSVNPath& destPath, const SVNRev& pegrev, |
@@ -4081,7 +4081,7 @@ | ||
4081 | 4081 | CString sTempFile = CTempFiles::Instance().GetTempFilePath(false).GetWinPathString(); |
4082 | 4082 | targetList.WriteToFile(sTempFile, false); |
4083 | 4083 | CString sCmd; |
4084 | - sCmd.Format(L"/command:shelve /pathfile:\"%s\" /deletepathfile /noui", (LPCTSTR)sTempFile); | |
4084 | + sCmd.Format(L"/command:shelve /pathfile:\"%s\" /deletepathfile", (LPCTSTR)sTempFile); | |
4085 | 4085 | if (GetAsyncKeyState(VK_SHIFT) & 0x8000) |
4086 | 4086 | { |
4087 | 4087 | sCmd += L" /showoptions"; |
@@ -28,7 +28,7 @@ | ||
28 | 28 | #include "GotoLineDlg.h" |
29 | 29 | #include "EncodingDlg.h" |
30 | 30 | #include "EditorConfigWrapper.h" |
31 | -#include "DpiScale.h" | |
31 | +#include "DPIAware.h" | |
32 | 32 | |
33 | 33 | // Note about lines: |
34 | 34 | // We use three different kind of lines here: |
@@ -1644,7 +1644,6 @@ | ||
1644 | 1644 | } |
1645 | 1645 | else |
1646 | 1646 | { |
1647 | - CDpiScale dpi(pDC->GetSafeHdc()); | |
1648 | 1647 | CPen pen(PS_SOLID, 0, m_WhiteSpaceFg); |
1649 | 1648 | CPen * oldpen = pDC->SelectObject(&pen); |
1650 | 1649 | int yMiddle = origin.y + rc.Height()/2; |
@@ -1656,10 +1655,10 @@ | ||
1656 | 1655 | { |
1657 | 1656 | // multiline |
1658 | 1657 | bMultiline = true; |
1659 | - pDC->MoveTo(origin.x, yMiddle-dpi.ScaleY(2)); | |
1660 | - pDC->LineTo(origin.x+GetCharWidth()-dpi.ScaleX(1), yMiddle-dpi.ScaleY(2)); | |
1661 | - pDC->LineTo(origin.x+GetCharWidth()-dpi.ScaleX(1), yMiddle+dpi.ScaleY(2)); | |
1662 | - pDC->LineTo(origin.x, yMiddle+dpi.ScaleY(2)); | |
1658 | + pDC->MoveTo(origin.x, yMiddle- CDPIAware::Instance().ScaleY(2)); | |
1659 | + pDC->LineTo(origin.x+GetCharWidth()-CDPIAware::Instance().ScaleX(1), yMiddle-CDPIAware::Instance().ScaleY(2)); | |
1660 | + pDC->LineTo(origin.x+GetCharWidth()-CDPIAware::Instance().ScaleX(1), yMiddle+CDPIAware::Instance().ScaleY(2)); | |
1661 | + pDC->LineTo(origin.x, yMiddle+ CDPIAware::Instance().ScaleY(2)); | |
1663 | 1662 | } |
1664 | 1663 | else if (GetLineLength(nLineIndex) == 0) |
1665 | 1664 | bMultiline = true; |
@@ -1674,32 +1673,32 @@ | ||
1674 | 1673 | case EOL_AUTOLINE: |
1675 | 1674 | case EOL_CRLF: |
1676 | 1675 | // arrow from top to middle+2, then left |
1677 | - pDC->MoveTo(origin.x+GetCharWidth()-dpi.ScaleX(1), rc.top+dpi.ScaleY(1)); | |
1678 | - pDC->LineTo(origin.x+GetCharWidth()-dpi.ScaleX(1), yMiddle); | |
1676 | + pDC->MoveTo(origin.x+GetCharWidth()-CDPIAware::Instance().ScaleX(1), rc.top+ CDPIAware::Instance().ScaleY(1)); | |
1677 | + pDC->LineTo(origin.x+GetCharWidth()-CDPIAware::Instance().ScaleX(1), yMiddle); | |
1679 | 1678 | case EOL_CR: |
1680 | 1679 | // arrow from right to left |
1681 | - pDC->MoveTo(origin.x+GetCharWidth()-dpi.ScaleX(1), yMiddle); | |
1680 | + pDC->MoveTo(origin.x+GetCharWidth()-CDPIAware::Instance().ScaleX(1), yMiddle); | |
1682 | 1681 | pDC->LineTo(origin.x, yMiddle); |
1683 | - pDC->LineTo(origin.x+dpi.ScaleX(4), yMiddle+dpi.ScaleY(4)); | |
1682 | + pDC->LineTo(origin.x+CDPIAware::Instance().ScaleX(4), yMiddle+CDPIAware::Instance().ScaleY(4)); | |
1684 | 1683 | pDC->MoveTo(origin.x, yMiddle); |
1685 | - pDC->LineTo(origin.x+dpi.ScaleX(4), yMiddle-dpi.ScaleY(4)); | |
1684 | + pDC->LineTo(origin.x+CDPIAware::Instance().ScaleX(4), yMiddle-CDPIAware::Instance().ScaleY(4)); | |
1686 | 1685 | break; |
1687 | 1686 | case EOL_LFCR: |
1688 | 1687 | // from right-upper to left then down |
1689 | - pDC->MoveTo(origin.x+GetCharWidth()-dpi.ScaleX(1), yMiddle-dpi.ScaleY(2)); | |
1690 | - pDC->LineTo(xMiddle, yMiddle-dpi.ScaleY(2)); | |
1691 | - pDC->LineTo(xMiddle, rc.bottom-dpi.ScaleY(1)); | |
1692 | - pDC->LineTo(xMiddle+dpi.ScaleX(4), rc.bottom-dpi.ScaleY(5)); | |
1693 | - pDC->MoveTo(xMiddle, rc.bottom-dpi.ScaleY(1)); | |
1694 | - pDC->LineTo(xMiddle-dpi.ScaleX(4), rc.bottom-dpi.ScaleY(5)); | |
1688 | + pDC->MoveTo(origin.x+GetCharWidth()-CDPIAware::Instance().ScaleX(1), yMiddle-CDPIAware::Instance().ScaleY(2)); | |
1689 | + pDC->LineTo(xMiddle, yMiddle-CDPIAware::Instance().ScaleY(2)); | |
1690 | + pDC->LineTo(xMiddle, rc.bottom-CDPIAware::Instance().ScaleY(1)); | |
1691 | + pDC->LineTo(xMiddle+CDPIAware::Instance().ScaleX(4), rc.bottom-CDPIAware::Instance().ScaleY(5)); | |
1692 | + pDC->MoveTo(xMiddle, rc.bottom-CDPIAware::Instance().ScaleY(1)); | |
1693 | + pDC->LineTo(xMiddle-CDPIAware::Instance().ScaleX(4), rc.bottom-CDPIAware::Instance().ScaleY(5)); | |
1695 | 1694 | break; |
1696 | 1695 | case EOL_LF: |
1697 | 1696 | // arrow from top to bottom |
1698 | 1697 | pDC->MoveTo(xMiddle, rc.top); |
1699 | - pDC->LineTo(xMiddle, rc.bottom-dpi.ScaleY(1)); | |
1700 | - pDC->LineTo(xMiddle+dpi.ScaleX(4), rc.bottom-dpi.ScaleY(5)); | |
1701 | - pDC->MoveTo(xMiddle, rc.bottom-dpi.ScaleY(1)); | |
1702 | - pDC->LineTo(xMiddle-dpi.ScaleX(4), rc.bottom-dpi.ScaleY(5)); | |
1698 | + pDC->LineTo(xMiddle, rc.bottom-CDPIAware::Instance().ScaleY(1)); | |
1699 | + pDC->LineTo(xMiddle+CDPIAware::Instance().ScaleX(4), rc.bottom-CDPIAware::Instance().ScaleY(5)); | |
1700 | + pDC->MoveTo(xMiddle, rc.bottom-CDPIAware::Instance().ScaleY(1)); | |
1701 | + pDC->LineTo(xMiddle-CDPIAware::Instance().ScaleX(4), rc.bottom-CDPIAware::Instance().ScaleY(5)); | |
1703 | 1702 | break; |
1704 | 1703 | case EOL_FF: // Form Feed, U+000C |
1705 | 1704 | case EOL_NEL: // Next Line, U+0085 |
@@ -2054,7 +2053,6 @@ | ||
2054 | 2053 | int y = rc.top + (rc.bottom-rc.top)/2; |
2055 | 2054 | xpos -= m_nOffsetChar * GetCharWidth(); |
2056 | 2055 | |
2057 | - CDpiScale dpi(pDC->GetSafeHdc()); | |
2058 | 2056 | CPen pen(PS_SOLID, 0, m_WhiteSpaceFg); |
2059 | 2057 | while (*pszChars) |
2060 | 2058 | { |
@@ -2072,11 +2070,11 @@ | ||
2072 | 2070 | if ((xposreal > 0) || (nSpaces > 0)) |
2073 | 2071 | { |
2074 | 2072 | CPen * oldPen = pDC->SelectObject(&pen); |
2075 | - pDC->MoveTo(xposreal + rc.left + dpi.ScaleX(2), y); | |
2076 | - pDC->LineTo((xpos + nSpaces * GetCharWidth()) + rc.left - dpi.ScaleX(2), y); | |
2077 | - pDC->LineTo((xpos + nSpaces * GetCharWidth()) + rc.left - dpi.ScaleX(6), y - dpi.ScaleY(4)); | |
2078 | - pDC->MoveTo((xpos + nSpaces * GetCharWidth()) + rc.left - dpi.ScaleX(2), y); | |
2079 | - pDC->LineTo((xpos + nSpaces * GetCharWidth()) + rc.left - dpi.ScaleX(6), y + dpi.ScaleY(4)); | |
2073 | + pDC->MoveTo(xposreal + rc.left + CDPIAware::Instance().ScaleX(2), y); | |
2074 | + pDC->LineTo((xpos + nSpaces * GetCharWidth()) + rc.left - CDPIAware::Instance().ScaleX(2), y); | |
2075 | + pDC->LineTo((xpos + nSpaces * GetCharWidth()) + rc.left - CDPIAware::Instance().ScaleX(6), y - CDPIAware::Instance().ScaleY(4)); | |
2076 | + pDC->MoveTo((xpos + nSpaces * GetCharWidth()) + rc.left - CDPIAware::Instance().ScaleX(2), y); | |
2077 | + pDC->LineTo((xpos + nSpaces * GetCharWidth()) + rc.left - CDPIAware::Instance().ScaleX(6), y + CDPIAware::Instance().ScaleY(4)); | |
2080 | 2078 | pDC->SelectObject(oldPen); |
2081 | 2079 | } |
2082 | 2080 | } |
@@ -2090,8 +2088,8 @@ | ||
2090 | 2088 | pLastSpace = pszChars + 1; |
2091 | 2089 | if (xpos >= 0) |
2092 | 2090 | { |
2093 | - const int cxWhitespace = dpi.ScaleX(2); | |
2094 | - const int cyWhitespace = dpi.ScaleY(2); | |
2091 | + const int cxWhitespace = CDPIAware::Instance().ScaleX(2); | |
2092 | + const int cyWhitespace = CDPIAware::Instance().ScaleY(2); | |
2095 | 2093 | // draw 2-logical pixel rectangle, like Scintilla editor. |
2096 | 2094 | pDC->FillSolidRect(xpos + rc.left + GetCharWidth() / 2 - cxWhitespace/2, y, |
2097 | 2095 | cxWhitespace, cyWhitespace, m_WhiteSpaceFg); |
@@ -64,6 +64,7 @@ | ||
64 | 64 | #include "RenameDlg.h" |
65 | 65 | #include "..\..\ext\snarl\SnarlInterface.h" |
66 | 66 | #include "ToastNotifications.h" |
67 | +#include "DPIAware.h" | |
67 | 68 | #include <tlhelp32.h> |
68 | 69 | #include <shlwapi.h> |
69 | 70 | #include <fstream> |
@@ -7729,12 +7730,14 @@ | ||
7729 | 7730 | #define MONITORMODE_TOOLBARBUTTONCOUNT 10 |
7730 | 7731 | TBBUTTON tbb[MONITORMODE_TOOLBARBUTTONCOUNT] = { 0 }; |
7731 | 7732 | // create an image list containing the icons for the toolbar |
7732 | - if (!m_toolbarImages.Create(24, 24, ILC_COLOR32 | ILC_MASK, MONITORMODE_TOOLBARBUTTONCOUNT, 4)) | |
7733 | + const int iconSizeX = int(24 * CDPIAware::Instance().ScaleFactorX()); | |
7734 | + const int iconSizeY = int(24 * CDPIAware::Instance().ScaleFactorX()); | |
7735 | + if (!m_toolbarImages.Create(iconSizeX, iconSizeY, ILC_COLOR32 | ILC_MASK, MONITORMODE_TOOLBARBUTTONCOUNT, 4)) | |
7733 | 7736 | return false; |
7734 | 7737 | auto iString = ::SendMessage(m_hwndToolbar, TB_ADDSTRING, |
7735 | 7738 | (WPARAM)AfxGetResourceHandle(), (LPARAM)IDS_MONITOR_TOOLBARTEXTS); |
7736 | 7739 | int index = 0; |
7737 | - HICON hIcon = CCommonAppUtils::LoadIconEx(IDI_MONITOR_GETALL, 0, 0, LR_VGACOLOR | LR_DEFAULTSIZE | LR_LOADTRANSPARENT); | |
7740 | + HICON hIcon = CCommonAppUtils::LoadIconEx(IDI_MONITOR_GETALL, iconSizeX, iconSizeY, LR_VGACOLOR | LR_LOADTRANSPARENT); | |
7738 | 7741 | tbb[index].iBitmap = m_toolbarImages.Add(hIcon); |
7739 | 7742 | tbb[index].idCommand = ID_LOGDLG_MONITOR_CHECKREPOSITORIESNOW; |
7740 | 7743 | tbb[index].fsState = TBSTATE_ENABLED | BTNS_SHOWTEXT; |
@@ -7749,7 +7752,7 @@ | ||
7749 | 7752 | tbb[index].dwData = 0; |
7750 | 7753 | tbb[index++].iString = 0; |
7751 | 7754 | |
7752 | - hIcon = CCommonAppUtils::LoadIconEx(IDI_MONITOR_ADD, 0, 0, LR_VGACOLOR | LR_DEFAULTSIZE | LR_LOADTRANSPARENT); | |
7755 | + hIcon = CCommonAppUtils::LoadIconEx(IDI_MONITOR_ADD, iconSizeX, iconSizeY, LR_VGACOLOR | LR_LOADTRANSPARENT); | |
7753 | 7756 | tbb[index].iBitmap = m_toolbarImages.Add(hIcon); |
7754 | 7757 | tbb[index].idCommand = ID_LOGDLG_MONITOR_ADDPROJECT; |
7755 | 7758 | tbb[index].fsState = TBSTATE_ENABLED | BTNS_SHOWTEXT; |
@@ -7757,7 +7760,7 @@ | ||
7757 | 7760 | tbb[index].dwData = 0; |
7758 | 7761 | tbb[index++].iString = iString++; |
7759 | 7762 | |
7760 | - hIcon = CCommonAppUtils::LoadIconEx(IDI_MONITOR_EDIT, 0, 0, LR_VGACOLOR | LR_DEFAULTSIZE | LR_LOADTRANSPARENT); | |
7763 | + hIcon = CCommonAppUtils::LoadIconEx(IDI_MONITOR_EDIT, iconSizeX, iconSizeY, LR_VGACOLOR | LR_LOADTRANSPARENT); | |
7761 | 7764 | tbb[index].iBitmap = m_toolbarImages.Add(hIcon); |
7762 | 7765 | tbb[index].idCommand = ID_LOGDLG_MONITOR_EDIT; |
7763 | 7766 | tbb[index].fsState = BTNS_SHOWTEXT; |
@@ -7765,7 +7768,7 @@ | ||
7765 | 7768 | tbb[index].dwData = 0; |
7766 | 7769 | tbb[index++].iString = iString++; |
7767 | 7770 | |
7768 | - hIcon = CCommonAppUtils::LoadIconEx(IDI_MONITOR_REMOVE, 0, 0, LR_VGACOLOR | LR_DEFAULTSIZE | LR_LOADTRANSPARENT); | |
7771 | + hIcon = CCommonAppUtils::LoadIconEx(IDI_MONITOR_REMOVE, iconSizeX, iconSizeY, LR_VGACOLOR | LR_LOADTRANSPARENT); | |
7769 | 7772 | tbb[index].iBitmap = m_toolbarImages.Add(hIcon); |
7770 | 7773 | tbb[index].idCommand = ID_LOGDLG_MONITOR_REMOVE; |
7771 | 7774 | tbb[index].fsState = BTNS_SHOWTEXT; |
@@ -7780,7 +7783,7 @@ | ||
7780 | 7783 | tbb[index].dwData = 0; |
7781 | 7784 | tbb[index++].iString = 0; |
7782 | 7785 | |
7783 | - hIcon = CCommonAppUtils::LoadIconEx(IDI_MONITOR_MARKALLASREAD, 0, 0, LR_VGACOLOR | LR_DEFAULTSIZE | LR_LOADTRANSPARENT); | |
7786 | + hIcon = CCommonAppUtils::LoadIconEx(IDI_MONITOR_MARKALLASREAD, iconSizeX, iconSizeY, LR_VGACOLOR | LR_LOADTRANSPARENT); | |
7784 | 7787 | tbb[index].iBitmap = m_toolbarImages.Add(hIcon); |
7785 | 7788 | tbb[index].idCommand = ID_MISC_MARKALLASREAD; |
7786 | 7789 | tbb[index].fsState = TBSTATE_ENABLED | BTNS_SHOWTEXT; |
@@ -7788,7 +7791,7 @@ | ||
7788 | 7791 | tbb[index].dwData = 0; |
7789 | 7792 | tbb[index++].iString = iString++; |
7790 | 7793 | |
7791 | - hIcon = CCommonAppUtils::LoadIconEx(IDI_MONITOR_UPDATE, 0, 0, LR_VGACOLOR | LR_DEFAULTSIZE | LR_LOADTRANSPARENT); | |
7794 | + hIcon = CCommonAppUtils::LoadIconEx(IDI_MONITOR_UPDATE, iconSizeX, iconSizeY, LR_VGACOLOR | LR_LOADTRANSPARENT); | |
7792 | 7795 | tbb[index].iBitmap = m_toolbarImages.Add(hIcon); |
7793 | 7796 | tbb[index].idCommand = ID_MISC_UPDATE; |
7794 | 7797 | tbb[index].fsState = TBSTATE_ENABLED | BTNS_SHOWTEXT; |
@@ -7803,7 +7806,7 @@ | ||
7803 | 7806 | tbb[index].dwData = 0; |
7804 | 7807 | tbb[index++].iString = 0; |
7805 | 7808 | |
7806 | - hIcon = CCommonAppUtils::LoadIconEx(IDI_MONITOR_OPTIONS, 0, 0, LR_VGACOLOR | LR_DEFAULTSIZE | LR_LOADTRANSPARENT); | |
7809 | + hIcon = CCommonAppUtils::LoadIconEx(IDI_MONITOR_OPTIONS, iconSizeX, iconSizeY, LR_VGACOLOR | LR_LOADTRANSPARENT); | |
7807 | 7810 | tbb[index].iBitmap = m_toolbarImages.Add(hIcon); |
7808 | 7811 | tbb[index].idCommand = ID_MISC_OPTIONS; |
7809 | 7812 | tbb[index].fsState = TBSTATE_ENABLED | BTNS_SHOWTEXT; |
@@ -1,6 +1,6 @@ | ||
1 | -// TortoiseSVN - a Windows shell extension for easy version control | |
1 | +// TortoiseSVN - a Windows shell extension for easy version control | |
2 | 2 | |
3 | -// Copyright (C) 2016-2017 - TortoiseSVN | |
3 | +// Copyright (C) 2016-2018 - TortoiseSVN | |
4 | 4 | |
5 | 5 | // This program is free software; you can redistribute it and/or |
6 | 6 | // modify it under the terms of the GNU General Public License |
@@ -160,7 +160,7 @@ | ||
160 | 160 | { |
161 | 161 | auto path = m_conflictInfo->GetPath().GetFileOrDirectoryName(); |
162 | 162 | CString sDialogTitle; |
163 | - sDialogTitle.LoadString(IDS_PROC_EDIT_TREE_CONFLICTS); | |
163 | + sDialogTitle.LoadString(IDS_PROC_EDIT_PROP_CONFLICTS); | |
164 | 164 | sDialogTitle = CCommonAppUtils::FormatWindowTitle(path, sDialogTitle); |
165 | 165 | |
166 | 166 | if (!m_conflictInfo->GetPropResolutionOptions(m_options)) |
@@ -1,6 +1,6 @@ | ||
1 | -// TortoiseSVN - a Windows shell extension for easy version control | |
1 | +// TortoiseSVN - a Windows shell extension for easy version control | |
2 | 2 | |
3 | -// Copyright (C) 2016-2017 - TortoiseSVN | |
3 | +// Copyright (C) 2016-2018 - TortoiseSVN | |
4 | 4 | |
5 | 5 | // This program is free software; you can redistribute it and/or |
6 | 6 | // modify it under the terms of the GNU General Public License |
@@ -159,7 +159,7 @@ | ||
159 | 159 | { |
160 | 160 | auto path = m_conflictInfo->GetPath().GetFileOrDirectoryName(); |
161 | 161 | CString sDialogTitle; |
162 | - sDialogTitle.LoadString(IDS_PROC_EDIT_TREE_CONFLICTS); | |
162 | + sDialogTitle.LoadString(IDS_PROC_EDIT_TEXT_CONFLICTS); | |
163 | 163 | sDialogTitle = CCommonAppUtils::FormatWindowTitle(path, sDialogTitle); |
164 | 164 | |
165 | 165 | if (!m_conflictInfo->GetTextResolutionOptions(m_options)) |
@@ -185,7 +185,7 @@ | ||
185 | 185 | AddCommandButton(buttonID, optLabel + L"\n" + optDescription); |
186 | 186 | } |
187 | 187 | |
188 | - AddCommandButton(1000, CString(MAKEINTRESOURCE(IDS_EDITCONFLICT_PROP_EDITCMD))); | |
188 | + AddCommandButton(1000, CString(MAKEINTRESOURCE(IDS_EDITCONFLICT_TEXT_EDITCMD))); | |
189 | 189 | |
190 | 190 | int button; |
191 | 191 | TASKDIALOGCONFIG taskConfig = { 0 }; |
@@ -1,43 +0,0 @@ | ||
1 | -// TortoiseSVN - a Windows shell extension for easy version control | |
2 | - | |
3 | -// Copyright (C) 2017 - TortoiseSVN | |
4 | - | |
5 | -// This program is free software; you can redistribute it and/or | |
6 | -// modify it under the terms of the GNU General Public License | |
7 | -// as published by the Free Software Foundation; either version 2 | |
8 | -// of the License, or (at your option) any later version. | |
9 | - | |
10 | -// This program is distributed in the hope that it will be useful, | |
11 | -// but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -// GNU General Public License for more details. | |
14 | - | |
15 | -// You should have received a copy of the GNU General Public License | |
16 | -// along with this program; if not, write to the Free Software Foundation, | |
17 | -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 | -// | |
19 | -#pragma once | |
20 | - | |
21 | -class CDpiScale | |
22 | -{ | |
23 | -public: | |
24 | - CDpiScale(HDC hdc) | |
25 | - { | |
26 | - m_cxScale = GetDeviceCaps(hdc, LOGPIXELSX); | |
27 | - m_cyScale = GetDeviceCaps(hdc, LOGPIXELSY); | |
28 | - } | |
29 | - | |
30 | - int ScaleX(int x) const | |
31 | - { | |
32 | - return MulDiv(x, m_cxScale, 96); | |
33 | - } | |
34 | - | |
35 | - int ScaleY(int y) const | |
36 | - { | |
37 | - return MulDiv(y, m_cyScale, 96); | |
38 | - } | |
39 | - | |
40 | -private: | |
41 | - int m_cxScale; | |
42 | - int m_cyScale; | |
43 | -}; |
@@ -0,0 +1,132 @@ | ||
1 | +// TortoiseSVN - a Windows shell extension for easy version control | |
2 | + | |
3 | +// Copyright (C) 2018 - TortoiseSVN | |
4 | + | |
5 | +// This program is free software; you can redistribute it and/or | |
6 | +// modify it under the terms of the GNU General Public License | |
7 | +// as published by the Free Software Foundation; either version 2 | |
8 | +// of the License, or (at your option) any later version. | |
9 | + | |
10 | +// This program is distributed in the hope that it will be useful, | |
11 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | +// GNU General Public License for more details. | |
14 | + | |
15 | +// You should have received a copy of the GNU General Public License | |
16 | +// along with this program; if not, write to the Free Software Foundation, | |
17 | +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 | +// | |
19 | +class CDPIAware | |
20 | +{ | |
21 | +private: | |
22 | + CDPIAware() : m_fInitialized(false), m_dpiX(96), m_dpiY(96) {} | |
23 | + ~CDPIAware() {} | |
24 | +public: | |
25 | + static CDPIAware& Instance() | |
26 | + { | |
27 | + static CDPIAware instance; | |
28 | + return instance; | |
29 | + } | |
30 | + | |
31 | + // Get screen DPI. | |
32 | + int GetDPIX() { _Init(); return m_dpiX; } | |
33 | + int GetDPIY() { _Init(); return m_dpiY; } | |
34 | + | |
35 | + // Convert between raw pixels and relative pixels. | |
36 | + int ScaleX(int x) { _Init(); return MulDiv(x, m_dpiX, 96); } | |
37 | + int ScaleY(int y) { _Init(); return MulDiv(y, m_dpiY, 96); } | |
38 | + float ScaleFactorX() { _Init(); return m_dpiX / 96.0f; } | |
39 | + float ScaleFactorY() { _Init(); return m_dpiY / 96.0f; } | |
40 | + int UnscaleX(int x) { _Init(); return MulDiv(x, 96, m_dpiX); } | |
41 | + int UnscaleY(int y) { _Init(); return MulDiv(y, 96, m_dpiY); } | |
42 | + | |
43 | + // Determine the screen dimensions in relative pixels. | |
44 | + int ScaledScreenWidth() { return _ScaledSystemMetricX(SM_CXSCREEN); } | |
45 | + int ScaledScreenHeight() { return _ScaledSystemMetricY(SM_CYSCREEN); } | |
46 | + | |
47 | + // Scale rectangle from raw pixels to relative pixels. | |
48 | + void ScaleRect(__inout RECT *pRect) | |
49 | + { | |
50 | + pRect->left = ScaleX(pRect->left); | |
51 | + pRect->right = ScaleX(pRect->right); | |
52 | + pRect->top = ScaleY(pRect->top); | |
53 | + pRect->bottom = ScaleY(pRect->bottom); | |
54 | + } | |
55 | + | |
56 | + // Scale Point from raw pixels to relative pixels. | |
57 | + void ScalePoint(__inout POINT *pPoint) | |
58 | + { | |
59 | + pPoint->x = ScaleX(pPoint->x); | |
60 | + pPoint->y = ScaleY(pPoint->y); | |
61 | + } | |
62 | + | |
63 | + // Scale Size from raw pixels to relative pixels. | |
64 | + void ScaleSize(__inout SIZE *pSize) | |
65 | + { | |
66 | + pSize->cx = ScaleX(pSize->cx); | |
67 | + pSize->cy = ScaleY(pSize->cy); | |
68 | + } | |
69 | + | |
70 | + // Determine if screen resolution meets minimum requirements in relative pixels. | |
71 | + bool IsResolutionAtLeast(int cxMin, int cyMin) | |
72 | + { | |
73 | + return (ScaledScreenWidth() >= cxMin) && (ScaledScreenHeight() >= cyMin); | |
74 | + } | |
75 | + | |
76 | + // Convert a point size (1/72 of an inch) to raw pixels. | |
77 | + int PointsToPixels(int pt) { return MulDiv(pt, m_dpiY, 72); } | |
78 | + | |
79 | + // Invalidate any cached metrics. | |
80 | + void Invalidate() { m_fInitialized = false; } | |
81 | + | |
82 | +private: | |
83 | + | |
84 | + // This function initializes the CDPIAware Class | |
85 | + void _Init() | |
86 | + { | |
87 | + if (!m_fInitialized) | |
88 | + { | |
89 | + HDC hdc = GetDC(nullptr); | |
90 | + if (hdc) | |
91 | + { | |
92 | + // Initialize the DPI member variable | |
93 | + // This will correspond to the DPI setting | |
94 | + // With all Windows OS's to date the X and Y DPI will be identical | |
95 | + m_dpiX = GetDeviceCaps(hdc, LOGPIXELSX); | |
96 | + m_dpiY = GetDeviceCaps(hdc, LOGPIXELSY); | |
97 | + ReleaseDC(nullptr, hdc); | |
98 | + } | |
99 | + m_fInitialized = true; | |
100 | + } | |
101 | + } | |
102 | + | |
103 | + // This returns a 96-DPI scaled-down equivalent value for nIndex | |
104 | + // For example, the value 120 at 120 DPI setting gets scaled down to 96 | |
105 | + // X and Y versions are provided, though to date all Windows OS releases | |
106 | + // have equal X and Y scale values | |
107 | + int _ScaledSystemMetricX(int nIndex) | |
108 | + { | |
109 | + _Init(); | |
110 | + return MulDiv(GetSystemMetrics(nIndex), 96, m_dpiX); | |
111 | + } | |
112 | + | |
113 | + // This returns a 96-DPI scaled-down equivalent value for nIndex | |
114 | + // For example, the value 120 at 120 DPI setting gets scaled down to 96 | |
115 | + // X and Y versions are provided, though to date all Windows OS releases | |
116 | + // have equal X and Y scale values | |
117 | + int _ScaledSystemMetricY(int nIndex) | |
118 | + { | |
119 | + _Init(); | |
120 | + return MulDiv(GetSystemMetrics(nIndex), 96, m_dpiY); | |
121 | + } | |
122 | + | |
123 | +private: | |
124 | + | |
125 | + // Member variable indicating whether the class has been initialized | |
126 | + bool m_fInitialized; | |
127 | + | |
128 | + // X and Y DPI values are provided, though to date all | |
129 | + // Windows OS releases have equal X and Y scale values | |
130 | + int m_dpiX; | |
131 | + int m_dpiY; | |
132 | +}; |