summaryrefslogtreecommitdiff
path: root/plugins/Clist_nicer/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Clist_nicer/src')
-rw-r--r--plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp11
-rw-r--r--plugins/Clist_nicer/src/CLUIFrames/movetogroup.cpp38
-rw-r--r--plugins/Clist_nicer/src/Include/clc.h62
-rw-r--r--plugins/Clist_nicer/src/Include/resource.h4
-rw-r--r--plugins/Clist_nicer/src/clc.cpp623
-rw-r--r--plugins/Clist_nicer/src/clcitems.cpp24
-rw-r--r--plugins/Clist_nicer/src/clcmsgs.cpp31
-rw-r--r--plugins/Clist_nicer/src/clcopts.cpp10
-rw-r--r--plugins/Clist_nicer/src/clistevents.cpp7
-rw-r--r--plugins/Clist_nicer/src/clistmenus.cpp7
-rw-r--r--plugins/Clist_nicer/src/clui.cpp196
-rw-r--r--plugins/Clist_nicer/src/cluiopts.cpp1
-rw-r--r--plugins/Clist_nicer/src/cluiservices.cpp1
-rw-r--r--plugins/Clist_nicer/src/init.cpp5
-rw-r--r--plugins/Clist_nicer/src/rowheight_funcs.cpp21
-rw-r--r--plugins/Clist_nicer/src/statusfloater.cpp1208
16 files changed, 391 insertions, 1858 deletions
diff --git a/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp b/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp
index 7d6e67b063..7e3e32361d 100644
--- a/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp
+++ b/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp
@@ -152,16 +152,7 @@ INT_PTR GroupMenuonAddService(WPARAM wParam,LPARAM lParam)
CheckMenuItem(hMenuOldContext, POPUP_SHOWMETAICONS, MF_BYCOMMAND | (cfg::dat.dwFlags & CLUI_USEMETAICONS ? MF_CHECKED : MF_UNCHECKED));
CheckMenuItem(hMenuOldContext, POPUP_SHOWSTATUSICONS, MF_BYCOMMAND | (cfg::dat.dwFlags & CLUI_FRAME_STATUSICONS ? MF_CHECKED : MF_UNCHECKED));
- // floater menu items
-
- EnableMenuItem(hMenuOldContext, POPUP_FLOATER_AUTOHIDE, MF_BYCOMMAND | (cfg::dat.bUseFloater & CLUI_USE_FLOATER ? MF_ENABLED : MF_GRAYED));
- EnableMenuItem(hMenuOldContext, POPUP_FLOATER_EVENTS, MF_BYCOMMAND | (cfg::dat.bUseFloater & CLUI_USE_FLOATER ? MF_ENABLED : MF_GRAYED));
- CheckMenuItem(hMenuOldContext, POPUP_FLOATER, MF_BYCOMMAND | (cfg::dat.bUseFloater & CLUI_USE_FLOATER ? MF_CHECKED : MF_UNCHECKED));
- CheckMenuItem(hMenuOldContext, POPUP_FLOATER_AUTOHIDE, MF_BYCOMMAND | (cfg::dat.bUseFloater & CLUI_FLOATER_AUTOHIDE ? MF_CHECKED : MF_UNCHECKED));
- CheckMenuItem(hMenuOldContext, POPUP_FLOATER_EVENTS, MF_BYCOMMAND | (cfg::dat.bUseFloater & CLUI_FLOATER_EVENTS ? MF_CHECKED : MF_UNCHECKED));
-
- mii->fMask|=MIIM_SUBMENU;
- //mi.fType=MFT_STRING;
+ mii->fMask |= MIIM_SUBMENU;
mii->hSubMenu=(HMENU)hMenuOldContext;
}
return(TRUE);
diff --git a/plugins/Clist_nicer/src/CLUIFrames/movetogroup.cpp b/plugins/Clist_nicer/src/CLUIFrames/movetogroup.cpp
deleted file mode 100644
index c0456bb1e1..0000000000
--- a/plugins/Clist_nicer/src/CLUIFrames/movetogroup.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-#include <commonheaders.h>
-
-HANDLE hPriorityItem = 0, hFloatingItem = 0;
-
-static int OnContactMenuBuild(WPARAM wParam,LPARAM lParam)
-{
- BYTE bSetting = cfg::getByte("CList", "flt_enabled", 0);
- if (bSetting && !hFloatingItem) {
- CLISTMENUITEM mi = { sizeof(mi) };
- mi.position=200000;
- mi.pszPopupName=(char *)-1;
- mi.pszService="CList/SetContactFloating";
- mi.pszName=LPGEN("&Floating Contact");
- if (SendMessage(pcli->hwndContactTree, CLM_QUERYFLOATINGCONTACT, wParam, 0))
- mi.flags = CMIF_CHECKED;
-
- hFloatingItem = Menu_AddContactMenuItem(&mi);
- }
- else if ( !bSetting && hFloatingItem) {
- CallService(MS_CLIST_REMOVECONTACTMENUITEM, (WPARAM)hFloatingItem, 0);
- hFloatingItem = 0;
- }
- else {
- CLISTMENUITEM mi = { sizeof(mi) };
- mi.flags = CMIM_FLAGS;
- if (SendMessage(pcli->hwndContactTree, CLM_QUERYFLOATINGCONTACT, wParam, 0))
- mi.flags |= CMIF_CHECKED;
-
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hFloatingItem, (LPARAM)&mi);
- }
- return 0;
-}
-
-int MTG_OnmodulesLoad(WPARAM wParam,LPARAM lParam)
-{
- HookEvent(ME_CLIST_PREBUILDCONTACTMENU,OnContactMenuBuild);
- return 0;
-}
diff --git a/plugins/Clist_nicer/src/Include/clc.h b/plugins/Clist_nicer/src/Include/clc.h
index c82a916a90..5bafa1080c 100644
--- a/plugins/Clist_nicer/src/Include/clc.h
+++ b/plugins/Clist_nicer/src/Include/clc.h
@@ -91,16 +91,6 @@
#define ECF_AVATAR 1
#define ECF_SECONDLINE 2
-struct ContactFloater {
- ContactFloater *pNextFloater;
- HWND hwnd;
- HDC hdc;
- HBITMAP hbm, hbmOld;
- HANDLE hContact;
-};
-
-typedef ContactFloater CONTACTFLOATER;
-
#define DSPF_CENTERSTATUSICON 1
#define DSPF_DIMIDLE 2
#define DSPF_NOFFLINEAVATARS 4
@@ -129,7 +119,6 @@ struct TExtraCache
DWORD dwCFlags;
DWORD dwDFlags; // display flags for caching only
StatusItems_t *status_item, *proto_status_item;
- CONTACTFLOATER *floater;
DWORD dwLastMsgTime;
DWORD msgFrequency;
BOOL isChatRoom;
@@ -230,10 +219,6 @@ struct ClcData : public ClcDataBase
#define MULTIROW_IFSPACE 2
#define MULTIROW_IFNEEDED 3
-#define CLUI_USE_FLOATER 1
-#define CLUI_FLOATER_AUTOHIDE 2
-#define CLUI_FLOATER_EVENTS 4
-
#define CLC_GROUPALIGN_LEFT 0
#define CLC_GROUPALIGN_RIGHT 1
#define CLC_GROUPALIGN_AUTO 2
@@ -319,7 +304,6 @@ struct TCluiData {
BYTE bFirstRun;
BYTE bUseDCMirroring;
BYTE bCLeft, bCRight, bCTop, bCBottom;
- BYTE bUseFloater;
BYTE fullyInited;
BYTE bAutoExpandGroups;
SIZE szOldCTreeSize;
@@ -451,20 +435,6 @@ void RTL_DetectAndSet(ClcContact *contact, HANDLE hContact);
void RTL_DetectGroupName(ClcContact *group);
void CLN_LoadAllIcons(BOOL mode);
void ReloadSkinItemsToCache();
-void SFL_RegisterWindowClass(), SFL_UnregisterWindowClass();
-void SFL_Create();
-void SFL_Destroy();
-void SFL_SetState(int iMode);
-void SFL_SetSize();
-void SFL_PaintNotifyArea();
-void SFL_Update(HICON hIcon, int iIcon, HIMAGELIST hIml, const TCHAR *szText, BOOL refresh);
-
-void FLT_Update(struct ClcData *dat, ClcContact *contact);
-int FLT_CheckAvail();
-void FLT_Create(int iEntry);
-void FLT_SetSize(struct TExtraCache *centry, LONG width, LONG height);
-void FLT_SyncWithClist();
-void FLT_ReadOptions(), FLT_WriteOptions(), FLT_RefreshAll();
//clcopts.c
int ClcOptInit(WPARAM wParam, LPARAM lParam);
@@ -528,8 +498,6 @@ int CoolSB_SetupScrollBar();
#define CLM_SETHIDESUBCONTACTS (CLM_FIRST+106)
#define CLM_TOGGLEPRIORITYCONTACT (CLM_FIRST+107)
#define CLM_QUERYPRIORITYCONTACT (CLM_FIRST+108)
-#define CLM_TOGGLEFLOATINGCONTACT (CLM_FIRST+109)
-#define CLM_QUERYFLOATINGCONTACT (CLM_FIRST+110)
#define IDC_RESETMODES 110
#define IDC_SELECTMODE 108
@@ -538,33 +506,3 @@ int CoolSB_SetupScrollBar();
#define NR_CLIENTS 40
typedef BOOL (WINAPI *PGF)(HDC, PTRIVERTEX, ULONG, PVOID, ULONG, ULONG);
-
-/*
- * floating stuff
- */
-
-#define FLT_SIMPLE 1
-#define FLT_AVATARS 2
-#define FLT_DUALROW 4
-#define FLT_EXTRAICONS 8
-#define FLT_SYNCWITHCLIST 16
-#define FLT_AUTOHIDE 32
-#define FLT_SNAP 64
-#define FLT_BORDER 128
-#define FLT_ROUNDED 256
-#define FLT_FILLSTDCOLOR 512
-#define FLT_SHOWTOOLTIPS 1024
-
-typedef struct _floatopts {
- DWORD dwFlags;
- BYTE pad_left, pad_right, pad_top, pad_bottom;
- DWORD width;
- COLORREF border_colour;
- BYTE trans, act_trans;
- BYTE radius;
- BYTE enabled;
- BYTE def_hover_time;
- WORD hover_time;
-} FLOATINGOPTIONS;
-
-extern FLOATINGOPTIONS g_floatoptions;
diff --git a/plugins/Clist_nicer/src/Include/resource.h b/plugins/Clist_nicer/src/Include/resource.h
index c8fc9dd09c..76c82fa2a3 100644
--- a/plugins/Clist_nicer/src/Include/resource.h
+++ b/plugins/Clist_nicer/src/Include/resource.h
@@ -3,7 +3,6 @@
// Используется d:\MNG_orig\plugins\Clist_nicer\res\resource.rc
//
#define IDD_OPT_VIEWMODES 1
-#define IDD_OPT_FLOATING 3
#define IDD_OPT_SKIN 4
#define IDD_QUICKIGNORE 5
#define IDD_OPT 6
@@ -364,12 +363,9 @@
#define IDC_FLT_OPACITY 40055
#define IDC_DSP_APPLY 40056
#define IDC_FLT_ACTIVEOPACITY 40056
-#define POPUP_FLOATER 40057
-#define POPUP_FLOATER_AUTOHIDE 40058
#define IDC_FLT_WIDTH 40058
#define IDC_AVATARDISPMODE 40059
#define IDC_FLT_WIDTHSPIN 40059
-#define POPUP_FLOATER_EVENTS 40060
#define IDC_FLT_SNAP 40060
#define IDC_FLT_ACTIVEOPACITYVALUE 40061
#define IDC_FLT_BORDER 40062
diff --git a/plugins/Clist_nicer/src/clc.cpp b/plugins/Clist_nicer/src/clc.cpp
index 36ca706c00..e494790e72 100644
--- a/plugins/Clist_nicer/src/clc.cpp
+++ b/plugins/Clist_nicer/src/clc.cpp
@@ -189,7 +189,6 @@ static int ClcSettingChanged(WPARAM wParam, LPARAM lParam)
static int ClcPreshutdown(WPARAM wParam, LPARAM lParam)
{
- SFL_Destroy();
cfg::shutDown = TRUE;
if (hSvc_GetContactStatusMsg)
DestroyServiceFunction(hSvc_GetContactStatusMsg);
@@ -205,7 +204,7 @@ int ClcShutdown(WPARAM wParam, LPARAM lParam)
DeleteObject(cfg::dat.hBrushAvatarBorder);
DestroyMenu(cfg::dat.hMenuNotify);
ClearIcons(1);
- SFL_UnregisterWindowClass();
+
if (cfg::eCache) {
for (int i = 0; i < cfg::nextCacheEntry; i++) {
if (cfg::eCache[i].statusMsg)
@@ -264,245 +263,243 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L
return ProcessExternalMessages(hwnd, dat, msg, wParam, lParam);
switch (msg) {
- case WM_CREATE:
- dat = (struct ClcData *)mir_alloc(sizeof(struct ClcData));
- memset(dat, 0, sizeof(struct ClcData));
- SetWindowLongPtr(hwnd, 0, (LONG_PTR) dat);
-
- RowHeight::Init(dat);
- dat->forceScroll = 0;
- dat->lastRepaint = 0;
- dat->hwndParent = GetParent(hwnd);
- dat->lastSort = GetTickCount();
- dat->needsResort = FALSE;
- {
- CREATESTRUCT *cs = (CREATESTRUCT *)lParam;
- if (cs->lpCreateParams == (LPVOID)0xff00ff00) {
- dat->bisEmbedded = FALSE;
- dat->bHideSubcontacts = TRUE;
- cfg::clcdat = dat;
- if (cfg::dat.bShowLocalTime)
- SetTimer(hwnd, TIMERID_REFRESH, 65000, NULL);
- } else
- dat->bisEmbedded = TRUE;
- }
- break;
+ case WM_CREATE:
+ dat = (struct ClcData *)mir_alloc(sizeof(struct ClcData));
+ memset(dat, 0, sizeof(struct ClcData));
+ SetWindowLongPtr(hwnd, 0, (LONG_PTR) dat);
+
+ RowHeight::Init(dat);
+ dat->forceScroll = 0;
+ dat->lastRepaint = 0;
+ dat->hwndParent = GetParent(hwnd);
+ dat->lastSort = GetTickCount();
+ dat->needsResort = FALSE;
+ {
+ CREATESTRUCT *cs = (CREATESTRUCT *)lParam;
+ if (cs->lpCreateParams == (LPVOID)0xff00ff00) {
+ dat->bisEmbedded = FALSE;
+ dat->bHideSubcontacts = TRUE;
+ cfg::clcdat = dat;
+ if (cfg::dat.bShowLocalTime)
+ SetTimer(hwnd, TIMERID_REFRESH, 65000, NULL);
+ } else
+ dat->bisEmbedded = TRUE;
+ }
+ break;
- case WM_SIZE:
- pcli->pfnEndRename(hwnd, dat, 1);
- KillTimer(hwnd, TIMERID_INFOTIP);
- KillTimer(hwnd, TIMERID_RENAME);
- pcli->pfnRecalcScrollBar(hwnd, dat);
+ case WM_SIZE:
+ pcli->pfnEndRename(hwnd, dat, 1);
+ KillTimer(hwnd, TIMERID_INFOTIP);
+ KillTimer(hwnd, TIMERID_RENAME);
+ pcli->pfnRecalcScrollBar(hwnd, dat);
LBL_Def:
- return DefWindowProc(hwnd, msg, wParam, lParam);
+ return DefWindowProc(hwnd, msg, wParam, lParam);
- case WM_NCCALCSIZE:
- return FrameNCCalcSize(hwnd, DefWindowProc, wParam, lParam, frameHasTitlebar);
+ case WM_NCCALCSIZE:
+ return FrameNCCalcSize(hwnd, DefWindowProc, wParam, lParam, frameHasTitlebar);
/*
- * scroll bar handling
+ * scroll bar handling
*/
- case WM_NCPAINT:
- return FrameNCPaint(hwnd, DefWindowProc, wParam, lParam, frameHasTitlebar);
-
- case INTM_GROUPCHANGED:
- {
- WORD iExtraImage[EXTRA_ICON_COUNT];
- BYTE flags = 0;
- if ( !FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL))
- memset(iExtraImage, 0xFF, sizeof(iExtraImage));
- else {
- memcpy(iExtraImage, contact->iExtraImage, sizeof(iExtraImage));
- flags = contact->flags;
- }
- pcli->pfnDeleteItemFromTree(hwnd, (HANDLE)wParam);
- if (GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_SHOWHIDDEN || !CLVM_GetContactHiddenStatus((HANDLE)wParam, NULL, dat)) {
- pcli->pfnAddContactToTree(hwnd, dat, (HANDLE)wParam, 1, 1);
- if (FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) {
- memcpy(contact->iExtraImage, iExtraImage, sizeof(iExtraImage));
- if (flags & CONTACTF_CHECKED)
- contact->flags |= CONTACTF_CHECKED;
- }
+ case WM_NCPAINT:
+ return FrameNCPaint(hwnd, DefWindowProc, wParam, lParam, frameHasTitlebar);
- NMCLISTCONTROL nm;
- nm.hdr.code = CLN_CONTACTMOVED;
- nm.hdr.hwndFrom = hwnd;
- nm.hdr.idFrom = GetDlgCtrlID(hwnd);
- nm.flags = 0;
- nm.hItem = (HANDLE)wParam;
- SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM) &nm);
+ case INTM_GROUPCHANGED:
+ {
+ WORD iExtraImage[EXTRA_ICON_COUNT];
+ BYTE flags = 0;
+ if ( !FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL))
+ memset(iExtraImage, 0xFF, sizeof(iExtraImage));
+ else {
+ memcpy(iExtraImage, contact->iExtraImage, sizeof(iExtraImage));
+ flags = contact->flags;
+ }
+ pcli->pfnDeleteItemFromTree(hwnd, (HANDLE)wParam);
+ if (GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_SHOWHIDDEN || !CLVM_GetContactHiddenStatus((HANDLE)wParam, NULL, dat)) {
+ pcli->pfnAddContactToTree(hwnd, dat, (HANDLE)wParam, 1, 1);
+ if (FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) {
+ memcpy(contact->iExtraImage, iExtraImage, sizeof(iExtraImage));
+ if (flags & CONTACTF_CHECKED)
+ contact->flags |= CONTACTF_CHECKED;
}
- dat->needsResort = TRUE;
- PostMessage(hwnd, INTM_SORTCLC, 0, 1);
+
+ NMCLISTCONTROL nm;
+ nm.hdr.code = CLN_CONTACTMOVED;
+ nm.hdr.hwndFrom = hwnd;
+ nm.hdr.idFrom = GetDlgCtrlID(hwnd);
+ nm.flags = 0;
+ nm.hItem = (HANDLE)wParam;
+ SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM) &nm);
}
- goto LBL_Def;
+ dat->needsResort = TRUE;
+ PostMessage(hwnd, INTM_SORTCLC, 0, 1);
+ }
+ goto LBL_Def;
- case INTM_ICONCHANGED:
- {
- int recalcScrollBar = 0;
- WORD status = ID_STATUS_OFFLINE;
- int contactRemoved = 0;
- HANDLE hSelItem = NULL;
- ClcContact *selcontact = NULL;
-
- char *szProto = GetContactProto((HANDLE)wParam);
- if (szProto == NULL)
- status = ID_STATUS_OFFLINE;
- else
- status = cfg::getWord((HANDLE)wParam, szProto, "Status", ID_STATUS_OFFLINE);
-
- int shouldShow = (GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_SHOWHIDDEN || !CLVM_GetContactHiddenStatus((HANDLE)wParam, szProto, dat)) && ((cfg::dat.bFilterEffective ? TRUE : !pcli->pfnIsHiddenMode(dat, status)) || CallService(MS_CLIST_GETCONTACTICON, wParam, 0) != lParam);// XXX CLVM changed - this means an offline msg is flashing, so the contact should be shown
-
- if ( !FindItem(hwnd, dat, (HANDLE)wParam, &contact, &group, NULL)) {
- if (shouldShow && CallService(MS_DB_CONTACT_IS, wParam, 0)) {
- if (dat->selection >= 0 && pcli->pfnGetRowByIndex(dat, dat->selection, &selcontact, NULL) != -1)
- hSelItem = pcli->pfnContactToHItem(selcontact);
- pcli->pfnAddContactToTree(hwnd, dat, (HANDLE)wParam, 0, 0);
- recalcScrollBar = 1;
- FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL);
- if (contact) {
- contact->iImage = (WORD) lParam;
- pcli->pfnNotifyNewContact(hwnd, (HANDLE)wParam);
- }
- }
- } else {
- //item in list already
- DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE);
- if (contact->iImage == (WORD) lParam)
- break;
- if ( !shouldShow && !(style & CLS_NOHIDEOFFLINE) && (style & CLS_HIDEOFFLINE || group->hideOffline || cfg::dat.bFilterEffective)) { // CLVM changed
- if (dat->selection >= 0 && pcli->pfnGetRowByIndex(dat, dat->selection, &selcontact, NULL) != -1)
- hSelItem = pcli->pfnContactToHItem(selcontact);
- pcli->pfnRemoveItemFromGroup(hwnd, group, contact, 0);
- contactRemoved = TRUE;
- recalcScrollBar = 1;
- } else {
+ case INTM_ICONCHANGED:
+ {
+ int recalcScrollBar = 0;
+ WORD status = ID_STATUS_OFFLINE;
+ int contactRemoved = 0;
+ HANDLE hSelItem = NULL;
+ ClcContact *selcontact = NULL;
+
+ char *szProto = GetContactProto((HANDLE)wParam);
+ if (szProto == NULL)
+ status = ID_STATUS_OFFLINE;
+ else
+ status = cfg::getWord((HANDLE)wParam, szProto, "Status", ID_STATUS_OFFLINE);
+
+ int shouldShow = (GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_SHOWHIDDEN || !CLVM_GetContactHiddenStatus((HANDLE)wParam, szProto, dat)) && ((cfg::dat.bFilterEffective ? TRUE : !pcli->pfnIsHiddenMode(dat, status)) || CallService(MS_CLIST_GETCONTACTICON, wParam, 0) != lParam);// XXX CLVM changed - this means an offline msg is flashing, so the contact should be shown
+
+ if ( !FindItem(hwnd, dat, (HANDLE)wParam, &contact, &group, NULL)) {
+ if (shouldShow && CallService(MS_DB_CONTACT_IS, wParam, 0)) {
+ if (dat->selection >= 0 && pcli->pfnGetRowByIndex(dat, dat->selection, &selcontact, NULL) != -1)
+ hSelItem = pcli->pfnContactToHItem(selcontact);
+ pcli->pfnAddContactToTree(hwnd, dat, (HANDLE)wParam, 0, 0);
+ recalcScrollBar = 1;
+ FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL);
+ if (contact) {
contact->iImage = (WORD) lParam;
- if ( !pcli->pfnIsHiddenMode(dat, status))
- contact->flags |= CONTACTF_ONLINE;
- else
- contact->flags &= ~CONTACTF_ONLINE;
+ pcli->pfnNotifyNewContact(hwnd, (HANDLE)wParam);
}
}
- if (hSelItem) {
- ClcGroup *selgroup;
- if (pcli->pfnFindItem(hwnd, dat, hSelItem, &selcontact, &selgroup, NULL))
- dat->selection = pcli->pfnGetRowsPriorTo(&dat->list, selgroup, List_IndexOf((SortedList*) & selgroup->cl, selcontact));
+ } else {
+ //item in list already
+ DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE);
+ if (contact->iImage == (WORD) lParam)
+ break;
+ if ( !shouldShow && !(style & CLS_NOHIDEOFFLINE) && (style & CLS_HIDEOFFLINE || group->hideOffline || cfg::dat.bFilterEffective)) { // CLVM changed
+ if (dat->selection >= 0 && pcli->pfnGetRowByIndex(dat, dat->selection, &selcontact, NULL) != -1)
+ hSelItem = pcli->pfnContactToHItem(selcontact);
+ pcli->pfnRemoveItemFromGroup(hwnd, group, contact, 0);
+ contactRemoved = TRUE;
+ recalcScrollBar = 1;
+ } else {
+ contact->iImage = (WORD) lParam;
+ if ( !pcli->pfnIsHiddenMode(dat, status))
+ contact->flags |= CONTACTF_ONLINE;
else
- dat->selection = -1;
+ contact->flags &= ~CONTACTF_ONLINE;
}
- dat->needsResort = TRUE;
- PostMessage(hwnd, INTM_SORTCLC, 0, recalcScrollBar);
- PostMessage(hwnd, INTM_INVALIDATE, 0, (LPARAM)(contactRemoved ? 0 : wParam));
- if (recalcScrollBar)
- pcli->pfnRecalcScrollBar(hwnd, dat);
- goto LBL_Def;
}
+ if (hSelItem) {
+ ClcGroup *selgroup;
+ if (pcli->pfnFindItem(hwnd, dat, hSelItem, &selcontact, &selgroup, NULL))
+ dat->selection = pcli->pfnGetRowsPriorTo(&dat->list, selgroup, List_IndexOf((SortedList*) & selgroup->cl, selcontact));
+ else
+ dat->selection = -1;
+ }
+ dat->needsResort = TRUE;
+ PostMessage(hwnd, INTM_SORTCLC, 0, recalcScrollBar);
+ PostMessage(hwnd, INTM_INVALIDATE, 0, (LPARAM)(contactRemoved ? 0 : wParam));
+ if (recalcScrollBar)
+ pcli->pfnRecalcScrollBar(hwnd, dat);
+ }
+ goto LBL_Def;
- case INTM_METACHANGED:
- if ( !pcli->pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL))
- break;
+ case INTM_METACHANGED:
+ if ( !pcli->pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL))
+ break;
- if (contact->bIsMeta && cfg::dat.bMetaAvail && !(cfg::dat.dwFlags & CLUI_USEMETAICONS)) {
- contact->hSubContact = (HANDLE) CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM) contact->hContact, 0);
- contact->metaProto = GetContactProto(contact->hSubContact);
- contact->iImage = CallService(MS_CLIST_GETCONTACTICON, (WPARAM) contact->hSubContact, 0);
- if (contact->extraCacheEntry >= 0 && contact->extraCacheEntry < cfg::nextCacheEntry) {
- int subIndex = cfg::getCache(contact->hSubContact, contact->metaProto);
- ClcContact *subContact;
- if ( !pcli->pfnFindItem(hwnd, dat, (HANDLE)contact->hSubContact, &subContact, NULL, NULL))
- break;
+ if (contact->bIsMeta && cfg::dat.bMetaAvail && !(cfg::dat.dwFlags & CLUI_USEMETAICONS)) {
+ contact->hSubContact = (HANDLE) CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM) contact->hContact, 0);
+ contact->metaProto = GetContactProto(contact->hSubContact);
+ contact->iImage = CallService(MS_CLIST_GETCONTACTICON, (WPARAM) contact->hSubContact, 0);
+ if (contact->extraCacheEntry >= 0 && contact->extraCacheEntry < cfg::nextCacheEntry) {
+ int subIndex = cfg::getCache(contact->hSubContact, contact->metaProto);
+ ClcContact *subContact;
+ if ( !pcli->pfnFindItem(hwnd, dat, (HANDLE)contact->hSubContact, &subContact, NULL, NULL))
+ break;
- cfg::eCache[contact->extraCacheEntry].proto_status_item = GetProtocolStatusItem(contact->metaProto);
- if (subIndex >= 0 && subIndex <= cfg::nextCacheEntry) {
- cfg::eCache[contact->extraCacheEntry].status_item = cfg::eCache[subIndex].status_item;
- memcpy(contact->iExtraImage, subContact->iExtraImage, sizeof(contact->iExtraImage));
- }
+ cfg::eCache[contact->extraCacheEntry].proto_status_item = GetProtocolStatusItem(contact->metaProto);
+ if (subIndex >= 0 && subIndex <= cfg::nextCacheEntry) {
+ cfg::eCache[contact->extraCacheEntry].status_item = cfg::eCache[subIndex].status_item;
+ memcpy(contact->iExtraImage, subContact->iExtraImage, sizeof(contact->iExtraImage));
}
}
- SendMessage(hwnd, INTM_NAMEORDERCHANGED, wParam, lParam);
- goto LBL_Def;
-
- case INTM_METACHANGEDEVENT:
- if ( !FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL))
- break;
- if (lParam == 0)
- SendMessage(hwnd, CLM_AUTOREBUILD, 0, 0);
- goto LBL_Def;
+ }
+ SendMessage(hwnd, INTM_NAMEORDERCHANGED, wParam, lParam);
+ goto LBL_Def;
- case INTM_NAMECHANGED:
- ClcContact *contact;
- if ( !FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL))
- break;
- lstrcpyn(contact->szText, pcli->pfnGetContactDisplayName((HANDLE)wParam, 0), safe_sizeof(contact->szText));
+ case INTM_METACHANGEDEVENT:
+ if ( !FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL))
+ break;
+ if (lParam == 0)
+ SendMessage(hwnd, CLM_AUTOREBUILD, 0, 0);
+ goto LBL_Def;
- RTL_DetectAndSet(contact, 0);
+ case INTM_NAMECHANGED:
+ ClcContact *contact;
+ if ( !FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL))
+ break;
+ lstrcpyn(contact->szText, pcli->pfnGetContactDisplayName((HANDLE)wParam, 0), safe_sizeof(contact->szText));
- dat->needsResort = TRUE;
- PostMessage(hwnd, INTM_SORTCLC, 0, 0);
- goto LBL_Def;
+ RTL_DetectAndSet(contact, 0);
- case INTM_CODEPAGECHANGED:
- if ( !FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL))
- break;
- contact->codePage = cfg::getDword((HANDLE)wParam, "Tab_SRMsg", "ANSIcodepage", cfg::getDword((HANDLE)wParam, "UserInfo", "ANSIcodepage", CP_ACP));
- PostMessage(hwnd, INTM_INVALIDATE, 0, 0);
- goto LBL_Def;
+ dat->needsResort = TRUE;
+ PostMessage(hwnd, INTM_SORTCLC, 0, 0);
+ goto LBL_Def;
- case INTM_AVATARCHANGED:
- {
- avatarCacheEntry *cEntry = (struct avatarCacheEntry *)lParam;
- contact = NULL;
-
- if (wParam == 0) {
- //RemoveFromImgCache(0, cEntry);
- cfg::dat.bForceRefetchOnPaint = TRUE;
- RedrawWindow(hwnd, NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW);
- cfg::dat.bForceRefetchOnPaint = FALSE;
- goto LBL_Def;
- }
-
- if ( !FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL))
- return 0;
- contact->ace = cEntry;
- if (cEntry == NULL)
- contact->cFlags &= ~ECF_AVATAR;
- else {
- DWORD dwFlags;
-
- if (contact->extraCacheEntry >= 0 && contact->extraCacheEntry < cfg::nextCacheEntry)
- dwFlags = cfg::eCache[contact->extraCacheEntry].dwDFlags;
- else
- dwFlags = cfg::getDword(contact->hContact, "CList", "CLN_Flags", 0);
- if (cfg::dat.dwFlags & CLUI_FRAME_AVATARS)
- contact->cFlags = (dwFlags & ECF_HIDEAVATAR ? contact->cFlags & ~ECF_AVATAR : contact->cFlags | ECF_AVATAR);
- else
- contact->cFlags = (dwFlags & ECF_FORCEAVATAR ? contact->cFlags | ECF_AVATAR : contact->cFlags & ~ECF_AVATAR);
- }
- PostMessage(hwnd, INTM_INVALIDATE, 0, (LPARAM)contact->hContact);
+ case INTM_CODEPAGECHANGED:
+ if ( !FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL))
+ break;
+ contact->codePage = cfg::getDword((HANDLE)wParam, "Tab_SRMsg", "ANSIcodepage", cfg::getDword((HANDLE)wParam, "UserInfo", "ANSIcodepage", CP_ACP));
+ PostMessage(hwnd, INTM_INVALIDATE, 0, 0);
+ goto LBL_Def;
+
+ case INTM_AVATARCHANGED:
+ {
+ avatarCacheEntry *cEntry = (struct avatarCacheEntry *)lParam;
+ contact = NULL;
+
+ if (wParam == 0) {
+ //RemoveFromImgCache(0, cEntry);
+ cfg::dat.bForceRefetchOnPaint = TRUE;
+ RedrawWindow(hwnd, NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW);
+ cfg::dat.bForceRefetchOnPaint = FALSE;
+ goto LBL_Def;
}
- goto LBL_Def;
- case INTM_STATUSMSGCHANGED:
- {
- int index = -1;
- char *szProto = NULL;
-
- if ( !FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL))
- index = cfg::getCache((HANDLE)wParam, NULL);
- else {
- index = contact->extraCacheEntry;
- szProto = contact->proto;
- }
- GetCachedStatusMsg(index, szProto);
- PostMessage(hwnd, INTM_INVALIDATE, 0, (LPARAM)(contact ? contact->hContact : 0));
+ if ( !FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL))
+ return 0;
+ contact->ace = cEntry;
+ if (cEntry == NULL)
+ contact->cFlags &= ~ECF_AVATAR;
+ else {
+ DWORD dwFlags;
+
+ if (contact->extraCacheEntry >= 0 && contact->extraCacheEntry < cfg::nextCacheEntry)
+ dwFlags = cfg::eCache[contact->extraCacheEntry].dwDFlags;
+ else
+ dwFlags = cfg::getDword(contact->hContact, "CList", "CLN_Flags", 0);
+ if (cfg::dat.dwFlags & CLUI_FRAME_AVATARS)
+ contact->cFlags = (dwFlags & ECF_HIDEAVATAR ? contact->cFlags & ~ECF_AVATAR : contact->cFlags | ECF_AVATAR);
+ else
+ contact->cFlags = (dwFlags & ECF_FORCEAVATAR ? contact->cFlags | ECF_AVATAR : contact->cFlags & ~ECF_AVATAR);
}
- goto LBL_Def;
+ PostMessage(hwnd, INTM_INVALIDATE, 0, (LPARAM)contact->hContact);
+ }
+ goto LBL_Def;
+
+ case INTM_STATUSMSGCHANGED:
+ {
+ int index = -1;
+ char *szProto = NULL;
- case INTM_STATUSCHANGED: {
if ( !FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL))
- break;
+ index = cfg::getCache((HANDLE)wParam, NULL);
+ else {
+ index = contact->extraCacheEntry;
+ szProto = contact->proto;
+ }
+ GetCachedStatusMsg(index, szProto);
+ PostMessage(hwnd, INTM_INVALIDATE, 0, (LPARAM)(contact ? contact->hContact : 0));
+ }
+ goto LBL_Def;
+ case INTM_STATUSCHANGED:
+ if ( FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) {
WORD wStatus = cfg::getWord((HANDLE)wParam, contact->proto, "Status", ID_STATUS_OFFLINE);
if (cfg::dat.bNoOfflineAvatars && wStatus != ID_STATUS_OFFLINE && contact->wStatus == ID_STATUS_OFFLINE) {
contact->wStatus = wStatus;
@@ -511,72 +508,64 @@ LBL_Def:
}
contact->wStatus = wStatus;
goto LBL_Def;
- }
- case INTM_PROTOCHANGED:
- if ( !FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL))
- break;
+ }
+ break;
- contact->proto = GetContactProto((HANDLE)wParam);
- CallService(MS_CLIST_INVALIDATEDISPLAYNAME, wParam, 0);
- lstrcpyn(contact->szText, pcli->pfnGetContactDisplayName((HANDLE)wParam, 0), safe_sizeof(contact->szText));
+ case INTM_PROTOCHANGED:
+ if ( !FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL))
+ break;
- RTL_DetectAndSet(contact, 0);
+ contact->proto = GetContactProto((HANDLE)wParam);
+ CallService(MS_CLIST_INVALIDATEDISPLAYNAME, wParam, 0);
+ lstrcpyn(contact->szText, pcli->pfnGetContactDisplayName((HANDLE)wParam, 0), safe_sizeof(contact->szText));
- dat->needsResort = TRUE;
- PostMessage(hwnd, INTM_SORTCLC, 0, 0);
- goto LBL_Def;
+ RTL_DetectAndSet(contact, 0);
- case INTM_INVALIDATE:
- if ( !dat->bNeedPaint) {
- KillTimer(hwnd, TIMERID_PAINT);
- SetTimer(hwnd, TIMERID_PAINT, 100, NULL);
- dat->bNeedPaint = TRUE;
- }
+ dat->needsResort = TRUE;
+ PostMessage(hwnd, INTM_SORTCLC, 0, 0);
+ goto LBL_Def;
- if (lParam && !dat->bisEmbedded) {
- if (FindItem(hwnd, dat, (HANDLE)lParam, &contact, NULL, 0)) {
- if (contact && contact->extraCacheEntry >= 0 && contact->extraCacheEntry < cfg::nextCacheEntry && cfg::eCache[contact->extraCacheEntry].floater)
- FLT_Update(dat, contact);
- }
- }
- goto LBL_Def;
+ case INTM_INVALIDATE:
+ if ( !dat->bNeedPaint) {
+ KillTimer(hwnd, TIMERID_PAINT);
+ SetTimer(hwnd, TIMERID_PAINT, 100, NULL);
+ dat->bNeedPaint = TRUE;
+ }
+ goto LBL_Def;
- case INTM_INVALIDATECONTACT:
- {
- if ( !FindItem(hwnd, dat, (HANDLE)wParam, &contact, &group, NULL))
- break;
+ case INTM_INVALIDATECONTACT:
+ {
+ if ( !FindItem(hwnd, dat, (HANDLE)wParam, &contact, &group, NULL))
+ break;
- if (contact == 0 || group == 0)
- break;
+ if (contact == 0 || group == 0)
+ break;
- int iItem = pcli->pfnGetRowsPriorTo(&dat->list, group, List_IndexOf((SortedList*) & group->cl, contact));
- pcli->pfnInvalidateItem(hwnd, dat, iItem);
- }
- goto LBL_Def;
+ int iItem = pcli->pfnGetRowsPriorTo(&dat->list, group, List_IndexOf((SortedList*) & group->cl, contact));
+ pcli->pfnInvalidateItem(hwnd, dat, iItem);
+ }
+ goto LBL_Def;
- case INTM_FORCESORT:
- dat->needsResort = TRUE;
- return SendMessage(hwnd, INTM_SORTCLC, wParam, lParam);
+ case INTM_FORCESORT:
+ dat->needsResort = TRUE;
+ return SendMessage(hwnd, INTM_SORTCLC, wParam, lParam);
- case INTM_SORTCLC:
- if (dat->needsResort) {
- pcli->pfnSortCLC(hwnd, dat, TRUE);
- dat->needsResort = FALSE;
- }
- if (lParam)
- pcli->pfnRecalcScrollBar(hwnd, dat);
- goto LBL_Def;
+ case INTM_SORTCLC:
+ if (dat->needsResort) {
+ pcli->pfnSortCLC(hwnd, dat, TRUE);
+ dat->needsResort = FALSE;
+ }
+ if (lParam)
+ pcli->pfnRecalcScrollBar(hwnd, dat);
+ goto LBL_Def;
- case INTM_IDLECHANGED: {
+ case INTM_IDLECHANGED:
+ if ( FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) {
DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *) lParam;
- char *szProto;
- ClcContact *contact = NULL;
-
- if ( !FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL))
- break;
- szProto = (char*)cws->szModule;
+ char *szProto = (char*)cws->szModule;
if (szProto == NULL)
break;
+
contact->flags &= ~CONTACTF_IDLE;
if (cfg::getDword((HANDLE)wParam, szProto, "IdleTS", 0)) {
contact->flags |= CONTACTF_IDLE;
@@ -584,13 +573,14 @@ LBL_Def:
PostMessage(hwnd, INTM_INVALIDATE, 0, (LPARAM)contact->hContact);
goto LBL_Def;
}
- case INTM_XSTATUSCHANGED: {
- DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *) lParam;
- char *szProto;
- ClcContact *contact = NULL;
+ break;
+
+ case INTM_XSTATUSCHANGED:
+ {
int index;
- szProto = (char *)cws->szModule;
+ DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *) lParam;
+ char *szProto = (char *)cws->szModule;
if ( !FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) {
index = cfg::getCache((HANDLE)wParam, szProto);
@@ -599,7 +589,7 @@ LBL_Def:
HANDLE hMasterContact = (HANDLE)cfg::getDword((HANDLE)wParam, cfg::dat.szMetaName, "Handle", 0);
if (hMasterContact && hMasterContact != (HANDLE)wParam) // avoid recursive call of settings handler
cfg::writeByte(hMasterContact, cfg::dat.szMetaName, "XStatusId",
- (BYTE)cfg::getByte((HANDLE)wParam, szProto, "XStatusId", 0));
+ (BYTE)cfg::getByte((HANDLE)wParam, szProto, "XStatusId", 0));
break;
}
}
@@ -609,14 +599,16 @@ LBL_Def:
}
if (szProto == NULL)
break;
+
GetCachedStatusMsg(index, szProto);
PostMessage(hwnd, INTM_INVALIDATE, 0, (LPARAM)(contact ? contact->hContact : 0));
- goto LBL_Def;
}
- case WM_PAINT: {
- HDC hdc;
+ goto LBL_Def;
+
+ case WM_PAINT:
+ {
PAINTSTRUCT ps;
- hdc = BeginPaint(hwnd, &ps);
+ HDC hdc = BeginPaint(hwnd, &ps);
if (IsWindowVisible(hwnd) && !during_sizing && !cfg::shutDown) {
PaintClc(hwnd, dat, hdc, &ps.rcPaint);
dat->bNeedPaint = FALSE;
@@ -627,35 +619,35 @@ LBL_Def:
SetDBButtonStates(0);
dat->oldSelection = dat->selection;
}
- goto LBL_Def;
}
+ goto LBL_Def;
- case WM_MOUSEWHEEL:
- dat->forceScroll = TRUE;
- break;
+ case WM_MOUSEWHEEL:
+ dat->forceScroll = TRUE;
+ break;
- case WM_TIMER:
- if (wParam == TIMERID_PAINT) {
- KillTimer(hwnd, TIMERID_PAINT);
- InvalidateRect(hwnd, NULL, FALSE);
- goto LBL_Def;
- }
-
- if (wParam == TIMERID_REFRESH) {
- InvalidateRect(hwnd, NULL, FALSE);
- goto LBL_Def;
- }
- break;
+ case WM_TIMER:
+ if (wParam == TIMERID_PAINT) {
+ KillTimer(hwnd, TIMERID_PAINT);
+ InvalidateRect(hwnd, NULL, FALSE);
+ goto LBL_Def;
+ }
- case WM_LBUTTONDBLCLK: {
- ClcContact *contact;
+ if (wParam == TIMERID_REFRESH) {
+ InvalidateRect(hwnd, NULL, FALSE);
+ goto LBL_Def;
+ }
+ break;
+
+ case WM_LBUTTONDBLCLK:
+ ReleaseCapture();
+ dat->iHotTrack = -1;
+ pcli->pfnHideInfoTip(hwnd, dat);
+ KillTimer(hwnd, TIMERID_RENAME);
+ KillTimer(hwnd, TIMERID_INFOTIP);
+ dat->szQuickSearch[0] = 0;
+ {
DWORD hitFlags;
- ReleaseCapture();
- dat->iHotTrack = -1;
- pcli->pfnHideInfoTip(hwnd, dat);
- KillTimer(hwnd, TIMERID_RENAME);
- KillTimer(hwnd, TIMERID_INFOTIP);
- dat->szQuickSearch[0] = 0;
dat->selection = HitTest(hwnd, dat, (short) LOWORD(lParam), (short) HIWORD(lParam), &contact, NULL, &hitFlags);
if (hitFlags & CLCHT_ONITEMEXTRA)
break;
@@ -671,10 +663,11 @@ LBL_Def:
UpdateWindow(hwnd);
pcli->pfnDoSelectionDefaultAction(hwnd, dat);
}
- return TRUE;
}
- case WM_CONTEXTMENU: {
- ClcContact *contact;
+ return TRUE;
+
+ case WM_CONTEXTMENU:
+ {
HMENU hMenu = NULL;
POINT pt;
DWORD hitFlags;
@@ -711,7 +704,7 @@ LBL_Def:
ClientToScreen(hwnd, &pt);
TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, pcli->hwndContactList, NULL);
CheckMenuItem(hMenu, POPUP_GROUPHIDEOFFLINE, contact->group->hideOffline ? MF_CHECKED : MF_UNCHECKED);
- DestroyMenu(hMenu);
+ DestroyMenu(hMenu);
return 0;
} else if (contact->type == CLCIT_CONTACT)
hMenu = (HMENU) CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM) contact->hContact, 0);
@@ -725,32 +718,26 @@ LBL_Def:
TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, hwnd, NULL);
DestroyMenu(hMenu);
}
- return 0;
}
- case WM_COMMAND:
- if (LOWORD(wParam) == POPUP_NEWGROUP)
- SendMessage(GetParent(hwnd), msg, wParam, lParam);
- break;
+ return 0;
- case WM_NCHITTEST: {
+ case WM_COMMAND:
+ if (LOWORD(wParam) == POPUP_NEWGROUP)
+ SendMessage(GetParent(hwnd), msg, wParam, lParam);
+ break;
+
+ case WM_NCHITTEST:
+ {
LRESULT lr = SendMessage(GetParent(hwnd), WM_NCHITTEST, wParam, lParam);
if (lr == HTLEFT || lr == HTRIGHT || lr == HTBOTTOM || lr == HTTOP || lr == HTTOPLEFT || lr == HTTOPRIGHT
- || lr == HTBOTTOMLEFT || lr == HTBOTTOMRIGHT)
+ || lr == HTBOTTOMLEFT || lr == HTBOTTOMRIGHT)
return HTTRANSPARENT;
- break;
}
- case WM_DESTROY: {
- int i;
+ break;
- if ( !dat->bisEmbedded) {
- for (i = 0; i < cfg::nextCacheEntry; i++) {
- if (cfg::eCache[i].floater && cfg::eCache[i].floater->hwnd)
- DestroyWindow(cfg::eCache[i].floater->hwnd);
- }
- }
- RowHeight::Free(dat);
- break;
- }
+ case WM_DESTROY:
+ RowHeight::Free(dat);
+ break;
}
return saveContactListControlWndProc(hwnd, msg, wParam, lParam);
diff --git a/plugins/Clist_nicer/src/clcitems.cpp b/plugins/Clist_nicer/src/clcitems.cpp
index 37135af5ce..2170d2c9e6 100644
--- a/plugins/Clist_nicer/src/clcitems.cpp
+++ b/plugins/Clist_nicer/src/clcitems.cpp
@@ -78,15 +78,6 @@ ClcGroup *AddGroup(HWND hwnd, struct ClcData *dat, const TCHAR *szName, DWORD fl
return p;
}
-ClcGroup *RemoveItemFromGroup(HWND hwnd, ClcGroup *group, ClcContact *contact, int updateTotalCount)
-{
- if (contact->extraCacheEntry >= 0 && contact->extraCacheEntry < cfg::nextCacheEntry)
- if (cfg::eCache[contact->extraCacheEntry].floater && cfg::eCache[contact->extraCacheEntry].floater->hwnd)
- ShowWindow(cfg::eCache[contact->extraCacheEntry].floater->hwnd, SW_HIDE);
-
- return(saveRemoveItemFromGroup(hwnd, group, contact, updateTotalCount));
-}
-
void LoadAvatarForContact(ClcContact *p)
{
DWORD dwFlags;
@@ -143,17 +134,9 @@ int AddContactToGroup(struct ClcData *dat, ClcGroup *group, HANDLE hContact)
else {
p->extraCacheEntry = cfg::getCache(p->hContact, p->proto);
GetExtendedInfo( p, dat);
- if (p->extraCacheEntry >= 0 && p->extraCacheEntry < cfg::nextCacheEntry) {
+ if (p->extraCacheEntry >= 0 && p->extraCacheEntry < cfg::nextCacheEntry)
cfg::eCache[p->extraCacheEntry].proto_status_item = GetProtocolStatusItem(p->bIsMeta ? p->metaProto : p->proto);
- if (cfg::getByte(p->hContact, "CList", "floating", 0) && g_floatoptions.enabled) {
- if (cfg::eCache[p->extraCacheEntry].floater == NULL)
- FLT_Create(p->extraCacheEntry);
- else {
- ShowWindow(cfg::eCache[p->extraCacheEntry].floater->hwnd, SW_SHOWNOACTIVATE);
- FLT_Update(dat, p);
- }
- }
- }
+
LoadAvatarForContact(p);
// notify other plugins to re-supply their extra images (icq for xstatus, mBirthday etc...)
pcli->pfnSetAllExtraIcons(pcli->hwndContactTree, hContact);
@@ -244,9 +227,6 @@ void RebuildEntireList(HWND hwnd, struct ClcData *dat)
pcli->pfnSortCLC(hwnd, dat, 0);
pcli->pfnSetAllExtraIcons(pcli->hwndContactTree, 0);
-
- if ( !dat->bisEmbedded)
- FLT_SyncWithClist();
}
/*
diff --git a/plugins/Clist_nicer/src/clcmsgs.cpp b/plugins/Clist_nicer/src/clcmsgs.cpp
index ddfefc3c64..7ea189e04c 100644
--- a/plugins/Clist_nicer/src/clcmsgs.cpp
+++ b/plugins/Clist_nicer/src/clcmsgs.cpp
@@ -96,37 +96,6 @@ LRESULT ProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM
}
return 0;
- case CLM_TOGGLEFLOATINGCONTACT:
- if (wParam) {
- ClcContact *contact = NULL;
- if ( !FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL))
- return 0;
- if (contact->type != CLCIT_CONTACT)
- return 0;
-
- int iEntry = contact->extraCacheEntry;
-
- if (iEntry >= 0 && iEntry <= cfg::nextCacheEntry) {
- BYTE state = !cfg::getByte(contact->hContact, "CList", "floating", 0);
- if (state) {
- if (cfg::eCache[iEntry].floater == NULL)
- FLT_Create(iEntry);
- ShowWindow(cfg::eCache[contact->extraCacheEntry].floater->hwnd, SW_SHOW);
- }
- else {
- if (cfg::eCache[iEntry].floater && cfg::eCache[iEntry].floater->hwnd) {
- DestroyWindow(cfg::eCache[iEntry].floater->hwnd);
- cfg::eCache[iEntry].floater = 0;
- }
- }
- cfg::writeByte(contact->hContact, "CList", "floating", state);
- }
- }
- return 0;
-
- case CLM_QUERYFLOATINGCONTACT:
- return cfg::getByte((HANDLE)wParam, "CList", "floating", 0);
-
case CLM_SETFONT:
if (HIWORD(lParam)<0 || HIWORD(lParam)>FONTID_LAST)
return 0;
diff --git a/plugins/Clist_nicer/src/clcopts.cpp b/plugins/Clist_nicer/src/clcopts.cpp
index f5747d4246..49f569fd6c 100644
--- a/plugins/Clist_nicer/src/clcopts.cpp
+++ b/plugins/Clist_nicer/src/clcopts.cpp
@@ -36,7 +36,6 @@ static INT_PTR CALLBACK DlgProcClcMainOpts(HWND hwndDlg, UINT msg, WPARAM wParam
static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
//static INT_PTR CALLBACK DlgProcClcTextOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
extern INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-extern INT_PTR CALLBACK DlgProcFloatingContacts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
extern INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
extern INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
extern INT_PTR CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
@@ -590,15 +589,6 @@ int ClcOptInit(WPARAM wParam, LPARAM lParam)
Options_AddPage(wParam, &odp);
////////////////////////////////////////////////////////////////////////////
-
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_FLOATING);
- odp.pszTitle = LPGEN("Floating contacts");
- odp.pszTab = NULL;
- odp.pfnDlgProc = DlgProcFloatingContacts;
- odp.flags = ODPF_BOLDGROUPS;
- Options_AddPage(wParam, &odp);
-
- ////////////////////////////////////////////////////////////////////////////
// Other options
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT);
diff --git a/plugins/Clist_nicer/src/clistevents.cpp b/plugins/Clist_nicer/src/clistevents.cpp
index 63cb6bb9d3..90fb3129dc 100644
--- a/plugins/Clist_nicer/src/clistevents.cpp
+++ b/plugins/Clist_nicer/src/clistevents.cpp
@@ -323,8 +323,6 @@ struct CListEvent* AddEvent(CLISTEVENT *cle)
}
}
InvalidateRect(hwndEventFrame, NULL, FALSE);
- if (cfg::dat.bUseFloater & CLUI_USE_FLOATER && cfg::dat.bUseFloater & CLUI_FLOATER_EVENTS)
- SFL_Update(0, 0, 0, NULL, FALSE);
}
return p;
@@ -385,11 +383,8 @@ int RemoveEvent(HANDLE hContact, HANDLE hDbEvent)
if (hContact == cfg::dat.hUpdateContact || (INT_PTR)hDbEvent == 1)
cfg::dat.hUpdateContact = 0;
- if (cfg::dat.notifyActive) {
+ if (cfg::dat.notifyActive)
InvalidateRect(hwndEventFrame, NULL, FALSE);
- if (cfg::dat.bUseFloater & CLUI_USE_FLOATER && cfg::dat.bUseFloater & CLUI_FLOATER_EVENTS)
- SFL_Update(0, 0, 0, NULL, FALSE);
- }
return 0;
}
diff --git a/plugins/Clist_nicer/src/clistmenus.cpp b/plugins/Clist_nicer/src/clistmenus.cpp
index bfabb68c49..300f7346e3 100644
--- a/plugins/Clist_nicer/src/clistmenus.cpp
+++ b/plugins/Clist_nicer/src/clistmenus.cpp
@@ -387,16 +387,9 @@ static INT_PTR SetContactIgnore(WPARAM wParam, LPARAM lParam)
* the desktop.
*/
-static INT_PTR SetContactFloating(WPARAM wParam, LPARAM lParam)
-{
- SendMessage(pcli->hwndContactTree, CLM_TOGGLEFLOATINGCONTACT, wParam, lParam);
- return 0;
-}
-
int InitCustomMenus(void)
{
CreateServiceFunction("CloseAction",CloseAction);
- CreateServiceFunction("CList/SetContactFloating", SetContactFloating);
CreateServiceFunction("CList/SetContactIgnore", SetContactIgnore);
{
//FYR: Visibility and ignore item moved back to clist_nicer from core
diff --git a/plugins/Clist_nicer/src/clui.cpp b/plugins/Clist_nicer/src/clui.cpp
index f3544e008c..b5a865b638 100644
--- a/plugins/Clist_nicer/src/clui.cpp
+++ b/plugins/Clist_nicer/src/clui.cpp
@@ -79,10 +79,7 @@ int LoadCluiServices(void);
void InitGroupMenus();
void FS_RegisterFonts();
void LoadExtraIconModule();
-int MTG_OnmodulesLoad(WPARAM wParam, LPARAM lParam);
void RemoveFromTaskBar(HWND hWnd);
-void FLT_ShowHideAll(int showCmd);
-void FLT_SnapToEdges(HWND hwnd);
void DestroyTrayMenu(HMENU hMenu);
extern LONG g_cxsmIcon, g_cysmIcon;
@@ -253,7 +250,6 @@ static int CluiModulesLoaded(WPARAM wParam, LPARAM lParam)
static char *szVersionUrl = "http://download.miranda.or.at/clist_nicer/0.9/versionW.txt";
static char *szUpdateUrl = "http://download.miranda.or.at/clist_nicer/0.9/clist_nicer_plusW.zip";
- MTG_OnmodulesLoad(wParam, lParam);
FS_RegisterFonts();
HookEvent(ME_FONT_RELOAD, FS_FontsChanged);
return 0;
@@ -575,7 +571,6 @@ void ReloadThemedOptions()
if (cfg::dat.hBrushColorKey)
DeleteObject(cfg::dat.hBrushColorKey);
cfg::dat.hBrushColorKey = CreateSolidBrush(RGB(255, 0, 255));
- cfg::dat.bUseFloater = cfg::getByte("CLUI", "FloaterMode", 0);
cfg::dat.bWantFastGradients = cfg::getByte("CLCExt", "FastGradients", 0);
cfg::dat.titleBarHeight = cfg::getByte("CLCExt", "frame_height", DEFAULT_TITLEBAR_HEIGHT);
cfg::dat.group_padding = cfg::getDword("CLCExt", "grp_padding", 0);
@@ -651,86 +646,82 @@ static void sttProcessResize(HWND hwnd, NMCLISTCONTROL *nmc)
int CustomDrawScrollBars(NMCSBCUSTOMDRAW *nmcsbcd)
{
switch (nmcsbcd->hdr.code) {
- case NM_COOLSB_CUSTOMDRAW: {
- static HDC hdcScroll = 0;
- static HBITMAP hbmScroll, hbmScrollOld;
- static LONG scrollLeft, scrollRight, scrollHeight, scrollYmin, scrollYmax;
-
- switch (nmcsbcd->dwDrawStage) {
- case CDDS_PREPAINT:
- if (cfg::dat.bSkinnedScrollbar) // XXX fix (verify skin items to be complete, otherwise don't draw
- return CDRF_SKIPDEFAULT;
- else
- return CDRF_DODEFAULT;
- case CDDS_POSTPAINT:
- return 0;
- case CDDS_ITEMPREPAINT: {
- HDC hdc = nmcsbcd->hdc;
- StatusItems_t *item = 0, *arrowItem = 0;
- UINT uItemID = ID_EXTBKSCROLLBACK;
- RECT rcWindow;
- POINT pt;
- DWORD dfcFlags;
- HRGN rgn = 0;
- GetWindowRect(pcli->hwndContactTree, &rcWindow);
- pt.x = rcWindow.left;
- pt.y = rcWindow.top;
- ScreenToClient(pcli->hwndContactList, &pt);
- hdcScroll = hdc;
- BitBlt(hdcScroll, nmcsbcd->rect.left, nmcsbcd->rect.top, nmcsbcd->rect.right - nmcsbcd->rect.left,
- nmcsbcd->rect.bottom - nmcsbcd->rect.top, cfg::dat.hdcBg, pt.x + nmcsbcd->rect.left, pt.y + nmcsbcd->rect.top, SRCCOPY);
-
- switch (nmcsbcd->uItem) {
- case HTSCROLL_UP:
- case HTSCROLL_DOWN:
- uItemID = (nmcsbcd->uState == CDIS_DEFAULT || nmcsbcd->uState == CDIS_DISABLED) ? ID_EXTBKSCROLLBUTTON :
- (nmcsbcd->uState == CDIS_HOT ? ID_EXTBKSCROLLBUTTONHOVER : ID_EXTBKSCROLLBUTTONPRESSED);
- break;
- case HTSCROLL_PAGEGDOWN:
- case HTSCROLL_PAGEGUP:
- uItemID = nmcsbcd->uItem == HTSCROLL_PAGEGUP ? ID_EXTBKSCROLLBACK : ID_EXTBKSCROLLBACKLOWER;;
- rgn = CreateRectRgn(nmcsbcd->rect.left, nmcsbcd->rect.top, nmcsbcd->rect.right, nmcsbcd->rect.bottom);
- SelectClipRgn(hdcScroll, rgn);
- break;
- case HTSCROLL_THUMB:
- uItemID = nmcsbcd->uState == CDIS_HOT ? ID_EXTBKSCROLLTHUMBHOVER : ID_EXTBKSCROLLTHUMB;
- uItemID = nmcsbcd->uState == CDIS_SELECTED ? ID_EXTBKSCROLLTHUMBPRESSED : ID_EXTBKSCROLLTHUMB;
- break;
- default:
- break;
- }
+ case NM_COOLSB_CUSTOMDRAW:
+ static HDC hdcScroll = 0;
+ static HBITMAP hbmScroll, hbmScrollOld;
+ static LONG scrollLeft, scrollRight, scrollHeight, scrollYmin, scrollYmax;
+
+ switch (nmcsbcd->dwDrawStage) {
+ case CDDS_PREPAINT:
+ if (cfg::dat.bSkinnedScrollbar) // XXX fix (verify skin items to be complete, otherwise don't draw
+ return CDRF_SKIPDEFAULT;
+ return CDRF_DODEFAULT;
+
+ case CDDS_POSTPAINT:
+ return 0;
- uItemID -= ID_STATUS_OFFLINE;
- item = arStatusItems[uItemID];
- if ( !item->IGNORED) {
- int alpha = nmcsbcd->uState == CDIS_DISABLED ? item->ALPHA - 50 : item->ALPHA;
- DrawAlpha(hdcScroll, &nmcsbcd->rect, item->COLOR, alpha, item->COLOR2, item->COLOR2_TRANSPARENT,
- item->GRADIENT, item->CORNER, item->BORDERSTYLE, item->imageItem);
- }
- dfcFlags = DFCS_FLAT | (nmcsbcd->uState == CDIS_DISABLED ? DFCS_INACTIVE :
- (nmcsbcd->uState == CDIS_HOT ? DFCS_HOT :
- (nmcsbcd->uState == CDIS_SELECTED ? DFCS_PUSHED : 0)));
-
- if (nmcsbcd->uItem == HTSCROLL_UP)
- arrowItem = arStatusItems[ID_EXTBKSCROLLARROWUP - ID_STATUS_OFFLINE];
- if (nmcsbcd->uItem == HTSCROLL_DOWN)
- arrowItem = arStatusItems[ID_EXTBKSCROLLARROWDOWN - ID_STATUS_OFFLINE];
- if (arrowItem && !arrowItem->IGNORED)
- DrawAlpha(hdcScroll, &nmcsbcd->rect, arrowItem->COLOR, arrowItem->ALPHA, arrowItem->COLOR2, arrowItem->COLOR2_TRANSPARENT,
- arrowItem->GRADIENT, arrowItem->CORNER, arrowItem->BORDERSTYLE, arrowItem->imageItem);
- else if (arrowItem)
- DrawFrameControl(hdcScroll, &nmcsbcd->rect, DFC_SCROLL, (nmcsbcd->uItem == HTSCROLL_UP ? DFCS_SCROLLUP : DFCS_SCROLLDOWN) | dfcFlags);
-
- if (rgn) {
- SelectClipRgn(hdcScroll, NULL);
- DeleteObject(rgn);
- }
- }
- default:
- break;
+ case CDDS_ITEMPREPAINT:
+ HDC hdc = nmcsbcd->hdc;
+ StatusItems_t *item = 0, *arrowItem = 0;
+ UINT uItemID = ID_EXTBKSCROLLBACK;
+ RECT rcWindow;
+ POINT pt;
+ DWORD dfcFlags;
+ HRGN rgn = 0;
+ GetWindowRect(pcli->hwndContactTree, &rcWindow);
+ pt.x = rcWindow.left;
+ pt.y = rcWindow.top;
+ ScreenToClient(pcli->hwndContactList, &pt);
+ hdcScroll = hdc;
+ BitBlt(hdcScroll, nmcsbcd->rect.left, nmcsbcd->rect.top, nmcsbcd->rect.right - nmcsbcd->rect.left,
+ nmcsbcd->rect.bottom - nmcsbcd->rect.top, cfg::dat.hdcBg, pt.x + nmcsbcd->rect.left, pt.y + nmcsbcd->rect.top, SRCCOPY);
+
+ switch (nmcsbcd->uItem) {
+ case HTSCROLL_UP:
+ case HTSCROLL_DOWN:
+ uItemID = (nmcsbcd->uState == CDIS_DEFAULT || nmcsbcd->uState == CDIS_DISABLED) ? ID_EXTBKSCROLLBUTTON :
+ (nmcsbcd->uState == CDIS_HOT ? ID_EXTBKSCROLLBUTTONHOVER : ID_EXTBKSCROLLBUTTONPRESSED);
+ break;
+ case HTSCROLL_PAGEGDOWN:
+ case HTSCROLL_PAGEGUP:
+ uItemID = nmcsbcd->uItem == HTSCROLL_PAGEGUP ? ID_EXTBKSCROLLBACK : ID_EXTBKSCROLLBACKLOWER;;
+ rgn = CreateRectRgn(nmcsbcd->rect.left, nmcsbcd->rect.top, nmcsbcd->rect.right, nmcsbcd->rect.bottom);
+ SelectClipRgn(hdcScroll, rgn);
+ break;
+ case HTSCROLL_THUMB:
+ uItemID = nmcsbcd->uState == CDIS_HOT ? ID_EXTBKSCROLLTHUMBHOVER : ID_EXTBKSCROLLTHUMB;
+ uItemID = nmcsbcd->uState == CDIS_SELECTED ? ID_EXTBKSCROLLTHUMBPRESSED : ID_EXTBKSCROLLTHUMB;
+ break;
+ default:
+ break;
+ }
+
+ uItemID -= ID_STATUS_OFFLINE;
+ item = arStatusItems[uItemID];
+ if ( !item->IGNORED) {
+ int alpha = nmcsbcd->uState == CDIS_DISABLED ? item->ALPHA - 50 : item->ALPHA;
+ DrawAlpha(hdcScroll, &nmcsbcd->rect, item->COLOR, alpha, item->COLOR2, item->COLOR2_TRANSPARENT,
+ item->GRADIENT, item->CORNER, item->BORDERSTYLE, item->imageItem);
+ }
+ dfcFlags = DFCS_FLAT | (nmcsbcd->uState == CDIS_DISABLED ? DFCS_INACTIVE :
+ (nmcsbcd->uState == CDIS_HOT ? DFCS_HOT :
+ (nmcsbcd->uState == CDIS_SELECTED ? DFCS_PUSHED : 0)));
+
+ if (nmcsbcd->uItem == HTSCROLL_UP)
+ arrowItem = arStatusItems[ID_EXTBKSCROLLARROWUP - ID_STATUS_OFFLINE];
+ if (nmcsbcd->uItem == HTSCROLL_DOWN)
+ arrowItem = arStatusItems[ID_EXTBKSCROLLARROWDOWN - ID_STATUS_OFFLINE];
+ if (arrowItem && !arrowItem->IGNORED)
+ DrawAlpha(hdcScroll, &nmcsbcd->rect, arrowItem->COLOR, arrowItem->ALPHA, arrowItem->COLOR2, arrowItem->COLOR2_TRANSPARENT,
+ arrowItem->GRADIENT, arrowItem->CORNER, arrowItem->BORDERSTYLE, arrowItem->imageItem);
+ else if (arrowItem)
+ DrawFrameControl(hdcScroll, &nmcsbcd->rect, DFC_SCROLL, (nmcsbcd->uItem == HTSCROLL_UP ? DFCS_SCROLLUP : DFCS_SCROLLDOWN) | dfcFlags);
+
+ if (rgn) {
+ SelectClipRgn(hdcScroll, NULL);
+ DeleteObject(rgn);
}
}
- return 0;
}
return 0;
}
@@ -776,8 +767,6 @@ static void ShowCLUI(HWND hwnd)
SendMessage(pcli->hwndContactList, WM_SIZE, 0, 0);
SendMessage(pcli->hwndContactTree, WM_SIZE, 0, 0);
}
- SFL_Create();
- SFL_SetState(cfg::dat.bUseFloater & CLUI_FLOATER_AUTOHIDE ? (old_cliststate == SETTING_STATE_NORMAL ? 0 : 1) : 1);
}
static void GetButtonRect(HWND hwnd, RECT *rc)
@@ -1301,15 +1290,6 @@ skipbg:
}
PostMessage(hwnd, CLUIINTM_REMOVEFROMTASKBAR, 0, 0);
- if (g_floatoptions.enabled) {
- if (wParam)
- FLT_ShowHideAll(SW_HIDE);
- else
- FLT_ShowHideAll(SW_SHOWNOACTIVATE);
- }
-
- if ( !cfg::dat.fadeinout)
- SFL_SetState(-1);
if (lParam)
return DefWindowProc(hwnd, msg, wParam, lParam);
if (noRecurse)
@@ -1334,7 +1314,6 @@ skipbg:
for (startTick = GetTickCount(); ;) {
thisTick = GetTickCount();
if (thisTick >= startTick + 200) {
- SFL_SetState(-1);
API::SetLayeredWindowAttributes(hwnd, cfg::dat.bFullTransparent ? cfg::dat.colorkey : RGB(0, 0, 0), (BYTE)(destAlpha), LWA_ALPHA | (cfg::dat.bFullTransparent ? LWA_COLORKEY : 0));
g_fading_active = 0;
return DefWindowProc(hwnd, msg, wParam, lParam);
@@ -1596,26 +1575,6 @@ buttons_done:
case POPUP_SHOWSTATUSICONS:
cfg::dat.dwFlags ^= CLUI_FRAME_STATUSICONS;
break;
- case POPUP_FLOATER:
- cfg::dat.bUseFloater ^= CLUI_USE_FLOATER;
- if (cfg::dat.bUseFloater & CLUI_USE_FLOATER) {
- SFL_Create();
- SFL_SetState(-1);
- } else
- SFL_Destroy();
- cfg::writeByte("CLUI", "FloaterMode", cfg::dat.bUseFloater);
- break;
- case POPUP_FLOATER_AUTOHIDE:
- cfg::dat.bUseFloater ^= CLUI_FLOATER_AUTOHIDE;
- SFL_SetState(cfg::dat.bUseFloater & CLUI_FLOATER_AUTOHIDE ? (cfg::getByte("CList", "State", SETTING_STATE_NORMAL) == SETTING_STATE_NORMAL ? 0 : 1) : 1);
- cfg::writeByte("CLUI", "FloaterMode", cfg::dat.bUseFloater);
- break;
- case POPUP_FLOATER_EVENTS:
- cfg::dat.bUseFloater ^= CLUI_FLOATER_EVENTS;
- SFL_SetSize();
- SFL_Update(0, 0, 0, NULL, FALSE);
- cfg::writeByte("CLUI", "FloaterMode", cfg::dat.bUseFloater);
- break;
}
if (dwOldFlags != cfg::dat.dwFlags) {
InvalidateRect(pcli->hwndContactTree, NULL, FALSE);
@@ -2032,8 +1991,6 @@ void LoadCLUIModule(void)
wndclass.lpszClassName = _T("EventAreaClass");
RegisterClass(&wndclass);
- SFL_RegisterWindowClass();
-
oldhideoffline = cfg::getByte("CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT);
cluiPos.left = cfg::getDword("CList", "x", 600);
cluiPos.top = cfg::getDword("CList", "y", 200);
@@ -2046,6 +2003,13 @@ void LoadCLUIModule(void)
CreateServiceFunction("CLN/About", CLN_ShowAbout);
CreateServiceFunction(MS_CLUI_SHOWMAINMENU, CLN_ShowMainMenu);
CreateServiceFunction(MS_CLUI_SHOWSTATUSMENU, CLN_ShowStatusMenu);
+
+ if ( cfg::getByte("CLUI", "FloaterMode", 0)) {
+ MessageBox(NULL,
+ TranslateT("You need the FloatingContacts plugin, cause the embedded floating contacts were removed"),
+ TranslateT("Warning"), MB_OK | MB_ICONWARNING);
+ db_unset(NULL, "CLUI", "FloaterMode");
+ }
}
void OnCreateClc()
diff --git a/plugins/Clist_nicer/src/cluiopts.cpp b/plugins/Clist_nicer/src/cluiopts.cpp
index 17e12b7cd9..15ad632d14 100644
--- a/plugins/Clist_nicer/src/cluiopts.cpp
+++ b/plugins/Clist_nicer/src/cluiopts.cpp
@@ -322,7 +322,6 @@ INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
SetWindowPos(pcli->hwndContactList, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW);
cfg::dat.fadeinout = oldFading;
- SFL_SetState(cfg::dat.bUseFloater & CLUI_FLOATER_AUTOHIDE ? (cfg::getByte("CList", "State", SETTING_STATE_NORMAL) == SETTING_STATE_NORMAL ? 0 : 1) : 1);
opt_clui_changed = 0;
pcli->pfnClcOptionsChanged();
diff --git a/plugins/Clist_nicer/src/cluiservices.cpp b/plugins/Clist_nicer/src/cluiservices.cpp
index df7296080f..b21bc4d392 100644
--- a/plugins/Clist_nicer/src/cluiservices.cpp
+++ b/plugins/Clist_nicer/src/cluiservices.cpp
@@ -254,6 +254,5 @@ void CluiProtocolStatusChanged( int parStatus, const char* szProto )
}
InvalidateRect(hwndTtbStatus, NULL, TRUE);
}
- SFL_Update(hIcon, iIcon, hCListImages, szStatus, TRUE);
}
}
diff --git a/plugins/Clist_nicer/src/init.cpp b/plugins/Clist_nicer/src/init.cpp
index 661dbfb617..9a020f6b36 100644
--- a/plugins/Clist_nicer/src/init.cpp
+++ b/plugins/Clist_nicer/src/init.cpp
@@ -68,9 +68,6 @@ void LoadClcOptions(HWND hwnd,struct ClcData *dat);
int ( *saveAddContactToGroup )(struct ClcData *dat, ClcGroup *group, HANDLE hContact);
int AddContactToGroup(struct ClcData *dat, ClcGroup *group, HANDLE hContact);
-ClcGroup* ( *saveRemoveItemFromGroup )(HWND hwnd, ClcGroup *group, ClcContact *contact, int updateTotalCount);
-ClcGroup* RemoveItemFromGroup(HWND hwnd, ClcGroup *group, ClcContact *contact, int updateTotalCount);
-
struct CListEvent* ( *saveAddEvent )(CLISTEVENT *cle);
struct CListEvent* AddEvent(CLISTEVENT *cle);
@@ -272,7 +269,6 @@ extern "C" int __declspec(dllexport) CListInitialise()
cfg::writeByte("CLUI", "firstrun", 0);
ReloadThemedOptions();
- FLT_ReadOptions();
Reload3dBevelColors();
cfg::dat.dwFlags = cfg::getDword("CLUI", "Frameflags", CLUI_FRAME_STATUSICONS | CLUI_FRAME_SHOWBOTTOMBUTTONS |
@@ -311,7 +307,6 @@ extern "C" int __declspec(dllexport) CListInitialise()
pcli->pfnShowHide = ShowHide;
saveAddContactToGroup = pcli->pfnAddContactToGroup; pcli->pfnAddContactToGroup = AddContactToGroup;
- saveRemoveItemFromGroup = pcli->pfnRemoveItemFromGroup; pcli->pfnRemoveItemFromGroup = RemoveItemFromGroup;
saveAddEvent = pcli->pfnAddEvent; pcli->pfnAddEvent = AddEvent;
saveRemoveEvent = pcli->pfnRemoveEvent; pcli->pfnRemoveEvent = RemoveEvent;
diff --git a/plugins/Clist_nicer/src/rowheight_funcs.cpp b/plugins/Clist_nicer/src/rowheight_funcs.cpp
index 918d600348..d3c9d52589 100644
--- a/plugins/Clist_nicer/src/rowheight_funcs.cpp
+++ b/plugins/Clist_nicer/src/rowheight_funcs.cpp
@@ -265,23 +265,6 @@ int RowHeight::getHeight(ClcData *dat, int item)
int RowHeight::getFloatingRowHeight(const ClcData *dat, HWND hwnd, ClcContact *contact, DWORD dwFlags)
{
- int height = 0;
-
- height = dat->fontInfo[GetBasicFontID(contact)].fontHeight;
-
- if ( !dat->bisEmbedded) {
- if ( !(dwFlags & FLT_SIMPLE)) {
- if (dwFlags & FLT_DUALROW) {
- height += (dat->fontInfo[FONTID_STATUS].fontHeight + cfg::dat.avatarPadding);
- }
- // Avatar size
- if (dwFlags & FLT_AVATARS && contact->cFlags & ECF_AVATAR && contact->type == CLCIT_CONTACT && contact->ace != NULL && !(contact->ace->dwFlags & AVS_HIDEONCLIST))
- height = max(height, cfg::dat.avatarSize + cfg::dat.avatarPadding);
- }
- }
-
- height = max(height, dat->min_row_heigh);
- height += cfg::dat.bRowSpacing;
-
- return height;
+ int height = max(dat->fontInfo[GetBasicFontID(contact)].fontHeight, dat->min_row_heigh);
+ return height + cfg::dat.bRowSpacing;
}
diff --git a/plugins/Clist_nicer/src/statusfloater.cpp b/plugins/Clist_nicer/src/statusfloater.cpp
deleted file mode 100644
index 751e9f29d6..0000000000
--- a/plugins/Clist_nicer/src/statusfloater.cpp
+++ /dev/null
@@ -1,1208 +0,0 @@
-/*
-
-Miranda IM: the free IM client for Microsoft* Windows*
-
-Copyright 2000-2003 Miranda ICQ/IM project,
-all portions of this codebase are copyrighted to the people
-listed in contributors.txt.
-
-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.
-
-------------------------
-
-implements a simple status floater as a layered (and skinnable) window with
-a minimalistic UI (change status, access main menu). It also may hold a copy
-of the event area.
-
-Also implementes floating contacts (FLT_*() functions)
-
-*/
-
-#include <commonheaders.h>
-
-#define SNAP_SCREEN_TOLERANCE 10
-#define SNAP_FLT_TOLERANCE 10
-#define TOOLTIP_TIMER 1
-
-#define MS_TOOLTIP_SHOWTIP "mToolTip/ShowTip"
-#define MS_TOOLTIP_HIDETIP "mToolTip/HideTip"
-
-BYTE __forceinline percent_to_byte(UINT32 percent)
-{
- return(BYTE) ((FLOAT) (((FLOAT) percent) / 100) * 255);
-}
-
-void FLT_Update(struct ClcData *dat, ClcContact *contact);
-void FLT_ShowHideAll(int showCmd);
-void FLT_SnapToEdges(HWND hwnd);
-void FLT_SnapToFloater(HWND hwnd);
-
-HWND g_hwndSFL = 0;
-HDC g_SFLCachedDC = 0;
-HBITMAP g_SFLhbmOld = 0, g_SFLhbm = 0;
-ContactFloater *pFirstFloater = 0;
-BOOL hover = FALSE;
-BOOL tooltip = FALSE;
-UINT_PTR hTooltipTimer = 0;
-POINT start_pos;
-
-extern int g_padding_y;
-
-extern HIMAGELIST hCListImages;
-extern HWND g_hwndEventArea;
-extern HDC g_HDC;
-
-extern int g_list_avatars;
-
-FLOATINGOPTIONS g_floatoptions;
-
-static UINT padctrlIDs[] = { IDC_FLT_PADLEFTSPIN, IDC_FLT_PADRIGHTSPIN, IDC_FLT_PADTOPSPIN,
- IDC_FLT_PADBOTTOMSPIN, 0 };
-
-/*
- * floating contacts support functions
- * simple linked list of allocated ContactFloater* structs
- */
-
-static ContactFloater *FLT_AddToList(ContactFloater *pFloater)
-{
- ContactFloater *pCurrent = pFirstFloater;
-
- if ( !pFirstFloater) {
- pFirstFloater = pFloater;
- pFirstFloater->pNextFloater = NULL;
- return pFirstFloater;
- } else {
- while (pCurrent->pNextFloater != 0)
- pCurrent = pCurrent->pNextFloater;
- pCurrent->pNextFloater = pFloater;
- pFloater->pNextFloater = NULL;
- return pCurrent;
- }
-}
-
-static ContactFloater *FLT_RemoveFromList(ContactFloater *pFloater)
-{
- ContactFloater *pCurrent = pFirstFloater;
-
- if (pFloater == pFirstFloater) {
- if (pFloater->pNextFloater != NULL)
- pFirstFloater = pFloater->pNextFloater;
- else
- pFirstFloater = NULL;
- return pFirstFloater;
- }
-
- do {
- if (pCurrent->pNextFloater == pFloater) {
- pCurrent->pNextFloater = pCurrent->pNextFloater->pNextFloater;
- return 0;
- }
- } while (pCurrent = pCurrent->pNextFloater);
-
- return NULL;
-}
-
-void FLT_SnapToEdges(HWND hwnd)
-{
- RECT dr;
- MONITORINFO monInfo;
- RECT rcWindow;
- HMONITOR curMonitor;
-
- if ( API::pfnMonitorFromWindow == NULL )
- return;
-
- curMonitor = API::pfnMonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST);
-
- monInfo.cbSize = sizeof(monInfo);
- API::pfnGetMonitorInfo(curMonitor, &monInfo);
-
- dr = monInfo.rcWork;
- GetWindowRect(hwnd, &rcWindow);
-
- if (rcWindow.left < dr.left + SNAP_SCREEN_TOLERANCE){
- SetWindowPos(hwnd, HWND_TOPMOST, 0, rcWindow.top, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
- GetWindowRect(hwnd, &rcWindow);
- }
-
- if (rcWindow.top < dr.top + SNAP_SCREEN_TOLERANCE){
- SetWindowPos(hwnd, HWND_TOPMOST, rcWindow.left, 0, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
- GetWindowRect(hwnd, &rcWindow);
- }
-
- if (rcWindow.right > dr.right - SNAP_SCREEN_TOLERANCE)
- SetWindowPos(hwnd, HWND_TOPMOST, dr.right - (rcWindow.right - rcWindow.left), rcWindow.top, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
-
- if (rcWindow.bottom > dr.bottom - SNAP_SCREEN_TOLERANCE)
- SetWindowPos(hwnd, HWND_TOPMOST, rcWindow.left, dr.bottom - (rcWindow.bottom - rcWindow.top), 0, 0, SWP_NOSIZE | SWP_NOZORDER);
-}
-
-void FLT_SnapToFloater(HWND hwnd)
-{
- ContactFloater *pCurrent = pFirstFloater;
- RECT rcWindow, rcBase;
- int minTop = 0xFFFFFF, minBottom = 0xFFFFFF, minRight = 0xFFFFFF, minLeft = 0xFFFFFF;
- int posTop = 0, posBottom = 0, posRight = 0, posLeft = 0;
-
- GetWindowRect(hwnd, &rcBase);
-
- //find the closest floater
- while(pCurrent) {
- GetWindowRect(pCurrent->hwnd, &rcWindow);
- //top
- if ((rcWindow.top - rcBase.bottom > -SNAP_FLT_TOLERANCE) && (rcWindow.top - rcBase.bottom < minTop)) {
- posTop = rcWindow.top;
- minTop = rcWindow.top - rcBase.bottom;
- }
- //bottom
- if ((rcBase.top - rcWindow.bottom > -SNAP_FLT_TOLERANCE) && (rcBase.top - rcWindow.bottom < minBottom)) {
- posBottom = rcWindow.bottom;
- minBottom = rcBase.top - rcWindow.bottom;
- }
- //left
- if ((rcWindow.left - rcBase.right > -SNAP_FLT_TOLERANCE) && (rcWindow.left - rcBase.right < minLeft)) {
- posLeft= rcWindow.left;
- minLeft = rcWindow.left - rcBase.right;
- }
- //right
- if ((rcBase.left - rcWindow.right > -SNAP_FLT_TOLERANCE) && (rcBase.left - rcWindow.right < minRight)) {
- posRight= rcWindow.right;
- minRight = rcBase.left - rcWindow.right;
- }
- pCurrent = pCurrent->pNextFloater;
- }
-
- //snap to the closest floater if spacing is under SNAP_FLT_TOLERANCE
- if (posTop && (rcBase.bottom > posTop - SNAP_FLT_TOLERANCE))
- SetWindowPos(hwnd, HWND_TOPMOST, rcBase.left, posTop - (rcBase.bottom - rcBase.top), 0, 0, SWP_NOSIZE | SWP_NOZORDER);
-
- if (posBottom && (rcBase.top < posBottom + SNAP_FLT_TOLERANCE))
- SetWindowPos(hwnd, HWND_TOPMOST, rcBase.left, posBottom, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
-
- if (posLeft && (rcBase.right > posLeft - SNAP_FLT_TOLERANCE))
- SetWindowPos(hwnd, HWND_TOPMOST, posLeft - (rcBase.right - rcBase.left), rcBase.top, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
-
- if (posRight && (rcBase.left < posRight + SNAP_FLT_TOLERANCE))
- SetWindowPos(hwnd, HWND_TOPMOST, posRight, rcBase.top, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
-}
-
-/*
- * dialog procedure for the floating contacts option page
- */
-
-INT_PTR CALLBACK DlgProcFloatingContacts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- switch(msg) {
- case WM_INITDIALOG:
- {
- DWORD dwFlags = g_floatoptions.dwFlags;
- int i = 0;
-
- TranslateDialogDefault(hwndDlg);
-
- CheckDlgButton(hwndDlg, IDC_FLT_ENABLED, g_floatoptions.enabled);
- SendMessage(hwndDlg, WM_COMMAND, (WPARAM)IDC_FLT_ENABLED, 0);
- CheckDlgButton(hwndDlg, IDC_FLT_SIMPLELAYOUT, dwFlags & FLT_SIMPLE);
- SendMessage(hwndDlg, WM_COMMAND, (WPARAM)IDC_FLT_SIMPLELAYOUT, 0);
- CheckDlgButton(hwndDlg, IDC_FLT_AVATARS, dwFlags & FLT_AVATARS);
- CheckDlgButton(hwndDlg, IDC_FLT_DUALROWS, dwFlags & FLT_DUALROW);
- CheckDlgButton(hwndDlg, IDC_FLT_EXTRAICONS, dwFlags & FLT_EXTRAICONS);
- CheckDlgButton(hwndDlg, IDC_FLT_SYNCED, dwFlags & FLT_SYNCWITHCLIST);
- CheckDlgButton(hwndDlg, IDC_FLT_AUTOHIDE, dwFlags & FLT_AUTOHIDE);
- CheckDlgButton(hwndDlg, IDC_FLT_SNAP, dwFlags & FLT_SNAP);
- CheckDlgButton(hwndDlg, IDC_FLT_BORDER, dwFlags & FLT_BORDER);
- SendMessage(hwndDlg, WM_COMMAND, (WPARAM)IDC_FLT_BORDER, 0);
- CheckDlgButton(hwndDlg, IDC_FLT_ROUNDED, dwFlags & FLT_ROUNDED);
- CheckDlgButton(hwndDlg, IDC_FLT_FILLSTD, dwFlags & FLT_FILLSTDCOLOR);
-
- SendMessage(hwndDlg, WM_COMMAND, (WPARAM)IDC_FLT_ROUNDED, 0);
-
- if (ServiceExists(MS_TOOLTIP_SHOWTIP)) {
- CheckDlgButton(hwndDlg, IDC_FLT_SHOWTOOLTIPS, dwFlags & FLT_SHOWTOOLTIPS);
- SendMessage(hwndDlg, WM_COMMAND, (WPARAM)IDC_FLT_SHOWTOOLTIPS, 0);
- CheckDlgButton(hwndDlg, IDC_FLT_DEFHOVERTIME, g_floatoptions.def_hover_time);
- SendMessage(hwndDlg, WM_COMMAND, (WPARAM)IDC_FLT_DEFHOVERTIME, 0);
- }
- else {
- CheckDlgButton(hwndDlg, IDC_FLT_SHOWTOOLTIPS, 0);
- Utils::enableDlgControl(hwndDlg, IDC_FLT_SHOWTOOLTIPS, 0);
- }
-
- for (i = 0; padctrlIDs[i] != 0; i++)
- SendDlgItemMessage(hwndDlg, padctrlIDs[i], UDM_SETRANGE, 0, MAKELONG(20, 0));
- SendDlgItemMessage(hwndDlg, IDC_FLT_WIDTHSPIN, UDM_SETRANGE, 0, MAKELONG(200, 50));
- SendDlgItemMessage(hwndDlg, IDC_FLT_RADIUSSPIN, UDM_SETRANGE, 0, MAKELONG(20, 1));
- SendDlgItemMessage(hwndDlg, IDC_FLT_HOVERTIMESPIN, UDM_SETRANGE, 0, MAKELONG(5000, 1));
-
- SendDlgItemMessage(hwndDlg, IDC_FLT_PADLEFTSPIN, UDM_SETPOS, 0, (LPARAM)g_floatoptions.pad_left);
- SendDlgItemMessage(hwndDlg, IDC_FLT_PADRIGHTSPIN, UDM_SETPOS, 0, (LPARAM)g_floatoptions.pad_right);
- SendDlgItemMessage(hwndDlg, IDC_FLT_PADTOPSPIN, UDM_SETPOS, 0, (LPARAM)g_floatoptions.pad_top);
- SendDlgItemMessage(hwndDlg, IDC_FLT_PADBOTTOMSPIN, UDM_SETPOS, 0, (LPARAM)g_floatoptions.pad_top);
- SendDlgItemMessage(hwndDlg, IDC_FLT_WIDTHSPIN, UDM_SETPOS, 0, (LPARAM)g_floatoptions.width);
- SendDlgItemMessage(hwndDlg, IDC_FLT_RADIUSSPIN, UDM_SETPOS, 0, (LPARAM)g_floatoptions.radius);
- SendDlgItemMessage(hwndDlg, IDC_FLT_HOVERTIMESPIN, UDM_SETPOS, 0, (LPARAM)g_floatoptions.hover_time);
-
- SendDlgItemMessage(hwndDlg, IDC_FLT_ACTIVEOPACITY, TBM_SETRANGE, FALSE, MAKELONG(1, 255));
- SendDlgItemMessage(hwndDlg, IDC_FLT_ACTIVEOPACITY, TBM_SETPOS, TRUE, g_floatoptions.act_trans);
- SendDlgItemMessage(hwndDlg, IDC_FLT_OPACITY, TBM_SETRANGE, FALSE, MAKELONG(1, 255));
- SendDlgItemMessage(hwndDlg, IDC_FLT_OPACITY, TBM_SETPOS, TRUE, g_floatoptions.trans);
- SendMessage(hwndDlg, WM_HSCROLL, 0, 0);
-
- SendDlgItemMessage(hwndDlg, IDC_FLT_BORDERCOLOUR, CPM_SETDEFAULTCOLOUR, 0, 0);
- SendDlgItemMessage(hwndDlg, IDC_FLT_BORDERCOLOUR, CPM_SETCOLOUR, 0, g_floatoptions.border_colour);
-
- FLT_ShowHideAll(SW_SHOWNOACTIVATE);
- }
- return TRUE;
-
- case WM_COMMAND:
- switch(LOWORD(wParam)) {
- case IDC_FLT_ENABLED:
- {
- int isEnabled = IsDlgButtonChecked(hwndDlg, IDC_FLT_ENABLED);
- int isSimple = IsDlgButtonChecked(hwndDlg, IDC_FLT_SIMPLELAYOUT);
- int isBorder = IsDlgButtonChecked(hwndDlg, IDC_FLT_BORDER);
- int isRounded = IsDlgButtonChecked(hwndDlg, IDC_FLT_ROUNDED);
- int isTooltip = IsDlgButtonChecked(hwndDlg, IDC_FLT_SHOWTOOLTIPS);
- int isDefHoverTime = IsDlgButtonChecked(hwndDlg, IDC_FLT_DEFHOVERTIME);
-
- Utils::enableDlgControl(hwndDlg, IDC_FLT_SIMPLELAYOUT, isEnabled);
- Utils::enableDlgControl(hwndDlg, IDC_FLT_SYNCED, isEnabled);
- Utils::enableDlgControl(hwndDlg, IDC_FLT_AUTOHIDE, isEnabled);
- Utils::enableDlgControl(hwndDlg, IDC_FLT_SNAP, isEnabled);
- Utils::enableDlgControl(hwndDlg, IDC_FLT_ACTIVEOPACITY, isEnabled);
- Utils::enableDlgControl(hwndDlg, IDC_FLT_OPACITY, isEnabled);
- Utils::enableDlgControl(hwndDlg, IDC_FLT_PADLEFTSPIN, isEnabled);
- Utils::enableDlgControl(hwndDlg, IDC_FLT_PADRIGHTSPIN, isEnabled);
- Utils::enableDlgControl(hwndDlg, IDC_FLT_PADTOPSPIN, isEnabled);
- Utils::enableDlgControl(hwndDlg, IDC_FLT_PADLEFT, isEnabled);
- Utils::enableDlgControl(hwndDlg, IDC_FLT_PADRIGHT, isEnabled);
- Utils::enableDlgControl(hwndDlg, IDC_FLT_PADTOP, isEnabled);
- //EnableWindow(GetDlgItem(hwndDlg, IDC_FLT_PADBOTTOMSPIN), isEnabled);
- Utils::enableDlgControl(hwndDlg, IDC_FLT_PADBOTTOM, isEnabled);
- Utils::enableDlgControl(hwndDlg, IDC_FLT_WIDTHSPIN, isEnabled);
- Utils::enableDlgControl(hwndDlg, IDC_FLT_WIDTH, isEnabled);
- Utils::enableDlgControl(hwndDlg, IDC_FLT_BORDER, isEnabled);
- Utils::enableDlgControl(hwndDlg, IDC_FLT_ROUNDED, isEnabled);
- Utils::enableDlgControl(hwndDlg, IDC_FLT_BORDERCOLOUR, isEnabled & isBorder);
- Utils::enableDlgControl(hwndDlg, IDC_FLT_RADIUS, isEnabled & isRounded);
- Utils::enableDlgControl(hwndDlg, IDC_FLT_RADIUSSPIN, isEnabled & isRounded);
- Utils::enableDlgControl(hwndDlg, IDC_FLT_SHOWTOOLTIPS, isEnabled & ServiceExists(MS_TOOLTIP_SHOWTIP));
- Utils::enableDlgControl(hwndDlg, IDC_FLT_DEFHOVERTIME, isEnabled & isTooltip);
- Utils::enableDlgControl(hwndDlg, IDC_FLT_HOVERTIME, isEnabled & isTooltip & !isDefHoverTime);
- Utils::enableDlgControl(hwndDlg, IDC_FLT_HOVERTIMESPIN, isEnabled & isTooltip & !isDefHoverTime);
-
- Utils::enableDlgControl(hwndDlg, IDC_FLT_AVATARS, isEnabled & !isSimple);
- Utils::enableDlgControl(hwndDlg, IDC_FLT_EXTRAICONS, isEnabled & !isSimple);
- Utils::enableDlgControl(hwndDlg, IDC_FLT_DUALROWS, isEnabled & !isSimple);
- }
- break;
-
- case IDC_FLT_SIMPLELAYOUT:
- if (IsDlgButtonChecked(hwndDlg, IDC_FLT_ENABLED)) {
- int isSimple = IsDlgButtonChecked(hwndDlg, IDC_FLT_SIMPLELAYOUT);
- Utils::enableDlgControl(hwndDlg, IDC_FLT_AVATARS, !isSimple);
- Utils::enableDlgControl(hwndDlg, IDC_FLT_EXTRAICONS, !isSimple);
- Utils::enableDlgControl(hwndDlg, IDC_FLT_DUALROWS, !isSimple);
- }
- break;
-
- case IDC_FLT_BORDER:
- if (IsDlgButtonChecked(hwndDlg, IDC_FLT_ENABLED)) {
- int isBorder = IsDlgButtonChecked(hwndDlg, IDC_FLT_BORDER);
- Utils::enableDlgControl(hwndDlg, IDC_FLT_BORDERCOLOUR, isBorder);
- }
- break;
-
- case IDC_FLT_ROUNDED:
- if (IsDlgButtonChecked(hwndDlg, IDC_FLT_ENABLED)) {
- int isRounded = IsDlgButtonChecked(hwndDlg, IDC_FLT_ROUNDED);
- Utils::enableDlgControl(hwndDlg, IDC_FLT_RADIUS, isRounded);
- Utils::enableDlgControl(hwndDlg, IDC_FLT_RADIUSSPIN, isRounded);
- }
- break;
-
- case IDC_FLT_SHOWTOOLTIPS:
- if (IsDlgButtonChecked(hwndDlg, IDC_FLT_ENABLED)) {
- int isTooltip = IsDlgButtonChecked(hwndDlg, IDC_FLT_SHOWTOOLTIPS);
- int isDefHoverTime = IsDlgButtonChecked(hwndDlg, IDC_FLT_DEFHOVERTIME);
- Utils::enableDlgControl(hwndDlg, IDC_FLT_DEFHOVERTIME, isTooltip);
- Utils::enableDlgControl(hwndDlg, IDC_FLT_HOVERTIME, isTooltip & !isDefHoverTime);
- Utils::enableDlgControl(hwndDlg, IDC_FLT_HOVERTIMESPIN, isTooltip & !isDefHoverTime);
- }
- break;
-
- case IDC_FLT_DEFHOVERTIME:
- if (IsDlgButtonChecked(hwndDlg, IDC_FLT_ENABLED) && IsDlgButtonChecked(hwndDlg, IDC_FLT_SHOWTOOLTIPS)) {
- int isDefHoverTime = IsDlgButtonChecked(hwndDlg, IDC_FLT_DEFHOVERTIME);
- Utils::enableDlgControl(hwndDlg, IDC_FLT_HOVERTIME, !isDefHoverTime);
- Utils::enableDlgControl(hwndDlg, IDC_FLT_HOVERTIMESPIN, !isDefHoverTime);
- }
- break;
-
- case IDC_FLT_PADTOP:
- if (HIWORD(wParam) == EN_CHANGE){
- int value = SendDlgItemMessage(hwndDlg, IDC_FLT_PADTOPSPIN, UDM_GETPOS, 0, 0);
- SendDlgItemMessage(hwndDlg, IDC_FLT_PADBOTTOMSPIN, UDM_SETPOS, 0, (LPARAM)value);
- }
- break;
- }
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
-
- case WM_HSCROLL:
- {
- char str[10];
- wsprintfA(str, "%d%%", 100 * SendDlgItemMessage(hwndDlg, IDC_FLT_ACTIVEOPACITY, TBM_GETPOS, 0, 0) / 255);
- SetDlgItemTextA(hwndDlg, IDC_FLT_ACTIVEOPACITYVALUE, str);
- wsprintfA(str, "%d%%", 100 * SendDlgItemMessage(hwndDlg, IDC_FLT_OPACITY, TBM_GETPOS, 0, 0) / 255);
- SetDlgItemTextA(hwndDlg, IDC_FLT_OPACITYVALUE, str);
-
- if (lParam)
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }
- break;
-
- case WM_NOTIFY:
- switch (((LPNMHDR) lParam)->idFrom) {
- case 0:
- if (((LPNMHDR) lParam)->code == PSN_APPLY) {
- g_floatoptions.enabled = IsDlgButtonChecked(hwndDlg, IDC_FLT_ENABLED) ? 1 : 0;
- g_floatoptions.dwFlags = 0;
-
- if (IsDlgButtonChecked(hwndDlg, IDC_FLT_SIMPLELAYOUT))
- g_floatoptions.dwFlags = FLT_SIMPLE;
-
- g_floatoptions.dwFlags |= (IsDlgButtonChecked(hwndDlg, IDC_FLT_AVATARS) ? FLT_AVATARS : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_FLT_DUALROWS) ? FLT_DUALROW : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_FLT_EXTRAICONS) ? FLT_EXTRAICONS : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_FLT_SYNCED) ? FLT_SYNCWITHCLIST : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_FLT_AUTOHIDE) ? FLT_AUTOHIDE : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_FLT_SNAP) ? FLT_SNAP : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_FLT_BORDER) ? FLT_BORDER : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_FLT_FILLSTD) ? FLT_FILLSTDCOLOR : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_FLT_SHOWTOOLTIPS) ? FLT_SHOWTOOLTIPS : 0) |
- (IsDlgButtonChecked(hwndDlg, IDC_FLT_ROUNDED) ? FLT_ROUNDED : 0);
-
- g_floatoptions.act_trans = (BYTE)SendDlgItemMessage(hwndDlg, IDC_FLT_ACTIVEOPACITY, TBM_GETPOS, 0, 0);
- g_floatoptions.trans = (BYTE)SendDlgItemMessage(hwndDlg, IDC_FLT_OPACITY, TBM_GETPOS, 0, 0);
- g_floatoptions.pad_left = (BYTE)SendDlgItemMessage(hwndDlg, IDC_FLT_PADLEFTSPIN, UDM_GETPOS, 0, 0);
- g_floatoptions.pad_right = (BYTE)SendDlgItemMessage(hwndDlg, IDC_FLT_PADRIGHTSPIN, UDM_GETPOS, 0, 0);
- g_floatoptions.pad_top = (BYTE)SendDlgItemMessage(hwndDlg, IDC_FLT_PADTOPSPIN, UDM_GETPOS, 0, 0);
- g_floatoptions.pad_bottom = (BYTE)SendDlgItemMessage(hwndDlg, IDC_FLT_PADBOTTOMSPIN, UDM_GETPOS, 0, 0);
- g_floatoptions.width = (BYTE)SendDlgItemMessage(hwndDlg, IDC_FLT_WIDTHSPIN, UDM_GETPOS, 0, 0);
- g_floatoptions.radius = (BYTE)SendDlgItemMessage(hwndDlg, IDC_FLT_RADIUSSPIN, UDM_GETPOS, 0, 0);
- g_floatoptions.border_colour = SendDlgItemMessage(hwndDlg, IDC_FLT_BORDERCOLOUR, CPM_GETCOLOUR, 0, 0);
-
- g_floatoptions.def_hover_time= IsDlgButtonChecked(hwndDlg, IDC_FLT_DEFHOVERTIME) ? 1 : 0;
- if (g_floatoptions.def_hover_time)
- g_floatoptions.hover_time = cfg::getWord("CLC", "InfoTipHoverTime", 200);
- else
- g_floatoptions.hover_time = (WORD)SendDlgItemMessage(hwndDlg, IDC_FLT_HOVERTIMESPIN, UDM_GETPOS, 0, 0);
-
- FLT_WriteOptions();
- FLT_RefreshAll();
- return TRUE;
- }
- break;
- }
- break;
- }
- return FALSE;
-}
-
-void FLT_ReadOptions()
-{
- ZeroMemory(&g_floatoptions, sizeof(FLOATINGOPTIONS));
-
- g_floatoptions.enabled = cfg::getByte("CList", "flt_enabled", 0);
- g_floatoptions.dwFlags = cfg::getDword("CList", "flt_flags", FLT_SIMPLE);
- DWORD dwPad = cfg::getDword("CList", "flt_padding", 0);
-
- g_floatoptions.pad_top = LOBYTE(LOWORD(dwPad));
- g_floatoptions.pad_right = HIBYTE(LOWORD(dwPad));
- g_floatoptions.pad_bottom = LOBYTE(HIWORD(dwPad));
- g_floatoptions.pad_left = HIBYTE(HIWORD(dwPad));
-
- g_floatoptions.width = cfg::getDword("CList", "flt_width", 100);
- g_floatoptions.act_trans = cfg::getByte("CList", "flt_acttrans", 255);
- g_floatoptions.trans = cfg::getByte("CList", "flt_trans", 255);
- g_floatoptions.radius = cfg::getByte("CList", "flt_radius", 3);
- g_floatoptions.border_colour = cfg::getDword("CList", "flt_bordercolour", 0);
- g_floatoptions.def_hover_time = cfg::getByte("CList", "flt_defhovertime", 1);
-
- if (g_floatoptions.def_hover_time)
- g_floatoptions.hover_time = cfg::getWord("CLC", "InfoTipHoverTime", 200);
- else
- g_floatoptions.hover_time = cfg::getWord("CList", "flt_hovertime", 200);
-}
-
-void FLT_WriteOptions()
-{
- cfg::writeByte("CList", "flt_enabled", g_floatoptions.enabled);
- cfg::writeDword("CList", "flt_flags", g_floatoptions.dwFlags);
- DWORD dwPad = MAKELONG(MAKEWORD(g_floatoptions.pad_top, g_floatoptions.pad_right),
- MAKEWORD(g_floatoptions.pad_bottom, g_floatoptions.pad_left));
- cfg::writeDword("CList", "flt_padding", dwPad);
- cfg::writeDword("CList", "flt_width", g_floatoptions.width);
- cfg::writeByte("CList", "flt_acttrans", g_floatoptions.act_trans);
- cfg::writeByte("CList", "flt_trans", g_floatoptions.trans);
- cfg::writeByte("CList", "flt_radius", g_floatoptions.radius);
- cfg::writeDword("CList", "flt_bordercolour", g_floatoptions.border_colour);
- cfg::writeByte("CList", "flt_defhovertime", g_floatoptions.def_hover_time);
- if ( !g_floatoptions.def_hover_time)
- cfg::writeWord("CList", "flt_hovertime", g_floatoptions.hover_time);
-}
-
-LRESULT CALLBACK StatusFloaterClassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- switch(msg) {
- case WM_DESTROY:
- Utils_SaveWindowPosition(hwnd, 0, "CLUI", "sfl");
- if (g_SFLCachedDC) {
- SelectObject(g_SFLCachedDC, g_SFLhbmOld);
- DeleteObject(g_SFLhbm);
- DeleteDC(g_SFLCachedDC);
- g_SFLCachedDC = 0;
- }
- break;
-
- case WM_ERASEBKGND:
- return TRUE;
-
- case WM_PAINT:
- {
- HDC hdc;
- PAINTSTRUCT ps;
-
- hdc = BeginPaint(hwnd, &ps);
- ps.fErase = FALSE;
- EndPaint(hwnd, &ps);
- }
- return TRUE;
-
- case WM_LBUTTONDOWN:
- {
- POINT ptMouse;
- RECT rcWindow;
-
- GetCursorPos(&ptMouse);
- GetWindowRect(hwnd, &rcWindow);
- rcWindow.right = rcWindow.left + 25;
- if ( !PtInRect(&rcWindow, ptMouse))
- return SendMessage(hwnd, WM_SYSCOMMAND, SC_MOVE | HTCAPTION, MAKELPARAM(ptMouse.x, ptMouse.y));
- }
- break;
-
- case WM_LBUTTONUP:
- {
- HMENU hmenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS, 0, 0);
- RECT rcWindow;
- POINT pt;
-
- GetCursorPos(&pt);
- GetWindowRect(hwnd, &rcWindow);
- if (cfg::dat.bUseFloater & CLUI_FLOATER_EVENTS) {
- if (pt.y > rcWindow.top + ((rcWindow.bottom - rcWindow.top) / 2))
- SendMessage(g_hwndEventArea, WM_COMMAND, MAKEWPARAM(IDC_NOTIFYBUTTON, 0), 0);
- else
- TrackPopupMenu(hmenu, TPM_TOPALIGN|TPM_LEFTALIGN|TPM_RIGHTBUTTON, rcWindow.left, rcWindow.bottom, 0, pcli->hwndContactList, NULL);
- }
- else TrackPopupMenu(hmenu, TPM_TOPALIGN|TPM_LEFTALIGN|TPM_RIGHTBUTTON, rcWindow.left, rcWindow.bottom, 0, pcli->hwndContactList, NULL);
- }
- return 0;
-
- case WM_CONTEXTMENU:
- {
- HMENU hmenu = (HMENU)CallService(MS_CLIST_MENUGETMAIN, 0, 0);
- RECT rcWindow;
-
- GetWindowRect(hwnd, &rcWindow);
- TrackPopupMenu(hmenu, TPM_TOPALIGN|TPM_LEFTALIGN|TPM_RIGHTBUTTON, rcWindow.left, rcWindow.bottom, 0, pcli->hwndContactList, NULL);
- }
- return 0;
- }
- return DefWindowProc(hwnd, msg, wParam, lParam);
-}
-
-void CALLBACK ShowTooltip(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
-{
- ContactFloater *pCurrent = pFirstFloater;
- POINT pt;
- CLCINFOTIP ti = {0};
-
- KillTimer(hwnd, TOOLTIP_TIMER);
- hTooltipTimer = 0;
-
- GetCursorPos(&pt);
- if ((abs(pt.x - start_pos.x) > 3) && (abs(pt.y - start_pos.y) > 3)) return;
-
- while(pCurrent->hwnd != hwnd)
- pCurrent = pCurrent->pNextFloater;
-
- ti.cbSize = sizeof(ti);
- ti.isGroup = 0;
- ti.isTreeFocused = 0;
- ti.hItem = pCurrent->hContact;
- ti.ptCursor = pt;
- CallService(MS_TOOLTIP_SHOWTIP, 0, (LPARAM)&ti);
- tooltip = TRUE;
-}
-
-LRESULT CALLBACK ContactFloaterClassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- INT_PTR iEntry = GetWindowLongPtr(hwnd, GWLP_USERDATA);
- struct TExtraCache *centry = NULL;
-
- if (iEntry >= 0 && iEntry < cfg::nextCacheEntry)
- centry = &cfg::eCache[iEntry];
-
- switch(msg) {
- case WM_NCCREATE:
- {
- CREATESTRUCT *cs = (CREATESTRUCT *)lParam;
- SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)cs->lpCreateParams);
- iEntry = (int)cs->lpCreateParams;
- if (iEntry >= 0 && iEntry < cfg::nextCacheEntry)
- centry = &cfg::eCache[iEntry];
- return TRUE;
- }
- case WM_DESTROY:
- if (centry) {
- WINDOWPLACEMENT wp = {0};
-
- SelectObject(centry->floater->hdc, centry->floater->hbmOld);
- DeleteObject(centry->floater->hbm);
- DeleteDC(centry->floater->hdc);
- FLT_RemoveFromList(centry->floater);
- free(centry->floater);
- centry->floater = 0;
- Utils_SaveWindowPosition(hwnd, centry->hContact, "CList", "flt");
- break;
- }
- case WM_ERASEBKGND:
- return TRUE;
- case WM_PAINT:
- {
- HDC hdc;
- PAINTSTRUCT ps;
-
- hdc = BeginPaint(hwnd, &ps);
- ps.fErase = FALSE;
- EndPaint(hwnd, &ps);
- return TRUE;
- }
- case WM_LBUTTONDBLCLK:
- if (centry)
- CallService(MS_CLIST_CONTACTDOUBLECLICKED, (WPARAM)centry->hContact, 0);
- return 0;
- case WM_LBUTTONDOWN:
- {
- POINT ptMouse;
- RECT rcWindow;
-
- GetCursorPos(&ptMouse);
- GetWindowRect(hwnd, &rcWindow);
- rcWindow.right = rcWindow.left + 25;
- if ( !PtInRect(&rcWindow, ptMouse))
- return SendMessage(hwnd, WM_SYSCOMMAND, SC_MOVE | HTCAPTION, MAKELPARAM(ptMouse.x, ptMouse.y));
- break;
- }
- case WM_MOUSEMOVE:
- if ( API::pfnTrackMouseEvent && !hover ) {
- TRACKMOUSEEVENT tme;
- tme.cbSize = sizeof(TRACKMOUSEEVENT);
- tme.dwFlags = TME_HOVER | TME_LEAVE;
- tme.hwndTrack = hwnd;
- tme.dwHoverTime = 5;
- API::pfnTrackMouseEvent(&tme);
- hover = TRUE;
- }
- if ( ServiceExists( MS_TOOLTIP_SHOWTIP )) {
- if ((g_floatoptions.dwFlags & FLT_SHOWTOOLTIPS) && !tooltip) {
- GetCursorPos(&start_pos);
- if (hTooltipTimer) KillTimer(hwnd, TOOLTIP_TIMER);
- hTooltipTimer = SetTimer(hwnd, TOOLTIP_TIMER, g_floatoptions.hover_time, ShowTooltip);
- }
- }
-
- return FALSE;
-
- case WM_MOUSEHOVER:
- {
- ClcContact *contact = NULL;
- ContactFloater *pCurrent = pFirstFloater;
- int oldTrans = g_floatoptions.trans;
-
- while(pCurrent->hwnd != hwnd)
- pCurrent = pCurrent->pNextFloater;
-
- if (FindItem(pcli->hwndContactTree, cfg::clcdat, pCurrent->hContact, &contact, NULL, 0)) {
- g_floatoptions.trans = g_floatoptions.act_trans;
- FLT_Update(cfg::clcdat, contact);
- g_floatoptions.trans = oldTrans;
- }
-
- break;
- }
- case WM_MOUSELEAVE:
- {
- ClcContact *contact = NULL;
- ContactFloater *pCurrent = pFirstFloater;
-
- while(pCurrent->hwnd != hwnd)
- pCurrent = pCurrent->pNextFloater;
-
- if (FindItem(pcli->hwndContactTree, cfg::clcdat, pCurrent->hContact, &contact, NULL, 0))
- FLT_Update(cfg::clcdat, contact);
-
- if (hTooltipTimer)
- {
- KillTimer(hwnd, TOOLTIP_TIMER);
- hTooltipTimer = 0;
- }
-
- if (tooltip) CallService(MS_TOOLTIP_HIDETIP, 0, 0);
-
- hover = FALSE;
- tooltip = FALSE;
-
-
- break;
- }
-
- case WM_MOVE:
- {
- if (g_floatoptions.dwFlags & FLT_SNAP)
- FLT_SnapToEdges(hwnd);
-
- if (GetKeyState(VK_CONTROL) < 0)
- FLT_SnapToFloater(hwnd);
-
- break;
- }
- case WM_MEASUREITEM:
- return(CallService(MS_CLIST_MENUMEASUREITEM, wParam, lParam));
- case WM_DRAWITEM:
- return(CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam));
- case WM_COMMAND:
- return(CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKELONG(LOWORD(wParam), MPCF_CONTACTMENU), (LPARAM)centry->hContact));
- case WM_CONTEXTMENU:
- {
- if (centry) {
- HMENU hContactMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM)centry->hContact, 0);
- RECT rcWindow;
-
- GetWindowRect(hwnd, &rcWindow);
- TrackPopupMenu(hContactMenu, TPM_TOPALIGN|TPM_LEFTALIGN|TPM_RIGHTBUTTON, rcWindow.left, rcWindow.bottom, 0, hwnd, NULL);
- DestroyMenu(hContactMenu);
- return 0;
- }
- break;
- }
- }
- return DefWindowProc(hwnd, msg, wParam, lParam);
-}
-
-void SFL_RegisterWindowClass()
-{
- WNDCLASS wndclass;
-
- wndclass.style = 0;
- wndclass.lpfnWndProc = StatusFloaterClassProc;
- wndclass.cbClsExtra = 0;
- wndclass.cbWndExtra = 0;
- wndclass.hInstance = g_hInst;
- wndclass.hIcon = 0;
- wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
- wndclass.hbrBackground = (HBRUSH) (COLOR_3DFACE);
- wndclass.lpszMenuName = 0;
- wndclass.lpszClassName = _T("StatusFloaterClass");
- RegisterClass(&wndclass);
-
- wndclass.style = CS_DBLCLKS;
- wndclass.lpszClassName = _T("ContactFloaterClass");
- wndclass.lpfnWndProc = ContactFloaterClassProc;
- RegisterClass(&wndclass);
-}
-
-void SFL_UnregisterWindowClass()
-{
- UnregisterClass(_T("StatusFloaterClass"), g_hInst);
- UnregisterClass(_T("ContactFloaterClass"), g_hInst);
-}
-
-void SFL_Destroy()
-{
- if (g_hwndSFL)
- DestroyWindow(g_hwndSFL);
- g_hwndSFL = 0;
-}
-
-static HICON sfl_hIcon = (HICON)-1;
-static int sfl_iIcon = -1;
-static TCHAR sfl_statustext[100] = _T("");
-
-void SFL_Update(HICON hIcon, int iIcon, HIMAGELIST hIml, const TCHAR *szText, BOOL refresh)
-{
- RECT rcClient, rcWindow;
- POINT ptDest, ptSrc = {0};
- SIZE szDest, szT;
- BLENDFUNCTION bf = {0};
- HFONT hOldFont;
- StatusItems_t *item = arStatusItems[ID_EXTBKSTATUSFLOATER - ID_STATUS_OFFLINE];
- RECT rcStatusArea;
- LONG cy;
-
- if (g_hwndSFL == 0)
- return;
-
- GetClientRect(g_hwndSFL, &rcClient);
- GetWindowRect(g_hwndSFL, &rcWindow);
-
- ptDest.x = rcWindow.left;
- ptDest.y = rcWindow.top;
- szDest.cx = rcWindow.right - rcWindow.left;
- szDest.cy = rcWindow.bottom - rcWindow.top;
-
- if (item->IGNORED) {
- FillRect(g_SFLCachedDC, &rcClient, GetSysColorBrush(COLOR_3DFACE));
- SetTextColor(g_SFLCachedDC, GetSysColor(COLOR_BTNTEXT));
- }
- else {
- FillRect(g_SFLCachedDC, &rcClient, GetSysColorBrush(COLOR_3DFACE));
- DrawAlpha(g_SFLCachedDC, &rcClient, item->COLOR, 100, item->COLOR2, item->COLOR2_TRANSPARENT,
- item->GRADIENT, item->CORNER, item->BORDERSTYLE, item->imageItem);
- SetTextColor(g_SFLCachedDC, item->TEXTCOLOR);
- }
- bf.BlendOp = AC_SRC_OVER;
- bf.AlphaFormat = 0;
- bf.SourceConstantAlpha = item->IGNORED ? 255 : percent_to_byte(item->ALPHA);
-
- rcStatusArea = rcClient;
-
- if (cfg::dat.bUseFloater & CLUI_FLOATER_EVENTS)
- rcStatusArea.bottom = 20;
-
- cy = rcStatusArea.bottom - rcStatusArea.top;
-
- if (szText != NULL && refresh) {
- _tcsncpy(sfl_statustext, szText, 100);
- sfl_statustext[99] = 0;
- }
-
- if ( !hIcon) {
- HICON p_hIcon;
-
- if (refresh)
- sfl_iIcon = iIcon;
- if (sfl_iIcon != -1) {
- p_hIcon = ImageList_ExtractIcon(0, hCListImages, sfl_iIcon);
- DrawIconEx(g_SFLCachedDC, 5, (cy - 16) / 2, p_hIcon, 16, 16, 0, 0, DI_NORMAL);
- DestroyIcon(p_hIcon);
- }
- }
- else {
- if (refresh)
- sfl_hIcon = hIcon;
- if (sfl_hIcon != (HICON)-1)
- DrawIconEx(g_SFLCachedDC, 5, (cy - 16) / 2, sfl_hIcon, 16, 16, 0, 0, DI_NORMAL);
- }
-
- hOldFont = reinterpret_cast<HFONT>(SelectObject(g_SFLCachedDC, GetStockObject(DEFAULT_GUI_FONT)));
- SetBkMode(g_SFLCachedDC, TRANSPARENT);
- GetTextExtentPoint32(g_SFLCachedDC, sfl_statustext, lstrlen(sfl_statustext), &szT);
- TextOut(g_SFLCachedDC, 24, (cy - szT.cy) / 2, sfl_statustext, lstrlen(sfl_statustext));
-
- if (cfg::dat.bUseFloater & CLUI_FLOATER_EVENTS) {
- RECT rcNA = rcClient;
-
- rcNA.top = 18;
- PaintNotifyArea(g_SFLCachedDC, &rcNA);
- }
-
- SelectObject(g_SFLCachedDC, hOldFont);
-
- if (API::pfnUpdateLayeredWindow)
- API::pfnUpdateLayeredWindow(g_hwndSFL, 0, &ptDest, &szDest, g_SFLCachedDC, &ptSrc, GetSysColor(COLOR_3DFACE), &bf, ULW_ALPHA | ULW_COLORKEY);
-}
-
-/*
-* set the floater
-* mode = 0/1 forced hide/show
-* OR -1 to set it depending on the clist state (visible/hidden) (this is actually reversed, because the function
-* is called *before* the clist is shown or hidden)
-*/
-
-void SFL_SetState(int uMode)
-{
- BYTE bClistState;
-
- if (g_hwndSFL == 0 || !(cfg::dat.bUseFloater & CLUI_USE_FLOATER))
- return;
-
- if (uMode == -1) {
- if (cfg::dat.bUseFloater & CLUI_FLOATER_AUTOHIDE) {
- bClistState = cfg::getByte("CList", "State", SETTING_STATE_NORMAL);
- ShowWindow(g_hwndSFL, bClistState == SETTING_STATE_NORMAL ? SW_SHOW : SW_HIDE);
- }
- else
- ShowWindow(g_hwndSFL, SW_SHOW);
- }
- else
- ShowWindow(g_hwndSFL, uMode ? SW_SHOW : SW_HIDE);
-}
-
-// XXX improve size calculations for the floater window.
-
-void SFL_SetSize()
-{
- HDC hdc;
- LONG lWidth;
- RECT rcWindow;
- SIZE sz;
- char *szStatusMode;
- HFONT oldFont;
- int i;
-
- GetWindowRect(g_hwndSFL, &rcWindow);
- lWidth = rcWindow.right - rcWindow.left;
-
- hdc = GetDC(g_hwndSFL);
- oldFont = reinterpret_cast<HFONT>(SelectObject(hdc, GetStockObject(DEFAULT_GUI_FONT)));
- for (i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++) {
- szStatusMode = Translate((char *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)i, 0));
- GetTextExtentPoint32A(hdc, szStatusMode, lstrlenA(szStatusMode), &sz);
- lWidth = max(lWidth, sz.cx + 16 + 8);
- }
- SetWindowPos(g_hwndSFL, HWND_TOPMOST, rcWindow.left, rcWindow.top, lWidth, max(cfg::dat.bUseFloater & CLUI_FLOATER_EVENTS ? 36 : 20, sz.cy + 4), SWP_SHOWWINDOW);
- GetWindowRect(g_hwndSFL, &rcWindow);
-
- if (g_SFLCachedDC) {
- SelectObject(g_SFLCachedDC, g_SFLhbmOld);
- DeleteObject(g_SFLhbm);
- DeleteDC(g_SFLCachedDC);
- g_SFLCachedDC = 0;
- }
-
- g_SFLCachedDC = CreateCompatibleDC(hdc);
- g_SFLhbm = CreateCompatibleBitmap(hdc, lWidth, rcWindow.bottom - rcWindow.top);
- g_SFLhbmOld = reinterpret_cast<HBITMAP>(SelectObject(g_SFLCachedDC, g_SFLhbm));
-
- ReleaseDC(g_hwndSFL, hdc);
- CluiProtocolStatusChanged(0, 0);
-}
-
-void SFL_Create()
-{
- if (g_hwndSFL == 0 && cfg::dat.bUseFloater & CLUI_USE_FLOATER && API::pfnUpdateLayeredWindow != NULL)
- g_hwndSFL = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_LAYERED, _T("StatusFloaterClass"), _T("sfl"), WS_VISIBLE, 0, 0, 0, 0, 0, 0, g_hInst, 0);
- else
- return;
-
- SetWindowLongPtr(g_hwndSFL, GWL_STYLE, GetWindowLongPtr(g_hwndSFL, GWL_STYLE) & ~(WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_OVERLAPPEDWINDOW | WS_POPUPWINDOW));
-
- Utils_RestoreWindowPosition(g_hwndSFL, 0, "CLUI", "sfl");
- SFL_SetSize();
-}
-
-void FLT_SetSize(struct TExtraCache *centry, LONG width, LONG height)
-{
- HDC hdc;
- RECT rcWindow;
- HFONT oldFont;
- int flags = SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOACTIVATE;
-
- int iVis = pcli->pfnGetWindowVisibleState(pcli->hwndContactList, 0, 0);
- if ((g_floatoptions.dwFlags & FLT_AUTOHIDE) && (iVis == 2 || iVis == 4)) //2 = GWVS_VISIBLE, 4 = GWVS_PARTIALLY_COVERED
- flags = SWP_NOMOVE | SWP_NOACTIVATE;
-
- if (centry->floater) {
- hdc = GetDC(centry->floater->hwnd);
- oldFont = reinterpret_cast<HFONT>(SelectObject(hdc, GetStockObject(DEFAULT_GUI_FONT)));
-
- SetWindowPos(centry->floater->hwnd, HWND_TOPMOST, 0, 0, width, height, flags);
- GetWindowRect(centry->floater->hwnd, &rcWindow);
-
- if (centry->floater->hdc) {
- SelectObject(centry->floater->hdc, centry->floater->hbmOld);
- DeleteObject(centry->floater->hbm);
- DeleteDC(centry->floater->hdc);
- centry->floater->hdc = 0;
- }
-
- centry->floater->hdc = CreateCompatibleDC(hdc);
- centry->floater->hbm = CreateCompatibleBitmap(hdc, width, rcWindow.bottom - rcWindow.top);
- centry->floater->hbmOld= reinterpret_cast<HBITMAP>(SelectObject(centry->floater->hdc, centry->floater->hbm));
-
- ReleaseDC(centry->floater->hwnd, hdc);
- }
-}
-
-void FLT_Create(int iEntry)
-{
- struct TExtraCache *centry = NULL;
-
- if (iEntry >= 0 && iEntry < cfg::nextCacheEntry) {
- ClcContact *contact = NULL;
- ClcGroup *group = NULL;
-
- centry = &cfg::eCache[iEntry];
- if (centry->floater == 0 && API::pfnUpdateLayeredWindow != NULL) {
-
- centry->floater = (ContactFloater *)malloc(sizeof(ContactFloater));
- if (centry->floater == NULL)
- return;
- FLT_AddToList(centry->floater);
- centry->floater->hwnd = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_LAYERED, _T("ContactFloaterClass"), _T("sfl"), WS_VISIBLE, 0, 0, 0, 0, 0, 0, g_hInst, (LPVOID)iEntry);
- centry->floater->hContact = centry->hContact;
- }
- else if (centry->floater != NULL) {
- ShowWindow(centry->floater->hwnd, SW_SHOWNOACTIVATE);
- return;
- }
-
- SetWindowLongPtr(centry->floater->hwnd, GWL_STYLE, GetWindowLongPtr(centry->floater->hwnd, GWL_STYLE) & ~(WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_OVERLAPPEDWINDOW | WS_POPUPWINDOW));
-
- if (Utils_RestoreWindowPosition(centry->floater->hwnd, centry->hContact, "CList", "flt"))
- if (Utils_RestoreWindowPositionNoMove(centry->floater->hwnd, centry->hContact, "CList", "flt"))
- SetWindowPos(centry->floater->hwnd, 0, 50, 50, 150, 30, SWP_NOZORDER | SWP_NOACTIVATE);
-
- //FLT_SetSize(centry, 100, 20);
- ShowWindow(centry->floater->hwnd, SW_SHOWNOACTIVATE);
- if (FindItem(pcli->hwndContactTree, cfg::clcdat, centry->hContact, &contact, &group, 0)) {
- if (contact)
- FLT_Update(cfg::clcdat, contact);
- }
- }
-}
-
-extern HDC hdcAV;
-extern HDC hdcTempAV;
-extern HBITMAP hbmTempAV, hbmTempOldAV;
-extern LONG g_maxAV_X, g_maxAV_Y;
-
-void FLT_Update(struct ClcData *dat, ClcContact *contact)
-{
- RECT rcClient, rcWindow;
- POINT ptSrc = {0};
- ClcGroup *group = NULL;
- ClcContact *newContact = NULL;
- HRGN rgn;
-
- if (contact == NULL || dat == NULL)
- return;
-
- if (contact->extraCacheEntry < 0 || contact->extraCacheEntry >= cfg::nextCacheEntry)
- return;
-
- if (cfg::eCache[contact->extraCacheEntry].floater == NULL)
- return;
-
- FLT_SetSize(&cfg::eCache[contact->extraCacheEntry], g_floatoptions.width, RowHeight::getFloatingRowHeight(dat, pcli->hwndContactTree, contact, g_floatoptions.dwFlags) + (2*g_floatoptions.pad_top));
-
- HWND hwnd = cfg::eCache[contact->extraCacheEntry].floater->hwnd;
- HDC hdc = cfg::eCache[contact->extraCacheEntry].floater->hdc;
-
- if (hwnd == 0)
- return;
-
- GetClientRect(hwnd, &rcClient);
- GetWindowRect(hwnd, &rcWindow);
-
- POINT ptDest = {rcWindow.left, rcWindow.top };
- SIZE szDest = {rcWindow.right - rcWindow.left, rcWindow.bottom - rcWindow.top};
-
- /*
- * fill with a DESATURATED representation of the clist bg color and use this later as a color key
- */
-
- float greyLevel = (float)(GetRValue(cfg::clcdat->bkColour) * 0.299 + GetGValue(cfg::clcdat->bkColour) * 0.587 + GetBValue(cfg::clcdat->bkColour) * 0.144);
- if (greyLevel > 255)
- greyLevel = 255;
-
- COLORREF clrKey = RGB((BYTE)greyLevel, (BYTE)greyLevel, (BYTE)greyLevel);
- HBRUSH brKey = CreateSolidBrush(clrKey);
- FillRect(hdc, &rcClient, brKey);
- DeleteObject(brKey);
-
- SetBkMode(hdc, TRANSPARENT);
-
- if (g_floatoptions.dwFlags & FLT_ROUNDED){
- rgn = CreateRoundRectRgn(0, 0, rcClient.right, rcClient.bottom, g_floatoptions.radius, g_floatoptions.radius);
- SelectClipRgn(hdc, rgn);
- if (g_floatoptions.dwFlags & FLT_FILLSTDCOLOR) {
- HBRUSH br = CreateSolidBrush(cfg::clcdat->bkColour);
- FillRect(hdc, &rcClient, br);
- DeleteObject(br);
- }
- }
-
- if (FindItem(pcli->hwndContactTree, dat, contact->hContact, &newContact, &group, 0)) {
- DWORD oldFlags = cfg::dat.dwFlags;
- BYTE oldPadding = cfg::dat.avatarPadding;
- struct avatarCacheEntry *ace_old = contact->ace;
- BYTE oldDualRow = contact->bSecondLine;
-
- int oldLeftMargin = dat->leftMargin;
- int oldRightMargin = dat->rightMargin;
-
- if (g_floatoptions.dwFlags & FLT_SIMPLE) {
- contact->ace = 0;
- contact->bSecondLine = MULTIROW_NEVER;
- cfg::dat.dwFlags &= ~CLUI_SHOWCLIENTICONS;
- }
- else {
- if ( !(g_floatoptions.dwFlags & FLT_AVATARS)) {
- contact->ace = 0;
- g_list_avatars = 0;
- }
- else g_list_avatars = 1;
-
- if ( !(g_floatoptions.dwFlags & FLT_DUALROW))
- contact->bSecondLine = MULTIROW_NEVER;
- else
- contact->bSecondLine = MULTIROW_ALWAYS;
-
- if ( !(g_floatoptions.dwFlags & FLT_EXTRAICONS))
- cfg::dat.dwFlags &= ~CLUI_SHOWCLIENTICONS;
- }
-
- dat->leftMargin = g_floatoptions.pad_left;
- dat->rightMargin = g_floatoptions.pad_right;
-
- g_HDC = hdc;
-
- hdcTempAV = CreateCompatibleDC(g_HDC);
- hdcAV = CreateCompatibleDC(g_HDC);
- hbmTempAV = CreateCompatibleBitmap(g_HDC, g_maxAV_X, g_maxAV_Y);
- hbmTempOldAV = reinterpret_cast<HBITMAP>(SelectObject(hdcTempAV, hbmTempAV));
-
- g_padding_y = g_floatoptions.pad_top;
- BOOL firstDrawn = TRUE;
- PaintItem(hdc, group, contact, 0, 0, dat, -4, pcli->hwndContactTree, 0, &rcClient, &firstDrawn, 0, rcClient.bottom - rcClient.top);
- g_padding_y = 0;
-
- SelectObject(hdcTempAV, hbmTempOldAV);
- DeleteObject(hbmTempAV);
- DeleteDC(hdcTempAV);
- DeleteDC(hdcAV);
-
- cfg::dat.dwFlags = oldFlags;
- cfg::dat.avatarPadding = oldPadding;
- contact->ace = ace_old;
- contact->bSecondLine = oldDualRow;
-
- dat->leftMargin = oldLeftMargin;
- dat->rightMargin = oldRightMargin;
- }
-
- if (g_floatoptions.dwFlags & FLT_BORDER){
- HBRUSH hbrBorder = CreateSolidBrush(g_floatoptions.border_colour);
- if (g_floatoptions.dwFlags & FLT_ROUNDED)
- FrameRgn(hdc, rgn, hbrBorder, 1, 1);
- else
- FrameRect(hdc, &rcClient, hbrBorder);
-
- DeleteObject(hbrBorder);
- }
-
- if (g_floatoptions.dwFlags & FLT_ROUNDED)
- DeleteObject(rgn);
-
- BLENDFUNCTION bf = {0};
- bf.BlendOp = AC_SRC_OVER;
- bf.AlphaFormat = 0;
- bf.SourceConstantAlpha = g_floatoptions.trans;
-
- if (API::pfnUpdateLayeredWindow)
- API::pfnUpdateLayeredWindow(hwnd, 0, &ptDest, &szDest, hdc, &ptSrc, clrKey /*GetSysColor(COLOR_3DFACE)*/, &bf, ULW_COLORKEY | ULW_ALPHA);
-}
-
-/*
-* syncs the floating contacts with clist contact visibility.
-* will hide all floating contacts which are not visible on the list
-* needed after a list rebuild
-*/
-
-void FLT_SyncWithClist()
-{
- ContactFloater *pCurrent = pFirstFloater;
- int iVis = pcli->pfnGetWindowVisibleState(pcli->hwndContactList, 0, 0);
-
- if (g_floatoptions.dwFlags & FLT_SYNCWITHCLIST){
- while(pCurrent) {
- HWND hwnd = pCurrent->hwnd;
- if (hwnd && IsWindow(hwnd)) {
- ClcContact *contact;
- if (FindItem(pcli->hwndContactTree, cfg::clcdat, pCurrent->hContact, &contact, NULL, 0)) {
- FLT_Update(cfg::clcdat, contact);
- if (((g_floatoptions.dwFlags & FLT_AUTOHIDE) && (iVis == 2 || iVis == 4)) || !(g_floatoptions.dwFlags & FLT_AUTOHIDE))
- ShowWindow(hwnd, SW_SHOWNOACTIVATE);
- else
- ShowWindow(hwnd, SW_HIDE);
- }
- else ShowWindow(hwnd, SW_HIDE);
- }
- pCurrent = pCurrent->pNextFloater;
- }
- }
-}
-
-/*
-* quickly show or hide all floating contacts
-* used by autohide/show feature
-*/
-
-void FLT_ShowHideAll(int showCmd)
-{
- ClcContact *contact;
- ContactFloater *pCurrent = pFirstFloater;
- HWND hwnd;
-
- if (g_floatoptions.dwFlags & FLT_AUTOHIDE) {
- while(pCurrent) {
- hwnd = pCurrent->hwnd;
- if (hwnd && IsWindow(hwnd)) {
- if (showCmd == SW_SHOWNOACTIVATE && FindItem(pcli->hwndContactTree, cfg::clcdat, pCurrent->hContact, &contact, NULL, 0))
- ShowWindow(hwnd, SW_SHOWNOACTIVATE);
- else if (showCmd != SW_SHOWNOACTIVATE)
- ShowWindow(hwnd, showCmd);
- }
- pCurrent = pCurrent->pNextFloater;
- }
- }
-}
-
-/*
-* update/repaint all contact floaters
-*/
-
-void FLT_RefreshAll()
-{
- ClcContact *contact = NULL;
- ContactFloater *pCurrent = pFirstFloater;
-
- while(pCurrent) {
- if (FindItem(pcli->hwndContactTree, cfg::clcdat, pCurrent->hContact, &contact, NULL, 0)) {
- HWND hwnd = pCurrent->hwnd;
- if (hwnd && IsWindow(hwnd))
- FLT_Update(cfg::clcdat, contact);
- }
- pCurrent = pCurrent->pNextFloater;
- }
-}
-