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

Side by Side Diff: src/plugin/PluginClass.cpp

Issue 6210609305616384: Issue 1538 - Replace ABP icon with new one (v.1.1) - for Internet Explorer (Closed)
Patch Set: Use both 19x19 and 32x32 icons adaptively. Fix the icon position. Created Feb. 3, 2015, 3:18 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/plugin/AdblockPlus.rc ('k') | src/plugin/Resource.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2015 Eyeo GmbH 3 * Copyright (C) 2006-2015 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 26 matching lines...) Expand all
37 #ifdef DEBUG_HIDE_EL 37 #ifdef DEBUG_HIDE_EL
38 DWORD profileTime = 0; 38 DWORD profileTime = 0;
39 #endif 39 #endif
40 40
41 typedef HANDLE (WINAPI *OPENTHEMEDATA)(HWND, LPCWSTR); 41 typedef HANDLE (WINAPI *OPENTHEMEDATA)(HWND, LPCWSTR);
42 typedef HRESULT (WINAPI *DRAWTHEMEBACKGROUND)(HANDLE, HDC, INT, INT, LPRECT, LPR ECT); 42 typedef HRESULT (WINAPI *DRAWTHEMEBACKGROUND)(HANDLE, HDC, INT, INT, LPRECT, LPR ECT);
43 typedef HRESULT (WINAPI *CLOSETHEMEDATA)(HANDLE); 43 typedef HRESULT (WINAPI *CLOSETHEMEDATA)(HANDLE);
44 44
45 HICON CPluginClass::s_hIcons[ICON_MAX] = { NULL, NULL, NULL }; 45 HICON CPluginClass::s_hIcons[ICON_MAX] = { NULL, NULL, NULL };
46 DWORD CPluginClass::s_hIconTypes[ICON_MAX] = { IDI_ICON_DISABLED, IDI_ICON_ENABL ED, IDI_ICON_DEACTIVATED }; 46 DWORD CPluginClass::s_hIconTypes[ICON_MAX] = { IDI_ICON_DISABLED, IDI_ICON_ENABL ED, IDI_ICON_DEACTIVATED };
47 uint32_t iconHeight = 32;
48 uint32_t iconWidth = 32;
Eric 2015/02/03 16:07:48 At the very least, it's time to introduce an anony
47 49
48 CPluginMimeFilterClient* CPluginClass::s_mimeFilter = NULL; 50 CPluginMimeFilterClient* CPluginClass::s_mimeFilter = NULL;
49 51
50 CLOSETHEMEDATA pfnClose = NULL; 52 CLOSETHEMEDATA pfnClose = NULL;
51 DRAWTHEMEBACKGROUND pfnDrawThemeBackground = NULL; 53 DRAWTHEMEBACKGROUND pfnDrawThemeBackground = NULL;
52 OPENTHEMEDATA pfnOpenThemeData = NULL; 54 OPENTHEMEDATA pfnOpenThemeData = NULL;
53 55
54 ATOM CPluginClass::s_atomPaneClass = NULL; 56 ATOM CPluginClass::s_atomPaneClass = NULL;
55 HINSTANCE CPluginClass::s_hUxtheme = NULL; 57 HINSTANCE CPluginClass::s_hUxtheme = NULL;
56 std::set<CPluginClass*> CPluginClass::s_instances; 58 std::set<CPluginClass*> CPluginClass::s_instances;
(...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after
985 DEBUG_ERROR_LOG(0, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_NO_STATUSBAR_WIN, "Class ::CreateStatusBarPane - No status bar") 987 DEBUG_ERROR_LOG(0, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_NO_STATUSBAR_WIN, "Class ::CreateStatusBarPane - No status bar")
986 return true; 988 return true;
987 } 989 }
988 990
989 // Calculate pane height 991 // Calculate pane height
990 AdblockPlus::Rectangle rcStatusBar; 992 AdblockPlus::Rectangle rcStatusBar;
991 ::GetClientRect(hWndStatusBar, &rcStatusBar); 993 ::GetClientRect(hWndStatusBar, &rcStatusBar);
992 994
993 if (rcStatusBar.Height() > 0) 995 if (rcStatusBar.Height() > 0)
994 { 996 {
997 if (rcStatusBar.Height() < iconWidth)
998 {
999 iconWidth = 19;
1000 iconHeight = 19;
1001 CPluginClass::s_hIconTypes[0] = IDI_ICON_DISABLED_19;
1002 CPluginClass::s_hIconTypes[1] = IDI_ICON_ENABLED_19;
1003 CPluginClass::s_hIconTypes[2] = IDI_ICON_DEACTIVATED_19;
1004 }
1005
995 #ifdef _DEBUG 1006 #ifdef _DEBUG
996 m_nPaneWidth = 70; 1007 m_nPaneWidth = 70;
997 #else 1008 #else
998 m_nPaneWidth = min(rcStatusBar.Height(), 32); 1009 m_nPaneWidth = min(rcStatusBar.Height(), iconWidth);
999 #endif 1010 #endif
1000 } 1011 }
1001 else 1012 else
1002 { 1013 {
1003 #ifdef _DEBUG 1014 #ifdef _DEBUG
1004 m_nPaneWidth = 70; 1015 m_nPaneWidth = 70;
1005 #else 1016 #else
1006 m_nPaneWidth = 32; 1017 m_nPaneWidth = iconWidth;
1007 #endif 1018 #endif
1008 } 1019 }
1009 // Create pane window 1020 // Create pane window
1010 HWND hWndNewPane = ::CreateWindowEx( 1021 HWND hWndNewPane = ::CreateWindowEx(
1011 NULL, 1022 NULL,
1012 MAKEINTATOM(GetAtomPaneClass()), 1023 MAKEINTATOM(GetAtomPaneClass()),
1013 L"", 1024 L"",
1014 WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, 1025 WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
1015 rcStatusBar.Width() - 500,0,m_nPaneWidth,rcStatusBar.Height(), 1026 rcStatusBar.Width() - 500, 0, m_nPaneWidth, rcStatusBar.Height(),
1016 hWndStatusBar, 1027 hWndStatusBar,
1017 (HMENU)3671, 1028 (HMENU)3671,
1018 _Module.m_hInst, 1029 _Module.m_hInst,
1019 NULL); 1030 NULL);
1020 1031
1021 if (!hWndNewPane) 1032 if (!hWndNewPane)
1022 { 1033 {
1023 DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_CREATE_ST ATUSBAR_PANE, "Class::CreateStatusBarPane - CreateWindowEx") 1034 DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_CREATE_ST ATUSBAR_PANE, "Class::CreateStatusBarPane - CreateWindowEx")
1024 return false; 1035 return false;
1025 } 1036 }
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after
1614 } 1625 }
1615 1626
1616 // Draw icon 1627 // Draw icon
1617 if (CPluginClient::GetInstance()) 1628 if (CPluginClient::GetInstance())
1618 { 1629 {
1619 HICON hIcon = GetStatusBarIcon(pClass->GetTab()->GetDocumentUrl()); 1630 HICON hIcon = GetStatusBarIcon(pClass->GetTab()->GetDocumentUrl());
1620 1631
1621 int offx = nDrawEdge; 1632 int offx = nDrawEdge;
1622 if (hIcon) 1633 if (hIcon)
1623 { 1634 {
1624 ::DrawIconEx(hDC, offx, 0, hIcon, rcClient.Height() - 2, rcClient.Heig ht() - 2, NULL, NULL, DI_NORMAL); 1635 //Get the RECT for the leftmost pane (the status text pane)
1625 offx += 32; 1636 RECT rect;
1637 BOOL rectRes = ::SendMessage(pClass->m_hStatusBarWnd, SB_GETRECT, 0, ( LPARAM)&rect);
1638 ::DrawIconEx(hDC, 0, rect.bottom - rect.top - iconHeight, hIcon, iconW idth, iconHeight, NULL, NULL, DI_NORMAL);
1639 offx += iconWidth;
1626 } 1640 }
1627 #ifdef _DEBUG 1641 #ifdef _DEBUG
1628 // Display version 1642 // Display version
1629 HFONT hFont = (HFONT)::SendMessage(pClass->m_hStatusBarWnd, WM_GETFONT, 0, 0); 1643 HFONT hFont = (HFONT)::SendMessage(pClass->m_hStatusBarWnd, WM_GETFONT, 0, 0);
1630 HGDIOBJ hOldFont = ::SelectObject(hDC,hFont); 1644 HGDIOBJ hOldFont = ::SelectObject(hDC,hFont);
1631 1645
1632 AdblockPlus::Rectangle rcText = rcClient; 1646 AdblockPlus::Rectangle rcText = rcClient;
1633 rcText.left += offx; 1647 rcText.left += offx;
1634 ::SetBkMode(hDC, TRANSPARENT); 1648 ::SetBkMode(hDC, TRANSPARENT);
1635 ::DrawTextW(hDC, IEPLUGIN_VERSION, -1, &rcText, DT_WORD_ELLIPSIS|DT_LEFT |DT_SINGLELINE|DT_VCENTER); 1649 ::DrawTextW(hDC, IEPLUGIN_VERSION, -1, &rcText, DT_WORD_ELLIPSIS|DT_LEFT |DT_SINGLELINE|DT_VCENTER);
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
1871 } 1885 }
1872 } 1886 }
1873 } 1887 }
1874 1888
1875 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT); 1889 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT);
1876 } 1890 }
1877 1891
1878 return hTabWnd; 1892 return hTabWnd;
1879 1893
1880 } 1894 }
OLDNEW
« no previous file with comments | « src/plugin/AdblockPlus.rc ('k') | src/plugin/Resource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld