summaryrefslogtreecommitdiff
path: root/plugins/Clist_nicer
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-11-04 22:36:16 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-11-04 22:36:16 +0000
commit0a668c8eb335ba601d97fc7c8dbbecb1c7455408 (patch)
tree5ea7696fe3e98623abfad58e62422b5538e2a36e /plugins/Clist_nicer
parent3ed8130e44a7f076fba9f4957c09920716441f48 (diff)
massive extinction of clutches:
- nicer own extra icons; - duplicate cache entries in modern - many other quirks git-svn-id: http://svn.miranda-ng.org/main/trunk@2201 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Clist_nicer')
-rw-r--r--plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp72
-rw-r--r--plugins/Clist_nicer/src/Include/clc.h33
-rw-r--r--plugins/Clist_nicer/src/Include/commonheaders.h1
-rw-r--r--plugins/Clist_nicer/src/clc.cpp18
-rw-r--r--plugins/Clist_nicer/src/clcitems.cpp3
-rw-r--r--plugins/Clist_nicer/src/clcmsgs.cpp108
-rw-r--r--plugins/Clist_nicer/src/clcopts.cpp18
-rw-r--r--plugins/Clist_nicer/src/clcpaint.cpp91
-rw-r--r--plugins/Clist_nicer/src/clcutils.cpp737
-rw-r--r--plugins/Clist_nicer/src/clistmod.cpp2
-rw-r--r--plugins/Clist_nicer/src/clui.cpp29
-rw-r--r--plugins/Clist_nicer/src/cluiservices.cpp2
-rw-r--r--plugins/Clist_nicer/src/config.cpp2
-rw-r--r--plugins/Clist_nicer/src/extBackg.cpp5
-rw-r--r--plugins/Clist_nicer/src/init.cpp41
15 files changed, 462 insertions, 700 deletions
diff --git a/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp b/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp
index e3f277004b..d1e36fca10 100644
--- a/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp
+++ b/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp
@@ -27,7 +27,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "cluiframes.h"
HFONT __fastcall ChangeToFont(HDC hdc, struct ClcData *dat, int id, int *fontHeight);
-extern HIMAGELIST himlExtraImages;
extern HWND g_hwndViewModeFrame, g_hwndEventArea;
extern StatusItems_t *StatusItems;
extern int mf_updatethread_running;
@@ -3386,75 +3385,9 @@ static int CLUIFrameOnModulesUnload(WPARAM wParam, LPARAM lParam)
}
/*
-static INT_PTR SetIconForExtraColumn(WPARAM wParam, LPARAM lParam)
-{
- pIconExtraColumn piec;
-
- if (pcli->hwndContactTree == 0)
- return -1;
-
- if (wParam == 0 || lParam == 0 || IsBadCodePtr((FARPROC)lParam))
- return -1;
-
- piec = (pIconExtraColumn)lParam;
-
- if (piec->cbSize != sizeof(IconExtraColumn))
- return -1;
-
- if (cfg::dat.bMetaAvail && cfg::dat.bMetaEnabled && cfg::getByte((HANDLE)wParam, cfg::dat.szMetaName, "IsSubcontact", 0))
- PostMessage(pcli->hwndContactTree, CLM_SETEXTRAIMAGEINTMETA, wParam, MAKELONG((WORD)piec->ColumnType, (WORD)piec->hImage));
- else
- PostMessage(pcli->hwndContactTree, CLM_SETEXTRAIMAGEINT, wParam, MAKELONG((WORD)piec->ColumnType, (WORD)piec->hImage));
- return 0;
-}
-*/
-/*
* wparam=hIcon
* return hImage on success,-1 on failure
*/
-static INT_PTR AddIconToExtraImageList(WPARAM wParam, LPARAM lParam)
-{
- if (himlExtraImages == 0 || wParam == 0)
- return -1;
-
- return((int)ImageList_AddIcon(himlExtraImages, (HICON)wParam));
-}
-
-/*
-static INT_PTR SkinDrawBgService(WPARAM wParam, LPARAM lParam)
-{
- StatusItems_t item;
- HWND hwnd;
- RECT rc;
-
- SKINDRAWREQUEST *sdrq = (SKINDRAWREQUEST *)wParam;
-
- if (wParam == 0 || IsBadCodePtr((FARPROC)wParam) || pDrawAlpha == NULL)
- return 0;
-
- hwnd = WindowFromDC(sdrq->hDC);
- GetClientRect(hwnd, &rc);
- if (strstr(sdrq->szObjectID, "/Background") && EqualRect(&sdrq->rcClipRect, &sdrq->rcDestRect)) {
- SkinDrawBg(hwnd, sdrq->hDC);
- GetItemByStatus(ID_EXTBKEVTAREA, &item);
- if (item.IGNORED)
- FillRect(sdrq->hDC, &(sdrq->rcClipRect), GetSysColorBrush(COLOR_3DFACE));
- else {
- DrawAlpha(sdrq->hDC, &(sdrq->rcClipRect), item.COLOR, item.ALPHA, item.COLOR2, item.COLOR2_TRANSPARENT,
- item.GRADIENT, item.CORNER, item.BORDERSTYLE, item.imageItem);
- }
- }
- else {
- GetItemByStatus(ID_EXTBKEVTAREA, &item);
- if (item.IGNORED)
- FillRect(sdrq->hDC, &(sdrq->rcClipRect), GetSysColorBrush(COLOR_3DFACE));
- else {
- DrawAlpha(sdrq->hDC, &(sdrq->rcClipRect), item.COLOR, item.ALPHA, item.COLOR2, item.COLOR2_TRANSPARENT,
- item.GRADIENT, item.CORNER, item.BORDERSTYLE, item.imageItem);
- }
- }
-}
-*/
void RegisterCLUIFrameClasses()
{
@@ -3572,8 +3505,3 @@ int UnLoadCLUIFramesModule(void)
UnitFramesMenu();
return 0;
}
-
-void ReloadExtraIcons()
-{
- NotifyEventHooks(hExtraImageListRebuilding, 0, 0);
-}
diff --git a/plugins/Clist_nicer/src/Include/clc.h b/plugins/Clist_nicer/src/Include/clc.h
index eb1ea2b004..d4c69bcb4f 100644
--- a/plugins/Clist_nicer/src/Include/clc.h
+++ b/plugins/Clist_nicer/src/Include/clc.h
@@ -30,8 +30,6 @@
*
*/
-#define MAXEXTRACOLUMNS 16
-
#define INTM_XSTATUSCHANGED (WM_USER+26)
#define INTM_METACHANGEDEVENT (WM_USER+27)
#define INTM_CODEPAGECHANGED (WM_USER+28)
@@ -54,7 +52,6 @@
#define TIMERID_SORT 15
#define TIMERID_REFRESH 18
#define TIMERID_PAINT 19
-ClcGroup;
#define CONTACTF_ONLINE 1
#define CONTACTF_INVISTO 2
@@ -115,8 +112,6 @@ typedef ContactFloater CONTACTFLOATER;
#define DSPF_DONTSEPARATEOFFLINE 32
#define DSPF_CENTERGROUPNAMES 64
-#define EXICON_COUNT 11
-
/* Extra icons settings */
typedef struct _OrderTreeData
{
@@ -129,12 +124,12 @@ typedef struct _OrderTreeData
struct DisplayProfile
{
- DWORD dwFlags;
- DWORD dwExtraImageMask;
- int exIconScale;
- BOOL bCenterStatusIcons;
- BOOL bDimIdle, bNoOfflineAvatars, bShowLocalTime, bShowLocalTimeSelective, bDontSeparateOffline, bCenterGroupNames;
- BYTE dualRowMode;
+ DWORD dwFlags;
+ DWORD dwExtraImageMask;
+ int exIconScale;
+ BOOL bCenterStatusIcons;
+ BOOL bDimIdle, bNoOfflineAvatars, bShowLocalTime, bShowLocalTimeSelective, bDontSeparateOffline, bCenterGroupNames;
+ BYTE dualRowMode;
COLORREF avatarBorder;
DWORD avatarRadius;
int avatarSize;
@@ -143,7 +138,6 @@ struct DisplayProfile
BYTE sortOrder[3], bUseDCMirroring, bGroupAlign;
BYTE avatarPadding;
BYTE bLeftMargin, bRightMargin, bRowSpacing, bGroupIndent, bRowHeight, bGroupRowHeight;
- BYTE exIconOrder[EXICON_COUNT];
};
typedef struct DisplayProfile DISPLAYPROFILE;
@@ -162,10 +156,8 @@ typedef struct DisplayProfileSet DISPLAYPROFILESET;
struct TExtraCache
{
- WORD iExtraImage[MAXEXTRACOLUMNS];
HANDLE hContact;
HANDLE hTimeZone;
- DWORD iExtraValid;
BYTE valid;
TCHAR *statusMsg;
BYTE bStatusMsgValid;
@@ -377,7 +369,6 @@ struct TCluiData {
BOOL fOnDesktop;
int group_padding;
DWORD t_now;
- BYTE exIconOrder[EXICON_COUNT];
BOOL realTimeSaving;
TCHAR tszProfilePath[MAX_PATH];
FILETIME ft;
@@ -566,18 +557,6 @@ int CoolSB_SetupScrollBar();
#define SETTING_WINDOWSTYLE_THINBORDER 2
#define SETTING_WINDOWSTYLE_NOBORDER 3
-#define EIMG_SHOW_RES0 8
-#define EIMG_SHOW_EMAIL 1
-#define EIMG_SHOW_WEB 2
-#define EIMG_SHOW_SMS 4
-#define EIMG_SHOW_ADV1 16
-#define EIMG_SHOW_ADV2 32
-#define EIMG_SHOW_ADV3 512
-#define EIMG_SHOW_CLIENT 64
-#define EIMG_SHOW_ADV4 1024
-#define EIMG_SHOW_RES1 128
-#define EIMG_SHOW_RES2 256
-
#define CLCHT_ONITEMEXTRAEX 0x1000 //on an extra icon, HIBYTE(HIWORD()) says which
#define CLCHT_ONAVATAR 0x2000
#define CLCHT_ONITEMSPACE 0x4000
diff --git a/plugins/Clist_nicer/src/Include/commonheaders.h b/plugins/Clist_nicer/src/Include/commonheaders.h
index 27f0da733b..8fb2a7f6a4 100644
--- a/plugins/Clist_nicer/src/Include/commonheaders.h
+++ b/plugins/Clist_nicer/src/Include/commonheaders.h
@@ -36,7 +36,6 @@
#define _WIN32_IE 0x0501
#define _CRT_SECURE_NO_WARNINGS
-#define EXTRA_ICON_COUNT 11
#undef FASTCALL
diff --git a/plugins/Clist_nicer/src/clc.cpp b/plugins/Clist_nicer/src/clc.cpp
index 486a81e3f4..e3163f5aaf 100644
--- a/plugins/Clist_nicer/src/clc.cpp
+++ b/plugins/Clist_nicer/src/clc.cpp
@@ -47,7 +47,6 @@ extern int during_sizing;
extern StatusItems_t *StatusItems;
HIMAGELIST hCListImages;
-extern HIMAGELIST himlExtraImages;
HANDLE hIcoLibChanged = 0, hSvc_GetContactStatusMsg = 0;
@@ -289,7 +288,6 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L
RowHeight::Init(dat);
dat->forceScroll = 0;
dat->lastRepaint = 0;
- dat->himlExtraColumns = himlExtraImages;
dat->hwndParent = GetParent(hwnd);
dat->lastSort = GetTickCount();
dat->needsResort = FALSE;
@@ -324,12 +322,12 @@ LBL_Def:
return FrameNCPaint(hwnd, DefWindowProc, wParam, lParam, frameHasTitlebar);
case INTM_GROUPCHANGED: {
ClcContact *contact;
- BYTE iExtraImage[MAXEXTRACOLUMNS];
+ WORD iExtraImage[EXTRA_ICON_COUNT];
BYTE flags = 0;
if (!FindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
memset(iExtraImage, 0xFF, sizeof(iExtraImage));
else {
- CopyMemory(iExtraImage, contact->iExtraImage, sizeof(iExtraImage));
+ memcpy(iExtraImage, contact->iExtraImage, sizeof(iExtraImage));
flags = contact->flags;
}
pcli->pfnDeleteItemFromTree(hwnd, (HANDLE) wParam);
@@ -337,7 +335,7 @@ LBL_Def:
NMCLISTCONTROL nm;
pcli->pfnAddContactToTree(hwnd, dat, (HANDLE) wParam, 1, 1);
if (FindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL)) {
- CopyMemory(contact->iExtraImage, iExtraImage, sizeof(iExtraImage));
+ memcpy(contact->iExtraImage, iExtraImage, sizeof(iExtraImage));
if (flags & CONTACTF_CHECKED)
contact->flags |= CONTACTF_CHECKED;
}
@@ -417,19 +415,23 @@ LBL_Def:
}
case INTM_METACHANGED: {
ClcContact *contact;
- if (!pcli->pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
+ 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 = (char*) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) contact->hSubContact, 0);
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;
- CopyMemory(cfg::eCache[contact->extraCacheEntry].iExtraImage, cfg::eCache[subIndex].iExtraImage, MAXEXTRACOLUMNS);
- cfg::eCache[contact->extraCacheEntry].iExtraValid = cfg::eCache[subIndex].iExtraValid;
+ memcpy(contact->iExtraImage, subContact->iExtraImage, sizeof(contact->iExtraImage));
}
}
}
diff --git a/plugins/Clist_nicer/src/clcitems.cpp b/plugins/Clist_nicer/src/clcitems.cpp
index 97f438dbc5..3705104501 100644
--- a/plugins/Clist_nicer/src/clcitems.cpp
+++ b/plugins/Clist_nicer/src/clcitems.cpp
@@ -476,9 +476,6 @@ void GetExtendedInfo(ClcContact *contact, struct ClcData *dat)
return;
cfg::eCache[index].isChatRoom = cfg::getByte(contact->hContact, contact->proto, "ChatRoom", 0);
-
- cfg::eCache[index].iExtraValid &= ~(EIMG_SHOW_EMAIL | EIMG_SHOW_SMS | EIMG_SHOW_WEB);
- memset(cfg::eCache[index].iExtraImage, 0xFF, sizeof(cfg::eCache[index].iExtraImage));
}
void LoadSkinItemToCache(struct TExtraCache *cEntry, const char *szProto)
diff --git a/plugins/Clist_nicer/src/clcmsgs.cpp b/plugins/Clist_nicer/src/clcmsgs.cpp
index c1900f2141..0b3dd76d22 100644
--- a/plugins/Clist_nicer/src/clcmsgs.cpp
+++ b/plugins/Clist_nicer/src/clcmsgs.cpp
@@ -53,77 +53,19 @@ LRESULT ProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM
break;
}
- case CLM_SETEXTRAIMAGEINT:
- {
- ClcContact *contact = NULL;
- int index = -1;
-
- if (LOWORD(lParam) >= MAXEXTRACOLUMNS || wParam == 0)
- return 0;
-
- if (!FindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
- return 0;
-
- index = contact->extraCacheEntry;
-
- if (contact->type != CLCIT_CONTACT) // || contact->bIsMeta)
- return 0;
-
- //if (contact->bIsMeta && LOWORD(lParam) != EIMG_EXTRA && LOWORD(lParam) != EIMG_CLIENT)
- // return 0;
-
- /*
- if (contact->hContact == 5846286) {
- _DebugTraceA("set extra image %d", LOWORD(lParam));
- }
- */
- if (index >= 0 && index < cfg::nextCacheEntry) {
- cfg::eCache[index].iExtraImage[LOWORD(lParam)] = (BYTE)HIWORD(lParam);
- cfg::eCache[index].iExtraValid = cfg::eCache[index].iExtraImage[LOWORD(lParam)] != 0xffff ? (cfg::eCache[index].iExtraValid | (1 << LOWORD(lParam))) : (cfg::eCache[index].iExtraValid & ~(1 << LOWORD(lParam)));
- PostMessage(hwnd, INTM_INVALIDATE, 0, (LPARAM)(contact ? contact->hContact : 0));
- }
- }
- return 0;
- case CLM_SETEXTRAIMAGEINTMETA:
- {
- HANDLE hMasterContact = 0;
- int index = -1;
-
- if (LOWORD(lParam) >= MAXEXTRACOLUMNS)
- return 0;
-
- index = cfg::getCache((HANDLE)wParam, NULL);
- if (index >= 0 && index < cfg::nextCacheEntry) {
- cfg::eCache[index].iExtraImage[LOWORD(lParam)] = (BYTE)HIWORD(lParam);
- cfg::eCache[index].iExtraValid = cfg::eCache[index].iExtraImage[LOWORD(lParam)] != 0xffff ? (cfg::eCache[index].iExtraValid | (1 << LOWORD(lParam))) : (cfg::eCache[index].iExtraValid & ~(1 << LOWORD(lParam)));
- }
-
- hMasterContact = (HANDLE)cfg::getDword((HANDLE)wParam, cfg::dat.szMetaName, "Handle", 0);
-
- index = cfg::getCache(hMasterContact, NULL);
- if (index >= 0 && index < cfg::nextCacheEntry) {
- cfg::eCache[index].iExtraImage[LOWORD(lParam)] = (BYTE)HIWORD(lParam);
- cfg::eCache[index].iExtraValid = cfg::eCache[index].iExtraImage[LOWORD(lParam)] != 0xffff ? (cfg::eCache[index].iExtraValid | (1 << LOWORD(lParam))) : (cfg::eCache[index].iExtraValid & ~(1 << LOWORD(lParam)));
- PostMessage(hwnd, INTM_INVALIDATE, 0, 0);
- }
- }
- return 0;
-
case CLM_GETSTATUSMSG:
- {
+ if (wParam) {
ClcContact *contact = NULL;
-
- if (wParam == 0)
- return 0;
-
if (!FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL))
return 0;
+
if (contact->type != CLCIT_CONTACT)
return 0;
- if (contact->extraCacheEntry >= 0 && contact->extraCacheEntry <= cfg::nextCacheEntry) {
+
+ if (contact->extraCacheEntry >= 0 && contact->extraCacheEntry <= cfg::nextCacheEntry)
if (cfg::eCache[contact->extraCacheEntry].bStatusMsgValid != STATUSMSG_NOTFOUND)
return((INT_PTR)cfg::eCache[contact->extraCacheEntry].statusMsg);
- } }
+ }
return 0;
case CLM_SETHIDESUBCONTACTS:
@@ -131,12 +73,8 @@ LRESULT ProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM
return 0;
case CLM_TOGGLEPRIORITYCONTACT:
- {
+ if (wParam) {
ClcContact *contact = NULL;
-
- if (wParam == 0)
- return 0;
-
if (!FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL))
return 0;
if (contact->type != CLCIT_CONTACT)
@@ -144,39 +82,32 @@ LRESULT ProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM
contact->flags ^= CONTACTF_PRIORITY;
cfg::writeByte(contact->hContact, "CList", "Priority", (BYTE)(contact->flags & CONTACTF_PRIORITY ? 1 : 0));
pcli->pfnClcBroadcast(CLM_AUTOREBUILD, 0, 0);
- return 0;
}
+ return 0;
+
case CLM_QUERYPRIORITYCONTACT:
- {
+ if (wParam) {
ClcContact *contact = NULL;
-
- if (wParam == 0)
- return 0;
-
if (!FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL))
return 0;
if (contact->type != CLCIT_CONTACT)
return 0;
return(contact->flags & CONTACTF_PRIORITY ? 1 : 0);
}
+ return 0;
+
case CLM_TOGGLEFLOATINGCONTACT:
- {
+ if (wParam) {
ClcContact *contact = NULL;
- BYTE state;
- int iEntry;
-
- if (wParam == 0)
- return 0;
-
if (!FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL))
return 0;
if (contact->type != CLCIT_CONTACT)
return 0;
- iEntry = contact->extraCacheEntry;
+ int iEntry = contact->extraCacheEntry;
if (iEntry >= 0 && iEntry <= cfg::nextCacheEntry) {
- state = !cfg::getByte(contact->hContact, "CList", "floating", 0);
+ BYTE state = !cfg::getByte(contact->hContact, "CList", "floating", 0);
if (state) {
if (cfg::eCache[iEntry].floater == NULL)
FLT_Create(iEntry);
@@ -190,17 +121,12 @@ LRESULT ProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM
}
cfg::writeByte(contact->hContact, "CList", "floating", state);
}
- return 0;
- }
- case CLM_QUERYFLOATINGCONTACT:
- {
- return(cfg::getByte((HANDLE)wParam, "CList", "floating", 0));
}
- case CLM_SETEXTRAIMAGELIST:
- dat->himlExtraColumns = (HIMAGELIST) lParam;
- InvalidateRect(hwnd, NULL, FALSE);
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 7555aacb94..0f38eef919 100644
--- a/plugins/Clist_nicer/src/clcopts.cpp
+++ b/plugins/Clist_nicer/src/clcopts.cpp
@@ -41,9 +41,6 @@ extern INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
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);
extern INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-extern void ReloadExtraIcons( void );
-
-extern HIMAGELIST himlExtraImages;
struct CheckBoxToStyleEx_t {
int id;
@@ -314,7 +311,6 @@ static void DSP_LoadFromDefaults(DISPLAYPROFILE *p)
p->bGroupIndent = cfg::getByte("CLC", "GroupIndent", CLCDEFAULT_GROUPINDENT);
p->bRowHeight = cfg::getByte("CLC", "RowHeight", CLCDEFAULT_ROWHEIGHT);
p->bGroupRowHeight = cfg::getByte("CLC", "GRowHeight", CLCDEFAULT_ROWHEIGHT);
- CopyMemory(p->exIconOrder, cfg::dat.exIconOrder, EXICON_COUNT);
}
/*
@@ -327,7 +323,7 @@ void DSP_Apply(DISPLAYPROFILE *p)
DWORD oldMask = cfg::dat.dwExtraImageMask;
int i;
DWORD exStyle;
- char temp[EXICON_COUNT + 1];
+ char temp[EXTRA_ICON_COUNT + 1];
/*
* icons page
*/
@@ -340,10 +336,6 @@ void DSP_Apply(DISPLAYPROFILE *p)
cfg::writeByte("CLC", "ExIconScale", (BYTE)cfg::dat.exIconScale);
cfg::writeByte("CLC", "si_centered", (BYTE)cfg::dat.bCenterStatusIcons);
cfg::writeByte("CLC", "ShowIdle", (BYTE)p->bDimIdle);
-
- CopyMemory(cfg::dat.exIconOrder, p->exIconOrder, EXICON_COUNT);
- CopyMemory(temp, p->exIconOrder, EXICON_COUNT);
- temp[EXICON_COUNT] = 0;
cfg::writeString(NULL, "CLUI", "exIconOrder", temp);
/*
@@ -438,11 +430,9 @@ void DSP_Apply(DISPLAYPROFILE *p)
for (i = 0; i < cfg::nextCacheEntry; i++)
cfg::eCache[i].dwXMask = CalcXMask(cfg::eCache[i].hContact);
- if (oldexIconScale != cfg::dat.exIconScale) {
- ImageList_RemoveAll(himlExtraImages);
- ImageList_SetIconSize(himlExtraImages, cfg::dat.exIconScale, cfg::dat.exIconScale);
+ if (oldexIconScale != cfg::dat.exIconScale)
IcoLibReloadIcons();
- }
+
pcli->pfnClcOptionsChanged();
pcli->pfnClcBroadcast(CLM_AUTOREBUILD, 0, 0);
}
@@ -1373,7 +1363,7 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
if (!GetOpenFileNameA(&ofn))
break;
SetDlgItemTextA(hwndDlg, IDC_FILENAME, str);
- }
+ }
else if (LOWORD(wParam) == IDC_FILENAME && HIWORD(wParam) != EN_CHANGE)
break;
diff --git a/plugins/Clist_nicer/src/clcpaint.cpp b/plugins/Clist_nicer/src/clcpaint.cpp
index 45a525e65d..03b9e0141e 100644
--- a/plugins/Clist_nicer/src/clcpaint.cpp
+++ b/plugins/Clist_nicer/src/clcpaint.cpp
@@ -226,7 +226,8 @@ void PaintNotifyArea(HDC hDC, RECT *rc)
DrawText(hDC, szName, -1, rc, DT_VCENTER | DT_SINGLELINE);
ImageList_DrawEx(hCListImages, (int)cfg::dat.hIconNotify, hDC, 4, (rc->bottom + rc->top - 16) / 2, 16, 16, CLR_NONE, CLR_NONE, ILD_NORMAL);
ev_lastIcon = cfg::dat.hIconNotify;
- } else if (iCount > 0) {
+ }
+ else if (iCount > 0) {
MENUITEMINFO mii = {0};
struct NotifyMenuItemExData *nmi;
TCHAR *szName;
@@ -243,7 +244,8 @@ void PaintNotifyArea(HDC hDC, RECT *rc)
ImageList_DrawEx(hCListImages, nmi->iIcon, hDC, 4, (rc->bottom + rc->top) / 2 - 8, 16, 16, CLR_NONE, CLR_NONE, ILD_NORMAL);
DrawText(hDC, szName, -1, rc, DT_VCENTER | DT_SINGLELINE);
ev_lastIcon = (int)nmi->hIcon;
- } else {
+ }
+ else {
HICON hIcon = reinterpret_cast<HICON>(LoadImage(g_hInst, MAKEINTRESOURCE(IDI_BLANK), IMAGE_ICON, 16, 16, 0));
DrawText(hDC, cfg::dat.szNoEvents, lstrlen(cfg::dat.szNoEvents), rc, DT_VCENTER | DT_SINGLELINE);
DrawIconEx(hDC, 4, (rc->bottom + rc->top - 16) / 2, hIcon, 16, 16, 0, 0, DI_NORMAL | DI_COMPAT);
@@ -478,7 +480,6 @@ void __inline PaintItem(HDC hdcMem, ClcGroup *group, ClcContact *contact, int in
else
cEntry = cfg::eCache;
-
if (dat->bisEmbedded)
goto set_bg_l;
@@ -491,23 +492,18 @@ void __inline PaintItem(HDC hdcMem, ClcGroup *group, ClcContact *contact, int in
bg_indent_l = cfg::dat.bApplyIndentToBg ? indent * dat->groupIndent : 0;
dt_nickflags = DT_RTLREADING | DT_RIGHT;
}
- else
- bg_indent_l = cfg::dat.bApplyIndentToBg ? indent * dat->groupIndent : 0;
+ else bg_indent_l = cfg::dat.bApplyIndentToBg ? indent * dat->groupIndent : 0;
}
else if (type == CLCIT_GROUP && API::pfnSetLayout != NULL) {
if ((contact->isRtl && cfg::dat.bGroupAlign == CLC_GROUPALIGN_AUTO) || cfg::dat.bGroupAlign == CLC_GROUPALIGN_RIGHT) {
g_RTL = TRUE;
bg_indent_r = cfg::dat.bApplyIndentToBg ? indent * dat->groupIndent : 0;
}
- else
- bg_indent_l = cfg::dat.bApplyIndentToBg ? indent * dat->groupIndent : 0;
+ else bg_indent_l = cfg::dat.bApplyIndentToBg ? indent * dat->groupIndent : 0;
}
- else
- bg_indent_l = cfg::dat.bApplyIndentToBg ? indent * dat->groupIndent : 0;
+ else bg_indent_l = cfg::dat.bApplyIndentToBg ? indent * dat->groupIndent : 0;
set_bg_l:
-
-
g_hottrack = dat->exStyle & CLS_EX_TRACKSELECT && type == CLCIT_CONTACT && dat->iHotTrack == index;
if (g_hottrack == selected)
g_hottrack = 0;
@@ -522,7 +518,8 @@ set_bg_l:
ChangeToFont(hdcMem, dat, FONTID_GROUPS, &fontHeight);
else
ChangeToFont(hdcMem, dat, FONTID_CONTACTS, &fontHeight);
- } else if (type == CLCIT_DIVIDER) {
+ }
+ else if (type == CLCIT_DIVIDER) {
ChangeToFont(hdcMem, dat, FONTID_DIVIDERS, &fontHeight);
GetTextExtentPoint32(hdcMem, contact->szText, lstrlen(contact->szText), &textSize);
}
@@ -857,18 +854,16 @@ set_bg_l:
SetHotTrackColour(hdcMem,dat);
if (ht->IGNORED == 0)
SetTextColor(hdcMem, ht->TEXTCOLOR);
- if (!g_hottrack_done) {
- if (ht->IGNORED == 0) {
+ if (!g_hottrack_done)
+ if (ht->IGNORED == 0)
DrawAlpha(hdcMem, &rc, ht->COLOR, ht->ALPHA, ht->COLOR2, ht->COLOR2_TRANSPARENT, ht->GRADIENT,
ht->CORNER, ht->BORDERSTYLE, ht->imageItem);
- }
- }
}
if (g_RTL)
API::pfnSetLayout(hdcMem, LAYOUT_RTL | LAYOUT_BITMAPORIENTATIONPRESERVED);
-bgskipped:
+bgskipped:
rcContent.top = y + g_padding_y;
rcContent.bottom = y + rowHeight - (2 * g_padding_y);
rcContent.left = leftX;
@@ -905,7 +900,6 @@ bgskipped:
else if (type == CLCIT_CONTACT)
iImage = contact->iImage;
-
if (pi_avatar && (av_left || av_right)) {
RECT rc;
@@ -976,23 +970,19 @@ bgskipped:
if (type == CLCIT_CONTACT && !dat->bisEmbedded) {
BYTE bApparentModeDontCare = !((flags & CONTACTF_VISTO) ^ (flags & CONTACTF_INVISTO));
contact->extraIconRightBegin = 0;
- if (cEntry && (contact->extraCacheEntry >= 0 && contact->extraCacheEntry < cfg::nextCacheEntry && cEntry->iExtraValid)) {
- int i, iIndex;
+ if (cEntry && (contact->extraCacheEntry >= 0 && contact->extraCacheEntry < cfg::nextCacheEntry)) {
DWORD dwOldMask = cEntry->dwXMask;
- if (dwFlags & CLUI_FRAME_USEXSTATUSASSTATUS)
- cEntry->dwXMask &= ~EIMG_SHOW_ADV1;
-
- for (i = EXICON_COUNT - 1; i >= 0; i--) {
- iIndex = cfg::dat.exIconOrder[i] - 1;
- if (iIndex >= 0 && iIndex < EXICON_COUNT) {
- if (cEntry->iExtraImage[i] != 0xffff && ((1 << i) & cEntry->dwXMask)) {
- if (contact->extraIconRightBegin == 0 && i != (EXICON_COUNT - 1))
- contact->extraIconRightBegin = rcContent.right;
- ImageList_DrawEx(dat->himlExtraColumns, cEntry->iExtraImage[i], hdcMem, rcContent.right - cfg::dat.exIconScale, twoRows ? rcContent.bottom - g_exIconSpacing : y + ((rowHeight - cfg::dat.exIconScale) >> 1),
- 0, 0, CLR_NONE, CLR_NONE, ILD_NORMAL);
- rcContent.right -= g_exIconSpacing;
- rightIcons++;
- }
+//!!!!!! if (dwFlags & CLUI_FRAME_USEXSTATUSASSTATUS)
+//!!!!!! cEntry->dwXMask &= ~EIMG_SHOW_ADV1;
+
+ for (int i = EXTRA_ICON_COUNT - 1; i >= 0; i--) {
+ if (contact->iExtraImage[i] != 0xffff && ((1 << i) & cEntry->dwXMask)) {
+ if (contact->extraIconRightBegin == 0 && i != (EXTRA_ICON_COUNT - 1))
+ contact->extraIconRightBegin = rcContent.right;
+ ImageList_DrawEx(dat->himlExtraColumns, contact->iExtraImage[i], hdcMem, rcContent.right - cfg::dat.exIconScale, twoRows ? rcContent.bottom - g_exIconSpacing : y + ((rowHeight - cfg::dat.exIconScale) >> 1),
+ 0, 0, CLR_NONE, CLR_NONE, ILD_NORMAL);
+ rcContent.right -= g_exIconSpacing;
+ rightIcons++;
}
}
cEntry->dwXMask = dwOldMask;
@@ -1030,7 +1020,8 @@ text:
rc.left = rc.right + 6 + textSize.cx;
rc.right = clRect->right - dat->rightMargin;
DrawEdge(hdcMem, &rc, BDR_SUNKENOUTER, BF_RECT);
- } else if (type == CLCIT_GROUP) {
+ }
+ else if (type == CLCIT_GROUP) {
RECT rc;
int leftMargin = 0, countStart = 0, leftLineEnd, rightLineStart;
fontHeight = dat->fontInfo[FONTID_GROUPS].fontHeight;
@@ -1118,7 +1109,8 @@ text:
DrawEdge(hdcMem, &rc, BDR_SUNKENOUTER, BF_RECT);
}
}
- } else {
+ }
+ else {
TCHAR *szText = contact->szText;
rcContent.top = y + ((rowHeight - fontHeight) >> 1);
@@ -1142,12 +1134,8 @@ text:
}
// nickname
- if (!twoRows) {
- if (dt_nickflags)
- DrawText(hdcMem, szText, -1, &rcContent, DT_EDITCONTROL | DT_NOPREFIX | DT_NOCLIP | DT_WORD_ELLIPSIS | DT_SINGLELINE | dt_nickflags);
- else
- DrawText(hdcMem, szText, -1, &rcContent, DT_EDITCONTROL | DT_NOPREFIX | DT_NOCLIP | DT_WORD_ELLIPSIS | DT_SINGLELINE);
- }
+ if (!twoRows)
+ DrawText(hdcMem, szText, -1, &rcContent, DT_EDITCONTROL | DT_NOPREFIX | DT_NOCLIP | DT_WORD_ELLIPSIS | DT_SINGLELINE | dt_nickflags);
else {
int statusFontHeight;
DWORD dtFlags = DT_WORD_ELLIPSIS | DT_NOPREFIX | DT_NOCLIP | DT_SINGLELINE;
@@ -1308,20 +1296,23 @@ nodisplay:
DrawText(hdcMem, szText, qlen, &rc, DT_EDITCONTROL | DT_NOPREFIX | DT_NOCLIP | DT_WORD_ELLIPSIS | DT_SINGLELINE);
}
}
+
//extra icons
- for (iImage = 0; iImage< dat->extraColumnsCount; iImage++) {
+ for (int i = dat->extraColumnsCount-1; i >= 0; i--) {
COLORREF colourFg = dat->selBkColour;
int mode = ILD_NORMAL;
- if (contact->iExtraImage[iImage] == 0xFF)
+ if (contact->iExtraImage[i] == 0xFFFF)
continue;
+
if (selected)
mode = ILD_SELECTED;
- else if (g_hottrack) {
- mode = ILD_FOCUS; colourFg = dat->hotTextColour;
- } else if (type == CLCIT_CONTACT && flags & CONTACTF_NOTONLIST) {
- colourFg = dat->fontInfo[FONTID_NOTONLIST].colour; mode = ILD_BLEND50;
- }
- ImageList_DrawEx(dat->himlExtraColumns, contact->iExtraImage[iImage], hdcMem, clRect->right - rightOffset - dat->extraColumnSpacing * (dat->extraColumnsCount - iImage), y + ((rowHeight - 16) >> 1), 0, 0, CLR_NONE, colourFg, mode);
+ else if (g_hottrack)
+ mode = ILD_FOCUS, colourFg = dat->hotTextColour;
+ else if (type == CLCIT_CONTACT && flags & CONTACTF_NOTONLIST)
+ colourFg = dat->fontInfo[FONTID_NOTONLIST].colour, mode = ILD_BLEND50;
+
+ rightOffset += dat->extraColumnSpacing;
+ ImageList_DrawEx(dat->himlExtraColumns, contact->iExtraImage[i], hdcMem, clRect->right - rightOffset, y + ((rowHeight - 16) >> 1), 0, 0, CLR_NONE, colourFg, mode);
}
if (g_RTL)
API::pfnSetLayout(hdcMem, 0);
diff --git a/plugins/Clist_nicer/src/clcutils.cpp b/plugins/Clist_nicer/src/clcutils.cpp
index bc0c144f87..0424afad7a 100644
--- a/plugins/Clist_nicer/src/clcutils.cpp
+++ b/plugins/Clist_nicer/src/clcutils.cpp
@@ -40,37 +40,41 @@ static int MY_pathIsAbsolute(const TCHAR *path)
{
if (!path || !(lstrlen(path) > 2))
return 0;
+
if ((path[1] == ':' && path[2] == '\\') || (path[0] == '\\' && path[1] == '\\'))
- return 1;
+ return 1;
+
return 0;
}
size_t MY_pathToRelative(const TCHAR *pSrc, TCHAR *pOut)
{
if (!pSrc || !lstrlen(pSrc) || lstrlen(pSrc) > MAX_PATH)
- return 0;
- if (!MY_pathIsAbsolute(pSrc)) {
+ return 0;
+
+ if ( !MY_pathIsAbsolute(pSrc)) {
mir_sntprintf(pOut, MAX_PATH, _T("%s"), pSrc);
return lstrlen(pOut);
- } else {
- TCHAR szTmp[MAX_PATH];
- mir_sntprintf(szTmp, SIZEOF(szTmp), _T("%s"), pSrc);
- _tcslwr(szTmp);
- if (_tcsstr(szTmp, cfg::dat.tszProfilePath)) {
- mir_sntprintf(pOut, MAX_PATH, _T("%s"), pSrc + lstrlen(cfg::dat.tszProfilePath) - 1);
- pOut[0]='.';
- return lstrlen(pOut);
- } else {
- mir_sntprintf(pOut, MAX_PATH, _T("%s"), pSrc);
- return lstrlen(pOut);
- }
}
+
+ TCHAR szTmp[MAX_PATH];
+ mir_sntprintf(szTmp, SIZEOF(szTmp), _T("%s"), pSrc);
+ _tcslwr(szTmp);
+ if ( _tcsstr(szTmp, cfg::dat.tszProfilePath)) {
+ mir_sntprintf(pOut, MAX_PATH, _T("%s"), pSrc + lstrlen(cfg::dat.tszProfilePath) - 1);
+ pOut[0]='.';
+ return lstrlen(pOut);
+ }
+
+ mir_sntprintf(pOut, MAX_PATH, _T("%s"), pSrc);
+ return lstrlen(pOut);
}
size_t MY_pathToAbsolute(const TCHAR *pSrc, TCHAR *pOut)
{
if (!pSrc || !lstrlen(pSrc) || lstrlen(pSrc) > MAX_PATH)
- return 0;
+ return 0;
+
if (MY_pathIsAbsolute(pSrc)&&pSrc[0]!='.')
mir_sntprintf(pOut, MAX_PATH, _T("%s"), pSrc);
else if (pSrc[0]=='.')
@@ -86,261 +90,260 @@ size_t MY_pathToAbsolute(const TCHAR *pSrc, TCHAR *pOut)
int RTL_HitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, ClcContact *hitcontact, DWORD *flags, int indent, int hit)
{
- RECT clRect;
- int right, checkboxWidth, cxSmIcon, i, width;
- DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE);
- SIZE textSize;
- HDC hdc;
- HFONT hFont;
-
- GetClientRect(hwnd, &clRect);
- right = clRect.right;
-
- // avatar check
- if (hitcontact->type == CLCIT_CONTACT && cfg::dat.dwFlags & CLUI_FRAME_AVATARS && hitcontact->ace != NULL && hitcontact->avatarLeft != -1) {
- if (testx < right - hitcontact->avatarLeft && testx > right - hitcontact->avatarLeft - cfg::dat.avatarSize) {
- if (flags)
- *flags |= CLCHT_ONAVATAR;
- }
- }
- if (testx > right - (dat->leftMargin + indent * dat->groupIndent)) {
- if (flags)
- *flags |= CLCHT_ONITEMINDENT;
- return hit;
- }
- checkboxWidth = 0;
- if (style & CLS_CHECKBOXES && hitcontact->type == CLCIT_CONTACT)
- checkboxWidth = dat->checkboxSize + 2;
- if (style & CLS_GROUPCHECKBOXES && hitcontact->type == CLCIT_GROUP)
- checkboxWidth = dat->checkboxSize + 2;
- if (hitcontact->type == CLCIT_INFO && hitcontact->flags & CLCIIF_CHECKBOX)
- checkboxWidth = dat->checkboxSize + 2;
- if (testx > right - (dat->leftMargin + indent * dat->groupIndent + checkboxWidth)) {
- if (flags)
- *flags |= CLCHT_ONITEMCHECK;
- return hit;
- }
- if (testx > right - (dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace)) {
- if (flags)
- *flags |= CLCHT_ONITEMICON;
- return hit;
- }
- cxSmIcon = GetSystemMetrics(SM_CXSMICON);
- for (i = 0; i< dat->extraColumnsCount; i++) {
- if (hitcontact->iExtraImage[i] == 0xFF)
- continue;
- if (testx >= dat->extraColumnSpacing * (dat->extraColumnsCount - i) && testx < dat->extraColumnSpacing * (dat->extraColumnsCount - i) + cxSmIcon) {
- if (flags)
- *flags |= CLCHT_ONITEMEXTRA | (i << 24);
- return hit;
- }
- }
- if (hitcontact->extraCacheEntry >= 0 && hitcontact->extraCacheEntry < cfg::nextCacheEntry && cfg::eCache[hitcontact->extraCacheEntry].iExtraValid) {
- int rightOffset = hitcontact->extraIconRightBegin;
- int images_present = 0;
-
- for (i = 5; i >= 0; i--) {
- if (cfg::eCache[hitcontact->extraCacheEntry].iExtraImage[i] == 0xFF)
- continue;
- if (!((1 << i) & cfg::eCache[hitcontact->extraCacheEntry].dwXMask))
- continue;
- images_present++;
- if (testx < right - (rightOffset - (cfg::dat.exIconScale + 2) * images_present) && testx > right - (rightOffset - (cfg::dat.exIconScale + 2) * images_present + (cfg::dat.exIconScale))) {
- if (flags)
- *flags |= (CLCHT_ONITEMEXTRAEX | ((i + 1) << 24));
- return hit;
- }
- }
- }
-
- hdc = GetDC(hwnd);
- if (hitcontact->type == CLCIT_GROUP)
- hFont = reinterpret_cast<HFONT>(SelectObject(hdc, dat->fontInfo[FONTID_GROUPS].hFont));
- else
- hFont = reinterpret_cast<HFONT>(SelectObject(hdc, dat->fontInfo[FONTID_CONTACTS].hFont));
- GetTextExtentPoint32(hdc, hitcontact->szText, lstrlen(hitcontact->szText), &textSize);
- width = textSize.cx;
- if (hitcontact->type == CLCIT_GROUP) {
- char *szCounts;
- szCounts = pcli->pfnGetGroupCountsText(dat, hitcontact);
- if (szCounts[0]) {
- GetTextExtentPoint32A(hdc, " ", 1, &textSize);
- width += textSize.cx;
- SelectObject(hdc, dat->fontInfo[FONTID_GROUPCOUNTS].hFont);
- GetTextExtentPoint32A(hdc, szCounts, lstrlenA(szCounts), &textSize);
- width += textSize.cx;
- }
- }
- SelectObject(hdc, hFont);
- ReleaseDC(hwnd, hdc);
- if (testx > right - (dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace + width + 4 + (cfg::dat.dwFlags & CLUI_FRAME_AVATARS ? cfg::dat.avatarSize : 0))) {
- if (flags)
- *flags |= CLCHT_ONITEMLABEL;
- return hit;
- }
- if (cfg::dat.dwFlags & CLUI_FULLROWSELECT && !(GetKeyState(VK_SHIFT) & 0x8000) && testx < right - (dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace + width + 4 + (cfg::dat.dwFlags & CLUI_FRAME_AVATARS ? cfg::dat.avatarSize : 0))) {
- if (flags)
- *flags |= CLCHT_ONITEMSPACE;
- return hit;
- }
- if (flags)
- *flags |= CLCHT_NOWHERE;
- return -1;
+ RECT clRect;
+ int right, checkboxWidth, cxSmIcon, i, width;
+ DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE);
+ SIZE textSize;
+ HDC hdc;
+ HFONT hFont;
+
+ GetClientRect(hwnd, &clRect);
+ right = clRect.right;
+
+ // avatar check
+ if (hitcontact->type == CLCIT_CONTACT && cfg::dat.dwFlags & CLUI_FRAME_AVATARS && hitcontact->ace != NULL && hitcontact->avatarLeft != -1) {
+ if (testx < right - hitcontact->avatarLeft && testx > right - hitcontact->avatarLeft - cfg::dat.avatarSize)
+ if (flags)
+ *flags |= CLCHT_ONAVATAR;
+ }
+ if (testx > right - (dat->leftMargin + indent * dat->groupIndent)) {
+ if (flags)
+ *flags |= CLCHT_ONITEMINDENT;
+ return hit;
+ }
+ checkboxWidth = 0;
+ if (style & CLS_CHECKBOXES && hitcontact->type == CLCIT_CONTACT)
+ checkboxWidth = dat->checkboxSize + 2;
+ if (style & CLS_GROUPCHECKBOXES && hitcontact->type == CLCIT_GROUP)
+ checkboxWidth = dat->checkboxSize + 2;
+ if (hitcontact->type == CLCIT_INFO && hitcontact->flags & CLCIIF_CHECKBOX)
+ checkboxWidth = dat->checkboxSize + 2;
+ if (testx > right - (dat->leftMargin + indent * dat->groupIndent + checkboxWidth)) {
+ if (flags)
+ *flags |= CLCHT_ONITEMCHECK;
+ return hit;
+ }
+ if (testx > right - (dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace)) {
+ if (flags)
+ *flags |= CLCHT_ONITEMICON;
+ return hit;
+ }
+ cxSmIcon = GetSystemMetrics(SM_CXSMICON);
+ for (i = 0; i< dat->extraColumnsCount; i++) {
+ if (hitcontact->iExtraImage[i] == 0xFFFF)
+ continue;
+ if (testx >= dat->extraColumnSpacing * (dat->extraColumnsCount - i) && testx < dat->extraColumnSpacing * (dat->extraColumnsCount - i) + cxSmIcon) {
+ if (flags)
+ *flags |= CLCHT_ONITEMEXTRA | (i << 24);
+ return hit;
+ }
+ }
+ if (hitcontact->extraCacheEntry >= 0 && hitcontact->extraCacheEntry < cfg::nextCacheEntry) {
+ int rightOffset = hitcontact->extraIconRightBegin;
+ int images_present = 0;
+
+ for (i = EXTRA_ICON_COUNT-1; i >= 0; i--) {
+ if (hitcontact->iExtraImage[i] == 0xFFFF)
+ continue;
+ if (!((1 << i) & cfg::eCache[hitcontact->extraCacheEntry].dwXMask))
+ continue;
+ images_present++;
+ if (testx < right - (rightOffset - (cfg::dat.exIconScale + 2) * images_present) && testx > right - (rightOffset - (cfg::dat.exIconScale + 2) * images_present + (cfg::dat.exIconScale))) {
+ if (flags)
+ *flags |= (CLCHT_ONITEMEXTRAEX | ((i + 1) << 24));
+ return hit;
+ }
+ }
+ }
+
+ hdc = GetDC(hwnd);
+ if (hitcontact->type == CLCIT_GROUP)
+ hFont = reinterpret_cast<HFONT>(SelectObject(hdc, dat->fontInfo[FONTID_GROUPS].hFont));
+ else
+ hFont = reinterpret_cast<HFONT>(SelectObject(hdc, dat->fontInfo[FONTID_CONTACTS].hFont));
+ GetTextExtentPoint32(hdc, hitcontact->szText, lstrlen(hitcontact->szText), &textSize);
+ width = textSize.cx;
+ if (hitcontact->type == CLCIT_GROUP) {
+ char *szCounts;
+ szCounts = pcli->pfnGetGroupCountsText(dat, hitcontact);
+ if (szCounts[0]) {
+ GetTextExtentPoint32A(hdc, " ", 1, &textSize);
+ width += textSize.cx;
+ SelectObject(hdc, dat->fontInfo[FONTID_GROUPCOUNTS].hFont);
+ GetTextExtentPoint32A(hdc, szCounts, lstrlenA(szCounts), &textSize);
+ width += textSize.cx;
+ }
+ }
+ SelectObject(hdc, hFont);
+ ReleaseDC(hwnd, hdc);
+ if (testx > right - (dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace + width + 4 + (cfg::dat.dwFlags & CLUI_FRAME_AVATARS ? cfg::dat.avatarSize : 0))) {
+ if (flags)
+ *flags |= CLCHT_ONITEMLABEL;
+ return hit;
+ }
+ if (cfg::dat.dwFlags & CLUI_FULLROWSELECT && !(GetKeyState(VK_SHIFT) & 0x8000) && testx < right - (dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace + width + 4 + (cfg::dat.dwFlags & CLUI_FRAME_AVATARS ? cfg::dat.avatarSize : 0))) {
+ if (flags)
+ *flags |= CLCHT_ONITEMSPACE;
+ return hit;
+ }
+ if (flags)
+ *flags |= CLCHT_NOWHERE;
+ return -1;
}
int HitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, ClcContact **contact, ClcGroup **group, DWORD *flags)
{
- ClcContact *hitcontact;
- ClcGroup *hitgroup;
- int hit, indent, width, i, cxSmIcon;
- int checkboxWidth;
- SIZE textSize;
- HDC hdc;
- RECT clRect;
- HFONT hFont;
- DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE);
+ ClcContact *hitcontact;
+ ClcGroup *hitgroup;
+ int hit, indent, width, i, cxSmIcon;
+ int checkboxWidth;
+ SIZE textSize;
+ HDC hdc;
+ RECT clRect;
+ HFONT hFont;
+ DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE);
BYTE mirror_mode = cfg::dat.bUseDCMirroring;
- if (flags)
- *flags = 0;
- GetClientRect(hwnd, &clRect);
- if (testx < 0 || testy < 0 || testy >= clRect.bottom || testx >= clRect.right) {
- if (flags) {
- if (testx < 0)
- *flags |= CLCHT_TOLEFT;
- else if (testx >= clRect.right)
- *flags |= CLCHT_TORIGHT;
- if (testy < 0)
- *flags |= CLCHT_ABOVE;
- else if (testy >= clRect.bottom)
- *flags |= CLCHT_BELOW;
- }
- return -1;
- }
- if (testx< dat->leftMargin) {
- if (flags)
- *flags |= CLCHT_INLEFTMARGIN | CLCHT_NOWHERE;
- return -1;
- }
- hit = RowHeight::hitTest(dat, dat->yScroll + testy);
+ if (flags)
+ *flags = 0;
+ GetClientRect(hwnd, &clRect);
+ if (testx < 0 || testy < 0 || testy >= clRect.bottom || testx >= clRect.right) {
+ if (flags) {
+ if (testx < 0)
+ *flags |= CLCHT_TOLEFT;
+ else if (testx >= clRect.right)
+ *flags |= CLCHT_TORIGHT;
+ if (testy < 0)
+ *flags |= CLCHT_ABOVE;
+ else if (testy >= clRect.bottom)
+ *flags |= CLCHT_BELOW;
+ }
+ return -1;
+ }
+ if (testx< dat->leftMargin) {
+ if (flags)
+ *flags |= CLCHT_INLEFTMARGIN | CLCHT_NOWHERE;
+ return -1;
+ }
+ hit = RowHeight::hitTest(dat, dat->yScroll + testy);
if (hit != -1)
hit = pcli->pfnGetRowByIndex(dat, hit, &hitcontact, &hitgroup);
- if (hit == -1) {
- if (flags)
- *flags |= CLCHT_NOWHERE | CLCHT_BELOWITEMS;
- return -1;
- }
- if (contact)
- *contact = hitcontact;
- if (group)
- *group = hitgroup;
-
- for (indent = 0; hitgroup->parent; indent++,hitgroup = hitgroup->parent) {
- ;
- }
-
- if (!dat->bisEmbedded) {
- if (hitcontact->type == CLCIT_CONTACT) {
- if (mirror_mode == 1 || (mirror_mode == 2 && cfg::eCache[hitcontact->extraCacheEntry].dwCFlags & ECF_RTLNICK))
- return RTL_HitTest(hwnd, dat, testx, testy, hitcontact, flags, indent, hit);
- }
- else if (hitcontact->type == CLCIT_GROUP) {
- if (cfg::dat.bGroupAlign == CLC_GROUPALIGN_RIGHT || (hitcontact->isRtl && cfg::dat.bGroupAlign == CLC_GROUPALIGN_AUTO))
- return RTL_HitTest(hwnd, dat, testx, testy, hitcontact, flags, indent, hit);
- }
- }
-
- // avatar check
- if (hitcontact->type == CLCIT_CONTACT && cfg::dat.dwFlags & CLUI_FRAME_AVATARS && hitcontact->ace != NULL && hitcontact->avatarLeft != -1) {
- if (testx >hitcontact->avatarLeft && testx < hitcontact->avatarLeft + cfg::dat.avatarSize) {
- if (flags)
- *flags |= CLCHT_ONAVATAR;
- }
- }
- if (testx< dat->leftMargin + indent * dat->groupIndent) {
- if (flags)
- *flags |= CLCHT_ONITEMINDENT;
- return hit;
- }
- checkboxWidth = 0;
- if (style & CLS_CHECKBOXES && hitcontact->type == CLCIT_CONTACT)
- checkboxWidth = dat->checkboxSize + 2;
- if (style & CLS_GROUPCHECKBOXES && hitcontact->type == CLCIT_GROUP)
- checkboxWidth = dat->checkboxSize + 2;
- if (hitcontact->type == CLCIT_INFO && hitcontact->flags & CLCIIF_CHECKBOX)
- checkboxWidth = dat->checkboxSize + 2;
- if (testx< dat->leftMargin + indent * dat->groupIndent + checkboxWidth) {
- if (flags)
- *flags |= CLCHT_ONITEMCHECK;
- return hit;
- }
- if (testx< dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace) {
- if (flags)
- *flags |= CLCHT_ONITEMICON;
- return hit;
- }
- cxSmIcon = GetSystemMetrics(SM_CXSMICON);
- for (i = 0; i< dat->extraColumnsCount; i++) {
- if (hitcontact->iExtraImage[i] == 0xFF)
- continue;
- if (testx >= clRect.right - dat->extraColumnSpacing * (dat->extraColumnsCount - i) && testx< clRect.right - dat->extraColumnSpacing * (dat->extraColumnsCount - i) + cxSmIcon) {
- if (flags)
- *flags |= CLCHT_ONITEMEXTRA | (i << 24);
- return hit;
- }
- }
- if (hitcontact->extraCacheEntry >= 0 && hitcontact->extraCacheEntry < cfg::nextCacheEntry && cfg::eCache[hitcontact->extraCacheEntry].iExtraValid) {
- //int rightOffset = clRect.right;
- int rightOffset = hitcontact->extraIconRightBegin;
- int images_present = 0;
-
- for (i = 5; i >= 0; i--) {
- if (cfg::eCache[hitcontact->extraCacheEntry].iExtraImage[i] == 0xFF)
- continue;
- if (!((1 << i) & cfg::eCache[hitcontact->extraCacheEntry].dwXMask))
- continue;
- images_present++;
- if (testx > (rightOffset - (cfg::dat.exIconScale + 2) * images_present) && testx < (rightOffset - (cfg::dat.exIconScale + 2) * images_present + (cfg::dat.exIconScale))) {
- if (flags)
- *flags |= (CLCHT_ONITEMEXTRAEX | ((i + 1) << 24));
- return hit;
- }
- }
- }
- hdc = GetDC(hwnd);
- if (hitcontact->type == CLCIT_GROUP)
- hFont = reinterpret_cast<HFONT>(SelectObject(hdc, dat->fontInfo[FONTID_GROUPS].hFont));
- else
- hFont = reinterpret_cast<HFONT>(SelectObject(hdc, dat->fontInfo[FONTID_CONTACTS].hFont));
- GetTextExtentPoint32(hdc, hitcontact->szText, lstrlen(hitcontact->szText), &textSize);
- width = textSize.cx;
- if (hitcontact->type == CLCIT_GROUP) {
- char *szCounts;
- szCounts = pcli->pfnGetGroupCountsText(dat, hitcontact);
- if (szCounts[0]) {
- GetTextExtentPoint32A(hdc, " ", 1, &textSize);
- width += textSize.cx;
- SelectObject(hdc, dat->fontInfo[FONTID_GROUPCOUNTS].hFont);
- GetTextExtentPoint32A(hdc, szCounts, lstrlenA(szCounts), &textSize);
- width += textSize.cx;
- }
- }
- SelectObject(hdc, hFont);
- ReleaseDC(hwnd, hdc);
- if (cfg::dat.dwFlags & CLUI_FULLROWSELECT && !(GetKeyState(VK_SHIFT) & 0x8000) && testx > dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace + width + 4 + (cfg::dat.dwFlags & CLUI_FRAME_AVATARS ? cfg::dat.avatarSize : 0)) {
- if (flags)
- *flags |= CLCHT_ONITEMSPACE;
- return hit;
- }
- if (testx< dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace + width + 4 + (cfg::dat.dwFlags & CLUI_FRAME_AVATARS ? cfg::dat.avatarSize : 0)) {
- if (flags)
- *flags |= CLCHT_ONITEMLABEL;
- return hit;
- }
- if (flags)
- *flags |= CLCHT_NOWHERE;
- return -1;
+ if (hit == -1) {
+ if (flags)
+ *flags |= CLCHT_NOWHERE | CLCHT_BELOWITEMS;
+ return -1;
+ }
+ if (contact)
+ *contact = hitcontact;
+ if (group)
+ *group = hitgroup;
+
+ for (indent = 0; hitgroup->parent; indent++,hitgroup = hitgroup->parent) {
+ ;
+ }
+
+ if (!dat->bisEmbedded) {
+ if (hitcontact->type == CLCIT_CONTACT) {
+ if (mirror_mode == 1 || (mirror_mode == 2 && cfg::eCache[hitcontact->extraCacheEntry].dwCFlags & ECF_RTLNICK))
+ return RTL_HitTest(hwnd, dat, testx, testy, hitcontact, flags, indent, hit);
+ }
+ else if (hitcontact->type == CLCIT_GROUP) {
+ if (cfg::dat.bGroupAlign == CLC_GROUPALIGN_RIGHT || (hitcontact->isRtl && cfg::dat.bGroupAlign == CLC_GROUPALIGN_AUTO))
+ return RTL_HitTest(hwnd, dat, testx, testy, hitcontact, flags, indent, hit);
+ }
+ }
+
+ // avatar check
+ if (hitcontact->type == CLCIT_CONTACT && cfg::dat.dwFlags & CLUI_FRAME_AVATARS && hitcontact->ace != NULL && hitcontact->avatarLeft != -1) {
+ if (testx >hitcontact->avatarLeft && testx < hitcontact->avatarLeft + cfg::dat.avatarSize) {
+ if (flags)
+ *flags |= CLCHT_ONAVATAR;
+ }
+ }
+ if (testx< dat->leftMargin + indent * dat->groupIndent) {
+ if (flags)
+ *flags |= CLCHT_ONITEMINDENT;
+ return hit;
+ }
+ checkboxWidth = 0;
+ if (style & CLS_CHECKBOXES && hitcontact->type == CLCIT_CONTACT)
+ checkboxWidth = dat->checkboxSize + 2;
+ if (style & CLS_GROUPCHECKBOXES && hitcontact->type == CLCIT_GROUP)
+ checkboxWidth = dat->checkboxSize + 2;
+ if (hitcontact->type == CLCIT_INFO && hitcontact->flags & CLCIIF_CHECKBOX)
+ checkboxWidth = dat->checkboxSize + 2;
+ if (testx< dat->leftMargin + indent * dat->groupIndent + checkboxWidth) {
+ if (flags)
+ *flags |= CLCHT_ONITEMCHECK;
+ return hit;
+ }
+ if (testx< dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace) {
+ if (flags)
+ *flags |= CLCHT_ONITEMICON;
+ return hit;
+ }
+ cxSmIcon = GetSystemMetrics(SM_CXSMICON);
+ for (i = 0; i< dat->extraColumnsCount; i++) {
+ if (hitcontact->iExtraImage[i] == 0xFFFF)
+ continue;
+ if (testx >= clRect.right - dat->extraColumnSpacing * (dat->extraColumnsCount - i) && testx< clRect.right - dat->extraColumnSpacing * (dat->extraColumnsCount - i) + cxSmIcon) {
+ if (flags)
+ *flags |= CLCHT_ONITEMEXTRA | (i << 24);
+ return hit;
+ }
+ }
+ if (hitcontact->extraCacheEntry >= 0 && hitcontact->extraCacheEntry < cfg::nextCacheEntry) {
+ //int rightOffset = clRect.right;
+ int rightOffset = hitcontact->extraIconRightBegin;
+ int images_present = 0;
+
+ for (i = EXTRA_ICON_COUNT; i >= 0; i--) {
+ if (hitcontact->iExtraImage[i] == 0xFFFF)
+ continue;
+ if (!((1 << i) & cfg::eCache[hitcontact->extraCacheEntry].dwXMask))
+ continue;
+ images_present++;
+ if (testx > (rightOffset - (cfg::dat.exIconScale + 2) * images_present) && testx < (rightOffset - (cfg::dat.exIconScale + 2) * images_present + (cfg::dat.exIconScale))) {
+ if (flags)
+ *flags |= (CLCHT_ONITEMEXTRAEX | ((i + 1) << 24));
+ return hit;
+ }
+ }
+ }
+ hdc = GetDC(hwnd);
+ if (hitcontact->type == CLCIT_GROUP)
+ hFont = reinterpret_cast<HFONT>(SelectObject(hdc, dat->fontInfo[FONTID_GROUPS].hFont));
+ else
+ hFont = reinterpret_cast<HFONT>(SelectObject(hdc, dat->fontInfo[FONTID_CONTACTS].hFont));
+ GetTextExtentPoint32(hdc, hitcontact->szText, lstrlen(hitcontact->szText), &textSize);
+ width = textSize.cx;
+ if (hitcontact->type == CLCIT_GROUP) {
+ char *szCounts;
+ szCounts = pcli->pfnGetGroupCountsText(dat, hitcontact);
+ if (szCounts[0]) {
+ GetTextExtentPoint32A(hdc, " ", 1, &textSize);
+ width += textSize.cx;
+ SelectObject(hdc, dat->fontInfo[FONTID_GROUPCOUNTS].hFont);
+ GetTextExtentPoint32A(hdc, szCounts, lstrlenA(szCounts), &textSize);
+ width += textSize.cx;
+ }
+ }
+ SelectObject(hdc, hFont);
+ ReleaseDC(hwnd, hdc);
+ if (cfg::dat.dwFlags & CLUI_FULLROWSELECT && !(GetKeyState(VK_SHIFT) & 0x8000) && testx > dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace + width + 4 + (cfg::dat.dwFlags & CLUI_FRAME_AVATARS ? cfg::dat.avatarSize : 0)) {
+ if (flags)
+ *flags |= CLCHT_ONITEMSPACE;
+ return hit;
+ }
+ if (testx< dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace + width + 4 + (cfg::dat.dwFlags & CLUI_FRAME_AVATARS ? cfg::dat.avatarSize : 0)) {
+ if (flags)
+ *flags |= CLCHT_ONITEMLABEL;
+ return hit;
+ }
+ if (flags)
+ *flags |= CLCHT_NOWHERE;
+ return -1;
}
void ScrollTo(HWND hwnd, struct ClcData *dat, int desty, int noSmooth)
@@ -380,10 +383,10 @@ void ScrollTo(HWND hwnd, struct ClcData *dat, int desty, int noSmooth)
else
InvalidateRect(hwnd, NULL, FALSE);
previousy = dat->yScroll;
- if (cfg::dat.bSkinnedScrollbar && !dat->bisEmbedded)
- CoolSB_SetScrollPos(hwnd, SB_VERT, dat->yScroll, TRUE);
- else
- SetScrollPos(hwnd, SB_VERT, dat->yScroll, TRUE);
+ if (cfg::dat.bSkinnedScrollbar && !dat->bisEmbedded)
+ CoolSB_SetScrollPos(hwnd, SB_VERT, dat->yScroll, TRUE);
+ else
+ SetScrollPos(hwnd, SB_VERT, dat->yScroll, TRUE);
UpdateWindow(hwnd);
}
}
@@ -397,49 +400,49 @@ void ScrollTo(HWND hwnd, struct ClcData *dat, int desty, int noSmooth)
else
InvalidateRect(hwnd, NULL, FALSE);
- if (cfg::dat.bSkinnedScrollbar && !dat->bisEmbedded)
- CoolSB_SetScrollPos(hwnd, SB_VERT, dat->yScroll, TRUE);
- else
- SetScrollPos(hwnd, SB_VERT, dat->yScroll, TRUE);
+ if (cfg::dat.bSkinnedScrollbar && !dat->bisEmbedded)
+ CoolSB_SetScrollPos(hwnd, SB_VERT, dat->yScroll, TRUE);
+ else
+ SetScrollPos(hwnd, SB_VERT, dat->yScroll, TRUE);
dat->forceScroll = 0;
}
void RecalcScrollBar(HWND hwnd, struct ClcData *dat)
{
- SCROLLINFO si = { 0 };
- RECT clRect;
- NMCLISTCONTROL nm;
-
- RowHeight::calcRowHeights(dat, hwnd);
-
- GetClientRect(hwnd, &clRect);
- si.cbSize = sizeof(si);
- si.fMask = SIF_ALL;
- si.nMin = 0;
- si.nMax = pcli->pfnGetRowTotalHeight(dat)-1;
- si.nPage = clRect.bottom;
- si.nPos = dat->yScroll;
-
- if (GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_CONTACTLIST) {
- if (dat->noVScrollbar == 0) {
- if (cfg::dat.bSkinnedScrollbar && !dat->bisEmbedded)
- CoolSB_SetScrollInfo(hwnd, SB_VERT, &si, TRUE);
- else
- SetScrollInfo(hwnd, SB_VERT, &si, TRUE);
- }
- }
- else {
- if (cfg::dat.bSkinnedScrollbar && !dat->bisEmbedded)
- CoolSB_SetScrollInfo(hwnd, SB_VERT, &si, TRUE);
- else
- SetScrollInfo(hwnd, SB_VERT, &si, TRUE);
- }
- ScrollTo(hwnd, dat, dat->yScroll, 1);
- nm.hdr.code = CLN_LISTSIZECHANGE;
- nm.hdr.hwndFrom = hwnd;
- nm.hdr.idFrom = GetDlgCtrlID(hwnd);
- nm.pt.y = si.nMax;
- SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM) & nm);
+ SCROLLINFO si = { 0 };
+ RECT clRect;
+ NMCLISTCONTROL nm;
+
+ RowHeight::calcRowHeights(dat, hwnd);
+
+ GetClientRect(hwnd, &clRect);
+ si.cbSize = sizeof(si);
+ si.fMask = SIF_ALL;
+ si.nMin = 0;
+ si.nMax = pcli->pfnGetRowTotalHeight(dat)-1;
+ si.nPage = clRect.bottom;
+ si.nPos = dat->yScroll;
+
+ if (GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_CONTACTLIST) {
+ if (dat->noVScrollbar == 0) {
+ if (cfg::dat.bSkinnedScrollbar && !dat->bisEmbedded)
+ CoolSB_SetScrollInfo(hwnd, SB_VERT, &si, TRUE);
+ else
+ SetScrollInfo(hwnd, SB_VERT, &si, TRUE);
+ }
+ }
+ else {
+ if (cfg::dat.bSkinnedScrollbar && !dat->bisEmbedded)
+ CoolSB_SetScrollInfo(hwnd, SB_VERT, &si, TRUE);
+ else
+ SetScrollInfo(hwnd, SB_VERT, &si, TRUE);
+ }
+ ScrollTo(hwnd, dat, dat->yScroll, 1);
+ nm.hdr.code = CLN_LISTSIZECHANGE;
+ nm.hdr.hwndFrom = hwnd;
+ nm.hdr.idFrom = GetDlgCtrlID(hwnd);
+ nm.pt.y = si.nMax;
+ SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM) & nm);
//saveRecalcScrollBar(hwnd, dat);
}
@@ -452,15 +455,15 @@ void SetGroupExpand(HWND hwnd,struct ClcData *dat,ClcGroup *group,int newState)
RECT clRect;
NMCLISTCONTROL nm;
- if (newState == -1)
- group->expanded ^= 1;
- else {
- if (group->expanded == (newState != 0))
- return;
- group->expanded = newState != 0;
- }
+ if (newState == -1)
+ group->expanded ^= 1;
+ else {
+ if (group->expanded == (newState != 0))
+ return;
+ group->expanded = newState != 0;
+ }
InvalidateRect(hwnd,NULL,FALSE);
- contentCount = pcli->pfnGetGroupContentsCount(group,1);
+ contentCount = pcli->pfnGetGroupContentsCount(group,1);
groupy=pcli->pfnGetRowsPriorTo(&dat->list,group,-1);
if (dat->selection>groupy && dat->selection<groupy+contentCount) dat->selection=groupy;
@@ -489,12 +492,12 @@ static LRESULT CALLBACK RenameEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPara
switch (msg) {
case WM_KEYDOWN:
switch (wParam) {
- case VK_RETURN:
- pcli->pfnEndRename(GetParent(hwnd), (struct ClcData *) GetWindowLongPtr(GetParent(hwnd), 0), 1);
- return 0;
- case VK_ESCAPE:
- pcli->pfnEndRename(GetParent(hwnd), (struct ClcData *) GetWindowLongPtr(GetParent(hwnd), 0), 0);
- return 0;
+ case VK_RETURN:
+ pcli->pfnEndRename(GetParent(hwnd), (struct ClcData *) GetWindowLongPtr(GetParent(hwnd), 0), 1);
+ return 0;
+ case VK_ESCAPE:
+ pcli->pfnEndRename(GetParent(hwnd), (struct ClcData *) GetWindowLongPtr(GetParent(hwnd), 0), 0);
+ return 0;
}
break;
case WM_GETDLGCODE:
@@ -515,55 +518,55 @@ static LRESULT CALLBACK RenameEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPara
void BeginRenameSelection(HWND hwnd, struct ClcData *dat)
{
- ClcContact *contact;
- ClcGroup *group;
- int indent, x, y, h;
- RECT clRect;
-
- KillTimer(hwnd, TIMERID_RENAME);
- ReleaseCapture();
- dat->iHotTrack = -1;
- dat->selection = pcli->pfnGetRowByIndex(dat, dat->selection, &contact, &group);
- if (dat->selection == -1)
- return;
- if (contact->type != CLCIT_CONTACT && contact->type != CLCIT_GROUP)
- return;
- for (indent = 0; group->parent; indent++,group = group->parent) {
- ;
- }
- GetClientRect(hwnd, &clRect);
- x = indent * dat->groupIndent + dat->iconXSpace - 2;
- //y = dat->selection * dat->rowHeight - dat->yScroll;
- y = RowHeight::getItemTopY(dat, dat->selection)-dat->yScroll;
-
- h=dat->row_heights[dat->selection];
- {
- int i;
- for (i=0; i <= FONTID_LAST; i++)
- if (h<dat->fontInfo[i].fontHeight+2) h=dat->fontInfo[i].fontHeight+2;
- }
+ ClcContact *contact;
+ ClcGroup *group;
+ int indent, x, y, h;
+ RECT clRect;
+
+ KillTimer(hwnd, TIMERID_RENAME);
+ ReleaseCapture();
+ dat->iHotTrack = -1;
+ dat->selection = pcli->pfnGetRowByIndex(dat, dat->selection, &contact, &group);
+ if (dat->selection == -1)
+ return;
+ if (contact->type != CLCIT_CONTACT && contact->type != CLCIT_GROUP)
+ return;
+ for (indent = 0; group->parent; indent++,group = group->parent) {
+ ;
+ }
+ GetClientRect(hwnd, &clRect);
+ x = indent * dat->groupIndent + dat->iconXSpace - 2;
+ //y = dat->selection * dat->rowHeight - dat->yScroll;
+ y = RowHeight::getItemTopY(dat, dat->selection)-dat->yScroll;
+
+ h=dat->row_heights[dat->selection];
+ {
+ int i;
+ for (i=0; i <= FONTID_LAST; i++)
+ if (h<dat->fontInfo[i].fontHeight+2) h=dat->fontInfo[i].fontHeight+2;
+ }
dat->hwndRenameEdit = CreateWindowEx(0, _T("RichEdit20W"),contact->szText,WS_CHILD|WS_BORDER|ES_MULTILINE|ES_AUTOHSCROLL,x,y,clRect.right-x,h,hwnd,NULL,g_hInst,NULL);
- {
- if ((contact->type == CLCIT_CONTACT && cfg::eCache[contact->extraCacheEntry].dwCFlags & ECF_RTLNICK) || (contact->type == CLCIT_GROUP && contact->isRtl)) {
- PARAFORMAT2 pf2;
- ZeroMemory((void *)&pf2, sizeof(pf2));
- pf2.cbSize = sizeof(pf2);
- pf2.dwMask = PFM_RTLPARA;
- pf2.wEffects = PFE_RTLPARA;
- SetWindowText(dat->hwndRenameEdit, _T(""));
- SendMessage(dat->hwndRenameEdit, EM_SETPARAFORMAT, 0, (LPARAM)&pf2);
- SetWindowText(dat->hwndRenameEdit, contact->szText);
- }
- }
-
- //dat->hwndRenameEdit = CreateWindow(_T("EDIT"), contact->szText, WS_CHILD | WS_BORDER | ES_AUTOHSCROLL, x, y, clRect.right - x, dat->rowHeight, hwnd, NULL, g_hInst, NULL);
- OldRenameEditWndProc = (WNDPROC) SetWindowLongPtr(dat->hwndRenameEdit, GWLP_WNDPROC, (LONG_PTR) RenameEditSubclassProc);
- SendMessage(dat->hwndRenameEdit, WM_SETFONT, (WPARAM) (contact->type == CLCIT_GROUP ? dat->fontInfo[FONTID_GROUPS].hFont : dat->fontInfo[FONTID_CONTACTS].hFont), 0);
- SendMessage(dat->hwndRenameEdit, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN | EC_USEFONTINFO, 0);
- SendMessage(dat->hwndRenameEdit, EM_SETSEL, 0, (LPARAM) (-1));
- ShowWindow(dat->hwndRenameEdit, SW_SHOW);
- SetFocus(dat->hwndRenameEdit);
+ {
+ if ((contact->type == CLCIT_CONTACT && cfg::eCache[contact->extraCacheEntry].dwCFlags & ECF_RTLNICK) || (contact->type == CLCIT_GROUP && contact->isRtl)) {
+ PARAFORMAT2 pf2;
+ ZeroMemory((void *)&pf2, sizeof(pf2));
+ pf2.cbSize = sizeof(pf2);
+ pf2.dwMask = PFM_RTLPARA;
+ pf2.wEffects = PFE_RTLPARA;
+ SetWindowText(dat->hwndRenameEdit, _T(""));
+ SendMessage(dat->hwndRenameEdit, EM_SETPARAFORMAT, 0, (LPARAM)&pf2);
+ SetWindowText(dat->hwndRenameEdit, contact->szText);
+ }
+ }
+
+ //dat->hwndRenameEdit = CreateWindow(_T("EDIT"), contact->szText, WS_CHILD | WS_BORDER | ES_AUTOHSCROLL, x, y, clRect.right - x, dat->rowHeight, hwnd, NULL, g_hInst, NULL);
+ OldRenameEditWndProc = (WNDPROC) SetWindowLongPtr(dat->hwndRenameEdit, GWLP_WNDPROC, (LONG_PTR) RenameEditSubclassProc);
+ SendMessage(dat->hwndRenameEdit, WM_SETFONT, (WPARAM) (contact->type == CLCIT_GROUP ? dat->fontInfo[FONTID_GROUPS].hFont : dat->fontInfo[FONTID_CONTACTS].hFont), 0);
+ SendMessage(dat->hwndRenameEdit, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN | EC_USEFONTINFO, 0);
+ SendMessage(dat->hwndRenameEdit, EM_SETSEL, 0, (LPARAM) (-1));
+ ShowWindow(dat->hwndRenameEdit, SW_SHOW);
+ SetFocus(dat->hwndRenameEdit);
}
extern void ( *saveLoadClcOptions )(HWND hwnd,struct ClcData *dat);
@@ -579,7 +582,7 @@ void LoadClcOptions(HWND hwnd, struct ClcData *dat)
dat->row_border = 0;
dat->rightMargin = cfg::getByte("CLC", "RightMargin", CLCDEFAULT_LEFTMARGIN);
dat->bkColour = cfg::getByte("CLC", "UseWinColours", CLCDEFAULT_USEWINDOWSCOLOURS) ?
- GetSysColor(COLOR_3DFACE) : cfg::getDword("CLC", "BkColour", CLCDEFAULT_BKCOLOUR);
+ GetSysColor(COLOR_3DFACE) : cfg::getDword("CLC", "BkColour", CLCDEFAULT_BKCOLOUR);
if (!dat->bkChanged) {
if (cfg::dat.hBrushCLCBk)
DeleteObject(cfg::dat.hBrushCLCBk);
@@ -590,7 +593,7 @@ void LoadClcOptions(HWND hwnd, struct ClcData *dat)
DeleteDC(cfg::dat.hdcPic);
cfg::dat.hdcPic = 0;
cfg::dat.hbmPicOld = 0;
- } }
+ } }
cfg::dat.bmpBackground = dat->hBmpBackground;
if (cfg::dat.bmpBackground) {
diff --git a/plugins/Clist_nicer/src/clistmod.cpp b/plugins/Clist_nicer/src/clistmod.cpp
index 305d4aece1..2092413e71 100644
--- a/plugins/Clist_nicer/src/clistmod.cpp
+++ b/plugins/Clist_nicer/src/clistmod.cpp
@@ -111,7 +111,7 @@ static INT_PTR GetCaps(WPARAM wParam, LPARAM)
case CLUICAPS_FLAGS1:
return CLUIF_HIDEEMPTYGROUPS | CLUIF_DISABLEGROUPS | CLUIF_HASONTOPOPTION | CLUIF_HASAUTOHIDEOPTION;
case CLUICAPS_FLAGS2:
- return MAKELONG(MAXEXTRACOLUMNS,1);
+ return MAKELONG(EXTRA_ICON_COUNT,1);
}
return 0;
}
diff --git a/plugins/Clist_nicer/src/clui.cpp b/plugins/Clist_nicer/src/clui.cpp
index 98f34ad1a4..12fa50628d 100644
--- a/plugins/Clist_nicer/src/clui.cpp
+++ b/plugins/Clist_nicer/src/clui.cpp
@@ -68,8 +68,6 @@ extern ButtonItem *g_ButtonItems;
extern COLORREF g_CLUISkinnedBkColorRGB;
extern wndFrame *wndFrameCLC;
-HIMAGELIST himlExtraImages = 0;
-
static BYTE old_cliststate, show_on_first_autosize = FALSE;
RECT cluiPos;
@@ -82,7 +80,6 @@ extern HANDLE hNotifyFrame;
int SortList(WPARAM wParam, LPARAM lParam);
int LoadCluiServices(void);
void InitGroupMenus();
-void ReloadExtraIcons();
void FS_RegisterFonts();
void LoadExtraIconModule();
int MTG_OnmodulesLoad(WPARAM wParam, LPARAM lParam);
@@ -202,7 +199,7 @@ static HWND PreCreateCLC(HWND parent)
static int CreateCLC(HWND parent)
{
- ReloadExtraIcons();
+ pcli->pfnReloadExtraIcons();
CallService(MS_CLIST_SETHIDEOFFLINE, (WPARAM)oldhideoffline, 0);
disableautoupd = 0;
@@ -270,39 +267,31 @@ static HICON hIconSaved = 0;
void ClearIcons(int mode)
{
- int i;
-
- for (i = IDI_OVL_OFFLINE; i <= IDI_OVL_OUTTOLUNCH; i++) {
+ for (int i = IDI_OVL_OFFLINE; i <= IDI_OVL_OUTTOLUNCH; i++) {
if (overlayicons[i - IDI_OVL_OFFLINE] != 0) {
if (mode)
DestroyIcon(overlayicons[i - IDI_OVL_OFFLINE]);
overlayicons[i - IDI_OVL_OFFLINE] = 0;
}
}
- hIconSaved = ImageList_GetIcon(himlExtraImages, 3, ILD_NORMAL);
- ImageList_RemoveAll(himlExtraImages);
}
static void CacheClientIcons()
{
- int i = 0;
- char szBuffer[128];
-
ClearIcons(0);
- for (i = IDI_OVL_OFFLINE; i <= IDI_OVL_OUTTOLUNCH; i++) {
+ for (int i = IDI_OVL_OFFLINE; i <= IDI_OVL_OUTTOLUNCH; i++) {
+ char szBuffer[128];
mir_snprintf(szBuffer, sizeof(szBuffer), "cln_ovl_%d", ID_STATUS_OFFLINE + (i - IDI_OVL_OFFLINE));
overlayicons[i - IDI_OVL_OFFLINE] = Skin_GetIcon(szBuffer);
}
+
+ /* !!!!!!!!!!!!!!!!!!!!!!
ImageList_AddIcon(himlExtraImages, Skin_GetIcon("core_main_14"));
ImageList_AddIcon(himlExtraImages, (HICON)LoadSkinnedIcon(SKINICON_EVENT_URL));
ImageList_AddIcon(himlExtraImages, Skin_GetIcon("core_main_17"));
- if (hIconSaved != 0) {
- ImageList_AddIcon(himlExtraImages, hIconSaved);
- DestroyIcon(hIconSaved);
- hIconSaved = 0;
- } else
- ImageList_AddIcon(himlExtraImages, Skin_GetIcon("core_main_17"));
+ ImageList_AddIcon(himlExtraImages, Skin_GetIcon("core_main_17"));
+ */
}
static void InitIcoLib()
@@ -437,7 +426,7 @@ void IcoLibReloadIcons()
cfg::dat.hIconInvisible = Skin_GetIcon("CLN_invisible");
cfg::dat.hIconChatactive = Skin_GetIcon("CLN_chatactive");
CacheClientIcons();
- ReloadExtraIcons();
+ pcli->pfnReloadExtraIcons();
// force client icons reload
{
diff --git a/plugins/Clist_nicer/src/cluiservices.cpp b/plugins/Clist_nicer/src/cluiservices.cpp
index 093f950bbb..f4b8b29e7d 100644
--- a/plugins/Clist_nicer/src/cluiservices.cpp
+++ b/plugins/Clist_nicer/src/cluiservices.cpp
@@ -27,7 +27,7 @@ UNICODE done
#include "../cluiframes/cluiframes.h"
#include <m_icq.h>
-extern HIMAGELIST hCListImages, himlExtraImages;;
+extern HIMAGELIST hCListImages;
extern ButtonItem *g_ButtonItems;
extern PLUGININFOEX pluginInfo;
diff --git a/plugins/Clist_nicer/src/config.cpp b/plugins/Clist_nicer/src/config.cpp
index 8ed431ad40..676c145c9e 100644
--- a/plugins/Clist_nicer/src/config.cpp
+++ b/plugins/Clist_nicer/src/config.cpp
@@ -220,8 +220,6 @@ int cfg::getCache(const HANDLE hContact, const char *szProto)
}
memset(&cfg::eCache[nextCacheEntry], 0, sizeof(TExtraCache));
cfg::eCache[nextCacheEntry].hContact = hContact;
- memset(cfg::eCache[nextCacheEntry].iExtraImage, 0xffff, MAXEXTRACOLUMNS);
- cfg::eCache[nextCacheEntry].iExtraValid = 0;
cfg::eCache[nextCacheEntry].valid = FALSE;
cfg::eCache[nextCacheEntry].bStatusMsgValid = 0;
cfg::eCache[nextCacheEntry].statusMsg = NULL;
diff --git a/plugins/Clist_nicer/src/extBackg.cpp b/plugins/Clist_nicer/src/extBackg.cpp
index 42767f9ad6..0a7a7cefc5 100644
--- a/plugins/Clist_nicer/src/extBackg.cpp
+++ b/plugins/Clist_nicer/src/extBackg.cpp
@@ -27,7 +27,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
extern int g_hottrack;
extern HWND g_hwndViewModeFrame;
-extern HIMAGELIST himlExtraImages;
StatusItems_t *StatusItems = NULL;
ImageItem *g_ImageItems = NULL, *g_glyphItem = NULL;
@@ -40,7 +39,6 @@ int ID_EXTBK_LAST = ID_EXTBK_LAST_D;
//void SetTBSKinned(int mode);
void ReloadThemedOptions();
-void ReloadExtraIcons();
static void SaveCompleteStructToDB(void);
static StatusItems_t _StatusItems[] = {
@@ -1503,7 +1501,6 @@ void extbk_import(char *file, HWND hwndDlg)
SendMessage(pcli->hwndContactList, WM_SIZE, 0, 0);
RedrawWindow(pcli->hwndContactList,NULL,NULL,RDW_INVALIDATE|RDW_ERASE|RDW_FRAME|RDW_UPDATENOW|RDW_ALLCHILDREN);
if (oldexIconScale != cfg::dat.exIconScale) {
- ImageList_SetIconSize(himlExtraImages, cfg::dat.exIconScale, cfg::dat.exIconScale);
IcoLibReloadIcons();
pcli->pfnClcBroadcast(CLM_AUTOREBUILD, 0, 0);
}
@@ -1849,7 +1846,7 @@ int CoolSB_SetupScrollBar()
UninitializeCoolSB(pcli->hwndContactTree);
return 0;
}
-
+
if (cfg::dat.bSkinnedScrollbar) {
InitializeCoolSB(pcli->hwndContactTree);
CoolSB_SetStyle(pcli->hwndContactTree, SB_VERT, CSBS_HOTTRACKED);
diff --git a/plugins/Clist_nicer/src/init.cpp b/plugins/Clist_nicer/src/init.cpp
index 2016cceccc..8837513e72 100644
--- a/plugins/Clist_nicer/src/init.cpp
+++ b/plugins/Clist_nicer/src/init.cpp
@@ -46,7 +46,6 @@ extern int Docking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam);
extern int SetHideOffline(WPARAM wParam, LPARAM lParam);
extern DWORD g_gdiplusToken;
-extern HIMAGELIST himlExtraImages;
TIME_API tmi;
@@ -212,11 +211,6 @@ static int fnIconFromStatusMode( const char* szProto, int status, HANDLE hContac
extern "C" int __declspec(dllexport) CListInitialise()
{
- int rc = 0;
- DBVARIANT dbv;
- int i;
- char szProfilePath[MAX_PATH];
-
mir_getTMI(&tmi);
mir_getLP( &pluginInfo );
@@ -278,52 +272,22 @@ extern "C" int __declspec(dllexport) CListInitialise()
if (cfg::dat.bFirstRun)
cfg::writeByte("CLUI", "firstrun", 0);
- if (!cfg::getString(NULL, "CLUI", "exIconOrder", &dbv)) {
- if (lstrlenA(dbv.pszVal) < EXICON_COUNT) {
- for (i = 1; i <= EXICON_COUNT; i++)
- cfg::dat.exIconOrder[i - 1] = i;
- } else {
- for (i = 0; i < EXICON_COUNT; i++)
- if (dbv.pszVal[i] < EXICON_COUNT+1 && dbv.pszVal[i] >0)
- cfg::dat.exIconOrder[i] = dbv.pszVal[i];
- else
- cfg::dat.exIconOrder[i] = i+1;
- }
- DBFreeVariant(&dbv);
- } else {
- for (i = 1; i <= EXICON_COUNT; i++)
- cfg::dat.exIconOrder[i - 1] = i;
- }
ReloadThemedOptions();
FLT_ReadOptions();
Reload3dBevelColors();
- himlExtraImages = ImageList_Create(16, 16, ILC_MASK | (IsWinVerXPPlus() ? ILC_COLOR32 : ILC_COLOR16), 30, 2);
- ImageList_SetIconSize(himlExtraImages, cfg::dat.exIconScale, cfg::dat.exIconScale);
cfg::dat.dwFlags = cfg::getDword("CLUI", "Frameflags", CLUI_FRAME_STATUSICONS | CLUI_FRAME_SHOWBOTTOMBUTTONS |
CLUI_FRAME_BUTTONSFLAT | CLUI_FRAME_CLISTSUNKEN);
cfg::dat.dwFlags |= (cfg::getByte("CLUI", "ShowSBar", 1) ? CLUI_FRAME_SBARSHOW : 0);
cfg::dat.soundsOff = cfg::getByte("CLUI", "NoSounds", 0);
- CallService(MS_DB_GETPROFILEPATH, MAX_PATH, (LPARAM)szProfilePath);
-
- MultiByteToWideChar(CP_ACP, 0, szProfilePath, MAX_PATH, cfg::dat.tszProfilePath, MAX_PATH);
- cfg::dat.tszProfilePath[MAX_PATH - 1] = 0;
-
+ CallService(MS_DB_GETPROFILEPATHT, MAX_PATH, (LPARAM)cfg::dat.tszProfilePath);
_tcslwr(cfg::dat.tszProfilePath);
PreloadContactListModule();
// get the clist interface
pcli = ( CLIST_INTERFACE* )CallService(MS_CLIST_RETRIEVE_INTERFACE, 0, (LPARAM)g_hInst);
- if ( (INT_PTR)pcli == CALLSERVICE_NOTFOUND ) {
-LBL_Error:
- MessageBoxA( NULL, "This plugin requires Miranda IM 0.8.0.9 or later", "Fatal error", MB_OK );
- return 1;
- }
- if ( pcli->version < 6 ) // don't join it with the previous if ()
- goto LBL_Error;
-
pcli->pfnBuildGroupPopupMenu = BuildGroupPopupMenu;
pcli->pfnCluiProtocolStatusChanged = CluiProtocolStatusChanged;
pcli->pfnCompareContacts = CompareContacts;
@@ -363,7 +327,7 @@ LBL_Error:
saveRecalcScrollBar = pcli->pfnRecalcScrollBar; pcli->pfnRecalcScrollBar = RecalcScrollBar;
saveTrayIconProcessMessage = pcli->pfnTrayIconProcessMessage; pcli->pfnTrayIconProcessMessage = TrayIconProcessMessage;
- rc = LoadContactListModule();
+ int rc = LoadContactListModule();
if (rc == 0)
rc = LoadCLCModule();
LoadCLUIModule();
@@ -382,7 +346,6 @@ extern "C" int __declspec(dllexport) Unload(void)
{
if (IsWindow(pcli->hwndContactList))
DestroyWindow(pcli->hwndContactList);
- ImageList_Destroy(himlExtraImages);
ClcShutdown(0, 0);
UnLoadCLUIFramesModule();
return 0;