From 5475d2b962b5d8ffee7523bf58d66377515b8053 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 29 Jul 2014 15:26:06 +0000 Subject: - m_flash.h & m_flash.inc moved to deprecated; - their support in AVS & tabSRMM is discontinued git-svn-id: http://svn.miranda-ng.org/main/trunk@9984 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/!Deprecated/FlashAvatars/m_flash.h | 89 +++++++++++ plugins/!Deprecated/FlashAvatars/m_flash.inc | 92 ++++++++++++ plugins/AVS/src/acc.cpp | 149 +------------------ plugins/AVS/src/commonheaders.h | 1 - plugins/ExternalAPI/delphi/m_flash.inc | 92 ------------ plugins/ExternalAPI/m_flash.h | 89 ----------- plugins/TabSRMM/src/commonheaders.h | 1 - plugins/TabSRMM/src/container.cpp | 8 - plugins/TabSRMM/src/generic_msghandlers.cpp | 14 -- plugins/TabSRMM/src/globals.cpp | 3 - plugins/TabSRMM/src/globals.h | 1 - plugins/TabSRMM/src/msgdialog.cpp | 160 +++++++------------- plugins/TabSRMM/src/msgdlgutils.cpp | 214 +++++---------------------- 13 files changed, 271 insertions(+), 642 deletions(-) create mode 100644 plugins/!Deprecated/FlashAvatars/m_flash.h create mode 100644 plugins/!Deprecated/FlashAvatars/m_flash.inc delete mode 100644 plugins/ExternalAPI/delphi/m_flash.inc delete mode 100644 plugins/ExternalAPI/m_flash.h diff --git a/plugins/!Deprecated/FlashAvatars/m_flash.h b/plugins/!Deprecated/FlashAvatars/m_flash.h new file mode 100644 index 0000000000..96a8407103 --- /dev/null +++ b/plugins/!Deprecated/FlashAvatars/m_flash.h @@ -0,0 +1,89 @@ +/* +Miranda FlashAvatars Plugin +Plugin support header file +Copyright (C) 2006 Big Muscle + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +// Service functions + +/** + WPARAM FLASHAVATAR* (hContact, hParentWindow) + LPARAM not used + */ +#define MS_FAVATAR_DESTROY "FlashAvatar/Destroy" + +/** + WPARAM FLASHAVATAR* (hContact, hParentWindow) + LPARAM not used + */ +#define MS_FAVATAR_MAKE "FlashAvatar/Make" + +/** + WPARAM FLASHAVATAR* (hContact, hParentWindow) + LPARAM LPRECT + */ +#define MS_FAVATAR_RESIZE "FlashAvatar/Resize" + +/** + WPARAM FLASHAVATAR* (hContact, hParentWindow) + LPARAM LPRECT + */ +#define MS_FAVATAR_SETPOS "FlashAvatar/SetPos" + +/** + WPARAM FLASHAVATAR* (hContact, hParentWindow) + LPARAM not used + */ +#define MS_FAVATAR_GETINFO "FlashAvatar/GetInfo" + +/** + WPARAM FLASHAVATAR* (hContact, hParentWindow) + LPARAM BSTR + */ +#define MS_FAVATAR_SETEMOFACE "FlashAvatar/SetEmoFace" + +/** + WPARAM FLASHAVATAR* (hContact, hParentWindow) + LPARAM COLORREF + */ +#define MS_FAVATAR_SETBKCOLOR "FlashAvatar/SetBkColor" + +// Avatar emotion faces +#define AV_SMILE "smile" +#define AV_SAD "sad" +#define AV_LAUGH "laugh" +#define AV_MAD "mad" +#define AV_CRY "cry" +#define AV_OFFLINE "offline" +#define AV_BUSY "busy" +#define AV_LOVE "love" +#define AV_NORMAL "stam" + +// Avatar default size +#define FAVATAR_WIDTH 52 +#define FAVATAR_HEIGHT 64 + +// FLASHAVATAR structure +typedef struct { + MCONTACT hContact; // contact who flash avatar belongs to + HWND hWindow; // handle of flash avatar object + HWND hParentWindow; // handle of flash avatar's parent object + TCHAR* cUrl; // url of .swf file + int id; // unique number of plugin which wants to use avatar service + char* cProto; // contact's protocol + char reserved[16]; +} FLASHAVATAR; diff --git a/plugins/!Deprecated/FlashAvatars/m_flash.inc b/plugins/!Deprecated/FlashAvatars/m_flash.inc new file mode 100644 index 0000000000..c6c7cc1816 --- /dev/null +++ b/plugins/!Deprecated/FlashAvatars/m_flash.inc @@ -0,0 +1,92 @@ +{ +Miranda FlashAvatars Plugin +Plugin support header file +Copyright (C) 2006 Big Muscle + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +} + +{$IFNDEF M_FLASH} +{$DEFINE M_FLASH} +// Service functions + +{ + WPARAM FLASHAVATAR* (hContact, hParentWindow) + LPARAM not used +} + MS_FAVATAR_DESTROY = 'FlashAvatar/Destroy'; + +{ + WPARAM FLASHAVATAR* (hContact, hParentWindow) + LPARAM not used +} + MS_FAVATAR_MAKE = 'FlashAvatar/Make'; + +{ + WPARAM FLASHAVATAR* (hContact, hParentWindow) + LPARAM LPRECT +} + MS_FAVATAR_RESIZE = 'FlashAvatar/Resize'; + +{ + WPARAM FLASHAVATAR* (hContact, hParentWindow) + LPARAM LPRECT +} + MS_FAVATAR_SETPOS = 'FlashAvatar/SetPos'; + +{ + WPARAM FLASHAVATAR* (hContact, hParentWindow) + LPARAM not used +} + MS_FAVATAR_GETINFO = 'FlashAvatar/GetInfo'; + +{ + WPARAM FLASHAVATAR* (hContact, hParentWindow) + LPARAM BSTR +} + MS_FAVATAR_SETEMOFACE = 'FlashAvatar/SetEmoFace'; + +{ + WPARAM FLASHAVATAR* (hContact, hParentWindow) + LPARAM COLORREF +} + MS_FAVATAR_SETBKCOLOR = 'FlashAvatar/SetBkColor'; + +// Avatar emotion faces + AV_SMILE = 'smile'; + AV_SAD = 'sad'; + AV_LAUGH = 'laugh'; + AV_MAD = 'mad'; + AV_CRY = 'cry'; + AV_OFFLINE = 'offline'; + AV_BUSY = 'busy'; + AV_LOVE = 'love'; + AV_NORMAL = 'stam'; + +// Avatar default size + FAVATAR_WIDTH = 52; + FAVATAR_HEIGHT = 64; + +type + TFLASHAVATAR = record + hContact :TMCONTACT; // contact who flash avatar belongs to + hWindow :HWND; // handle of flash avatar object + hParentWindow:HWND; // handle of flash avatar's parent object + cUrl :TChar; // url of .swf file + id :int; // unique number of plugin which wants to use avatar service + cProto :PAnsiChar; // contacts protocol + end; + +{$ENDIF} diff --git a/plugins/AVS/src/acc.cpp b/plugins/AVS/src/acc.cpp index e579b5d186..a99c3a2e59 100644 --- a/plugins/AVS/src/acc.cpp +++ b/plugins/AVS/src/acc.cpp @@ -45,7 +45,6 @@ typedef struct int avatarRoundCornerRadius; TCHAR noAvatarText[128]; BOOL respectHidden; - BOOL showingFlash; BOOL resizeIfSmaller; BOOL fAero; BOOL showingAnimatedGif; @@ -76,105 +75,6 @@ typedef struct } ACCData; -void ResizeFlash(HWND hwnd, ACCData* data) -{ - if ((data->hContact != NULL || data->proto[0] != '\0') && ServiceExists(MS_FAVATAR_RESIZE)) { - RECT rc; - GetClientRect(hwnd, &rc); - - if (data->borderColor != -1 || data->avatarBorderColor != -1) { - rc.left++; - rc.right -= 2; - rc.top++; - rc.bottom -= 2; - } - - FLASHAVATAR fa = { 0 }; - fa.hContact = data->hContact; - fa.cProto = data->proto; - fa.hParentWindow = hwnd; - fa.id = 1675; - CallService(MS_FAVATAR_RESIZE, (WPARAM)&fa, (LPARAM)&rc); - CallService(MS_FAVATAR_SETPOS, (WPARAM)&fa, (LPARAM)&rc); - } -} - -void SetBkgFlash(HWND hwnd, ACCData* data) -{ - if ((data->hContact != NULL || data->proto[0] != '\0') && ServiceExists(MS_FAVATAR_SETBKCOLOR)) { - FLASHAVATAR fa = { 0 }; - fa.hContact = data->hContact; - fa.cProto = data->proto; - fa.hParentWindow = hwnd; - fa.id = 1675; - - if (data->bkgColor != -1) - CallService(MS_FAVATAR_SETBKCOLOR, (WPARAM)&fa, (LPARAM)data->bkgColor); - else - CallService(MS_FAVATAR_SETBKCOLOR, (WPARAM)&fa, (LPARAM)RGB(255, 255, 255)); - } -} - -void DestroyFlash(HWND hwnd, ACCData* data) -{ - if (!data->showingFlash) - return; - - if ((data->hContact != NULL || data->proto[0] != '\0') && ServiceExists(MS_FAVATAR_DESTROY)) { - FLASHAVATAR fa = { 0 }; - fa.hContact = data->hContact; - fa.cProto = data->proto; - fa.hParentWindow = hwnd; - fa.id = 1675; - CallService(MS_FAVATAR_DESTROY, (WPARAM)&fa, 0); - } - - data->showingFlash = FALSE; -} - -void StartFlash(HWND hwnd, ACCData* data) -{ - if (!ServiceExists(MS_FAVATAR_MAKE)) - return; - - int format; - if (data->hContact != NULL) { - format = db_get_w(data->hContact, "ContactPhoto", "Format", 0); - } - else if (data->proto[0] != '\0') { - protoPicCacheEntry *ace = NULL; - for (int i = 0; i < g_MyAvatars.getCount(); i++) { - if (!lstrcmpA(data->proto, g_MyAvatars[i].szProtoname)) { - ace = &g_MyAvatars[i]; - break; - } - } - - if (ace != NULL && ace->szFilename != NULL) - format = ProtoGetAvatarFormat(ace->szFilename); - else - format = 0; - } - else return; - - if (format != PA_FORMAT_XML && format != PA_FORMAT_SWF) - return; - - FLASHAVATAR fa = { 0 }; - fa.hContact = data->hContact; - fa.cProto = data->proto; - fa.hParentWindow = hwnd; - fa.id = 1675; - CallService(MS_FAVATAR_MAKE, (WPARAM)&fa, 0); - - if (fa.hWindow == NULL) - return; - - data->showingFlash = TRUE; - ResizeFlash(hwnd, data); - SetBkgFlash(hwnd, data); -} - BOOL AnimatedGifGetData(ACCData* data) { FIBITMAP *page = fei->FI_LockPage(data->ag.multi, 0); @@ -394,16 +294,12 @@ ERR: void DestroyAnimation(HWND hwnd, ACCData* data) { - DestroyFlash(hwnd, data); DestroyAnimatedGif(hwnd, data); } void StartAnimation(HWND hwnd, ACCData* data) { - StartFlash(hwnd, data); - - if (!data->showingFlash) - StartAnimatedGif(hwnd, data); + StartAnimatedGif(hwnd, data); } BOOL ScreenToClient(HWND hWnd, LPRECT lpRect) @@ -497,7 +393,6 @@ static LRESULT CALLBACK ACCWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP data->bkgColor = -1; data->avatarBorderColor = -1; data->respectHidden = TRUE; - data->showingFlash = FALSE; data->resizeIfSmaller = TRUE; data->showingAnimatedGif = FALSE; data->fAero = FALSE; @@ -550,24 +445,18 @@ static LRESULT CALLBACK ACCWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP case AVATAR_SETBKGCOLOR: data->bkgColor = (COLORREF)lParam; - if (data->showingFlash) - SetBkgFlash(hwnd, data); NotifyAvatarChange(hwnd); Invalidate(hwnd); return TRUE; case AVATAR_SETBORDERCOLOR: data->borderColor = (COLORREF)lParam; - if (data->showingFlash) - ResizeFlash(hwnd, data); NotifyAvatarChange(hwnd); Invalidate(hwnd); return TRUE; case AVATAR_SETAVATARBORDERCOLOR: data->avatarBorderColor = (COLORREF)lParam; - if (data->showingFlash) - ResizeFlash(hwnd, data); NotifyAvatarChange(hwnd); Invalidate(hwnd); return TRUE; @@ -601,27 +490,13 @@ static LRESULT CALLBACK ACCWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP case AVATAR_GETUSEDSPACE: { - int *width = (int *)wParam; - int *height = (int *)lParam; + int *width = (int*)wParam; + int *height = (int*)lParam; RECT rc; GetClientRect(hwnd, &rc); // Get avatar - if (data->showingFlash && ServiceExists(MS_FAVATAR_GETINFO)) { - FLASHAVATAR fa = { 0 }; - fa.hContact = data->hContact; - fa.cProto = data->proto; - fa.hParentWindow = hwnd; - fa.id = 1675; - CallService(MS_FAVATAR_GETINFO, (WPARAM)&fa, 0); - if (fa.hWindow != NULL) { - *width = rc.right - rc.left; - *height = rc.bottom - rc.top; - return TRUE; - } - } - avatarCacheEntry *ace; if (data->hContact == NULL) ace = (avatarCacheEntry *)CallService(MS_AV_GETMYAVATAR, 0, (LPARAM)data->proto); @@ -697,22 +572,8 @@ static LRESULT CALLBACK ACCWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP DeleteObject(hbrush); } - if (data->hContact == NULL && data->proto[0] == '\0' - && db_get_b(NULL, AVS_MODULE, "GlobalUserAvatarNotConsistent", 1)) { + if (data->hContact == NULL && data->proto[0] == 0 && db_get_b(NULL, AVS_MODULE, "GlobalUserAvatarNotConsistent", 1)) DrawText(hdc, data->hFont, rc, TranslateT("Protocols have different avatars")); - } - - // Has a flash avatar - else if (data->showingFlash) { - // Don't draw - - // Draw control border if needed - if (data->borderColor == -1 && data->avatarBorderColor != -1) { - HBRUSH hbrush = CreateSolidBrush(data->avatarBorderColor); - FrameRect(hdc, &rc, hbrush); - DeleteObject(hbrush); - } - } // Has an animated gif // Has a "normal" image @@ -787,8 +648,6 @@ static LRESULT CALLBACK ACCWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP return TRUE; case WM_SIZE: - if (data->showingFlash) - ResizeFlash(hwnd, data); InvalidateRect(hwnd, NULL, TRUE); break; diff --git a/plugins/AVS/src/commonheaders.h b/plugins/AVS/src/commonheaders.h index a84d746d3a..c44fb6b08a 100644 --- a/plugins/AVS/src/commonheaders.h +++ b/plugins/AVS/src/commonheaders.h @@ -43,7 +43,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include #include -#include #include #include "resource.h" diff --git a/plugins/ExternalAPI/delphi/m_flash.inc b/plugins/ExternalAPI/delphi/m_flash.inc deleted file mode 100644 index c6c7cc1816..0000000000 --- a/plugins/ExternalAPI/delphi/m_flash.inc +++ /dev/null @@ -1,92 +0,0 @@ -{ -Miranda FlashAvatars Plugin -Plugin support header file -Copyright (C) 2006 Big Muscle - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -} - -{$IFNDEF M_FLASH} -{$DEFINE M_FLASH} -// Service functions - -{ - WPARAM FLASHAVATAR* (hContact, hParentWindow) - LPARAM not used -} - MS_FAVATAR_DESTROY = 'FlashAvatar/Destroy'; - -{ - WPARAM FLASHAVATAR* (hContact, hParentWindow) - LPARAM not used -} - MS_FAVATAR_MAKE = 'FlashAvatar/Make'; - -{ - WPARAM FLASHAVATAR* (hContact, hParentWindow) - LPARAM LPRECT -} - MS_FAVATAR_RESIZE = 'FlashAvatar/Resize'; - -{ - WPARAM FLASHAVATAR* (hContact, hParentWindow) - LPARAM LPRECT -} - MS_FAVATAR_SETPOS = 'FlashAvatar/SetPos'; - -{ - WPARAM FLASHAVATAR* (hContact, hParentWindow) - LPARAM not used -} - MS_FAVATAR_GETINFO = 'FlashAvatar/GetInfo'; - -{ - WPARAM FLASHAVATAR* (hContact, hParentWindow) - LPARAM BSTR -} - MS_FAVATAR_SETEMOFACE = 'FlashAvatar/SetEmoFace'; - -{ - WPARAM FLASHAVATAR* (hContact, hParentWindow) - LPARAM COLORREF -} - MS_FAVATAR_SETBKCOLOR = 'FlashAvatar/SetBkColor'; - -// Avatar emotion faces - AV_SMILE = 'smile'; - AV_SAD = 'sad'; - AV_LAUGH = 'laugh'; - AV_MAD = 'mad'; - AV_CRY = 'cry'; - AV_OFFLINE = 'offline'; - AV_BUSY = 'busy'; - AV_LOVE = 'love'; - AV_NORMAL = 'stam'; - -// Avatar default size - FAVATAR_WIDTH = 52; - FAVATAR_HEIGHT = 64; - -type - TFLASHAVATAR = record - hContact :TMCONTACT; // contact who flash avatar belongs to - hWindow :HWND; // handle of flash avatar object - hParentWindow:HWND; // handle of flash avatar's parent object - cUrl :TChar; // url of .swf file - id :int; // unique number of plugin which wants to use avatar service - cProto :PAnsiChar; // contacts protocol - end; - -{$ENDIF} diff --git a/plugins/ExternalAPI/m_flash.h b/plugins/ExternalAPI/m_flash.h deleted file mode 100644 index 96a8407103..0000000000 --- a/plugins/ExternalAPI/m_flash.h +++ /dev/null @@ -1,89 +0,0 @@ -/* -Miranda FlashAvatars Plugin -Plugin support header file -Copyright (C) 2006 Big Muscle - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -// Service functions - -/** - WPARAM FLASHAVATAR* (hContact, hParentWindow) - LPARAM not used - */ -#define MS_FAVATAR_DESTROY "FlashAvatar/Destroy" - -/** - WPARAM FLASHAVATAR* (hContact, hParentWindow) - LPARAM not used - */ -#define MS_FAVATAR_MAKE "FlashAvatar/Make" - -/** - WPARAM FLASHAVATAR* (hContact, hParentWindow) - LPARAM LPRECT - */ -#define MS_FAVATAR_RESIZE "FlashAvatar/Resize" - -/** - WPARAM FLASHAVATAR* (hContact, hParentWindow) - LPARAM LPRECT - */ -#define MS_FAVATAR_SETPOS "FlashAvatar/SetPos" - -/** - WPARAM FLASHAVATAR* (hContact, hParentWindow) - LPARAM not used - */ -#define MS_FAVATAR_GETINFO "FlashAvatar/GetInfo" - -/** - WPARAM FLASHAVATAR* (hContact, hParentWindow) - LPARAM BSTR - */ -#define MS_FAVATAR_SETEMOFACE "FlashAvatar/SetEmoFace" - -/** - WPARAM FLASHAVATAR* (hContact, hParentWindow) - LPARAM COLORREF - */ -#define MS_FAVATAR_SETBKCOLOR "FlashAvatar/SetBkColor" - -// Avatar emotion faces -#define AV_SMILE "smile" -#define AV_SAD "sad" -#define AV_LAUGH "laugh" -#define AV_MAD "mad" -#define AV_CRY "cry" -#define AV_OFFLINE "offline" -#define AV_BUSY "busy" -#define AV_LOVE "love" -#define AV_NORMAL "stam" - -// Avatar default size -#define FAVATAR_WIDTH 52 -#define FAVATAR_HEIGHT 64 - -// FLASHAVATAR structure -typedef struct { - MCONTACT hContact; // contact who flash avatar belongs to - HWND hWindow; // handle of flash avatar object - HWND hParentWindow; // handle of flash avatar's parent object - TCHAR* cUrl; // url of .swf file - int id; // unique number of plugin which wants to use avatar service - char* cProto; // contact's protocol - char reserved[16]; -} FLASHAVATAR; diff --git a/plugins/TabSRMM/src/commonheaders.h b/plugins/TabSRMM/src/commonheaders.h index 99f5890497..79da8bf610 100644 --- a/plugins/TabSRMM/src/commonheaders.h +++ b/plugins/TabSRMM/src/commonheaders.h @@ -89,7 +89,6 @@ #include #include #include -#include #include #define TSAPI __stdcall diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp index d76bb0021c..efe384d9fb 100644 --- a/plugins/TabSRMM/src/container.cpp +++ b/plugins/TabSRMM/src/container.cpp @@ -1747,14 +1747,6 @@ panel_found: return 0; case WM_DESTROY: - if (PluginConfig.g_FlashAvatarAvail) { // destroy own flash avatar - FLASHAVATAR fa = {0}; - TWindowData *dat = (TWindowData*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA); - - fa.id = 25367; - fa.cProto = dat ? dat->szProto : NULL; - CallService(MS_FAVATAR_DESTROY, (WPARAM)&fa, 0); - } pContainer->hwnd = 0; pContainer->hwndActive = 0; pContainer->hMenuContext = 0; diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index 3a08715d5d..3294c0b866 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -1826,20 +1826,6 @@ void TSAPI DM_UpdateTitle(TWindowData *dat, WPARAM wParam, LPARAM lParam) dat->Panel->Invalidate(); if (dat->pWnd) dat->pWnd->Invalidate(); - - if (PluginConfig.g_FlashAvatarAvail) { - FLASHAVATAR fa = {0}; - - fa.hContact = dat->hContact; - fa.hWindow = 0; - fa.id = 25367; - fa.cProto = dat->szProto; - - CallService(MS_FAVATAR_GETINFO, (WPARAM)&fa, 0); - dat->hwndFlash = fa.hWindow; - if (dat->hwndFlash) - SetParent(dat->hwndFlash, dat->Panel->isActive() ? dat->hwndPanelPicParent : GetDlgItem(hwndDlg, IDC_CONTACTPIC)); - } } // care about MetaContacts and update the statusbar icon with the currently "most online" contact... if (dat->bIsMeta) { diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp index c2216f2caa..b2c5a7efa7 100644 --- a/plugins/TabSRMM/src/globals.cpp +++ b/plugins/TabSRMM/src/globals.cpp @@ -123,9 +123,6 @@ void CGlobals::reloadSystemModulesChanged() HookEvent(ME_SMILEYADD_OPTIONSCHANGED, ::SmileyAddOptionsChanged); } - // Flashavatars - g_FlashAvatarAvail = (ServiceExists(MS_FAVATAR_GETINFO) ? 1 : 0); - // ieView BOOL bIEView = ServiceExists(MS_IEVIEW_WINDOW); if (bIEView) { diff --git a/plugins/TabSRMM/src/globals.h b/plugins/TabSRMM/src/globals.h index f0b031c50f..c2d41ae5b1 100644 --- a/plugins/TabSRMM/src/globals.h +++ b/plugins/TabSRMM/src/globals.h @@ -72,7 +72,6 @@ public: HCURSOR hCurSplitNS, hCurSplitWE, hCurHyperlinkHand; HBITMAP g_hbmUnknown; int g_SmileyAddAvail, g_WantIEView, g_PopupAvail, g_WantHPP; - int g_FlashAvatarAvail; HIMAGELIST g_hImageList; HICON g_IconMsgEvent, g_IconTypingEvent, g_IconFileEvent, g_IconSend; HICON g_IconMsgEventBig, g_IconTypingEventBig; diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index 43b46f8818..f94d5e955e 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -52,7 +52,8 @@ tooltips[] = { IDC_TOGGLESIDEBAR, LPGENT("Expand or collapse the side bar") } }; -static struct { +static struct +{ int id; HICON *pIcon; } @@ -65,7 +66,6 @@ buttonicons[] = static void _clrMsgFilter(LPARAM lParam) { MSGFILTER *m = reinterpret_cast(lParam); - m->msg = 0; m->lParam = 0; m->wParam = 0; @@ -80,24 +80,21 @@ BOOL TSAPI IsUtfSendAvailable(MCONTACT hContact) return (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_IMSENDUTF) ? TRUE : FALSE; } -/** - * show a modified context menu for the richedit control(s) - * @param dat message window data - * @param idFrom dlg ctrl id - * @param hwndFrom src window handle - * @param pt mouse pointer position - */ +///////////////////////////////////////////////////////////////////////////////////////// +// show a modified context menu for the richedit control(s) +// @param dat message window data +// @param idFrom dlg ctrl id +// @param hwndFrom src window handle +// @param pt mouse pointer position + static void ShowPopupMenu(TWindowData *dat, int idFrom, HWND hwndFrom, POINT pt) { - HMENU hMenu, hSubMenu; - CHARRANGE sel, all = { 0, -1}; - int iSelection; - unsigned oldCodepage = dat->codePage; - int iPrivateBG = M.GetByte(dat->hContact, "private_bg", 0); - MessageWindowPopupData mwpd; - HWND hwndDlg = dat->hwnd; + CHARRANGE sel, all = { 0, -1}; + int oldCodepage = dat->codePage; + int iPrivateBG = M.GetByte(dat->hContact, "private_bg", 0); + HWND hwndDlg = dat->hwnd; - hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_CONTEXT)); + HMENU hSubMenu, hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_CONTEXT)); if (idFrom == IDC_LOG) hSubMenu = GetSubMenu(hMenu, 0); else { @@ -111,27 +108,26 @@ static void ShowPopupMenu(TWindowData *dat, int idFrom, HWND hwndFrom, POINT pt) SendMessage(hwndFrom, EM_EXGETSEL, 0, (LPARAM)&sel); if (sel.cpMin == sel.cpMax) { EnableMenuItem(hSubMenu, IDM_COPY, MF_BYCOMMAND | MF_GRAYED); - //MAD EnableMenuItem(hSubMenu, IDM_QUOTE, MF_BYCOMMAND | MF_GRAYED); - //MAD_ if (idFrom == IDC_MESSAGE) EnableMenuItem(hSubMenu, IDM_CUT, MF_BYCOMMAND | MF_GRAYED); } if (idFrom == IDC_LOG) { - int i; - //MAD: quote mod InsertMenuA(hSubMenu, 6/*5*/, MF_BYPOSITION | MF_SEPARATOR, 0, 0); InsertMenu(hSubMenu, 7/*6*/, MF_BYPOSITION | MF_POPUP, (UINT_PTR) PluginConfig.g_hMenuEncoding, TranslateT("Character Encoding")); - for (i=0; i < GetMenuItemCount(PluginConfig.g_hMenuEncoding); i++) + for (int i=0; i < GetMenuItemCount(PluginConfig.g_hMenuEncoding); i++) CheckMenuItem(PluginConfig.g_hMenuEncoding, i, MF_BYPOSITION | MF_UNCHECKED); + if (dat->codePage == CP_ACP) CheckMenuItem(PluginConfig.g_hMenuEncoding, 0, MF_BYPOSITION | MF_CHECKED); else CheckMenuItem(PluginConfig.g_hMenuEncoding, dat->codePage, MF_BYCOMMAND | MF_CHECKED); + CheckMenuItem(hSubMenu, ID_LOG_FREEZELOG, MF_BYCOMMAND | (dat->dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED ? MF_CHECKED : MF_UNCHECKED)); } + MessageWindowPopupData mwpd; if (idFrom == IDC_LOG || idFrom == IDC_MESSAGE) { // First notification mwpd.cbSize = sizeof(mwpd); @@ -145,7 +141,7 @@ static void ShowPopupMenu(TWindowData *dat, int idFrom, HWND hwndFrom, POINT pt) NotifyEventHooks(PluginConfig.m_event_MsgPopup, 0, (LPARAM)&mwpd); } - iSelection = TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL); + int iSelection = TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL); if (idFrom == IDC_LOG || idFrom == IDC_MESSAGE) { // Second notification @@ -154,7 +150,7 @@ static void ShowPopupMenu(TWindowData *dat, int idFrom, HWND hwndFrom, POINT pt) NotifyEventHooks(PluginConfig.m_event_MsgPopup, 0, (LPARAM)&mwpd); } - if (((iSelection > 800 && iSelection < 1400) || iSelection == 20866) && idFrom == IDC_LOG) { + if (((iSelection > 800 && iSelection < 1400) || iSelection == 20866) && idFrom == IDC_LOG) { dat->codePage = iSelection; db_set_dw(dat->hContact, SRMSGMOD_T, "ANSIcodepage", dat->codePage); } @@ -247,9 +243,8 @@ LRESULT CALLBACK IEViewSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l return mir_callNextSubclass(hwnd, IEViewSubclassProc, msg, wParam, lParam); } -/* - * sublassing procedure for the h++ based message log viewer - */ +///////////////////////////////////////////////////////////////////////////////////////// +// sublassing procedure for the h++ based message log viewer LRESULT CALLBACK HPPKFSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { @@ -258,7 +253,7 @@ LRESULT CALLBACK HPPKFSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP BOOL isCtrl, isShift, isAlt; KbdState(mwdat, isShift, isCtrl, isAlt); - switch(msg) { + switch (msg) { case WM_NCCALCSIZE: return CSkin::NcCalcRichEditFrame(hwnd, mwdat, ID_EXTBKHISTORY, msg, wParam, lParam, HPPKFSubclassProc); case WM_NCPAINT: @@ -269,10 +264,11 @@ LRESULT CALLBACK HPPKFSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP if (wParam != VK_PRIOR && wParam != VK_NEXT && wParam != VK_DELETE && wParam != VK_MENU && wParam != VK_END && wParam != VK_HOME && wParam != VK_UP && wParam != VK_DOWN && wParam != VK_LEFT && - wParam != VK_RIGHT && wParam != VK_TAB && wParam != VK_SPACE) { - SetFocus(GetDlgItem(mwdat->hwnd,IDC_MESSAGE)); - keybd_event((BYTE)wParam, (BYTE)MapVirtualKey(wParam,0), KEYEVENTF_EXTENDEDKEY | 0, 0); - return 0; + wParam != VK_RIGHT && wParam != VK_TAB && wParam != VK_SPACE) + { + SetFocus(GetDlgItem(mwdat->hwnd, IDC_MESSAGE)); + keybd_event((BYTE)wParam, (BYTE)MapVirtualKey(wParam, 0), KEYEVENTF_EXTENDEDKEY | 0, 0); + return 0; } break; } @@ -281,14 +277,13 @@ LRESULT CALLBACK HPPKFSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP return mir_callNextSubclass(hwnd, HPPKFSubclassProc, msg, wParam, lParam); } -/* - * update state of the container - this is called whenever a tab becomes active, no matter how and - * deals with various things like updating the title bar, removing flashing icons, updating the - * session list, switching the keyboard layout (autolocale active) and the general container status. - * - * it protects itself from being called more than once per session activation and is valid for - * normal IM sessions *only*. Group chat sessions have their own activation handler (see chat/window.c) -*/ +///////////////////////////////////////////////////////////////////////////////////////// +// update state of the container - this is called whenever a tab becomes active, no matter how and +// deals with various things like updating the title bar, removing flashing icons, updating the +// session list, switching the keyboard layout (autolocale active) and the general container status. +// +// it protects itself from being called more than once per session activation and is valid for +// normal IM sessions *only*. Group chat sessions have their own activation handler (see chat/window.c) static void MsgWindowUpdateState(TWindowData *dat, UINT msg) { @@ -389,8 +384,8 @@ static void MsgWindowUpdateState(TWindowData *dat, UINT msg) if (dat->hwndIEView) { if (M.GetByte("subclassIEView", 0)) { mir_subclassWindow(dat->hwndIEView, IEViewSubclassProc); - SetWindowPos(dat->hwndIEView, 0, 0, 0, 0, 0, SWP_FRAMECHANGED|SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_DRAWFRAME); - RedrawWindow(dat->hwndIEView, 0, 0, RDW_FRAME|RDW_INVALIDATE|RDW_UPDATENOW); + SetWindowPos(dat->hwndIEView, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_DRAWFRAME); + RedrawWindow(dat->hwndIEView, 0, 0, RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW); } } dat->hwndIWebBrowserControl = WindowFromPoint(pt); @@ -419,8 +414,7 @@ static void MsgWindowUpdateState(TWindowData *dat, UINT msg) void TSAPI ShowMultipleControls(HWND hwndDlg, const UINT *controls, int cControls, int state) { - int i; - for (i=0; i < cControls; i++) + for (int i = 0; i < cControls; i++) Utils::showDlgControl(hwndDlg, controls[i], state); } @@ -475,8 +469,7 @@ void TSAPI SetDialogToType(HWND hwndDlg) SendMessage(hwndDlg, DM_UPDATETITLE, 0, 1); SendMessage(hwndDlg, WM_SIZE, 0, 0); - if (!PluginConfig.g_FlashAvatarAvail) - Utils::enableDlgControl(hwndDlg, IDC_CONTACTPIC, FALSE); + Utils::enableDlgControl(hwndDlg, IDC_CONTACTPIC, FALSE); dat->Panel->Configure(); } @@ -571,10 +564,8 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar if (mwdat == NULL) return 0; - /* - * prevent the rich edit from switching text direction or keyboard layout when - * using hotkeys with ctrl-shift or alt-shift modifiers - */ + // prevent the rich edit from switching text direction or keyboard layout when + // using hotkeys with ctrl-shift or alt-shift modifiers if (mwdat->fkeyProcessed && (msg == WM_KEYUP)) { GetKeyboardState(mwdat->kstate); if (mwdat->kstate[VK_CONTROL] & 0x80 || mwdat->kstate[VK_SHIFT] & 0x80) @@ -807,9 +798,9 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar case WM_USER + 100: SetFocus(hwnd); break; + case WM_CONTEXTMENU: POINT pt; - if (lParam == 0xFFFFFFFF) { CHARRANGE sel; SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM)&sel); @@ -827,6 +818,7 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar return mir_callNextSubclass(hwnd, MessageEditSubclassProc, msg, wParam, lParam); } +///////////////////////////////////////////////////////////////////////////////////////// // subclasses the avatar display controls, needed for skinning and to prevent // it from flickering during resize/move operations. @@ -850,6 +842,7 @@ LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM switch (msg) { case WM_NCHITTEST: return HTCLIENT; + case WM_SETCURSOR: GetClientRect(hwnd, &rc); SetCursor(rc.right > rc.bottom ? PluginConfig.hCurSplitNS : PluginConfig.hCurSplitWE); @@ -987,9 +980,8 @@ LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM return mir_callNextSubclass(hwnd, SplitterSubclassProc, msg, wParam, lParam); } -/* - * resizer proc for the "new" layout. - */ +///////////////////////////////////////////////////////////////////////////////////////// +// resizer proc for the "new" layout. static int MessageDialogResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL * urc) { @@ -1066,15 +1058,6 @@ static int MessageDialogResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL * SetWindowPos(dat->hwndContactPic, HWND_TOP, 1, ((urc->rcItem.bottom - urc->rcItem.top) - (dat->pic.cy)) / 2 + 1, //resizes it dat->pic.cx - 2, dat->pic.cy - 2, SWP_SHOWWINDOW); - if (PluginConfig.g_FlashAvatarAvail) { - RECT rc = { urc->rcItem.left, urc->rcItem.top, urc->rcItem.right, urc->rcItem.bottom }; - FLASHAVATAR fa = { 0 }; - - fa.hContact = !bInfoPanel ? dat->hContact : NULL; - fa.id = 25367; - fa.cProto = dat->szProto; - CallService(MS_FAVATAR_RESIZE, (WPARAM)&fa, (LPARAM)&rc); - } return RD_ANCHORX_RIGHT | RD_ANCHORY_BOTTOM; case IDC_SPLITTER: @@ -1656,16 +1639,6 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP rc.right = cx; rc.bottom--; - if (PluginConfig.g_FlashAvatarAvail) { - RECT rc1 = { 0, 0, rc.right - rc.left, rc.bottom - rc.top }; - if (dat->Panel->isActive()) { - FLASHAVATAR fa = { 0 }; - fa.hContact = dat->hContact; - fa.id = 25367; - fa.cProto = dat->szProto; - CallService(MS_FAVATAR_RESIZE, (WPARAM)&fa, (LPARAM)&rc1); - } - } if (dat->showInfoPic && (dat->hwndPanelPic || dat->hwndFlash)) { SetWindowPos(dat->hwndPanelPicParent, HWND_TOP, rc.left - 2, rc.top, rc.right - rc.left, (rc.bottom - rc.top) + 1, 0); ShowWindow(dat->hwndPanelPicParent, (dat->panelWidth == -1) || !dat->Panel->isActive() ? SW_HIDE : SW_SHOW); @@ -1951,14 +1924,11 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP } else { if (((NMHDR*)lParam)->idFrom == IDC_MESSAGE) { - if (GetSendButtonState(hwndDlg) != PBS_DISABLED && !(dat->pContainer->dwFlags & CNT_HIDETOOLBAR)) { + if (GetSendButtonState(hwndDlg) != PBS_DISABLED && !(dat->pContainer->dwFlags & CNT_HIDETOOLBAR)) SetFocus(GetDlgItem(hwndDlg, IDOK)); - return(_dlgReturn(hwndDlg, 1)); - } - else { + else SetFocus(GetDlgItem(hwndDlg, IDC_LOG)); - return(_dlgReturn(hwndDlg, 1)); - } + return(_dlgReturn(hwndDlg, 1)); } if (((NMHDR*)lParam)->idFrom == IDC_LOG) { SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE)); @@ -2217,12 +2187,11 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP return 0; case DM_LOADBUTTONBARICONS: - { - for (int i=0; i < SIZEOF(buttonicons); i++) { - SendDlgItemMessage(hwndDlg, buttonicons[i].id, BM_SETIMAGE, IMAGE_ICON, (LPARAM)*buttonicons[i].pIcon); - SendDlgItemMessage(hwndDlg, buttonicons[i].id, BUTTONSETCONTAINER, (LPARAM)m_pContainer, 0); - } + for (int i=0; i < SIZEOF(buttonicons); i++) { + SendDlgItemMessage(hwndDlg, buttonicons[i].id, BM_SETIMAGE, IMAGE_ICON, (LPARAM)*buttonicons[i].pIcon); + SendDlgItemMessage(hwndDlg, buttonicons[i].id, BUTTONSETCONTAINER, (LPARAM)m_pContainer, 0); } + BB_UpdateIcons(hwndDlg, dat); SendMessage(hwndDlg, DM_UPDATEWINICON, 0, 0); return 0; @@ -2253,20 +2222,6 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP return 0; case WM_SETFOCUS: - if (PluginConfig.g_FlashAvatarAvail) { // own avatar draw - FLASHAVATAR fa = { 0 }; - fa.cProto = dat->szProto; - fa.id = 25367; - - CallService(MS_FAVATAR_GETINFO, (WPARAM)&fa, 0); - if (fa.hWindow) { - if (dat->Panel->isActive()) { - SetParent(fa.hWindow, GetDlgItem(hwndDlg, IDC_CONTACTPIC)); - ShowWindow(fa.hWindow, SW_SHOW); - } - else ShowWindow(fa.hWindow, SW_HIDE); - } - } MsgWindowUpdateState(dat, WM_SETFOCUS); SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE)); return 1; @@ -2485,7 +2440,6 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP // for single message sends: basevalue (TIMERID_MSGSEND) + send queue index if (wParam >= TIMERID_MSGSEND) { int iIndex = wParam - TIMERID_MSGSEND; - if (iIndex < SendQueue::NR_SENDJOBS) { // single sendjob timer SendJob *job = sendQueue->getJobByIndex(iIndex); KillTimer(hwndDlg, wParam); @@ -3352,14 +3306,6 @@ quote_from_last: if (!dat) break; - if (PluginConfig.g_FlashAvatarAvail) { - FLASHAVATAR fa = { 0 }; - fa.hContact = dat->hContact; - fa.id = 25367; - fa.cProto = dat->szProto; - CallService(MS_FAVATAR_DESTROY, (WPARAM)&fa, 0); - } - if (dat->hwndContactPic) DestroyWindow(dat->hwndContactPic); diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp index 42af46825d..13672ea199 100644 --- a/plugins/TabSRMM/src/msgdlgutils.cpp +++ b/plugins/TabSRMM/src/msgdlgutils.cpp @@ -223,19 +223,8 @@ void TSAPI CalcDynamicAvatarSize(TWindowData *dat, BITMAP *bminfo) BOOL bBottomToolBar = dat->pContainer->dwFlags & CNT_BOTTOMTOOLBAR; BOOL bToolBar = dat->pContainer->dwFlags & CNT_HIDETOOLBAR ? 0 : 1; bool bInfoPanel = dat->Panel->isActive(); - int iSplitOffset = dat->bIsAutosizingInput ? 1 : 0; - - if (PluginConfig.g_FlashAvatarAvail) { - FLASHAVATAR fa = { 0 }; - fa.cProto = dat->szProto; - fa.id = 25367; - fa.hContact = bInfoPanel ? NULL : dat->hContact; - CallService(MS_FAVATAR_GETINFO, (WPARAM)&fa, 0); - if (fa.hWindow) { - bminfo->bmHeight = FAVATAR_HEIGHT; - bminfo->bmWidth = FAVATAR_WIDTH; - } - } + int iSplitOffset = dat->bIsAutosizingInput ? 1 : 0; + GetClientRect(dat->hwnd, &rc); if (dat->dwFlags & MWF_WASBACKGROUNDCREATE || dat->pContainer->dwFlags & CNT_DEFERREDCONFIGURE || dat->pContainer->dwFlags & CNT_CREATE_MINIMIZED || IsIconic(dat->pContainer->hwnd)) @@ -566,22 +555,8 @@ int TSAPI GetAvatarVisibility(HWND hwndDlg, TWindowData *dat) if (bOwnAvatarMode) dat->showPic = FALSE; else { - FLASHAVATAR fa = { 0 }; - if (PluginConfig.g_FlashAvatarAvail) { - fa.cProto = dat->szProto; - fa.id = 25367; - fa.hParentWindow = GetDlgItem(hwndDlg, IDC_CONTACTPIC); - - CallService(MS_FAVATAR_MAKE, (WPARAM)&fa, 0); - if (fa.hWindow != NULL&&dat->hwndContactPic) { - DestroyWindow(dat->hwndContactPic); - dat->hwndContactPic = NULL; - } - dat->showPic = ((dat->hOwnPic && dat->hOwnPic != PluginConfig.g_hbmUnknown) || (fa.hWindow != NULL)) ? 1 : 0; - } - else dat->showPic = (dat->hOwnPic && dat->hOwnPic != PluginConfig.g_hbmUnknown) ? 1 : 0; - - if (!PluginConfig.g_bDisableAniAvatars && fa.hWindow == NULL && !dat->hwndContactPic) + dat->showPic = (dat->hOwnPic && dat->hOwnPic != PluginConfig.g_hbmUnknown) ? 1 : 0; + if (!PluginConfig.g_bDisableAniAvatars && !dat->hwndContactPic) dat->hwndContactPic = CreateWindowEx(WS_EX_TOPMOST, AVATAR_CONTROL_CLASS, _T(""), WS_VISIBLE | WS_CHILD, 1, 1, 1, 1, GetDlgItem(hwndDlg, IDC_CONTACTPIC), (HMENU)0, NULL, NULL); } @@ -592,7 +567,6 @@ int TSAPI GetAvatarVisibility(HWND hwndDlg, TWindowData *dat) case 0: dat->showInfoPic = 1; case 1: - FLASHAVATAR fa = { 0 }; HBITMAP hbm = ((dat->ace && !(dat->ace->dwFlags & AVS_HIDEONCLIST)) ? dat->ace->hbmPic : 0); if (0 == hbm && 0 == bAvatarMode && !PluginConfig.g_bDisableAniAvatars) { @@ -600,31 +574,14 @@ int TSAPI GetAvatarVisibility(HWND hwndDlg, TWindowData *dat) break; } - if (PluginConfig.g_FlashAvatarAvail) { - fa.cProto = dat->szProto; - fa.id = 25367; - fa.hContact = dat->hContact; - fa.hParentWindow = dat->hwndPanelPicParent; - - CallService(MS_FAVATAR_MAKE, (WPARAM)&fa, 0); - if (fa.hWindow != NULL && dat->hwndPanelPic) { - DestroyWindow(dat->hwndPanelPic); - dat->hwndPanelPic = NULL; - ShowWindow(dat->hwndPanelPicParent, SW_SHOW); - EnableWindow(dat->hwndPanelPicParent, TRUE); - } - } - if (!PluginConfig.g_bDisableAniAvatars && fa.hWindow == NULL && !dat->hwndPanelPic) { + if (!PluginConfig.g_bDisableAniAvatars && !dat->hwndPanelPic) { dat->hwndPanelPic = CreateWindowEx(WS_EX_TOPMOST, AVATAR_CONTROL_CLASS, _T(""), WS_VISIBLE | WS_CHILD, 1, 1, 1, 1, dat->hwndPanelPicParent, (HMENU)7000, NULL, NULL); if (dat->hwndPanelPic) SendMessage(dat->hwndPanelPic, AVATAR_SETAEROCOMPATDRAWING, 0, TRUE); } - if (bAvatarMode != 0) { - if ((hbm && hbm != PluginConfig.g_hbmUnknown) || (fa.hWindow != NULL)) - dat->showInfoPic = 1; - else - dat->showInfoPic = 0; - } + + if (bAvatarMode != 0) + dat->showInfoPic = (hbm && hbm != PluginConfig.g_hbmUnknown); break; } @@ -660,27 +617,11 @@ int TSAPI GetAvatarVisibility(HWND hwndDlg, TWindowData *dat) case 3: // on, if present case 1: HBITMAP hbm = (dat->ace && !(dat->ace->dwFlags & AVS_HIDEONCLIST)) ? dat->ace->hbmPic : 0; - FLASHAVATAR fa = { 0 }; - - if (PluginConfig.g_FlashAvatarAvail) { - fa.cProto = dat->szProto; - fa.id = 25367; - fa.hContact = dat->hContact; - fa.hParentWindow = GetDlgItem(hwndDlg, IDC_CONTACTPIC); - CallService(MS_FAVATAR_MAKE, (WPARAM)&fa, 0); - - if (fa.hWindow != NULL&&dat->hwndContactPic) { - DestroyWindow(dat->hwndContactPic); - dat->hwndContactPic = NULL; - } - } - if (!PluginConfig.g_bDisableAniAvatars && fa.hWindow == NULL && !dat->hwndContactPic) + + if (!PluginConfig.g_bDisableAniAvatars && !dat->hwndContactPic) dat->hwndContactPic = CreateWindowEx(WS_EX_TOPMOST, AVATAR_CONTROL_CLASS, _T(""), WS_VISIBLE | WS_CHILD, 1, 1, 1, 1, GetDlgItem(hwndDlg, IDC_CONTACTPIC), (HMENU)0, NULL, NULL); - if ((hbm && hbm != PluginConfig.g_hbmUnknown) || (fa.hWindow != NULL)) - dat->showPic = 1; - else - dat->showPic = 0; + dat->showPic = (hbm && hbm != PluginConfig.g_hbmUnknown); break; } @@ -691,7 +632,7 @@ int TSAPI GetAvatarVisibility(HWND hwndDlg, TWindowData *dat) // reloads avatars if (dat->showPic) - if (dat->hwndPanelPic) //shows contact or user picture, depending on panel visibility + if (dat->hwndPanelPic) // shows contact or user picture, depending on panel visibility SendMessage(dat->hwndContactPic, AVATAR_SETPROTOCOL, 0, (LPARAM)dat->szProto); if (dat->hwndContactPic) @@ -783,38 +724,9 @@ void TSAPI AdjustBottomAvatarDisplay(TWindowData *dat) { if (dat) { bool bInfoPanel = dat->Panel->isActive(); - HBITMAP hbm = (bInfoPanel && dat->pContainer->avatarMode != 3) ? dat->hOwnPic : (dat->ace ? dat->ace->hbmPic : PluginConfig.g_hbmUnknown); HWND hwndDlg = dat->hwnd; - if (PluginConfig.g_FlashAvatarAvail) { - FLASHAVATAR fa = { 0 }; - - fa.hContact = dat->hContact; - fa.hWindow = 0; - fa.id = 25367; - fa.cProto = dat->szProto; - CallService(MS_FAVATAR_GETINFO, (WPARAM)&fa, 0); - if (fa.hWindow) { - dat->hwndFlash = fa.hWindow; - SetParent(dat->hwndFlash, bInfoPanel ? dat->hwndPanelPicParent : GetDlgItem(dat->hwnd, IDC_CONTACTPIC)); - } - fa.hContact = 0; - fa.hWindow = 0; - if (bInfoPanel) { - fa.hParentWindow = GetDlgItem(hwndDlg, IDC_CONTACTPIC); - CallService(MS_FAVATAR_MAKE, (WPARAM)&fa, 0); - if (fa.hWindow) { - SetParent(fa.hWindow, GetDlgItem(hwndDlg, IDC_CONTACTPIC)); - ShowWindow(fa.hWindow, SW_SHOW); - } - } - else { - CallService(MS_FAVATAR_GETINFO, (WPARAM)&fa, 0); - if (fa.hWindow) - ShowWindow(fa.hWindow, SW_HIDE); - } - } - + HBITMAP hbm = (bInfoPanel && dat->pContainer->avatarMode != 3) ? dat->hOwnPic : (dat->ace ? dat->ace->hbmPic : PluginConfig.g_hbmUnknown); if (hbm) { dat->showPic = GetAvatarVisibility(hwndDlg, dat); if (dat->dynaSplitter == 0 || dat->splitterY == 0) @@ -1701,68 +1613,19 @@ int TSAPI MsgWindowDrawHandler(WPARAM wParam, LPARAM lParam, TWindowData *dat) } if ((dis->hwndItem == GetDlgItem(hwndDlg, IDC_CONTACTPIC) && (dat->ace ? dat->ace->hbmPic : PluginConfig.g_hbmUnknown) && dat->showPic) || (dis->hwndItem == hwndDlg && dat->Panel->isActive() && (dat->ace ? dat->ace->hbmPic : PluginConfig.g_hbmUnknown))) { - HBRUSH hOldBrush; - BITMAP bminfo; - double dAspect = 0, dNewWidth = 0, dNewHeight = 0; - DWORD iMaxHeight = 0, top, cx, cy; - RECT rc, rcClient, rcFrame; - HDC hdcDraw; - HBITMAP hbmDraw, hbmOld; - BOOL bPanelPic = dis->hwndItem == hwndDlg; - DWORD aceFlags = 0; - HPEN hPenBorder = 0, hPenOld = 0; - HRGN clipRgn = 0; - int iRad = PluginConfig.m_WinVerMajor >= 5 ? 4 : 6; - BOOL flashAvatar = FALSE; - bool bInfoPanel = dat->Panel->isActive(); - - if (PluginConfig.g_FlashAvatarAvail && (!bPanelPic || (bPanelPic && dat->showInfoPic == 1))) { - FLASHAVATAR fa = { 0 }; - - fa.id = 25367; - fa.cProto = dat->szProto; - if (!bPanelPic && bInfoPanel) { - fa.hParentWindow = GetDlgItem(hwndDlg, IDC_CONTACTPIC); - CallService(MS_FAVATAR_MAKE, (WPARAM)&fa, 0); - Utils::enableDlgControl(hwndDlg, IDC_CONTACTPIC, fa.hWindow != 0); - } - else { - fa.hContact = dat->hContact; - fa.hParentWindow = bInfoPanel ? dat->hwndPanelPicParent : GetDlgItem(hwndDlg, IDC_CONTACTPIC); - CallService(MS_FAVATAR_MAKE, (WPARAM)&fa, 0); - if (bInfoPanel) { - if (fa.hWindow != NULL&&dat->hwndPanelPic) { - DestroyWindow(dat->hwndPanelPic); - dat->hwndPanelPic = NULL; - } - if (!PluginConfig.g_bDisableAniAvatars && fa.hWindow == 0 && dat->hwndPanelPic == 0) { - dat->hwndPanelPic = CreateWindowEx(WS_EX_TOPMOST, AVATAR_CONTROL_CLASS, _T(""), WS_VISIBLE | WS_CHILD, 1, 1, 1, 1, dat->hwndPanelPicParent, (HMENU)7000, NULL, NULL); - Utils::setAvatarContact(dat->hwndPanelPic, dat->hContact); - } - } - else { - if (fa.hWindow != NULL && dat->hwndContactPic) { - DestroyWindow(dat->hwndContactPic); - dat->hwndContactPic = NULL; - } - if (!PluginConfig.g_bDisableAniAvatars && fa.hWindow == 0 && dat->hwndContactPic == 0) { - dat->hwndContactPic = CreateWindowEx(WS_EX_TOPMOST, AVATAR_CONTROL_CLASS, _T(""), WS_VISIBLE | WS_CHILD, 1, 1, 1, 1, GetDlgItem(hwndDlg, IDC_CONTACTPIC), (HMENU)0, NULL, NULL); - Utils::setAvatarContact(dat->hwndContactPic, dat->hContact); - } - } - dat->hwndFlash = fa.hWindow; - } - if (fa.hWindow != 0) { - bminfo.bmHeight = FAVATAR_HEIGHT; - bminfo.bmWidth = FAVATAR_WIDTH; - CallService(MS_FAVATAR_SETBKCOLOR, (WPARAM)&fa, (LPARAM)GetSysColor(COLOR_3DFACE)); - flashAvatar = TRUE; - } - } + BITMAP bminfo; + double dAspect = 0, dNewWidth = 0, dNewHeight = 0; + DWORD iMaxHeight = 0, top, cx, cy; + RECT rc, rcClient, rcFrame; + BOOL bPanelPic = dis->hwndItem == hwndDlg; + DWORD aceFlags = 0; + HPEN hPenBorder = 0, hPenOld = 0; + HRGN clipRgn = 0; + int iRad = PluginConfig.m_WinVerMajor >= 5 ? 4 : 6; + bool bInfoPanel = dat->Panel->isActive(); if (bPanelPic) { - if (!flashAvatar) - GetObject(dat->ace ? dat->ace->hbmPic : PluginConfig.g_hbmUnknown, sizeof(bminfo), &bminfo); + GetObject(dat->ace ? dat->ace->hbmPic : PluginConfig.g_hbmUnknown, sizeof(bminfo), &bminfo); if ((dat->ace && dat->showInfoPic && !(dat->ace->dwFlags & AVS_HIDEONCLIST)) || dat->showInfoPic) aceFlags = dat->ace ? dat->ace->dwFlags : 0; @@ -1824,7 +1687,6 @@ int TSAPI MsgWindowDrawHandler(WPARAM wParam, LPARAM lParam, TWindowData *dat) } } else { - if (bminfo.bmHeight > 0) dAspect = (double)dat->iRealAvatarHeight / (double)bminfo.bmHeight; else @@ -1835,19 +1697,13 @@ int TSAPI MsgWindowDrawHandler(WPARAM wParam, LPARAM lParam, TWindowData *dat) iMaxHeight = dat->iRealAvatarHeight; } - if (flashAvatar) { - SetWindowPos(dat->hwndPanelPicParent, HWND_TOP, rcClient.left, rcClient.top, - (int)dNewWidth, (int)dNewHeight, SWP_SHOWWINDOW | SWP_NOCOPYBITS); - return TRUE; - } + HDC hdcDraw = CreateCompatibleDC(dis->hDC); + HBITMAP hbmDraw = CreateCompatibleBitmap(dis->hDC, cx, cy); + HBITMAP hbmOld = (HBITMAP)SelectObject(hdcDraw, hbmDraw); - hdcDraw = CreateCompatibleDC(dis->hDC); - hbmDraw = CreateCompatibleBitmap(dis->hDC, cx, cy); - hbmOld = (HBITMAP)SelectObject(hdcDraw, hbmDraw); + bool bAero = M.isAero(); - bool bAero = M.isAero(); - - hOldBrush = (HBRUSH)SelectObject(hdcDraw, bAero ? (HBRUSH)GetStockObject(HOLLOW_BRUSH) : GetSysColorBrush(COLOR_3DFACE)); + HBRUSH hOldBrush = (HBRUSH)SelectObject(hdcDraw, bAero ? (HBRUSH)GetStockObject(HOLLOW_BRUSH) : GetSysColorBrush(COLOR_3DFACE)); rcFrame = rcClient; if (!bPanelPic) { @@ -1914,10 +1770,8 @@ int TSAPI MsgWindowDrawHandler(WPARAM wParam, LPARAM lParam, TWindowData *dat) rcFrame.top += height_off; rcFrame.bottom += height_off; - /* - * prepare border drawing (if avatar is rendered by ACC, the parent control will be responsible for - * the border, so skip it here) - */ + // prepare border drawing (if avatar is rendered by ACC, the parent control will be responsible for + // the border, so skip it here) if (dat->hwndPanelPic == 0) { OffsetRect(&rcClient, -2, 0); if (CSkin::m_bAvatarBorderType == 1) @@ -1931,9 +1785,7 @@ int TSAPI MsgWindowDrawHandler(WPARAM wParam, LPARAM lParam, TWindowData *dat) } if (dat->hwndPanelPic) { - /* - * paint avatar using ACC - */ + // paint avatar using ACC SendMessage(dat->hwndPanelPic, AVATAR_SETAEROCOMPATDRAWING, 0, bAero ? TRUE : FALSE); SetWindowPos(dat->hwndPanelPic, HWND_TOP, rcFrame.left + border_off, rcFrame.top + border_off, rb.max_width, rb.max_height, SWP_SHOWWINDOW | SWP_ASYNCWINDOWPOS | SWP_DEFERERASE | SWP_NOSENDCHANGING); @@ -2100,7 +1952,7 @@ void TSAPI LoadOverrideTheme(TContainerData *pContainer) void TSAPI ConfigureSmileyButton(TWindowData *dat) { - HWND hwndDlg = dat->hwnd; + HWND hwndDlg = dat->hwnd; int nrSmileys = 0; int showToolbar = dat->pContainer->dwFlags & CNT_HIDETOOLBAR ? 0 : 1; int iItemID = IDC_SMILEYBTN; -- cgit v1.2.3