Left: | ||
Right: |
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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
135 assert(linkIDCounter == m_links.size() && "The amount of links in the text is different from the amount of provided links"); | 135 assert(linkIDCounter == m_links.size() && "The amount of links in the text is different from the amount of provided links"); |
136 m_htmlPage = ReplaceMulti(m_htmlPage, L"<!--Title-->", ToUtf16String(notificat ion.GetTitle())); | 136 m_htmlPage = ReplaceMulti(m_htmlPage, L"<!--Title-->", ToUtf16String(notificat ion.GetTitle())); |
137 m_htmlPage = ReplaceMulti(m_htmlPage, L"<!--Body-->", body); | 137 m_htmlPage = ReplaceMulti(m_htmlPage, L"<!--Body-->", body); |
138 } | 138 } |
139 | 139 |
140 NotificationWindow::~NotificationWindow() | 140 NotificationWindow::~NotificationWindow() |
141 { | 141 { |
142 } | 142 } |
143 | 143 |
144 LRESULT NotificationWindow::OnCreate(const CREATESTRUCT* /*createStruct*/) { | 144 LRESULT NotificationWindow::OnCreate(const CREATESTRUCT* /*createStruct*/) { |
145 { | |
146 DCHandle hdc(GetDC()); | |
147 m_dpi = hdc.GetDeviceCaps(LOGPIXELSX); | |
148 } | |
145 m_bgColor.CreateSolidBrush(RGB(255, 255, 255)); | 149 m_bgColor.CreateSolidBrush(RGB(255, 255, 255)); |
146 | 150 |
147 CRect iconRect(CPoint(0, 0), CSize(kIconSize + 2 * kIconPadding, kIconSize + 2 * kIconPadding)); | 151 CRect iconRect(CPoint(0, 0), CSize(kIconSize + 2 * kIconPadding, kIconSize + 2 * kIconPadding)); |
148 m_icon.Create(m_hWnd, DPIAware(iconRect), nullptr, WS_CHILD | WS_VISIBLE | SS_ BITMAP | SS_CENTERIMAGE); | 152 m_icon.Create(m_hWnd, DPIAware(iconRect), nullptr, WS_CHILD | WS_VISIBLE | SS_ BITMAP | SS_CENTERIMAGE); |
149 LoadABPIcon(); | 153 LoadABPIcon(); |
150 | 154 |
151 m_axIE.Create(m_hWnd, DPIAware(CRect(CPoint(iconRect.right, 0), CSize(kWindowW idth - iconRect.right, kWindowHeight))), | 155 m_axIE.Create(m_hWnd, DPIAware(CRect(CPoint(iconRect.right, 0), CSize(kWindowW idth - iconRect.right, kWindowHeight))), |
152 L"", WS_CHILD | WS_VISIBLE, 0, kHTMLDocumentCtrlID); | 156 L"", WS_CHILD | WS_VISIBLE, 0, kHTMLDocumentCtrlID); |
153 m_axIE.CreateControl((L"mshtml:" + m_htmlPage).c_str()); | 157 m_axIE.CreateControl((L"mshtml:" + m_htmlPage).c_str()); |
154 ATL::CComPtr<IAxWinAmbientDispatch> axWinAmbient; | 158 ATL::CComPtr<IAxWinAmbientDispatch> axWinAmbient; |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
290 ::DrawIconEx(tmpDC, 0, 0, hIcon, tmpRect.Width(), tmpRect.Height(), 0, nullptr , DI_NORMAL); | 294 ::DrawIconEx(tmpDC, 0, 0, hIcon, tmpRect.Width(), tmpRect.Height(), 0, nullptr , DI_NORMAL); |
291 m_iconImg.Attach(bitmap.Detach()); | 295 m_iconImg.Attach(bitmap.Detach()); |
292 tmpDC.SelectBitmap(prevBitmap); | 296 tmpDC.SelectBitmap(prevBitmap); |
293 m_icon.SetBitmap(m_iconImg); | 297 m_icon.SetBitmap(m_iconImg); |
294 } | 298 } |
295 | 299 |
296 POINT NotificationBorderWindow::GetWindowCoordinates() { | 300 POINT NotificationBorderWindow::GetWindowCoordinates() { |
297 HMONITOR primaryMonitor = MonitorFromWindow(m_hWnd, MONITOR_DEFAULTTOPRIMARY); | 301 HMONITOR primaryMonitor = MonitorFromWindow(m_hWnd, MONITOR_DEFAULTTOPRIMARY); |
298 { | 302 { |
299 DCHandle hdc(GetDC()); | 303 DCHandle hdc(GetDC()); |
300 m_dpi = hdc.GetDeviceCaps(LOGPIXELSX); | 304 m_dpi = hdc.GetDeviceCaps(LOGPIXELSX); |
Oleksandr
2015/08/18 11:47:40
Is this still needed, seeing that we now get dpi i
sergei
2015/08/18 11:58:40
It's a little bit odd. `GetWindowCoordinates` is a
| |
301 } | 305 } |
302 MONITORINFO monitorInfo = {}; | 306 MONITORINFO monitorInfo = {}; |
303 monitorInfo.cbSize = sizeof(monitorInfo); | 307 monitorInfo.cbSize = sizeof(monitorInfo); |
304 GetMonitorInfo(primaryMonitor, &monitorInfo); | 308 GetMonitorInfo(primaryMonitor, &monitorInfo); |
305 int windowX = monitorInfo.rcWork.right - DPIAware(kWindowWidth + kWindowMargin Right); | 309 int windowX = monitorInfo.rcWork.right - DPIAware(kWindowWidth + kWindowMargin Right); |
306 int windowY = monitorInfo.rcWork.bottom - DPIAware(kWindowHeight + kWindowMarg inBottom); | 310 int windowY = monitorInfo.rcWork.bottom - DPIAware(kWindowHeight + kWindowMarg inBottom); |
307 POINT coords = {windowX, windowY}; | 311 POINT coords = {windowX, windowY}; |
308 return coords; | 312 return coords; |
309 } | 313 } |
310 | 314 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
358 { | 362 { |
359 DestroyWindow(); | 363 DestroyWindow(); |
360 return 0; | 364 return 0; |
361 } | 365 } |
362 | 366 |
363 void NotificationBorderWindow::OnFinalMessage(HWND) { | 367 void NotificationBorderWindow::OnFinalMessage(HWND) { |
364 if (!!m_onDestroyedCallback) { | 368 if (!!m_onDestroyedCallback) { |
365 m_onDestroyedCallback(); | 369 m_onDestroyedCallback(); |
366 } | 370 } |
367 } | 371 } |
LEFT | RIGHT |