LEFT | RIGHT |
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 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
677 case DISPID_COMMANDSTATECHANGE: | 679 case DISPID_COMMANDSTATECHANGE: |
678 if (m_hPaneWnd == NULL) | 680 if (m_hPaneWnd == NULL) |
679 { | 681 { |
680 CreateStatusBarPane(); | 682 CreateStatusBarPane(); |
681 } | 683 } |
682 else | 684 else |
683 { | 685 { |
684 if (AdblockPlus::IE::InstalledMajorVersion() > 6) | 686 if (AdblockPlus::IE::InstalledMajorVersion() > 6) |
685 { | 687 { |
686 RECT rect; | 688 RECT rect; |
687 BOOL rectRes = GetClientRect(m_hStatusBarWnd, &rect); | 689 //Get the RECT for the leftmost pane (the status text pane) |
| 690 BOOL rectRes = ::SendMessage(m_hStatusBarWnd, SB_GETRECT, 0, (LPARAM)&
rect); |
688 if (rectRes == TRUE) | 691 if (rectRes == TRUE) |
689 { | 692 { |
690 MoveWindow(m_hPaneWnd, rect.right - 200, 0, m_nPaneWidth, rect.botto
m - rect.top, TRUE); | 693 MoveWindow(m_hPaneWnd, rect.right - m_nPaneWidth, 0, m_nPaneWidth, r
ect.bottom - rect.top, TRUE); |
691 } | 694 } |
692 } | 695 } |
693 } | 696 } |
694 break; | 697 break; |
695 | 698 |
696 case DISPID_STATUSTEXTCHANGE: | 699 case DISPID_STATUSTEXTCHANGE: |
697 break; | 700 break; |
698 | 701 |
699 case DISPID_BEFORENAVIGATE2: | 702 case DISPID_BEFORENAVIGATE2: |
700 { | 703 { |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
986 DEBUG_ERROR_LOG(0, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_NO_STATUSBAR_WIN, "Class
::CreateStatusBarPane - No status bar") | 989 DEBUG_ERROR_LOG(0, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_NO_STATUSBAR_WIN, "Class
::CreateStatusBarPane - No status bar") |
987 return true; | 990 return true; |
988 } | 991 } |
989 | 992 |
990 // Calculate pane height | 993 // Calculate pane height |
991 AdblockPlus::Rectangle rcStatusBar; | 994 AdblockPlus::Rectangle rcStatusBar; |
992 ::GetClientRect(hWndStatusBar, &rcStatusBar); | 995 ::GetClientRect(hWndStatusBar, &rcStatusBar); |
993 | 996 |
994 if (rcStatusBar.Height() > 0) | 997 if (rcStatusBar.Height() > 0) |
995 { | 998 { |
| 999 if (rcStatusBar.Height() < iconWidth) |
| 1000 { |
| 1001 iconWidth = 19; |
| 1002 iconHeight = 19; |
| 1003 } |
| 1004 |
996 #ifdef _DEBUG | 1005 #ifdef _DEBUG |
997 m_nPaneWidth = 70; | 1006 m_nPaneWidth = 70; |
998 #else | 1007 #else |
999 m_nPaneWidth = min(rcStatusBar.Height(), 22); | 1008 m_nPaneWidth = min(rcStatusBar.Height(), iconWidth); |
1000 #endif | 1009 #endif |
1001 } | 1010 } |
1002 else | 1011 else |
1003 { | 1012 { |
1004 #ifdef _DEBUG | 1013 #ifdef _DEBUG |
1005 m_nPaneWidth = 70; | 1014 m_nPaneWidth = 70; |
1006 #else | 1015 #else |
1007 m_nPaneWidth = 22; | 1016 m_nPaneWidth = iconWidth; |
1008 #endif | 1017 #endif |
1009 } | 1018 } |
1010 // Create pane window | 1019 // Create pane window |
1011 HWND hWndNewPane = ::CreateWindowEx( | 1020 HWND hWndNewPane = ::CreateWindowEx( |
1012 NULL, | 1021 NULL, |
1013 MAKEINTATOM(GetAtomPaneClass()), | 1022 MAKEINTATOM(GetAtomPaneClass()), |
1014 L"", | 1023 L"", |
1015 WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, | 1024 WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, |
1016 rcStatusBar.Width() - 500,0,m_nPaneWidth,rcStatusBar.Height(), | 1025 rcStatusBar.Width() - 500, 0, m_nPaneWidth, rcStatusBar.Height(), |
1017 hWndStatusBar, | 1026 hWndStatusBar, |
1018 (HMENU)3671, | 1027 (HMENU)3671, |
1019 _Module.m_hInst, | 1028 _Module.m_hInst, |
1020 NULL); | 1029 NULL); |
1021 | 1030 |
1022 if (!hWndNewPane) | 1031 if (!hWndNewPane) |
1023 { | 1032 { |
1024 DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_CREATE_ST
ATUSBAR_PANE, "Class::CreateStatusBarPane - CreateWindowEx") | 1033 DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_CREATE_ST
ATUSBAR_PANE, "Class::CreateStatusBarPane - CreateWindowEx") |
1025 return false; | 1034 return false; |
1026 } | 1035 } |
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1612 } | 1621 } |
1613 } | 1622 } |
1614 } | 1623 } |
1615 } | 1624 } |
1616 | 1625 |
1617 // Draw icon | 1626 // Draw icon |
1618 if (CPluginClient::GetInstance()) | 1627 if (CPluginClient::GetInstance()) |
1619 { | 1628 { |
1620 HICON hIcon = GetStatusBarIcon(pClass->GetTab()->GetDocumentUrl()); | 1629 HICON hIcon = GetStatusBarIcon(pClass->GetTab()->GetDocumentUrl()); |
1621 | 1630 |
1622 int offx = (rcClient.Height() - 16)/2 + nDrawEdge; | 1631 int offx = nDrawEdge; |
1623 if (hIcon) | 1632 if (hIcon) |
1624 { | 1633 { |
1625 ::DrawIconEx(hDC, offx, (rcClient.Height() - 16)/2 + 2, hIcon, 16, 16,
NULL, NULL, DI_NORMAL); | 1634 //Get the RECT for the leftmost pane (the status text pane) |
1626 offx += 22; | 1635 RECT rect; |
| 1636 BOOL rectRes = ::SendMessage(pClass->m_hStatusBarWnd, SB_GETRECT, 0, (
LPARAM)&rect); |
| 1637 ::DrawIconEx(hDC, 0, rect.bottom - rect.top - iconHeight, hIcon, iconW
idth, iconHeight, NULL, NULL, DI_NORMAL); |
| 1638 offx += iconWidth; |
1627 } | 1639 } |
1628 #ifdef _DEBUG | 1640 #ifdef _DEBUG |
1629 // Display version | 1641 // Display version |
1630 HFONT hFont = (HFONT)::SendMessage(pClass->m_hStatusBarWnd, WM_GETFONT,
0, 0); | 1642 HFONT hFont = (HFONT)::SendMessage(pClass->m_hStatusBarWnd, WM_GETFONT,
0, 0); |
1631 HGDIOBJ hOldFont = ::SelectObject(hDC,hFont); | 1643 HGDIOBJ hOldFont = ::SelectObject(hDC,hFont); |
1632 | 1644 |
1633 AdblockPlus::Rectangle rcText = rcClient; | 1645 AdblockPlus::Rectangle rcText = rcClient; |
1634 rcText.left += offx; | 1646 rcText.left += offx; |
1635 ::SetBkMode(hDC, TRANSPARENT); | 1647 ::SetBkMode(hDC, TRANSPARENT); |
1636 ::DrawTextW(hDC, IEPLUGIN_VERSION, -1, &rcText, DT_WORD_ELLIPSIS|DT_LEFT
|DT_SINGLELINE|DT_VCENTER); | 1648 ::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... |
1784 } | 1796 } |
1785 | 1797 |
1786 HICON CPluginClass::GetIcon(int type) | 1798 HICON CPluginClass::GetIcon(int type) |
1787 { | 1799 { |
1788 HICON icon = NULL; | 1800 HICON icon = NULL; |
1789 | 1801 |
1790 s_criticalSectionLocal.Lock(); | 1802 s_criticalSectionLocal.Lock(); |
1791 { | 1803 { |
1792 if (!s_hIcons[type]) | 1804 if (!s_hIcons[type]) |
1793 { | 1805 { |
1794 s_hIcons[type] = ::LoadIcon(_Module.m_hInst, MAKEINTRESOURCE(s_hIconTypes[
type])); | 1806 std::wstring imageToLoad = L"#"; |
| 1807 imageToLoad += std::to_wstring(s_hIconTypes[type]); |
| 1808 s_hIcons[type] = (HICON)::LoadImage(_Module.m_hInst, imageToLoad.c_str(),
IMAGE_ICON, iconWidth, iconHeight, LR_SHARED); |
1795 if (!s_hIcons[type]) | 1809 if (!s_hIcons[type]) |
1796 { | 1810 { |
1797 DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_LOAD_
ICON, "Class::GetIcon - LoadIcon"); | 1811 DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_LOAD_
ICON, "Class::GetIcon - LoadIcon"); |
1798 } | 1812 } |
1799 } | 1813 } |
1800 | 1814 |
1801 icon = s_hIcons[type]; | 1815 icon = s_hIcons[type]; |
1802 } | 1816 } |
1803 s_criticalSectionLocal.Unlock(); | 1817 s_criticalSectionLocal.Unlock(); |
1804 | 1818 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1872 } | 1886 } |
1873 } | 1887 } |
1874 } | 1888 } |
1875 | 1889 |
1876 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT); | 1890 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT); |
1877 } | 1891 } |
1878 | 1892 |
1879 return hTabWnd; | 1893 return hTabWnd; |
1880 | 1894 |
1881 } | 1895 } |
LEFT | RIGHT |