OLD | NEW |
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 Loading... |
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; |
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 Loading... |
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 } |
| 1002 |
995 #ifdef _DEBUG | 1003 #ifdef _DEBUG |
996 m_nPaneWidth = 70; | 1004 m_nPaneWidth = 70; |
997 #else | 1005 #else |
998 m_nPaneWidth = min(rcStatusBar.Height(), 22); | 1006 m_nPaneWidth = min(rcStatusBar.Height(), iconWidth); |
999 #endif | 1007 #endif |
1000 } | 1008 } |
1001 else | 1009 else |
1002 { | 1010 { |
1003 #ifdef _DEBUG | 1011 #ifdef _DEBUG |
1004 m_nPaneWidth = 70; | 1012 m_nPaneWidth = 70; |
1005 #else | 1013 #else |
1006 m_nPaneWidth = 22; | 1014 m_nPaneWidth = iconWidth; |
1007 #endif | 1015 #endif |
1008 } | 1016 } |
1009 // Create pane window | 1017 // Create pane window |
1010 HWND hWndNewPane = ::CreateWindowEx( | 1018 HWND hWndNewPane = ::CreateWindowEx( |
1011 NULL, | 1019 NULL, |
1012 MAKEINTATOM(GetAtomPaneClass()), | 1020 MAKEINTATOM(GetAtomPaneClass()), |
1013 L"", | 1021 L"", |
1014 WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, | 1022 WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, |
1015 rcStatusBar.Width() - 500,0,m_nPaneWidth,rcStatusBar.Height(), | 1023 rcStatusBar.Width() - 500, 0, m_nPaneWidth, rcStatusBar.Height(), |
1016 hWndStatusBar, | 1024 hWndStatusBar, |
1017 (HMENU)3671, | 1025 (HMENU)3671, |
1018 _Module.m_hInst, | 1026 _Module.m_hInst, |
1019 NULL); | 1027 NULL); |
1020 | 1028 |
1021 if (!hWndNewPane) | 1029 if (!hWndNewPane) |
1022 { | 1030 { |
1023 DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_CREATE_ST
ATUSBAR_PANE, "Class::CreateStatusBarPane - CreateWindowEx") | 1031 DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_CREATE_ST
ATUSBAR_PANE, "Class::CreateStatusBarPane - CreateWindowEx") |
1024 return false; | 1032 return false; |
1025 } | 1033 } |
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1614 } | 1622 } |
1615 | 1623 |
1616 // Draw icon | 1624 // Draw icon |
1617 if (CPluginClient::GetInstance()) | 1625 if (CPluginClient::GetInstance()) |
1618 { | 1626 { |
1619 HICON hIcon = GetStatusBarIcon(pClass->GetTab()->GetDocumentUrl()); | 1627 HICON hIcon = GetStatusBarIcon(pClass->GetTab()->GetDocumentUrl()); |
1620 | 1628 |
1621 int offx = nDrawEdge; | 1629 int offx = nDrawEdge; |
1622 if (hIcon) | 1630 if (hIcon) |
1623 { | 1631 { |
1624 ::DrawIconEx(hDC, offx, (rcClient.Height() - 16)/2 + 2, hIcon, 16, 16,
NULL, NULL, DI_NORMAL); | 1632 //Get the RECT for the leftmost pane (the status text pane) |
1625 offx += 22; | 1633 RECT rect; |
| 1634 BOOL rectRes = ::SendMessage(pClass->m_hStatusBarWnd, SB_GETRECT, 0, (
LPARAM)&rect); |
| 1635 ::DrawIconEx(hDC, 0, rect.bottom - rect.top - iconHeight, hIcon, iconW
idth, iconHeight, NULL, NULL, DI_NORMAL); |
| 1636 offx += iconWidth; |
1626 } | 1637 } |
1627 #ifdef _DEBUG | 1638 #ifdef _DEBUG |
1628 // Display version | 1639 // Display version |
1629 HFONT hFont = (HFONT)::SendMessage(pClass->m_hStatusBarWnd, WM_GETFONT,
0, 0); | 1640 HFONT hFont = (HFONT)::SendMessage(pClass->m_hStatusBarWnd, WM_GETFONT,
0, 0); |
1630 HGDIOBJ hOldFont = ::SelectObject(hDC,hFont); | 1641 HGDIOBJ hOldFont = ::SelectObject(hDC,hFont); |
1631 | 1642 |
1632 AdblockPlus::Rectangle rcText = rcClient; | 1643 AdblockPlus::Rectangle rcText = rcClient; |
1633 rcText.left += offx; | 1644 rcText.left += offx; |
1634 ::SetBkMode(hDC, TRANSPARENT); | 1645 ::SetBkMode(hDC, TRANSPARENT); |
1635 ::DrawTextW(hDC, IEPLUGIN_VERSION, -1, &rcText, DT_WORD_ELLIPSIS|DT_LEFT
|DT_SINGLELINE|DT_VCENTER); | 1646 ::DrawTextW(hDC, IEPLUGIN_VERSION, -1, &rcText, DT_WORD_ELLIPSIS|DT_LEFT
|DT_SINGLELINE|DT_VCENTER); |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1783 } | 1794 } |
1784 | 1795 |
1785 HICON CPluginClass::GetIcon(int type) | 1796 HICON CPluginClass::GetIcon(int type) |
1786 { | 1797 { |
1787 HICON icon = NULL; | 1798 HICON icon = NULL; |
1788 | 1799 |
1789 s_criticalSectionLocal.Lock(); | 1800 s_criticalSectionLocal.Lock(); |
1790 { | 1801 { |
1791 if (!s_hIcons[type]) | 1802 if (!s_hIcons[type]) |
1792 { | 1803 { |
1793 s_hIcons[type] = ::LoadIcon(_Module.m_hInst, MAKEINTRESOURCE(s_hIconTypes[
type])); | 1804 std::wstring imageToLoad = L"#"; |
| 1805 imageToLoad += std::to_wstring(s_hIconTypes[type]); |
| 1806 s_hIcons[type] = (HICON)::LoadImage(_Module.m_hInst, imageToLoad.c_str(),
IMAGE_ICON, iconWidth, iconHeight, LR_SHARED); |
1794 if (!s_hIcons[type]) | 1807 if (!s_hIcons[type]) |
1795 { | 1808 { |
1796 DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_LOAD_
ICON, "Class::GetIcon - LoadIcon") | 1809 DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_LOAD_
ICON, "Class::GetIcon - LoadIcon") |
1797 } | 1810 } |
1798 } | 1811 } |
1799 | 1812 |
1800 icon = s_hIcons[type]; | 1813 icon = s_hIcons[type]; |
1801 } | 1814 } |
1802 s_criticalSectionLocal.Unlock(); | 1815 s_criticalSectionLocal.Unlock(); |
1803 | 1816 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1871 } | 1884 } |
1872 } | 1885 } |
1873 } | 1886 } |
1874 | 1887 |
1875 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT); | 1888 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT); |
1876 } | 1889 } |
1877 | 1890 |
1878 return hTabWnd; | 1891 return hTabWnd; |
1879 | 1892 |
1880 } | 1893 } |
OLD | NEW |