diff options
author | George Hazan <george.hazan@gmail.com> | 2013-06-19 17:58:14 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-06-19 17:58:14 +0000 |
commit | 9c2ff265738122969de9ec2ddbf936a93c656976 (patch) | |
tree | 389d11e14cb99f33c408f19bab141c7f7f828f57 /plugins/Clist_modern/src | |
parent | 09c0958aeb5c355b75d2cedf67e15ebb5098e980 (diff) |
removing old junk from clist_modern
git-svn-id: http://svn.miranda-ng.org/main/trunk@5045 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Clist_modern/src')
-rw-r--r-- | plugins/Clist_modern/src/hdr/modern_commonheaders.h | 43 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_clui.cpp | 181 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_utils.cpp | 9 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_xptheme.cpp | 49 |
4 files changed, 132 insertions, 150 deletions
diff --git a/plugins/Clist_modern/src/hdr/modern_commonheaders.h b/plugins/Clist_modern/src/hdr/modern_commonheaders.h index 2e80beb3d1..9a57cc9bba 100644 --- a/plugins/Clist_modern/src/hdr/modern_commonheaders.h +++ b/plugins/Clist_modern/src/hdr/modern_commonheaders.h @@ -268,26 +268,25 @@ int AniAva_RedrawAllAvatars(BOOL updateZOrder); // request to repaint all void AniAva_UpdateParent();
int AniAva_RenderAvatar( HANDLE hContact, HDC hdcMem, RECT *rc );
-
-#define CCI_NAME 1
-#define CCI_GROUP (1<<1)
-#define CCI_PROTO (1<<2)
-#define CCI_STATUS (1<<3)
-#define CCI_LINES (1<<4)
-#define CCI_HIDDEN (1<<4)
-#define CCI_NOHIDEOFFLINE (1<<5)
-#define CCI_NOPROTO (1<<6)
-#define CCI_HIDESUBCONTACT (1<<7)
-#define CCI_I (1<<8)
-#define CCI_APPARENT (1<<9)
-#define CCI_NOTONLIST (1<<10)
-#define CCI_IDLETS (1<<11)
-#define CCI_CCONTACT (1<<12)
-#define CCI_EXPAND (1<<13)
-#define CCI_UNKNOWN (1<<14)
-#define CCI_TIME (1<<15)
-#define CCI_OTHER ~( CCI_NAME|CCI_GROUP|CCI_PROTO|CCI_STATUS|CCI_LINES|CCI_TIME )
-#define CCI_ALL (0xFFFFFFFF)
+#define CCI_NAME 1
+#define CCI_GROUP (1<<1)
+#define CCI_PROTO (1<<2)
+#define CCI_STATUS (1<<3)
+#define CCI_LINES (1<<4)
+#define CCI_HIDDEN (1<<4)
+#define CCI_NOHIDEOFFLINE (1<<5)
+#define CCI_NOPROTO (1<<6)
+#define CCI_HIDESUBCONTACT (1<<7)
+#define CCI_I (1<<8)
+#define CCI_APPARENT (1<<9)
+#define CCI_NOTONLIST (1<<10)
+#define CCI_IDLETS (1<<11)
+#define CCI_CCONTACT (1<<12)
+#define CCI_EXPAND (1<<13)
+#define CCI_UNKNOWN (1<<14)
+#define CCI_TIME (1<<15)
+#define CCI_OTHER ~( CCI_NAME|CCI_GROUP|CCI_PROTO|CCI_STATUS|CCI_LINES|CCI_TIME )
+#define CCI_ALL (0xFFFFFFFF)
void CListSettings_FreeCacheItemData(ClcCacheEntry *pDst);
int CLUI_SyncGetPDNCE(WPARAM wParam, LPARAM lParam);
@@ -297,10 +296,6 @@ void pdnce___SetStatus( ClcCacheEntry *pdnce, WORD wStatus ); /* move to list module */
typedef void (*ItemDestuctor)(void*);
-void li_ListDestruct(SortedList *pList, ItemDestuctor pItemDestructor);
-
-#define mir_safe_free(a) if(a) mir_free(a)
-
template <class T> class INIT : public T
{
public:
diff --git a/plugins/Clist_modern/src/modern_clui.cpp b/plugins/Clist_modern/src/modern_clui.cpp index ec9a5673ea..ee9ce018ed 100644 --- a/plugins/Clist_modern/src/modern_clui.cpp +++ b/plugins/Clist_modern/src/modern_clui.cpp @@ -45,94 +45,94 @@ void DestroyTrayMenu(HMENU hMenu); #include <crtdbg.h>
#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} -}; +/* 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"
@@ -1080,9 +1080,10 @@ static int CLUI_CreateTimerForConnectingIcon(WPARAM wParam,LPARAM lParam) pt->himlIconList = ImageList_Create(16,16,ILC_MASK|ILC_COLOR32,cnt,1);
for (int i=0; i < cnt; i++) {
HICON ic = CLUI_GetConnectingIconForProto(szProto, i);
- if (ic)
+ if (ic) {
ImageList_AddIcon(pt->himlIconList, ic);
- DestroyIcon_protect(ic);
+ DestroyIcon(ic);
+ }
}
CLUI_SafeSetTimer(pcli->hwndContactList,TM_STATUSBARUPDATE+pt->nIndex,(int)(nAnimatedIconStep)/1,0);
pt->bTimerCreated = 1;
diff --git a/plugins/Clist_modern/src/modern_utils.cpp b/plugins/Clist_modern/src/modern_utils.cpp index 18c03de468..b843b28368 100644 --- a/plugins/Clist_modern/src/modern_utils.cpp +++ b/plugins/Clist_modern/src/modern_utils.cpp @@ -150,12 +150,3 @@ BOOL DestroyIcon_protect(HICON icon) if (icon) return DestroyIcon(icon);
return FALSE;
}
-
-void li_ListDestruct(SortedList *pList, ItemDestuctor pItemDestructor)
-{
- int i=0;
- if ( !pList) return;
- for (i=0; i < pList->realCount; i++) pItemDestructor(pList->items[i]);
- List_Destroy(pList);
- mir_free(pList);
-}
diff --git a/plugins/Clist_modern/src/modern_xptheme.cpp b/plugins/Clist_modern/src/modern_xptheme.cpp index 892926c842..dac9f7f525 100644 --- a/plugins/Clist_modern/src/modern_xptheme.cpp +++ b/plugins/Clist_modern/src/modern_xptheme.cpp @@ -12,7 +12,7 @@ typedef struct _tagXPTObject LPCWSTR lpcwClassObject;
} XPTObject;
-static SortedList * xptObjectList = NULL;
+static OBJLIST<XPTObject> xptObjectList(1);
static CRITICAL_SECTION xptCS;
static BOOL xptModuleLoaded = FALSE;
@@ -85,13 +85,12 @@ static void _sttXptReloadThemeData(XPTObject * xptObject) HRESULT XPThemesLoadModule()
{
- if (_xpt_ThemeSupport())
- {
- InitializeCriticalSection(&xptCS);
- xptObjectList = List_Create(0, 1);
- xptModuleLoaded = TRUE;
- }
- return S_OK;
+ if (_xpt_ThemeSupport())
+ {
+ InitializeCriticalSection(&xptCS);
+ xptModuleLoaded = TRUE;
+ }
+ return S_OK;
}
void XPThemesUnloadModule()
@@ -100,7 +99,7 @@ void XPThemesUnloadModule() xptlock();
xptModuleLoaded = FALSE;
xptunlock();
- li_ListDestruct(xptObjectList,_sttXptObjectDestructor);
+ xptObjectList.destroy();
DeleteCriticalSection(&xptCS);
FreeLibrary(_xpt_ThemeAPIHandle);
}
@@ -127,7 +126,7 @@ BOOL xpt_IsValidHandle(XPTHANDLE xptHandle) if ( !xptHandle) return FALSE;
xptlock();
{
- if (List_IndexOf(xptObjectList, (void*)xptHandle) != -1)
+ if (xptObjectList.indexOf((XPTObject*)xptHandle) != -1)
res = TRUE;
}
xptunlock();
@@ -140,11 +139,11 @@ XPTHANDLE xpt_AddThemeHandle(HWND hwnd, LPCWSTR className) xptcheck NULL;
xptlock();
{
- XPTObject* xptObject = (XPTObject*)mir_calloc(sizeof(XPTObject));
+ XPTObject* xptObject = new XPTObject;
xptObject->lpcwClassObject = className;
xptObject->hOwnerWindow = hwnd;
_sttXptReloadThemeData(xptObject);
- List_InsertPtr(xptObjectList, (void*)xptObject);
+ xptObjectList.insert(xptObject);
res = (XPTHANDLE)xptObject;
}
xptunlock();
@@ -160,7 +159,7 @@ void xpt_FreeThemeHandle(XPTHANDLE xptHandle) XPTObject* xptObject = (XPTObject*)xptHandle;
_sttXptCloseThemeData(xptObject);
_sttXptObjectDestructor((void *) xptHandle);
- List_Remove(xptObjectList, List_IndexOf(xptObjectList,(void *) xptHandle));
+ xptObjectList.remove( xptObjectList.indexOf(xptObject));
}
xptunlock();
}
@@ -169,18 +168,15 @@ void xpt_FreeThemeForWindow(HWND hwnd) xptcheck;
xptlock();
{
- int i=0;
- while (i < xptObjectList->realCount)
+ for (int i=0; i < xptObjectList.getCount(); )
{
- XPTObject* xptObject = (XPTObject*)xptObjectList->items[i];
- if (xptObject->hOwnerWindow == hwnd)
- {
- _sttXptCloseThemeData(xptObject);
- _sttXptObjectDestructor((void *) xptObject);
- List_Remove(xptObjectList, i);
- }
- else
- i++;
+ XPTObject& xptObject = xptObjectList[i];
+ if (xptObject.hOwnerWindow == hwnd)
+ {
+ _sttXptCloseThemeData(&xptObject);
+ xptObjectList.remove(i);
+ }
+ else i++;
}
}
xptunlock();
@@ -191,9 +187,8 @@ void xpt_OnWM_THEMECHANGED() xptcheck;
xptlock();
{
- int i;
- for (i=0; i < xptObjectList->realCount; i++)
- _sttXptReloadThemeData((XPTObject*)xptObjectList->items[i]);
+ for (int i=0; i < xptObjectList.getCount(); i++)
+ _sttXptReloadThemeData(&xptObjectList[i]);
}
xptunlock();
}
|