From b3ded48d866f59df3c9e8634eabe6e62596ad2d5 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Sun, 21 Dec 2014 08:17:45 +0000 Subject: Popup: changed warning level to w4 git-svn-id: http://svn.miranda-ng.org/main/trunk@11550 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Popup/Popup_12.vcxproj | 8 +- plugins/Popup/src/actions.cpp | 52 +-- plugins/Popup/src/actions.h | 6 +- plugins/Popup/src/avatars.cpp | 18 +- plugins/Popup/src/avatars.h | 10 +- plugins/Popup/src/avatars_flash.h | 8 +- plugins/Popup/src/avatars_gif.cpp | 19 +- plugins/Popup/src/avatars_gif.h | 8 +- plugins/Popup/src/avatars_simple.cpp | 19 +- plugins/Popup/src/avatars_simple.h | 8 +- plugins/Popup/src/bitmap_funcs.cpp | 28 +- plugins/Popup/src/bitmap_funcs.h | 20 +- plugins/Popup/src/common.h | 40 +-- plugins/Popup/src/config.cpp | 64 ++-- plugins/Popup/src/config.h | 16 +- plugins/Popup/src/def_settings.h | 134 +++---- plugins/Popup/src/defs.h | 26 +- plugins/Popup/src/effects.cpp | 22 +- plugins/Popup/src/effects.h | 6 +- plugins/Popup/src/font.cpp | 24 +- plugins/Popup/src/font.h | 6 +- plugins/Popup/src/formula.cpp | 181 +++++----- plugins/Popup/src/formula.h | 28 +- plugins/Popup/src/headers.h | 10 +- plugins/Popup/src/history.cpp | 270 +++++++-------- plugins/Popup/src/history.h | 6 +- plugins/Popup/src/icons.cpp | 56 +-- plugins/Popup/src/icons.h | 8 +- plugins/Popup/src/main.cpp | 70 ++-- plugins/Popup/src/notifications.cpp | 92 ++--- plugins/Popup/src/notifications.h | 6 +- plugins/Popup/src/opt_adv.cpp | 4 +- plugins/Popup/src/opt_class.cpp | 10 +- plugins/Popup/src/opt_contacts.cpp | 4 +- plugins/Popup/src/opt_gen.cpp | 2 +- plugins/Popup/src/opt_skins.cpp | 6 +- plugins/Popup/src/opttree.cpp | 4 +- plugins/Popup/src/popup_gdiplus.cpp | 135 ++++---- plugins/Popup/src/popup_gdiplus.h | 8 +- plugins/Popup/src/popup_thread.cpp | 56 +-- plugins/Popup/src/popup_thread.h | 6 +- plugins/Popup/src/popup_wnd2.cpp | 653 ++++++++++++++++++----------------- plugins/Popup/src/popup_wnd2.h | 30 +- plugins/Popup/src/services.cpp | 127 ++++--- plugins/Popup/src/services.h | 6 +- plugins/Popup/src/skin.cpp | 157 +++++---- plugins/Popup/src/skin.h | 54 +-- plugins/Popup/src/srmm_menu.cpp | 32 +- plugins/Popup/src/srmm_menu.h | 6 +- 49 files changed, 1288 insertions(+), 1281 deletions(-) (limited to 'plugins') diff --git a/plugins/Popup/Popup_12.vcxproj b/plugins/Popup/Popup_12.vcxproj index a77d36f0b3..09fa383f4b 100644 --- a/plugins/Popup/Popup_12.vcxproj +++ b/plugins/Popup/Popup_12.vcxproj @@ -81,7 +81,7 @@ MultiThreadedDebugDLL Use headers.h - Level3 + Level4 EditAndContinue @@ -107,7 +107,7 @@ MultiThreadedDebugDLL Use headers.h - Level3 + Level4 _DEBUG;%(PreprocessorDefinitions) @@ -133,7 +133,7 @@ true Use headers.h - Level3 + Level4 Size @@ -162,7 +162,7 @@ true Use headers.h - Level3 + Level4 Size diff --git a/plugins/Popup/src/actions.cpp b/plugins/Popup/src/actions.cpp index 175bd9f062..5ad36cc6c2 100644 --- a/plugins/Popup/src/actions.cpp +++ b/plugins/Popup/src/actions.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 @@ -35,21 +35,21 @@ void LoadActions() { POPUPACTION actions[] = { - { sizeof(POPUPACTION), IcoLib_GetIcon(ICO_ACT_REPLY, 0), "General/Quick reply", 0}, - { sizeof(POPUPACTION), IcoLib_GetIcon(ICO_ACT_MESS, 0), "General/Send message", 0}, - { sizeof(POPUPACTION), IcoLib_GetIcon(ICO_ACT_INFO, 0), "General/User details", 0}, - { sizeof(POPUPACTION), IcoLib_GetIcon(ICO_ACT_MENU, 0), "General/Contact menu", 0}, - { sizeof(POPUPACTION), IcoLib_GetIcon(ICO_ACT_ADD, 0), "General/Add permanently", 0}, - { sizeof(POPUPACTION), IcoLib_GetIcon(ICO_ACT_PIN, 0), "General/Pin popup", 0}, - { sizeof(POPUPACTION), IcoLib_GetIcon(ICO_ACT_CLOSE, 0), "General/Dismiss popup", 0}, - { sizeof(POPUPACTION), IcoLib_GetIcon(ICO_ACT_COPY, 0), "General/Copy to clipboard", 0}, + { sizeof(POPUPACTION), IcoLib_GetIcon(ICO_ACT_REPLY, 0), "General/Quick reply", 0 }, + { sizeof(POPUPACTION), IcoLib_GetIcon(ICO_ACT_MESS, 0), "General/Send message", 0 }, + { sizeof(POPUPACTION), IcoLib_GetIcon(ICO_ACT_INFO, 0), "General/User details", 0 }, + { sizeof(POPUPACTION), IcoLib_GetIcon(ICO_ACT_MENU, 0), "General/Contact menu", 0 }, + { sizeof(POPUPACTION), IcoLib_GetIcon(ICO_ACT_ADD, 0), "General/Add permanently", 0 }, + { sizeof(POPUPACTION), IcoLib_GetIcon(ICO_ACT_PIN, 0), "General/Pin popup", 0 }, + { sizeof(POPUPACTION), IcoLib_GetIcon(ICO_ACT_CLOSE, 0), "General/Dismiss popup", 0 }, + { sizeof(POPUPACTION), IcoLib_GetIcon(ICO_ACT_COPY, 0), "General/Copy to clipboard", 0 }, // remove popup action - #if defined(_DEBUG) +#if defined(_DEBUG) { sizeof(POPUPACTION), IcoLib_GetIcon(ICO_POPUP_ON, 0), "Popup Plus/Test action", PAF_ENABLED}, { sizeof(POPUPACTION), IcoLib_GetIcon(ICO_ACT_CLOSE, 0), "Popup Plus/Second test action", 0}, { sizeof(POPUPACTION), LoadSkinnedIcon(SKINICON_OTHER_MIRANDA), "Popup Plus/One more action", PAF_ENABLED}, - #endif +#endif }; for (int i = 0; i < SIZEOF(actions); ++i) @@ -94,7 +94,7 @@ bool IsActionEnabled(POPUPACTION *action) bool IsActionEnabled(char *name) { - POPUPACTION action = {0}; + POPUPACTION action = { 0 }; action.flags = PAF_ENABLED; mir_strcpy(action.lpzTitle, name); return IsActionEnabled(&action); @@ -144,13 +144,13 @@ DWORD MouseOverride(HWND hCombo, int number) // options void LoadOption_Actions() { - PopupOptions.actions = db_get_dw(NULL, MODULNAME, "Actions", - ACT_ENABLE | ACT_RIGHTICONS | ACT_DEF_KEEPWND | ACT_DEF_IMONLY | - ACT_DEF_NOGLOBAL | ACT_DEF_MESSAGE | ACT_DEF_DETAILS | ACT_DEF_MENU | - ACT_DEF_ADD | ACT_DEF_DISMISS | ACT_DEF_PIN); - PopupOptions.overrideLeft = db_get_dw(NULL,MODULNAME, "OverrideLeft", 0); - PopupOptions.overrideMiddle = db_get_dw(NULL,MODULNAME, "OverrideMiddle", 0); - PopupOptions.overrideRight = db_get_dw(NULL,MODULNAME, "OverrideRight", 0); + PopupOptions.actions = db_get_dw(NULL, MODULNAME, "Actions", + ACT_ENABLE | ACT_RIGHTICONS | ACT_DEF_KEEPWND | ACT_DEF_IMONLY | + ACT_DEF_NOGLOBAL | ACT_DEF_MESSAGE | ACT_DEF_DETAILS | ACT_DEF_MENU | + ACT_DEF_ADD | ACT_DEF_DISMISS | ACT_DEF_PIN); + PopupOptions.overrideLeft = db_get_dw(NULL, MODULNAME, "OverrideLeft", 0); + PopupOptions.overrideMiddle = db_get_dw(NULL, MODULNAME, "OverrideMiddle", 0); + PopupOptions.overrideRight = db_get_dw(NULL, MODULNAME, "OverrideRight", 0); } static UINT controls[] = @@ -220,7 +220,7 @@ INT_PTR CALLBACK DlgProcPopupActions(HWND hwnd, UINT msg, WPARAM wParam, LPARAM HIMAGELIST hImgList = ImageList_Create(16, 16, ILC_MASK | ILC_COLOR32, 10, 1); ListView_SetImageList(hwndList, hImgList, LVSIL_SMALL); - LVCOLUMN column = {0}; + LVCOLUMN column = { 0 }; column.mask = LVCF_TEXT | LVCF_WIDTH; column.pszText = TranslateT("Action"); column.cx = 175; @@ -241,19 +241,19 @@ INT_PTR CALLBACK DlgProcPopupActions(HWND hwnd, UINT msg, WPARAM wParam, LPARAM if ((grpId = groups.getIndex(szGroup)) < 0) { - LVGROUP group = {0}; + LVGROUP group = { 0 }; group.cbSize = sizeof(group); group.mask = LVGF_HEADER | LVGF_GROUPID; LPTSTR wszGroup = mir_a2t(szGroup); group.pszHeader = TranslateTS(wszGroup); group.cchHeader = (int)mir_tstrlen(wszGroup); grpId = group.iGroupId = groups.getCount(); - int grpId = ListView_InsertGroup(hwndList, -1, &group); + ListView_InsertGroup(hwndList, -1, &group); mir_free(wszGroup); groups.insert(mir_strdup(szGroup), groups.getCount()); } - LVITEM item = {0}; + LVITEM item = { 0 }; item.mask = LVIF_IMAGE | LVIF_PARAM | LVIF_TEXT | LVIF_STATE | LVIF_INDENT; item.iItem = i; ptrT tszName(mir_a2t(szName)); @@ -362,7 +362,7 @@ INT_PTR CALLBACK DlgProcPopupActions(HWND hwnd, UINT msg, WPARAM wParam, LPARAM db_set_dw(NULL, MODULNAME, "OverrideMiddle", PopupOptions.overrideMiddle); db_set_dw(NULL, MODULNAME, "OverrideRight", PopupOptions.overrideRight); } - break; + break; case IDC_ACTIONS: NMLISTVIEW *nmlv = (NMLISTVIEW *)lParam; diff --git a/plugins/Popup/src/actions.h b/plugins/Popup/src/actions.h index 9d6393eb4c..78e1a14a1d 100644 --- a/plugins/Popup/src/actions.h +++ b/plugins/Popup/src/actions.h @@ -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 diff --git a/plugins/Popup/src/avatars.cpp b/plugins/Popup/src/avatars.cpp index 67637b4e6b..094fc26cd8 100644 --- a/plugins/Popup/src/avatars.cpp +++ b/plugins/Popup/src/avatars.cpp @@ -1,10 +1,10 @@ /* Popup Plus plugin for Miranda IM -Copyright � 2002 Luca Santarelli, - � 2004-2007 Victor Pavlychko - � 2010 MPK - � 2010 Merlin_de +Copyright © 2002 Luca Santarelli, +© 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 @@ -30,16 +30,16 @@ PopupAvatar *PopupAvatar::create(MCONTACT hContact) if (ServiceExists(MS_AV_GETAVATARBITMAP)) { avatarCacheEntry *av = (avatarCacheEntry *)CallService(MS_AV_GETAVATARBITMAP, hContact, 0); -// MessageBox(NULL, _T("00"), _T(MODULNAME_LONG), MB_OK); + // MessageBox(NULL, _T("00"), _T(MODULNAME_LONG), MB_OK); if (av && (_tcslen(av->szFilename) > 4)) { -// MessageBox(NULL, _T("01"), _T(MODULNAME_LONG), MB_OK); - if (!_tcsicmp(av->szFilename+_tcslen(av->szFilename)-4, _T(".gif"))) + // MessageBox(NULL, _T("01"), _T(MODULNAME_LONG), MB_OK); + if (!_tcsicmp(av->szFilename + _tcslen(av->szFilename) - 4, _T(".gif"))) { -// MessageBox(NULL, _T("02"), _T(MODULNAME_LONG), MB_OK); + // MessageBox(NULL, _T("02"), _T(MODULNAME_LONG), MB_OK); if (db_get_b(NULL, MODULNAME, "EnableGifAnimation", 1) && GDIPlus_IsAnimatedGIF(av->szFilename)) { -// MessageBox(NULL, _T("03"), _T(MODULNAME_LONG), MB_OK); + // MessageBox(NULL, _T("03"), _T(MODULNAME_LONG), MB_OK); return new GifAvatar(hContact); } } diff --git a/plugins/Popup/src/avatars.h b/plugins/Popup/src/avatars.h index 9621bd13e9..f2a6492fb5 100644 --- a/plugins/Popup/src/avatars.h +++ b/plugins/Popup/src/avatars.h @@ -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 @@ -31,7 +31,7 @@ protected: bool bIsAnimated, bIsValid; public: - PopupAvatar(HANDLE h) {} + PopupAvatar() {} virtual ~PopupAvatar() {} virtual int activeFrameDelay() = 0; virtual void draw(MyBitmap *bmp, int x, int y, int w, int h, POPUPOPTIONS *options) = 0; @@ -41,7 +41,7 @@ public: inline bool isAnimated() { return bIsAnimated; } inline int getWidth() { return width; } inline int getHeight() { return height; } - + static PopupAvatar *create(MCONTACT hContact); }; diff --git a/plugins/Popup/src/avatars_flash.h b/plugins/Popup/src/avatars_flash.h index 351491f65a..7868e2c5cc 100644 --- a/plugins/Popup/src/avatars_flash.h +++ b/plugins/Popup/src/avatars_flash.h @@ -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 @@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef __avatars_flash_h__ #define __avatars_flash_h__ -class FlashAvatar: public PopupAvatar +class FlashAvatar : public PopupAvatar { public: FlashAvatar(MCONTACT hContact); diff --git a/plugins/Popup/src/avatars_gif.cpp b/plugins/Popup/src/avatars_gif.cpp index 6e55e7d60e..3a37a16612 100644 --- a/plugins/Popup/src/avatars_gif.cpp +++ b/plugins/Popup/src/avatars_gif.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 @@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "headers.h" -GifAvatar::GifAvatar(MCONTACT hContact): PopupAvatar((HANDLE)hContact) +GifAvatar::GifAvatar(MCONTACT hContact) : PopupAvatar() { av = (avatarCacheEntry *)CallService(MS_AV_GETAVATARBITMAP, hContact, 0); bIsAnimated = true; @@ -77,11 +77,12 @@ void GifAvatar::draw(MyBitmap *bmp, int x, int y, int w, int h, POPUPOPTIONS *op HRGN rgn; if (options->avatarRadius) { - rgn = CreateRoundRectRgn(x, y, x+w, y+h, 2 * options->avatarRadius, 2 * options->avatarRadius); + rgn = CreateRoundRectRgn(x, y, x + w, y + h, 2 * options->avatarRadius, 2 * options->avatarRadius); SelectClipRgn(bmp->getDC(), rgn); - } else + } + else { - rgn = CreateRectRgn(x, y, x+w, y+h); + rgn = CreateRectRgn(x, y, x + w, y + h); } HDC hdcTmp = CreateCompatibleDC(bmp->getDC()); @@ -102,7 +103,7 @@ void GifAvatar::draw(MyBitmap *bmp, int x, int y, int w, int h, POPUPOPTIONS *op { HBRUSH hbr = CreateSolidBrush(fonts.clAvatarBorder); bmp->saveAlpha(x, y, w, h); - FrameRgn(bmp->getDC(), rgn, hbr, 1, 1); + FrameRgn(bmp->getDC(), rgn, hbr, 1, 1); DeleteObject(hbr); bmp->restoreAlpha(x, y, w, h); } @@ -112,7 +113,7 @@ void GifAvatar::draw(MyBitmap *bmp, int x, int y, int w, int h, POPUPOPTIONS *op StretchBlt(bmp->getDC(), x, y, w, h, hdcTmp, frameSize.cx*activeFrame, 0, frameSize.cx, frameSize.cy, SRCCOPY); if (options->avatarBorders) { HBRUSH hbr = CreateSolidBrush(fonts.clAvatarBorder); - FrameRgn(bmp->getDC(), rgn, hbr, 1, 1); + FrameRgn(bmp->getDC(), rgn, hbr, 1, 1); DeleteObject(hbr); } bmp->restoreAlpha(x, y, w, h); diff --git a/plugins/Popup/src/avatars_gif.h b/plugins/Popup/src/avatars_gif.h index e05a89c504..eca4c186c8 100644 --- a/plugins/Popup/src/avatars_gif.h +++ b/plugins/Popup/src/avatars_gif.h @@ -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 @@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef __avatars_gif_h__ #define __avatars_gif_h__ -class GifAvatar: public PopupAvatar +class GifAvatar : public PopupAvatar { protected: avatarCacheEntry *av; diff --git a/plugins/Popup/src/avatars_simple.cpp b/plugins/Popup/src/avatars_simple.cpp index 86c9b6dd15..ab5edadbf6 100644 --- a/plugins/Popup/src/avatars_simple.cpp +++ b/plugins/Popup/src/avatars_simple.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 @@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "headers.h" SimpleAvatar::SimpleAvatar(HANDLE h, bool bUseBitmap) : - PopupAvatar((bUseBitmap) ? 0 : h) +PopupAvatar() { bIsAnimated = false; bIsValid = true; @@ -85,11 +85,12 @@ void SimpleAvatar::draw(MyBitmap *bmp, int x, int y, int w, int h, POPUPOPTIONS HRGN rgn; if (options->avatarRadius) { - rgn = CreateRoundRectRgn(x, y, x+w, y+h, 2 * options->avatarRadius, 2 * options->avatarRadius); + rgn = CreateRoundRectRgn(x, y, x + w, y + h, 2 * options->avatarRadius, 2 * options->avatarRadius); SelectClipRgn(bmp->getDC(), rgn); - } else + } + else { - rgn = CreateRectRgn(x, y, x+w, y+h); + rgn = CreateRectRgn(x, y, x + w, y + h); } HDC hdcTmp = CreateCompatibleDC(bmp->getDC()); @@ -110,7 +111,7 @@ void SimpleAvatar::draw(MyBitmap *bmp, int x, int y, int w, int h, POPUPOPTIONS { HBRUSH hbr = CreateSolidBrush(fonts.clAvatarBorder); bmp->saveAlpha(x, y, w, h); - FrameRgn(bmp->getDC(), rgn, hbr, 1, 1); + FrameRgn(bmp->getDC(), rgn, hbr, 1, 1); DeleteObject(hbr); bmp->restoreAlpha(x, y, w, h); } @@ -120,7 +121,7 @@ void SimpleAvatar::draw(MyBitmap *bmp, int x, int y, int w, int h, POPUPOPTIONS StretchBlt(bmp->getDC(), x, y, w, h, hdcTmp, 0, 0, av->bmWidth, av->bmHeight, SRCCOPY); if (options->avatarBorders){ HBRUSH hbr = CreateSolidBrush(fonts.clAvatarBorder); - FrameRgn(bmp->getDC(), rgn, hbr, 1, 1); + FrameRgn(bmp->getDC(), rgn, hbr, 1, 1); DeleteObject(hbr); } bmp->restoreAlpha(x, y, w, h); diff --git a/plugins/Popup/src/avatars_simple.h b/plugins/Popup/src/avatars_simple.h index 25ae0e702a..0479674cd4 100644 --- a/plugins/Popup/src/avatars_simple.h +++ b/plugins/Popup/src/avatars_simple.h @@ -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 @@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef __avatars_simple_h__ #define __avatars_simple_h__ -class SimpleAvatar: public PopupAvatar +class SimpleAvatar : public PopupAvatar { private: avatarCacheEntry *av; diff --git a/plugins/Popup/src/bitmap_funcs.cpp b/plugins/Popup/src/bitmap_funcs.cpp index cd551905aa..f88668d7ee 100644 --- a/plugins/Popup/src/bitmap_funcs.cpp +++ b/plugins/Popup/src/bitmap_funcs.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 @@ -88,8 +88,8 @@ void MyBitmap::makeOpaqueRect(int x1, int y1, int x2, int y2) GdiFlush(); for (int i = y1; i < y2; i++) for (int j = x1; j < x2; j++) { - int idx = i * width + j; - bits[idx] |= 0xff000000; + int idx = i * width + j; + bits[idx] |= 0xff000000; } } @@ -518,7 +518,7 @@ void MyBitmap::DrawPart(MyBitmap *bmp, int xin, int yin, int win, int hin, int x } } -void MyBitmap::DrawNoAlpha(MyBitmap *bmp, int x, int y, int w, int h) +void MyBitmap::DrawNoAlpha(MyBitmap *bmp, int x, int y) { if (!(bits && bmp && bmp->bits)) return; @@ -676,7 +676,7 @@ static int hex2dec(char hex) return 0; } -bool MyBitmap::loadFromFile_pixel(const TCHAR *fn, const TCHAR *fnAlpha) +bool MyBitmap::loadFromFile_pixel(const TCHAR *fn) { allocate(1, 1); int r, g, b, a = 255; @@ -688,7 +688,7 @@ bool MyBitmap::loadFromFile_pixel(const TCHAR *fn, const TCHAR *fnAlpha) return true; } -bool MyBitmap::loadFromFile_gradient(const TCHAR *fn, const TCHAR *fnAlpha) +bool MyBitmap::loadFromFile_gradient(const TCHAR *fn) { const TCHAR *p = fn + mir_tstrlen(_T("gradient:")); @@ -720,7 +720,7 @@ bool MyBitmap::loadFromFile_gradient(const TCHAR *fn, const TCHAR *fnAlpha) return true; } -bool MyBitmap::loadFromFile_png(const TCHAR *fn, const TCHAR *fnAlpha) +bool MyBitmap::loadFromFile_png(const TCHAR *fn) { if (!ServiceExists(MS_PNG2DIB)) return false; @@ -728,8 +728,8 @@ bool MyBitmap::loadFromFile_png(const TCHAR *fn, const TCHAR *fnAlpha) HANDLE hFile, hMap = 0; BYTE *ppMap = 0; long cbFileSize = 0; - BITMAPINFOHEADER *pDib; - BYTE *pDibBits; + BITMAPINFOHEADER *pDib = 0; + BYTE *pDibBits = 0; if ((hFile = CreateFile(fn, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL)) != INVALID_HANDLE_VALUE) if ((hMap = CreateFileMapping(hFile, NULL, PAGE_READONLY, 0, 0, NULL)) != NULL) if ((ppMap = (BYTE*)MapViewOfFile(hMap, FILE_MAP_READ, 0, 0, 0)) != NULL) @@ -826,15 +826,15 @@ bool MyBitmap::loadFromFile(const TCHAR *fn, const TCHAR *fnAlpha) if (bits) freemem(); if (!_tcsncmp(fn, _T("pixel:"), mir_tstrlen(_T("pixel:")))) - return loadFromFile_pixel(fn, fnAlpha); + return loadFromFile_pixel(fn); if (!_tcsncmp(fn, _T("gradient:"), mir_tstrlen(_T("gradient:")))) - return loadFromFile_gradient(fn, fnAlpha); + return loadFromFile_gradient(fn); TCHAR ext[5]; _tcsncpy_s(ext, fn + (_tcslen(fn) - 4), _TRUNCATE); if (!mir_tstrcmpi(ext, _T(".png"))) - return loadFromFile_png(fn, fnAlpha); + return loadFromFile_png(fn); return loadFromFile_default(fn, fnAlpha); } diff --git a/plugins/Popup/src/bitmap_funcs.h b/plugins/Popup/src/bitmap_funcs.h index 75af1de6d0..6840e8f89e 100644 --- a/plugins/Popup/src/bitmap_funcs.h +++ b/plugins/Popup/src/bitmap_funcs.h @@ -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 @@ -43,9 +43,9 @@ private: void freemem(); - bool loadFromFile_pixel(const TCHAR *fn, const TCHAR *fnAlpha = 0); - bool loadFromFile_gradient(const TCHAR *fn, const TCHAR *fnAlpha = 0); - bool loadFromFile_png(const TCHAR *fn, const TCHAR *fnAlpha = 0); + bool loadFromFile_pixel(const TCHAR *fn); + bool loadFromFile_gradient(const TCHAR *fn); + bool loadFromFile_png(const TCHAR *fn); bool loadFromFile_default(const TCHAR *fn, const TCHAR *fnAlpha = 0); void premultipleChannels(); @@ -66,7 +66,7 @@ public: void makeOpaque(); void makeOpaqueRect(int x1, int y1, int x2, int y2); - void makeOpaqueRect(RECT rc) { makeOpaqueRect(rc.left, rc.top, rc.right, rc.bottom); } + void makeOpaqueRect(RECT rc) { makeOpaqueRect(rc.left, rc.top, rc.right, rc.bottom); } void saveAlpha(int x = 0, int y = 0, int w = 0, int h = 0); void restoreAlpha(int x = 0, int y = 0, int w = 0, int h = 0); @@ -74,7 +74,7 @@ public: void DrawBits(COLOR32 *inbits, int inw, int inh, int x, int y, int w, int h); void BlendBits(COLOR32 *inbits, int inw, int inh, int x, int y, int w, int h); - void DrawNoAlpha(MyBitmap *bmp, int x, int y, int w, int h); + void DrawNoAlpha(MyBitmap *bmp, int x, int y); void Blend(MyBitmap *bmp, int x, int y, int w, int h); void Draw(MyBitmap *bmp, int x, int y, int w, int h); @@ -85,8 +85,8 @@ public: void BlendPart(MyBitmap *bmp, int xin, int yin, int win, int hin, int x, int y, int w, int h); void BlendPartColorized(MyBitmap *bmp, int xin, int yin, int win, int hin, int x, int y, int w, int h, COLOR32 color); void DrawPart(MyBitmap *bmp, int xin, int yin, int win, int hin, int x, int y, int w, int h); -// void DrawPartNoAlpha(MyBitmap *bmp, int x, int y, int w, int h); -// void DrawPartColorized(MyBitmap *bmp, int x, int y, int w, int h, COLOR32 color); + // void DrawPartNoAlpha(MyBitmap *bmp, int x, int y, int w, int h); + // void DrawPartColorized(MyBitmap *bmp, int x, int y, int w, int h, COLOR32 color); void DrawIcon(HICON hic, int x, int y, int w = 0, int h = 0); void Draw_Text(TCHAR *str, int x, int y); diff --git a/plugins/Popup/src/common.h b/plugins/Popup/src/common.h index aa8fb83bc5..6f0f1b8ab2 100644 --- a/plugins/Popup/src/common.h +++ b/plugins/Popup/src/common.h @@ -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 @@ -47,8 +47,8 @@ inline void DebugMsg(LPTSTR msg){ } //===== Percentile to Byte and viceversa ===== -inline int Byte2Percentile(int vByte) { return (vByte*100)/255; } -inline int Percentile2Byte(int vPerc) { return (vPerc*255)/100; } +inline int Byte2Percentile(int vByte) { return (vByte * 100) / 255; } +inline int Percentile2Byte(int vPerc) { return (vPerc * 255) / 100; } //===== Strings & MirandaDB ================== inline char *db_get_s(MCONTACT hContact, const char *ModuleName, const char *SettingName, const char *Default) @@ -73,7 +73,7 @@ inline INT_PTR DBGetContactSettingStringX(MCONTACT hContact, const char *ModuleN DBVARIANT dbv; BOOL result = db_get_s(hContact, ModuleName, SettingName, &dbv, retType); - switch(retType) { + switch (retType) { case DBVT_ASCIIZ: ret = (INT_PTR)mir_strdup(result ? Default : dbv.pszVal); break; @@ -92,24 +92,24 @@ inline INT_PTR DBGetContactSettingStringX(MCONTACT hContact, const char *ModuleN inline void AddTooltipTranslated(HWND hwndToolTip, HWND hwnd, int id, RECT rc, char *text) { - TOOLINFO ti = {0}; - ti.cbSize = sizeof(TOOLINFO); + TOOLINFO ti = { 0 }; + ti.cbSize = sizeof(TOOLINFO); - ti.hwnd = hwnd; - ti.uId = id; - SendMessage(hwndToolTip, TTM_DELTOOL, 0, (LPARAM) (LPTOOLINFO) &ti); + ti.hwnd = hwnd; + ti.uId = id; + SendMessage(hwndToolTip, TTM_DELTOOL, 0, (LPARAM)(LPTOOLINFO)&ti); - LPTSTR wtext = mir_a2t(text); + LPTSTR wtext = mir_a2t(text); - ti.uFlags = TTF_SUBCLASS; - ti.hwnd = hwnd; - ti.uId = id; - ti.hinst = hInst; - ti.lpszText = TranslateTS(wtext); - ti.rect = rc; - SendMessage(hwndToolTip, TTM_ADDTOOL, 0, (LPARAM) (LPTOOLINFO) &ti); + ti.uFlags = TTF_SUBCLASS; + ti.hwnd = hwnd; + ti.uId = id; + ti.hinst = hInst; + ti.lpszText = TranslateTS(wtext); + ti.rect = rc; + SendMessage(hwndToolTip, TTM_ADDTOOL, 0, (LPARAM)(LPTOOLINFO)&ti); - mir_free(wtext); + mir_free(wtext); } diff --git a/plugins/Popup/src/config.cpp b/plugins/Popup/src/config.cpp index c3f5a44151..b0f7004aec 100644 --- a/plugins/Popup/src/config.cpp +++ b/plugins/Popup/src/config.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 @@ -30,9 +30,9 @@ HANDLE hMainThread; HANDLE hSemaphore; BOOL closing = FALSE; -MTEXT_INTERFACE MText = {0}; +MTEXT_INTERFACE MText = { 0 }; HANDLE folderId; -BOOL gbPopupLoaded = FALSE; +BOOL gbPopupLoaded = FALSE; BOOL gbHppInstalled = FALSE; // ===== Brushes, Colours and Fonts ===== @@ -59,20 +59,20 @@ PLUGININFOEX pluginInfoEx = __AUTHORWEB, UNICODE_AWARE, // {26A9125D-7863-4E01-AF0E-D14EF95C5054} - {0x26a9125d, 0x7863, 0x4e01, {0xaf, 0xe, 0xd1, 0x4e, 0xf9, 0x5c, 0x50, 0x54}} + { 0x26a9125d, 0x7863, 0x4e01, { 0xaf, 0xe, 0xd1, 0x4e, 0xf9, 0x5c, 0x50, 0x54 } } }; -HRESULT (WINAPI *MyDwmEnableBlurBehindWindow)(HWND hWnd, DWM_BLURBEHIND *pBlurBehind); +HRESULT(WINAPI *MyDwmEnableBlurBehindWindow)(HWND hWnd, DWM_BLURBEHIND *pBlurBehind); // ====== Common Vars ======================== // common funcs void LoadOptions() { memset(&PopupOptions, 0, sizeof(PopupOptions)); - #if defined(_DEBUG) - PopupOptions.debug = db_get_b(NULL, MODULNAME, "debug", FALSE); - #endif +#if defined(_DEBUG) + PopupOptions.debug = db_get_b(NULL, MODULNAME, "debug", FALSE); +#endif // Load Popup Options if (!OptionLoaded){ @@ -89,43 +89,43 @@ void LoadOptions() { void PopupPreview() { TCHAR *lptzTitle1Eng = TranslateT("The Jabberwocky"); - TCHAR *lptzText1Eng = TranslateT("`Twas brillig, and the slithy toves\r\nDid gyre and gimble in the wabe:\r\nAll mimsy were the borogoves,\r\nAnd the mome raths outgrabe.\r\n\t[b][i]Lewis Carroll, 1855[/i][/b]"); + TCHAR *lptzText1Eng = TranslateT("`Twas brillig, and the slithy toves\r\nDid gyre and gimble in the wabe:\r\nAll mimsy were the borogoves,\r\nAnd the mome raths outgrabe.\r\n\t[b][i]Lewis Carroll, 1855[/i][/b]"); TCHAR *lptzTitle2 = TranslateT("Test preview for the popup plugin settings. This is supposed to be long enough not to fit in one line..."); - TCHAR *lptzText2 = TranslateTS( + TCHAR *lptzText2 = TranslateTS( LPGENT("This is a special test preview for the popup plugin settings. The text and title are quite long so you can tweak your skin and plugin settings to best fit your needs :)") ); - POPUPDATA2 ppd = {0}; + POPUPDATA2 ppd = { 0 }; memset(&ppd, 0, sizeof(ppd)); - ppd.cbSize = sizeof(ppd); - ppd.flags = PU2_TCHAR; + ppd.cbSize = sizeof(ppd); + ppd.flags = PU2_TCHAR; - ppd.lptzTitle = lptzTitle1Eng; - ppd.lptzText = lptzText1Eng; - ppd.lchIcon = LoadSkinnedIcon(SKINICON_EVENT_MESSAGE); + ppd.lptzTitle = lptzTitle1Eng; + ppd.lptzText = lptzText1Eng; + ppd.lchIcon = LoadSkinnedIcon(SKINICON_EVENT_MESSAGE); CallService(MS_POPUP_ADDPOPUP2, (WPARAM)&ppd, APF_NO_HISTORY); - if (PopupOptions.UseAnimations || PopupOptions.UseEffect) Sleep((ANIM_TIME*2)/3); // Pause + if (PopupOptions.UseAnimations || PopupOptions.UseEffect) Sleep((ANIM_TIME * 2) / 3); // Pause memset(&ppd, 0, sizeof(ppd)); - ppd.cbSize = sizeof(ppd); - ppd.flags = PU2_TCHAR; - ppd.lptzTitle = lptzTitle2; - ppd.lptzText = lptzText2; - ppd.lchIcon = LoadSkinnedIcon(SKINICON_OTHER_MIRANDA); - ppd.hbmAvatar = hbmNoAvatar; + ppd.cbSize = sizeof(ppd); + ppd.flags = PU2_TCHAR; + ppd.lptzTitle = lptzTitle2; + ppd.lptzText = lptzText2; + ppd.lchIcon = LoadSkinnedIcon(SKINICON_OTHER_MIRANDA); + ppd.hbmAvatar = hbmNoAvatar; CallService(MS_POPUP_ADDPOPUP2, (WPARAM)&ppd, APF_NO_HISTORY); - if (PopupOptions.UseAnimations || PopupOptions.UseEffect) Sleep((ANIM_TIME*2)/3); // Pause + if (PopupOptions.UseAnimations || PopupOptions.UseEffect) Sleep((ANIM_TIME * 2) / 3); // Pause - PUShowMessageT(TranslateT("This is a notification message"), (DWORD)SM_NOTIFY|0x80000000); - if (PopupOptions.UseAnimations || PopupOptions.UseEffect) Sleep((ANIM_TIME*2)/3); // Pause + PUShowMessageT(TranslateT("This is a notification message"), (DWORD)SM_NOTIFY | 0x80000000); + if (PopupOptions.UseAnimations || PopupOptions.UseEffect) Sleep((ANIM_TIME * 2) / 3); // Pause - PUShowMessageT(TranslateT("This is a warning message"), (DWORD)SM_WARNING|0x80000000); - if (PopupOptions.UseAnimations || PopupOptions.UseEffect) Sleep((ANIM_TIME*2)/3); // Pause + PUShowMessageT(TranslateT("This is a warning message"), (DWORD)SM_WARNING | 0x80000000); + if (PopupOptions.UseAnimations || PopupOptions.UseEffect) Sleep((ANIM_TIME * 2) / 3); // Pause - PUShowMessageT(TranslateT("This is an error message"), (DWORD)SM_ERROR|0x80000000); + PUShowMessageT(TranslateT("This is an error message"), (DWORD)SM_ERROR | 0x80000000); } ////////////////////////////////////////////////////////////////////////////////////////////// @@ -140,7 +140,7 @@ static int EnumProc(const char *szSetting, LPARAM lParam) EnumProcParam* param = (EnumProcParam*)lParam; DBVARIANT dbv; - if ( !db_get(NULL, param->szModule, szSetting, &dbv)) { + if (!db_get(NULL, param->szModule, szSetting, &dbv)) { db_set(NULL, param->szNewModule, szSetting, &dbv); db_free(&dbv); } diff --git a/plugins/Popup/src/config.h b/plugins/Popup/src/config.h index 89b670331c..60af91a679 100644 --- a/plugins/Popup/src/config.h +++ b/plugins/Popup/src/config.h @@ -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 @@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define __config_h__ typedef struct tagPOPUPOPTIONS { -//==Page General==== + //==Page General==== //Timeout BYTE InfiniteDelay; int Seconds; @@ -52,7 +52,7 @@ typedef struct tagPOPUPOPTIONS { BYTE DisableWhenFullscreen; //others BYTE debug; -//==Page Skins==== + //==Page Skins==== LPTSTR SkinPack; BYTE DisplayTime; BYTE DropShadow; @@ -60,13 +60,13 @@ typedef struct tagPOPUPOPTIONS { BYTE EnableAeroGlass; BYTE UseWinColors; BYTE UseMText; -//==Page Actions==== + //==Page Actions==== DWORD actions; //Mouse Override int overrideLeft; int overrideRight; int overrideMiddle; -//==Page Advanced==== + //==Page Advanced==== //History BYTE EnableHistory; WORD HistorySize; @@ -186,7 +186,7 @@ struct DWM_BLURBEHIND BOOL fTransitionOnMaximized; }; -extern HRESULT (WINAPI *MyDwmEnableBlurBehindWindow)(HWND hWnd, DWM_BLURBEHIND *pBlurBehind); +extern HRESULT(WINAPI *MyDwmEnableBlurBehindWindow)(HWND hWnd, DWM_BLURBEHIND *pBlurBehind); typedef struct TestStruct{ int cbSize; diff --git a/plugins/Popup/src/def_settings.h b/plugins/Popup/src/def_settings.h index 2bfc5d7cf1..6e2dd748d4 100644 --- a/plugins/Popup/src/def_settings.h +++ b/plugins/Popup/src/def_settings.h @@ -2,7 +2,7 @@ Popup Plus plugin for Miranda IM Copyright © 2002 Luca Santarelli, - © 2004-2007 Victor Pavlychko +© 2004-2007 Victor Pavlychko This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -36,25 +36,25 @@ enum //===== Sizes ===== enum { - STYLE_SZ_GAP = 4, - STYLE_SZ_TEXTH = 14, - STYLE_SZ_NAMEH = 14, - STYLE_SZ_TIMEW = 35, - STYLE_SZ_TIMEH = 14, + STYLE_SZ_GAP = 4, + STYLE_SZ_TEXTH = 14, + STYLE_SZ_NAMEH = 14, + STYLE_SZ_TIMEW = 35, + STYLE_SZ_TIMEH = 14, -// STYLE_SZ_CLOCKH = 13, -// STYLE_SZ_CLOCKW = 7, -// STYLE_SZ_CLOCK = 2 + 3 + 4 * STYLE_SZ_CLOCKW + 2, + // STYLE_SZ_CLOCKH = 13, + // STYLE_SZ_CLOCKW = 7, + // STYLE_SZ_CLOCK = 2 + 3 + 4 * STYLE_SZ_CLOCKW + 2, // Text and Name are style dependant. - STYLE_SZ_TEXTW_FLAT = 146, - STYLE_SZ_NAMEW_FLAT = 101, - STYLE_SZ_TEXTW_BEVELED = 125, - STYLE_SZ_NAMEW_BEVELED = 80, + STYLE_SZ_TEXTW_FLAT = 146, + STYLE_SZ_NAMEW_FLAT = 101, + STYLE_SZ_TEXTW_BEVELED = 125, + STYLE_SZ_NAMEW_BEVELED = 80, // border size - STYLE_SZ_BORDER_BEVELED = 2, - STYLE_SZ_BORDER_FLAT = 2 + STYLE_SZ_BORDER_BEVELED = 2, + STYLE_SZ_BORDER_FLAT = 2 }; //===== Popup Positioning ===== @@ -65,10 +65,10 @@ enum POS_LOWERRIGHT, POS_UPPERRIGHT, POS_CENTER, - + // ranges - POS_MINVALUE = POS_UPPERLEFT, - POS_MAXVALUE = POS_CENTER + POS_MINVALUE = POS_UPPERLEFT, + POS_MAXVALUE = POS_CENTER }; //===== Spreading ===== @@ -77,8 +77,8 @@ enum SPREADING_HORIZONTAL, SPREADING_VERTICAL, - SPREADING_MINVALUE = SPREADING_HORIZONTAL, - SPREADING_MAXVALUE = SPREADING_VERTICAL + SPREADING_MINVALUE = SPREADING_HORIZONTAL, + SPREADING_MAXVALUE = SPREADING_VERTICAL }; //===== Popup Options flags @@ -92,61 +92,61 @@ enum }; enum { - TIMER_TIMETOLIVE = 26378, // My Birthday, send me something 8) - TIMER_TESTCHANGE = 60477, // You know who you are. + TIMER_TIMETOLIVE = 26378, // My Birthday, send me something 8) + TIMER_TESTCHANGE = 60477, // You know who you are. + + ANIM_TIME = 250, + FADE_TIME = (ANIM_TIME), + FADE_STEP = 10, - ANIM_TIME = 250, - FADE_TIME = (ANIM_TIME), - FADE_STEP = 10, + MN_MIRANDA = 0x01, + MN_ACTIVE = 0x02, - MN_MIRANDA = 0x01, - MN_ACTIVE = 0x02, - UM_SETDLGITEMINT = 5674 }; // Defaults: enum { - SETTING_BACKCOLOUR_DEFAULT = RGB(173,206,247), - SETTING_TEXTCOLOUR_DEFAULT = RGB(0,0,0), - - SETTING_MONITOR_DEFAULT = MN_MIRANDA, - SETTING_USEMINIMUMWIDTH_DEFAULT = 1, - SETTING_USEMAXIMUMWIDTH_DEFAULT = 1, - SETTING_USINGTHREADS_DEFAULT = 1, - SETTING_MODULEISENABLED_DEFAULT = 1, - SETTING_MULTILINE_DEFAULT = 1, - SETTING_FADEINTIME_DEFAULT = (ANIM_TIME), - SETTING_FADEOUTTIME_DEFAULT = (ANIM_TIME), - SETTING_FADEOUTTIME_MIN = 0, - SETTING_FADEINTIME_MIN = 0, - SETTING_FADEOUTTIME_MAX = 10000, - SETTING_FADEINTIME_MAX = 10000, - - SETTING_LIFETIME_MIN = 1, - SETTING_LIFETIME_MAX = 60, - SETTING_LIFETIME_DEFAULT = 4, - SETTING_LIFETIME_INFINITE = -1, - - SETTING_ENLARGEMENT_MIN = 100, - SETTING_ENLARGEMENT_MAX = 200, - SETTING_ENLARGEMENT_DEFAULT = 120, - - SETTING_HISTORYSIZE_MAX = 100, - SETTING_HISTORYSIZE_DEFAULT = 20, - - SETTING_AVTSIZE_MIN = 16, - SETTING_AVTSIZE_MAX = 100, - SETTING_AVTSIZE_DEFAULT = 32, - - SETTING_MINIMUMWIDTH_MIN = 80, - SETTING_MINIMUMWIDTH_MAX = 160, - SETTING_MINIMUMWIDTH_DEFAULT= 110, - - SETTING_MAXIMUMWIDTH_MIN = 160, -// SETTING_MAXIMUMWIDTH_MAX = 640, - SETTING_MAXIMUMWIDTH_DEFAULT= 310, + SETTING_BACKCOLOUR_DEFAULT = RGB(173, 206, 247), + SETTING_TEXTCOLOUR_DEFAULT = RGB(0, 0, 0), + + SETTING_MONITOR_DEFAULT = MN_MIRANDA, + SETTING_USEMINIMUMWIDTH_DEFAULT = 1, + SETTING_USEMAXIMUMWIDTH_DEFAULT = 1, + SETTING_USINGTHREADS_DEFAULT = 1, + SETTING_MODULEISENABLED_DEFAULT = 1, + SETTING_MULTILINE_DEFAULT = 1, + SETTING_FADEINTIME_DEFAULT = (ANIM_TIME), + SETTING_FADEOUTTIME_DEFAULT = (ANIM_TIME), + SETTING_FADEOUTTIME_MIN = 0, + SETTING_FADEINTIME_MIN = 0, + SETTING_FADEOUTTIME_MAX = 10000, + SETTING_FADEINTIME_MAX = 10000, + + SETTING_LIFETIME_MIN = 1, + SETTING_LIFETIME_MAX = 60, + SETTING_LIFETIME_DEFAULT = 4, + SETTING_LIFETIME_INFINITE = -1, + + SETTING_ENLARGEMENT_MIN = 100, + SETTING_ENLARGEMENT_MAX = 200, + SETTING_ENLARGEMENT_DEFAULT = 120, + + SETTING_HISTORYSIZE_MAX = 100, + SETTING_HISTORYSIZE_DEFAULT = 20, + + SETTING_AVTSIZE_MIN = 16, + SETTING_AVTSIZE_MAX = 100, + SETTING_AVTSIZE_DEFAULT = 32, + + SETTING_MINIMUMWIDTH_MIN = 80, + SETTING_MINIMUMWIDTH_MAX = 160, + SETTING_MINIMUMWIDTH_DEFAULT = 110, + + SETTING_MAXIMUMWIDTH_MIN = 160, + // SETTING_MAXIMUMWIDTH_MAX = 640, + SETTING_MAXIMUMWIDTH_DEFAULT = 310, SETTING_SMILEPACKTYPE_DEFAULT = SPK_NONE }; diff --git a/plugins/Popup/src/defs.h b/plugins/Popup/src/defs.h index f0f1d51b82..237148a222 100644 --- a/plugins/Popup/src/defs.h +++ b/plugins/Popup/src/defs.h @@ -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 @@ -25,19 +25,19 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define __defs_h__ #ifdef __cplusplus - // in C++ files we should define everything inside extren "C" - #define EXTERNC extern "C" - #define BEGIN_EXTERNC extern "C" { - #define END_EXTERNC }; +// in C++ files we should define everything inside extren "C" +#define EXTERNC extern "C" +#define BEGIN_EXTERNC extern "C" { +#define END_EXTERNC }; - // in C++ all exported function must be extern "C" - #define MIRAPI extern "C" __declspec(dllexport) +// in C++ all exported function must be extern "C" +#define MIRAPI extern "C" __declspec(dllexport) #else - #define EXTERNC - #define BEGIN_EXTERNC - #define END_EXTERNC +#define EXTERNC +#define BEGIN_EXTERNC +#define END_EXTERNC - #define MIRAPI __declspec(dllexport) +#define MIRAPI __declspec(dllexport) #endif #endif \ No newline at end of file diff --git a/plugins/Popup/src/effects.cpp b/plugins/Popup/src/effects.cpp index 1d1b329af9..88b680a009 100644 --- a/plugins/Popup/src/effects.cpp +++ b/plugins/Popup/src/effects.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 @@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. class MyTestEffect; -class MyTestEffect: public IPopupPlusEffect +class MyTestEffect : public IPopupPlusEffect { protected: int w, h; @@ -48,11 +48,12 @@ public: virtual void beginFrame(int frame) { this->frame = frame; - stage = (frame*2 > frameCount) ? 1 : 0; + stage = (frame * 2 > frameCount) ? 1 : 0; if (stage == 0) { alpha = alpha0 + (alpha1 - alpha0) * frame * 2 / frameCount; - } else + } + else { alpha = alpha0 + (alpha1 - alpha0) * (frame * 2 - frameCount) / frameCount; } @@ -61,11 +62,12 @@ public: { if (stage == 0) { - if ((x/16+y/16) % 2) return alpha0; + if ((x / 16 + y / 16) % 2) return alpha0; return alpha; - } else + } + else { - if ((x/16+y/16) % 2) return alpha; + if ((x / 16 + y / 16) % 2) return alpha; return alpha1; } } @@ -79,6 +81,6 @@ static INT_PTR svcCreateEffect_MyTestEffect(WPARAM, LPARAM) { return (INT_PTR)(n void PopupEfectsInitialize() { CreateServiceFunction(MS_POPUP_CREATEVFX LPGEN("Square fading"), svcCreateEffect_MyTestEffect); - + CallService(MS_POPUP_REGISTERVFX, 0, (LPARAM)"Square fading"); } diff --git a/plugins/Popup/src/effects.h b/plugins/Popup/src/effects.h index 715b9d7ecd..57532caad9 100644 --- a/plugins/Popup/src/effects.h +++ b/plugins/Popup/src/effects.h @@ -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 diff --git a/plugins/Popup/src/font.cpp b/plugins/Popup/src/font.cpp index e8df778714..1424c497af 100644 --- a/plugins/Popup/src/font.cpp +++ b/plugins/Popup/src/font.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 @@ -23,11 +23,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "headers.h" -PopupFonts fonts = {0}; +PopupFonts fonts = { 0 }; void InitFonts() { // Fonts - FontIDT fid = {0}; + FontIDT fid = { 0 }; fid.cbSize = sizeof(FontIDT); mir_tstrncpy(fid.group, _T(PU_FNT_AND_COLOR), SIZEOF(fid.group)); strncpy(fid.dbSettingsGroup, PU_FNT_AND_COLOR_DB, SIZEOF(fid.dbSettingsGroup)); @@ -40,7 +40,7 @@ void InitFonts() { mir_tstrncpy(fid.name, _T(PU_FNT_NAME_TITLE), SIZEOF(fid.name)); mir_snprintf(fid.prefix, SIZEOF(fid.prefix), PU_FNT_PREFIX, PU_FNT_NAME_TITLE); - fid.deffontsettings.style = DBFONTF_BOLD; + fid.deffontsettings.style = DBFONTF_BOLD; fid.deffontsettings.colour = RGB(0, 0, 0); FontRegisterT(&fid); @@ -64,7 +64,7 @@ void InitFonts() { fid.deffontsettings.style = DBFONTF_UNDERLINE; FontRegisterT(&fid); - ColourIDT cid = {0}; + ColourIDT cid = { 0 }; cid.cbSize = sizeof(ColourIDT); mir_tstrncpy(cid.group, _T(PU_FNT_AND_COLOR), SIZEOF(cid.group)); strncpy(cid.dbSettingsGroup, PU_FNT_AND_COLOR_DB, SIZEOF(cid.dbSettingsGroup)); @@ -91,8 +91,8 @@ void ReloadFonts() if (fonts.action) DeleteObject(fonts.action); if (fonts.actionHover) DeleteObject(fonts.actionHover); - LOGFONT lf = {0}; - FontIDT fid = {0}; + LOGFONT lf = { 0 }; + FontIDT fid = { 0 }; fid.cbSize = sizeof(FontIDT); mir_tstrncpy(fid.group, _T(PU_FNT_AND_COLOR), SIZEOF(fid.name)); @@ -116,7 +116,7 @@ void ReloadFonts() fonts.clActionHover = (COLORREF)CallService(MS_FONT_GETT, (WPARAM)&fid, (LPARAM)&lf); fonts.actionHover = CreateFontIndirect(&lf); - ColourIDT cid = {0}; + ColourIDT cid = { 0 }; cid.cbSize = sizeof(ColourIDT); mir_tstrncpy(cid.group, _T(PU_FNT_AND_COLOR), SIZEOF(cid.group)); mir_tstrncpy(cid.name, PU_COL_BACK_NAME, SIZEOF(cid.name)); @@ -131,10 +131,10 @@ void ReloadFonts() for (int i = 0; i < gTreeData.getCount(); i++) { if (gTreeData[i]->typ == 2) { mir_snprintf(setting, SIZEOF(setting), "%s/TextCol", gTreeData[i]->pupClass.pszName); - gTreeData[i]->colorText = gTreeData[i]->pupClass.colorText = + gTreeData[i]->colorText = gTreeData[i]->pupClass.colorText = (COLORREF)db_get_dw(0, PU_MODULCLASS, setting, (DWORD)fonts.clText); mir_snprintf(setting, SIZEOF(setting), "%s/BgCol", gTreeData[i]->pupClass.pszName); - gTreeData[i]->colorBack = gTreeData[i]->pupClass.colorBack = + gTreeData[i]->colorBack = gTreeData[i]->pupClass.colorBack = (COLORREF)db_get_dw(0, PU_MODULCLASS, setting, (DWORD)fonts.clBack/*pc->colorBack*/); } } diff --git a/plugins/Popup/src/font.h b/plugins/Popup/src/font.h index 8f897600af..49d6df34d8 100644 --- a/plugins/Popup/src/font.h +++ b/plugins/Popup/src/font.h @@ -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 diff --git a/plugins/Popup/src/formula.cpp b/plugins/Popup/src/formula.cpp index f4f1a1b2f1..cbd59163fd 100644 --- a/plugins/Popup/src/formula.cpp +++ b/plugins/Popup/src/formula.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 @@ -36,22 +36,25 @@ int Formula::eval_neq(TCHAR *&s, Args *args, bool *vars) const if (myisspace(*s)) { ++s; - } else - if (*s == '<') - { - // this is needed due to side effects caused by min() macro... - int tmp = eval_sum(++s, args, vars); - left = min(left, tmp); - } else - if (*s == '>') - { - // this is needed due to side effects caused by max() macro... - int tmp = eval_sum(++s, args, vars); - left = max(left, tmp); - } else - { - break; } + else + if (*s == '<') + { + // this is needed due to side effects caused by min() macro... + int tmp = eval_sum(++s, args, vars); + left = min(left, tmp); + } + else + if (*s == '>') + { + // this is needed due to side effects caused by max() macro... + int tmp = eval_sum(++s, args, vars); + left = max(left, tmp); + } + else + { + break; + } } return left; } @@ -64,18 +67,21 @@ int Formula::eval_sum(TCHAR *&s, Args *args, bool *vars) const if (myisspace(*s)) { ++s; - } else - if (*s == '+') - { - left += eval_mul(++s, args, vars); - } else - if (*s == '-') - { - left -= eval_mul(++s, args, vars); - } else - { - break; } + else + if (*s == '+') + { + left += eval_mul(++s, args, vars); + } + else + if (*s == '-') + { + left -= eval_mul(++s, args, vars); + } + else + { + break; + } } return left; } @@ -88,24 +94,28 @@ int Formula::eval_mul(TCHAR *&s, Args *args, bool *vars) const if (myisspace(*s)) { ++s; - } else - if (*s == '*') - { - left *= eval_atom(++s, args, vars); - } else - if (*s == '/') - { - if (int right = eval_atom(++s, args, vars)) - left /= right; - } else - if (*s == '%') - { - if (int right = eval_atom(++s, args, vars)) - left %= right; - } else - { - break; } + else + if (*s == '*') + { + left *= eval_atom(++s, args, vars); + } + else + if (*s == '/') + { + if (int right = eval_atom(++s, args, vars)) + left /= right; + } + else + if (*s == '%') + { + if (int right = eval_atom(++s, args, vars)) + left %= right; + } + else + { + break; + } } return left; } @@ -117,44 +127,49 @@ int Formula::eval_atom(TCHAR *&s, Args *args, bool *vars) const if (myisspace(*s)) { ++s; - } else - if (*s == '(') - { - int res = eval_neq(++s, args, vars); - if (*s == ')') - ++s; - return res; - } else - if ((*s == '+') || (*s == '-')) - { - int sign = 1; - if (*s == '-') - sign = -1; - return sign * eval_neq(++s, args, vars); - } else - if (*s == '!') - { - return !eval_neq(++s, args, vars); - } else - if ((*s >= '0') && (*s <= '9')) - { - int res = 0; - while ((*s >= '0') && (*s <= '9')) - res = res * 10 + *s++ - '0'; - return res; - } else - { - if (!args) - return 0; - char buf[1024]; - char *bufptr = buf; - while (((*s >= '0') && (*s <= '9')) || ((*s >= 'a') && (*s <= 'z')) || ((*s >= 'A') && (*s <= 'A')) || (*s == '_') || (*s == '.')) - *bufptr++ = *s++; - *bufptr = 0; - int res = args->get(buf); - if (vars) *vars = true; - return res; } + else + if (*s == '(') + { + int res = eval_neq(++s, args, vars); + if (*s == ')') + ++s; + return res; + } + else + if ((*s == '+') || (*s == '-')) + { + int sign = 1; + if (*s == '-') + sign = -1; + return sign * eval_neq(++s, args, vars); + } + else + if (*s == '!') + { + return !eval_neq(++s, args, vars); + } + else + if ((*s >= '0') && (*s <= '9')) + { + int res = 0; + while ((*s >= '0') && (*s <= '9')) + res = res * 10 + *s++ - '0'; + return res; + } + else + { + if (!args) + return 0; + char buf[1024]; + char *bufptr = buf; + while (((*s >= '0') && (*s <= '9')) || ((*s >= 'a') && (*s <= 'z')) || ((*s >= 'A') && (*s <= 'A')) || (*s == '_') || (*s == '.')) + *bufptr++ = *s++; + *bufptr = 0; + int res = args->get(buf); + if (vars) *vars = true; + return res; + } } return 0; } diff --git a/plugins/Popup/src/formula.h b/plugins/Popup/src/formula.h index 67cea481c9..7be33d1d23 100644 --- a/plugins/Popup/src/formula.h +++ b/plugins/Popup/src/formula.h @@ -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 @@ -35,18 +35,18 @@ public: char *name; int value; Item *next; - - Item(char *aName, int aValue, Item *aNext): value(aValue), next(aNext) { name = aName ? mir_strdup(aName) : 0; } + + Item(char *aName, int aValue, Item *aNext) : value(aValue), next(aNext) { name = aName ? mir_strdup(aName) : 0; } ~Item() { if (name) mir_free(name); } }; Item *items; public: - Args():items(0){} - ~Args(){clear();} + Args() :items(0){} + ~Args(){ clear(); } void add(char *name, int value) { for (Item *p = items; p; p = p->next) - if (!mir_strcmp(p->name,name)) + if (!mir_strcmp(p->name, name)) { p->value = value; return; @@ -56,7 +56,7 @@ public: int get(char *name) { for (Item *p = items; p; p = p->next) - if (!mir_strcmp(p->name,name)) + if (!mir_strcmp(p->name, name)) return p->value; return 0; } @@ -73,16 +73,16 @@ public: private: TCHAR *m_str; - int eval_neq (TCHAR *&s, Args *args, bool *vars) const; + int eval_neq(TCHAR *&s, Args *args, bool *vars) const; int eval_sum(TCHAR *&s, Args *args, bool *vars) const; int eval_mul(TCHAR *&s, Args *args, bool *vars) const; int eval_atom(TCHAR *&s, Args *args, bool *vars) const; public: - Formula():m_str(mir_tstrdup(_T(""))) {} - Formula(TCHAR *s):m_str(mir_tstrdup(s)) {} - ~Formula() {mir_free(m_str);} - void set(TCHAR *s){mir_free(m_str);m_str=mir_tstrdup(s);} + Formula() :m_str(mir_tstrdup(_T(""))) {} + Formula(TCHAR *s) :m_str(mir_tstrdup(s)) {} + ~Formula() { mir_free(m_str); } + void set(TCHAR *s){ mir_free(m_str); m_str = mir_tstrdup(s); } int eval(Args *args, bool *vars = 0) const; }; diff --git a/plugins/Popup/src/headers.h b/plugins/Popup/src/headers.h index 226aea0525..1aa9f6f8be 100644 --- a/plugins/Popup/src/headers.h +++ b/plugins/Popup/src/headers.h @@ -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 @@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. /* =============================================================================== - Popup plugin +Popup plugin This plugin notifies you when a contact changes his/hers status with a Popup. You can customize its look (style of popup, font, text...) and behaviour (the @@ -90,7 +90,7 @@ http://miranda-ng.org/distr/ #include #include #ifndef MTEXT_NOHELPERS - #define MTEXT_NOHELPERS +#define MTEXT_NOHELPERS #endif // MTEXT_NOHELPERS #include #include diff --git a/plugins/Popup/src/history.cpp b/plugins/Popup/src/history.cpp index edc3a66d0b..2d794a62a1 100644 --- a/plugins/Popup/src/history.cpp +++ b/plugins/Popup/src/history.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 @@ -62,8 +62,8 @@ void PopupHistoryLoad() void PopupHistoryUnload() { - for (int i=0; i < arPopupHistory.getCount(); ++i) - FreeHistoryItem( arPopupHistory[i] ); + for (int i = 0; i < arPopupHistory.getCount(); ++i) + FreeHistoryItem(arPopupHistory[i]); arPopupHistory.destroy(); DeleteCriticalSection(&csPopupHistory); @@ -74,7 +74,7 @@ void PopupHistoryAdd(POPUPDATA2 *ppdNew) if (!PopupOptions.EnableHistory) return; - POPUPDATA2 *ppd = (POPUPDATA2*)mir_alloc( sizeof(POPUPDATA2)); + POPUPDATA2 *ppd = (POPUPDATA2*)mir_alloc(sizeof(POPUPDATA2)); *ppd = *ppdNew; if (ppd->flags & PU2_UNICODE) { ppd->lptzTitle = mir_tstrdup(ppd->lpwzTitle); @@ -117,7 +117,7 @@ void PopupHistoryShow() } } -static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) +static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM, LPARAM lParam) { static int oldWidth = 0; static int loadItem = -1; @@ -127,104 +127,104 @@ static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA switch (msg) { case WM_INITDIALOG: - { - oldWidth = 0; - HWND hwndList = GetDlgItem(hwnd, IDC_POPUP_LIST); - for (int i=0; i < arPopupHistory.getCount(); ++i) - ListBox_SetItemData(hwndList, ListBox_AddString(hwndList, _T("")), 0); - SendMessage(hwnd, WM_SETICON, ICON_SMALL, (LPARAM)IcoLib_GetIcon(ICO_HISTORY,0)); - SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM)IcoLib_GetIcon(ICO_HISTORY,1)); - - if (gbHppInstalled && PopupOptions.UseHppHistoryLog) { - logType = LOG_HPP; - ShowWindow(GetDlgItem(hwnd, IDC_POPUP_LIST), SW_HIDE); - - IEVIEWWINDOW ieWindow; - ieWindow.cbSize = sizeof(IEVIEWWINDOW); - ieWindow.iType = IEW_CREATE; - ieWindow.dwFlags = 0; - ieWindow.dwMode = IEWM_MUCC; - ieWindow.parent = hwnd; - ieWindow.x = 0; - ieWindow.y = 0; - ieWindow.cx = 100; - ieWindow.cy = 100; - CallService(MS_HPP_EG_WINDOW, 0, (LPARAM)&ieWindow); - hwndLog = ieWindow.hwnd; - ShowWindow(hwndLog, SW_SHOW); - - RECT rcLst; GetWindowRect(hwndList, &rcLst); - POINT pt; - pt.x = rcLst.left; - pt.y = rcLst.top; - ScreenToClient(hwnd, &pt); - - ieWindow.cbSize = sizeof(IEVIEWWINDOW); - ieWindow.iType = IEW_SETPOS; - ieWindow.parent = hwnd; - ieWindow.hwnd = hwndLog; - ieWindow.x = pt.x; - ieWindow.y = pt.y; - ieWindow.cx = rcLst.right-rcLst.left; - ieWindow.cy = rcLst.bottom-rcLst.top; - CallService(MS_HPP_EG_WINDOW, 0, (LPARAM)&ieWindow); - - IEVIEWEVENTDATA ieData; - - IEVIEWEVENT ieEvent; - ieEvent.cbSize = sizeof(ieEvent); - ieEvent.iType = IEE_LOG_MEM_EVENTS; - ieEvent.dwFlags = 0; - ieEvent.hwnd = hwndLog; - ieEvent.eventData = &ieData; - ieEvent.count = 1; - ieEvent.codepage = 0; - ieEvent.pszProto = NULL; - - for (int i=0; i < arPopupHistory.getCount(); ++i) { - POPUPDATA2* ppd = arPopupHistory[i]; - ieData.cbSize = sizeof(ieData); - ieData.iType = IEED_EVENT_SYSTEM; - ieData.dwFlags = 0; - ieData.color = ppd->colorText; - if (ppd->flags & PU2_UNICODE) { - ieData.dwFlags |= IEEDF_UNICODE_TEXT | IEEDF_UNICODE_NICK; - ieData.pszNickW = ppd->lptzTitle; - ieData.pszTextW = ppd->lptzText; - ieData.pszText2W = NULL; - } - else { - ieData.dwFlags |= 0; - ieData.pszNick = ppd->lpzTitle; - ieData.pszText = ppd->lpzText; - ieData.pszText2 = NULL; - } - ieData.bIsMe = FALSE; - ieData.time = ppd->dwTimestamp; - ieData.dwData = 0; - ieData.next = NULL; - CallService(MS_HPP_EG_EVENT, 0, (WPARAM)&ieEvent); + { + oldWidth = 0; + HWND hwndList = GetDlgItem(hwnd, IDC_POPUP_LIST); + for (int i = 0; i < arPopupHistory.getCount(); ++i) + ListBox_SetItemData(hwndList, ListBox_AddString(hwndList, _T("")), 0); + SendMessage(hwnd, WM_SETICON, ICON_SMALL, (LPARAM)IcoLib_GetIcon(ICO_HISTORY, 0)); + SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM)IcoLib_GetIcon(ICO_HISTORY, 1)); + + if (gbHppInstalled && PopupOptions.UseHppHistoryLog) { + logType = LOG_HPP; + ShowWindow(GetDlgItem(hwnd, IDC_POPUP_LIST), SW_HIDE); + + IEVIEWWINDOW ieWindow; + ieWindow.cbSize = sizeof(IEVIEWWINDOW); + ieWindow.iType = IEW_CREATE; + ieWindow.dwFlags = 0; + ieWindow.dwMode = IEWM_MUCC; + ieWindow.parent = hwnd; + ieWindow.x = 0; + ieWindow.y = 0; + ieWindow.cx = 100; + ieWindow.cy = 100; + CallService(MS_HPP_EG_WINDOW, 0, (LPARAM)&ieWindow); + hwndLog = ieWindow.hwnd; + ShowWindow(hwndLog, SW_SHOW); + + RECT rcLst; GetWindowRect(hwndList, &rcLst); + POINT pt; + pt.x = rcLst.left; + pt.y = rcLst.top; + ScreenToClient(hwnd, &pt); + + ieWindow.cbSize = sizeof(IEVIEWWINDOW); + ieWindow.iType = IEW_SETPOS; + ieWindow.parent = hwnd; + ieWindow.hwnd = hwndLog; + ieWindow.x = pt.x; + ieWindow.y = pt.y; + ieWindow.cx = rcLst.right - rcLst.left; + ieWindow.cy = rcLst.bottom - rcLst.top; + CallService(MS_HPP_EG_WINDOW, 0, (LPARAM)&ieWindow); + + IEVIEWEVENTDATA ieData; + + IEVIEWEVENT ieEvent; + ieEvent.cbSize = sizeof(ieEvent); + ieEvent.iType = IEE_LOG_MEM_EVENTS; + ieEvent.dwFlags = 0; + ieEvent.hwnd = hwndLog; + ieEvent.eventData = &ieData; + ieEvent.count = 1; + ieEvent.codepage = 0; + ieEvent.pszProto = NULL; + + for (int i = 0; i < arPopupHistory.getCount(); ++i) { + POPUPDATA2* ppd = arPopupHistory[i]; + ieData.cbSize = sizeof(ieData); + ieData.iType = IEED_EVENT_SYSTEM; + ieData.dwFlags = 0; + ieData.color = ppd->colorText; + if (ppd->flags & PU2_UNICODE) { + ieData.dwFlags |= IEEDF_UNICODE_TEXT | IEEDF_UNICODE_NICK; + ieData.pszNickW = ppd->lptzTitle; + ieData.pszTextW = ppd->lptzText; + ieData.pszText2W = NULL; } + else { + ieData.dwFlags |= 0; + ieData.pszNick = ppd->lpzTitle; + ieData.pszText = ppd->lpzText; + ieData.pszText2 = NULL; + } + ieData.bIsMe = FALSE; + ieData.time = ppd->dwTimestamp; + ieData.dwData = 0; + ieData.next = NULL; + CallService(MS_HPP_EG_EVENT, 0, (WPARAM)&ieEvent); } - else { - logType = LOG_DEFAULT; - hwndLog = hwndList; + } + else { + logType = LOG_DEFAULT; + hwndLog = hwndList; - ShowWindow(hwndLog, SW_SHOW); - } + ShowWindow(hwndLog, SW_SHOW); + } - Utils_RestoreWindowPosition(hwnd, NULL, MODULNAME, "popupHistory_"); + Utils_RestoreWindowPosition(hwnd, NULL, MODULNAME, "popupHistory_"); - if (logType == LOG_DEFAULT) { - SendMessage(hwnd, UM_RESIZELIST, 0, 0); - ListBox_SetTopIndex(hwndLog, arPopupHistory.getCount()-1); - } + if (logType == LOG_DEFAULT) { + SendMessage(hwnd, UM_RESIZELIST, 0, 0); + ListBox_SetTopIndex(hwndLog, arPopupHistory.getCount() - 1); } - return TRUE; + } + return TRUE; case WM_MEASUREITEM: if (logType == LOG_DEFAULT) { - LPMEASUREITEMSTRUCT lpmis = (LPMEASUREITEMSTRUCT) lParam; + LPMEASUREITEMSTRUCT lpmis = (LPMEASUREITEMSTRUCT)lParam; if (lpmis->itemID == -1) return FALSE; lpmis->itemHeight = 50; @@ -234,7 +234,7 @@ static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA case WM_DRAWITEM: if (logType == LOG_DEFAULT) { LPDRAWITEMSTRUCT lpdis; - lpdis = (LPDRAWITEMSTRUCT) lParam; + lpdis = (LPDRAWITEMSTRUCT)lParam; if (lpdis->itemID == -1) return FALSE; @@ -248,7 +248,7 @@ static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA POPUPOPTIONS customOptions = PopupOptions; customOptions.DynamicResize = FALSE; - customOptions.MinimumWidth = customOptions.MaximumWidth = rc.right-rc.left-30; + customOptions.MinimumWidth = customOptions.MaximumWidth = rc.right - rc.left - 30; POPUPDATA2 *ppd = arPopupHistory[lpdis->itemID]; wndPreview = new PopupWnd2(ppd, &customOptions, true); @@ -256,7 +256,7 @@ static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA wndPreview->update(); ListBox_SetItemData(hwndLog, lpdis->itemID, wndPreview); - ListBox_SetItemHeight(hwndLog, lpdis->itemID, wndPreview->getSize().cy+6); + ListBox_SetItemHeight(hwndLog, lpdis->itemID, wndPreview->getSize().cy + 6); } if (wndPreview) { @@ -264,7 +264,7 @@ static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA HBRUSH hbr = CreateSolidBrush(GetSysColor(COLOR_HIGHLIGHT)); FillRect(lpdis->hDC, &lpdis->rcItem, hbr); DeleteObject(hbr); - } + } else { HBRUSH hbr = CreateSolidBrush(GetSysColor(COLOR_WINDOW)); FillRect(lpdis->hDC, &lpdis->rcItem, hbr); @@ -279,7 +279,7 @@ static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA bf.BlendFlags = 0; bf.SourceConstantAlpha = 255; bf.AlphaFormat = AC_SRC_ALPHA; - AlphaBlend(lpdis->hDC, lpdis->rcItem.left+5, lpdis->rcItem.top+3, width, height, + AlphaBlend(lpdis->hDC, lpdis->rcItem.left + 5, lpdis->rcItem.top + 3, width, height, wndPreview->getContent()->getDC(), 0, 0, width, height, bf); } @@ -296,48 +296,48 @@ static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA return TRUE; case WM_SIZE: - { - RECT rcLst; GetClientRect(hwnd, &rcLst); - rcLst.left += 10; - rcLst.top += 10; - rcLst.right -= 10; - rcLst.bottom -= 10; - if (logType == LOG_HPP) { - SetWindowPos(hwndLog, NULL, - rcLst.left, rcLst.top, rcLst.right-rcLst.left, rcLst.bottom-rcLst.top, - SWP_NOZORDER|SWP_DEFERERASE|SWP_SHOWWINDOW); - - IEVIEWWINDOW ieWindow; - ieWindow.cbSize = sizeof(IEVIEWWINDOW); - ieWindow.iType = IEW_SETPOS; - ieWindow.parent = hwnd; - ieWindow.hwnd = hwndLog; - ieWindow.x = rcLst.left; - ieWindow.y = rcLst.top; - ieWindow.cx = rcLst.right-rcLst.left; - ieWindow.cy = rcLst.bottom-rcLst.top; - CallService(MS_HPP_EG_WINDOW, 0, (LPARAM)&ieWindow); - } - else if (logType == LOG_DEFAULT) { - SetWindowPos(hwndLog, NULL, - rcLst.left, rcLst.top, rcLst.right-rcLst.left, rcLst.bottom-rcLst.top, - SWP_NOZORDER | SWP_DEFERERASE | SWP_SHOWWINDOW); - if (rcLst.right-rcLst.left != oldWidth) { - oldWidth = rcLst.right-rcLst.left; - PostMessage(hwnd, UM_RESIZELIST, 0, 0); - } + { + RECT rcLst; GetClientRect(hwnd, &rcLst); + rcLst.left += 10; + rcLst.top += 10; + rcLst.right -= 10; + rcLst.bottom -= 10; + if (logType == LOG_HPP) { + SetWindowPos(hwndLog, NULL, + rcLst.left, rcLst.top, rcLst.right - rcLst.left, rcLst.bottom - rcLst.top, + SWP_NOZORDER | SWP_DEFERERASE | SWP_SHOWWINDOW); + + IEVIEWWINDOW ieWindow; + ieWindow.cbSize = sizeof(IEVIEWWINDOW); + ieWindow.iType = IEW_SETPOS; + ieWindow.parent = hwnd; + ieWindow.hwnd = hwndLog; + ieWindow.x = rcLst.left; + ieWindow.y = rcLst.top; + ieWindow.cx = rcLst.right - rcLst.left; + ieWindow.cy = rcLst.bottom - rcLst.top; + CallService(MS_HPP_EG_WINDOW, 0, (LPARAM)&ieWindow); + } + else if (logType == LOG_DEFAULT) { + SetWindowPos(hwndLog, NULL, + rcLst.left, rcLst.top, rcLst.right - rcLst.left, rcLst.bottom - rcLst.top, + SWP_NOZORDER | SWP_DEFERERASE | SWP_SHOWWINDOW); + if (rcLst.right - rcLst.left != oldWidth) { + oldWidth = rcLst.right - rcLst.left; + PostMessage(hwnd, UM_RESIZELIST, 0, 0); } } - return TRUE; + } + return TRUE; case UM_RESIZELIST: if (logType == LOG_DEFAULT) { - RECT rc; + RECT rc; GetWindowRect(GetDlgItem(hwnd, IDC_POPUP_LIST), &rc); - if (rc.right-rc.left <= 30) + if (rc.right - rc.left <= 30) return FALSE; - for (int i=0; i < arPopupHistory.getCount(); ++i) { + for (int i = 0; i < arPopupHistory.getCount(); ++i) { PopupWnd2 *wndPreview = (PopupWnd2 *)ListBox_GetItemData(hwndLog, i); if (wndPreview) delete wndPreview; diff --git a/plugins/Popup/src/history.h b/plugins/Popup/src/history.h index d649618d99..58a7e73c6f 100644 --- a/plugins/Popup/src/history.h +++ b/plugins/Popup/src/history.h @@ -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 diff --git a/plugins/Popup/src/icons.cpp b/plugins/Popup/src/icons.cpp index 5d9432a700..6775f971d6 100644 --- a/plugins/Popup/src/icons.cpp +++ b/plugins/Popup/src/icons.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 @@ -26,37 +26,37 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static IconItem iconList[] = { // toolbar - { LPGEN("Popups are enabled"), ICO_TB_POPUP_ON, IDI_POPUP }, - { LPGEN("Popups are disabled"), ICO_TB_POPUP_OFF, IDI_NOPOPUP }, + { LPGEN("Popups are enabled"), ICO_TB_POPUP_ON, IDI_POPUP }, + { LPGEN("Popups are disabled"), ICO_TB_POPUP_OFF, IDI_NOPOPUP }, // common popup - { LPGEN("Popups are enabled"), ICO_POPUP_ON, IDI_POPUP }, - { LPGEN("Popups are disabled"), ICO_POPUP_OFF, IDI_NOPOPUP }, - { LPGEN("With \"favorite\" overlay"), ICO_FAV, IDI_PU_FAVOURITE }, - { LPGEN("With \"fullscreen\" overlay"), ICO_FULLSCREEN, IDI_PU_FULLSCREEN }, - { LPGEN("Popup History"), ICO_HISTORY, IDI_HISTORY }, + { LPGEN("Popups are enabled"), ICO_POPUP_ON, IDI_POPUP }, + { LPGEN("Popups are disabled"), ICO_POPUP_OFF, IDI_NOPOPUP }, + { LPGEN("With \"favorite\" overlay"), ICO_FAV, IDI_PU_FAVOURITE }, + { LPGEN("With \"fullscreen\" overlay"), ICO_FULLSCREEN, IDI_PU_FULLSCREEN }, + { LPGEN("Popup History"), ICO_HISTORY, IDI_HISTORY }, // option - { LPGEN("Refresh skin list"), ICO_OPT_RELOAD, IDI_RELOAD }, - { LPGEN("Popup placement"), ICO_OPT_RESIZE, IDI_RESIZE }, - { LPGEN("OK"), ICO_OPT_OK, IDI_ACT_OK }, - { LPGEN("Cancel"), ICO_OPT_CANCEL, IDI_ACT_CLOSE }, - { LPGEN("Popup group"), ICO_OPT_GROUP, IDI_OPT_GROUP }, - { LPGEN("Show default"), ICO_OPT_DEF, IDI_ACT_OK }, - { LPGEN("Favorite contact"), ICO_OPT_FAV, IDI_OPT_FAVORITE }, - { LPGEN("Show in fullscreen"), ICO_OPT_FULLSCREEN, IDI_OPT_FULLSCREEN }, - { LPGEN("Blocked contact"), ICO_OPT_BLOCK, IDI_OPT_BLOCK }, + { LPGEN("Refresh skin list"), ICO_OPT_RELOAD, IDI_RELOAD }, + { LPGEN("Popup placement"), ICO_OPT_RESIZE, IDI_RESIZE }, + { LPGEN("OK"), ICO_OPT_OK, IDI_ACT_OK }, + { LPGEN("Cancel"), ICO_OPT_CANCEL, IDI_ACT_CLOSE }, + { LPGEN("Popup group"), ICO_OPT_GROUP, IDI_OPT_GROUP }, + { LPGEN("Show default"), ICO_OPT_DEF, IDI_ACT_OK }, + { LPGEN("Favorite contact"), ICO_OPT_FAV, IDI_OPT_FAVORITE }, + { LPGEN("Show in fullscreen"), ICO_OPT_FULLSCREEN, IDI_OPT_FULLSCREEN }, + { LPGEN("Blocked contact"), ICO_OPT_BLOCK, IDI_OPT_BLOCK }, // action - { LPGEN("Quick reply"), ICO_ACT_REPLY, IDI_ACT_REPLY }, - { LPGEN("Pin popup"), ICO_ACT_PIN, IDI_ACT_PIN }, - { LPGEN("Pinned popup"), ICO_ACT_PINNED, IDI_ACT_PINNED }, - { LPGEN("Send message"), ICO_ACT_MESS, IDI_ACT_MESSAGE }, - { LPGEN("User details"), ICO_ACT_INFO, IDI_ACT_INFO }, - { LPGEN("Contact menu"), ICO_ACT_MENU, IDI_ACT_MENU }, - { LPGEN("Add contact permanently"), ICO_ACT_ADD, IDI_ACT_ADD }, - { LPGEN("Dismiss popup"), ICO_ACT_CLOSE, IDI_ACT_CLOSE }, - { LPGEN("Copy to clipboard"), ICO_ACT_COPY, IDI_ACT_COPY } + { LPGEN("Quick reply"), ICO_ACT_REPLY, IDI_ACT_REPLY }, + { LPGEN("Pin popup"), ICO_ACT_PIN, IDI_ACT_PIN }, + { LPGEN("Pinned popup"), ICO_ACT_PINNED, IDI_ACT_PINNED }, + { LPGEN("Send message"), ICO_ACT_MESS, IDI_ACT_MESSAGE }, + { LPGEN("User details"), ICO_ACT_INFO, IDI_ACT_INFO }, + { LPGEN("Contact menu"), ICO_ACT_MENU, IDI_ACT_MENU }, + { LPGEN("Add contact permanently"), ICO_ACT_ADD, IDI_ACT_ADD }, + { LPGEN("Dismiss popup"), ICO_ACT_CLOSE, IDI_ACT_CLOSE }, + { LPGEN("Copy to clipboard"), ICO_ACT_COPY, IDI_ACT_COPY } }; diff --git a/plugins/Popup/src/icons.h b/plugins/Popup/src/icons.h index df52aed4ef..06b873b71b 100644 --- a/plugins/Popup/src/icons.h +++ b/plugins/Popup/src/icons.h @@ -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 @@ -65,6 +65,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define ICO_OPT_BLOCK MODULNAME"_opt_block" void InitIcons(); -HICON IcoLib_GetIcon(LPCSTR pszIcon, bool big=false); +HICON IcoLib_GetIcon(LPCSTR pszIcon, bool big = false); #endif // __icons_h__ diff --git a/plugins/Popup/src/main.cpp b/plugins/Popup/src/main.cpp index 3680e6ee42..395792e278 100644 --- a/plugins/Popup/src/main.cpp +++ b/plugins/Popup/src/main.cpp @@ -2,8 +2,8 @@ Popup Plus plugin for Miranda IM Copyright © 2002 Luca Santarelli, - © 2004-2007 Victor Pavlychko - © 2010 MPK +© 2004-2007 Victor Pavlychko +© 2010 MPK This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -30,11 +30,11 @@ WORD SETTING_MAXIMUMWIDTH_MAX = GetSystemMetrics(SM_CXSCREEN); HANDLE hEventNotify; //===== Options ========================================================================= -static int OptionsInitialize(WPARAM,LPARAM); +static int OptionsInitialize(WPARAM, LPARAM); void UpgradeDb(); //===== Initializations ================================================================= -static int OkToExit(WPARAM,LPARAM); +static int OkToExit(WPARAM, LPARAM); bool OptionLoaded = false; int hLangpack = 0; @@ -45,7 +45,7 @@ HMODULE hKernelDll = 0; HMODULE hGdiDll = 0; HMODULE hDwmapiDll = 0; -GLOBAL_WND_CLASSES g_wndClass = {0}; +GLOBAL_WND_CLASSES g_wndClass = { 0 }; HANDLE htuText; HANDLE htuTitle; @@ -156,7 +156,7 @@ INT_PTR svcEnableDisableMenuCommand(WPARAM, LPARAM) PopupOptions.ModuleIsEnabled = FALSE; db_set_b(NULL, "Popup", "ModuleIsEnabled", FALSE); mi.ptszName = LPGENT("Enable Popups"); - mi.hIcon = IcoLib_GetIcon(ICO_POPUP_OFF,0); + mi.hIcon = IcoLib_GetIcon(ICO_POPUP_OFF, 0); } else { // The module is disabled. @@ -164,7 +164,7 @@ INT_PTR svcEnableDisableMenuCommand(WPARAM, LPARAM) PopupOptions.ModuleIsEnabled = TRUE; db_set_b(NULL, "Popup", "ModuleIsEnabled", TRUE); mi.ptszName = LPGENT("Disable Popups"); - mi.hIcon = IcoLib_GetIcon(ICO_POPUP_ON,0); + mi.hIcon = IcoLib_GetIcon(ICO_POPUP_ON, 0); } mi.flags = CMIM_NAME | CMIM_ICON | CMIF_TCHAR; Menu_ModifyItem(hMenuItem, &mi); @@ -240,17 +240,17 @@ void LoadHotkey() // menu // Function which makes the initializations -static int ModulesLoaded(WPARAM,LPARAM) +static int ModulesLoaded(WPARAM, LPARAM) { // check if History++ is installed gbHppInstalled = ServiceExists(MS_HPP_GETVERSION) && ServiceExists(MS_HPP_EG_WINDOW) && - (CallService(MS_HPP_GETVERSION, 0, 0) >= PLUGIN_MAKE_VERSION(1,5,0,112)); + (CallService(MS_HPP_GETVERSION, 0, 0) >= PLUGIN_MAKE_VERSION(1, 5, 0, 112)); // check if MText plugin is installed mir_getMTI(&MText); if (MText.Register) { htuText = MText.Register("Popup Plus/Text", MTEXT_FANCY_DEFAULT); - htuTitle = MText.Register("Popup Plus/Title",MTEXT_FANCY_DEFAULT); + htuTitle = MText.Register("Popup Plus/Title", MTEXT_FANCY_DEFAULT); } else htuTitle = htuText = NULL; @@ -274,7 +274,7 @@ static int ModulesLoaded(WPARAM,LPARAM) // Folder plugin support folderId = FoldersRegisterCustomPathT(LPGEN("Skins"), LPGEN("Popup Plus"), MIRANDA_PATHT _T("\\Skins\\Popup")); // load skin - skins.load(_T("dir")); + skins.load(); const PopupSkin *skin; if (skin = skins.getSkin(PopupOptions.SkinPack)) { mir_free(PopupOptions.SkinPack); @@ -294,7 +294,7 @@ static int ModulesLoaded(WPARAM,LPARAM) //=== DllMain =========================================================================== // DLL entry point, Required to store the instance handle -BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) +BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID) { hInst = hinstDLL; return TRUE; @@ -335,18 +335,18 @@ MIRAPI int Load(void) CreateServiceFunction(MS_POPUP_GETSTATUS, GetStatus); - #if defined(_DEBUG) - PopupOptions.debug = db_get_b(NULL, MODULNAME, "debug", FALSE); - #else - PopupOptions.debug = false; - #endif +#if defined(_DEBUG) + PopupOptions.debug = db_get_b(NULL, MODULNAME, "debug", FALSE); +#else + PopupOptions.debug = false; +#endif LoadGDIPlus(); // Transparent and animation routines hDwmapiDll = LoadLibrary(_T("dwmapi.dll")); MyDwmEnableBlurBehindWindow = 0; if (hDwmapiDll) - MyDwmEnableBlurBehindWindow = (HRESULT (WINAPI *)(HWND, DWM_BLURBEHIND *))GetProcAddress(hDwmapiDll, "DwmEnableBlurBehindWindow"); + MyDwmEnableBlurBehindWindow = (HRESULT(WINAPI *)(HWND, DWM_BLURBEHIND *))GetProcAddress(hDwmapiDll, "DwmEnableBlurBehindWindow"); PopupHistoryLoad(); LoadPopupThread(); @@ -372,32 +372,32 @@ MIRAPI int Load(void) // Service Functions hEventNotify = CreateHookableEvent(ME_POPUP_FILTER); - CreateServiceFunction(MS_POPUP_ADDPOPUP, Popup_AddPopup); - CreateServiceFunction(MS_POPUP_ADDPOPUPW, Popup_AddPopupW); - CreateServiceFunction(MS_POPUP_ADDPOPUP2, Popup_AddPopup2); + CreateServiceFunction(MS_POPUP_ADDPOPUP, Popup_AddPopup); + CreateServiceFunction(MS_POPUP_ADDPOPUPW, Popup_AddPopupW); + CreateServiceFunction(MS_POPUP_ADDPOPUP2, Popup_AddPopup2); - CreateServiceFunction(MS_POPUP_CHANGETEXTW, Popup_ChangeTextW); + CreateServiceFunction(MS_POPUP_CHANGETEXTW, Popup_ChangeTextW); - CreateServiceFunction(MS_POPUP_CHANGEW, Popup_ChangeW); - CreateServiceFunction(MS_POPUP_CHANGEPOPUP2, Popup_Change2); + CreateServiceFunction(MS_POPUP_CHANGEW, Popup_ChangeW); + CreateServiceFunction(MS_POPUP_CHANGEPOPUP2, Popup_Change2); - CreateServiceFunction(MS_POPUP_GETCONTACT, Popup_GetContact); - CreateServiceFunction(MS_POPUP_GETPLUGINDATA, Popup_GetPluginData); + CreateServiceFunction(MS_POPUP_GETCONTACT, Popup_GetContact); + CreateServiceFunction(MS_POPUP_GETPLUGINDATA, Popup_GetPluginData); - CreateServiceFunction(MS_POPUP_SHOWMESSAGE, Popup_ShowMessage); - CreateServiceFunction(MS_POPUP_SHOWMESSAGEW, Popup_ShowMessageW); - CreateServiceFunction(MS_POPUP_QUERY, Popup_Query); + CreateServiceFunction(MS_POPUP_SHOWMESSAGE, Popup_ShowMessage); + CreateServiceFunction(MS_POPUP_SHOWMESSAGEW, Popup_ShowMessageW); + CreateServiceFunction(MS_POPUP_QUERY, Popup_Query); - CreateServiceFunction(MS_POPUP_REGISTERACTIONS, Popup_RegisterActions); + CreateServiceFunction(MS_POPUP_REGISTERACTIONS, Popup_RegisterActions); CreateServiceFunction(MS_POPUP_REGISTERNOTIFICATION, Popup_RegisterNotification); - CreateServiceFunction(MS_POPUP_UNHOOKEVENTASYNC, Popup_UnhookEventAsync); + CreateServiceFunction(MS_POPUP_UNHOOKEVENTASYNC, Popup_UnhookEventAsync); - CreateServiceFunction(MS_POPUP_REGISTERVFX, Popup_RegisterVfx); + CreateServiceFunction(MS_POPUP_REGISTERVFX, Popup_RegisterVfx); - CreateServiceFunction(MS_POPUP_REGISTERCLASS, Popup_RegisterPopupClass); - CreateServiceFunction(MS_POPUP_UNREGISTERCLASS, Popup_UnregisterPopupClass); - CreateServiceFunction(MS_POPUP_ADDPOPUPCLASS, Popup_CreateClassPopup); + CreateServiceFunction(MS_POPUP_REGISTERCLASS, Popup_RegisterPopupClass); + CreateServiceFunction(MS_POPUP_UNREGISTERCLASS, Popup_UnregisterPopupClass); + CreateServiceFunction(MS_POPUP_ADDPOPUPCLASS, Popup_CreateClassPopup); // load icons / create hook InitIcons(); diff --git a/plugins/Popup/src/notifications.cpp b/plugins/Popup/src/notifications.cpp index a789b56e56..84e115bd6d 100644 --- a/plugins/Popup/src/notifications.cpp +++ b/plugins/Popup/src/notifications.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 @@ -41,32 +41,32 @@ LIST gTreeData(20, TreeDataSortFunc); // interface void LoadNotifications() { - POPUPNOTIFICATION notification = {0}; + POPUPNOTIFICATION notification = { 0 }; notification.cbSize = sizeof(notification); notification.actionCount = 0; notification.lpActions = 0; mir_strncpy(notification.lpzGroup, "Misc", sizeof(notification.lpzName)); mir_strncpy(notification.lpzName, "Warning", sizeof(notification.lpzName)); - notification.lchIcon = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_MB_WARN), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR|LR_SHARED); - notification.colorBack = RGB(210,210,150); - notification.colorText = RGB(0,0,0); + notification.lchIcon = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_MB_WARN), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR | LR_SHARED); + notification.colorBack = RGB(210, 210, 150); + notification.colorText = RGB(0, 0, 0); notification.iSeconds = 10; g_hntfWarning = RegisterNotification(¬ification); mir_strncpy(notification.lpzGroup, "Misc", sizeof(notification.lpzName)); mir_strncpy(notification.lpzName, "Notification", sizeof(notification.lpzName)); - notification.lchIcon = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_MB_INFO), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR|LR_SHARED); - notification.colorBack = RGB(230,230,230); - notification.colorText = RGB(0,0,0); + notification.lchIcon = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_MB_INFO), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR | LR_SHARED); + notification.colorBack = RGB(230, 230, 230); + notification.colorText = RGB(0, 0, 0); notification.iSeconds = 7; g_hntfNotification = RegisterNotification(¬ification); mir_strncpy(notification.lpzGroup, "Misc", sizeof(notification.lpzName)); mir_strncpy(notification.lpzName, "Error", sizeof(notification.lpzName)); - notification.lchIcon = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_MB_STOP), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR|LR_SHARED); - notification.colorBack = RGB(191,0,0); - notification.colorText = RGB(255,245,225); + notification.lchIcon = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_MB_STOP), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR | LR_SHARED); + notification.colorBack = RGB(191, 0, 0); + notification.colorText = RGB(255, 245, 225); notification.iSeconds = -1; g_hntfError = RegisterNotification(¬ification); } @@ -84,7 +84,7 @@ void FreePopupClass(POPUPTREEDATA *ptd) void UnloadTreeData() { - for (int i=0; i < gTreeData.getCount(); ++i) + for (int i = 0; i < gTreeData.getCount(); ++i) FreePopupClass(gTreeData[i]); gTreeData.destroy(); } @@ -92,15 +92,15 @@ void UnloadTreeData() void SaveNotificationSettings(POPUPTREEDATA *ptd, char* szModul) { if (ptd->typ == 1) { - char setting[2*MAXMODULELABELLENGTH]; + char setting[2 * MAXMODULELABELLENGTH]; mir_snprintf(setting, SIZEOF(setting), "{%s/%s}Timeout", ptd->notification.lpzGroup, ptd->notification.lpzName); db_set_w(NULL, szModul, setting, ptd->notification.iSeconds); - mir_snprintf(setting, SIZEOF(setting), "{%s/%s}enabled", - ptd->notification.lpzGroup, + mir_snprintf(setting, SIZEOF(setting), "{%s/%s}enabled", + ptd->notification.lpzGroup, ptd->notification.lpzName); db_set_b(NULL, szModul, setting, ptd->enabled); @@ -124,7 +124,7 @@ void SaveNotificationSettings(POPUPTREEDATA *ptd, char* szModul) ptd->notification.lpzName); db_set_s(NULL, szModul, setting, ptd->rightAction); - for (int i=0; i < ptd->notification.actionCount; ++i) { + for (int i = 0; i < ptd->notification.actionCount; ++i) { POPUPNOTIFYACTION &p = ptd->notification.lpActions[i]; if (!mir_strcmp(ptd->leftAction, p.lpzTitle)) db_set(NULL, p.lpzLModule, p.lpzLSetting, &p.dbvLData); @@ -138,21 +138,21 @@ void SaveNotificationSettings(POPUPTREEDATA *ptd, char* szModul) void LoadNotificationSettings(POPUPTREEDATA *ptd, char* szModul) { if (ptd->typ == 1) { - char setting[2*MAXMODULELABELLENGTH]; + char setting[2 * MAXMODULELABELLENGTH]; char *szTmp = NULL; mir_snprintf(setting, SIZEOF(setting), "{%s/%s}enabled", ptd->notification.lpzGroup, ptd->notification.lpzName); - ptd->enabled = + ptd->enabled = (signed char)db_get_b(NULL, szModul, setting, TRUE); mir_snprintf(setting, SIZEOF(setting), "{%s/%s}Timeout", ptd->notification.lpzGroup, ptd->notification.lpzName); - ptd->notification.iSeconds = + ptd->notification.iSeconds = (signed char)db_get_w(NULL, szModul, setting, ptd->notification.iSeconds); mir_snprintf(setting, SIZEOF(setting), "{%s/%s}TimeoutVal", ptd->notification.lpzGroup, ptd->notification.lpzName); ptd->timeoutValue = (signed char)db_get_w(NULL, szModul, setting, - ptd->notification.iSeconds ? ptd->notification.iSeconds : 0); + ptd->notification.iSeconds ? ptd->notification.iSeconds : 0); mir_snprintf(setting, SIZEOF(setting), "{%s/%s}disableWhen", ptd->notification.lpzGroup, ptd->notification.lpzName); ptd->disableWhen = @@ -172,7 +172,7 @@ void LoadNotificationSettings(POPUPTREEDATA *ptd, char* szModul) HANDLE RegisterNotification(POPUPNOTIFICATION *notification) { - POPUPTREEDATA *ptd = (POPUPTREEDATA *)mir_alloc(sizeof(POPUPTREEDATA)); + POPUPTREEDATA *ptd = (POPUPTREEDATA *)mir_alloc(sizeof(POPUPTREEDATA)); ptd->signature = PopupNotificationData_SIGNATURE; ptd->typ = 1; ptd->pszTreeRoot = mir_a2t(notification->lpzGroup); @@ -183,9 +183,9 @@ HANDLE RegisterNotification(POPUPNOTIFICATION *notification) LoadNotificationSettings(ptd, "PopupNotifications"); // ugly hack to make reset always possible - SaveNotificationSettings(ptd,"PopupNotifications"); + SaveNotificationSettings(ptd, "PopupNotifications"); - FontID fontid = {0}; + FontID fontid = { 0 }; fontid.cbSize = sizeof(fontid); mir_snprintf(fontid.group, SIZEOF(fontid.group), PU_FNT_AND_COLOR"/%s", notification->lpzGroup); mir_strcpy(fontid.dbSettingsGroup, "PopupNotifications"); @@ -200,7 +200,7 @@ HANDLE RegisterNotification(POPUPNOTIFICATION *notification) fontid.deffontsettings.style = 0; FontRegister(&fontid); - ColourID colourid = {0}; + ColourID colourid = { 0 }; colourid.cbSize = sizeof(colourid); mir_snprintf(colourid.group, SIZEOF(colourid.group), PU_FNT_AND_COLOR"/%s", notification->lpzGroup); mir_strcpy(colourid.dbSettingsGroup, "PopupNotifications"); @@ -227,11 +227,11 @@ HANDLE RegisterNotification(POPUPNOTIFICATION *notification) HANDLE FindTreeData(LPTSTR group, LPTSTR name, BYTE typ) { - for(int i=0; i < gTreeData.getCount(); i++) { + for (int i = 0; i < gTreeData.getCount(); i++) { POPUPTREEDATA *p = gTreeData[i]; - if (p->typ == typ && - (!group || (_tcscmp(p->pszTreeRoot, group) == 0)) && - (!name || (_tcscmp(p->pszDescription, name) == 0))) + if (p->typ == typ && + (!group || (_tcscmp(p->pszTreeRoot, group) == 0)) && + (!name || (_tcscmp(p->pszDescription, name) == 0))) { return p; } @@ -252,13 +252,13 @@ void FillNotificationData(POPUPDATA2 *ppd, DWORD *disableWhen) *disableWhen = ptd->enabled ? ptd->disableWhen : 0xFFFFFFFF; LOGFONTA lf; // dummy to make FS happy (use LOGFONTA coz we use MS_FONT_GET) - FontID fontid = {0}; // use ansi version of fontID coz POPUPNOTIFICATION use char + FontID fontid = { 0 }; // use ansi version of fontID coz POPUPNOTIFICATION use char fontid.cbSize = sizeof(fontid); mir_snprintf(fontid.group, SIZEOF(fontid.group), PU_FNT_AND_COLOR"/%s", ptd->notification.lpzGroup); mir_snprintf(fontid.name, SIZEOF(fontid.name), "%s (colors only)", ptd->notification.lpzName); ppd->colorText = (COLORREF)CallService(MS_FONT_GET, (WPARAM)&fontid, (LPARAM)&lf); - ColourID colourid = {0}; // use ansi version of ColourID coz POPUPNOTIFICATION use char + ColourID colourid = { 0 }; // use ansi version of ColourID coz POPUPNOTIFICATION use char colourid.cbSize = sizeof(colourid); mir_snprintf(colourid.group, SIZEOF(colourid.group), PU_FNT_AND_COLOR"/%s", ptd->notification.lpzGroup); mir_snprintf(colourid.name, SIZEOF(colourid.name), "%s (colors only)", ptd->notification.lpzName); @@ -279,7 +279,7 @@ bool IsValidNotification(HANDLE hNotification) if (((POPUPTREEDATA *)hNotification)->signature == PopupNotificationData_SIGNATURE) res = true; } - __except(EXCEPTION_EXECUTE_HANDLER) + __except (EXCEPTION_EXECUTE_HANDLER) { res = false; } @@ -295,18 +295,18 @@ bool PerformAction(HANDLE hNotification, HWND hwnd, UINT message, WPARAM wparam, char *lpzAction = NULL; switch (message) { - case WM_LBUTTONUP: - case WM_COMMAND: - lpzAction = ptd->leftAction; - break; - - case WM_RBUTTONUP: - case WM_CONTEXTMENU: - lpzAction = ptd->rightAction; - break; - - default: - return false; + case WM_LBUTTONUP: + case WM_COMMAND: + lpzAction = ptd->leftAction; + break; + + case WM_RBUTTONUP: + case WM_CONTEXTMENU: + lpzAction = ptd->rightAction; + break; + + default: + return false; } if (!mir_strcmp(lpzAction, POPUP_ACTION_NOTHING)) @@ -318,7 +318,7 @@ bool PerformAction(HANDLE hNotification, HWND hwnd, UINT message, WPARAM wparam, return true; } - for (int i=0; i < ptd->notification.actionCount; ++i) + for (int i = 0; i < ptd->notification.actionCount; ++i) { if (!(ptd->notification.lpActions[i].dwFlags&PNAF_CALLBACK)) continue; diff --git a/plugins/Popup/src/notifications.h b/plugins/Popup/src/notifications.h index eb8a8e094f..4c8547d2f9 100644 --- a/plugins/Popup/src/notifications.h +++ b/plugins/Popup/src/notifications.h @@ -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 diff --git a/plugins/Popup/src/opt_adv.cpp b/plugins/Popup/src/opt_adv.cpp index aa4678d0f4..9275cf30ac 100644 --- a/plugins/Popup/src/opt_adv.cpp +++ b/plugins/Popup/src/opt_adv.cpp @@ -461,7 +461,7 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM PopupOptions.FadeIn = SETTING_FADEINTIME_MIN; else if (fade > SETTING_FADEINTIME_MAX) PopupOptions.FadeIn = SETTING_FADEINTIME_MAX; - if (fade != PopupOptions.FadeIn) { + if (fade != (int)PopupOptions.FadeIn) { SetDlgItemInt(hwnd, idCtrl, PopupOptions.FadeIn, FALSE); ErrorMSG(SETTING_FADEINTIME_MIN, SETTING_FADEINTIME_MAX); SetFocus((HWND)lParam); @@ -475,7 +475,7 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM PopupOptions.FadeOut = SETTING_FADEOUTTIME_MIN; else if (fade > SETTING_FADEOUTTIME_MAX) PopupOptions.FadeOut = SETTING_FADEOUTTIME_MAX; - if (fade != PopupOptions.FadeOut) { + if (fade != (int)PopupOptions.FadeOut) { SetDlgItemInt(hwnd, idCtrl, PopupOptions.FadeOut, FALSE); ErrorMSG(SETTING_FADEOUTTIME_MIN, SETTING_FADEOUTTIME_MAX); SetFocus((HWND)lParam); diff --git a/plugins/Popup/src/opt_class.cpp b/plugins/Popup/src/opt_class.cpp index dfdd247016..d7ea7b264a 100644 --- a/plugins/Popup/src/opt_class.cpp +++ b/plugins/Popup/src/opt_class.cpp @@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. //--------------------------------------------------------------------------- // Workaround for MS bug ComboBox_SelectItemData -int ComboBox_SelectItem(HWND hwndCtl, int indexStart, char* data) { +int ComboBox_SelectItem(HWND hwndCtl, char* data) { int i=0; for ( i ; i < ComboBox_GetCount(hwndCtl); i++) { if (strcmp(data, (char*)ComboBox_GetItemData(hwndCtl, i))==0) { @@ -245,8 +245,6 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l if (tvi.lParam) { POPUPTREEDATA* ptd = (POPUPTREEDATA *)tvi.lParam; - LPTSTR psztSelect = NULL; - int index = 0; // combo left action (default) HWND hCtrl = GetDlgItem(hwnd, IDC_LACTION); @@ -311,10 +309,10 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l CheckDlgButton(hwnd, IDC_ENABLE, ptd->enabled ? BST_CHECKED : BST_UNCHECKED); // combo left action (SELECT) hCtrl = GetDlgItem(hwnd, IDC_LACTION); - ComboBox_SelectItem (hCtrl, -1, ptd->leftAction); // use Workaround for MS bug ComboBox_SelectItemData + ComboBox_SelectItem (hCtrl, ptd->leftAction); // use Workaround for MS bug ComboBox_SelectItemData // combo right action (SELECT) hCtrl = GetDlgItem(hwnd, IDC_RACTION); - ComboBox_SelectItem (hCtrl, -1, ptd->rightAction); // use Workaround for MS bug ComboBox_SelectItemData + ComboBox_SelectItem (hCtrl, ptd->rightAction); // use Workaround for MS bug ComboBox_SelectItemData } // end if (tvi.lParam) else { // enable / disable controls @@ -388,7 +386,7 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l for (i = 0; i < SIZEOF(statusButtons); ++i) { if (IsDlgButtonChecked(hwnd, statusButtons[i].idCtrl)) ptd->disableWhen |= statusButtons[i].disableWhenFlag; - if (idCtrl == statusButtons[i].idCtrl) + if (idCtrl == (UINT)statusButtons[i].idCtrl) SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); } } diff --git a/plugins/Popup/src/opt_contacts.cpp b/plugins/Popup/src/opt_contacts.cpp index c20327a275..59532d3325 100644 --- a/plugins/Popup/src/opt_contacts.cpp +++ b/plugins/Popup/src/opt_contacts.cpp @@ -36,11 +36,11 @@ static void sttSetAllContactIcons(HWND hwndList) for (int i = 0; i < 4 /*SIZEOF(sttIcons)*/; ++i) // hIml element [0] = SKINICON_OTHER_SMALLDOT // hIml element [1..5] = IcoLib_GetIcon(....) ~ old sttIcons - SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(i, (dwMode == i) ? i + 1 : 0)); + SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(i, ((int)dwMode == i) ? i + 1 : 0)); } } -INT_PTR CALLBACK DlgProcContactOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) +INT_PTR CALLBACK DlgProcContactOpts(HWND hwnd, UINT msg, WPARAM, LPARAM lParam) { switch (msg) { case WM_INITDIALOG: diff --git a/plugins/Popup/src/opt_gen.cpp b/plugins/Popup/src/opt_gen.cpp index 3a3f0594d3..432459af12 100644 --- a/plugins/Popup/src/opt_gen.cpp +++ b/plugins/Popup/src/opt_gen.cpp @@ -602,7 +602,7 @@ void Check_ReorderPopups(HWND hwnd) { if (hwnd) CheckDlgButton(hwnd, IDC_REORDERPOPUPS, PopupOptions.ReorderPopups ? BST_CHECKED : BST_UNCHECKED); } -INT_PTR CALLBACK PositionBoxDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +INT_PTR CALLBACK PositionBoxDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM) { LOGFONT lf; static HFONT hFontTitle = 0; diff --git a/plugins/Popup/src/opt_skins.cpp b/plugins/Popup/src/opt_skins.cpp index 5cf38b25b1..c1c6a533c2 100644 --- a/plugins/Popup/src/opt_skins.cpp +++ b/plugins/Popup/src/opt_skins.cpp @@ -175,7 +175,6 @@ LRESULT CALLBACK WndProcPreviewBox(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP int SkinOptionList_AddSkin(OPTTREE_OPTION* &options, int *OptionsCount, int pos, DWORD *dwGlobalOptions) { const PopupSkin *skin = 0; - LPTSTR pszName = NULL; if (skin = skins.getSkin(PopupOptions.SkinPack)) { for (int i = 1; i <= 10; i++) { if (!skin->getFlagName(i)) @@ -357,7 +356,6 @@ INT_PTR CALLBACK DlgProcPopSkinsOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR // Skin List hCtrl = GetDlgItem(hwndDlg, IDC_SKINLIST); ListBox_ResetContent(hCtrl); - LPTSTR Temp = NULL; for (const Skins::SKINLIST *sl = skins.getSkinList(); sl; sl = sl->next) { dwIndex = ListBox_AddString(hCtrl, sl->name); @@ -406,11 +404,10 @@ INT_PTR CALLBACK DlgProcPopSkinsOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR case IDC_BTN_RELOAD: { - LPTSTR Temp = NULL; DWORD dwIndex = 0; TCHAR szNewSkin[128]; LPTSTR pszOldSkin = mir_tstrdup(PopupOptions.SkinPack); - skins.load(_T("")); + skins.load(); hCtrl = GetDlgItem(hwndDlg, IDC_SKINLIST); ListBox_ResetContent(hCtrl); for (const Skins::SKINLIST *sl = skins.getSkinList(); sl; sl = sl->next) @@ -473,7 +470,6 @@ INT_PTR CALLBACK DlgProcPopSkinsOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR }// end switch (HIWORD(wParam)) break; }// end WM_COMMAND - return FALSE; case WM_NOTIFY: if (!bDlgInit) return FALSE; diff --git a/plugins/Popup/src/opttree.cpp b/plugins/Popup/src/opttree.cpp index dd85cc81d0..b4481864d0 100644 --- a/plugins/Popup/src/opttree.cpp +++ b/plugins/Popup/src/opttree.cpp @@ -146,7 +146,7 @@ HTREEITEM OptTree_AddItem(HWND hwndTree, LPTSTR name, LPARAM lParam, int iconInd return result; } -BOOL OptTree_ProcessMessage(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, int *result, int idcTree, OPTTREE_OPTION *options, int optionCount) +BOOL OptTree_ProcessMessage(HWND hwnd, UINT msg, WPARAM, LPARAM lparam, int *result, int idcTree, OPTTREE_OPTION *options, int optionCount) { HWND hwndTree = GetDlgItem(hwnd, idcTree); switch (msg) @@ -238,7 +238,7 @@ BOOL OptTree_ProcessMessage(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, i case WM_NOTIFY: { LPNMHDR lpnmhdr = (LPNMHDR)lparam; - if (lpnmhdr->idFrom != idcTree) + if (lpnmhdr->idFrom != (UINT)idcTree) break; switch (lpnmhdr->code) { diff --git a/plugins/Popup/src/popup_gdiplus.cpp b/plugins/Popup/src/popup_gdiplus.cpp index c85f756c75..bf81780e79 100644 --- a/plugins/Popup/src/popup_gdiplus.cpp +++ b/plugins/Popup/src/popup_gdiplus.cpp @@ -1,10 +1,10 @@ /* Popup Plus plugin for Miranda IM -Copyright � 2002 Luca Santarelli, - � 2004-2007 Victor Pavlychko - � 2010 MPK - � 2010 Merlin_de +Copyright © 2002 Luca Santarelli, +© 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 @@ -43,7 +43,7 @@ void LoadGDIPlus() if (g_gdiplusToken == 0) Gdiplus::GdiplusStartup(&g_gdiplusToken, &gdiplusStartupInput, NULL); } - __except ( EXCEPTION_EXECUTE_HANDLER ) { + __except (EXCEPTION_EXECUTE_HANDLER) { gbGdiPlusLoaded = false; } } @@ -55,11 +55,11 @@ void UnloadGDIPlus() if (g_gdiplusToken && gbGdiPlusLoaded) Gdiplus::GdiplusShutdown(g_gdiplusToken); } - __except ( EXCEPTION_EXECUTE_HANDLER ) { + __except (EXCEPTION_EXECUTE_HANDLER) { // do nothing - } + } gbGdiPlusLoaded = true; - g_gdiplusToken = 0; + g_gdiplusToken = 0; } using namespace Gdiplus; @@ -71,37 +71,37 @@ using namespace Gdiplus; HBITMAP SkinEngine_CreateDIB32(int cx, int cy) { - if ( cx < 0 || cy < 0 ) { - return NULL; - } - - BITMAPINFO RGB32BitsBITMAPINFO; - memset(&RGB32BitsBITMAPINFO, 0, sizeof(BITMAPINFO)); - RGB32BitsBITMAPINFO.bmiHeader.biSize=sizeof(BITMAPINFOHEADER); - RGB32BitsBITMAPINFO.bmiHeader.biWidth=cx;// bm.bmWidth; - RGB32BitsBITMAPINFO.bmiHeader.biHeight=cy;// bm.bmHeight; - RGB32BitsBITMAPINFO.bmiHeader.biPlanes=1; - RGB32BitsBITMAPINFO.bmiHeader.biBitCount=32; - // pointer used for direct Bitmap pixels access - - - UINT *ptPixels; - HBITMAP DirectBitmap = CreateDIBSection(NULL, &RGB32BitsBITMAPINFO, DIB_RGB_COLORS, (void **)&ptPixels, NULL, 0); - if ((DirectBitmap == NULL || ptPixels == NULL) && cx!= 0 && cy!=0) - { - ; - } - else + if (cx < 0 || cy < 0) { + return NULL; + } + + BITMAPINFO RGB32BitsBITMAPINFO; + memset(&RGB32BitsBITMAPINFO, 0, sizeof(BITMAPINFO)); + RGB32BitsBITMAPINFO.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + RGB32BitsBITMAPINFO.bmiHeader.biWidth = cx;// bm.bmWidth; + RGB32BitsBITMAPINFO.bmiHeader.biHeight = cy;// bm.bmHeight; + RGB32BitsBITMAPINFO.bmiHeader.biPlanes = 1; + RGB32BitsBITMAPINFO.bmiHeader.biBitCount = 32; + // pointer used for direct Bitmap pixels access + + + UINT *ptPixels; + HBITMAP DirectBitmap = CreateDIBSection(NULL, &RGB32BitsBITMAPINFO, DIB_RGB_COLORS, (void **)&ptPixels, NULL, 0); + if ((DirectBitmap == NULL || ptPixels == NULL) && cx != 0 && cy != 0) + { + ; + } + else { - memset(ptPixels,0,cx*cy*4); + memset(ptPixels, 0, cx*cy * 4); } - return DirectBitmap; + return DirectBitmap; } BOOL GDIPlus_IsAnimatedGIF(TCHAR * szName) { - int nFrameCount=0; + int nFrameCount = 0; Image image(szName); UINT count = image.GetFrameDimensionsCount(); @@ -113,9 +113,9 @@ BOOL GDIPlus_IsAnimatedGIF(TCHAR * szName) // Get the number of frames in the first dimension. nFrameCount = image.GetFrameCount(&pDimensionIDs[0]); - delete []pDimensionIDs; + delete[]pDimensionIDs; - return (BOOL) (nFrameCount > 1) && image.GetWidth() && image.GetHeight(); + return (BOOL)(nFrameCount > 1) && image.GetWidth() && image.GetHeight(); } void GDIPlus_GetGIFSize(TCHAR * szName, int * width, int * height) @@ -128,9 +128,9 @@ void GDIPlus_GetGIFSize(TCHAR * szName, int * width, int * height) void GDIPlus_ExtractAnimatedGIF(TCHAR * szName, int width, int height, HBITMAP * pBitmap, int ** pframesDelay, int * pframesCount, SIZE * pSizeAvatar) { - int nFrameCount=0; + int nFrameCount = 0; Bitmap image(szName); - PropertyItem * pPropertyItem; + PropertyItem * pPropertyItem; UINT count = 0; @@ -148,60 +148,51 @@ void GDIPlus_ExtractAnimatedGIF(TCHAR * szName, int width, int height, HBITMAP * int nSize = image.GetPropertyItemSize(PropertyTagFrameDelay); // Allocate a buffer to receive the property item. - pPropertyItem = (PropertyItem*) mir_alloc(nSize); + pPropertyItem = (PropertyItem*)mir_alloc(nSize); image.GetPropertyItem(PropertyTagFrameDelay, nSize, pPropertyItem); - + int clipWidth; int clipHeight; - int imWidth=image.GetWidth(); - int imHeight=image.GetHeight(); - float xscale=(float)width/imWidth; - float yscale=(float)height/imHeight; - xscale=min(xscale,yscale); - clipWidth=(int)(xscale*imWidth+.5); - clipHeight=(int)(xscale*imHeight+.5); - - HBITMAP hBitmap=SkinEngine_CreateDIB32(clipWidth*nFrameCount, height); - HDC hdc=CreateCompatibleDC(NULL); - HBITMAP oldBmp=(HBITMAP)SelectObject(hdc,hBitmap); + int imWidth = image.GetWidth(); + int imHeight = image.GetHeight(); + float xscale = (float)width / imWidth; + float yscale = (float)height / imHeight; + xscale = min(xscale, yscale); + clipWidth = (int)(xscale*imWidth + .5); + clipHeight = (int)(xscale*imHeight + .5); + + HBITMAP hBitmap = SkinEngine_CreateDIB32(clipWidth*nFrameCount, height); + HDC hdc = CreateCompatibleDC(NULL); + HBITMAP oldBmp = (HBITMAP)SelectObject(hdc, hBitmap); Graphics graphics(hdc); ImageAttributes attr; - ColorMatrix ClrMatrix = - { - 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 0.0f, ((float)255)/255, 0.0f, - 0.0f, 0.0f, 0.0f, 0.0f, 1.0f - }; - // attr.SetColorMatrix(&ClrMatrix, ColorMatrixFlagsDefault,ColorAdjustTypeBitmap); graphics.SetInterpolationMode(InterpolationModeHighQualityBicubic); - int * delays=(int*)mir_alloc(nFrameCount*sizeof(int)); - memset(delays,0,nFrameCount*sizeof(int)); + int * delays = (int*)mir_alloc(nFrameCount*sizeof(int)); + memset(delays, 0, nFrameCount*sizeof(int)); - for (int i=1; ivalue)[i-1] * 10; - delays[i-1]=(int)lPause; + long lPause = ((long*)pPropertyItem->value)[i - 1] * 10; + delays[i - 1] = (int)lPause; } - SelectObject(hdc,oldBmp); + SelectObject(hdc, oldBmp); DeleteDC(hdc); mir_free(pPropertyItem); pPropertyItem = NULL; - delete []pDimensionIDs; + delete[]pDimensionIDs; if (pBitmap && pframesDelay && pframesCount && pSizeAvatar) { - *pBitmap=hBitmap; - *pframesDelay=delays; - *pframesCount=nFrameCount; - pSizeAvatar->cx=clipWidth; - pSizeAvatar->cy=clipHeight; + *pBitmap = hBitmap; + *pframesDelay = delays; + *pframesCount = nFrameCount; + pSizeAvatar->cx = clipWidth; + pSizeAvatar->cy = clipHeight; } GdiFlush(); } diff --git a/plugins/Popup/src/popup_gdiplus.h b/plugins/Popup/src/popup_gdiplus.h index 86a9de63de..acdec1f3d8 100644 --- a/plugins/Popup/src/popup_gdiplus.h +++ b/plugins/Popup/src/popup_gdiplus.h @@ -1,10 +1,10 @@ /* Popup Plus plugin for Miranda IM -Copyright � 2002 Luca Santarelli, - � 2004-2007 Victor Pavlychko - � 2010 MPK - � 2010 Merlin_de +Copyright © 2002 Luca Santarelli, +© 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 diff --git a/plugins/Popup/src/popup_thread.cpp b/plugins/Popup/src/popup_thread.cpp index 73c406a9b6..29f45dc3d7 100644 --- a/plugins/Popup/src/popup_thread.cpp +++ b/plugins/Popup/src/popup_thread.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 @@ -36,9 +36,9 @@ static LIST popupList(3); // forwards enum -{ +{ // message id's - UTM_PT_FIRST = WM_USER+1607, + UTM_PT_FIRST = WM_USER + 1607, UTM_STOP_THREAD, UTM_ADD_WINDOW, UTM_UPDATE_WINDOW, @@ -56,30 +56,30 @@ bool UpdatePopupPosition(PopupWnd2 *prev, PopupWnd2 *wnd) int POPUP_SPACING = PopupOptions.spacing; - POINT pos; - SIZE prevSize = {0}, curSize = wnd->getSize(); + POINT pos = { 0 }; + SIZE prevSize = { 0 }; if (prev) prevSize = prev->getSize(); // we have only one monitor (cant check it together with 1.if) RECT rc; - if ( GetSystemMetrics(SM_CMONITORS) == 1) + if (GetSystemMetrics(SM_CMONITORS) == 1) SystemParametersInfo(SPI_GETWORKAREA, 0, &rc, 0); else { // Multimonitor stuff (we have more then 1) HWND hWnd; if (PopupOptions.Monitor == MN_MIRANDA) - hWnd = (HWND)CallService(MS_CLUI_GETHWND,0,0); + hWnd = (HWND)CallService(MS_CLUI_GETHWND, 0, 0); else // PopupOptions.Monitor == MN_ACTIVE hWnd = GetForegroundWindow(); HMONITOR hMonitor = MonitorFromWindow(hWnd, MONITOR_DEFAULTTOPRIMARY); - MONITORINFOEX mnti; + MONITORINFOEX mnti; mnti.cbSize = sizeof(MONITORINFOEX); - if ( GetMonitorInfo(hMonitor, &mnti) == TRUE) + if (GetMonitorInfo(hMonitor, &mnti) == TRUE) memcpy(&rc, &(mnti.rcWork), sizeof(RECT)); else - SystemParametersInfo(SPI_GETWORKAREA,0,&rc,0); + SystemParametersInfo(SPI_GETWORKAREA, 0, &rc, 0); } rc.left += PopupOptions.gapLeft - POPUP_SPACING; @@ -134,7 +134,7 @@ void RepositionPopups() { PopupWnd2 *prev = 0; if (PopupOptions.ReorderPopups) { - for (int i=0; i < popupList.getCount(); ++i) { + for (int i = 0; i < popupList.getCount(); ++i) { UpdatePopupPosition(prev, popupList[i]); prev = popupList[i]; } @@ -152,7 +152,7 @@ static LRESULT CALLBACK PopupThreadManagerWndProc(HWND hwnd, UINT message, WPARA case UTM_STOP_THREAD: gTerminating = true; if (db_get_b(NULL, MODULNAME, "FastExit", 0)) - for (int i=0; i < popupList.getCount(); ++i) + for (int i = 0; i < popupList.getCount(); ++i) PUDeletePopup(popupList[i]->getHwnd()); PostQuitMessage(0); break; @@ -160,7 +160,7 @@ static LRESULT CALLBACK PopupThreadManagerWndProc(HWND hwnd, UINT message, WPARA case UTM_ADD_WINDOW: if (gTerminating) break; - UpdatePopupPosition(popupList.getCount() ? popupList[popupList.getCount()-1] : 0, wnd); + UpdatePopupPosition(popupList.getCount() ? popupList[popupList.getCount() - 1] : 0, wnd); popupList.insert(wnd); ++nPopups; wnd->callMethodAsync(&PopupWnd2::m_show, 0); @@ -178,15 +178,15 @@ static LRESULT CALLBACK PopupThreadManagerWndProc(HWND hwnd, UINT message, WPARA break; case UTM_REMOVE_WINDOW: - { - for (int i=popupList.getCount()-1; i >= 0; i--) - if (popupList[i] == wnd) - popupList.remove(i); - } - RepositionPopups(); - --nPopups; - delete wnd; - break; + { + for (int i = popupList.getCount() - 1; i >= 0; i--) + if (popupList[i] == wnd) + popupList.remove(i); + } + RepositionPopups(); + --nPopups; + delete wnd; + break; case UTM_LOCK_QUEUE: ++gLockCount; @@ -202,7 +202,7 @@ static LRESULT CALLBACK PopupThreadManagerWndProc(HWND hwnd, UINT message, WPARA } // thread func -static unsigned __stdcall PopupThread(void *arg) +static unsigned __stdcall PopupThread(void *) { // Create manager window DWORD err; @@ -218,7 +218,7 @@ static unsigned __stdcall PopupThread(void *arg) wcl.hbrBackground = (HBRUSH)GetStockObject(LTGRAY_BRUSH); wcl.lpszMenuName = NULL; wcl.lpszClassName = _T("PopupThreadManagerWnd"); - wcl.hIconSm = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_POPUP), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR); + wcl.hIconSm = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_POPUP), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR); g_wndClass.cPopupThreadManagerWnd = RegisterClassEx(&wcl); err = GetLastError(); if (!g_wndClass.cPopupThreadManagerWnd) { @@ -228,7 +228,7 @@ static unsigned __stdcall PopupThread(void *arg) } gHwndManager = CreateWindow(_T("PopupThreadManagerWnd"), NULL, 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP, NULL, hInst, NULL); - SetWindowPos(gHwndManager, 0, 0, 0, 0, 0, SWP_NOZORDER|SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE|SWP_DEFERERASE|SWP_NOSENDCHANGING|SWP_HIDEWINDOW); + SetWindowPos(gHwndManager, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOSENDCHANGING | SWP_HIDEWINDOW); MSG msg; while (GetMessage(&msg, NULL, 0, 0)) { @@ -260,7 +260,7 @@ void UnloadPopupThread() WaitForSingleObject(hThread, INFINITE); CloseHandle(hThread); - for (int i=0; i < popupList.getCount(); ++i) + for (int i = 0; i < popupList.getCount(); ++i) delete popupList[i]; popupList.destroy(); } diff --git a/plugins/Popup/src/popup_thread.h b/plugins/Popup/src/popup_thread.h index e4e754f6be..f56f5f1d1b 100644 --- a/plugins/Popup/src/popup_thread.h +++ b/plugins/Popup/src/popup_thread.h @@ -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 diff --git a/plugins/Popup/src/popup_wnd2.cpp b/plugins/Popup/src/popup_wnd2.cpp index 3763451ef6..c22d744463 100644 --- a/plugins/Popup/src/popup_wnd2.cpp +++ b/plugins/Popup/src/popup_wnd2.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 @@ -64,17 +64,17 @@ bool LoadPopupWnd2() wcl.hbrBackground = (HBRUSH)GetStockObject(LTGRAY_BRUSH); wcl.lpszMenuName = NULL; wcl.lpszClassName = _T(POPUP_WNDCLASS); - wcl.hIconSm = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_POPUP), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR); + wcl.hIconSm = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_POPUP), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR); g_wndClass.cPopupWnd2 = RegisterClassEx(&wcl); DWORD err = GetLastError(); if (!g_wndClass.cPopupWnd2) { res = false; TCHAR msg[1024]; mir_sntprintf(msg, SIZEOF(msg), TranslateT("Failed to register %s class."), wcl.lpszClassName); - MessageBox(NULL, msg, _T(MODULNAME_LONG), MB_ICONSTOP|MB_OK); + MessageBox(NULL, msg, _T(MODULNAME_LONG), MB_ICONSTOP | MB_OK); } - WNDCLASSEXW wclw = {0}; + WNDCLASSEXW wclw = { 0 }; wclw.cbSize = sizeof(wclw); if (!GetClassInfoEx(NULL, _T("EDIT"), &wclw)) MSGERROR(TranslateT("Failed to GetClassInfoExW from EDIT class.")); @@ -126,9 +126,9 @@ bool LoadPopupWnd2() } ghwndMenuHost = CreateWindow(_T("PopupMenuHostWnd"), NULL, 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP, NULL, hInst, NULL); - SetWindowPos(ghwndMenuHost, 0, 0, 0, 0, 0, SWP_NOZORDER|SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE|SWP_DEFERERASE|SWP_NOSENDCHANGING|SWP_HIDEWINDOW); + SetWindowPos(ghwndMenuHost, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOSENDCHANGING | SWP_HIDEWINDOW); - INITCOMMONCONTROLSEX iccex; + INITCOMMONCONTROLSEX iccex; iccex.dwICC = ICC_WIN95_CLASSES; iccex.dwSize = sizeof(INITCOMMONCONTROLSEX); InitCommonControlsEx(&iccex); @@ -169,7 +169,7 @@ PopupWnd2::~PopupWnd2() delete m_bmpBase; delete m_bmpAnimate; delete m_avatar; - delete []m_actions; + delete[]m_actions; if (m_mtText) MText.Destroy(m_mtText); if (m_mtTitle) MText.Destroy(m_mtTitle); @@ -183,11 +183,11 @@ void PopupWnd2::startThread() void PopupWnd2::create() { m_hwnd = CreateWindowEx( - WS_EX_TRANSPARENT| // prevents unwanted clicks - WS_EX_TOOLWINDOW|WS_EX_TOPMOST, // dwStyleEx + WS_EX_TRANSPARENT | // prevents unwanted clicks + WS_EX_TOOLWINDOW | WS_EX_TOPMOST, // dwStyleEx _T(POPUP_WNDCLASS), // Class name NULL, // Title - DS_SETFONT|DS_FIXEDSYS|WS_POPUP, // dwStyle + DS_SETFONT | DS_FIXEDSYS | WS_POPUP, // dwStyle CW_USEDEFAULT, // x CW_USEDEFAULT, // y CW_USEDEFAULT, // Width @@ -223,14 +223,14 @@ void PopupWnd2::updateLayered(BYTE opacity) if (SetWindowLongPtr(m_hwnd, GWL_EXSTYLE, GetWindowLongPtr(m_hwnd, GWL_EXSTYLE) | WS_EX_LAYERED)) { RECT rc; GetWindowRect(m_hwnd, &rc); - POINT ptDst = {rc.left, rc.top}; - POINT ptSrc = {0, 0}; + POINT ptDst = { rc.left, rc.top }; + POINT ptSrc = { 0, 0 }; BLENDFUNCTION blend; - blend.BlendOp = AC_SRC_OVER; - blend.BlendFlags = 0; + blend.BlendOp = AC_SRC_OVER; + blend.BlendFlags = 0; blend.SourceConstantAlpha = opacity; // m_options->UseTransparency ? opacity : 255; - blend.AlphaFormat = AC_SRC_ALPHA; + blend.AlphaFormat = AC_SRC_ALPHA; UpdateLayeredWindow(m_hwnd, NULL, &ptDst, &m_sz, m_bmpAnimate ? m_bmpAnimate->getDC() : m_bmp->getDC(), @@ -242,18 +242,18 @@ void PopupWnd2::updateLayered(BYTE opacity) SIZE PopupWnd2::measure() { - const PopupSkin *skin = skins.getSkin(m_lpzSkin?m_lpzSkin:m_options->SkinPack); + const PopupSkin *skin = skins.getSkin(m_lpzSkin ? m_lpzSkin : m_options->SkinPack); if (!skin) return m_sz; - MyBitmap bmpTmp(1,1); + MyBitmap bmpTmp(1, 1); skin->measure(bmpTmp.getDC(), this, m_options->UseMaximumWidth ? m_options->MaximumWidth : SETTING_MAXIMUMWIDTH_MAX, m_options); return m_sz; } void PopupWnd2::update() { - const PopupSkin *skin = skins.getSkin(m_lpzSkin?m_lpzSkin:m_options->SkinPack); + const PopupSkin *skin = skins.getSkin(m_lpzSkin ? m_lpzSkin : m_options->SkinPack); if (!skin) return; // update avatar @@ -268,7 +268,7 @@ void PopupWnd2::update() // measure popup if (m_bmpBase) delete m_bmpBase; if (m_bmpAnimate) delete m_bmpAnimate; - m_bmpBase = new MyBitmap(1,1); + m_bmpBase = new MyBitmap(1, 1); skin->measure(m_bmpBase->getDC(), this, m_options->UseMaximumWidth ? m_options->MaximumWidth : SETTING_MAXIMUMWIDTH_MAX, m_options); // render popup @@ -276,7 +276,7 @@ void PopupWnd2::update() HDC hdc = m_bmpBase->getDC(); if (!skin) return; SetBkMode(hdc, TRANSPARENT); - skin->display(m_bmpBase, this, m_options->UseMaximumWidth ? m_options->MaximumWidth : SETTING_MAXIMUMWIDTH_MAX, m_options, + skin->display(m_bmpBase, this, m_options, PopupSkin::DF_STATIC); if (*m_time && skin->useInternalClock()) { @@ -286,7 +286,7 @@ void PopupWnd2::update() m_bmpBase->Draw_Text(m_time, this->m_sz.cx - sz.cx - STYLE_SZ_GAP - skin->getRightGap(), STYLE_SZ_GAP); SelectObject(m_bmpBase->getDC(), hfnSave); } - + m_bReshapeWindow = true; animate(); @@ -294,21 +294,22 @@ void PopupWnd2::update() void PopupWnd2::animate() { - const PopupSkin *skin = skins.getSkin(m_lpzSkin?m_lpzSkin:m_options->SkinPack); + const PopupSkin *skin = skins.getSkin(m_lpzSkin ? m_lpzSkin : m_options->SkinPack); if (!skin) return; if (m_avatar->isAnimated() || m_actionCount) { if (!m_bmp) m_bmp = new MyBitmap(m_bmpBase->getWidth(), m_bmpBase->getHeight()); m_bmp->Draw(m_bmpBase, 0, 0, m_bmpBase->getWidth(), m_bmpBase->getHeight()); - skin->display(m_bmp, this, m_options->UseMaximumWidth ? m_options->MaximumWidth : SETTING_MAXIMUMWIDTH_MAX, m_options, PopupSkin::DF_ANIMATE); - } else - if (m_bmpBase) - { - if (m_bmp) delete m_bmp; - m_bmp = m_bmpBase; - m_bmpBase = NULL; + skin->display(m_bmp, this, m_options, PopupSkin::DF_ANIMATE); } + else + if (m_bmpBase) + { + if (m_bmp) delete m_bmp; + m_bmp = m_bmpBase; + m_bmpBase = NULL; + } // update layered window if supported updateLayered((m_options->UseTransparency && !(m_bIsHovered && m_options->OpaqueOnHover)) ? m_options->Alpha : 255); @@ -322,8 +323,8 @@ void PopupWnd2::animate() if (MyDwmEnableBlurBehindWindow && PopupOptions.EnableAeroGlass) { - DWM_BLURBEHIND bb = {0}; - bb.dwFlags = DWM_BB_ENABLE|DWM_BB_BLURREGION; + DWM_BLURBEHIND bb = { 0 }; + bb.dwFlags = DWM_BB_ENABLE | DWM_BB_BLURREGION; bb.fEnable = TRUE; bb.hRgnBlur = m_bmp->buildOpaqueRgn(254, false); MyDwmEnableBlurBehindWindow(m_hwnd, &bb); @@ -331,15 +332,15 @@ void PopupWnd2::animate() } // update tooltips - for (int i=0; i < m_actionCount; ++i) { + for (int i = 0; i < m_actionCount; ++i) { char *title = strchr(m_actions[i].actionA.lpzTitle, '/'); if (title) title++; else title = m_actions[i].actionA.lpzTitle; AddTooltipTranslated(m_hwndToolTip, m_hwnd, i, m_actions[i].rc, title); } -// if (!customPopup && hwnd /*&& IsWindowVisible(hwnd)*/) -// PopupThreadUpdateWindow(this); + // if (!customPopup && hwnd /*&& IsWindowVisible(hwnd)*/) + // PopupThreadUpdateWindow(this); } } @@ -365,11 +366,12 @@ void PopupWnd2::show() if (ServiceExists(vfxService)) if (effect = (IPopupPlusEffect *)CallService(vfxService, 0, 0)) { - effect->beginEffect(m_bmp->getWidth(), m_bmp->getHeight(), m_btAlpha0, m_btAlpha1, dwTime1-dwTime0); + effect->beginEffect(m_bmp->getWidth(), m_bmp->getHeight(), m_btAlpha0, m_btAlpha1, dwTime1 - dwTime0); m_bmpAnimate = new MyBitmap(m_bmp->getWidth(), m_bmp->getHeight()); } } - } else + } + else { updateLayered(m_options->UseTransparency ? m_options->Alpha : 255); } @@ -382,10 +384,11 @@ void PopupWnd2::show() m_ptPosition0.x -= m_sz.cx + 2 * 5; else m_ptPosition0.x += m_sz.cx + 2 * 5; - SetWindowPos(m_hwnd, 0, m_ptPosition0.x, m_ptPosition0.y, 0, 0, SWP_NOZORDER|SWP_NOSIZE|SWP_NOACTIVATE|SWP_DEFERERASE|SWP_NOSENDCHANGING|SWP_SHOWWINDOW); - } else + SetWindowPos(m_hwnd, 0, m_ptPosition0.x, m_ptPosition0.y, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOSENDCHANGING | SWP_SHOWWINDOW); + } + else { - SetWindowPos(m_hwnd, 0, m_pos.x, m_pos.y, 0, 0, SWP_NOZORDER|SWP_NOSIZE|SWP_NOACTIVATE|SWP_DEFERERASE|SWP_NOSENDCHANGING|SWP_SHOWWINDOW); + SetWindowPos(m_hwnd, 0, m_pos.x, m_pos.y, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOSENDCHANGING | SWP_SHOWWINDOW); } while ((dwTime = GetTickCount()) < dwTime1) { @@ -410,16 +413,17 @@ void PopupWnd2::show() } effect->endFrame(); updateLayered(255); - } else + } + else { updateLayered(m_btAlpha0 + (m_btAlpha1 - m_btAlpha0) * int(dwTime - dwTime0) / m_options->FadeIn); } } if (m_bSlide) SetWindowPos(m_hwnd, 0, - (int)m_ptPosition0.x + ((int)m_ptPosition1.x - (int)m_ptPosition0.x) * int(dwTime - dwTime0) / (int)m_options->FadeIn, - (int)m_ptPosition0.y + ((int)m_ptPosition1.y - (int)m_ptPosition0.y) * int(dwTime - dwTime0) / (int)m_options->FadeIn, - 0, 0, SWP_NOZORDER|SWP_NOSIZE|SWP_NOACTIVATE|SWP_DEFERERASE|SWP_NOSENDCHANGING|SWP_SHOWWINDOW); + (int)m_ptPosition0.x + ((int)m_ptPosition1.x - (int)m_ptPosition0.x) * int(dwTime - dwTime0) / (int)m_options->FadeIn, + (int)m_ptPosition0.y + ((int)m_ptPosition1.y - (int)m_ptPosition0.y) * int(dwTime - dwTime0) / (int)m_options->FadeIn, + 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOSENDCHANGING | SWP_SHOWWINDOW); UpdateWindow(m_hwnd); Sleep(1); } @@ -437,7 +441,7 @@ void PopupWnd2::show() updateLayered((m_options->UseTransparency && !(m_bIsHovered && m_options->OpaqueOnHover)) ? m_options->Alpha : 255); // updateLayered(m_options->UseTransparency ? m_options->Alpha : 255); - SetWindowPos(m_hwnd, 0, m_pos.x, m_pos.y, 0, 0, SWP_NOZORDER|SWP_NOSIZE|SWP_NOACTIVATE|SWP_DEFERERASE|SWP_NOSENDCHANGING|SWP_SHOWWINDOW); + SetWindowPos(m_hwnd, 0, m_pos.x, m_pos.y, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOSENDCHANGING | SWP_SHOWWINDOW); } void PopupWnd2::hide() @@ -463,7 +467,7 @@ void PopupWnd2::hide() if (ServiceExists(vfxService)) if (effect = (IPopupPlusEffect *)CallService(vfxService, 0, 0)) { - effect->beginEffect(m_bmp->getWidth(), m_bmp->getHeight(), m_btAlpha0, m_btAlpha1, dwTime1-dwTime0); + effect->beginEffect(m_bmp->getWidth(), m_bmp->getHeight(), m_btAlpha0, m_btAlpha1, dwTime1 - dwTime0); m_bmpAnimate = new MyBitmap(m_bmp->getWidth(), m_bmp->getHeight()); } } @@ -477,7 +481,7 @@ void PopupWnd2::hide() m_ptPosition1.x -= m_sz.cx + 2 * 5; else m_ptPosition1.x += m_sz.cx + 2 * 5; - SetWindowPos(m_hwnd, 0, m_ptPosition0.x, m_ptPosition0.y, 0, 0, SWP_NOZORDER|SWP_NOSIZE|SWP_NOACTIVATE|SWP_DEFERERASE|SWP_NOSENDCHANGING|SWP_SHOWWINDOW); + SetWindowPos(m_hwnd, 0, m_ptPosition0.x, m_ptPosition0.y, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOSENDCHANGING | SWP_SHOWWINDOW); } while ((dwTime = GetTickCount()) < dwTime1) { @@ -502,16 +506,17 @@ void PopupWnd2::hide() } effect->endFrame(); updateLayered(255); - } else + } + else { updateLayered((int)m_btAlpha0 + ((int)m_btAlpha1 - (int)m_btAlpha0) * int(dwTime - dwTime0) / (int)m_options->FadeOut); } } if (m_bSlide) SetWindowPos(m_hwnd, 0, - (int)m_ptPosition0.x + ((int)m_ptPosition1.x - (int)m_ptPosition0.x) * int(dwTime - dwTime0) / (int)m_options->FadeOut, - (int)m_ptPosition0.y + ((int)m_ptPosition1.y - (int)m_ptPosition0.y) * int(dwTime - dwTime0) / (int)m_options->FadeOut, - 0, 0, SWP_NOZORDER|SWP_NOSIZE|SWP_NOACTIVATE|SWP_DEFERERASE|SWP_NOSENDCHANGING|SWP_SHOWWINDOW); + (int)m_ptPosition0.x + ((int)m_ptPosition1.x - (int)m_ptPosition0.x) * int(dwTime - dwTime0) / (int)m_options->FadeOut, + (int)m_ptPosition0.y + ((int)m_ptPosition1.y - (int)m_ptPosition0.y) * int(dwTime - dwTime0) / (int)m_options->FadeOut, + 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOSENDCHANGING | SWP_SHOWWINDOW); UpdateWindow(m_hwnd); Sleep(1); } @@ -525,9 +530,9 @@ void PopupWnd2::hide() } } - SetWindowPos(m_hwnd, 0, 0, 0, 0, 0, SWP_NOZORDER|SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE|SWP_DEFERERASE|SWP_NOSENDCHANGING|SWP_HIDEWINDOW); + SetWindowPos(m_hwnd, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOSENDCHANGING | SWP_HIDEWINDOW); DestroyWindow(m_hwnd); -// hwnd = 0; + // hwnd = 0; } bool __forceinline isTextEmpty(TCHAR *text) @@ -543,18 +548,18 @@ bool __forceinline isTextEmpty(TCHAR *text) void PopupWnd2::fixDefaults() { if (m_options->UseWinColors) { - m_clBack = GetSysColor(COLOR_BTNFACE); - m_clText = GetSysColor(COLOR_WINDOWTEXT); - m_clTitle = GetSysColor(COLOR_WINDOWTEXT); - m_clClock = GetSysColor(COLOR_WINDOWTEXT); + m_clBack = GetSysColor(COLOR_BTNFACE); + m_clText = GetSysColor(COLOR_WINDOWTEXT); + m_clTitle = GetSysColor(COLOR_WINDOWTEXT); + m_clClock = GetSysColor(COLOR_WINDOWTEXT); } else if ((m_clBack == (COLORREF)NULL) && (m_clText == (COLORREF)NULL)) { - m_clTitle = fonts.clTitle; - m_clBack = fonts.clBack; - m_clText = fonts.clText; - m_clClock = fonts.clClock; + m_clTitle = fonts.clTitle; + m_clBack = fonts.clBack; + m_clText = fonts.clText; + m_clClock = fonts.clClock; } - else m_clClock = m_clTitle; + else m_clClock = m_clTitle; if (!m_iTimeout) m_iTimeout = m_options->InfiniteDelay ? -1 : m_options->Seconds; @@ -563,7 +568,7 @@ void PopupWnd2::fixDefaults() if (m_hContact) if (!GetContactProto(m_hContact)) m_hContact = NULL; - + switch (m_textType) { case TT_UNICODE: m_bTextEmpty = ::isTextEmpty(m_lptzText); @@ -603,75 +608,75 @@ int PopupWnd2::fixActions(POPUPACTION *theActions, int count) if (enableDefaultGen && (m_iTimeout != -1) && IsActionEnabled("General/Pin popup")) ++m_actionCount; if (enableDefaultGen && IsActionEnabled("General/Dismiss popup")) ++m_actionCount; if (enableDefaultGen && IsActionEnabled("General/Copy to clipboard")) ++m_actionCount; - + int iAction = fixActions(theActions, count, m_actionCount); if (enableDefaultUsr && isIm && IsActionEnabled("General/Quick reply")) { m_actions[iAction].actionA.cbSize = sizeof(POPUPACTION); - m_actions[iAction].actionA.lchIcon = IcoLib_GetIcon(ICO_ACT_REPLY,iconSize); + m_actions[iAction].actionA.lchIcon = IcoLib_GetIcon(ICO_ACT_REPLY, iconSize); mir_strcpy(m_actions[iAction].actionA.lpzTitle, "General/Quick reply"); m_actions[iAction].actionA.wParam = 0; m_actions[iAction].actionA.lParam = ACT_DEF_REPLY; ++iAction; } - + if (enableDefaultUsr && isIm && IsActionEnabled("General/Send message")) { m_actions[iAction].actionA.cbSize = sizeof(POPUPACTION); - m_actions[iAction].actionA.lchIcon = IcoLib_GetIcon(ICO_ACT_MESS,iconSize); + m_actions[iAction].actionA.lchIcon = IcoLib_GetIcon(ICO_ACT_MESS, iconSize); mir_strcpy(m_actions[iAction].actionA.lpzTitle, "General/Send message"); m_actions[iAction].actionA.wParam = 0; m_actions[iAction].actionA.lParam = ACT_DEF_MESSAGE; ++iAction; } - + if (enableDefaultUsr && IsActionEnabled("General/User details")) { m_actions[iAction].actionA.cbSize = sizeof(POPUPACTION); - m_actions[iAction].actionA.lchIcon = IcoLib_GetIcon(ICO_ACT_INFO,iconSize); + m_actions[iAction].actionA.lchIcon = IcoLib_GetIcon(ICO_ACT_INFO, iconSize); mir_strcpy(m_actions[iAction].actionA.lpzTitle, "General/User details"); m_actions[iAction].actionA.wParam = 0; m_actions[iAction].actionA.lParam = ACT_DEF_DETAILS; ++iAction; } - + if (enableDefaultUsr && IsActionEnabled("General/Contact menu")) { m_actions[iAction].actionA.cbSize = sizeof(POPUPACTION); - m_actions[iAction].actionA.lchIcon = IcoLib_GetIcon(ICO_ACT_MENU,iconSize); + m_actions[iAction].actionA.lchIcon = IcoLib_GetIcon(ICO_ACT_MENU, iconSize); mir_strcpy(m_actions[iAction].actionA.lpzTitle, "General/Contact menu"); m_actions[iAction].actionA.wParam = 0; m_actions[iAction].actionA.lParam = ACT_DEF_MENU; ++iAction; } - + if (enableDefaultUsr && db_get_b(m_hContact, "CList", "NotOnList", 0) && IsActionEnabled("General/Add permanently")) { m_actions[iAction].actionA.cbSize = sizeof(POPUPACTION); - m_actions[iAction].actionA.lchIcon = IcoLib_GetIcon(ICO_ACT_ADD,iconSize); + m_actions[iAction].actionA.lchIcon = IcoLib_GetIcon(ICO_ACT_ADD, iconSize); mir_strcpy(m_actions[iAction].actionA.lpzTitle, "General/Add permanently"); m_actions[iAction].actionA.wParam = 0; m_actions[iAction].actionA.lParam = ACT_DEF_ADD; ++iAction; } - + if (enableDefaultGen && (m_iTimeout != -1) && IsActionEnabled("General/Pin popup")) { m_actions[iAction].actionA.cbSize = sizeof(POPUPACTION); - m_actions[iAction].actionA.lchIcon = m_bIsPinned ? IcoLib_GetIcon(ICO_ACT_PINNED,iconSize) : IcoLib_GetIcon(ICO_ACT_PIN,iconSize); + m_actions[iAction].actionA.lchIcon = m_bIsPinned ? IcoLib_GetIcon(ICO_ACT_PINNED, iconSize) : IcoLib_GetIcon(ICO_ACT_PIN, iconSize); mir_strcpy(m_actions[iAction].actionA.lpzTitle, "General/Pin popup"); m_actions[iAction].actionA.wParam = 0; m_actions[iAction].actionA.lParam = ACT_DEF_PIN; ++iAction; } - + if (enableDefaultGen && IsActionEnabled("General/Dismiss popup")) { m_actions[iAction].actionA.cbSize = sizeof(POPUPACTION); - m_actions[iAction].actionA.lchIcon = IcoLib_GetIcon(ICO_ACT_CLOSE,iconSize); + m_actions[iAction].actionA.lchIcon = IcoLib_GetIcon(ICO_ACT_CLOSE, iconSize); mir_strcpy(m_actions[iAction].actionA.lpzTitle, "General/Dismiss popup"); m_actions[iAction].actionA.wParam = 0; m_actions[iAction].actionA.lParam = ACT_DEF_DISMISS; ++iAction; } - + if (enableDefaultGen && IsActionEnabled("General/Copy to clipboard")) { m_actions[iAction].actionA.cbSize = sizeof(POPUPACTION); - m_actions[iAction].actionA.lchIcon = IcoLib_GetIcon(ICO_ACT_COPY,iconSize); + m_actions[iAction].actionA.lchIcon = IcoLib_GetIcon(ICO_ACT_COPY, iconSize); mir_strcpy(m_actions[iAction].actionA.lpzTitle, "General/Copy to clipboard"); m_actions[iAction].actionA.wParam = 0; m_actions[iAction].actionA.lParam = ACT_DEF_COPY; @@ -685,7 +690,7 @@ int PopupWnd2::fixActions(POPUPACTION *theActions, int count) int PopupWnd2::fixActions(POPUPACTION *theActions, int count, int additional) { m_actionCount = 0; - if (m_actions) delete [] m_actions; + if (m_actions) delete[] m_actions; m_actions = NULL; int i; @@ -717,7 +722,7 @@ void PopupWnd2::setIcon(HICON hNewIcon) m_hIcon = hNewIcon; - if ( CallService(MS_SKIN2_ISMANAGEDICON, (WPARAM)m_hIcon, 0)) { + if (CallService(MS_SKIN2_ISMANAGEDICON, (WPARAM)m_hIcon, 0)) { CallService(MS_SKIN2_ADDREFICON, (WPARAM)m_hIcon, 0); m_bIcoLib = true; } @@ -727,9 +732,9 @@ void PopupWnd2::updateData(POPUPDATAW_V2 *ppd) { m_hContact = ppd->lchContact; - m_clBack = ppd->colorBack; - m_clClock = m_clTitle = m_clText = ppd->colorText; - m_iTimeout = ppd->iSeconds ? ppd->iSeconds : m_options->Seconds; + m_clBack = ppd->colorBack; + m_clClock = m_clTitle = m_clText = ppd->colorText; + m_iTimeout = ppd->iSeconds ? ppd->iSeconds : m_options->Seconds; if (m_textType == TT_NONE) m_textType = TT_UNICODE; mir_free(m_lptzText); mir_free(m_lptzTitle); @@ -755,7 +760,7 @@ void PopupWnd2::updateData(POPUPDATA2 *ppd) { m_hContact = ppd->lchContact; - m_clBack = ppd->colorBack; + m_clBack = ppd->colorBack; m_clClock = m_clTitle = m_clText = ppd->colorText; m_iTimeout = ppd->iSeconds; @@ -771,7 +776,7 @@ void PopupWnd2::updateData(POPUPDATA2 *ppd) m_PluginData = ppd->PluginData; m_PluginWindowProc = ppd->PluginWindowProc; - m_customPopup = (ppd->flags & PU2_CUSTOM_POPUP)!= 0; + m_customPopup = (ppd->flags & PU2_CUSTOM_POPUP) != 0; m_hbmAvatar = ppd->hbmAvatar; m_lpzSkin = mir_a2t(ppd->lpzSkin); @@ -785,7 +790,8 @@ void PopupWnd2::updateData(POPUPDATA2 *ppd) dbtts.szDest = m_time; dbtts.cbDest = SIZEOF(m_time); CallService(MS_DB_TIME_TIMESTAMPTOSTRINGT, (WPARAM)ppd->dwTimestamp, (LPARAM)&dbtts); - } else + } + else { GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL, _T("HH':'mm"), m_time, SIZEOF(m_time)); } @@ -811,7 +817,7 @@ void PopupWnd2::buildMText() m_textType = TT_MTEXT; m_mtText = MText.Create(htuText, m_lptzText); m_mtTitle = MText.Create(htuTitle, m_lptzTitle); - } + } } void PopupWnd2::updateText(TCHAR *text) @@ -848,10 +854,10 @@ LRESULT CALLBACK NullWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM l { switch (message) { - case WM_COMMAND: - case WM_CONTEXTMENU: - PUDeletePopup(hwnd); - break; + case WM_COMMAND: + case WM_CONTEXTMENU: + PUDeletePopup(hwnd); + break; } return DefWindowProc(hwnd, message, wParam, lParam); } @@ -879,13 +885,13 @@ BOOL IsUtfSendAvailable(MCONTACT hContact) void AddMessageToDB(MCONTACT hContact, char *msg, int flag/*bool utf*/) { - DBEVENTINFO dbei = {0}; + DBEVENTINFO dbei = { 0 }; dbei.cbSize = sizeof(dbei); dbei.eventType = EVENTTYPE_MESSAGE; - dbei.flags = DBEF_SENT | ((flag&PREF_UTF)==PREF_UTF ? DBEF_UTF : 0); + dbei.flags = DBEF_SENT | ((flag&PREF_UTF) == PREF_UTF ? DBEF_UTF : 0); dbei.szModule = GetContactProto(hContact); dbei.timestamp = time(NULL); - if ( !((flag & PREF_UTF) == PREF_UTF) && (flag & PREF_UNICODE) == PREF_UNICODE) + if (!((flag & PREF_UTF) == PREF_UTF) && (flag & PREF_UNICODE) == PREF_UNICODE) dbei.cbBlob = ((int)mir_tstrlen((LPTSTR)msg) + 1)*sizeof(TCHAR); else dbei.cbBlob = (int)mir_strlen(msg) + 1; @@ -902,34 +908,33 @@ LRESULT CALLBACK ReplyEditWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM case WM_KEYDOWN: switch (wParam) { case VK_RETURN: - { - char *buf = NULL; - int flag = 0; - TCHAR msg[2048]; - LPTSTR bufW = NULL; - - GetWindowText(hwnd, msg, SIZEOF(msg)); + { + char *buf = NULL; + int flag = 0; + TCHAR msg[2048]; - if (wcslen(msg) == 0){ - DestroyWindow(hwnd); - return 0; - } - // we have unicode message, check if it is possible and reasonable to send it as unicode - if (IsUtfSendAvailable(dat->hContact)) { - buf = mir_utf8encodeT(msg); - flag = PREF_UTF; - } - else { - buf = mir_t2a(msg); - flag = 0; - } + GetWindowText(hwnd, msg, SIZEOF(msg)); - CallContactService(dat->hContact, PSS_MESSAGE, flag, (LPARAM)buf); - AddMessageToDB(dat->hContact, buf, flag); - mir_free(buf); + if (wcslen(msg) == 0){ + DestroyWindow(hwnd); + return 0; } - DestroyWindow(hwnd); - return 0; + // we have unicode message, check if it is possible and reasonable to send it as unicode + if (IsUtfSendAvailable(dat->hContact)) { + buf = mir_utf8encodeT(msg); + flag = PREF_UTF; + } + else { + buf = mir_t2a(msg); + flag = 0; + } + + CallContactService(dat->hContact, PSS_MESSAGE, flag, (LPARAM)buf); + AddMessageToDB(dat->hContact, buf, flag); + mir_free(buf); + } + DestroyWindow(hwnd); + return 0; case VK_ESCAPE: DestroyWindow(hwnd); @@ -965,7 +970,7 @@ LRESULT CALLBACK PopupWnd2::WindowProc(UINT message, WPARAM wParam, LPARAM lPara case UM_INITPOPUP: if (!m_customPopup) PopupThreadAddWindow(this); - if (m_iTimeout > 0) SetTimer(m_hwnd, POPUP_TIMER, m_iTimeout*1000, 0); + if (m_iTimeout > 0) SetTimer(m_hwnd, POPUP_TIMER, m_iTimeout * 1000, 0); if (m_hContact && !m_hbmAvatar && PopupOptions.EnableAvatarUpdates) m_hhkAvatarChanged = HookEventMessage(ME_AV_AVATARCHANGED, m_hwnd, UM_AVATARCHANGED); if (m_avatar->activeFrameDelay() > 0) SetTimer(m_hwnd, AVATAR_TIMER, m_avatar->activeFrameDelay(), 0); @@ -977,12 +982,12 @@ LRESULT CALLBACK PopupWnd2::WindowProc(UINT message, WPARAM wParam, LPARAM lPara break; case UM_POPUPSHOW: - { - POINT pt; pt.x = wParam; pt.y = lParam; - setPosition(pt); - show(); - } - break; + { + POINT pt; pt.x = wParam; pt.y = lParam; + setPosition(pt); + show(); + } + break; case UM_AVATARCHANGED: if (wParam == m_hContact) @@ -1003,28 +1008,28 @@ LRESULT CALLBACK PopupWnd2::WindowProc(UINT message, WPARAM wParam, LPARAM lPara break; case ACT_DEF_REPLY: - { - if (!m_customPopup) PopupThreadLock(); - // RECT rc = renderInfo.textRect; - // MapWindowPoints(hwnd, NULL, (LPPOINT)&rc, 2); - RECT rc; GetWindowRect(m_hwnd, &rc); - - HWND hwndEditBox = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST, - g_wndClass.cPopupEditBox ? _T("PopupEditBox") : _T("EDIT"), - NULL, - WS_BORDER | WS_POPUP | WS_VISIBLE | ES_AUTOVSCROLL | ES_LEFT | ES_MULTILINE | ES_NOHIDESEL | ES_WANTRETURN, - rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, NULL, NULL, hInst, NULL); - - ReplyEditData *dat = (ReplyEditData *)mir_alloc(sizeof(ReplyEditData)); - dat->oldWndProc = (WNDPROC)GetWindowLongPtr(hwndEditBox, (LONG_PTR)GWLP_WNDPROC); - dat->hwndPopup = m_hwnd; - dat->hContact = m_hContact; - SendMessage(hwndEditBox, WM_SETFONT, (WPARAM)fonts.text, TRUE); - SetWindowLongPtr(hwndEditBox, GWLP_USERDATA, (LONG_PTR)dat); - SetWindowLongPtr(hwndEditBox, GWLP_WNDPROC, (LONG_PTR)ReplyEditWndProc); - SetFocus(hwndEditBox); - break; - } + { + if (!m_customPopup) PopupThreadLock(); + // RECT rc = renderInfo.textRect; + // MapWindowPoints(hwnd, NULL, (LPPOINT)&rc, 2); + RECT rc; GetWindowRect(m_hwnd, &rc); + + HWND hwndEditBox = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST, + g_wndClass.cPopupEditBox ? _T("PopupEditBox") : _T("EDIT"), + NULL, + WS_BORDER | WS_POPUP | WS_VISIBLE | ES_AUTOVSCROLL | ES_LEFT | ES_MULTILINE | ES_NOHIDESEL | ES_WANTRETURN, + rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, NULL, NULL, hInst, NULL); + + ReplyEditData *dat = (ReplyEditData *)mir_alloc(sizeof(ReplyEditData)); + dat->oldWndProc = (WNDPROC)GetWindowLongPtr(hwndEditBox, (LONG_PTR)GWLP_WNDPROC); + dat->hwndPopup = m_hwnd; + dat->hContact = m_hContact; + SendMessage(hwndEditBox, WM_SETFONT, (WPARAM)fonts.text, TRUE); + SetWindowLongPtr(hwndEditBox, GWLP_USERDATA, (LONG_PTR)dat); + SetWindowLongPtr(hwndEditBox, GWLP_WNDPROC, (LONG_PTR)ReplyEditWndProc); + SetFocus(hwndEditBox); + break; + } case ACT_DEF_DETAILS: CallServiceSync(MS_USERINFO_SHOWDIALOG, (WPARAM)m_hContact, 0); @@ -1038,27 +1043,27 @@ LRESULT CALLBACK PopupWnd2::WindowProc(UINT message, WPARAM wParam, LPARAM lPara break; case ACT_DEF_ADD: - { - ADDCONTACTSTRUCT acs = {0}; - acs.hContact = m_hContact; - acs.handleType = HANDLE_CONTACT; - acs.szProto = 0; - CallServiceSync(MS_ADDCONTACT_SHOW, NULL, (LPARAM)&acs); - if (!(PopupOptions.actions&ACT_DEF_KEEPWND)) - PUDeletePopup(m_hwnd); - } - break; + { + ADDCONTACTSTRUCT acs = { 0 }; + acs.hContact = m_hContact; + acs.handleType = HANDLE_CONTACT; + acs.szProto = 0; + CallServiceSync(MS_ADDCONTACT_SHOW, NULL, (LPARAM)&acs); + if (!(PopupOptions.actions&ACT_DEF_KEEPWND)) + PUDeletePopup(m_hwnd); + } + break; case ACT_DEF_PIN: if (m_bIsPinned) - SetTimer(m_hwnd, POPUP_TIMER, m_iTimeout*1000, NULL); + SetTimer(m_hwnd, POPUP_TIMER, m_iTimeout * 1000, NULL); else KillTimer(m_hwnd, POPUP_TIMER); m_bIsPinned = !m_bIsPinned; { bool iconSize = PopupOptions.actions&ACT_LARGE ? TRUE : FALSE; - PUModifyActionIcon(m_hwnd, wParam, lParam, m_bIsPinned ? IcoLib_GetIcon(ICO_ACT_PINNED,iconSize) : IcoLib_GetIcon(ICO_ACT_PIN,iconSize)); + PUModifyActionIcon(m_hwnd, wParam, lParam, m_bIsPinned ? IcoLib_GetIcon(ICO_ACT_PINNED, iconSize) : IcoLib_GetIcon(ICO_ACT_PIN, iconSize)); } break; @@ -1067,112 +1072,112 @@ LRESULT CALLBACK PopupWnd2::WindowProc(UINT message, WPARAM wParam, LPARAM lPara break; case ACT_DEF_COPY: - { - #define CF_TCHAR CF_UNICODETEXT + { +#define CF_TCHAR CF_UNICODETEXT - HGLOBAL clipbuffer; - static TCHAR * buffer, *text; - if ((this->m_lptzText) || (this->m_lptzTitle)) - { - size_t size = _tcslen(this->m_lptzText) + _tcslen(this->m_lptzTitle) + 3; - text = (TCHAR*)mir_alloc(size * sizeof(TCHAR)); - mir_sntprintf(text, size, _T("%s\n\n%s"), this->m_lptzTitle, this->m_lptzText); - } - OpenClipboard(m_hwnd); - EmptyClipboard(); - clipbuffer = GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, (mir_tstrlen(text)+1) * sizeof(TCHAR)); - buffer = (TCHAR *)GlobalLock(clipbuffer); - mir_tstrcpy(buffer, text); - GlobalUnlock(clipbuffer); - SetClipboardData(CF_TCHAR, clipbuffer); - CloseClipboard(); - PUDeletePopup(m_hwnd); - break; + HGLOBAL clipbuffer; + static TCHAR * buffer, *text; + if ((this->m_lptzText) || (this->m_lptzTitle)) + { + size_t size = _tcslen(this->m_lptzText) + _tcslen(this->m_lptzTitle) + 3; + text = (TCHAR*)mir_alloc(size * sizeof(TCHAR)); + mir_sntprintf(text, size, _T("%s\n\n%s"), this->m_lptzTitle, this->m_lptzText); } + OpenClipboard(m_hwnd); + EmptyClipboard(); + clipbuffer = GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, (mir_tstrlen(text) + 1) * sizeof(TCHAR)); + buffer = (TCHAR *)GlobalLock(clipbuffer); + mir_tstrcpy(buffer, text); + GlobalUnlock(clipbuffer); + SetClipboardData(CF_TCHAR, clipbuffer); + CloseClipboard(); + PUDeletePopup(m_hwnd); + break; + } } break; case UM_POPUPMODIFYACTIONICON: - { - LPPOPUPACTIONID actionId = (LPPOPUPACTIONID)wParam; - for (int i=0; i < m_actionCount; ++i) - if ((m_actions[i].actionA.wParam == actionId->wParam) && - (m_actions[i].actionA.lParam == actionId->lParam)) - { - m_actions[i].actionA.lchIcon = (HICON)lParam; - animate(); - break; - } - } - break; + { + LPPOPUPACTIONID actionId = (LPPOPUPACTIONID)wParam; + for (int i = 0; i < m_actionCount; ++i) + if ((m_actions[i].actionA.wParam == actionId->wParam) && + (m_actions[i].actionA.lParam == actionId->lParam)) + { + m_actions[i].actionA.lchIcon = (HICON)lParam; + animate(); + break; + } + } + break; case UM_MENUDONE: - { - unlock(); - if (!(PopupOptions.actions&ACT_DEF_KEEPWND)) - PUDeletePopup(m_hwnd); - break; - } + { + unlock(); + if (!(PopupOptions.actions&ACT_DEF_KEEPWND)) + PUDeletePopup(m_hwnd); + break; + } case WM_LBUTTONUP: - { - int i; - for (i = 0; i < m_actionCount; ++i) - if (m_actions[i].hover) - { - SendMessage(m_hwnd, UM_POPUPACTION, m_actions[i].actionA.wParam, m_actions[i].actionA.lParam); - break; - } + { + int i; + for (i = 0; i < m_actionCount; ++i) + if (m_actions[i].hover) + { + SendMessage(m_hwnd, UM_POPUPACTION, m_actions[i].actionA.wParam, m_actions[i].actionA.lParam); + break; + } - if (i == m_actionCount) { - if (PopupOptions.overrideLeft!=false && (m_hContact!=NULL || PopupOptions.overrideLeft == 5 || PopupOptions.overrideLeft == 6)) { - switch (PopupOptions.overrideLeft){ - default: - case 1:SendMessage(m_hwnd, UM_POPUPACTION,0, ACT_DEF_MESSAGE); break; - case 2:SendMessage(m_hwnd, UM_POPUPACTION,0, ACT_DEF_REPLY); break; - case 3:SendMessage(m_hwnd, UM_POPUPACTION,0, ACT_DEF_DETAILS); break; - case 4:SendMessage(m_hwnd, UM_POPUPACTION,0, ACT_DEF_MENU); break; - case 5:SendMessage(m_hwnd, UM_POPUPACTION,0, ACT_DEF_DISMISS); break; - case 6:SendMessage(m_hwnd, UM_POPUPACTION,0, ACT_DEF_PIN); break; - case 7:SendMessage(m_hwnd, UM_POPUPACTION,0, ACT_DEF_COPY); break; - } - } - else { - lock(); - if (!PerformAction(m_hNotification, m_hwnd, message, wParam, lParam)) - SendMessage(m_hwnd, WM_COMMAND, 0, 0); - unlock(); + if (i == m_actionCount) { + if (PopupOptions.overrideLeft != false && (m_hContact != NULL || PopupOptions.overrideLeft == 5 || PopupOptions.overrideLeft == 6)) { + switch (PopupOptions.overrideLeft){ + default: + case 1:SendMessage(m_hwnd, UM_POPUPACTION, 0, ACT_DEF_MESSAGE); break; + case 2:SendMessage(m_hwnd, UM_POPUPACTION, 0, ACT_DEF_REPLY); break; + case 3:SendMessage(m_hwnd, UM_POPUPACTION, 0, ACT_DEF_DETAILS); break; + case 4:SendMessage(m_hwnd, UM_POPUPACTION, 0, ACT_DEF_MENU); break; + case 5:SendMessage(m_hwnd, UM_POPUPACTION, 0, ACT_DEF_DISMISS); break; + case 6:SendMessage(m_hwnd, UM_POPUPACTION, 0, ACT_DEF_PIN); break; + case 7:SendMessage(m_hwnd, UM_POPUPACTION, 0, ACT_DEF_COPY); break; } } - break; + else { + lock(); + if (!PerformAction(m_hNotification, m_hwnd, message, wParam, lParam)) + SendMessage(m_hwnd, WM_COMMAND, 0, 0); + unlock(); + } } + break; + } case WM_MBUTTONUP: - if ( PopupOptions.overrideMiddle!=false && (m_hContact!=NULL || PopupOptions.overrideMiddle == 5 || PopupOptions.overrideMiddle == 6)) { + if (PopupOptions.overrideMiddle != false && (m_hContact != NULL || PopupOptions.overrideMiddle == 5 || PopupOptions.overrideMiddle == 6)) { switch (PopupOptions.overrideMiddle){ default: - case 1:SendMessage(m_hwnd, UM_POPUPACTION,0, ACT_DEF_MESSAGE); break; - case 2:SendMessage(m_hwnd, UM_POPUPACTION,0, ACT_DEF_REPLY); break; - case 3:SendMessage(m_hwnd, UM_POPUPACTION,0, ACT_DEF_DETAILS); break; - case 4:SendMessage(m_hwnd, UM_POPUPACTION,0, ACT_DEF_MENU); break; - case 5:SendMessage(m_hwnd, UM_POPUPACTION,0, ACT_DEF_DISMISS); break; - case 6:SendMessage(m_hwnd, UM_POPUPACTION,0, ACT_DEF_PIN); break; - case 7:SendMessage(m_hwnd, UM_POPUPACTION,0, ACT_DEF_COPY); break; + case 1:SendMessage(m_hwnd, UM_POPUPACTION, 0, ACT_DEF_MESSAGE); break; + case 2:SendMessage(m_hwnd, UM_POPUPACTION, 0, ACT_DEF_REPLY); break; + case 3:SendMessage(m_hwnd, UM_POPUPACTION, 0, ACT_DEF_DETAILS); break; + case 4:SendMessage(m_hwnd, UM_POPUPACTION, 0, ACT_DEF_MENU); break; + case 5:SendMessage(m_hwnd, UM_POPUPACTION, 0, ACT_DEF_DISMISS); break; + case 6:SendMessage(m_hwnd, UM_POPUPACTION, 0, ACT_DEF_PIN); break; + case 7:SendMessage(m_hwnd, UM_POPUPACTION, 0, ACT_DEF_COPY); break; } } break; case WM_CONTEXTMENU: - if ( PopupOptions.overrideRight!=false && (m_hContact!=NULL || PopupOptions.overrideRight == 5 || PopupOptions.overrideRight == 6)) { + if (PopupOptions.overrideRight != false && (m_hContact != NULL || PopupOptions.overrideRight == 5 || PopupOptions.overrideRight == 6)) { switch (PopupOptions.overrideRight){ default: - case 1:SendMessage(m_hwnd, UM_POPUPACTION,0, ACT_DEF_MESSAGE); break; - case 2:SendMessage(m_hwnd, UM_POPUPACTION,0, ACT_DEF_REPLY); break; - case 3:SendMessage(m_hwnd, UM_POPUPACTION,0, ACT_DEF_DETAILS); break; - case 4:SendMessage(m_hwnd, UM_POPUPACTION,0, ACT_DEF_MENU); break; - case 5:SendMessage(m_hwnd, UM_POPUPACTION,0, ACT_DEF_DISMISS); break; - case 6:SendMessage(m_hwnd, UM_POPUPACTION,0, ACT_DEF_PIN); break; - case 7:SendMessage(m_hwnd, UM_POPUPACTION,0, ACT_DEF_COPY); break; + case 1:SendMessage(m_hwnd, UM_POPUPACTION, 0, ACT_DEF_MESSAGE); break; + case 2:SendMessage(m_hwnd, UM_POPUPACTION, 0, ACT_DEF_REPLY); break; + case 3:SendMessage(m_hwnd, UM_POPUPACTION, 0, ACT_DEF_DETAILS); break; + case 4:SendMessage(m_hwnd, UM_POPUPACTION, 0, ACT_DEF_MENU); break; + case 5:SendMessage(m_hwnd, UM_POPUPACTION, 0, ACT_DEF_DISMISS); break; + case 6:SendMessage(m_hwnd, UM_POPUPACTION, 0, ACT_DEF_PIN); break; + case 7:SendMessage(m_hwnd, UM_POPUPACTION, 0, ACT_DEF_COPY); break; } return TRUE; } @@ -1200,26 +1205,26 @@ LRESULT CALLBACK PopupWnd2::WindowProc(UINT message, WPARAM wParam, LPARAM lPara break; case AVATAR_TIMER: - { - int newDelay = m_avatar->activeFrameDelay(); - animate(); - if ((newDelay <= 0) || (newDelay != m_avatarFrameDelay)) KillTimer(m_hwnd, AVATAR_TIMER); - if (newDelay > 0) { - SetTimer(m_hwnd, AVATAR_TIMER, newDelay, 0); - m_avatarFrameDelay = newDelay; - } - break; + { + int newDelay = m_avatar->activeFrameDelay(); + animate(); + if ((newDelay <= 0) || (newDelay != m_avatarFrameDelay)) KillTimer(m_hwnd, AVATAR_TIMER); + if (newDelay > 0) { + SetTimer(m_hwnd, AVATAR_TIMER, newDelay, 0); + m_avatarFrameDelay = newDelay; } + break; + } case CURSOR_TIMER: - { - POINT pt; GetCursorPos(&pt); - if (abs(pt.x-m_ptPrevCursor.x) + abs(pt.y-m_ptPrevCursor.y) > 4) { - SetWindowLongPtr(m_hwnd, GWL_EXSTYLE, GetWindowLongPtr(m_hwnd, GWL_EXSTYLE) & ~WS_EX_TRANSPARENT); - KillTimer(m_hwnd, CURSOR_TIMER); - } - break; + { + POINT pt; GetCursorPos(&pt); + if (abs(pt.x - m_ptPrevCursor.x) + abs(pt.y - m_ptPrevCursor.y) > 4) { + SetWindowLongPtr(m_hwnd, GWL_EXSTYLE, GetWindowLongPtr(m_hwnd, GWL_EXSTYLE) & ~WS_EX_TRANSPARENT); + KillTimer(m_hwnd, CURSOR_TIMER); } + break; + } } break; @@ -1232,20 +1237,20 @@ LRESULT CALLBACK PopupWnd2::WindowProc(UINT message, WPARAM wParam, LPARAM lPara case UM_CHANGEPOPUP: switch (wParam) { - case CPT_TEXTW: updateText((TCHAR *)lParam); mir_free((void *)lParam); break; - case CPT_TITLEW: updateTitle((TCHAR *)lParam); mir_free((void *)lParam); break; - case CPT_DATAW: updateData((POPUPDATAW_V2 *)lParam); mir_free((void *)lParam); break; + case CPT_TEXTW: updateText((TCHAR *)lParam); mir_free((void *)lParam); break; + case CPT_TITLEW: updateTitle((TCHAR *)lParam); mir_free((void *)lParam); break; + case CPT_DATAW: updateData((POPUPDATAW_V2 *)lParam); mir_free((void *)lParam); break; } update(); break; case UM_CALLMETHOD: - { - MethodPtr *method_copy = (MethodPtr *)wParam; - (this->*(*method_copy))(lParam); - delete method_copy; - } - break; + { + MethodPtr *method_copy = (MethodPtr *)wParam; + (this->*(*method_copy))(lParam); + delete method_copy; + } + break; case WM_PAINT: if (GetUpdateRect(m_hwnd, 0, FALSE)) { @@ -1263,44 +1268,44 @@ LRESULT CALLBACK PopupWnd2::WindowProc(UINT message, WPARAM wParam, LPARAM lPara break; case WM_MOUSEMOVE: - { - const PopupSkin *skin = skins.getSkin(m_lpzSkin?m_lpzSkin:m_options->SkinPack); - if (skin) - if (skin->onMouseMove(this, LOWORD(lParam), HIWORD(lParam))) - animate(); - - if (m_bIsHovered) break; - TRACKMOUSEEVENT tme; - tme.cbSize = sizeof(tme); - tme.dwFlags = TME_LEAVE; - tme.dwHoverTime = HOVER_DEFAULT; - tme.hwndTrack = m_hwnd; - _TrackMouseEvent(&tme); - if (!m_customPopup) PopupThreadLock(); + { + const PopupSkin *skin = skins.getSkin(m_lpzSkin ? m_lpzSkin : m_options->SkinPack); + if (skin) + if (skin->onMouseMove(this, LOWORD(lParam), HIWORD(lParam))) + animate(); - if (m_options->OpaqueOnHover) - updateLayered(255); + if (m_bIsHovered) break; + TRACKMOUSEEVENT tme; + tme.cbSize = sizeof(tme); + tme.dwFlags = TME_LEAVE; + tme.dwHoverTime = HOVER_DEFAULT; + tme.hwndTrack = m_hwnd; + _TrackMouseEvent(&tme); + if (!m_customPopup) PopupThreadLock(); - m_bIsHovered = true; - } - break; + if (m_options->OpaqueOnHover) + updateLayered(255); + + m_bIsHovered = true; + } + break; case WM_MOUSELEAVE: - { - const PopupSkin *skin = skins.getSkin(m_lpzSkin?m_lpzSkin:m_options->SkinPack); - if (skin) - if (skin->onMouseMove(this, LOWORD(lParam), HIWORD(lParam))) - animate(); + { + const PopupSkin *skin = skins.getSkin(m_lpzSkin ? m_lpzSkin : m_options->SkinPack); + if (skin) + if (skin->onMouseMove(this, LOWORD(lParam), HIWORD(lParam))) + animate(); - if (!m_bIsHovered) break; + if (!m_bIsHovered) break; - if (m_options->OpaqueOnHover) - updateLayered(m_options->UseTransparency ? m_options->Alpha : 255); + if (m_options->OpaqueOnHover) + updateLayered(m_options->UseTransparency ? m_options->Alpha : 255); - if (!m_customPopup) PopupThreadUnlock(); - m_bIsHovered = false; - } - break; + if (!m_customPopup) PopupThreadUnlock(); + m_bIsHovered = false; + } + break; case WM_CLOSE: hide(); @@ -1382,34 +1387,34 @@ LRESULT CALLBACK MenuHostWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM switch (message) { - case UM_SHOWMENU: - { - hContact = lParam; - POINT pt = {0}; - HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT,hContact,0); - GetCursorPos(&pt); - HWND hwndSave = GetForegroundWindow(); - SetForegroundWindow(hwnd); - TrackPopupMenu(hMenu, 0, pt.x, pt.y, 0, hwnd, NULL); - SetForegroundWindow(hwndSave); - DestroyMenu(hMenu); - PostMessage((HWND)wParam, UM_MENUDONE, 0, 0); - break; - } + case UM_SHOWMENU: + { + hContact = lParam; + POINT pt = { 0 }; + HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, hContact, 0); + GetCursorPos(&pt); + HWND hwndSave = GetForegroundWindow(); + SetForegroundWindow(hwnd); + TrackPopupMenu(hMenu, 0, pt.x, pt.y, 0, hwnd, NULL); + SetForegroundWindow(hwndSave); + DestroyMenu(hMenu); + PostMessage((HWND)wParam, UM_MENUDONE, 0, 0); + break; + } - case WM_COMMAND: - { - // do not call PluginWindowProc if menu item was clicked. prevent auto-closing... - if (CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTACTMENU), hContact)) - return DefWindowProc(hwnd, message, wParam, lParam); - break; - } + case WM_COMMAND: + { + // do not call PluginWindowProc if menu item was clicked. prevent auto-closing... + if (CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTACTMENU), hContact)) + return DefWindowProc(hwnd, message, wParam, lParam); + break; + } - case WM_MEASUREITEM: - return CallService(MS_CLIST_MENUMEASUREITEM,wParam,lParam); + case WM_MEASUREITEM: + return CallService(MS_CLIST_MENUMEASUREITEM, wParam, lParam); - case WM_DRAWITEM: - return CallService(MS_CLIST_MENUDRAWITEM,wParam,lParam); + case WM_DRAWITEM: + return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam); } return DefWindowProc(hwnd, message, wParam, lParam); diff --git a/plugins/Popup/src/popup_wnd2.h b/plugins/Popup/src/popup_wnd2.h index 3f56bb2a29..a0c6d20c06 100644 --- a/plugins/Popup/src/popup_wnd2.h +++ b/plugins/Popup/src/popup_wnd2.h @@ -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 @@ -33,8 +33,8 @@ class PopupAvatar; class PopupWnd2 : public MZeroedObject { public: - typedef LRESULT (PopupWnd2::*MethodPtr)(LPARAM lParam); - enum TextType {TT_NONE, TT_UNICODE, TT_MTEXT}; + typedef LRESULT(PopupWnd2::*MethodPtr)(LPARAM lParam); + enum TextType { TT_NONE, TT_UNICODE, TT_MTEXT }; struct ActionInfo { @@ -42,7 +42,7 @@ public: RECT rc; bool hover; - ActionInfo(): hover(false) {} + ActionInfo() : hover(false) {} }; DWORD m_signature; @@ -60,7 +60,7 @@ private: HFONT m_hfnTitle, m_hfnText; HICON m_hIcon; HBITMAP m_hbmAvatar; - TCHAR m_time[2+1+2+1]; + TCHAR m_time[2 + 1 + 2 + 1]; ActionInfo* m_actions; int m_actionCount; HANDLE m_hNotification; @@ -70,7 +70,7 @@ private: MCONTACT m_hContact, m_hContactPassed; WNDPROC m_PluginWindowProc; void *m_PluginData; - + // the window LPTSTR m_lpzSkin; bool m_customPopup; @@ -87,9 +87,9 @@ private: // show & hide bool m_bFade; - BYTE m_btAlpha0, m_btAlpha1; + BYTE m_btAlpha0, m_btAlpha1; bool m_bSlide; - POINT m_ptPosition0, m_ptPosition1; + POINT m_ptPosition0, m_ptPosition1; bool m_bDestroy; bool m_bIsHovered; @@ -108,7 +108,7 @@ private: int fixActions(POPUPACTION *theActions, int count, int additional); public: - PopupWnd2(POPUPDATA2 *ppd, POPUPOPTIONS *theCustomOptions=NULL, bool renderOnly=false); + PopupWnd2(POPUPDATA2 *ppd, POPUPOPTIONS *theCustomOptions = NULL, bool renderOnly = false); ~PopupWnd2(); void startThread(); @@ -124,7 +124,7 @@ public: void idle(); DWORD lock() { return ++m_lockCount; } - DWORD unlock() { return m_lockCount = m_lockCount ? m_lockCount-1 : 0; } + DWORD unlock() { return m_lockCount = m_lockCount ? m_lockCount - 1 : 0; } bool isLocked() { return m_lockCount != 0; } void setIcon(HICON); @@ -213,8 +213,8 @@ public: LRESULT m_updateData_POPUPDATA2(LPARAM arg) { updateData((POPUPDATA2 *)arg); update(); return 0; } LRESULT m_updateText(LPARAM arg) { updateText((TCHAR *)arg); update(); return 0; } LRESULT m_updateTitle(LPARAM arg) { updateTitle((TCHAR *)arg); update(); return 0; } - LRESULT m_show(LPARAM arg) { show(); return 0; } - LRESULT m_hide(LPARAM arg) { hide(); return 0; } + LRESULT m_show(LPARAM) { show(); return 0; } + LRESULT m_hide(LPARAM) { hide(); return 0; } // window related stuff LRESULT CALLBACK WindowProc(UINT, WPARAM, LPARAM); @@ -235,7 +235,7 @@ static inline bool IsValidPopupObject(PopupWnd2 *wnd) if (wnd->m_signature == POPUP_OBJECT_SIGNARURE) res = true; } - __except(EXCEPTION_EXECUTE_HANDLER) + __except (EXCEPTION_EXECUTE_HANDLER) { res = false; } 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; } diff --git a/plugins/Popup/src/services.h b/plugins/Popup/src/services.h index e27e6eb30a..cea395b1bd 100644 --- a/plugins/Popup/src/services.h +++ b/plugins/Popup/src/services.h @@ -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 diff --git a/plugins/Popup/src/skin.cpp b/plugins/Popup/src/skin.cpp index 40526579e9..03ec882e3f 100644 --- a/plugins/Popup/src/skin.cpp +++ b/plugins/Popup/src/skin.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 @@ -106,8 +106,8 @@ void PopupSkin::drawAction(MyBitmap *bmp, POPUPACTION *act, int x, int y, bool h return; bmp->DrawIcon(act->lchIcon, - (PopupOptions.actions & ACT_TEXT) ? x : (x+2), - y+2, + (PopupOptions.actions & ACT_TEXT) ? x : (x + 2), + y + 2, (PopupOptions.actions & ACT_LARGE) ? 32 : 16, (PopupOptions.actions & ACT_LARGE) ? 32 : 16); @@ -226,81 +226,81 @@ void PopupSkin::measure(HDC hdc, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *options SIZE szNew = { 0, 0 }; switch (head->type & ST_TYPEMASK) { case ST_TEXT: - { - int tmp = head->fw.eval(wnd->getArgs()); - // this is used to measure and layout text - wnd->getRenderInfo()->textw = tmp ? tmp : (maxw - head->fx.eval(wnd->getArgs())); - szNew.cx = wnd->getRenderInfo()->textw; - if (wnd->isTextEmpty()) - szNew.cx = szNew.cy = 0; - else { - HFONT hFntSave = (HFONT)SelectObject(hdc, fonts.text); - switch (wnd->getTextType()) { - case PopupWnd2::TT_UNICODE: - { - RECT rc; SetRect(&rc, 0, 0, szNew.cx, 0); - DrawTextEx(hdc, wnd->getText(), (int)mir_tstrlen(wnd->getText()), &rc, - DT_CALCRECT | DT_EXPANDTABS | DT_LEFT | DT_NOPREFIX | DT_TOP | DT_WORDBREAK/*|DT_RTLREADING*/, NULL); - szNew.cx = rc.right; - szNew.cy = rc.bottom; - } - break; - case PopupWnd2::TT_MTEXT: - MText.Measure(hdc, &szNew, wnd->getTextM()); - break; - } - SelectObject(hdc, hFntSave); + { + int tmp = head->fw.eval(wnd->getArgs()); + // this is used to measure and layout text + wnd->getRenderInfo()->textw = tmp ? tmp : (maxw - head->fx.eval(wnd->getArgs())); + szNew.cx = wnd->getRenderInfo()->textw; + if (wnd->isTextEmpty()) + szNew.cx = szNew.cy = 0; + else { + HFONT hFntSave = (HFONT)SelectObject(hdc, fonts.text); + switch (wnd->getTextType()) { + case PopupWnd2::TT_UNICODE: + { + RECT rc; SetRect(&rc, 0, 0, szNew.cx, 0); + DrawTextEx(hdc, wnd->getText(), (int)mir_tstrlen(wnd->getText()), &rc, + DT_CALCRECT | DT_EXPANDTABS | DT_LEFT | DT_NOPREFIX | DT_TOP | DT_WORDBREAK/*|DT_RTLREADING*/, NULL); + szNew.cx = rc.right; + szNew.cy = rc.bottom; } - - wnd->getRenderInfo()->texth = szNew.cy; - - SIZE szActions = measureActionBar(hdc, wnd); - wnd->getRenderInfo()->actw = szActions.cx; - if (szActions.cy) { - szNew.cx = max(szNew.cx, szActions.cx); - szNew.cy += szActions.cy; - szNew.cy += 3; + break; + case PopupWnd2::TT_MTEXT: + MText.Measure(hdc, &szNew, wnd->getTextM()); + break; } + SelectObject(hdc, hFntSave); + } - wnd->getRenderInfo()->realtextw = szNew.cx; + wnd->getRenderInfo()->texth = szNew.cy; - if (szNew.cx > maxw - head->fx.eval(wnd->getArgs())) - szNew.cx = maxw - head->fx.eval(wnd->getArgs()); - wnd->getArgs()->add("text.width", szNew.cx); - wnd->getArgs()->add("text.height", szNew.cy); + SIZE szActions = measureActionBar(hdc, wnd); + wnd->getRenderInfo()->actw = szActions.cx; + if (szActions.cy) { + szNew.cx = max(szNew.cx, szActions.cx); + szNew.cy += szActions.cy; + szNew.cy += 3; } - break; + + wnd->getRenderInfo()->realtextw = szNew.cx; + + if (szNew.cx > maxw - head->fx.eval(wnd->getArgs())) + szNew.cx = maxw - head->fx.eval(wnd->getArgs()); + wnd->getArgs()->add("text.width", szNew.cx); + wnd->getArgs()->add("text.height", szNew.cy); + } + break; case ST_TITLE: + { + int tmp = head->fw.eval(wnd->getArgs()); + // this is used to measure and layout text + wnd->getRenderInfo()->titlew = tmp ? tmp : (maxw - head->fx.eval(wnd->getArgs()) - STYLE_SZ_CLOCK); + szNew.cx = wnd->getRenderInfo()->titlew; + HFONT hFntSave = (HFONT)SelectObject(hdc, fonts.title); + switch (wnd->getTextType()) { + case PopupWnd2::TT_UNICODE: { - int tmp = head->fw.eval(wnd->getArgs()); - // this is used to measure and layout text - wnd->getRenderInfo()->titlew = tmp ? tmp : (maxw - head->fx.eval(wnd->getArgs()) - STYLE_SZ_CLOCK); - szNew.cx = wnd->getRenderInfo()->titlew; - HFONT hFntSave = (HFONT)SelectObject(hdc, fonts.title); - switch (wnd->getTextType()) { - case PopupWnd2::TT_UNICODE: - { - RECT rc; SetRect(&rc, 0, 0, szNew.cx, 0); - DrawTextEx(hdc, wnd->getTitle(), (int)mir_tstrlen(wnd->getTitle()), &rc, - DT_CALCRECT | DT_EXPANDTABS | DT_LEFT | DT_NOPREFIX | DT_TOP | DT_WORDBREAK/*|DT_RTLREADING*/, NULL); - szNew.cx = rc.right; - szNew.cy = rc.bottom; - } - break; - case PopupWnd2::TT_MTEXT: - MText.Measure(hdc, &szNew, wnd->getTitleM()); - break; - } - - SelectObject(hdc, hFntSave); - if (szNew.cx > maxw - head->fx.eval(wnd->getArgs()) - STYLE_SZ_CLOCK) - szNew.cx = maxw - head->fx.eval(wnd->getArgs()) - STYLE_SZ_CLOCK; - szNew.cx += STYLE_SZ_CLOCK; - wnd->getArgs()->add("title.width", szNew.cx); - wnd->getArgs()->add("title.height", szNew.cy); + RECT rc; SetRect(&rc, 0, 0, szNew.cx, 0); + DrawTextEx(hdc, wnd->getTitle(), (int)mir_tstrlen(wnd->getTitle()), &rc, + DT_CALCRECT | DT_EXPANDTABS | DT_LEFT | DT_NOPREFIX | DT_TOP | DT_WORDBREAK/*|DT_RTLREADING*/, NULL); + szNew.cx = rc.right; + szNew.cy = rc.bottom; } break; + case PopupWnd2::TT_MTEXT: + MText.Measure(hdc, &szNew, wnd->getTitleM()); + break; + } + + SelectObject(hdc, hFntSave); + if (szNew.cx > maxw - head->fx.eval(wnd->getArgs()) - STYLE_SZ_CLOCK) + szNew.cx = maxw - head->fx.eval(wnd->getArgs()) - STYLE_SZ_CLOCK; + szNew.cx += STYLE_SZ_CLOCK; + wnd->getArgs()->add("title.width", szNew.cx); + wnd->getArgs()->add("title.height", szNew.cy); + } + break; case ST_ICON: szNew.cx = szNew.cy = 16; @@ -411,7 +411,7 @@ void PopupSkin::measure(HDC hdc, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *options wnd->setSize(sz); } -void PopupSkin::display(MyBitmap *bmp, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *options, DWORD drawFlags) const +void PopupSkin::display(MyBitmap *bmp, PopupWnd2 *wnd, POPUPOPTIONS *options, DWORD drawFlags) const { if (!m_elements) return; @@ -442,7 +442,7 @@ void PopupSkin::display(MyBitmap *bmp, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *o SelectObject(hdc, hfnSave); STYLE_SZ_CLOCK = sz.cx + 2 * STYLE_SZ_GAP; } - + head = m_elements; SIZE sz; @@ -476,7 +476,6 @@ void PopupSkin::display(MyBitmap *bmp, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *o continue; } - int hShift = 0; switch (head->type & ST_TYPEMASK) { case ST_TEXT: if (head->textColor != (COLORREF)0xffffffff) @@ -505,7 +504,7 @@ void PopupSkin::display(MyBitmap *bmp, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *o DrawTextEx(hdc, wnd->getText(), (int)mir_tstrlen(wnd->getText()), &rc, DT_EXPANDTABS | DT_LEFT | DT_NOPREFIX | DT_TOP | DT_WORDBREAK/*|DT_RTLREADING*/, NULL); } - break; + break; case PopupWnd2::TT_MTEXT: MText.Display(hdc, pos, sz, wnd->getTextM()); break; @@ -555,7 +554,7 @@ void PopupSkin::display(MyBitmap *bmp, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *o DT_EXPANDTABS | DT_LEFT | DT_NOPREFIX | DT_TOP | DT_WORDBREAK/*|DT_RTLREADING*/, NULL); SelectObject(hdc, hFntSave); } - break; + break; case PopupWnd2::TT_MTEXT: HFONT hFntSave = (HFONT)SelectObject(hdc, fonts.title); MText.Display(hdc, pos, sz, wnd->getTitleM()); @@ -912,7 +911,7 @@ PopupSkin::SKINELEMENT *PopupSkin::loadObject(std::wistream &f) { SKINELEMENT *element = new SKINELEMENT; element->proportional = 0; - element->type = ST_NOTHING|ST_BADPOS; + element->type = ST_NOTHING | ST_BADPOS; element->next = NULL; element->flag_mask = 0; element->flags = 0; @@ -1078,7 +1077,7 @@ Skins::~Skins() } } -bool Skins::load(LPCTSTR dir1) +bool Skins::load() { while (m_skins) { SKINLIST *next = m_skins->next; @@ -1165,8 +1164,8 @@ const PopupSkin *Skins::getSkin(LPCTSTR name) if (!any->skin->isCompatible()) MessageBox(NULL, - TranslateT("The skin you are trying to load is designed\r\nfor newer version of Popup Plus. And will not\r\ndisplay properly.\r\n\r\nPlease choose another skin."), - _T(MODULNAME_LONG), MB_ICONSTOP | MB_OK); + TranslateT("The skin you are trying to load is designed\r\nfor newer version of Popup Plus. And will not\r\ndisplay properly.\r\n\r\nPlease choose another skin."), + _T(MODULNAME_LONG), MB_ICONSTOP | MB_OK); return any->skin; } diff --git a/plugins/Popup/src/skin.h b/plugins/Popup/src/skin.h index f6d95da214..28726cbf28 100644 --- a/plugins/Popup/src/skin.h +++ b/plugins/Popup/src/skin.h @@ -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 @@ -36,38 +36,38 @@ public: enum { ST_TYPEMASK = 0x07, - ST_NOTHING = 0x00, - ST_ICON = 0x01, - ST_TEXT = 0x02, - ST_TITLE = 0x03, - ST_BITMAP = 0x04, + ST_NOTHING = 0x00, + ST_ICON = 0x01, + ST_TEXT = 0x02, + ST_TITLE = 0x03, + ST_BITMAP = 0x04, ST_MYBITMAP = 0x05, - ST_AVATAR = 0x06, - ST_CLOCK = 0x07, + ST_AVATAR = 0x06, + ST_CLOCK = 0x07, - ST_STRETCH = 0x08, - ST_MONO = 0x10, - ST_BLEND = 0x20, - ST_BADPOS = 0x40 + ST_STRETCH = 0x08, + ST_MONO = 0x10, + ST_BLEND = 0x20, + ST_BADPOS = 0x40 }; enum { - DF_STATIC = 0x01, - DF_ANIMATE = 0x02, - DF_ALL = 0xff + DF_STATIC = 0x01, + DF_ANIMATE = 0x02, + DF_ALL = 0xff }; enum { - // left, separator, digits, am/pm, right + // left, separator, digits, am/pm, right CLOCK_LEFT = 0, CLOCK_SEPARATOR = 1, CLOCK_DIGITS = 2, CLOCK_AM = 12, CLOCK_PM = 13, CLOCK_RIGHT = 14, - CLOCK_ITEMS = 1+1+10+2+1 + CLOCK_ITEMS = 1 + 1 + 10 + 2 + 1 }; struct SKINELEMENT @@ -88,7 +88,7 @@ public: int proportional; COLORREF textColor; SKINELEMENT *next; - }; + }; struct RenderInfo { @@ -128,7 +128,7 @@ public: ~PopupSkin(); void measure(HDC hdc, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *options) const; - void display(MyBitmap *bmp, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *options, DWORD drawFlags=DF_ALL) const; + void display(MyBitmap *bmp, PopupWnd2 *wnd, POPUPOPTIONS *options, DWORD drawFlags = DF_ALL) const; bool onMouseMove(PopupWnd2 *wnd, int x, int y) const; bool onMouseLeave(PopupWnd2 *wnd) const; @@ -140,18 +140,18 @@ public: int useInternalClock() const { return m_internalClock; } int getLegacyRegionOpacity() const { return m_legacy_region_opacity; } int getShadowRegionOpacity() const { return m_shadow_region_opacity; } - bool isCompatible() const { return (DWORD) m_popup_version <= (DWORD) pluginInfoEx.version; } + bool isCompatible() const { return (DWORD)m_popup_version <= (DWORD)pluginInfoEx.version; } const LPTSTR getName() const { return m_name; } - const char *getFlagName(int id) const { return m_flag_names[id-1]; } - bool getFlag(int id) const { return (m_flags & (1 << (id-1))) != 0; } + const char *getFlagName(int id) const { return m_flag_names[id - 1]; } + bool getFlag(int id) const { return (m_flags & (1 << (id - 1))) != 0; } void setFlag(int id, bool val) const { if (val) - m_flags |= 1 << (id-1); + m_flags |= 1 << (id - 1); else - m_flags &= ~(1 << (id-1)); + m_flags &= ~(1 << (id - 1)); } void saveOpts() const; @@ -176,7 +176,7 @@ public: Skins(); ~Skins(); - bool load(LPCTSTR dir); + bool load(); const PopupSkin *getSkin(LPCTSTR name); const SKINLIST *getSkinList() const { return m_skins; } diff --git a/plugins/Popup/src/srmm_menu.cpp b/plugins/Popup/src/srmm_menu.cpp index 40039f13fb..c8b0c7289f 100644 --- a/plugins/Popup/src/srmm_menu.cpp +++ b/plugins/Popup/src/srmm_menu.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 @@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. === how does this work === We have four icons -- one for each mode. and we do hide/show them depending on current active mode for user. -*************************************************************************************/ + *************************************************************************************/ static HANDLE hDialogsList = NULL; @@ -41,7 +41,7 @@ static void SrmmMenu_UpdateIcon(MCONTACT hContact) StatusIconData sid = { sizeof(sid) }; sid.szModule = MODULNAME; - for (int i=0; i < 4; i++) { + for (int i = 0; i < 4; i++) { sid.dwId = i; sid.flags = (i == mode) ? 0 : MBF_HIDDEN; Srmm_ModifyIcon(hContact, &sid); @@ -81,16 +81,16 @@ static int SrmmMenu_ProcessIconClick(WPARAM hContact, LPARAM lParam) if (sicd->flags & MBCF_RIGHTBUTTON) { HMENU hMenu = CreatePopupMenu(); - AppendMenu(hMenu, MF_STRING, 1+PU_SHOWMODE_AUTO, TranslateT("Auto")); - AppendMenu(hMenu, MF_STRING, 1+PU_SHOWMODE_FAVORITE, TranslateT("Favorite")); - AppendMenu(hMenu, MF_STRING, 1+PU_SHOWMODE_FULLSCREEN, TranslateT("Ignore fullscreen")); - AppendMenu(hMenu, MF_STRING, 1+PU_SHOWMODE_BLOCK, TranslateT("Block")); + AppendMenu(hMenu, MF_STRING, 1 + PU_SHOWMODE_AUTO, TranslateT("Auto")); + AppendMenu(hMenu, MF_STRING, 1 + PU_SHOWMODE_FAVORITE, TranslateT("Favorite")); + AppendMenu(hMenu, MF_STRING, 1 + PU_SHOWMODE_FULLSCREEN, TranslateT("Ignore fullscreen")); + AppendMenu(hMenu, MF_STRING, 1 + PU_SHOWMODE_BLOCK, TranslateT("Block")); - CheckMenuItem(hMenu, 1+mode, MF_BYCOMMAND|MF_CHECKED); + CheckMenuItem(hMenu, 1 + mode, MF_BYCOMMAND | MF_CHECKED); mode = TrackPopupMenu(hMenu, TPM_RETURNCMD, sicd->clickLocation.x, sicd->clickLocation.y, 0, WindowList_Find(hDialogsList, hContact), NULL); if (mode) { - db_set_b(hContact, MODULNAME, "ShowMode", mode-1); + db_set_b(hContact, MODULNAME, "ShowMode", mode - 1); SrmmMenu_UpdateIcon(hContact); } } @@ -109,24 +109,24 @@ void SrmmMenu_Load() sid.dwId = 0; sid.szTooltip = LPGEN("Popup Mode: Auto"); - sid.hIcon = sid.hIconDisabled = IcoLib_GetIcon(ICO_POPUP_ON,0); + sid.hIcon = sid.hIconDisabled = IcoLib_GetIcon(ICO_POPUP_ON, 0); Srmm_AddIcon(&sid); sid.dwId = 1; sid.szTooltip = LPGEN("Popup Mode: Favorite"); - sid.hIcon = sid.hIconDisabled = IcoLib_GetIcon(ICO_FAV,0); + sid.hIcon = sid.hIconDisabled = IcoLib_GetIcon(ICO_FAV, 0); Srmm_AddIcon(&sid); sid.dwId = 2; sid.szTooltip = LPGEN("Popup Mode: Ignore fullscreen"); - sid.hIcon = sid.hIconDisabled = IcoLib_GetIcon(ICO_FULLSCREEN,0); + sid.hIcon = sid.hIconDisabled = IcoLib_GetIcon(ICO_FULLSCREEN, 0); Srmm_AddIcon(&sid); sid.dwId = 3; sid.szTooltip = LPGEN("Popup Mode: Block contact"); - sid.hIcon = sid.hIconDisabled = IcoLib_GetIcon(ICO_POPUP_OFF,0); + sid.hIcon = sid.hIconDisabled = IcoLib_GetIcon(ICO_POPUP_OFF, 0); Srmm_AddIcon(&sid); - + HookEvent(ME_MSG_ICONPRESSED, SrmmMenu_ProcessIconClick); HookEvent(ME_MSG_WINDOWEVENT, SrmmMenu_ProcessEvent); } diff --git a/plugins/Popup/src/srmm_menu.h b/plugins/Popup/src/srmm_menu.h index c64d3b303c..7a2c269d55 100644 --- a/plugins/Popup/src/srmm_menu.h +++ b/plugins/Popup/src/srmm_menu.h @@ -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 -- cgit v1.2.3