From bb88f142d7d41f0d6e6a4d1919fe6d6ace03fbe2 Mon Sep 17 00:00:00 2001 From: mataes2007 Date: Sun, 24 Apr 2011 17:39:28 +0000 Subject: popup: typo fixed fixed errors with ansi plugins fixed destroying all of popups windows before unloading added destroing functions on exit git-svn-id: http://miranda-plugins.googlecode.com/svn/trunk@24 e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb --- popup/src/effects.cpp | 3 ++- popup/src/headers.h | 1 + popup/src/history.cpp | 2 +- popup/src/main.cpp | 38 ++++++++++++++++++++++++++------------ popup/src/notifications.cpp | 2 +- popup/src/popup_wnd2.cpp | 2 +- 6 files changed, 32 insertions(+), 16 deletions(-) (limited to 'popup/src') diff --git a/popup/src/effects.cpp b/popup/src/effects.cpp index f19fd93..64ac46b 100644 --- a/popup/src/effects.cpp +++ b/popup/src/effects.cpp @@ -33,6 +33,7 @@ Last change by : $Author: Merlin_de $ #include "headers.h" class MyTestEffect; +HANDLE hSquareFad; class MyTestEffect: public IPopupPlusEffect { @@ -88,6 +89,6 @@ static INT_PTR svcCreateEffect_MyTestEffect(WPARAM, LPARAM) { return (INT_PTR)(n void PopupEfectsInitialize() { - CreateServiceFunction(MS_POPUP_CREATEVFX "Square fading", svcCreateEffect_MyTestEffect); + hSquareFad = CreateServiceFunction(MS_POPUP_CREATEVFX "Square fading", svcCreateEffect_MyTestEffect); CallService(MS_POPUP_REGISTERVFX, 0, (LPARAM)"Square fading"); } diff --git a/popup/src/headers.h b/popup/src/headers.h index 2aa428c..6b5f489 100644 --- a/popup/src/headers.h +++ b/popup/src/headers.h @@ -184,5 +184,6 @@ Last change by : $Author: Merlin_de $ #include "popup_gdiplus.h" INT_PTR svcEnableDisableMenuCommand(WPARAM, LPARAM); +extern HANDLE hSquareFad; #endif //HEADERS_H diff --git a/popup/src/history.cpp b/popup/src/history.cpp index 57b269e..baf5e17 100644 --- a/popup/src/history.cpp +++ b/popup/src/history.cpp @@ -169,7 +169,7 @@ void PopupHistoryAdd(POPUPDATA2 *ppdNew) void PopupHistoryShow() { if (!PopUpOptions.EnableHistory){ - MessageBox(NULL, TranslateT("Popup History is disabeled"), TranslateT("Popup History message"), MB_OK); + MessageBox(NULL, TranslateT("Popup History is disabled"), TranslateT("Popup History message"), MB_OK); return; } diff --git a/popup/src/main.cpp b/popup/src/main.cpp index 94d8b6f..486c597 100644 --- a/popup/src/main.cpp +++ b/popup/src/main.cpp @@ -72,6 +72,12 @@ HANDLE hMenuRoot = NULL; HANDLE hMenuItem = NULL; HANDLE hMenuItemHistory = NULL; +//==== ServiceFunctions Handles ==== +HANDLE hShowHistory = NULL; +HANDLE hTogglePopup = NULL; +HANDLE hGetStatus = NULL; +HANDLE hGetVersion = NULL; + //===== Event Handles ===== HANDLE hOptionsInitialize; //HANDLE hNotifyOptionsInitialize; deprecatet @@ -319,13 +325,13 @@ void InitMenuItems(void) { // Add item to main menu mi.hParentMenu = (HGENMENU)hMenuRoot; - CreateServiceFunction(MENUCOMMAND_SVC, svcEnableDisableMenuCommand); + hTogglePopup = CreateServiceFunction(MENUCOMMAND_SVC, svcEnableDisableMenuCommand); mi.ptszName = PopUpOptions.ModuleIsEnabled ? LPGENT("Disable &popup module") : LPGENT("Enable &popup module"); mi.pszService = MENUCOMMAND_SVC; hMenuItem = (HANDLE)CallService(MS_CLIST_ADDMAINMENUITEM, (WPARAM)0, (LPARAM)&mi); // Popup History - CreateServiceFunction(MENUCOMMAND_HISTORY, svcShowHistory); + hShowHistory = CreateServiceFunction(MENUCOMMAND_HISTORY, svcShowHistory); mi.position = 1000000000; mi.popupPosition = 1999990000; mi.ptszName = LPGENT("Popup History"); @@ -368,14 +374,14 @@ void registerUpdate(){ //register Hotkey void LoadHotkey(){ - HOTKEYDESC * hk = new HOTKEYDESC; - ZeroMemory(hk, sizeof(HOTKEYDESC)); - hk->cbSize = sizeof(hk); - hk->pszName = Translate("Toggle Popups"); - hk->pszDescription = Translate("Toggle Popups"); - hk->pszSection = Translate(MODULNAME_PLU); - hk->pszService = MENUCOMMAND_SVC; - CallService(MS_HOTKEY_REGISTER, 0, (LPARAM) hk); + HOTKEYDESC hk = {0}; + hk.cbSize = sizeof(hk); + hk.dwFlags = HKD_TCHAR; + hk.pszName = "Toggle Popups"; + hk.ptszDescription = LPGENT("Toggle Popups"); + hk.ptszSection = LPGENT(MODULNAME_PLU); + hk.pszService = MENUCOMMAND_SVC; + CallService(MS_HOTKEY_REGISTER, 0, (LPARAM) &hk); } //menu @@ -544,8 +550,8 @@ MIRAPI int Load(PLUGINLINK *link) CallService(MS_SYSTEM_GETVERSIONTEXT, (WPARAM) sizeof(ver), (LPARAM) ver); g_popup.isMirUnicode = strstr(ver, "Unicode") != NULL; - CreateServiceFunction("PopupPlus/GetVersion", svcGetVersion); - CreateServiceFunction(MS_POPUP_GETSTATUS, GetStatus); + hGetVersion = CreateServiceFunction("PopupPlus/GetVersion", svcGetVersion); + hGetStatus = CreateServiceFunction(MS_POPUP_GETSTATUS, GetStatus); DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &hMainThread, THREAD_SET_CONTEXT, FALSE, 0); @@ -708,6 +714,13 @@ MIRAPI int Unload(void) UnhookEvent(hEventStatusChanged); UnhookEvent(hIconsChanged); UnhookEvent(hFontsChanged); + UnhookEvent(hTBLoaded); + + DestroyServiceFunction(hShowHistory); + DestroyServiceFunction(hTogglePopup); + DestroyServiceFunction(hGetStatus); + DestroyServiceFunction(hGetVersion); + DestroyServiceFunction(hSquareFad); DeleteObject(fonts.title); DeleteObject(fonts.clock); @@ -728,6 +741,7 @@ MIRAPI int Unload(void) OptAdv_UnregisterVfx(); UnloadPopupThread(); + UnloadPopupWnd2(); PopupHistoryUnload(); UnregisterClass (MAKEINTATOM(g_wndClass.cPopupWnd2),hInst); diff --git a/popup/src/notifications.cpp b/popup/src/notifications.cpp index 03f8c24..89cf7d8 100644 --- a/popup/src/notifications.cpp +++ b/popup/src/notifications.cpp @@ -167,7 +167,7 @@ void LoadNotificationSettings(POPUPTREEDATA *ptd, char* szModul) mir_snprintf(setting, sizeof(setting), "{%s/%s}TimeoutVal", ptd->notification.lpzGroup, ptd->notification.lpzName); ptd->timeoutValue = (signed char)DBGetContactSettingWord(NULL, szModul, setting, - ptd->notification.iSeconds ? ptd->notification.iSeconds : PopUpOptions.Seconds); + ptd->notification.iSeconds ? ptd->notification.iSeconds : 0); mir_snprintf(setting, sizeof(setting), "{%s/%s}disableWhen", ptd->notification.lpzGroup, ptd->notification.lpzName); ptd->disableWhen = diff --git a/popup/src/popup_wnd2.cpp b/popup/src/popup_wnd2.cpp index 4ba2181..1e680c3 100644 --- a/popup/src/popup_wnd2.cpp +++ b/popup/src/popup_wnd2.cpp @@ -606,7 +606,7 @@ bool __forceinline isTextEmpty(char *text) if (!text) return true; while (*text) - if (!isspace(*text++)) + if (!isspace(BYTE(*text++))) return false; return true; } -- cgit v1.2.3