From baf37960ef71a5fab5cc37c17da9731b7d5f6b5b Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 18 Jun 2013 22:32:22 +0000 Subject: some cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@5032 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_modern/src/modern_clui.cpp | 101 +++++++++++++++++++++++++++++-- 1 file changed, 96 insertions(+), 5 deletions(-) (limited to 'plugins/Clist_modern/src/modern_clui.cpp') diff --git a/plugins/Clist_modern/src/modern_clui.cpp b/plugins/Clist_modern/src/modern_clui.cpp index cea7571750..ec9a5673ea 100644 --- a/plugins/Clist_modern/src/modern_clui.cpp +++ b/plugins/Clist_modern/src/modern_clui.cpp @@ -45,6 +45,95 @@ void DestroyTrayMenu(HMENU hMenu); #include #endif +/* Global variables */ + +UINT g_dwMainThreadID = 0; +HANDLE g_hAwayMsgThread = 0, g_hGetTextAsyncThread = 0, g_hSmoothAnimationThread = 0; + +HMENU g_hMenuMain; +BOOL g_bTransparentFlag = FALSE; + +BOOL g_mutex_bChangingMode = FALSE, g_mutex_bSizing = FALSE; + +BOOL g_flag_bOnModulesLoadedCalled = FALSE; + +RECT g_rcEdgeSizingRect={0}; + +BOOL (WINAPI *g_proc_SetLayeredWindowAttributesNew)(HWND,COLORREF,BYTE,DWORD); + +/* Module global variables */ + +static BYTE bAlphaEnd; +static BYTE bOldHideOffline; +static BYTE bOldUseGroups; + +static WORD wBehindEdgeShowDelay, + wBehindEdgeHideDelay, + wBehindEdgeBorderSize; + +static BOOL mutex_bAnimationInProgress=FALSE, + mutex_bShowHideCalledFromAnimation=FALSE, + mutex_bIgnoreActivation=FALSE, + mutex_bDisableAutoUpdate=TRUE, + mutex_bDuringSizing=FALSE, + mutex_bDelayedSizing=FALSE; //TBC is it need? + +static BOOL flag_bFirstTimeCall=FALSE; + +static BOOL bTransparentFocus=TRUE, + bNeedFixSizingRect=FALSE, + bShowEventStarted=FALSE; + +static HGENMENU hRenameMenuItem, hShowAvatarMenuItem, hHideAvatarMenuItem; + +static UINT uMsgGetProfile=0; + +static int nLastRequiredHeight=0, + nRequiredHeight=0, + nMirMenuState=0, + nStatusMenuState=0; + +static RECT rcNewWindowRect={0}, + rcOldWindowRect ={0}, + rcSizingRect={0}, + rcCorrectSizeRect={0}; + +static HANDLE hFrameContactTree; + +static PROTOTICKS CycleStartTick[64]={0};//max 64 protocols + +static int nAnimatedIconStep=100; + +HIMAGELIST hAvatarOverlays=NULL; + +OVERLAYICONINFO g_pAvatarOverlayIcons[ID_STATUS_OUTTOLUNCH - ID_STATUS_OFFLINE + 1] = +{ + { "AVATAR_OVERLAY_OFFLINE", LPGEN("Offline"), IDI_AVATAR_OVERLAY_OFFLINE, -1}, + { "AVATAR_OVERLAY_ONLINE", LPGEN("Online"), IDI_AVATAR_OVERLAY_ONLINE, -1}, + { "AVATAR_OVERLAY_AWAY", LPGEN("Away"), IDI_AVATAR_OVERLAY_AWAY, -1}, + { "AVATAR_OVERLAY_DND", LPGEN("DND"), IDI_AVATAR_OVERLAY_DND, -1}, + { "AVATAR_OVERLAY_NA", LPGEN("NA"), IDI_AVATAR_OVERLAY_NA, -1}, + { "AVATAR_OVERLAY_OCCUPIED", LPGEN("Occupied"), IDI_AVATAR_OVERLAY_OCCUPIED, -1}, + { "AVATAR_OVERLAY_CHAT", LPGEN("Free for chat"), IDI_AVATAR_OVERLAY_CHAT, -1}, + { "AVATAR_OVERLAY_INVISIBLE", LPGEN("Invisible"), IDI_AVATAR_OVERLAY_INVISIBLE, -1}, + { "AVATAR_OVERLAY_PHONE", LPGEN("On the phone"), IDI_AVATAR_OVERLAY_PHONE, -1}, + { "AVATAR_OVERLAY_LUNCH", LPGEN("Out to lunch"), IDI_AVATAR_OVERLAY_LUNCH, -1} +}; + +OVERLAYICONINFO g_pStatusOverlayIcons[ID_STATUS_OUTTOLUNCH - ID_STATUS_OFFLINE + 1] = +{ + { "STATUS_OVERLAY_OFFLINE", LPGEN("Offline"), IDI_STATUS_OVERLAY_OFFLINE, -1}, + { "STATUS_OVERLAY_ONLINE", LPGEN("Online"), IDI_STATUS_OVERLAY_ONLINE, -1}, + { "STATUS_OVERLAY_AWAY", LPGEN("Away"), IDI_STATUS_OVERLAY_AWAY, -1}, + { "STATUS_OVERLAY_DND", LPGEN("DND"), IDI_STATUS_OVERLAY_DND, -1}, + { "STATUS_OVERLAY_NA", LPGEN("NA"), IDI_STATUS_OVERLAY_NA, -1}, + { "STATUS_OVERLAY_OCCUPIED", LPGEN("Occupied"), IDI_STATUS_OVERLAY_OCCUPIED, -1}, + { "STATUS_OVERLAY_CHAT", LPGEN("Free for chat"), IDI_STATUS_OVERLAY_CHAT, -1}, + { "STATUS_OVERLAY_INVISIBLE", LPGEN("Invisible"), IDI_STATUS_OVERLAY_INVISIBLE, -1}, + { "STATUS_OVERLAY_PHONE", LPGEN("On the phone"), IDI_STATUS_OVERLAY_PHONE, -1}, + { "STATUS_OVERLAY_LUNCH", LPGEN("Out to lunch"), IDI_STATUS_OVERLAY_LUNCH, -1} +}; + //////////////// CLUI CLASS IMPLEMENTATION ///////////////////////////////// #include "hdr/modern_clui.h" @@ -249,7 +338,6 @@ HRESULT CLUI::LoadDllsRuntime() if (m_hUserDll) { g_proc_UpdateLayeredWindow = (BOOL (WINAPI *)(HWND,HDC,POINT*,SIZE*,HDC,POINT*,COLORREF,BLENDFUNCTION*,DWORD))GetProcAddress(m_hUserDll, "UpdateLayeredWindow"); g_proc_SetLayeredWindowAttributesNew = (BOOL (WINAPI *)(HWND,COLORREF,BYTE,DWORD))GetProcAddress(m_hUserDll, "SetLayeredWindowAttributes"); - g_proc_AnimateWindow = (BOOL (WINAPI*)(HWND,DWORD,DWORD))GetProcAddress(m_hUserDll,"AnimateWindow"); g_CluiData.fLayered = (g_proc_UpdateLayeredWindow != NULL) && !db_get_b(NULL,"ModernData","DisableEngine", SETTING_DISABLESKIN_DEFAULT); g_CluiData.fSmoothAnimation = IsWinVer2000Plus() && db_get_b(NULL, "CLUI", "FadeInOut", SETTING_FADEIN_DEFAULT); @@ -1278,7 +1366,6 @@ int CLUI_TestCursorOnBorders() if (g_bTransparentFlag) { if ( !bTransparentFocus && gf != hwnd) { CLUI_SmoothAlphaTransition(hwnd, db_get_b(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT), 1); - //g_proc_SetLayeredWindowAttributes(hwnd, RGB(0, 0, 0), (BYTE)db_get_b(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT), LWA_ALPHA); bTransparentFocus = 1; CLUI_SafeSetTimer(hwnd, TM_AUTOALPHA,250, NULL); } @@ -2654,9 +2741,13 @@ LRESULT CLUI::OnDestroy(UINT msg, WPARAM wParam, LPARAM lParam) while (CLUI_WaitThreadsCompletion(m_hWnd)); //stop all my threads TRACE("CLUI.c: WM_DESTROY - WaitThreadsCompletion DONE\n"); - for (int i=0; i < 64; i++) - if (CycleStartTick[i].szProto) - mir_free_and_nil(CycleStartTick[i].szProto); + for (int i=0; i < 64; i++) { + PROTOTICKS &p = CycleStartTick[i]; + if (p.szProto) + mir_free_and_nil(p.szProto); + if (p.himlIconList) + ImageList_Destroy(p.himlIconList); + } if (state == SETTING_STATE_NORMAL) CLUI_ShowWindowMod(m_hWnd,SW_HIDE); -- cgit v1.2.3