summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-11-05 17:35:20 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-11-05 17:35:20 +0000
commit245bfdb197e844f272b2cc42ded21a49d6aed779 (patch)
tree3fe5595c1b69d0fa96fc0f1e9715596cc45ca00c
parentd6edd541b10926aee0e9442d6577bf8213e0f757 (diff)
fix for the rest of extra icons in nicer+
git-svn-id: http://svn.miranda-ng.org/main/trunk@2209 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp1
-rw-r--r--plugins/Clist_nicer/src/Include/clc.h1
-rw-r--r--plugins/Clist_nicer/src/clc.cpp3
-rw-r--r--plugins/Clist_nicer/src/clcitems.cpp220
-rw-r--r--plugins/Clist_nicer/src/clui.cpp41
-rw-r--r--plugins/Clist_nicer/src/viewmodes.cpp1400
6 files changed, 776 insertions, 890 deletions
diff --git a/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp b/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp
index d1e36fca10..1462f5114d 100644
--- a/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp
+++ b/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp
@@ -34,7 +34,6 @@ extern int mf_updatethread_running;
extern DWORD WINAPI MF_UpdateThread(LPVOID p);
extern HANDLE hThreadMFUpdate;;
-HANDLE hExtraImageListRebuilding, hExtraImageApplying;
HANDLE hStatusBarShowToolTipEvent, hStatusBarHideToolTipEvent;
HANDLE g_hEventThread = 0;
diff --git a/plugins/Clist_nicer/src/Include/clc.h b/plugins/Clist_nicer/src/Include/clc.h
index d4c69bcb4f..4195b6c8b7 100644
--- a/plugins/Clist_nicer/src/Include/clc.h
+++ b/plugins/Clist_nicer/src/Include/clc.h
@@ -417,7 +417,6 @@ HANDLE ContactToItemHandle(ClcContact *contact, DWORD *nmFlags);
//clcitems.c
void RebuildEntireList(HWND hwnd, struct ClcData *dat);
-void SaveStateAndRebuildList(HWND hwnd, struct ClcData *dat);
DWORD INTSORT_GetLastMsgTime(HANDLE hContact);
//clcmsgs.c
diff --git a/plugins/Clist_nicer/src/clc.cpp b/plugins/Clist_nicer/src/clc.cpp
index e3163f5aaf..88b37628ad 100644
--- a/plugins/Clist_nicer/src/clc.cpp
+++ b/plugins/Clist_nicer/src/clc.cpp
@@ -39,7 +39,6 @@
int DefaultImageListColorDepth = ILC_COLOR32;
extern HPEN g_hPenCLUIFrames;
-extern HANDLE hExtraImageApplying;
extern wndFrame *wndFrameCLC;
extern ButtonItem *g_ButtonItems;
@@ -163,8 +162,6 @@ static int ClcSettingChanged(WPARAM wParam, LPARAM lParam)
SendMessage(pcli->hwndContactTree, INTM_XSTATUSCHANGED, wParam, lParam);
else if (!__strcmp(cws->szSetting, "Timezone") || !__strcmp(cws->szSetting, "TzName"))
ReloadExtraInfo((HANDLE)wParam);
- else if (!__strcmp(cws->szSetting, "MirVer"))
- NotifyEventHooks(hExtraImageApplying, wParam, 0);
if (cfg::dat.bMetaAvail && !(cfg::dat.dwFlags & CLUI_USEMETAICONS) && !__strcmp(szProto, cfg::dat.szMetaName)) {
if ((lstrlenA(cws->szSetting) > 6 && !strncmp(cws->szSetting, "Status", 6)) || strstr("Default,ForceSend,Nick", cws->szSetting))
diff --git a/plugins/Clist_nicer/src/clcitems.cpp b/plugins/Clist_nicer/src/clcitems.cpp
index 3705104501..daa2c859f0 100644
--- a/plugins/Clist_nicer/src/clcitems.cpp
+++ b/plugins/Clist_nicer/src/clcitems.cpp
@@ -33,8 +33,6 @@
#include <commonheaders.h>
#include <m_icq.h>
-extern HANDLE hExtraImageListRebuilding, hExtraImageApplying;
-
extern int ( *saveAddContactToGroup )(struct ClcData *dat, ClcGroup *group, HANDLE hContact);
extern int ( *saveAddInfoItemToGroup )(ClcGroup *group, int flags, const TCHAR *pszText);
extern ClcGroup* ( *saveRemoveItemFromGroup )(HWND hwnd, ClcGroup *group, ClcContact *contact, int updateTotalCount);
@@ -75,47 +73,45 @@ int AddInfoItemToGroup(ClcGroup *group, int flags, const TCHAR *pszText)
ClcGroup *AddGroup(HWND hwnd, struct ClcData *dat, const TCHAR *szName, DWORD flags, int groupId, int calcTotalMembers)
{
ClcGroup *p = saveAddGroup( hwnd, dat, szName, flags, groupId, calcTotalMembers);
+ if ( p && p->parent )
+ RTL_DetectGroupName( p->parent->cl.items[ p->parent->cl.count-1] );
-
- if ( p && p->parent )
- RTL_DetectGroupName( p->parent->cl.items[ p->parent->cl.count-1] );
-
return p;
}
ClcGroup *RemoveItemFromGroup(HWND hwnd, ClcGroup *group, ClcContact *contact, int updateTotalCount)
{
- if (contact->extraCacheEntry >= 0 && contact->extraCacheEntry < cfg::nextCacheEntry) {
+ 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;
-
- if (p->extraCacheEntry >= 0 && p->extraCacheEntry < cfg::nextCacheEntry)
- dwFlags = cfg::eCache[p->extraCacheEntry].dwDFlags;
- else
- dwFlags = cfg::getDword(p->hContact, "CList", "CLN_Flags", 0);
-
- if (cfg::dat.dwFlags & CLUI_FRAME_AVATARS)
- p->cFlags = (dwFlags & ECF_HIDEAVATAR ? p->cFlags & ~ECF_AVATAR : p->cFlags | ECF_AVATAR);
- else
- p->cFlags = (dwFlags & ECF_FORCEAVATAR ? p->cFlags | ECF_AVATAR : p->cFlags & ~ECF_AVATAR);
-
- p->ace = NULL;
- if (cfg::dat.bAvatarServiceAvail && (p->cFlags & ECF_AVATAR) && (!cfg::dat.bNoOfflineAvatars || p->wStatus != ID_STATUS_OFFLINE)) {
- p->ace = (struct avatarCacheEntry *)CallService(MS_AV_GETAVATARBITMAP, (WPARAM)p->hContact, 0);
- if (p->ace != NULL && p->ace->cbSize != sizeof(struct avatarCacheEntry))
- p->ace = NULL;
- if (p->ace != NULL)
- p->ace->t_lastAccess = cfg::dat.t_now;
- }
- if (p->ace == NULL)
- p->cFlags &= ~ECF_AVATAR;
+ DWORD dwFlags;
+
+ if (p->extraCacheEntry >= 0 && p->extraCacheEntry < cfg::nextCacheEntry)
+ dwFlags = cfg::eCache[p->extraCacheEntry].dwDFlags;
+ else
+ dwFlags = cfg::getDword(p->hContact, "CList", "CLN_Flags", 0);
+
+ if (cfg::dat.dwFlags & CLUI_FRAME_AVATARS)
+ p->cFlags = (dwFlags & ECF_HIDEAVATAR ? p->cFlags & ~ECF_AVATAR : p->cFlags | ECF_AVATAR);
+ else
+ p->cFlags = (dwFlags & ECF_FORCEAVATAR ? p->cFlags | ECF_AVATAR : p->cFlags & ~ECF_AVATAR);
+
+ p->ace = NULL;
+ if (cfg::dat.bAvatarServiceAvail && (p->cFlags & ECF_AVATAR) && (!cfg::dat.bNoOfflineAvatars || p->wStatus != ID_STATUS_OFFLINE)) {
+ p->ace = (struct avatarCacheEntry *)CallService(MS_AV_GETAVATARBITMAP, (WPARAM)p->hContact, 0);
+ if (p->ace != NULL && p->ace->cbSize != sizeof(struct avatarCacheEntry))
+ p->ace = NULL;
+ if (p->ace != NULL)
+ p->ace->t_lastAccess = cfg::dat.t_now;
+ }
+ if (p->ace == NULL)
+ p->cFlags &= ~ECF_AVATAR;
}
int AddContactToGroup(struct ClcData *dat, ClcGroup *group, HANDLE hContact)
@@ -125,7 +121,6 @@ int AddContactToGroup(struct ClcData *dat, ClcGroup *group, HANDLE hContact)
p->wStatus = cfg::getWord(hContact, p->proto, "Status", ID_STATUS_OFFLINE);
p->xStatus = cfg::getByte(hContact, p->proto, "XStatusId", 0);
- //p->iRowHeight = -1;
if (p->proto)
p->bIsMeta = !strcmp(p->proto, cfg::dat.szMetaName);
@@ -135,13 +130,14 @@ int AddContactToGroup(struct ClcData *dat, ClcGroup *group, HANDLE hContact)
p->hSubContact = (HANDLE) CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM) hContact, 0);
p->metaProto = (char*) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) p->hSubContact, 0);
p->iImage = CallService(MS_CLIST_GETCONTACTICON, (WPARAM) p->hSubContact, 0);
- } else {
+ }
+ else {
p->iImage = CallService(MS_CLIST_GETCONTACTICON, (WPARAM) hContact, 0);
p->metaProto = NULL;
}
p->codePage = cfg::getDword(hContact, "Tab_SRMsg", "ANSIcodepage", cfg::getDword(hContact, "UserInfo", "ANSIcodepage", CP_ACP));
- p->bSecondLine = cfg::getByte(hContact, "CList", "CLN_2ndline", cfg::dat.dualRowMode);
+ p->bSecondLine = cfg::getByte(hContact, "CList", "CLN_2ndline", cfg::dat.dualRowMode);
if (dat->bisEmbedded)
p->extraCacheEntry = -1;
@@ -159,9 +155,9 @@ int AddContactToGroup(struct ClcData *dat, ClcGroup *group, HANDLE hContact)
}
}
}
- LoadAvatarForContact(p);
- // notify other plugins to re-supply their extra images (icq for xstatus, mBirthday etc...)
- NotifyEventHooks(hExtraImageApplying, (WPARAM)hContact, 0);
+ LoadAvatarForContact(p);
+ // notify other plugins to re-supply their extra images (icq for xstatus, mBirthday etc...)
+ pcli->pfnSetAllExtraIcons(pcli->hwndContactTree, hContact);
}
RTL_DetectAndSet( p, p->hContact);
@@ -174,9 +170,7 @@ int AddContactToGroup(struct ClcData *dat, ClcGroup *group, HANDLE hContact)
void RebuildEntireList(HWND hwnd, struct ClcData *dat)
{
- char *szProto;
DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE);
- HANDLE hContact;
ClcGroup *group;
DBVARIANT dbv = {0};
@@ -188,20 +182,18 @@ void RebuildEntireList(HWND hwnd, struct ClcData *dat)
dat->list.cl.count = 0;
dat->list.totalMembers = 0;
dat->selection = -1;
- dat->SelectMode = cfg::getByte("CLC", "SelectMode", 0); {
- int i;
- TCHAR *szGroupName;
- DWORD groupFlags;
-
- for (i = 1; ; i++) {
- szGroupName = pcli->pfnGetGroupName(i, &groupFlags);
+ dat->SelectMode = cfg::getByte("CLC", "SelectMode", 0);
+ {
+ for (int i = 1; ; i++) {
+ DWORD groupFlags;
+ TCHAR *szGroupName = pcli->pfnGetGroupName(i, &groupFlags);
if (szGroupName == NULL)
break;
pcli->pfnAddGroup(hwnd, dat, szGroupName, groupFlags, i, 0);
}
}
- hContact = db_find_first();
+ HANDLE hContact = db_find_first();
while (hContact) {
if (style & CLS_SHOWHIDDEN || !CLVM_GetContactHiddenStatus(hContact, NULL, dat)) {
ZeroMemory((void *)&dbv, sizeof(dbv));
@@ -215,14 +207,15 @@ void RebuildEntireList(HWND hwnd, struct ClcData *dat)
if (group != NULL) {
group->totalMembers++;
if (!(style & CLS_NOHIDEOFFLINE) && (style & CLS_HIDEOFFLINE || group->hideOffline)) {
- szProto = (char*) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
+ char *szProto = (char*) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
if (szProto == NULL) {
if (!pcli->pfnIsHiddenMode(dat, ID_STATUS_OFFLINE))
AddContactToGroup(dat, group, hContact);
- } else if (!pcli->pfnIsHiddenMode(dat, (WORD) cfg::getWord(hContact, szProto, "Status", ID_STATUS_OFFLINE)))
+ }
+ else if (!pcli->pfnIsHiddenMode(dat, (WORD) cfg::getWord(hContact, szProto, "Status", ID_STATUS_OFFLINE)))
AddContactToGroup(dat, group, hContact);
- } else
- AddContactToGroup(dat, group, hContact);
+ }
+ else AddContactToGroup(dat, group, hContact);
}
}
hContact = db_find_next(hContact);
@@ -236,10 +229,11 @@ void RebuildEntireList(HWND hwnd, struct ClcData *dat)
group = group->parent;
if (group == NULL)
break;
- } else if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP) {
- if (group->cl.items[group->scanIndex]->group->cl.count == 0) {
+ }
+ else if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP) {
+ if (group->cl.items[group->scanIndex]->group->cl.count == 0)
group = pcli->pfnRemoveItemFromGroup(hwnd, group, group->cl.items[group->scanIndex], 0);
- } else {
+ else {
group = group->cl.items[group->scanIndex]->group;
group->scanIndex = 0;
}
@@ -248,7 +242,10 @@ void RebuildEntireList(HWND hwnd, struct ClcData *dat)
group->scanIndex++;
}
}
+
pcli->pfnSortCLC(hwnd, dat, 0);
+ pcli->pfnSetAllExtraIcons(pcli->hwndContactTree, 0);
+
if (!dat->bisEmbedded)
FLT_SyncWithClist();
}
@@ -261,19 +258,16 @@ void RebuildEntireList(HWND hwnd, struct ClcData *dat)
BYTE GetCachedStatusMsg(int iExtraCacheEntry, char *szProto)
{
DBVARIANT dbv = {0};
- HANDLE hContact;
- struct TExtraCache *cEntry;
- int result;
if (iExtraCacheEntry < 0 || iExtraCacheEntry > cfg::nextCacheEntry)
return 0;
- cEntry = &cfg::eCache[iExtraCacheEntry];
+ TExtraCache *cEntry = &cfg::eCache[iExtraCacheEntry];
cEntry->bStatusMsgValid = STATUSMSG_NOTFOUND;
- hContact = cEntry->hContact;
+ HANDLE hContact = cEntry->hContact;
- result = cfg::getTString(hContact, "CList", "StatusMsg", &dbv);
+ int result = cfg::getTString(hContact, "CList", "StatusMsg", &dbv);
if ( !result && lstrlen(dbv.ptszVal) > 1)
cEntry->bStatusMsgValid = STATUSMSG_CLIST;
else {
@@ -288,9 +282,10 @@ BYTE GetCachedStatusMsg(int iExtraCacheEntry, char *szProto)
cEntry->bStatusMsgValid = STATUSMSG_GG;
else if ( !(result = cfg::getTString(hContact, szProto, "XStatusMsg", &dbv)) && lstrlen(dbv.ptszVal) > 1)
cEntry->bStatusMsgValid = STATUSMSG_XSTATUS;
- } }
+ }
+ }
- if (cEntry->bStatusMsgValid == STATUSMSG_NOTFOUND) { // no status msg, consider xstatus name (if available)
+ if (cEntry->bStatusMsgValid == STATUSMSG_NOTFOUND) { // no status msg, consider xstatus name (if available)
if ( !result )
DBFreeVariant( &dbv );
result = cfg::getTString(hContact, szProto, "XStatusName", &dbv);
@@ -301,7 +296,6 @@ BYTE GetCachedStatusMsg(int iExtraCacheEntry, char *szProto)
_tcsncpy(cEntry->statusMsg, dbv.ptszVal, iLen + 1);
}
else {
- ICQ_CUSTOM_STATUS cst = {0};
int xStatus;
WPARAM xStatus2;
TCHAR xStatusName[128];
@@ -309,6 +303,7 @@ BYTE GetCachedStatusMsg(int iExtraCacheEntry, char *szProto)
mir_snprintf(szServiceName, 128, "%s%s", szProto, PS_ICQ_GETCUSTOMSTATUSEX);
+ ICQ_CUSTOM_STATUS cst = {0};
cst.cbSize = sizeof(ICQ_CUSTOM_STATUS);
cst.flags = CSSF_MASK_STATUS;
cst.status = &xStatus;
@@ -325,6 +320,7 @@ BYTE GetCachedStatusMsg(int iExtraCacheEntry, char *szProto)
}
}
}
+
if (cEntry->bStatusMsgValid > STATUSMSG_XSTATUSNAME) {
int j = 0, i;
cEntry->statusMsg = (TCHAR *)realloc(cEntry->statusMsg, (lstrlen(dbv.ptszVal) + 2) * sizeof(TCHAR));
@@ -339,16 +335,13 @@ BYTE GetCachedStatusMsg(int iExtraCacheEntry, char *szProto)
if ( !result )
DBFreeVariant( &dbv );
-
if (cEntry->bStatusMsgValid != STATUSMSG_NOTFOUND) {
WORD infoTypeC2[12];
- int iLen, i
- ;
ZeroMemory(infoTypeC2, sizeof(WORD) * 12);
- iLen = min(lstrlenW(cEntry->statusMsg), 10);
+ int iLen = min(lstrlenW(cEntry->statusMsg), 10);
GetStringTypeW(CT_CTYPE2, cEntry->statusMsg, iLen, infoTypeC2);
cEntry->dwCFlags &= ~ECF_RTLSTATUSMSG;
- for (i = 0; i < 10; i++) {
+ for (int i = 0; i < 10; i++) {
if (infoTypeC2[i] == C2_RIGHTTOLEFT) {
cEntry->dwCFlags |= ECF_RTLSTATUSMSG;
break;
@@ -397,52 +390,52 @@ void ReloadExtraInfo(HANDLE hContact)
void RTL_DetectAndSet(ClcContact *contact, HANDLE hContact)
{
- WORD infoTypeC2[12];
- int i, index;
- TCHAR *szText = NULL;
- DWORD iLen;
-
- ZeroMemory(infoTypeC2, sizeof(WORD) * 12);
-
- if (contact == NULL) {
- szText = pcli->pfnGetContactDisplayName(hContact, 0);
- index = cfg::getCache(hContact, NULL);
- }
- else {
- szText = contact->szText;
- index = contact->extraCacheEntry;
- }
- if (index >= 0 && index < cfg::nextCacheEntry) {
- iLen = min(lstrlenW(szText), 10);
- GetStringTypeW(CT_CTYPE2, szText, iLen, infoTypeC2);
- cfg::eCache[index].dwCFlags &= ~ECF_RTLNICK;
- for (i = 0; i < 10; i++) {
- if (infoTypeC2[i] == C2_RIGHTTOLEFT) {
- cfg::eCache[index].dwCFlags |= ECF_RTLNICK;
- return;
- }
- }
- }
+ WORD infoTypeC2[12];
+ int i, index;
+ TCHAR *szText = NULL;
+ DWORD iLen;
+
+ ZeroMemory(infoTypeC2, sizeof(WORD) * 12);
+
+ if (contact == NULL) {
+ szText = pcli->pfnGetContactDisplayName(hContact, 0);
+ index = cfg::getCache(hContact, NULL);
+ }
+ else {
+ szText = contact->szText;
+ index = contact->extraCacheEntry;
+ }
+ if (index >= 0 && index < cfg::nextCacheEntry) {
+ iLen = min(lstrlenW(szText), 10);
+ GetStringTypeW(CT_CTYPE2, szText, iLen, infoTypeC2);
+ cfg::eCache[index].dwCFlags &= ~ECF_RTLNICK;
+ for (i = 0; i < 10; i++) {
+ if (infoTypeC2[i] == C2_RIGHTTOLEFT) {
+ cfg::eCache[index].dwCFlags |= ECF_RTLNICK;
+ return;
+ }
+ }
+ }
}
void RTL_DetectGroupName(ClcContact *group)
{
- WORD infoTypeC2[12];
- int i;
- DWORD iLen;
-
- group->isRtl = 0;
-
- if (group->szText) {
- iLen = min(lstrlenW(group->szText), 10);
- GetStringTypeW(CT_CTYPE2, group->szText, iLen, infoTypeC2);
- for (i = 0; i < 10; i++) {
- if (infoTypeC2[i] == C2_RIGHTTOLEFT) {
- group->isRtl = 1;
- return;
- }
- }
- }
+ WORD infoTypeC2[12];
+ int i;
+ DWORD iLen;
+
+ group->isRtl = 0;
+
+ if (group->szText) {
+ iLen = min(lstrlenW(group->szText), 10);
+ GetStringTypeW(CT_CTYPE2, group->szText, iLen, infoTypeC2);
+ for (i = 0; i < 10; i++) {
+ if (infoTypeC2[i] == C2_RIGHTTOLEFT) {
+ group->isRtl = 1;
+ return;
+ }
+ }
+ }
}
/*
@@ -460,12 +453,7 @@ void GetExtendedInfo(ClcContact *contact, struct ClcData *dat)
int index = contact->extraCacheEntry;
- //firstTime = DBGetContactSettingDword(contact->hContact, "CList", "mf_firstEvent", 0);
- //count = DBGetContactSettingDword(contact->hContact, "CList", "mf_count", 0);
- //new_freq = count ? (g_CluiData.t_now - firstTime) / count : 0x7fffffff;
cfg::eCache[index].msgFrequency = cfg::getDword(contact->hContact, "CList", "mf_freq", 0x7fffffff);
- //g_ExtraCache[index].msgFrequency = new_freq;
- //DBWriteContactSettingDword(contact->hContact, "CList", "mf_freq", new_freq);
if (index >= 0 && index < cfg::nextCacheEntry) {
if (cfg::eCache[index].valid)
@@ -486,7 +474,7 @@ void LoadSkinItemToCache(struct TExtraCache *cEntry, const char *szProto)
if (cEntry->status_item == NULL)
cEntry->status_item = reinterpret_cast<StatusItems_t *>(malloc(sizeof(StatusItems_t)));
ZeroMemory(cEntry->status_item, sizeof(StatusItems_t));
- strcpy(cEntry->status_item->szName, "{--CONTACT--}"); // mark as "per contact" item
+ strcpy(cEntry->status_item->szName, "{--CONTACT--}"); // mark as "per contact" item
cEntry->status_item->IGNORED = 0;
cEntry->status_item->TEXTCOLOR = cfg::getDword(hContact, "EXTBK", "TEXT", RGB(20, 20, 20));
@@ -560,7 +548,7 @@ int __fastcall CLVM_GetContactHiddenStatus(HANDLE hContact, char *szProto, struc
if (!cfg::dat.bFilterEffective)
return dbHidden;
-
+
if (szProto == NULL)
szProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
// check stickies first (priority), only if we really have stickies defined (CLVM_STICKY_CONTACTS is set).
diff --git a/plugins/Clist_nicer/src/clui.cpp b/plugins/Clist_nicer/src/clui.cpp
index 12fa50628d..3db0ad2f9f 100644
--- a/plugins/Clist_nicer/src/clui.cpp
+++ b/plugins/Clist_nicer/src/clui.cpp
@@ -38,7 +38,7 @@
#define TM_AUTOALPHA 1
#define TIMERID_AUTOSIZE 100
-#define MENU_MIRANDAMENU 0xFFFF1234
+#define MENU_MIRANDAMENU 0xFFFF1234
int g_fading_active = 0;
@@ -90,7 +90,6 @@ void DestroyTrayMenu(HMENU hMenu);
extern LONG g_cxsmIcon, g_cysmIcon;
extern HANDLE hIcoLibChanged;
-extern HANDLE hExtraImageListRebuilding, hExtraImageApplying;
SIZE g_oldSize = {0};
POINT g_oldPos = {0};
@@ -421,23 +420,13 @@ void ConfigureFrame()
void IcoLibReloadIcons()
{
-
cfg::dat.hIconVisible = Skin_GetIcon("CLN_visible");
cfg::dat.hIconInvisible = Skin_GetIcon("CLN_invisible");
cfg::dat.hIconChatactive = Skin_GetIcon("CLN_chatactive");
CacheClientIcons();
pcli->pfnReloadExtraIcons();
+ pcli->pfnSetAllExtraIcons(pcli->hwndContactTree, 0);
- // force client icons reload
- {
- int i;
-
- for (i = 0; i < cfg::nextCacheEntry; i++) {
- if (cfg::eCache[i].hContact)
- NotifyEventHooks(hExtraImageApplying, (WPARAM)cfg::eCache[i].hContact, 0);
- }
- }
- //
pcli->pfnClcBroadcast(CLM_AUTOREBUILD, 0, 0);
SendMessage(g_hwndViewModeFrame, WM_USER + 100, 0, 0);
}
@@ -721,7 +710,7 @@ int CustomDrawScrollBars(NMCSBCUSTOMDRAW *nmcsbcd)
switch (nmcsbcd->dwDrawStage) {
case CDDS_PREPAINT:
- if (cfg::dat.bSkinnedScrollbar) // XXX fix (verify skin items to be complete, otherwise don't draw
+ if (cfg::dat.bSkinnedScrollbar) // XXX fix (verify skin items to be complete, otherwise don't draw
return CDRF_SKIPDEFAULT;
else
return CDRF_DODEFAULT;
@@ -741,7 +730,7 @@ int CustomDrawScrollBars(NMCSBCUSTOMDRAW *nmcsbcd)
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);
+ 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:
@@ -805,14 +794,15 @@ static int ServiceParamsOK(ButtonItem *item, WPARAM *wParam, LPARAM *lParam, HAN
if (item->dwFlags & BUTTON_PASSHCONTACTW || item->dwFlags & BUTTON_PASSHCONTACTL || item->dwFlags & BUTTON_ISCONTACTDBACTION) {
if (hContact == 0)
return 0;
+
if (item->dwFlags & BUTTON_PASSHCONTACTW)
*wParam = (WPARAM)hContact;
else if (item->dwFlags & BUTTON_PASSHCONTACTL)
*lParam = (LPARAM)hContact;
- return 1;
}
- return 1; // doesn't need a paramter
+ return 1;
}
+
static void ShowCLUI(HWND hwnd)
{
int state = old_cliststate;
@@ -1062,14 +1052,10 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l
rcFrame.left += (cfg::dat.bCLeft - 1);
rcFrame.right -= (cfg::dat.bCRight - 1);
- //if (!g_CluiData.bSkinnedButtonMode)
- // rcFrame.bottom -= (g_CluiData.bottomOffset);
rcFrame.bottom++;
rcFrame.bottom -= cfg::dat.statusBarHeight;
rcFrame.top += (cfg::dat.topOffset - 1);
- //if (g_CluiData.neeedSnap)
- // goto skipbg;
if (cfg::dat.dwFlags & CLUI_FRAME_CLISTSUNKEN) {
if (cfg::dat.bWallpaperMode && cfg::clcdat != NULL) {
InflateRect(&rcFrame, -1, -1);
@@ -1223,7 +1209,8 @@ skipbg:
RECT rc;
GetWindowRect(hwnd, &rc);
- if (!CallService(MS_CLIST_DOCKINGISDOCKED, 0, 0)) { //if docked, dont remember pos (except for width)
+ // if docked, dont remember pos (except for width)
+ if (!CallService(MS_CLIST_DOCKINGISDOCKED, 0, 0)) {
cfg::writeDword("CList", "Height", (DWORD)(rc.bottom - rc.top));
cfg::writeDword("CList", "x", (DWORD) rc.left);
cfg::writeDword("CList", "y", (DWORD) rc.top);
@@ -1440,7 +1427,7 @@ skipbg:
if (HIWORD(wParam) == BN_CLICKED && lParam != 0) {
if (LOWORD(wParam) == IDC_TBFIRSTUID - 1)
break;
- else if (LOWORD(wParam) >= IDC_TBFIRSTUID) { // skinnable buttons handling
+ else if (LOWORD(wParam) >= IDC_TBFIRSTUID) { // skinnable buttons handling
ButtonItem *item = g_ButtonItems;
WPARAM wwParam = 0;
LPARAM llParam = 0;
@@ -1692,7 +1679,7 @@ buttons_done:
break;
}
case WM_DISPLAYCHANGE:
- SendMessage(pcli->hwndContactTree, WM_SIZE, 0, 0); //forces it to send a cln_listsizechanged
+ SendMessage(pcli->hwndContactTree, WM_SIZE, 0, 0); //forces it to send a cln_listsizechanged
break;
case WM_NOTIFY:
if (((LPNMHDR) lParam)->hwndFrom == pcli->hwndContactTree) {
@@ -1742,7 +1729,7 @@ buttons_done:
HMENU hMenu;
hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDGROUP, 0, 0);
TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, hwnd, NULL);
- DestroyTrayMenu(hMenu);
+ DestroyTrayMenu(hMenu);
return 0;
}
GetWindowRect(pcli->hwndStatus, &rc);
@@ -2044,8 +2031,8 @@ static INT_PTR CLN_ShowStatusMenu(WPARAM wParam, LPARAM lParam)
return 0;
}
-#define MS_CLUI_SHOWMAINMENU "CList/ShowMainMenu"
-#define MS_CLUI_SHOWSTATUSMENU "CList/ShowStatusMenu"
+#define MS_CLUI_SHOWMAINMENU "CList/ShowMainMenu"
+#define MS_CLUI_SHOWSTATUSMENU "CList/ShowStatusMenu"
void LoadCLUIModule(void)
{
diff --git a/plugins/Clist_nicer/src/viewmodes.cpp b/plugins/Clist_nicer/src/viewmodes.cpp
index 2370350508..e7d5e945bf 100644
--- a/plugins/Clist_nicer/src/viewmodes.cpp
+++ b/plugins/Clist_nicer/src/viewmodes.cpp
@@ -50,14 +50,13 @@ static char g_szModename[2048];
static int g_ViewModeOptDlg = FALSE;
static UINT _page1Controls[] = {IDC_STATIC1, IDC_STATIC2, IDC_STATIC3, IDC_STATIC5, IDC_STATIC4,
- IDC_STATIC8, IDC_ADDVIEWMODE, IDC_DELETEVIEWMODE, IDC_NEWVIEMODE, IDC_GROUPS, IDC_PROTOCOLS,
- IDC_VIEWMODES, IDC_STATUSMODES, IDC_STATIC12, IDC_STATIC13, IDC_STATIC14, IDC_PROTOGROUPOP, IDC_GROUPSTATUSOP,
- IDC_AUTOCLEAR, IDC_AUTOCLEARVAL, IDC_AUTOCLEARSPIN, IDC_STATIC15, IDC_STATIC16,
+ IDC_STATIC8, IDC_ADDVIEWMODE, IDC_DELETEVIEWMODE, IDC_NEWVIEMODE, IDC_GROUPS, IDC_PROTOCOLS,
+ IDC_VIEWMODES, IDC_STATUSMODES, IDC_STATIC12, IDC_STATIC13, IDC_STATIC14, IDC_PROTOGROUPOP, IDC_GROUPSTATUSOP,
+ IDC_AUTOCLEAR, IDC_AUTOCLEARVAL, IDC_AUTOCLEARSPIN, IDC_STATIC15, IDC_STATIC16,
IDC_LASTMESSAGEOP, IDC_LASTMESSAGEUNIT, IDC_LASTMSG, IDC_LASTMSGVALUE, 0};
static UINT _page2Controls[] = {IDC_CLIST, IDC_STATIC9, IDC_STATIC8, IDC_CLEARALL, IDC_CURVIEWMODE2, 0};
-
/*
* enumerate all view modes, call the callback function with the mode name
* useful for filling lists, menus and so on..
@@ -73,112 +72,102 @@ int CLVM_EnumProc(const char *szSetting, LPARAM lParam)
void CLVM_EnumModes(pfnEnumCallback EnumCallback)
{
- DBCONTACTENUMSETTINGS dbces;
-
- dbces.pfnEnumProc = CLVM_EnumProc;
- dbces.szModule = CLVM_MODULE;
- dbces.ofsSettings=0;
- dbces.lParam = (LPARAM)EnumCallback;
- CallService(MS_DB_CONTACT_ENUMSETTINGS,0,(LPARAM)&dbces);
+ DBCONTACTENUMSETTINGS dbces;
+ dbces.pfnEnumProc = CLVM_EnumProc;
+ dbces.szModule = CLVM_MODULE;
+ dbces.ofsSettings=0;
+ dbces.lParam = (LPARAM)EnumCallback;
+ CallService(MS_DB_CONTACT_ENUMSETTINGS,0,(LPARAM)&dbces);
}
int FillModes(char *szsetting)
{
- if (szsetting[0] == 'ö')
- return 1;
- SendDlgItemMessageA(clvmHwnd, IDC_VIEWMODES, LB_INSERTSTRING, -1, (LPARAM)szsetting);
- return 1;
+ if (szsetting[0] != 'ö')
+ SendDlgItemMessageA(clvmHwnd, IDC_VIEWMODES, LB_INSERTSTRING, -1, (LPARAM)szsetting);
+ return 1;
}
static void ShowPage(HWND hwnd, int page)
{
- int i = 0;
- int pageChange = 0;
-
- if (page == 0 && IsWindowVisible(GetDlgItem(hwnd, _page2Controls[0])))
- pageChange = 1;
-
- if (page == 1 && IsWindowVisible(GetDlgItem(hwnd, _page1Controls[0])))
- pageChange = 1;
-
- if (pageChange)
- SendMessage(hwnd, WM_SETREDRAW, FALSE, 0);
-
- switch(page) {
- case 0:
- while(_page1Controls[i] != 0)
- ShowWindow(GetDlgItem(hwnd, _page1Controls[i++]), SW_SHOW);
- i = 0;
- while(_page2Controls[i] != 0)
- ShowWindow(GetDlgItem(hwnd, _page2Controls[i++]), SW_HIDE);
- break;
- case 1:
- while(_page1Controls[i] != 0)
- ShowWindow(GetDlgItem(hwnd, _page1Controls[i++]), SW_HIDE);
- i = 0;
- while(_page2Controls[i] != 0)
- ShowWindow(GetDlgItem(hwnd, _page2Controls[i++]), SW_SHOW);
- break;
- }
- if (pageChange) {
- SendMessage(hwnd, WM_SETREDRAW, TRUE, 0);
- RedrawWindow(hwnd, NULL, NULL, RDW_ERASE | RDW_INVALIDATE);
- }
+ int i = 0;
+ int pageChange = 0;
+
+ if (page == 0 && IsWindowVisible(GetDlgItem(hwnd, _page2Controls[0])))
+ pageChange = 1;
+
+ if (page == 1 && IsWindowVisible(GetDlgItem(hwnd, _page1Controls[0])))
+ pageChange = 1;
+
+ if (pageChange)
+ SendMessage(hwnd, WM_SETREDRAW, FALSE, 0);
+
+ switch(page) {
+ case 0:
+ while(_page1Controls[i] != 0)
+ ShowWindow(GetDlgItem(hwnd, _page1Controls[i++]), SW_SHOW);
+ i = 0;
+ while(_page2Controls[i] != 0)
+ ShowWindow(GetDlgItem(hwnd, _page2Controls[i++]), SW_HIDE);
+ break;
+ case 1:
+ while(_page1Controls[i] != 0)
+ ShowWindow(GetDlgItem(hwnd, _page1Controls[i++]), SW_HIDE);
+ i = 0;
+ while(_page2Controls[i] != 0)
+ ShowWindow(GetDlgItem(hwnd, _page2Controls[i++]), SW_SHOW);
+ break;
+ }
+ if (pageChange) {
+ SendMessage(hwnd, WM_SETREDRAW, TRUE, 0);
+ RedrawWindow(hwnd, NULL, NULL, RDW_ERASE | RDW_INVALIDATE);
+ }
}
static int UpdateClistItem(HANDLE hContact, DWORD mask)
{
- int i;
+ for (int i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++)
+ SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_SETEXTRAIMAGE, (WPARAM)hContact, MAKELONG(i - ID_STATUS_OFFLINE,
+ (1 << (i - ID_STATUS_OFFLINE)) & mask ? i - ID_STATUS_OFFLINE : nullImage));
- for (i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++)
- SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_SETEXTRAIMAGE, (WPARAM)hContact, MAKELONG(i - ID_STATUS_OFFLINE,
- (1 << (i - ID_STATUS_OFFLINE)) & mask ? i - ID_STATUS_OFFLINE : nullImage));
-
- return 0;
+ return 0;
}
static DWORD GetMaskForItem(HANDLE hItem)
{
- int i;
- DWORD dwMask = 0;
+ DWORD dwMask = 0;
- for (i = 0; i <= ID_STATUS_OUTTOLUNCH - ID_STATUS_OFFLINE; i++)
- dwMask |= (SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_GETEXTRAIMAGE, (WPARAM)hItem, i) == nullImage ? 0 : 1 << i);
+ for (int i = 0; i <= ID_STATUS_OUTTOLUNCH - ID_STATUS_OFFLINE; i++)
+ dwMask |= (SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_GETEXTRAIMAGE, (WPARAM)hItem, i) == nullImage ? 0 : 1 << i);
- return dwMask;
+ return dwMask;
}
static void UpdateStickies()
{
- HANDLE hContact = db_find_first();
- HANDLE hItem;
- DWORD localMask;
- int i;
-
- while(hContact) {
- hItem = (HANDLE)SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0);
- if (hItem)
- SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_SETCHECKMARK, (WPARAM)hItem, cfg::getByte(hContact, "CLVM", g_szModename, 0) ? 1 : 0);
- localMask = HIWORD(cfg::getDword(hContact, "CLVM", g_szModename, 0));
- UpdateClistItem(hItem, (localMask == 0 || localMask == stickyStatusMask) ? stickyStatusMask : localMask);
- hContact = db_find_next(hContact);
- }
-
- {
- HANDLE hItem;
-
- for (i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++)
- SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_SETEXTRAIMAGE, (WPARAM)hInfoItem, MAKELONG(i - ID_STATUS_OFFLINE, (1 << (i - ID_STATUS_OFFLINE)) & stickyStatusMask ? i - ID_STATUS_OFFLINE : ID_STATUS_OUTTOLUNCH - ID_STATUS_OFFLINE + 1));
-
- hItem=(HANDLE)SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_GETNEXTITEM,CLGN_ROOT,0);
- hItem=(HANDLE)SendDlgItemMessage(clvmHwnd, IDC_CLIST,CLM_GETNEXTITEM,CLGN_NEXTGROUP, (LPARAM)hItem);
- while(hItem) {
- for (i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++)
- SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELONG(i - ID_STATUS_OFFLINE, nullImage));
- hItem=(HANDLE)SendDlgItemMessage(clvmHwnd, IDC_CLIST,CLM_GETNEXTITEM,CLGN_NEXTGROUP,(LPARAM)hItem);
- }
- ShowPage(clvmHwnd, 0);
- }
+ HANDLE hContact = db_find_first();
+ HANDLE hItem;
+ int i;
+
+ while(hContact) {
+ hItem = (HANDLE)SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0);
+ if (hItem)
+ SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_SETCHECKMARK, (WPARAM)hItem, cfg::getByte(hContact, "CLVM", g_szModename, 0) ? 1 : 0);
+ DWORD localMask = HIWORD(cfg::getDword(hContact, "CLVM", g_szModename, 0));
+ UpdateClistItem(hItem, (localMask == 0 || localMask == stickyStatusMask) ? stickyStatusMask : localMask);
+ hContact = db_find_next(hContact);
+ }
+
+ for (i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++)
+ SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_SETEXTRAIMAGE, (WPARAM)hInfoItem, MAKELONG(i - ID_STATUS_OFFLINE, (1 << (i - ID_STATUS_OFFLINE)) & stickyStatusMask ? i - ID_STATUS_OFFLINE : ID_STATUS_OUTTOLUNCH - ID_STATUS_OFFLINE + 1));
+
+ hItem = (HANDLE)SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_GETNEXTITEM,CLGN_ROOT,0);
+ hItem = (HANDLE)SendDlgItemMessage(clvmHwnd, IDC_CLIST,CLM_GETNEXTITEM,CLGN_NEXTGROUP, (LPARAM)hItem);
+ while(hItem) {
+ for (i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++)
+ SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELONG(i - ID_STATUS_OFFLINE, nullImage));
+ hItem=(HANDLE)SendDlgItemMessage(clvmHwnd, IDC_CLIST,CLM_GETNEXTITEM,CLGN_NEXTGROUP,(LPARAM)hItem);
+ }
+ ShowPage(clvmHwnd, 0);
}
static int FillDialog(HWND hwnd)
@@ -281,7 +270,7 @@ static void SetAllChildIcons(HWND hwndList,HANDLE hFirstItem,int iColumn,int iIm
while(hItem) {
hChildItem=(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_CHILD,(LPARAM)hItem);
if (hChildItem)
- SetAllChildIcons(hwndList,hChildItem,iColumn,iImage);
+ SetAllChildIcons(hwndList,hChildItem,iColumn,iImage);
hItem=(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_NEXTGROUP,(LPARAM)hItem);
}
//check contacts
@@ -305,43 +294,43 @@ static void SetIconsForColumn(HWND hwndList,HANDLE hItem,HANDLE hItemAll,int iCo
SendMessage(hwndList,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(iColumn,iImage));
}
else if (itemType==CLCIT_INFO) {
- int oldiImage = SendMessage(hwndList,CLM_GETEXTRAIMAGE,(WPARAM)hItem,iColumn);
- if (oldiImage!=0xFF&&oldiImage!=iImage)
- SendMessage(hwndList,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(iColumn,iImage));
+ int oldiImage = SendMessage(hwndList,CLM_GETEXTRAIMAGE,(WPARAM)hItem,iColumn);
+ if (oldiImage!=0xFF&&oldiImage!=iImage)
+ SendMessage(hwndList,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(iColumn,iImage));
if (hItem == hItemAll)
- SetAllChildIcons(hwndList,hItem,iColumn,iImage);
+ SetAllChildIcons(hwndList,hItem,iColumn,iImage);
else
- SendMessage(hwndList,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(iColumn,iImage)); //hItemUnknown
+ SendMessage(hwndList,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(iColumn,iImage)); //hItemUnknown
}
else if (itemType==CLCIT_GROUP) {
- int oldiImage = SendMessage(hwndList,CLM_GETEXTRAIMAGE,(WPARAM)hItem,iColumn);
- if (oldiImage!=0xFF&&oldiImage!=iImage)
- SendMessage(hwndList,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(iColumn,iImage));
+ int oldiImage = SendMessage(hwndList,CLM_GETEXTRAIMAGE,(WPARAM)hItem,iColumn);
+ if (oldiImage!=0xFF&&oldiImage!=iImage)
+ SendMessage(hwndList,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(iColumn,iImage));
hItem=(HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_CHILD,(LPARAM)hItem);
if (hItem)
- SetAllChildIcons(hwndList,hItem,iColumn,iImage);
+ SetAllChildIcons(hwndList,hItem,iColumn,iImage);
}
}
void SaveViewMode(const char *name, const TCHAR *szGroupFilter, const char *szProtoFilter, DWORD statusMask, DWORD stickyStatusMask, unsigned int options,
unsigned int stickies, unsigned int operators, unsigned int lmdat)
{
- char szSetting[512];
-
- mir_snprintf(szSetting, 512, "%c%s_PF", 246, name);
- cfg::writeString(NULL, CLVM_MODULE, szSetting, szProtoFilter);
- mir_snprintf(szSetting, 512, "%c%s_GF", 246, name);
- cfg::writeTString(NULL, CLVM_MODULE, szSetting, szGroupFilter);
- mir_snprintf(szSetting, 512, "%c%s_SM", 246, name);
- cfg::writeDword(CLVM_MODULE, szSetting, statusMask);
- mir_snprintf(szSetting, 512, "%c%s_SSM", 246, name);
- cfg::writeDword(CLVM_MODULE, szSetting, stickyStatusMask);
- mir_snprintf(szSetting, 512, "%c%s_OPT", 246, name);
- cfg::writeDword(CLVM_MODULE, szSetting, options);
- mir_snprintf(szSetting, 512, "%c%s_LM", 246, name);
- cfg::writeDword(CLVM_MODULE, szSetting, lmdat);
-
- cfg::writeDword(CLVM_MODULE, name, MAKELONG((unsigned short)operators, (unsigned short)stickies));
+ char szSetting[512];
+
+ mir_snprintf(szSetting, 512, "%c%s_PF", 246, name);
+ cfg::writeString(NULL, CLVM_MODULE, szSetting, szProtoFilter);
+ mir_snprintf(szSetting, 512, "%c%s_GF", 246, name);
+ cfg::writeTString(NULL, CLVM_MODULE, szSetting, szGroupFilter);
+ mir_snprintf(szSetting, 512, "%c%s_SM", 246, name);
+ cfg::writeDword(CLVM_MODULE, szSetting, statusMask);
+ mir_snprintf(szSetting, 512, "%c%s_SSM", 246, name);
+ cfg::writeDword(CLVM_MODULE, szSetting, stickyStatusMask);
+ mir_snprintf(szSetting, 512, "%c%s_OPT", 246, name);
+ cfg::writeDword(CLVM_MODULE, szSetting, options);
+ mir_snprintf(szSetting, 512, "%c%s_LM", 246, name);
+ cfg::writeDword(CLVM_MODULE, szSetting, lmdat);
+
+ cfg::writeDword(CLVM_MODULE, name, MAKELONG((unsigned short)operators, (unsigned short)stickies));
}
/*
@@ -350,114 +339,114 @@ void SaveViewMode(const char *name, const TCHAR *szGroupFilter, const char *szPr
void SaveState()
{
- TCHAR newGroupFilter[2048] = _T("|");
- char newProtoFilter[2048] = "|";
- int i, iLen;
- HWND hwndList;
- char *szModeName = NULL;
- DWORD statusMask = 0;
- HANDLE hContact, hItem;
- DWORD operators = 0;
-
- if (clvm_curItem == -1)
- return;
-
- {
- LVITEMA item = {0};
- char szTemp[256];
-
- hwndList = GetDlgItem(clvmHwnd, IDC_PROTOCOLS);
- for (i = 0; i < ListView_GetItemCount(hwndList); i++) {
- if (ListView_GetCheckState(hwndList, i)) {
- item.mask = LVIF_TEXT;
- item.pszText = szTemp;
- item.cchTextMax = 255;
- item.iItem = i;
- SendMessageA(hwndList, LVM_GETITEMA, 0, (LPARAM)&item);
- strncat(newProtoFilter, szTemp, 2048);
- strncat(newProtoFilter, "|", 2048);
- newProtoFilter[2047] = 0;
- }
- }
- }
-
- {
- LVITEM item = {0};
- TCHAR szTemp[256];
-
- hwndList = GetDlgItem(clvmHwnd, IDC_GROUPS);
-
- operators |= ListView_GetCheckState(hwndList, 0) ? CLVM_INCLUDED_UNGROUPED : 0;
-
- for (i = 0; i < ListView_GetItemCount(hwndList); i++) {
- if (ListView_GetCheckState(hwndList, i)) {
- item.mask = LVIF_TEXT;
- item.pszText = szTemp;
- item.cchTextMax = 255;
- item.iItem = i;
- SendMessage(hwndList, LVM_GETITEM, 0, (LPARAM)&item);
- _tcsncat(newGroupFilter, szTemp, 2048);
- _tcsncat(newGroupFilter, _T("|"), 2048);
- newGroupFilter[2047] = 0;
- }
- }
- }
- hwndList = GetDlgItem(clvmHwnd, IDC_STATUSMODES);
- for (i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++) {
- if (ListView_GetCheckState(hwndList, i - ID_STATUS_OFFLINE))
- statusMask |= (1 << (i - ID_STATUS_OFFLINE));
- }
- iLen = SendMessageA(GetDlgItem(clvmHwnd, IDC_VIEWMODES), LB_GETTEXTLEN, clvm_curItem, 0);
- if (iLen) {
- unsigned int stickies = 0;
- DWORD dwGlobalMask, dwLocalMask;
+ TCHAR newGroupFilter[2048] = _T("|");
+ char newProtoFilter[2048] = "|";
+ int i, iLen;
+ HWND hwndList;
+ char *szModeName = NULL;
+ DWORD statusMask = 0;
+ HANDLE hContact, hItem;
+ DWORD operators = 0;
+
+ if (clvm_curItem == -1)
+ return;
+
+ {
+ LVITEMA item = {0};
+ char szTemp[256];
+
+ hwndList = GetDlgItem(clvmHwnd, IDC_PROTOCOLS);
+ for (i = 0; i < ListView_GetItemCount(hwndList); i++) {
+ if (ListView_GetCheckState(hwndList, i)) {
+ item.mask = LVIF_TEXT;
+ item.pszText = szTemp;
+ item.cchTextMax = 255;
+ item.iItem = i;
+ SendMessageA(hwndList, LVM_GETITEMA, 0, (LPARAM)&item);
+ strncat(newProtoFilter, szTemp, 2048);
+ strncat(newProtoFilter, "|", 2048);
+ newProtoFilter[2047] = 0;
+ }
+ }
+ }
+
+ {
+ LVITEM item = {0};
+ TCHAR szTemp[256];
+
+ hwndList = GetDlgItem(clvmHwnd, IDC_GROUPS);
+
+ operators |= ListView_GetCheckState(hwndList, 0) ? CLVM_INCLUDED_UNGROUPED : 0;
+
+ for (i = 0; i < ListView_GetItemCount(hwndList); i++) {
+ if (ListView_GetCheckState(hwndList, i)) {
+ item.mask = LVIF_TEXT;
+ item.pszText = szTemp;
+ item.cchTextMax = 255;
+ item.iItem = i;
+ SendMessage(hwndList, LVM_GETITEM, 0, (LPARAM)&item);
+ _tcsncat(newGroupFilter, szTemp, 2048);
+ _tcsncat(newGroupFilter, _T("|"), 2048);
+ newGroupFilter[2047] = 0;
+ }
+ }
+ }
+ hwndList = GetDlgItem(clvmHwnd, IDC_STATUSMODES);
+ for (i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++) {
+ if (ListView_GetCheckState(hwndList, i - ID_STATUS_OFFLINE))
+ statusMask |= (1 << (i - ID_STATUS_OFFLINE));
+ }
+ iLen = SendMessageA(GetDlgItem(clvmHwnd, IDC_VIEWMODES), LB_GETTEXTLEN, clvm_curItem, 0);
+ if (iLen) {
+ unsigned int stickies = 0;
+ DWORD dwGlobalMask, dwLocalMask;
BOOL translated;
- szModeName = ( char* )malloc(iLen + 1);
- if (szModeName) {
- DWORD options, lmdat;
- //char *vastring = NULL;
- //int len = GetWindowTextLengthA(GetDlgItem(clvmHwnd, IDC_VARIABLES)) + 1;
-
- //vastring = (char *)malloc(len);
- //if (vastring)
- // GetDlgItemTextA(clvmHwnd, IDC_VARIABLES, vastring, len);
- SendDlgItemMessageA(clvmHwnd, IDC_VIEWMODES, LB_GETTEXT, clvm_curItem, (LPARAM)szModeName);
- dwGlobalMask = GetMaskForItem(hInfoItem);
- hContact = db_find_first();
- while(hContact) {
- hItem = (HANDLE)SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0);
- if (hItem) {
- if (SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM)hItem, 0)) {
- dwLocalMask = GetMaskForItem(hItem);
- cfg::writeDword(hContact, "CLVM", szModeName, MAKELONG(1, (unsigned short)dwLocalMask));
- stickies++;
- }
- else {
- if (cfg::getDword(hContact, "CLVM", szModeName, 0))
- cfg::writeDword(hContact, "CLVM", szModeName, 0);
- }
- }
- hContact = db_find_next(hContact);
- }
- operators |= ((SendDlgItemMessage(clvmHwnd, IDC_PROTOGROUPOP, CB_GETCURSEL, 0, 0) == 1 ? CLVM_PROTOGROUP_OP : 0) |
- (SendDlgItemMessage(clvmHwnd, IDC_GROUPSTATUSOP, CB_GETCURSEL, 0, 0) == 1 ? CLVM_GROUPSTATUS_OP : 0) |
- (IsDlgButtonChecked(clvmHwnd, IDC_AUTOCLEAR) ? CLVM_AUTOCLEAR : 0) |
- (IsDlgButtonChecked(clvmHwnd, IDC_LASTMSG) ? CLVM_USELASTMSG : 0));
-
- options = SendDlgItemMessage(clvmHwnd, IDC_AUTOCLEARSPIN, UDM_GETPOS, 0, 0);
+ szModeName = ( char* )malloc(iLen + 1);
+ if (szModeName) {
+ DWORD options, lmdat;
+ //char *vastring = NULL;
+ //int len = GetWindowTextLengthA(GetDlgItem(clvmHwnd, IDC_VARIABLES)) + 1;
+
+ //vastring = (char *)malloc(len);
+ //if (vastring)
+ // GetDlgItemTextA(clvmHwnd, IDC_VARIABLES, vastring, len);
+ SendDlgItemMessageA(clvmHwnd, IDC_VIEWMODES, LB_GETTEXT, clvm_curItem, (LPARAM)szModeName);
+ dwGlobalMask = GetMaskForItem(hInfoItem);
+ hContact = db_find_first();
+ while(hContact) {
+ hItem = (HANDLE)SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0);
+ if (hItem) {
+ if (SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM)hItem, 0)) {
+ dwLocalMask = GetMaskForItem(hItem);
+ cfg::writeDword(hContact, "CLVM", szModeName, MAKELONG(1, (unsigned short)dwLocalMask));
+ stickies++;
+ }
+ else {
+ if (cfg::getDword(hContact, "CLVM", szModeName, 0))
+ cfg::writeDword(hContact, "CLVM", szModeName, 0);
+ }
+ }
+ hContact = db_find_next(hContact);
+ }
+ operators |= ((SendDlgItemMessage(clvmHwnd, IDC_PROTOGROUPOP, CB_GETCURSEL, 0, 0) == 1 ? CLVM_PROTOGROUP_OP : 0) |
+ (SendDlgItemMessage(clvmHwnd, IDC_GROUPSTATUSOP, CB_GETCURSEL, 0, 0) == 1 ? CLVM_GROUPSTATUS_OP : 0) |
+ (IsDlgButtonChecked(clvmHwnd, IDC_AUTOCLEAR) ? CLVM_AUTOCLEAR : 0) |
+ (IsDlgButtonChecked(clvmHwnd, IDC_LASTMSG) ? CLVM_USELASTMSG : 0));
+
+ options = SendDlgItemMessage(clvmHwnd, IDC_AUTOCLEARSPIN, UDM_GETPOS, 0, 0);
lmdat = MAKELONG(GetDlgItemInt(clvmHwnd, IDC_LASTMSGVALUE, &translated, FALSE),
- MAKEWORD(SendDlgItemMessage(clvmHwnd, IDC_LASTMESSAGEOP, CB_GETCURSEL, 0, 0),
- SendDlgItemMessage(clvmHwnd, IDC_LASTMESSAGEUNIT, CB_GETCURSEL, 0, 0)));
-
- SaveViewMode(szModeName, newGroupFilter, newProtoFilter, statusMask, dwGlobalMask, options,
- stickies, operators, lmdat);
- //free(vastring);
- free(szModeName);
- }
- }
- Utils::enableDlgControl(clvmHwnd, IDC_APPLY, FALSE);
+ MAKEWORD(SendDlgItemMessage(clvmHwnd, IDC_LASTMESSAGEOP, CB_GETCURSEL, 0, 0),
+ SendDlgItemMessage(clvmHwnd, IDC_LASTMESSAGEUNIT, CB_GETCURSEL, 0, 0)));
+
+ SaveViewMode(szModeName, newGroupFilter, newProtoFilter, statusMask, dwGlobalMask, options,
+ stickies, operators, lmdat);
+ //free(vastring);
+ free(szModeName);
+ }
+ }
+ Utils::enableDlgControl(clvmHwnd, IDC_APPLY, FALSE);
}
@@ -467,104 +456,104 @@ void SaveState()
void UpdateFilters()
{
- DBVARIANT dbv_pf = {0};
- DBVARIANT dbv_gf = {0};
- char szSetting[128];
- char *szBuf = NULL;
- int iLen;
- DWORD statusMask = 0, localMask = 0;
- DWORD dwFlags;
- DWORD opt;
- char szTemp[100];
-
- if (clvm_curItem == LB_ERR)
- return;
-
- iLen = SendDlgItemMessageA(clvmHwnd, IDC_VIEWMODES, LB_GETTEXTLEN, clvm_curItem, 0);
-
- if (iLen == 0)
- return;
-
- szBuf = (char *)malloc(iLen + 1);
- SendDlgItemMessageA(clvmHwnd, IDC_VIEWMODES, LB_GETTEXT, clvm_curItem, (LPARAM)szBuf);
- strncpy(g_szModename, szBuf, sizeof(g_szModename));
- g_szModename[sizeof(g_szModename) - 1] = 0;
- mir_snprintf(szTemp, 100, Translate("Current view mode: %s"), g_szModename);
- SetDlgItemTextA(clvmHwnd, IDC_CURVIEWMODE2, szTemp);
- mir_snprintf(szSetting, 128, "%c%s_PF", 246, szBuf);
- if (DBGetContactSetting(NULL, CLVM_MODULE, szSetting, &dbv_pf))
- goto cleanup;
- mir_snprintf(szSetting, 128, "%c%s_GF", 246, szBuf);
- if (cfg::getTString(NULL, CLVM_MODULE, szSetting, &dbv_gf))
- goto cleanup;
- mir_snprintf(szSetting, 128, "%c%s_OPT", 246, szBuf);
- if ((opt = cfg::getDword(NULL, CLVM_MODULE, szSetting, -1)) != -1) {
- SendDlgItemMessage(clvmHwnd, IDC_AUTOCLEARSPIN, UDM_SETPOS, 0, MAKELONG(LOWORD(opt), 0));
- }
- mir_snprintf(szSetting, 128, "%c%s_SM", 246, szBuf);
- statusMask = cfg::getDword(CLVM_MODULE, szSetting, -1);
- mir_snprintf(szSetting, 128, "%c%s_SSM", 246, szBuf);
- stickyStatusMask = cfg::getDword(CLVM_MODULE, szSetting, -1);
- dwFlags = cfg::getDword(CLVM_MODULE, szBuf, 0);
- {
- LVITEMA item = {0};
- char szTemp[256];
- char szMask[256];
- int i;
- HWND hwndList = GetDlgItem(clvmHwnd, IDC_PROTOCOLS);
-
- item.mask = LVIF_TEXT;
- item.pszText = szTemp;
- item.cchTextMax = 255;
-
- for (i = 0; i < ListView_GetItemCount(hwndList); i++) {
- item.iItem = i;
- SendMessageA(hwndList, LVM_GETITEMA, 0, (LPARAM)&item);
- mir_snprintf(szMask, 256, "%s|", szTemp);
- if (dbv_pf.pszVal && strstr(dbv_pf.pszVal, szMask))
- ListView_SetCheckState(hwndList, i, TRUE)
- else
- ListView_SetCheckState(hwndList, i, FALSE);
- }
- }
- {
- LVITEM item = {0};
- TCHAR szTemp[256];
- TCHAR szMask[256];
- int i;
- HWND hwndList = GetDlgItem(clvmHwnd, IDC_GROUPS);
-
- item.mask = LVIF_TEXT;
- item.pszText = szTemp;
- item.cchTextMax = 255;
-
- ListView_SetCheckState(hwndList, 0, dwFlags & CLVM_INCLUDED_UNGROUPED ? TRUE : FALSE);
-
- for (i = 1; i < ListView_GetItemCount(hwndList); i++) {
- item.iItem = i;
- SendMessage(hwndList, LVM_GETITEM, 0, (LPARAM)&item);
- _sntprintf(szMask, 256, _T("%s|"), szTemp);
- if (dbv_gf.ptszVal && _tcsstr(dbv_gf.ptszVal, szMask))
- ListView_SetCheckState(hwndList, i, TRUE)
- else
- ListView_SetCheckState(hwndList, i, FALSE);
- }
- }
- {
- HWND hwndList = GetDlgItem(clvmHwnd, IDC_STATUSMODES);
- int i;
-
- for (i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++) {
- if ((1 << (i - ID_STATUS_OFFLINE)) & statusMask)
- ListView_SetCheckState(hwndList, i - ID_STATUS_OFFLINE, TRUE)
- else
- ListView_SetCheckState(hwndList, i - ID_STATUS_OFFLINE, FALSE);
- }
- }
- SendDlgItemMessage(clvmHwnd, IDC_PROTOGROUPOP, CB_SETCURSEL, dwFlags & CLVM_PROTOGROUP_OP ? 1 : 0, 0);
- SendDlgItemMessage(clvmHwnd, IDC_GROUPSTATUSOP, CB_SETCURSEL, dwFlags & CLVM_GROUPSTATUS_OP ? 1 : 0, 0);
- CheckDlgButton(clvmHwnd, IDC_AUTOCLEAR, dwFlags & CLVM_AUTOCLEAR ? 1 : 0);
- UpdateStickies();
+ DBVARIANT dbv_pf = {0};
+ DBVARIANT dbv_gf = {0};
+ char szSetting[128];
+ char *szBuf = NULL;
+ int iLen;
+ DWORD statusMask = 0, localMask = 0;
+ DWORD dwFlags;
+ DWORD opt;
+ char szTemp[100];
+
+ if (clvm_curItem == LB_ERR)
+ return;
+
+ iLen = SendDlgItemMessageA(clvmHwnd, IDC_VIEWMODES, LB_GETTEXTLEN, clvm_curItem, 0);
+
+ if (iLen == 0)
+ return;
+
+ szBuf = (char *)malloc(iLen + 1);
+ SendDlgItemMessageA(clvmHwnd, IDC_VIEWMODES, LB_GETTEXT, clvm_curItem, (LPARAM)szBuf);
+ strncpy(g_szModename, szBuf, sizeof(g_szModename));
+ g_szModename[sizeof(g_szModename) - 1] = 0;
+ mir_snprintf(szTemp, 100, Translate("Current view mode: %s"), g_szModename);
+ SetDlgItemTextA(clvmHwnd, IDC_CURVIEWMODE2, szTemp);
+ mir_snprintf(szSetting, 128, "%c%s_PF", 246, szBuf);
+ if (DBGetContactSetting(NULL, CLVM_MODULE, szSetting, &dbv_pf))
+ goto cleanup;
+ mir_snprintf(szSetting, 128, "%c%s_GF", 246, szBuf);
+ if (cfg::getTString(NULL, CLVM_MODULE, szSetting, &dbv_gf))
+ goto cleanup;
+ mir_snprintf(szSetting, 128, "%c%s_OPT", 246, szBuf);
+ if ((opt = cfg::getDword(NULL, CLVM_MODULE, szSetting, -1)) != -1) {
+ SendDlgItemMessage(clvmHwnd, IDC_AUTOCLEARSPIN, UDM_SETPOS, 0, MAKELONG(LOWORD(opt), 0));
+ }
+ mir_snprintf(szSetting, 128, "%c%s_SM", 246, szBuf);
+ statusMask = cfg::getDword(CLVM_MODULE, szSetting, -1);
+ mir_snprintf(szSetting, 128, "%c%s_SSM", 246, szBuf);
+ stickyStatusMask = cfg::getDword(CLVM_MODULE, szSetting, -1);
+ dwFlags = cfg::getDword(CLVM_MODULE, szBuf, 0);
+ {
+ LVITEMA item = {0};
+ char szTemp[256];
+ char szMask[256];
+ int i;
+ HWND hwndList = GetDlgItem(clvmHwnd, IDC_PROTOCOLS);
+
+ item.mask = LVIF_TEXT;
+ item.pszText = szTemp;
+ item.cchTextMax = 255;
+
+ for (i = 0; i < ListView_GetItemCount(hwndList); i++) {
+ item.iItem = i;
+ SendMessageA(hwndList, LVM_GETITEMA, 0, (LPARAM)&item);
+ mir_snprintf(szMask, 256, "%s|", szTemp);
+ if (dbv_pf.pszVal && strstr(dbv_pf.pszVal, szMask))
+ ListView_SetCheckState(hwndList, i, TRUE)
+ else
+ ListView_SetCheckState(hwndList, i, FALSE);
+ }
+ }
+ {
+ LVITEM item = {0};
+ TCHAR szTemp[256];
+ TCHAR szMask[256];
+ int i;
+ HWND hwndList = GetDlgItem(clvmHwnd, IDC_GROUPS);
+
+ item.mask = LVIF_TEXT;
+ item.pszText = szTemp;
+ item.cchTextMax = 255;
+
+ ListView_SetCheckState(hwndList, 0, dwFlags & CLVM_INCLUDED_UNGROUPED ? TRUE : FALSE);
+
+ for (i = 1; i < ListView_GetItemCount(hwndList); i++) {
+ item.iItem = i;
+ SendMessage(hwndList, LVM_GETITEM, 0, (LPARAM)&item);
+ _sntprintf(szMask, 256, _T("%s|"), szTemp);
+ if (dbv_gf.ptszVal && _tcsstr(dbv_gf.ptszVal, szMask))
+ ListView_SetCheckState(hwndList, i, TRUE)
+ else
+ ListView_SetCheckState(hwndList, i, FALSE);
+ }
+ }
+ {
+ HWND hwndList = GetDlgItem(clvmHwnd, IDC_STATUSMODES);
+ int i;
+
+ for (i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++) {
+ if ((1 << (i - ID_STATUS_OFFLINE)) & statusMask)
+ ListView_SetCheckState(hwndList, i - ID_STATUS_OFFLINE, TRUE)
+ else
+ ListView_SetCheckState(hwndList, i - ID_STATUS_OFFLINE, FALSE);
+ }
+ }
+ SendDlgItemMessage(clvmHwnd, IDC_PROTOGROUPOP, CB_SETCURSEL, dwFlags & CLVM_PROTOGROUP_OP ? 1 : 0, 0);
+ SendDlgItemMessage(clvmHwnd, IDC_GROUPSTATUSOP, CB_SETCURSEL, dwFlags & CLVM_GROUPSTATUS_OP ? 1 : 0, 0);
+ CheckDlgButton(clvmHwnd, IDC_AUTOCLEAR, dwFlags & CLVM_AUTOCLEAR ? 1 : 0);
+ UpdateStickies();
{
int useLastMsg = dwFlags & CLVM_USELASTMSG;
@@ -576,7 +565,7 @@ void UpdateFilters()
Utils::enableDlgControl(clvmHwnd, IDC_LASTMSGVALUE, useLastMsg);
Utils::enableDlgControl(clvmHwnd, IDC_LASTMESSAGEUNIT, useLastMsg);
- mir_snprintf(szSetting, 128, "%c%s_LM", 246, szBuf);
+ mir_snprintf(szSetting, 128, "%c%s_LM", 246, szBuf);
lmdat = cfg::getDword(CLVM_MODULE, szSetting, 0);
SetDlgItemInt(clvmHwnd, IDC_LASTMSGVALUE, LOWORD(lmdat), FALSE);
@@ -588,305 +577,284 @@ void UpdateFilters()
ShowPage(clvmHwnd, 0);
cleanup:
- DBFreeVariant(&dbv_pf);
- DBFreeVariant(&dbv_gf);
- free(szBuf);
+ DBFreeVariant(&dbv_pf);
+ DBFreeVariant(&dbv_gf);
+ free(szBuf);
}
INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- clvmHwnd = hwndDlg;
-
- switch(msg) {
- case WM_INITDIALOG:
- {
- int i = 0;
- TCITEMA tci;
- RECT rcClient;
- CLCINFOITEM cii = {0};
- HICON hIcon;
-
- if (IS_THEMED)
- API::pfnEnableThemeDialogTexture(hwndDlg, ETDT_ENABLETAB);
-
- himlViewModes = ImageList_Create(16, 16, ILC_MASK | (IsWinVerXPPlus() ? ILC_COLOR32 : ILC_COLOR16), 12, 0);
- for (i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++)
- ImageList_AddIcon(himlViewModes, LoadSkinnedProtoIcon(NULL, i));
-
- hIcon = (HICON)LoadImage(g_hInst, MAKEINTRESOURCE(IDI_MINIMIZE), IMAGE_ICON, 16, 16, 0);
- nullImage = ImageList_AddIcon(himlViewModes, hIcon);
- DestroyIcon(hIcon);
- GetClientRect(hwndDlg, &rcClient);
-
- tci.mask = TCIF_PARAM|TCIF_TEXT;
- tci.lParam = 0;
- tci.pszText = Translate("Sticky contacts");
- SendMessageA(GetDlgItem(hwndDlg, IDC_TAB), TCM_INSERTITEMA, 0, (LPARAM)&tci);
-
- tci.pszText = Translate("Filtering");
- SendMessageA(GetDlgItem(hwndDlg, IDC_TAB), TCM_INSERTITEMA, 0, (LPARAM)&tci);
-
- TabCtrl_SetCurSel(GetDlgItem(hwndDlg, IDC_TAB), 0);
-
- TranslateDialogDefault(hwndDlg);
- FillDialog(hwndDlg);
- Utils::enableDlgControl(hwndDlg, IDC_ADDVIEWMODE, FALSE);
-
- SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETEXTRAIMAGELIST, 0, (LPARAM)himlViewModes);
- SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETEXTRACOLUMNS, ID_STATUS_OUTTOLUNCH - ID_STATUS_OFFLINE, 0);
- cii.cbSize = sizeof(cii);
- cii.hParentGroup = 0;
- cii.pszText = _T("*** All contacts ***");
- hInfoItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_ADDINFOITEM, 0, (LPARAM)&cii);
- SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETHIDEEMPTYGROUPS, 1, 0);
- if (SendDlgItemMessage(hwndDlg, IDC_VIEWMODES, LB_SETCURSEL, 0, 0) != LB_ERR) {
- clvm_curItem = 0;
- UpdateFilters();
- }
- else
- clvm_curItem = -1;
- g_ViewModeOptDlg = TRUE;
- i = 0;
- while(_page2Controls[i] != 0)
- ShowWindow(GetDlgItem(hwndDlg, _page2Controls[i++]), SW_HIDE);
- ShowWindow(hwndDlg, SW_SHOWNORMAL);
- Utils::enableDlgControl(hwndDlg, IDC_APPLY, FALSE);
- SendDlgItemMessage(hwndDlg, IDC_AUTOCLEARSPIN, UDM_SETRANGE, 0, MAKELONG(1000, 0));
- SetWindowText(hwndDlg, TranslateT("Configure view modes"));
- return TRUE;
- }
- case WM_COMMAND:
- switch(LOWORD(wParam)) {
- case IDC_PROTOGROUPOP:
- case IDC_GROUPSTATUSOP:
- case IDC_LASTMESSAGEUNIT:
- case IDC_LASTMESSAGEOP:
- if (HIWORD(wParam) == CBN_SELCHANGE)
- Utils::enableDlgControl(hwndDlg, IDC_APPLY, TRUE);
- break;
- case IDC_AUTOCLEAR:
- Utils::enableDlgControl(hwndDlg, IDC_APPLY, TRUE);
- break;
- case IDC_LASTMSG:
+ clvmHwnd = hwndDlg;
+
+ switch(msg) {
+ case WM_INITDIALOG:
+ {
+ int i = 0;
+ TCITEMA tci;
+ RECT rcClient;
+ CLCINFOITEM cii = {0};
+ HICON hIcon;
+
+ if (IS_THEMED)
+ API::pfnEnableThemeDialogTexture(hwndDlg, ETDT_ENABLETAB);
+
+ himlViewModes = ImageList_Create(16, 16, ILC_MASK | (IsWinVerXPPlus() ? ILC_COLOR32 : ILC_COLOR16), 12, 0);
+ for (i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++)
+ ImageList_AddIcon(himlViewModes, LoadSkinnedProtoIcon(NULL, i));
+
+ hIcon = (HICON)LoadImage(g_hInst, MAKEINTRESOURCE(IDI_MINIMIZE), IMAGE_ICON, 16, 16, 0);
+ nullImage = ImageList_AddIcon(himlViewModes, hIcon);
+ DestroyIcon(hIcon);
+ GetClientRect(hwndDlg, &rcClient);
+
+ tci.mask = TCIF_PARAM|TCIF_TEXT;
+ tci.lParam = 0;
+ tci.pszText = Translate("Sticky contacts");
+ SendMessageA(GetDlgItem(hwndDlg, IDC_TAB), TCM_INSERTITEMA, 0, (LPARAM)&tci);
+
+ tci.pszText = Translate("Filtering");
+ SendMessageA(GetDlgItem(hwndDlg, IDC_TAB), TCM_INSERTITEMA, 0, (LPARAM)&tci);
+
+ TabCtrl_SetCurSel(GetDlgItem(hwndDlg, IDC_TAB), 0);
+
+ TranslateDialogDefault(hwndDlg);
+ FillDialog(hwndDlg);
+ Utils::enableDlgControl(hwndDlg, IDC_ADDVIEWMODE, FALSE);
+
+ SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETEXTRAIMAGELIST, 0, (LPARAM)himlViewModes);
+ SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETEXTRACOLUMNS, ID_STATUS_OUTTOLUNCH - ID_STATUS_OFFLINE, 0);
+ cii.cbSize = sizeof(cii);
+ cii.hParentGroup = 0;
+ cii.pszText = _T("*** All contacts ***");
+ hInfoItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_ADDINFOITEM, 0, (LPARAM)&cii);
+ SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETHIDEEMPTYGROUPS, 1, 0);
+ if (SendDlgItemMessage(hwndDlg, IDC_VIEWMODES, LB_SETCURSEL, 0, 0) != LB_ERR) {
+ clvm_curItem = 0;
+ UpdateFilters();
+ }
+ else
+ clvm_curItem = -1;
+ g_ViewModeOptDlg = TRUE;
+ i = 0;
+ while(_page2Controls[i] != 0)
+ ShowWindow(GetDlgItem(hwndDlg, _page2Controls[i++]), SW_HIDE);
+ ShowWindow(hwndDlg, SW_SHOWNORMAL);
+ Utils::enableDlgControl(hwndDlg, IDC_APPLY, FALSE);
+ SendDlgItemMessage(hwndDlg, IDC_AUTOCLEARSPIN, UDM_SETRANGE, 0, MAKELONG(1000, 0));
+ SetWindowText(hwndDlg, TranslateT("Configure view modes"));
+ return TRUE;
+ }
+ case WM_COMMAND:
+ switch(LOWORD(wParam)) {
+ case IDC_PROTOGROUPOP:
+ case IDC_GROUPSTATUSOP:
+ case IDC_LASTMESSAGEUNIT:
+ case IDC_LASTMESSAGEOP:
+ if (HIWORD(wParam) == CBN_SELCHANGE)
+ Utils::enableDlgControl(hwndDlg, IDC_APPLY, TRUE);
+ break;
+ case IDC_AUTOCLEAR:
+ Utils::enableDlgControl(hwndDlg, IDC_APPLY, TRUE);
+ break;
+ case IDC_LASTMSG:
+ {
+ int bUseLastMsg = IsDlgButtonChecked(hwndDlg, IDC_LASTMSG);
+ Utils::enableDlgControl(hwndDlg, IDC_LASTMESSAGEOP, bUseLastMsg);
+ Utils::enableDlgControl(hwndDlg, IDC_LASTMESSAGEUNIT, bUseLastMsg);
+ Utils::enableDlgControl(hwndDlg, IDC_LASTMSGVALUE, bUseLastMsg);
+ Utils::enableDlgControl(hwndDlg, IDC_APPLY, TRUE);
+ break;
+ }
+ case IDC_AUTOCLEARVAL:
+ case IDC_LASTMSGVALUE:
+ if (HIWORD(wParam) == EN_CHANGE && GetFocus() == (HWND)lParam)
+ Utils::enableDlgControl(hwndDlg, IDC_APPLY, TRUE);
+ break;
+ case IDC_DELETEVIEWMODE:
+ {
+ if (MessageBoxA(0, Translate("Really delete this view mode? This cannot be undone"), Translate("Delete a view mode"), MB_YESNO | MB_ICONQUESTION) == IDYES) {
+ char szSetting[256];
+ int iLen = SendDlgItemMessage(hwndDlg, IDC_VIEWMODES, LB_GETTEXTLEN, SendDlgItemMessage(hwndDlg, IDC_VIEWMODES, LB_GETCURSEL, 0, 0), 0);
+ if (iLen) {
+ char *szBuf = ( char* )malloc(iLen + 1);
+ if (szBuf) {
+ HANDLE hContact;
+
+ SendDlgItemMessageA(hwndDlg, IDC_VIEWMODES, LB_GETTEXT, SendDlgItemMessage(hwndDlg, IDC_VIEWMODES, LB_GETCURSEL, 0, 0), (LPARAM)szBuf);
+ mir_snprintf(szSetting, 256, "%c%s_PF", 246, szBuf);
+ DBDeleteContactSetting(NULL, CLVM_MODULE, szSetting);
+ mir_snprintf(szSetting, 256, "%c%s_GF", 246, szBuf);
+ DBDeleteContactSetting(NULL, CLVM_MODULE, szSetting);
+ mir_snprintf(szSetting, 256, "%c%s_SM", 246, szBuf);
+ DBDeleteContactSetting(NULL, CLVM_MODULE, szSetting);
+ mir_snprintf(szSetting, 256, "%c%s_VA", 246, szBuf);
+ DBDeleteContactSetting(NULL, CLVM_MODULE, szSetting);
+ mir_snprintf(szSetting, 256, "%c%s_SSM", 246, szBuf);
+ DBDeleteContactSetting(NULL, CLVM_MODULE, szSetting);
+ DBDeleteContactSetting(NULL, CLVM_MODULE, szBuf);
+ if (!strcmp(cfg::dat.current_viewmode, szBuf) && lstrlenA(szBuf) == lstrlenA(cfg::dat.current_viewmode)) {
+ cfg::dat.bFilterEffective = 0;
+ pcli->pfnClcBroadcast(CLM_AUTOREBUILD, 0, 0);
+ SetWindowTextA(hwndSelector, Translate("No view mode"));
+ }
+ hContact = db_find_first();
+ while(hContact) {
+ if (cfg::getDword(hContact, "CLVM", szBuf, -1) != -1)
+ cfg::writeDword(hContact, "CLVM", szBuf, 0);
+ hContact = db_find_next(hContact);
+ }
+ SendDlgItemMessage(hwndDlg, IDC_VIEWMODES, LB_DELETESTRING, SendDlgItemMessage(hwndDlg, IDC_VIEWMODES, LB_GETCURSEL, 0, 0), 0);
+ if (SendDlgItemMessage(hwndDlg, IDC_VIEWMODES, LB_SETCURSEL, 0, 0) != LB_ERR) {
+ clvm_curItem = 0;
+ UpdateFilters();
+ }
+ else
+ clvm_curItem = -1;
+ free(szBuf);
+ }
+ }
+ }
+ break;
+ }
+ case IDC_ADDVIEWMODE:
+ {
+ char szBuf[256];
+
+ szBuf[0] = 0;
+ GetDlgItemTextA(hwndDlg, IDC_NEWVIEMODE, szBuf, 256);
+ szBuf[255] = 0;
+
+ if (lstrlenA(szBuf) > 2) {
+ if (cfg::getDword(CLVM_MODULE, szBuf, -1) != -1)
+ MessageBox(0, TranslateT("A view mode with this name does alredy exist"), TranslateT("Duplicate name"), MB_OK);
+ else {
+ int iNewItem = SendDlgItemMessageA(hwndDlg, IDC_VIEWMODES, LB_INSERTSTRING, -1, (LPARAM)szBuf);
+ if (iNewItem != LB_ERR) {
+ SendDlgItemMessage(hwndDlg, IDC_VIEWMODES, LB_SETCURSEL, (WPARAM)iNewItem, 0);
+ SaveViewMode(szBuf, _T(""), "", -1, -1, 0, 0, 0, 0);
+ clvm_curItem = iNewItem;
+ UpdateStickies();
+ SendDlgItemMessage(hwndDlg, IDC_PROTOGROUPOP, CB_SETCURSEL, 0, 0);
+ SendDlgItemMessage(hwndDlg, IDC_GROUPSTATUSOP, CB_SETCURSEL, 0, 0);
+ }
+ }
+ SetDlgItemTextA(hwndDlg, IDC_NEWVIEMODE, "");
+ }
+ Utils::enableDlgControl(hwndDlg, IDC_ADDVIEWMODE, FALSE);
+ break;
+ }
+ case IDC_CLEARALL:
+ {
+ HANDLE hItem;
+ HANDLE hContact = db_find_first();
+
+ while(hContact) {
+ hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0);
+ if (hItem)
+ SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETCHECKMARK, (WPARAM)hItem, 0);
+ hContact = db_find_next(hContact);
+ }
+ }
+ case IDOK:
+ case IDC_APPLY:
+ SaveState();
+ if (cfg::dat.bFilterEffective)
+ ApplyViewMode(cfg::dat.current_viewmode);
+ if (LOWORD(wParam) == IDOK)
+ DestroyWindow(hwndDlg);
+ break;
+ case IDCANCEL:
+ DestroyWindow(hwndDlg);
+ break;
+ }
+ if (LOWORD(wParam) == IDC_NEWVIEMODE && HIWORD(wParam) == EN_CHANGE)
+ Utils::enableDlgControl(hwndDlg, IDC_ADDVIEWMODE, TRUE);
+ if (LOWORD(wParam) == IDC_VIEWMODES && HIWORD(wParam) == LBN_SELCHANGE) {
+ SaveState();
+ clvm_curItem = SendDlgItemMessage(hwndDlg, IDC_VIEWMODES, LB_GETCURSEL, 0, 0);
+ UpdateFilters();
+ }
+ break;
+ case WM_NOTIFY:
+ {
+ switch (((LPNMHDR) lParam)->idFrom) {
+ case IDC_GROUPS:
+ case IDC_STATUSMODES:
+ case IDC_PROTOCOLS:
+ case IDC_CLIST:
+ if (((LPNMHDR) lParam)->code == NM_CLICK || ((LPNMHDR) lParam)->code == CLN_CHECKCHANGED)
+ Utils::enableDlgControl(hwndDlg, IDC_APPLY, TRUE);
+
+ switch (((LPNMHDR)lParam)->code) {
+ case CLN_NEWCONTACT:
+ case CLN_LISTREBUILT:
+ case NM_CLICK:
{
- int bUseLastMsg = IsDlgButtonChecked(hwndDlg, IDC_LASTMSG);
- Utils::enableDlgControl(hwndDlg, IDC_LASTMESSAGEOP, bUseLastMsg);
- Utils::enableDlgControl(hwndDlg, IDC_LASTMESSAGEUNIT, bUseLastMsg);
- Utils::enableDlgControl(hwndDlg, IDC_LASTMSGVALUE, bUseLastMsg);
- Utils::enableDlgControl(hwndDlg, IDC_APPLY, TRUE);
+ NMCLISTCONTROL *nm=(NMCLISTCONTROL*)lParam;
+ if (nm->iColumn==-1)
+ break;
+
+ DWORD hitFlags;
+ HANDLE hItem = (HANDLE)SendDlgItemMessage(hwndDlg,IDC_CLIST,CLM_HITTEST,(WPARAM)&hitFlags,MAKELPARAM(nm->pt.x,nm->pt.y));
+ if (hItem == NULL || !(hitFlags & CLCHT_ONITEMEXTRA))
+ break;
+
+ int iImage = SendDlgItemMessage(hwndDlg,IDC_CLIST,CLM_GETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(nm->iColumn,0));
+ if (iImage == nullImage)
+ iImage = nm->iColumn;
+ else if (iImage!=0xFF)
+ iImage = nullImage;
+ SetIconsForColumn(GetDlgItem(hwndDlg,IDC_CLIST),hItem,hInfoItem,nm->iColumn,iImage);
break;
}
- case IDC_AUTOCLEARVAL:
- case IDC_LASTMSGVALUE:
- if (HIWORD(wParam) == EN_CHANGE && GetFocus() == (HWND)lParam)
- Utils::enableDlgControl(hwndDlg, IDC_APPLY, TRUE);
- break;
- case IDC_DELETEVIEWMODE:
- {
- if (MessageBoxA(0, Translate("Really delete this view mode? This cannot be undone"), Translate("Delete a view mode"), MB_YESNO | MB_ICONQUESTION) == IDYES) {
- char szSetting[256];
- int iLen = SendDlgItemMessage(hwndDlg, IDC_VIEWMODES, LB_GETTEXTLEN, SendDlgItemMessage(hwndDlg, IDC_VIEWMODES, LB_GETCURSEL, 0, 0), 0);
- if (iLen) {
- char *szBuf = ( char* )malloc(iLen + 1);
- if (szBuf) {
- HANDLE hContact;
-
- SendDlgItemMessageA(hwndDlg, IDC_VIEWMODES, LB_GETTEXT, SendDlgItemMessage(hwndDlg, IDC_VIEWMODES, LB_GETCURSEL, 0, 0), (LPARAM)szBuf);
- mir_snprintf(szSetting, 256, "%c%s_PF", 246, szBuf);
- DBDeleteContactSetting(NULL, CLVM_MODULE, szSetting);
- mir_snprintf(szSetting, 256, "%c%s_GF", 246, szBuf);
- DBDeleteContactSetting(NULL, CLVM_MODULE, szSetting);
- mir_snprintf(szSetting, 256, "%c%s_SM", 246, szBuf);
- DBDeleteContactSetting(NULL, CLVM_MODULE, szSetting);
- mir_snprintf(szSetting, 256, "%c%s_VA", 246, szBuf);
- DBDeleteContactSetting(NULL, CLVM_MODULE, szSetting);
- mir_snprintf(szSetting, 256, "%c%s_SSM", 246, szBuf);
- DBDeleteContactSetting(NULL, CLVM_MODULE, szSetting);
- DBDeleteContactSetting(NULL, CLVM_MODULE, szBuf);
- if (!strcmp(cfg::dat.current_viewmode, szBuf) && lstrlenA(szBuf) == lstrlenA(cfg::dat.current_viewmode)) {
- cfg::dat.bFilterEffective = 0;
- pcli->pfnClcBroadcast(CLM_AUTOREBUILD, 0, 0);
- SetWindowTextA(hwndSelector, Translate("No view mode"));
- }
- hContact = db_find_first();
- while(hContact) {
- if (cfg::getDword(hContact, "CLVM", szBuf, -1) != -1)
- cfg::writeDword(hContact, "CLVM", szBuf, 0);
- hContact = db_find_next(hContact);
- }
- SendDlgItemMessage(hwndDlg, IDC_VIEWMODES, LB_DELETESTRING, SendDlgItemMessage(hwndDlg, IDC_VIEWMODES, LB_GETCURSEL, 0, 0), 0);
- if (SendDlgItemMessage(hwndDlg, IDC_VIEWMODES, LB_SETCURSEL, 0, 0) != LB_ERR) {
- clvm_curItem = 0;
- UpdateFilters();
- }
- else
- clvm_curItem = -1;
- free(szBuf);
- }
- }
- }
- break;
- }
- case IDC_ADDVIEWMODE:
- {
- char szBuf[256];
-
- szBuf[0] = 0;
- GetDlgItemTextA(hwndDlg, IDC_NEWVIEMODE, szBuf, 256);
- szBuf[255] = 0;
-
- if (lstrlenA(szBuf) > 2) {
- if (cfg::getDword(CLVM_MODULE, szBuf, -1) != -1)
- MessageBox(0, TranslateT("A view mode with this name does alredy exist"), TranslateT("Duplicate name"), MB_OK);
- else {
- int iNewItem = SendDlgItemMessageA(hwndDlg, IDC_VIEWMODES, LB_INSERTSTRING, -1, (LPARAM)szBuf);
- if (iNewItem != LB_ERR) {
- SendDlgItemMessage(hwndDlg, IDC_VIEWMODES, LB_SETCURSEL, (WPARAM)iNewItem, 0);
- SaveViewMode(szBuf, _T(""), "", -1, -1, 0, 0, 0, 0);
- clvm_curItem = iNewItem;
- UpdateStickies();
- SendDlgItemMessage(hwndDlg, IDC_PROTOGROUPOP, CB_SETCURSEL, 0, 0);
- SendDlgItemMessage(hwndDlg, IDC_GROUPSTATUSOP, CB_SETCURSEL, 0, 0);
- }
- }
- SetDlgItemTextA(hwndDlg, IDC_NEWVIEMODE, "");
- }
- Utils::enableDlgControl(hwndDlg, IDC_ADDVIEWMODE, FALSE);
- break;
- }
- case IDC_CLEARALL:
- {
- HANDLE hItem;
- HANDLE hContact = db_find_first();
-
- while(hContact) {
- hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0);
- if (hItem)
- SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETCHECKMARK, (WPARAM)hItem, 0);
- hContact = db_find_next(hContact);
- }
- }
- case IDOK:
- case IDC_APPLY:
- SaveState();
- if (cfg::dat.bFilterEffective)
- ApplyViewMode(cfg::dat.current_viewmode);
- if (LOWORD(wParam) == IDOK)
- DestroyWindow(hwndDlg);
- break;
- case IDCANCEL:
- DestroyWindow(hwndDlg);
- break;
- }
- if (LOWORD(wParam) == IDC_NEWVIEMODE && HIWORD(wParam) == EN_CHANGE)
- Utils::enableDlgControl(hwndDlg, IDC_ADDVIEWMODE, TRUE);
- if (LOWORD(wParam) == IDC_VIEWMODES && HIWORD(wParam) == LBN_SELCHANGE) {
- SaveState();
- clvm_curItem = SendDlgItemMessage(hwndDlg, IDC_VIEWMODES, LB_GETCURSEL, 0, 0);
- UpdateFilters();
- }
- break;
- case WM_NOTIFY:
- {
- switch (((LPNMHDR) lParam)->idFrom) {
- case IDC_GROUPS:
- case IDC_STATUSMODES:
- case IDC_PROTOCOLS:
- case IDC_CLIST:
- if (((LPNMHDR) lParam)->code == NM_CLICK || ((LPNMHDR) lParam)->code == CLN_CHECKCHANGED)
- Utils::enableDlgControl(hwndDlg, IDC_APPLY, TRUE);
- switch (((LPNMHDR)lParam)->code)
- {
- case CLN_NEWCONTACT:
- case CLN_LISTREBUILT:
- //SetAllContactIcons(GetDlgItem(hwndDlg,IDC_CLIST));
- //fall through
- /*
- case CLN_CONTACTMOVED:
- SetListGroupIcons(GetDlgItem(hwndDlg,IDC_LIST),(HANDLE)SendDlgItemMessage(hwndDlg,IDC_LIST,CLM_GETNEXTITEM,CLGN_ROOT,0),hItemAll,NULL);
- break;
- case CLN_OPTIONSCHANGED:
- ResetListOptions(GetDlgItem(hwndDlg,IDC_LIST));
- break;
- case CLN_CHECKCHANGED:
- {
- HANDLE hItem;
- NMCLISTCONTROL *nm=(NMCLISTCONTROL*)lParam;
- int typeOfItem = SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETITEMTYPE,(WPARAM)nm->hItem, 0);
- break;
- }*/
- case NM_CLICK:
- {
- HANDLE hItem;
- NMCLISTCONTROL *nm=(NMCLISTCONTROL*)lParam;
- DWORD hitFlags;
- int iImage;
-
- if (nm->iColumn==-1)
- break;
- hItem = (HANDLE)SendDlgItemMessage(hwndDlg,IDC_CLIST,CLM_HITTEST,(WPARAM)&hitFlags,MAKELPARAM(nm->pt.x,nm->pt.y));
- if (hItem==NULL) break;
- if (!(hitFlags&CLCHT_ONITEMEXTRA))
- break;
- iImage = SendDlgItemMessage(hwndDlg,IDC_CLIST,CLM_GETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(nm->iColumn,0));
- if (iImage == nullImage)
- iImage = nm->iColumn;
- else if (iImage!=0xFF)
- iImage = nullImage;
- SetIconsForColumn(GetDlgItem(hwndDlg,IDC_CLIST),hItem,hInfoItem,nm->iColumn,iImage);
- //SetListGroupIcons(GetDlgItem(hwndDlg,IDC_CLIST),(HANDLE)SendDlgItemMessage(hwndDlg,IDC_LIST,CLM_GETNEXTITEM,CLGN_ROOT,0),hInfoItem,NULL);
- break;
- }
- }
- break;
- case IDC_TAB:
- if (((LPNMHDR) lParam)->code == TCN_SELCHANGE) {
- int id = TabCtrl_GetCurSel(GetDlgItem(hwndDlg, IDC_TAB));
- if (id == 0)
- ShowPage(hwndDlg, 0);
- else
- ShowPage(hwndDlg, 1);
- break;
- }
-
- }
- break;
- }
- case WM_DESTROY:
- ImageList_RemoveAll(himlViewModes);
- ImageList_Destroy(himlViewModes);
- g_ViewModeOptDlg = FALSE;
- break;
- }
- return FALSE;
+ }
+ break;
+ case IDC_TAB:
+ if (((LPNMHDR) lParam)->code == TCN_SELCHANGE) {
+ int id = TabCtrl_GetCurSel(GetDlgItem(hwndDlg, IDC_TAB));
+ if (id == 0)
+ ShowPage(hwndDlg, 0);
+ else
+ ShowPage(hwndDlg, 1);
+ break;
+ }
+ }
+ break;
+ }
+ case WM_DESTROY:
+ ImageList_RemoveAll(himlViewModes);
+ ImageList_Destroy(himlViewModes);
+ g_ViewModeOptDlg = FALSE;
+ break;
+ }
+ return FALSE;
}
static int menuCounter = 0;
static int FillMenuCallback(char *szSetting)
{
- if (szSetting[0] == (char)246)
- return 1;
+ if (szSetting[0] == (char)246)
+ return 1;
- AppendMenuA(hViewModeMenu, MF_STRING, menuCounter++, szSetting);
- return 1;
+ AppendMenuA(hViewModeMenu, MF_STRING, menuCounter++, szSetting);
+ return 1;
}
void BuildViewModeMenu()
{
- if (hViewModeMenu)
- DestroyMenu(hViewModeMenu);
+ if (hViewModeMenu)
+ DestroyMenu(hViewModeMenu);
- menuCounter = 100;
- hViewModeMenu = CreatePopupMenu();
- CLVM_EnumModes(FillMenuCallback);
+ menuCounter = 100;
+ hViewModeMenu = CreatePopupMenu();
+ CLVM_EnumModes(FillMenuCallback);
if (GetMenuItemCount(hViewModeMenu) > 0)
AppendMenu(hViewModeMenu, MF_SEPARATOR, 0, NULL);
AppendMenu(hViewModeMenu, MF_STRING, 10001, TranslateT("Setup View Modes..."));
AppendMenu(hViewModeMenu, MF_STRING, 10002, TranslateT("Clear current View Mode"));
-
}
static UINT _buttons[] = {IDC_RESETMODES, IDC_SELECTMODE, IDC_CONFIGUREMODES, 0};
@@ -963,13 +931,11 @@ LRESULT CALLBACK ViewModeFrameWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hwnd, &ps);
RECT rc;
- //HDC hdc = (HDC)wParam;
HDC hdcMem = CreateCompatibleDC(hdc);
- HBITMAP hbm, hbmold;
GetClientRect(hwnd, &rc);
- hbm = CreateCompatibleBitmap(hdc, rc.right, rc.bottom);
- hbmold = (HBITMAP)SelectObject(hdcMem, hbm);
+ HBITMAP hbm = CreateCompatibleBitmap(hdc, rc.right, rc.bottom);
+ HBITMAP hbmold = (HBITMAP)SelectObject(hdcMem, hbm);
if (cfg::dat.bWallpaperMode)
SkinDrawBg(hwnd, hdcMem);
@@ -980,9 +946,6 @@ LRESULT CALLBACK ViewModeFrameWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
SelectObject(hdcMem, hbmold);
DeleteObject(hbm);
DeleteDC(hdcMem);
- //InvalidateRect(GetDlgItem(hwnd, IDC_RESETMODES), NULL, FALSE);
- //InvalidateRect(GetDlgItem(hwnd, IDC_CONFIGUREMODES), NULL, FALSE);
- //InvalidateRect(GetDlgItem(hwnd, IDC_SELECTMODE), NULL, FALSE);
EndPaint(hwnd, &ps);
return 0;
}
@@ -1058,8 +1021,9 @@ clvm_config_command:
CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_OPT_VIEWMODES), 0, DlgProcViewModesSetup, 0);
break;
}
- break;
}
+ break;
+
default:
return DefWindowProc(hwnd, msg, wParam, lParam);
}
@@ -1071,177 +1035,129 @@ HWND g_hwndViewModeFrame;
void CreateViewModeFrame()
{
- CLISTFrame frame = {0};
- WNDCLASS wndclass = {0};
-
- wndclass.style = 0;
- wndclass.lpfnWndProc = ViewModeFrameWndProc;
- 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("CLVMFrameWindow");
-
- RegisterClass(&wndclass);
-
- ZeroMemory(&frame, sizeof(frame));
- frame.cbSize = sizeof(frame);
- frame.tname = _T("View modes");
- frame.TBtname = TranslateT("View Modes");
- frame.hIcon = 0;
- frame.height = 22;
- frame.Flags=F_VISIBLE|F_SHOWTBTIP|F_NOBORDER|F_TCHAR;
- frame.align = alBottom;
- frame.hWnd = CreateWindowEx(0, _T("CLVMFrameWindow"), _T("CLVM"), WS_VISIBLE | WS_CHILD | WS_TABSTOP | WS_CLIPCHILDREN, 0, 0, 20, 20, pcli->hwndContactList, (HMENU) 0, g_hInst, NULL);
- g_hwndViewModeFrame = frame.hWnd;
- hCLVMFrame = (HWND)CallService(MS_CLIST_FRAMES_ADDFRAME,(WPARAM)&frame,0);
- CallService(MS_CLIST_FRAMES_UPDATEFRAME, (WPARAM)hCLVMFrame, FU_FMPOS);
+ CLISTFrame frame = {0};
+ WNDCLASS wndclass = {0};
+
+ wndclass.style = 0;
+ wndclass.lpfnWndProc = ViewModeFrameWndProc;
+ 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("CLVMFrameWindow");
+
+ RegisterClass(&wndclass);
+
+ ZeroMemory(&frame, sizeof(frame));
+ frame.cbSize = sizeof(frame);
+ frame.tname = _T("View modes");
+ frame.TBtname = TranslateT("View Modes");
+ frame.hIcon = 0;
+ frame.height = 22;
+ frame.Flags=F_VISIBLE|F_SHOWTBTIP|F_NOBORDER|F_TCHAR;
+ frame.align = alBottom;
+ frame.hWnd = CreateWindowEx(0, _T("CLVMFrameWindow"), _T("CLVM"), WS_VISIBLE | WS_CHILD | WS_TABSTOP | WS_CLIPCHILDREN, 0, 0, 20, 20, pcli->hwndContactList, (HMENU) 0, g_hInst, NULL);
+ g_hwndViewModeFrame = frame.hWnd;
+ hCLVMFrame = (HWND)CallService(MS_CLIST_FRAMES_ADDFRAME,(WPARAM)&frame,0);
+ CallService(MS_CLIST_FRAMES_UPDATEFRAME, (WPARAM)hCLVMFrame, FU_FMPOS);
}
const char *MakeVariablesString(const char *src, const char *UIN);
void ApplyViewMode(const char *name)
{
- char szSetting[256];
- DBVARIANT dbv = {0};
-
- cfg::dat.bFilterEffective = 0;
-
- mir_snprintf(szSetting, 256, "%c%s_PF", 246, name);
- if (!cfg::getString(NULL, CLVM_MODULE, szSetting, &dbv)) {
- if (lstrlenA(dbv.pszVal) >= 2) {
- strncpy(cfg::dat.protoFilter, dbv.pszVal, sizeof(cfg::dat.protoFilter));
- cfg::dat.protoFilter[sizeof(cfg::dat.protoFilter) - 1] = 0;
- cfg::dat.bFilterEffective |= CLVM_FILTER_PROTOS;
- }
- mir_free(dbv.pszVal);
- }
- mir_snprintf(szSetting, 256, "%c%s_GF", 246, name);
- if (!cfg::getTString(NULL, CLVM_MODULE, szSetting, &dbv)) {
- if (lstrlen(dbv.ptszVal) >= 2) {
- _tcsncpy(cfg::dat.groupFilter, dbv.ptszVal, safe_sizeof(cfg::dat.groupFilter));
- cfg::dat.groupFilter[safe_sizeof(cfg::dat.groupFilter) - 1] = 0;
- cfg::dat.bFilterEffective |= CLVM_FILTER_GROUPS;
- }
- mir_free(dbv.ptszVal);
- }
- mir_snprintf(szSetting, 256, "%c%s_SM", 246, name);
- cfg::dat.statusMaskFilter = cfg::getDword(CLVM_MODULE, szSetting, -1);
- if (cfg::dat.statusMaskFilter >= 1)
- cfg::dat.bFilterEffective |= CLVM_FILTER_STATUS;
-
- mir_snprintf(szSetting, 256, "%c%s_SSM", 246, name);
- cfg::dat.stickyMaskFilter = cfg::getDword(CLVM_MODULE, szSetting, -1);
- if (cfg::dat.stickyMaskFilter != -1)
- cfg::dat.bFilterEffective |= CLVM_FILTER_STICKYSTATUS;
-
- /*
- mir_snprintf(szSetting, 256, "%c%s_VA", 246, name);
- if (!DBGetContactSettingString(NULL, CLVM_MODULE, szSetting, &dbv)) {
- strncpy(g_CluiData.varFilter, dbv.pszVal, sizeof(g_CluiData.varFilter));
- g_CluiData.varFilter[sizeof(g_CluiData.varFilter) - 1] = 0;
- if (lstrlenA(g_CluiData.varFilter) > 10 && ServiceExists(MS_VARS_FORMATSTRING))
- g_CluiData.bFilterEffective |= CLVM_FILTER_VARIABLES;
- mir_free(dbv.ptszVal);
- if (g_CluiData.bFilterEffective & CLVM_FILTER_VARIABLES) {
- HANDLE hContact = db_find_first();
- char UIN[256];
- char *id, *szProto;
- const char *varstring;
- char *temp;
- FORMATINFO fi;
-
- while(hContact) {
- szProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
- if (szProto) {
- id = (char*) CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
- if (id) {
- if (!DBGetContactSetting(hContact, szProto, id, &dbv)) {
- if (dbv.type == DBVT_ASCIIZ) {
- mir_snprintf(UIN, 256, "<%s:%s>", szProto, dbv.pszVal);
- }
- else {
- mir_snprintf(UIN, 256, "<%s:%d>", szProto, dbv.dVal);
- }
- varstring = MakeVariablesString(g_CluiData.varFilter, UIN);
- ZeroMemory(&fi, sizeof(fi));
- fi.cbSize = sizeof(fi);
- fi.szFormat = varstring;
- fi.szSource = "";
- fi.hContact = 0;
- temp = (char *)CallService(MS_VARS_FORMATSTRING, (WPARAM)&fi, 0);
- if (temp && atol(temp) > 0)
- _DebugPopup(hContact, "%s, %d, %d, %d", temp, temp, fi.pCount, fi.eCount);
- variables_free(temp);
- DBFreeVariant(&dbv);
- }
- }
- }
- hContact = db_find_next(hContact);
- }
- }
- }*/
-
- cfg::dat.filterFlags = cfg::getDword(CLVM_MODULE, name, 0);
-
- KillTimer(g_hwndViewModeFrame, TIMERID_VIEWMODEEXPIRE);
-
- if (cfg::dat.filterFlags & CLVM_AUTOCLEAR) {
- DWORD timerexpire;
- mir_snprintf(szSetting, 256, "%c%s_OPT", 246, name);
- timerexpire = LOWORD(cfg::getDword(CLVM_MODULE, szSetting, 0));
- strncpy(cfg::dat.old_viewmode, cfg::dat.current_viewmode, 256);
- cfg::dat.old_viewmode[255] = 0;
- SetTimer(g_hwndViewModeFrame, TIMERID_VIEWMODEEXPIRE, timerexpire * 1000, NULL);
- }
- strncpy(cfg::dat.current_viewmode, name, 256);
- cfg::dat.current_viewmode[255] = 0;
+ char szSetting[256];
+ DBVARIANT dbv = {0};
+
+ cfg::dat.bFilterEffective = 0;
+
+ mir_snprintf(szSetting, 256, "%c%s_PF", 246, name);
+ if (!cfg::getString(NULL, CLVM_MODULE, szSetting, &dbv)) {
+ if (lstrlenA(dbv.pszVal) >= 2) {
+ strncpy(cfg::dat.protoFilter, dbv.pszVal, sizeof(cfg::dat.protoFilter));
+ cfg::dat.protoFilter[sizeof(cfg::dat.protoFilter) - 1] = 0;
+ cfg::dat.bFilterEffective |= CLVM_FILTER_PROTOS;
+ }
+ mir_free(dbv.pszVal);
+ }
+ mir_snprintf(szSetting, 256, "%c%s_GF", 246, name);
+ if (!cfg::getTString(NULL, CLVM_MODULE, szSetting, &dbv)) {
+ if (lstrlen(dbv.ptszVal) >= 2) {
+ _tcsncpy(cfg::dat.groupFilter, dbv.ptszVal, safe_sizeof(cfg::dat.groupFilter));
+ cfg::dat.groupFilter[safe_sizeof(cfg::dat.groupFilter) - 1] = 0;
+ cfg::dat.bFilterEffective |= CLVM_FILTER_GROUPS;
+ }
+ mir_free(dbv.ptszVal);
+ }
+ mir_snprintf(szSetting, 256, "%c%s_SM", 246, name);
+ cfg::dat.statusMaskFilter = cfg::getDword(CLVM_MODULE, szSetting, -1);
+ if (cfg::dat.statusMaskFilter >= 1)
+ cfg::dat.bFilterEffective |= CLVM_FILTER_STATUS;
+
+ mir_snprintf(szSetting, 256, "%c%s_SSM", 246, name);
+ cfg::dat.stickyMaskFilter = cfg::getDword(CLVM_MODULE, szSetting, -1);
+ if (cfg::dat.stickyMaskFilter != -1)
+ cfg::dat.bFilterEffective |= CLVM_FILTER_STICKYSTATUS;
+
+ cfg::dat.filterFlags = cfg::getDword(CLVM_MODULE, name, 0);
+
+ KillTimer(g_hwndViewModeFrame, TIMERID_VIEWMODEEXPIRE);
+
+ if (cfg::dat.filterFlags & CLVM_AUTOCLEAR) {
+ DWORD timerexpire;
+ mir_snprintf(szSetting, 256, "%c%s_OPT", 246, name);
+ timerexpire = LOWORD(cfg::getDword(CLVM_MODULE, szSetting, 0));
+ strncpy(cfg::dat.old_viewmode, cfg::dat.current_viewmode, 256);
+ cfg::dat.old_viewmode[255] = 0;
+ SetTimer(g_hwndViewModeFrame, TIMERID_VIEWMODEEXPIRE, timerexpire * 1000, NULL);
+ }
+ strncpy(cfg::dat.current_viewmode, name, 256);
+ cfg::dat.current_viewmode[255] = 0;
if (cfg::dat.filterFlags & CLVM_USELASTMSG) {
- DWORD unit;
- int i;
BYTE bSaved = cfg::dat.sortOrder[0];
cfg::dat.sortOrder[0] = SORTBY_LASTMSG;
- for (i = 0; i < cfg::nextCacheEntry; i++)
+ for (int i = 0; i < cfg::nextCacheEntry; i++)
cfg::eCache[i].dwLastMsgTime = INTSORT_GetLastMsgTime(cfg::eCache[i].hContact);
cfg::dat.sortOrder[0] = bSaved;
cfg::dat.bFilterEffective |= CLVM_FILTER_LASTMSG;
- mir_snprintf(szSetting, 256, "%c%s_LM", 246, name);
- cfg::dat.lastMsgFilter = cfg::getDword(CLVM_MODULE, szSetting, 0);
+ mir_snprintf(szSetting, 256, "%c%s_LM", 246, name);
+ cfg::dat.lastMsgFilter = cfg::getDword(CLVM_MODULE, szSetting, 0);
if (LOBYTE(HIWORD(cfg::dat.lastMsgFilter)))
cfg::dat.bFilterEffective |= CLVM_FILTER_LASTMSG_NEWERTHAN;
else
cfg::dat.bFilterEffective |= CLVM_FILTER_LASTMSG_OLDERTHAN;
- unit = LOWORD(cfg::dat.lastMsgFilter);
+
+ DWORD unit = LOWORD(cfg::dat.lastMsgFilter);
switch(HIBYTE(HIWORD(cfg::dat.lastMsgFilter))) {
- case 0:
- unit *= 60;
- break;
- case 1:
- unit *= 3600;
- break;
- case 2:
- unit *= 86400;
- break;
+ case 0:
+ unit *= 60;
+ break;
+ case 1:
+ unit *= 3600;
+ break;
+ case 2:
+ unit *= 86400;
+ break;
}
cfg::dat.lastMsgFilter = unit;
}
if (HIWORD(cfg::dat.filterFlags) > 0)
- cfg::dat.bFilterEffective |= CLVM_STICKY_CONTACTS;
+ cfg::dat.bFilterEffective |= CLVM_STICKY_CONTACTS;
- if (cfg::dat.boldHideOffline == (BYTE)-1)
- cfg::dat.boldHideOffline = cfg::getByte("CList", "HideOffline", 0);
+ if (cfg::dat.boldHideOffline == (BYTE)-1)
+ cfg::dat.boldHideOffline = cfg::getByte("CList", "HideOffline", 0);
- CallService(MS_CLIST_SETHIDEOFFLINE, 0, 0);
- SetWindowTextA(hwndSelector, name);
- pcli->pfnClcBroadcast(CLM_AUTOREBUILD, 0, 0);
+ CallService(MS_CLIST_SETHIDEOFFLINE, 0, 0);
+ SetWindowTextA(hwndSelector, name);
+ pcli->pfnClcBroadcast(CLM_AUTOREBUILD, 0, 0);
- cfg::writeString(NULL, "CList", "LastViewMode", cfg::dat.current_viewmode);
+ cfg::writeString(NULL, "CList", "LastViewMode", cfg::dat.current_viewmode);
}