Left: | ||
Right: |
OLD | NEW |
---|---|
1 #include "PluginStdAfx.h" | 1 #include "PluginStdAfx.h" |
2 | 2 |
3 #include "PluginClass.h" | 3 #include "PluginClass.h" |
4 #include "PluginSettings.h" | 4 #include "PluginSettings.h" |
5 #include "PluginSystem.h" | 5 #include "PluginSystem.h" |
6 #ifdef SUPPORT_FILTER | 6 #ifdef SUPPORT_FILTER |
7 #include "PluginFilter.h" | 7 #include "PluginFilter.h" |
8 #endif | 8 #endif |
9 #include "PluginMimeFilterClient.h" | 9 #include "PluginMimeFilterClient.h" |
10 #include "PluginClient.h" | 10 #include "PluginClient.h" |
11 #include "PluginClientFactory.h" | 11 #include "PluginClientFactory.h" |
12 #include "PluginMutex.h" | 12 #include "PluginMutex.h" |
13 #include "sddl.h" | 13 #include "sddl.h" |
14 #include "PluginUtil.h" | 14 #include "PluginUtil.h" |
15 #include "PluginUserSettings.h" | 15 #include "PluginUserSettings.h" |
16 #include "../shared/Utils.h" | |
16 | 17 |
17 #include "../shared/Dictionary.h" | 18 #include "../shared/Dictionary.h" |
18 | 19 |
Felix Dahlke
2013/09/11 15:22:59
As before, no need to add another line of whitespa
| |
20 | |
19 #ifdef DEBUG_HIDE_EL | 21 #ifdef DEBUG_HIDE_EL |
20 DWORD profileTime = 0; | 22 DWORD profileTime = 0; |
21 #endif | 23 #endif |
22 | 24 |
23 typedef HANDLE (WINAPI *OPENTHEMEDATA)(HWND, LPCWSTR); | 25 typedef HANDLE (WINAPI *OPENTHEMEDATA)(HWND, LPCWSTR); |
24 typedef HRESULT (WINAPI *DRAWTHEMEBACKGROUND)(HANDLE, HDC, INT, INT, LPRECT, LPR ECT); | 26 typedef HRESULT (WINAPI *DRAWTHEMEBACKGROUND)(HANDLE, HDC, INT, INT, LPRECT, LPR ECT); |
25 typedef HRESULT (WINAPI *CLOSETHEMEDATA)(HANDLE); | 27 typedef HRESULT (WINAPI *CLOSETHEMEDATA)(HANDLE); |
26 | 28 |
27 | 29 |
28 HICON CPluginClass::s_hIcons[ICON_MAX] = { NULL, NULL, NULL }; | 30 HICON CPluginClass::s_hIcons[ICON_MAX] = { NULL, NULL, NULL }; |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
206 else | 208 else |
207 { | 209 { |
208 url = m_tab->GetDocumentUrl(); | 210 url = m_tab->GetDocumentUrl(); |
209 } | 211 } |
210 | 212 |
211 return url; | 213 return url; |
212 } | 214 } |
213 | 215 |
214 DWORD WINAPI CPluginClass::StartInitObject(LPVOID thisPtr) | 216 DWORD WINAPI CPluginClass::StartInitObject(LPVOID thisPtr) |
215 { | 217 { |
218 INITCOMMONCONTROLSEX commControls; | |
219 commControls.dwSize = sizeof(INITCOMMONCONTROLSEX); | |
220 commControls.dwICC = ICC_USEREX_CLASSES | ICC_STANDARD_CLASSES | ICC_BAR_CLASS ES; | |
Wladimir Palant
2013/09/11 13:07:06
Isn't ICC_BAR_CLASSES enough for a tooltip?
| |
221 InitCommonControlsEx(&commControls); | |
Wladimir Palant
2013/09/11 13:07:06
Given that common controls are used by the Notific
Felix Dahlke
2013/09/11 15:22:59
I'd rather keep this where it is, the call is not
Wladimir Palant
2013/09/12 14:13:34
It is. Looking at the documentation, InitCommonCon
Felix Dahlke
2013/09/12 14:23:49
Then let's put it in the NotificationMessage class
Oleksandr
2013/09/12 14:26:26
NotificationMessage sounds best for me as well the
| |
216 if (thisPtr == NULL) | 222 if (thisPtr == NULL) |
217 return 0; | 223 return 0; |
218 if (!((CPluginClass*)thisPtr)->InitObject(true)) | 224 if (!((CPluginClass*)thisPtr)->InitObject(true)) |
219 { | 225 { |
220 ((CPluginClass*)thisPtr)->Unadvice(); | 226 ((CPluginClass*)thisPtr)->Unadvice(); |
221 } | 227 } |
222 | 228 |
223 return 0; | 229 return 0; |
224 } | 230 } |
225 | 231 |
(...skipping 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1263 int nCommand = ::TrackPopupMenu(hMenu, nMenuFlags, pt.x, pt.y, 0, hMenuWnd, 0) ; | 1269 int nCommand = ::TrackPopupMenu(hMenu, nMenuFlags, pt.x, pt.y, 0, hMenuWnd, 0) ; |
1264 | 1270 |
1265 ::DestroyMenu(hMenu); | 1271 ::DestroyMenu(hMenu); |
1266 ::DestroyWindow(hMenuWnd); | 1272 ::DestroyWindow(hMenuWnd); |
1267 | 1273 |
1268 switch (nCommand) | 1274 switch (nCommand) |
1269 { | 1275 { |
1270 case ID_MENU_UPDATE: | 1276 case ID_MENU_UPDATE: |
1271 { | 1277 { |
1272 CPluginClient* client = CPluginClient::GetInstance(); | 1278 CPluginClient* client = CPluginClient::GetInstance(); |
1273 client->CheckForUpdates(); | 1279 notifMessage.SetParent(m_hPaneWnd); |
1280 Dictionary* dictionary = Dictionary::GetInstance(); | |
1281 std::wstring checkingText = dictionary->Lookup("updater", "checking-for-up dates-text"); | |
1282 std::wstring checkingTitle = dictionary->Lookup("updater", "checking-for-u pdates-title"); | |
1283 | |
1284 notifMessage.Show(checkingText.c_str(), TTI_INFO); | |
1285 notifMessage.SetTextAndIcon(checkingText.c_str(), checkingTitle.c_str(), T TI_INFO); | |
Wladimir Palant
2013/09/11 13:07:06
Assuming that NotificationMessage is our class, th
| |
1286 client->CheckForUpdates(m_hPaneWnd); | |
1274 } | 1287 } |
1275 break; | 1288 break; |
1276 case ID_MENU_DISABLE: | 1289 case ID_MENU_DISABLE: |
1277 { | 1290 { |
1278 CPluginSettings* settings = CPluginSettings::GetInstance(); | 1291 CPluginSettings* settings = CPluginSettings::GetInstance(); |
1279 | 1292 |
1280 settings->TogglePluginEnabled(); | 1293 settings->TogglePluginEnabled(); |
1281 | 1294 |
1282 // Enable / disable mime filter | 1295 // Enable / disable mime filter |
1283 s_criticalSectionLocal.Lock(); | 1296 s_criticalSectionLocal.Lock(); |
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1770 break; | 1783 break; |
1771 case SC_CLOSE: | 1784 case SC_CLOSE: |
1772 break; | 1785 break; |
1773 | 1786 |
1774 case WM_UPDATEUISTATE: | 1787 case WM_UPDATEUISTATE: |
1775 { | 1788 { |
1776 CPluginTab* tab = GetTab(::GetCurrentThreadId()); | 1789 CPluginTab* tab = GetTab(::GetCurrentThreadId()); |
1777 if (tab) | 1790 if (tab) |
1778 { | 1791 { |
1779 tab->OnActivate(); | 1792 tab->OnActivate(); |
1793 RECT rect; | |
1794 GetWindowRect(pClass->m_hPaneWnd, &rect); | |
1795 pClass->notifMessage.Move(rect.left + (rect.right - rect.left) / 2, rect .top + (rect.bottom - rect.top) / 2); | |
1780 } | 1796 } |
1797 pClass->notifMessage.Hide(); | |
Wladimir Palant
2013/09/11 13:07:06
Shouldn't the notification be only hidden if we ge
| |
1798 } | |
1799 break; | |
1800 case WM_WINDOWPOSCHANGING: | |
1801 { | |
1802 RECT rect; | |
1803 GetWindowRect(pClass->m_hPaneWnd, &rect); | |
1804 pClass->notifMessage.Move(rect.left + (rect.right - rect.left) / 2, rect.t op + (rect.bottom - rect.top) / 2); | |
Wladimir Palant
2013/09/11 13:07:06
Shouldn't we check whether the notification is act
| |
1805 } | |
1806 break; | |
1807 case WM_ALREADY_UP_TO_DATE: | |
1808 { | |
1809 Dictionary* dictionary = Dictionary::GetInstance(); | |
1810 std::wstring upToDateText = dictionary->Lookup("updater", "update-already- up-to-date-text"); | |
1811 std::wstring upToDateTitle = dictionary->Lookup("updater", "update-already -up-to-date-title"); | |
1812 pClass->notifMessage.SetTextAndIcon(upToDateText.c_str(), upToDateTitle.c_ str(), TTI_INFO); | |
1813 } | |
1814 break; | |
1815 case WM_UPDATE_CHECK_ERROR: | |
1816 { | |
1817 Dictionary* dictionary = Dictionary::GetInstance(); | |
1818 std::wstring errorText = dictionary->Lookup("updater", "update-error-text" ); | |
1819 std::wstring errorTitle = dictionary->Lookup("updater", "update-error-titl e"); | |
1820 pClass->notifMessage.SetTextAndIcon(errorText.c_str(), errorText.c_str(), TTI_ERROR); | |
1821 } | |
1822 break; | |
1823 case WM_DOWNLOADING_UPDATE: | |
1824 { | |
1825 Dictionary* dictionary = Dictionary::GetInstance(); | |
1826 std::wstring downloadingText = dictionary->Lookup("updater", "downloading- update-text"); | |
1827 std::wstring downloadingTitle = dictionary->Lookup("updater", "downloading -update-title"); | |
1828 pClass->notifMessage.SetTextAndIcon(downloadingText.c_str(), downloadingTi tle.c_str(), TTI_ERROR); | |
1781 } | 1829 } |
1782 break; | 1830 break; |
1783 } | 1831 } |
1784 | 1832 |
1785 return DefWindowProc(hWnd, message, wParam, lParam); | 1833 return DefWindowProc(hWnd, message, wParam, lParam); |
1786 } | 1834 } |
1787 | 1835 |
1788 | 1836 |
1789 void CPluginClass::UpdateStatusBar() | 1837 void CPluginClass::UpdateStatusBar() |
1790 { | 1838 { |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1912 } | 1960 } |
1913 } | 1961 } |
1914 } | 1962 } |
1915 | 1963 |
1916 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT); | 1964 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT); |
1917 } | 1965 } |
1918 | 1966 |
1919 return hTabWnd; | 1967 return hTabWnd; |
1920 | 1968 |
1921 } | 1969 } |
OLD | NEW |