• R/O
  • SSH
  • HTTPS

tortoisesvn: Commit


Commit MetaInfo

Revisão28732 (tree)
Hora2020-01-31 02:32:06
Autorstefankueng

Mensagem de Log

make use the new CAutoIcon.

Mudança Sumário

Diff

--- trunk/src/TortoiseProc/Settings/SetOverlayIcons.cpp (revision 28731)
+++ trunk/src/TortoiseProc/Settings/SetOverlayIcons.cpp (revision 28732)
@@ -1,6 +1,6 @@
11 // TortoiseSVN - a Windows shell extension for easy version control
22
3-// Copyright (C) 2003-2008, 2010-2014, 2018 - TortoiseSVN
3+// Copyright (C) 2003-2008, 2010-2014, 2018, 2020 - 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
@@ -24,6 +24,7 @@
2424 #include "AppUtils.h"
2525 #include "PathUtils.h"
2626 #include "ShellUpdater.h"
27+#include "SmartHandle.h"
2728
2829 IMPLEMENT_DYNAMIC(CSetOverlayIcons, ISettingsPropPage)
2930 CSetOverlayIcons::CSetOverlayIcons()
@@ -160,48 +161,38 @@
160161 CImageList * pImageList = bSmallIcons ? &m_ImageList : &m_ImageListBig;
161162 int iconWidth = (bSmallIcons ? smallIconWidth : normalIconWidth);
162163 int iconHeight = (bSmallIcons ? smallIconHeight : normalIconHeight);
163- auto hNormalOverlay = LoadIconEx(nullptr, sIconSetPath + L"\\NormalIcon.ico", iconWidth, iconHeight);
164+ CAutoIcon hNormalOverlay = LoadIconEx(nullptr, sIconSetPath + L"\\NormalIcon.ico", iconWidth, iconHeight);
164165 index = pImageList->Add(hNormalOverlay);
165166 VERIFY(pImageList->SetOverlayImage(index, 1));
166- auto hModifiedOverlay = LoadIconEx(nullptr, sIconSetPath + L"\\ModifiedIcon.ico", iconWidth, iconHeight);
167+ CAutoIcon hModifiedOverlay = LoadIconEx(nullptr, sIconSetPath + L"\\ModifiedIcon.ico", iconWidth, iconHeight);
167168 index = pImageList->Add(hModifiedOverlay);
168169 VERIFY(pImageList->SetOverlayImage(index, 2));
169- auto hConflictedOverlay = LoadIconEx(nullptr, sIconSetPath + L"\\ConflictIcon.ico", iconWidth, iconHeight);
170+ CAutoIcon hConflictedOverlay = LoadIconEx(nullptr, sIconSetPath + L"\\ConflictIcon.ico", iconWidth, iconHeight);
170171 index = pImageList->Add(hConflictedOverlay);
171172 VERIFY(pImageList->SetOverlayImage(index, 3));
172- auto hReadOnlyOverlay = LoadIconEx(nullptr, sIconSetPath + L"\\ReadOnlyIcon.ico", iconWidth, iconHeight);
173+ CAutoIcon hReadOnlyOverlay = LoadIconEx(nullptr, sIconSetPath + L"\\ReadOnlyIcon.ico", iconWidth, iconHeight);
173174 index = pImageList->Add(hReadOnlyOverlay);
174175 VERIFY(pImageList->SetOverlayImage(index, 4));
175- auto hDeletedOverlay = LoadIconEx(nullptr, sIconSetPath + L"\\DeletedIcon.ico", iconWidth, iconHeight);
176+ CAutoIcon hDeletedOverlay = LoadIconEx(nullptr, sIconSetPath + L"\\DeletedIcon.ico", iconWidth, iconHeight);
176177 index = pImageList->Add(hDeletedOverlay);
177178 VERIFY(pImageList->SetOverlayImage(index, 5));
178- auto hLockedOverlay = LoadIconEx(nullptr, sIconSetPath + L"\\LockedIcon.ico", iconWidth, iconHeight);
179+ CAutoIcon hLockedOverlay = LoadIconEx(nullptr, sIconSetPath + L"\\LockedIcon.ico", iconWidth, iconHeight);
179180 index = pImageList->Add(hLockedOverlay);
180181 VERIFY(pImageList->SetOverlayImage(index, 6));
181- auto hAddedOverlay = LoadIconEx(nullptr, sIconSetPath + L"\\AddedIcon.ico", iconWidth, iconHeight);
182+ CAutoIcon hAddedOverlay = LoadIconEx(nullptr, sIconSetPath + L"\\AddedIcon.ico", iconWidth, iconHeight);
182183 index = pImageList->Add(hAddedOverlay);
183184 VERIFY(pImageList->SetOverlayImage(index, 7));
184- auto hIgnoredOverlay = LoadIconEx(nullptr, sIconSetPath + L"\\IgnoredIcon.ico", iconWidth, iconHeight);
185+ CAutoIcon hIgnoredOverlay = LoadIconEx(nullptr, sIconSetPath + L"\\IgnoredIcon.ico", iconWidth, iconHeight);
185186 index = pImageList->Add(hIgnoredOverlay);
186187 VERIFY(pImageList->SetOverlayImage(index, 8));
187- auto hUnversionedOverlay = LoadIconEx(nullptr, sIconSetPath + L"\\UnversionedIcon.ico", iconWidth, iconHeight);
188+ CAutoIcon hUnversionedOverlay = LoadIconEx(nullptr, sIconSetPath + L"\\UnversionedIcon.ico", iconWidth, iconHeight);
188189 index = pImageList->Add(hUnversionedOverlay);
189190 VERIFY(pImageList->SetOverlayImage(index, 9));
190191
191- DestroyIcon(hNormalOverlay);
192- DestroyIcon(hModifiedOverlay);
193- DestroyIcon(hConflictedOverlay);
194- DestroyIcon(hReadOnlyOverlay);
195- DestroyIcon(hDeletedOverlay);
196- DestroyIcon(hLockedOverlay);
197- DestroyIcon(hAddedOverlay);
198- DestroyIcon(hIgnoredOverlay);
199- DestroyIcon(hUnversionedOverlay);
200192
201193 // create an image list with different file icons
202- const HICON hIcon = GetFileIcon(L"Doesn't matter", bSmallIcons, FILE_ATTRIBUTE_DIRECTORY);
194+ CAutoIcon hIcon = GetFileIcon(L"Doesn't matter", bSmallIcons, FILE_ATTRIBUTE_DIRECTORY);
203195 int folderindex = pImageList->Add(hIcon); //folder
204- DestroyIcon(hIcon);
205196
206197 //folders
207198 index = m_cIconList.InsertItem(m_cIconList.GetItemCount(), m_sNormal, folderindex);
@@ -254,7 +245,7 @@
254245 }
255246 void CSetOverlayIcons::AddFileTypeGroup(CString sFileType, bool bSmallIcons)
256247 {
257- const HICON hIcon = GetFileIcon(sFileType, bSmallIcons, FILE_ATTRIBUTE_NORMAL);
248+ CAutoIcon hIcon = GetFileIcon(sFileType, bSmallIcons, FILE_ATTRIBUTE_NORMAL);
258249
259250 int imageindex = 0;
260251 if (bSmallIcons)
@@ -262,7 +253,6 @@
262253 else
263254 imageindex = m_ImageListBig.Add(hIcon);
264255
265- DestroyIcon(hIcon);
266256 int index = 0;
267257 index = m_cIconList.InsertItem(m_cIconList.GetItemCount(), m_sNormal+sFileType, imageindex);
268258 m_cIconList.SetItemState(index, INDEXTOOVERLAYMASK(1), TVIS_OVERLAYMASK);
--- trunk/src/Utils/CommonAppUtils.cpp (revision 28731)
+++ trunk/src/Utils/CommonAppUtils.cpp (revision 28732)
@@ -1,6 +1,6 @@
11 // TortoiseSVN - a Windows shell extension for easy version control
22
3-// Copyright (C) 2010-2018 - TortoiseSVN
3+// Copyright (C) 2010-2018, 2020 - 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
@@ -330,10 +330,9 @@
330330 ListView_SetTextBkColor(hListCtrl, CLR_NONE);
331331 COLORREF bkColor = ListView_GetBkColor(hListCtrl);
332332 // create a bitmap from the icon
333- auto hIcon = ::LoadIconEx(AfxGetResourceHandle(), MAKEINTRESOURCE(nID), width, height);
333+ CAutoIcon hIcon = ::LoadIconEx(AfxGetResourceHandle(), MAKEINTRESOURCE(nID), width, height);
334334 if (!hIcon)
335335 return false;
336- OnOutOfScope(DestroyIcon(hIcon));
337336
338337 RECT rect = {0};
339338 rect.right = width;
--- trunk/src/Utils/MiscUI/IconBitmapUtils.cpp (revision 28731)
+++ trunk/src/Utils/MiscUI/IconBitmapUtils.cpp (revision 28732)
@@ -1,7 +1,7 @@
11 // TortoiseSVN - a Windows shell extension for easy version control
22
33 // Copyright (C) 2016 - TortoiseGit
4-// Copyright (C) 2009-2012, 2014-2015, 2018 - TortoiseSVN
4+// Copyright (C) 2009-2012, 2014-2015, 2018, 2020 - TortoiseSVN
55
66 // This program is free software; you can redistribute it and/or
77 // modify it under the terms of the GNU General Public License
@@ -22,6 +22,7 @@
2222 #include "registry.h"
2323 #include "OnOutOfScope.h"
2424 #include "LoadIconEx.h"
25+#include "SmartHandle.h"
2526
2627 #pragma comment(lib, "UxTheme.lib")
2728
@@ -42,10 +43,9 @@
4243 if (bitmap_it != bitmaps.end() && bitmap_it->first == uIcon)
4344 return bitmap_it->second;
4445
45- auto hIcon = LoadIconEx(hInst, MAKEINTRESOURCE(uIcon), 12, 12);
46+ CAutoIcon hIcon = LoadIconEx(hInst, MAKEINTRESOURCE(uIcon), 12, 12);
4647 if (!hIcon)
4748 return NULL;
48- OnOutOfScope(DestroyIcon(hIcon));
4949
5050 RECT rect;
5151
@@ -102,12 +102,10 @@
102102
103103 int iconWidth = GetSystemMetrics(SM_CXSMICON);
104104 int iconHeight = GetSystemMetrics(SM_CYSMICON);
105- auto hIcon = LoadIconEx(hInst, MAKEINTRESOURCE(uIcon), iconWidth, iconHeight);
105+ CAutoIcon hIcon = LoadIconEx(hInst, MAKEINTRESOURCE(uIcon), iconWidth, iconHeight);
106106
107107 HBITMAP hBmp = IconToBitmapPARGB32(hIcon, iconWidth, iconHeight);
108108
109- DestroyIcon(hIcon);
110-
111109 if(hBmp)
112110 bitmaps.insert(bitmap_it, std::make_pair(uIcon, hBmp));
113111
--- trunk/src/Utils/MiscUI/SciEdit.cpp (revision 28731)
+++ trunk/src/Utils/MiscUI/SciEdit.cpp (revision 28732)
@@ -348,9 +348,8 @@
348348 Call(SCI_RGBAIMAGESETHEIGHT, iconHeight);
349349 for (auto icon : icons)
350350 {
351- auto hIcon = LoadIconEx(AfxGetInstanceHandle(), MAKEINTRESOURCE(icon.second), iconWidth, iconHeight);
351+ CAutoIcon hIcon = LoadIconEx(AfxGetInstanceHandle(), MAKEINTRESOURCE(icon.second), iconWidth, iconHeight);
352352 auto bytes = Icon2Image(hIcon);
353- DestroyIcon(hIcon);
354353 Call(SCI_REGISTERRGBAIMAGE, icon.first, (LPARAM)bytes.get());
355354 }
356355 }
--- trunk/src/Utils/TaskbarUUID.cpp (revision 28731)
+++ trunk/src/Utils/TaskbarUUID.cpp (revision 28732)
@@ -1,7 +1,7 @@
1-// TortoiseSVN - a Windows shell extension for easy version control
1+// TortoiseSVN - a Windows shell extension for easy version control
22
33 // Copyright (C) 2016 - TortoiseGit
4-// Copyright (C) 2011-2014, 2016-2017, 2019 - TortoiseSVN
4+// Copyright (C) 2011-2014, 2016-2017, 2019-2020 - TortoiseSVN
55
66 // This program is free software; you can redistribute it and/or
77 // modify it under the terms of the GNU General Public License
@@ -231,11 +231,10 @@
231231 SelectObject(hdc, hOldBM);
232232 DeleteDC(hdc);
233233
234- auto hIcon = CreateIconIndirect(&IconInfo);
234+ CAutoIcon hIcon = CreateIconIndirect(&IconInfo);
235235
236236 DeleteObject(IconInfo.hbmColor);
237237 DeleteObject(IconInfo.hbmMask);
238238
239239 pTaskbarInterface->SetOverlayIcon(hWnd, hIcon, uuid.c_str());
240- DestroyIcon(hIcon);
241240 }
Show on old repository browser