summaryrefslogtreecommitdiff
path: root/plugins/Popup/src/services.cpp
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2014-12-21 08:17:45 +0000
committerKirill Volinsky <mataes2007@gmail.com>2014-12-21 08:17:45 +0000
commitb3ded48d866f59df3c9e8634eabe6e62596ad2d5 (patch)
treea7a9f2cdd1a9846b7445e8ec6babbecee79c8c0b /plugins/Popup/src/services.cpp
parentb2ba573600e650273800774c7fad23268019a353 (diff)
Popup: changed warning level to w4
git-svn-id: http://svn.miranda-ng.org/main/trunk@11550 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Popup/src/services.cpp')
-rw-r--r--plugins/Popup/src/services.cpp127
1 files changed, 63 insertions, 64 deletions
diff --git a/plugins/Popup/src/services.cpp b/plugins/Popup/src/services.cpp
index 6e360ae165..347193f96c 100644
--- a/plugins/Popup/src/services.cpp
+++ b/plugins/Popup/src/services.cpp
@@ -2,9 +2,9 @@
Popup Plus plugin for Miranda IM
Copyright © 2002 Luca Santarelli,
- © 2004-2007 Victor Pavlychko
- © 2010 MPK
- © 2010 Merlin_de
+© 2004-2007 Victor Pavlychko
+© 2010 MPK
+© 2010 Merlin_de
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@@ -61,7 +61,7 @@ INT_PTR Popup_AddPopupW(WPARAM wParam, LPARAM lParam)
if (!ppd)
return -1;
- POPUPDATA2 ppd2 = {0};
+ POPUPDATA2 ppd2 = { 0 };
ppd2.cbSize = sizeof(ppd2);
ppd2.flags = PU2_UNICODE;
ppd2.lchContact = ppd->lchContact;
@@ -102,23 +102,23 @@ INT_PTR Popup_AddPopup2(WPARAM wParam, LPARAM lParam)
if (!ppdIn)
return -1;
- if ( NotifyEventHooks(hEventNotify, (WPARAM)ppdIn->lchContact, (LPARAM)ppdIn->PluginWindowProc))
+ if (NotifyEventHooks(hEventNotify, (WPARAM)ppdIn->lchContact, (LPARAM)ppdIn->PluginWindowProc))
return 0;
- POPUPDATA2 ppdFixed = {0};
+ POPUPDATA2 ppdFixed = { 0 };
POPUPDATA2 *ppd = &ppdFixed;
memcpy(ppd, ppdIn, min(ppdIn->cbSize, sizeof(POPUPDATA2)));
DWORD disableWhen;
FillNotificationData(ppd, &disableWhen);
- if ( !(lParam & APF_NO_HISTORY))
+ if (!(lParam & APF_NO_HISTORY))
PopupHistoryAdd(ppd);
- if ( PopupThreadIsFull())
+ if (PopupThreadIsFull())
return -1;
- if ( IsWorkstationLocked())
+ if (IsWorkstationLocked())
return -1;
// Check if contact handle is valid.
@@ -156,7 +156,7 @@ INT_PTR Popup_AddPopup2(WPARAM wParam, LPARAM lParam)
if (lParam & APF_CUSTOM_POPUP)
ppd->flags |= PU2_CUSTOM_POPUP;
-
+
PopupWnd2 *wnd = new PopupWnd2(ppd, NULL, false);
if (lParam & APF_RETURN_HWND) {
while (!wnd->m_bWindowCreated) Sleep(1);
@@ -167,7 +167,7 @@ INT_PTR Popup_AddPopup2(WPARAM wParam, LPARAM lParam)
}
//===== Popup/GetContact
-INT_PTR Popup_GetContact(WPARAM wParam, LPARAM lParam)
+INT_PTR Popup_GetContact(WPARAM wParam, LPARAM)
{
if (!gbPopupLoaded) return -1;
@@ -178,7 +178,7 @@ INT_PTR Popup_GetContact(WPARAM wParam, LPARAM lParam)
}
//===== Popup/GetPluginData
-INT_PTR Popup_GetPluginData(WPARAM wParam, LPARAM lParam)
+INT_PTR Popup_GetPluginData(WPARAM wParam, LPARAM)
{
if (!gbPopupLoaded || !wParam)
return -1;
@@ -234,36 +234,36 @@ INT_PTR Popup_ShowMessageW(WPARAM wParam, LPARAM lParam)
if (!gbPopupLoaded || !wParam || !lParam) return -1;
if (closing) return 0;
- POPUPDATA2 ppd2 = {0};
- ppd2.cbSize = sizeof(ppd2);
- ppd2.flags = PU2_UNICODE;
- ppd2.lptzText = (TCHAR*)wParam;
- switch (lParam&0x7fffffff) {
+ POPUPDATA2 ppd2 = { 0 };
+ ppd2.cbSize = sizeof(ppd2);
+ ppd2.flags = PU2_UNICODE;
+ ppd2.lptzText = (TCHAR*)wParam;
+ switch (lParam & 0x7fffffff) {
case SM_ERROR:
- ppd2.lchIcon = IcoLib_GetIcon(ICO_MISC_ERROR,0);
- ppd2.colorBack = RGB(191,0,0);
- ppd2.colorText = RGB(255,245,225);
- ppd2.lchNotification = g_hntfError;
- ppd2.lptzTitle = TranslateT("Error");
+ ppd2.lchIcon = IcoLib_GetIcon(ICO_MISC_ERROR, 0);
+ ppd2.colorBack = RGB(191, 0, 0);
+ ppd2.colorText = RGB(255, 245, 225);
+ ppd2.lchNotification = g_hntfError;
+ ppd2.lptzTitle = TranslateT("Error");
break;
case SM_WARNING:
- ppd2.lchIcon = IcoLib_GetIcon(ICO_MISC_WARNING,0);
- ppd2.colorBack = RGB(210,210,150);
- ppd2.colorText = RGB(0,0,0);
- ppd2.lchNotification = g_hntfWarning;
- ppd2.lptzTitle = TranslateT("Warning");
+ ppd2.lchIcon = IcoLib_GetIcon(ICO_MISC_WARNING, 0);
+ ppd2.colorBack = RGB(210, 210, 150);
+ ppd2.colorText = RGB(0, 0, 0);
+ ppd2.lchNotification = g_hntfWarning;
+ ppd2.lptzTitle = TranslateT("Warning");
break;
case SM_NOTIFY:
- ppd2.lchIcon = IcoLib_GetIcon(ICO_MISC_NOTIFY,0);
- ppd2.colorBack = RGB(230,230,230);
- ppd2.colorText = RGB(0,0,0);
- ppd2.lchNotification = g_hntfNotification;
- ppd2.lptzTitle = TranslateT("Notify");
+ ppd2.lchIcon = IcoLib_GetIcon(ICO_MISC_NOTIFY, 0);
+ ppd2.colorBack = RGB(230, 230, 230);
+ ppd2.colorText = RGB(0, 0, 0);
+ ppd2.lchNotification = g_hntfNotification;
+ ppd2.lptzTitle = TranslateT("Notify");
break;
default: // No no no... you must give me a good value.
return -1;
}
- return Popup_AddPopup2((WPARAM)&ppd2, (LPARAM)((lParam & 0x80000000)?APF_NO_HISTORY:0));
+ return Popup_AddPopup2((WPARAM)&ppd2, (LPARAM)((lParam & 0x80000000) ? APF_NO_HISTORY : 0));
}
INT_PTR Popup_ShowMessage(WPARAM wParam, LPARAM lParam)
@@ -284,26 +284,25 @@ INT_PTR Popup_Query(WPARAM wParam, LPARAM)
return 0;
switch (wParam) {
- case PUQS_ENABLEPOPUPS: {
- if (PopupOptions.ModuleIsEnabled) return 1; // They're already ON!!!
- else { // Module was disabled.
- svcEnableDisableMenuCommand(0,0);
- return 0;
- }
+ case PUQS_ENABLEPOPUPS: {
+ if (PopupOptions.ModuleIsEnabled) return 1; // They're already ON!!!
+ else { // Module was disabled.
+ svcEnableDisableMenuCommand(0, 0);
+ return 0;
}
- case PUQS_DISABLEPOPUPS: {
- if (!(PopupOptions.ModuleIsEnabled)) return 1; // They're already OFF!!!
- else {
- svcEnableDisableMenuCommand(0,0);
- return 0;
- }
+ }
+ case PUQS_DISABLEPOPUPS: {
+ if (!(PopupOptions.ModuleIsEnabled)) return 1; // They're already OFF!!!
+ else {
+ svcEnableDisableMenuCommand(0, 0);
+ return 0;
}
- case PUQS_GETSTATUS:
- return (PopupOptions.ModuleIsEnabled);
- default:
- return -1;
}
- return 0;
+ case PUQS_GETSTATUS:
+ return (PopupOptions.ModuleIsEnabled);
+ default:
+ return -1;
+ }
}
@@ -311,7 +310,7 @@ INT_PTR Popup_Query(WPARAM wParam, LPARAM)
INT_PTR Popup_RegisterActions(WPARAM wParam, LPARAM lParam)
{
LPPOPUPACTION actions = (LPPOPUPACTION)wParam;
- for (int i=0; i < lParam; ++i)
+ for (int i = 0; i < lParam; ++i)
RegisterAction(&actions[i]);
return 0;
}
@@ -334,7 +333,7 @@ static void CALLBACK SafeUnhookEventFunc(ULONG_PTR dwParam)
{
UnhookEvent(((SafeUnhookEventParam *)dwParam)->hEvent);
PostMessage(((SafeUnhookEventParam *)dwParam)->hwndPopup, UM_POPUPUNHOOKCOMPLETE, 0,
- (LPARAM)((SafeUnhookEventParam *)dwParam)->hEvent);
+ (LPARAM)((SafeUnhookEventParam *)dwParam)->hEvent);
delete (SafeUnhookEventParam *)dwParam;
}
@@ -348,7 +347,7 @@ INT_PTR Popup_UnhookEventAsync(WPARAM wParam, LPARAM lParam)
}
//===== Popup/RegisterVfx (effekt name for drop down box)
-INT_PTR Popup_RegisterVfx(WPARAM wParam, LPARAM lParam)
+INT_PTR Popup_RegisterVfx(WPARAM, LPARAM lParam)
{
OptAdv_RegisterVfx((char *)lParam);
return 0;
@@ -358,16 +357,16 @@ INT_PTR Popup_RegisterVfx(WPARAM wParam, LPARAM lParam)
INT_PTR Popup_RegisterPopupClass(WPARAM, LPARAM lParam)
{
char setting[256];
- POPUPCLASS *pc = (POPUPCLASS *)lParam;
+ POPUPCLASS *pc = (POPUPCLASS *)lParam;
POPUPTREEDATA *ptd = (POPUPTREEDATA *)mir_calloc(sizeof(POPUPTREEDATA));
ptd->cbSize = sizeof(POPUPTREEDATA);
- ptd->signature = 0/*PopupNotificationData_SIGNATURE*/;
- ptd->typ = 2;
+ ptd->signature = 0/*PopupNotificationData_SIGNATURE*/;
+ ptd->typ = 2;
memcpy(&ptd->pupClass, pc, sizeof(POPUPCLASS));
ptd->pszTreeRoot = mir_a2t(pc->pszName);
ptd->pupClass.pszName = mir_strdup(pc->pszName);
if (pc->flags & PCF_UNICODE) {
- ptd->pupClass.pwszDescription = mir_wstrdup(pc->pwszDescription);
+ ptd->pupClass.pwszDescription = mir_wstrdup(pc->pwszDescription);
ptd->pszDescription = mir_u2t(pc->pwszDescription);
}
else {
@@ -379,7 +378,7 @@ INT_PTR Popup_RegisterPopupClass(WPARAM, LPARAM lParam)
// we ignore pc->colorText and use fonts.text as default (if no setting found in DB)
mir_snprintf(setting, SIZEOF(setting), "%s/TextCol", ptd->pupClass.pszName);
ptd->pupClass.colorText = (COLORREF)db_get_dw(NULL, PU_MODULCLASS, setting, fonts.clText/*pc->colorText*/);
- FontIDT fid = {0};
+ FontIDT fid = { 0 };
fid.cbSize = sizeof(FontIDT);
mir_sntprintf(fid.group, SIZEOF(fid.group), _T(PU_FNT_AND_COLOR)_T("/%S"), ptd->pupClass.pszName);
strncpy(fid.dbSettingsGroup, PU_MODULCLASS, SIZEOF(fid.dbSettingsGroup));
@@ -390,14 +389,14 @@ INT_PTR Popup_RegisterPopupClass(WPARAM, LPARAM lParam)
_tcsncpy(fid.name, _T(PU_FNT_NAME_TEXT), SIZEOF(fid.name));
strncpy(fid.prefix, setting, SIZEOF(fid.prefix));
mir_snprintf(fid.prefix, SIZEOF(fid.prefix), "%s/Text", ptd->pupClass.pszName); // result is "%s/TextCol"
- fid.deffontsettings.style = 0;
+ fid.deffontsettings.style = 0;
fid.deffontsettings.colour = fonts.clText;
FontRegisterT(&fid);
// we ignore pc->colorBack and use fonts.clBack as default (if no setting found in DB)
mir_snprintf(setting, SIZEOF(setting), "%s/BgCol", ptd->pupClass.pszName);
ptd->pupClass.colorBack = (COLORREF)db_get_dw(NULL, PU_MODULCLASS, setting, (DWORD)fonts.clBack/*pc->colorBack*/);
- ColourIDT cid = {0};
+ ColourIDT cid = { 0 };
cid.cbSize = sizeof(ColourIDT);
mir_sntprintf(cid.group, SIZEOF(cid.group), _T(PU_FNT_AND_COLOR)_T("/%S"), ptd->pupClass.pszName);
strncpy(cid.dbSettingsGroup, PU_MODULCLASS, SIZEOF(fid.dbSettingsGroup));
@@ -417,7 +416,7 @@ INT_PTR Popup_UnregisterPopupClass(WPARAM, LPARAM lParam)
if (ptd == NULL)
return 1;
- for (int i=0; i < gTreeData.getCount(); i++)
+ for (int i = 0; i < gTreeData.getCount(); i++)
if (gTreeData[i] == ptd) {
gTreeData.remove(i);
FreePopupClass(ptd);
@@ -433,7 +432,7 @@ INT_PTR Popup_CreateClassPopup(WPARAM wParam, LPARAM lParam) {
POPUPDATACLASS *pdc = (POPUPDATACLASS *)lParam;
if (pdc->cbSize != sizeof(POPUPDATACLASS)) return ret;
- POPUPCLASS *pc = NULL;
+ POPUPCLASS *pc = NULL;
if (wParam)
pc = (POPUPCLASS*)wParam;
@@ -449,7 +448,7 @@ INT_PTR Popup_CreateClassPopup(WPARAM wParam, LPARAM lParam) {
ppd2.colorText = pc->colorText;
ppd2.lchIcon = pc->hIcon;
ppd2.iSeconds = pc->iSeconds;
- ppd2.PluginWindowProc= pc->PluginWindowProc;
+ ppd2.PluginWindowProc = pc->PluginWindowProc;
if (pc->flags & PCF_UNICODE) {
ppd2.flags = PU2_UNICODE;
ppd2.lptzTitle = (TCHAR*)pdc->ptszTitle;
@@ -465,5 +464,5 @@ INT_PTR Popup_CreateClassPopup(WPARAM wParam, LPARAM lParam) {
return Popup_AddPopup2((WPARAM)&ppd2, pc->lParam);
}
- return ret!=0 ? 1 : 0;
+ return ret != 0 ? 1 : 0;
}