From ef0abe4f9f67eeff4007f4839ba08a503472c74c Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 21 Jan 2014 23:24:02 +0000 Subject: - new typed helper, WindowList_Create, to create a window list - new service, WindowList_Destroy, to destroy a window list - internal windowlist.cpp implementation rewritten to LIST<> git-svn-id: http://svn.miranda-ng.org/main/trunk@7823 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Weather/src/weather.cpp | 7 ++- plugins/Weather/src/weather_mwin.cpp | 97 +++++++++++++++++------------------- 2 files changed, 52 insertions(+), 52 deletions(-) (limited to 'plugins/Weather') diff --git a/plugins/Weather/src/weather.cpp b/plugins/Weather/src/weather.cpp index e477f1d14e..f93dded751 100644 --- a/plugins/Weather/src/weather.cpp +++ b/plugins/Weather/src/weather.cpp @@ -136,8 +136,8 @@ int WeatherInit(WPARAM wParam,LPARAM lParam) HookEvent(ME_TTB_MODULELOADED, OnToolbarLoaded); - hDataWindowList = (HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST,0,0); - hWindowList = (HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST,0,0); + hDataWindowList = WindowList_Create(); + hWindowList = WindowList_Create(); return 0; } @@ -173,6 +173,9 @@ extern "C" int __declspec(dllexport) Unload(void) DestroyOptions(); DestroyWIList(); // unload all ini data from memory + WindowList_Destroy(hDataWindowList); + WindowList_Destroy(hWindowList); + CloseHandle(hUpdateMutex); return 0; } diff --git a/plugins/Weather/src/weather_mwin.cpp b/plugins/Weather/src/weather_mwin.cpp index 0d4ba8317a..6ccbfb19f0 100644 --- a/plugins/Weather/src/weather_mwin.cpp +++ b/plugins/Weather/src/weather_mwin.cpp @@ -325,56 +325,52 @@ void InitMwin(void) if ( !ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) return; - hMwinWindowList = (HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST,0,0); - - { - WNDCLASS wndclass; - wndclass.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW; - wndclass.lpfnWndProc = wndProc; - wndclass.cbClsExtra = 0; - wndclass.cbWndExtra = 0; - wndclass.hInstance = hInst; - wndclass.hIcon = NULL; - wndclass.hCursor = LoadCursor (NULL, IDC_ARROW); - wndclass.hbrBackground = 0; //(HBRUSH)(COLOR_3DFACE+1); - wndclass.lpszMenuName = NULL; - wndclass.lpszClassName = _T("WeatherFrame"); - RegisterClass(&wndclass); - } - - { - ColourIDT colourid = {0}; - colourid.cbSize = sizeof(ColourIDT); - strcpy(colourid.dbSettingsGroup, WEATHERPROTONAME); - strcpy(colourid.setting, "ColorMwinFrame"); - _tcscpy(colourid.name, LPGENT("Frame Background")); - _tcscpy(colourid.group, _T(WEATHERPROTONAME)); - colourid.defcolour = GetSysColor(COLOR_3DFACE); - ColourRegisterT(&colourid); - - FontIDT fontid = {0}; - fontid.cbSize = sizeof(FontIDT); - fontid.flags = FIDF_ALLOWREREGISTER | FIDF_DEFAULTVALID; - strcpy(fontid.dbSettingsGroup, WEATHERPROTONAME); - _tcscpy(fontid.group, _T(WEATHERPROTONAME)); - _tcscpy(fontid.name, LPGENT("Frame Font")); - strcpy(fontid.prefix, "fnt0"); - - HDC hdc = GetDC(NULL); - fontid.deffontsettings.size = -13; - ReleaseDC(0, hdc); - - fontid.deffontsettings.charset = DEFAULT_CHARSET; - _tcscpy(fontid.deffontsettings.szFace, _T("Verdana")); - _tcscpy(fontid.backgroundGroup, _T(WEATHERPROTONAME)); - _tcscpy(fontid.backgroundName, LPGENT("Frame Background")); - FontRegisterT(&fontid); - - fontid.deffontsettings.style = DBFONTF_BOLD; - _tcscpy(fontid.name, LPGENT("Frame Title Font")); - strcpy(fontid.prefix, "fnt1"); - FontRegisterT(&fontid); - } + hMwinWindowList = WindowList_Create(); + + WNDCLASS wndclass; + wndclass.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW; + wndclass.lpfnWndProc = wndProc; + wndclass.cbClsExtra = 0; + wndclass.cbWndExtra = 0; + wndclass.hInstance = hInst; + wndclass.hIcon = NULL; + wndclass.hCursor = LoadCursor (NULL, IDC_ARROW); + wndclass.hbrBackground = 0; //(HBRUSH)(COLOR_3DFACE+1); + wndclass.lpszMenuName = NULL; + wndclass.lpszClassName = _T("WeatherFrame"); + RegisterClass(&wndclass); + + ColourIDT colourid = {0}; + colourid.cbSize = sizeof(ColourIDT); + strcpy(colourid.dbSettingsGroup, WEATHERPROTONAME); + strcpy(colourid.setting, "ColorMwinFrame"); + _tcscpy(colourid.name, LPGENT("Frame Background")); + _tcscpy(colourid.group, _T(WEATHERPROTONAME)); + colourid.defcolour = GetSysColor(COLOR_3DFACE); + ColourRegisterT(&colourid); + + FontIDT fontid = {0}; + fontid.cbSize = sizeof(FontIDT); + fontid.flags = FIDF_ALLOWREREGISTER | FIDF_DEFAULTVALID; + strcpy(fontid.dbSettingsGroup, WEATHERPROTONAME); + _tcscpy(fontid.group, _T(WEATHERPROTONAME)); + _tcscpy(fontid.name, LPGENT("Frame Font")); + strcpy(fontid.prefix, "fnt0"); + + HDC hdc = GetDC(NULL); + fontid.deffontsettings.size = -13; + ReleaseDC(0, hdc); + + fontid.deffontsettings.charset = DEFAULT_CHARSET; + _tcscpy(fontid.deffontsettings.szFace, _T("Verdana")); + _tcscpy(fontid.backgroundGroup, _T(WEATHERPROTONAME)); + _tcscpy(fontid.backgroundName, LPGENT("Frame Background")); + FontRegisterT(&fontid); + + fontid.deffontsettings.style = DBFONTF_BOLD; + _tcscpy(fontid.name, LPGENT("Frame Title Font")); + strcpy(fontid.prefix, "fnt1"); + FontRegisterT(&fontid); for (HANDLE hContact = db_find_first(WEATHERPROTONAME); hContact; hContact = db_find_next(hContact, WEATHERPROTONAME)) if (db_get_dw(hContact, WEATHERPROTONAME, "mwin", 0)) @@ -391,5 +387,6 @@ void DestroyMwin(void) CallService(MS_CLIST_FRAMES_REMOVEFRAME, frameId, 0); } UnregisterClass( _T("WeatherFrame"), hInst); + WindowList_Destroy(hMwinWindowList); UnhookEvent(hFontHook); } -- cgit v1.2.3