Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: src/plugin/PluginClass.cpp

Issue 6215938672164864: [IE] Replace ATL::CRect (Closed)
Patch Set: Comments addressed; Rebased Created July 23, 2014, 11:59 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/plugin/PluginClass.cpp
===================================================================
--- a/src/plugin/PluginClass.cpp
+++ b/src/plugin/PluginClass.cpp
@@ -49,6 +49,33 @@
std::map<UINT,CString> CPluginClass::s_menuDomains;
#endif
+namespace
+{
+ // Without an extra namespace within the anonymous one, the identifier "Rectangle" is ambiguous
+ // See http://msdn.microsoft.com/en-us/library/windows/desktop/dd162898(v=vs.85).aspx
+ namespace AdblockPlus
+ {
+ /**
+ * Replacement for ATL type CRect.
+ */
+ class Rectangle
+ : public RECT
+ {
+ public:
+ // C++11 noexcept
+ int Height() const
+ {
+ return bottom - top;
+ }
+
+ // C++11 noexcept
+ int Width() const
+ {
+ return right - left;
+ }
+ };
+ }
+}
CPluginClass::CPluginClass()
{
@@ -944,7 +971,7 @@
}
// Calculate pane height
- CRect rcStatusBar;
+ AdblockPlus::Rectangle rcStatusBar;
::GetClientRect(hWndStatusBar, &rcStatusBar);
if (rcStatusBar.Height() > 0)
@@ -1575,10 +1602,10 @@
}
LRESULT hRet = CallWindowProc(pClass->m_pWndProcStatus, hWnd, message, wParam, (LPARAM)lpParts);
- CRect rcPane;
+ AdblockPlus::Rectangle rcPane;
::SendMessage(hWnd, SB_GETRECT, STATUSBAR_PANE_NUMBER, (LPARAM)&rcPane);
- CRect rcClient;
+ AdblockPlus::Rectangle rcClient;
::GetClientRect(hWnd, &rcClient);
::MoveWindow(
@@ -1665,7 +1692,7 @@
PAINTSTRUCT ps;
HDC hDC = ::BeginPaint(hWnd, &ps);
- CRect rcClient;
+ AdblockPlus::Rectangle rcClient;
::GetClientRect(hWnd, &rcClient);
int nDrawEdge = 0;
@@ -1687,7 +1714,7 @@
// Draw background
if (pfnDrawThemeBackground)
{
- CRect rc = rcClient;
+ AdblockPlus::Rectangle rc = rcClient;
rc.right -= 2;
pfnDrawThemeBackground(pClass->m_hTheme, hDC, 0, 0, &rc, NULL);
}
@@ -1727,7 +1754,7 @@
HFONT hFont = (HFONT)::SendMessage(pClass->m_hStatusBarWnd, WM_GETFONT, 0, 0);
HGDIOBJ hOldFont = ::SelectObject(hDC,hFont);
- CRect rcText = rcClient;
+ Local::Rectangle rcText = rcClient;
sergei 2014/07/23 13:34:49 Should Local be renamed to AdblockPlus?
Eric 2014/07/23 16:34:14 That's what I get for compiling in Release configu
rcText.left += offx;
::SetBkMode(hDC, TRANSPARENT);
::DrawTextW(hDC, IEPLUGIN_VERSION, -1, &rcText, DT_WORD_ELLIPSIS|DT_LEFT|DT_SINGLELINE|DT_VCENTER);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld