summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-11-10 20:18:48 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-11-10 20:18:48 +0000
commit22377c8be5548d37deee4258b315c2e5f1b42bca (patch)
tree359febdaa0dbc9efaf6384259ce43a3fcb03fadb
parent2e57f9842aa2da2985bfc36bcc85d1124f2dbb3f (diff)
- fixed crazy drawing bug in nicer;
- code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@2281 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--plugins/Clist_nicer/src/clcpaint.cpp28
-rw-r--r--src/modules/clist/clc.cpp54
-rw-r--r--src/modules/clist/clcmsgs.cpp44
-rw-r--r--src/modules/clist/clistevents.cpp4
-rw-r--r--src/modules/clist/clistmod.cpp2
-rw-r--r--src/modules/clist/clui.cpp6
-rw-r--r--src/modules/clist/contact.cpp6
-rw-r--r--src/modules/extraicons/DefaultExtraIcons.cpp8
-rw-r--r--src/modules/visibility/visibility.cpp348
9 files changed, 248 insertions, 252 deletions
diff --git a/plugins/Clist_nicer/src/clcpaint.cpp b/plugins/Clist_nicer/src/clcpaint.cpp
index 5c92e82748..7801c0237d 100644
--- a/plugins/Clist_nicer/src/clcpaint.cpp
+++ b/plugins/Clist_nicer/src/clcpaint.cpp
@@ -955,22 +955,20 @@ bgskipped:
}
else iconXSpace = 0;
- if (type == CLCIT_CONTACT && !dat->bisEmbedded) {
+ if (type == CLCIT_CONTACT) {
contact->extraIconRightBegin = 0;
- if (cEntry && (contact->extraCacheEntry >= 0 && contact->extraCacheEntry < cfg::nextCacheEntry)) {
- for (int i = dat->extraColumnsCount-1; i >= 0; i--) {
- if (contact->iExtraImage[i] == EMPTY_EXTRA_ICON)
- continue;
-
- if (contact->extraIconRightBegin == 0)
- contact->extraIconRightBegin = rcContent.right;
-
- rightIcons++;
- ImageList_DrawEx(dat->himlExtraColumns, contact->iExtraImage[i], hdcMem,
- rcContent.right - dat->extraColumnSpacing * rightIcons,
- y + (rowHeight - g_cysmIcon)/2,
- 0, 0, CLR_NONE, CLR_NONE, ILD_NORMAL);
- }
+ for (int i = dat->extraColumnsCount-1; i >= 0; i--) {
+ if (contact->iExtraImage[i] == EMPTY_EXTRA_ICON)
+ continue;
+
+ if (contact->extraIconRightBegin == 0)
+ contact->extraIconRightBegin = rcContent.right;
+
+ rightIcons++;
+ ImageList_DrawEx(dat->himlExtraColumns, contact->iExtraImage[i], hdcMem,
+ rcContent.right - dat->extraColumnSpacing * rightIcons,
+ y + (rowHeight - g_cysmIcon)/2,
+ 0, 0, CLR_NONE, CLR_NONE, ILD_NORMAL);
}
}
}
diff --git a/src/modules/clist/clc.cpp b/src/modules/clist/clc.cpp
index 3f2e64d472..ea1e92877e 100644
--- a/src/modules/clist/clc.cpp
+++ b/src/modules/clist/clc.cpp
@@ -78,7 +78,7 @@ static int ClcSettingChanged(WPARAM wParam, LPARAM lParam)
if ( !strcmp(cws->szModule, "CList")) {
if ( !strcmp(cws->szSetting, "MyHandle")) {
- cli.pfnInvalidateDisplayNameCacheEntry((HANDLE) wParam);
+ cli.pfnInvalidateDisplayNameCacheEntry((HANDLE)wParam);
cli.pfnClcBroadcast(INTM_NAMECHANGED, wParam, lParam);
}
else if ( !strcmp(cws->szSetting, "Group"))
@@ -446,13 +446,13 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
break;
case INTM_CONTACTADDED:
- cli.pfnAddContactToTree(hwnd, dat, (HANDLE) wParam, 1, 1);
- cli.pfnNotifyNewContact(hwnd, (HANDLE) wParam);
+ cli.pfnAddContactToTree(hwnd, dat, (HANDLE)wParam, 1, 1);
+ cli.pfnNotifyNewContact(hwnd, (HANDLE)wParam);
SortClcByTimer(hwnd);
break;
case INTM_CONTACTDELETED:
- cli.pfnDeleteItemFromTree(hwnd, (HANDLE) wParam);
+ cli.pfnDeleteItemFromTree(hwnd, (HANDLE)wParam);
SortClcByTimer(hwnd);
break;
@@ -462,12 +462,12 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
if (GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_SHOWHIDDEN)
break;
if (dbcws->value.type == DBVT_DELETED || dbcws->value.bVal == 0) {
- if (cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, NULL, NULL, NULL))
+ if (cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, NULL, NULL, NULL))
break;
- cli.pfnAddContactToTree(hwnd, dat, (HANDLE) wParam, 1, 1);
- cli.pfnNotifyNewContact(hwnd, (HANDLE) wParam);
+ cli.pfnAddContactToTree(hwnd, dat, (HANDLE)wParam, 1, 1);
+ cli.pfnNotifyNewContact(hwnd, (HANDLE)wParam);
}
- else cli.pfnDeleteItemFromTree(hwnd, (HANDLE) wParam);
+ else cli.pfnDeleteItemFromTree(hwnd, (HANDLE)wParam);
dat->needsResort = 1;
SortClcByTimer(hwnd);
@@ -478,17 +478,17 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
{
WORD iExtraImage[EXTRA_ICON_COUNT];
BYTE flags = 0;
- if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
+ if ( !cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL))
memset(iExtraImage, 0xFF, sizeof(iExtraImage));
else {
memcpy(iExtraImage, contact->iExtraImage, sizeof(iExtraImage));
flags = contact->flags;
}
- cli.pfnDeleteItemFromTree(hwnd, (HANDLE) wParam);
- if (GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_SHOWHIDDEN || !db_get_b((HANDLE) wParam, "CList", "Hidden", 0)) {
+ cli.pfnDeleteItemFromTree(hwnd, (HANDLE)wParam);
+ if (GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_SHOWHIDDEN || !db_get_b((HANDLE)wParam, "CList", "Hidden", 0)) {
NMCLISTCONTROL nm;
- cli.pfnAddContactToTree(hwnd, dat, (HANDLE) wParam, 1, 1);
- if (cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL)) {
+ cli.pfnAddContactToTree(hwnd, dat, (HANDLE)wParam, 1, 1);
+ if (cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) {
memcpy(contact->iExtraImage, iExtraImage, sizeof(iExtraImage));
if (flags & CONTACTF_CHECKED)
contact->flags |= CONTACTF_CHECKED;
@@ -497,7 +497,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
nm.hdr.hwndFrom = hwnd;
nm.hdr.idFrom = GetDlgCtrlID(hwnd);
nm.flags = 0;
- nm.hItem = (HANDLE) wParam;
+ nm.hItem = (HANDLE)wParam;
SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM) & nm);
dat->needsResort = 1;
}
@@ -516,25 +516,25 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
if (szProto == NULL)
status = ID_STATUS_OFFLINE;
else
- status = DBGetContactSettingWord((HANDLE) wParam, szProto, "Status", ID_STATUS_OFFLINE);
+ status = DBGetContactSettingWord((HANDLE)wParam, szProto, "Status", ID_STATUS_OFFLINE);
// this means an offline msg is flashing, so the contact should be shown
DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE);
- shouldShow = (style & CLS_SHOWHIDDEN || !db_get_b((HANDLE) wParam, "CList", "Hidden", 0))
+ shouldShow = (style & CLS_SHOWHIDDEN || !db_get_b((HANDLE)wParam, "CList", "Hidden", 0))
&& ( !cli.pfnIsHiddenMode(dat, status) || CallService(MS_CLIST_GETCONTACTICON, wParam, 0) != lParam);
contact = NULL;
group = NULL;
- if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, &group, NULL)) {
+ if ( !cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, &group, NULL)) {
if (shouldShow && CallService(MS_DB_CONTACT_IS, wParam, 0)) {
if (dat->selection >= 0 && cli.pfnGetRowByIndex(dat, dat->selection, &selcontact, NULL) != -1)
hSelItem = cli.pfnContactToHItem(selcontact);
- cli.pfnAddContactToTree(hwnd, dat, (HANDLE) wParam, (style & CLS_CONTACTLIST) == 0, 0);
+ cli.pfnAddContactToTree(hwnd, dat, (HANDLE)wParam, (style & CLS_CONTACTLIST) == 0, 0);
recalcScrollBar = 1;
- cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL);
+ cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL);
if (contact) {
contact->iImage = (WORD) lParam;
- cli.pfnNotifyNewContact(hwnd, (HANDLE) wParam);
+ cli.pfnNotifyNewContact(hwnd, (HANDLE)wParam);
dat->needsResort = 1;
}
}
@@ -569,7 +569,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
break;
case INTM_NAMECHANGED:
- if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
+ if ( !cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL))
break;
lstrcpyn(contact->szText, cli.pfnGetContactDisplayName((HANDLE)wParam, 0), SIZEOF(contact->szText));
@@ -578,7 +578,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
break;
case INTM_PROTOCHANGED:
- if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
+ if ( !cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL))
break;
contact->proto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0);
@@ -588,7 +588,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
break;
case INTM_NOTONLISTCHANGED:
- if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
+ if ( !cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL))
break;
if (contact->type == CLCIT_CONTACT) {
@@ -606,12 +606,12 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
break;
case INTM_APPARENTMODECHANGED:
- if ( cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL)) {
+ if ( cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) {
char *szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0);
if (szProto == NULL)
break;
- WORD apparentMode = DBGetContactSettingWord((HANDLE) wParam, szProto, "ApparentMode", 0);
+ WORD apparentMode = DBGetContactSettingWord((HANDLE)wParam, szProto, "ApparentMode", 0);
contact->flags &= ~(CONTACTF_INVISTO | CONTACTF_VISTO);
if (apparentMode == ID_STATUS_OFFLINE)
contact->flags |= CONTACTF_INVISTO;
@@ -628,12 +628,12 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
break;
case INTM_IDLECHANGED:
- if ( cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL)) {
+ if ( cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) {
char *szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0);
if (szProto == NULL)
break;
contact->flags &= ~CONTACTF_IDLE;
- if (db_get_dw((HANDLE) wParam, szProto, "IdleTS", 0))
+ if (db_get_dw((HANDLE)wParam, szProto, "IdleTS", 0))
contact->flags |= CONTACTF_IDLE;
cli.pfnInvalidateRect(hwnd, NULL, FALSE);
diff --git a/src/modules/clist/clcmsgs.cpp b/src/modules/clist/clcmsgs.cpp
index c6f7ad3157..b34eafc52c 100644
--- a/src/modules/clist/clcmsgs.cpp
+++ b/src/modules/clist/clcmsgs.cpp
@@ -29,7 +29,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR
{
switch (msg) {
case CLM_ADDCONTACT:
- cli.pfnAddContactToTree(hwnd, dat, (HANDLE) wParam, 1, 0);
+ cli.pfnAddContactToTree(hwnd, dat, (HANDLE)wParam, 1, 0);
cli.pfnRecalcScrollBar(hwnd, dat);
cli.pfnSortCLC(hwnd, dat, 1);
break;
@@ -77,7 +77,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR
break;
case CLM_DELETEITEM:
- cli.pfnDeleteItemFromTree(hwnd, (HANDLE) wParam);
+ cli.pfnDeleteItemFromTree(hwnd, (HANDLE)wParam);
cli.pfnSortCLC(hwnd, dat, 1);
cli.pfnRecalcScrollBar(hwnd, dat);
break;
@@ -95,7 +95,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR
{
ClcContact *contact;
ClcGroup *group, *tgroup;
- if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, &group, NULL))
+ if ( !cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, &group, NULL))
break;
for (tgroup = group; tgroup; tgroup = tgroup->parent)
cli.pfnSetGroupExpand(hwnd, dat, tgroup, 1);
@@ -106,7 +106,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR
case CLM_EXPAND:
{
ClcContact *contact;
- if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
+ if ( !cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL))
break;
if (contact->type != CLCIT_GROUP)
break;
@@ -115,7 +115,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR
}
case CLM_FINDCONTACT:
- if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, NULL, NULL, NULL))
+ if ( !cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, NULL, NULL, NULL))
return (LRESULT)(HANDLE) NULL;
return wParam;
@@ -130,7 +130,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR
case CLM_GETCHECKMARK:
{
ClcContact *contact;
- if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
+ if ( !cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL))
return 0;
return (contact->flags & CONTACTF_CHECKED) != 0;
}
@@ -144,7 +144,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR
case CLM_GETEXPAND:
{
ClcContact *contact;
- if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
+ if ( !cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL))
return CLE_INVALID;
if (contact->type != CLCIT_GROUP)
return CLE_INVALID;
@@ -162,7 +162,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR
case CLM_GETEXTRAIMAGE:
if (LOWORD(lParam) < dat->extraColumnsCount) {
ClcContact *contact;
- if ( cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
+ if ( cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL))
return contact->iExtraImage[LOWORD(lParam)];
}
return EMPTY_EXTRA_ICON;
@@ -188,7 +188,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR
case CLM_GETITEMTEXT:
{
ClcContact *contact;
- if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
+ if ( !cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL))
return 0;
lstrcpy((TCHAR*) lParam, contact->szText);
return lstrlen(contact->szText);
@@ -197,7 +197,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR
case CLM_GETITEMTYPE:
{
ClcContact *contact;
- if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
+ if ( !cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL))
return CLCIT_INVALID;
return contact->type;
}
@@ -318,7 +318,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR
{
ClcContact *contact;
ClcGroup *group, *tgroup;
- if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, &group, NULL))
+ if ( !cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, &group, NULL))
break;
for (tgroup = group; tgroup; tgroup = tgroup->parent)
cli.pfnSetGroupExpand(hwnd, dat, tgroup, 1);
@@ -351,7 +351,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR
case CLM_SETCHECKMARK:
{
ClcContact *contact;
- if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
+ if ( !cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL))
return 0;
if (lParam)
contact->flags |= CONTACTF_CHECKED;
@@ -365,23 +365,21 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR
case CLM_SETEXTRACOLUMNS:
if (wParam > EXTRA_ICON_COUNT)
return 0;
+
dat->extraColumnsCount = wParam;
cli.pfnInvalidateRect(hwnd, NULL, FALSE);
break;
case CLM_SETEXTRAIMAGE:
- {
- if (LOWORD(lParam) >= dat->extraColumnsCount)
- return 0;
-
- ClcContact *contact;
- if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
- return 0;
+ if ( LOWORD(lParam) < dat->extraColumnsCount) {
+ ClcContact *contact;
+ if ( !cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL))
+ return 0;
- contact->iExtraImage[LOWORD(lParam)] = HIWORD(lParam);
- cli.pfnInvalidateRect(hwnd, NULL, FALSE);
+ contact->iExtraImage[LOWORD(lParam)] = HIWORD(lParam);
+ cli.pfnInvalidateRect(hwnd, NULL, FALSE);
+ }
break;
- }
case CLM_SETEXTRAIMAGELIST:
dat->himlExtraColumns = (HIMAGELIST) lParam;
@@ -433,7 +431,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR
case CLM_SETITEMTEXT:
{
ClcContact *contact;
- if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
+ if ( !cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL))
break;
lstrcpyn(contact->szText, (TCHAR*)lParam, SIZEOF(contact->szText));
cli.pfnSortCLC(hwnd, dat, 1);
diff --git a/src/modules/clist/clistevents.cpp b/src/modules/clist/clistevents.cpp
index 0e19129dee..f374fbacb5 100644
--- a/src/modules/clist/clistevents.cpp
+++ b/src/modules/clist/clistevents.cpp
@@ -360,7 +360,7 @@ static int RemoveEventsForContact(WPARAM wParam, LPARAM)
for (; cli.events.count > 0;) {
for (hit = 0, j = 0; j < cli.events.count; j++) {
- if (cli.events.items[j]->cle.hContact == (HANDLE) wParam) {
+ if (cli.events.items[j]->cle.hContact == (HANDLE)wParam) {
cli.pfnRemoveEvent((HANDLE)wParam, cli.events.items[j]->cle.hDbEvent);
hit = 1;
}
@@ -374,7 +374,7 @@ static int RemoveEventsForContact(WPARAM wParam, LPARAM)
static int CListEventSettingsChanged(WPARAM wParam, LPARAM lParam)
{
- HANDLE hContact = (HANDLE) wParam;
+ HANDLE hContact = (HANDLE)wParam;
DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *) lParam;
if (hContact == NULL && cws && cws->szModule && cws->szSetting && strcmp(cws->szModule, "CList") == 0) {
if (strcmp(cws->szSetting, "DisableTrayFlash") == 0)
diff --git a/src/modules/clist/clistmod.cpp b/src/modules/clist/clistmod.cpp
index 2bc691ca94..60ce86d46d 100644
--- a/src/modules/clist/clistmod.cpp
+++ b/src/modules/clist/clistmod.cpp
@@ -438,7 +438,7 @@ extern int sortByStatus, sortByProto;
static INT_PTR CompareContacts(WPARAM wParam, LPARAM lParam)
{
- HANDLE a = (HANDLE) wParam, b = (HANDLE) lParam;
+ HANDLE a = (HANDLE)wParam, b = (HANDLE) lParam;
TCHAR namea[128], *nameb;
int statusa, statusb;
char *szProto1, *szProto2;
diff --git a/src/modules/clist/clui.cpp b/src/modules/clist/clui.cpp
index 383ab66dd8..983ff73007 100644
--- a/src/modules/clist/clui.cpp
+++ b/src/modules/clist/clui.cpp
@@ -204,7 +204,7 @@ static INT_PTR MenuItem_DeleteContact(WPARAM wParam, LPARAM lParam)
status = CallProtoServiceInt(NULL,szProto, PS_GETSTATUS, 0, 0);
if (status == ID_STATUS_OFFLINE || (status >= ID_STATUS_CONNECTING && status < ID_STATUS_CONNECTING + MAX_CONNECT_RETRIES)) {
// Set a flag so we remember to delete the contact when the protocol goes online the next time
- DBWriteContactSettingByte((HANDLE) wParam, "CList", "Delete", 1);
+ DBWriteContactSettingByte((HANDLE)wParam, "CList", "Delete", 1);
MessageBox(NULL,
TranslateT("This contact is on an instant messaging system which stores its contact list on a central server. The contact will be removed from the server and from your contact list when you next connect to that network."),
TranslateT("Delete Contact"), MB_OK);
@@ -217,7 +217,7 @@ static INT_PTR MenuItem_DeleteContact(WPARAM wParam, LPARAM lParam)
// Archive contact
case IDC_HIDE:
- DBWriteContactSettingByte((HANDLE) wParam, "CList", "Hidden", 1);
+ DBWriteContactSettingByte((HANDLE)wParam, "CList", "Hidden", 1);
break;
}
@@ -228,7 +228,7 @@ static INT_PTR MenuItem_AddContactToList(WPARAM wParam, LPARAM)
{
ADDCONTACTSTRUCT acs = { 0 };
- acs.handle = (HANDLE) wParam;
+ acs.handle = (HANDLE)wParam;
acs.handleType = HANDLE_CONTACT;
acs.szProto = "";
diff --git a/src/modules/clist/contact.cpp b/src/modules/clist/contact.cpp
index 86b9625ece..574ea53bb8 100644
--- a/src/modules/clist/contact.cpp
+++ b/src/modules/clist/contact.cpp
@@ -162,13 +162,13 @@ INT_PTR ContactChangeGroup(WPARAM wParam, LPARAM lParam)
CallService(MS_CLUI_CONTACTDELETED, wParam, 0);
if ((HANDLE) lParam == NULL)
- DBDeleteContactSetting((HANDLE) wParam, "CList", "Group");
+ DBDeleteContactSetting((HANDLE)wParam, "CList", "Group");
else {
grpChg.pszNewName = cli.pfnGetGroupName(lParam, NULL);
- db_set_ts((HANDLE) wParam, "CList", "Group", grpChg.pszNewName);
+ db_set_ts((HANDLE)wParam, "CList", "Group", grpChg.pszNewName);
}
CallService(MS_CLUI_CONTACTADDED, wParam,
- cli.pfnIconFromStatusMode((char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0), GetContactStatus((HANDLE) wParam), (HANDLE) wParam));
+ cli.pfnIconFromStatusMode((char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0), GetContactStatus((HANDLE)wParam), (HANDLE)wParam));
NotifyEventHooks(hGroupChangeEvent, wParam, (LPARAM)&grpChg);
return 0;
diff --git a/src/modules/extraicons/DefaultExtraIcons.cpp b/src/modules/extraicons/DefaultExtraIcons.cpp
index 4c05a8e590..46262f877d 100644
--- a/src/modules/extraicons/DefaultExtraIcons.cpp
+++ b/src/modules/extraicons/DefaultExtraIcons.cpp
@@ -203,7 +203,7 @@ static void SetExtraIcons(HANDLE hContact)
static int SettingChanged(WPARAM wParam, LPARAM lParam)
{
- HANDLE hContact = (HANDLE) wParam;
+ HANDLE hContact = (HANDLE)wParam;
DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING*) lParam;
if (hContact == NULL)
@@ -258,7 +258,7 @@ static int DefaultOnClick(WPARAM wParam, LPARAM lParam, LPARAM param)
if (info == NULL)
return 0;
- HANDLE hContact = (HANDLE) wParam;
+ HANDLE hContact = (HANDLE)wParam;
if (hContact == NULL)
return 0;
@@ -360,7 +360,7 @@ static ProtoInfo *FindProto(const char * proto)
static int ProtocolApplyIcon(WPARAM wParam, LPARAM lParam)
{
- HANDLE hContact = (HANDLE) wParam;
+ HANDLE hContact = (HANDLE)wParam;
char *proto = (char*) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
if (IsEmpty(proto))
@@ -379,7 +379,7 @@ static int ProtocolApplyIcon(WPARAM wParam, LPARAM lParam)
static int ProtocolOnClick(WPARAM wParam, LPARAM lParam, LPARAM param)
{
- HANDLE hContact = (HANDLE) wParam;
+ HANDLE hContact = (HANDLE)wParam;
if (hContact == NULL)
return 0;
diff --git a/src/modules/visibility/visibility.cpp b/src/modules/visibility/visibility.cpp
index 88f43b4a3c..10a89ce628 100644
--- a/src/modules/visibility/visibility.cpp
+++ b/src/modules/visibility/visibility.cpp
@@ -24,29 +24,32 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
static void SetListGroupIcons(HWND hwndList, HANDLE hFirstItem, HANDLE hParentItem, int *groupChildCount)
{
- int typeOfFirst;
int iconOn[2] = {1, 1};
- int childCount[2] = {0, 0}, i;
- int iImage;
- HANDLE hItem, hChildItem;
+ int childCount[2] = {0, 0};
- typeOfFirst = SendMessage(hwndList, CLM_GETITEMTYPE, (WPARAM)hFirstItem, 0);
+ int typeOfFirst = SendMessage(hwndList, CLM_GETITEMTYPE, (WPARAM)hFirstItem, 0);
//check groups
- if (typeOfFirst == CLCIT_GROUP) hItem = hFirstItem;
- else hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTGROUP, (LPARAM)hFirstItem);
+ HANDLE hItem;
+ if (typeOfFirst == CLCIT_GROUP)
+ hItem = hFirstItem;
+ else
+ hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTGROUP, (LPARAM)hFirstItem);
+
while (hItem) {
- hChildItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem);
+ HANDLE hChildItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem);
if (hChildItem) SetListGroupIcons(hwndList, hChildItem, hItem, childCount);
- for (i=0; i < SIZEOF(iconOn); i++)
+ for (int i=0; i < SIZEOF(iconOn); i++)
if (iconOn[i] && SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hItem, i) == 0) iconOn[i] = 0;
hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTGROUP, (LPARAM)hItem);
}
//check contacts
- if (typeOfFirst == CLCIT_CONTACT) hItem = hFirstItem;
- else hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTCONTACT, (LPARAM)hFirstItem);
+ if (typeOfFirst == CLCIT_CONTACT)
+ hItem = hFirstItem;
+ else
+ hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTCONTACT, (LPARAM)hFirstItem);
while (hItem) {
- for (i=0; i < SIZEOF(iconOn); i++) {
- iImage = SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hItem, i);
+ for (int i=0; i < SIZEOF(iconOn); i++) {
+ int iImage = SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hItem, i);
if (iconOn[i] && iImage == 0) iconOn[i] = 0;
if (iImage != EMPTY_EXTRA_ICON)
childCount[i]++;
@@ -54,7 +57,7 @@ static void SetListGroupIcons(HWND hwndList, HANDLE hFirstItem, HANDLE hParentIt
hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTCONTACT, (LPARAM)hItem);
}
//set icons
- for (i=0; i < SIZEOF(iconOn); i++) {
+ for (int i=0; i < SIZEOF(iconOn); i++) {
SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hParentItem, MAKELPARAM(i, childCount[i]?(iconOn[i]?i+1:0):EMPTY_EXTRA_ICON));
if (groupChildCount) groupChildCount[i]+=childCount[i];
}
@@ -62,23 +65,26 @@ static void SetListGroupIcons(HWND hwndList, HANDLE hFirstItem, HANDLE hParentIt
static void SetAllChildIcons(HWND hwndList, HANDLE hFirstItem, int iColumn, int iImage)
{
- int typeOfFirst, iOldIcon;
- HANDLE hItem, hChildItem;
-
- typeOfFirst = SendMessage(hwndList, CLM_GETITEMTYPE, (WPARAM)hFirstItem, 0);
+ int typeOfFirst = SendMessage(hwndList, CLM_GETITEMTYPE, (WPARAM)hFirstItem, 0);
//check groups
- if (typeOfFirst == CLCIT_GROUP) hItem = hFirstItem;
- else hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTGROUP, (LPARAM)hFirstItem);
+ HANDLE hItem;
+ if (typeOfFirst == CLCIT_GROUP)
+ hItem = hFirstItem;
+ else
+ hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTGROUP, (LPARAM)hFirstItem);
while (hItem) {
- hChildItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem);
- if (hChildItem) SetAllChildIcons(hwndList, hChildItem, iColumn, iImage);
+ HANDLE hChildItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem);
+ if (hChildItem)
+ SetAllChildIcons(hwndList, hChildItem, iColumn, iImage);
hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTGROUP, (LPARAM)hItem);
}
//check contacts
- if (typeOfFirst == CLCIT_CONTACT) hItem = hFirstItem;
- else hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTCONTACT, (LPARAM)hFirstItem);
+ if (typeOfFirst == CLCIT_CONTACT)
+ hItem = hFirstItem;
+ else
+ hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTCONTACT, (LPARAM)hFirstItem);
while (hItem) {
- iOldIcon = SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hItem, iColumn);
+ int iOldIcon = SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hItem, iColumn);
if (iOldIcon != EMPTY_EXTRA_ICON && iOldIcon != iImage)
SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(iColumn, iImage));
hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTCONTACT, (LPARAM)hItem);
@@ -87,45 +93,44 @@ static void SetAllChildIcons(HWND hwndList, HANDLE hFirstItem, int iColumn, int
static void ResetListOptions(HWND hwndList)
{
- int i;
-
- SendMessage(hwndList, CLM_SETBKBITMAP, 0, (LPARAM)(HBITMAP)NULL);
+ SendMessage(hwndList, CLM_SETBKBITMAP, 0, 0);
SendMessage(hwndList, CLM_SETBKCOLOR, GetSysColor(COLOR_WINDOW), 0);
SendMessage(hwndList, CLM_SETGREYOUTFLAGS, 0, 0);
SendMessage(hwndList, CLM_SETLEFTMARGIN, 2, 0);
SendMessage(hwndList, CLM_SETINDENT, 10, 0);
- for (i=0;i <= FONTID_MAX;i++)
+ for (int i=0; i <= FONTID_MAX; i++)
SendMessage(hwndList, CLM_SETTEXTCOLOR, i, GetSysColor(COLOR_WINDOWTEXT));
SetWindowLongPtr(hwndList, GWL_STYLE, GetWindowLongPtr(hwndList, GWL_STYLE)|CLS_SHOWHIDDEN);
}
static void SetAllContactIcons(HWND hwndList)
{
- HANDLE hContact, hItem;
- char *szProto;
- DWORD flags;
- WORD status;
-
- hContact = db_find_first();
+ HANDLE hContact = db_find_first();
do {
- hItem = (HANDLE)SendMessage(hwndList, CLM_FINDCONTACT, (WPARAM)hContact, 0);
+ HANDLE hItem = (HANDLE)SendMessage(hwndList, CLM_FINDCONTACT, (WPARAM)hContact, 0);
if (hItem) {
- szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
- if (szProto == NULL) {flags = 0; status = 0;}
+ DWORD flags;
+ WORD status;
+ char *szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
+ if (szProto == NULL) {
+ flags = 0;
+ status = 0;
+ }
else {
flags = CallProtoServiceInt(NULL,szProto, PS_GETCAPS, PFLAGNUM_1, 0);
status = DBGetContactSettingWord(hContact, szProto, "ApparentMode", 0);
}
- if (flags & PF1_INVISLIST) {
+
+ if (flags & PF1_INVISLIST)
if (SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(0, 0)) == EMPTY_EXTRA_ICON)
- SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(0, status == ID_STATUS_ONLINE?1:0));
- }
- if (flags & PF1_VISLIST) {
+ SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(0, status == ID_STATUS_ONLINE ? 1 : 0));
+
+ if (flags & PF1_VISLIST)
if (SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(1, 0)) == EMPTY_EXTRA_ICON)
- SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(1, status == ID_STATUS_OFFLINE?2:0));
- }
+ SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(1, status == ID_STATUS_OFFLINE ? 2 : 0));
}
- } while (hContact = db_find_next(hContact));
+ }
+ while (hContact = db_find_next(hContact));
}
static INT_PTR CALLBACK DlgProcVisibilityOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM lParam)
@@ -133,146 +138,141 @@ static INT_PTR CALLBACK DlgProcVisibilityOpts(HWND hwndDlg, UINT msg, WPARAM, LP
static HICON hVisibleIcon, hInvisibleIcon;
static HANDLE hItemAll;
- switch (msg)
- {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwndDlg);
- { HIMAGELIST hIml;
- hIml = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), (IsWinVerXPPlus()?ILC_COLOR32:ILC_COLOR16)|ILC_MASK, 3, 3);
- ImageList_AddIcon_IconLibLoaded(hIml, SKINICON_OTHER_SMALLDOT);
- ImageList_AddIcon_IconLibLoaded(hIml, SKINICON_STATUS_INVISIBLE);
- ImageList_AddIcon_IconLibLoaded(hIml, SKINICON_STATUS_OFFLINE);
- SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_SETEXTRAIMAGELIST, 0, (LPARAM)hIml);
- hVisibleIcon = ImageList_GetIcon(hIml, 1, ILD_NORMAL);
- SendDlgItemMessage(hwndDlg, IDC_VISIBLEICON, STM_SETICON, (WPARAM)hVisibleIcon, 0);
- hInvisibleIcon = ImageList_GetIcon(hIml, 2, ILD_NORMAL);
- SendDlgItemMessage(hwndDlg, IDC_INVISIBLEICON, STM_SETICON, (WPARAM)hInvisibleIcon, 0);
- }
+ HIMAGELIST hIml;
- ResetListOptions( GetDlgItem(hwndDlg, IDC_LIST));
- SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_SETEXTRACOLUMNS, 2, 0);
+ switch (msg) {
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hwndDlg);
- { CLCINFOITEM cii = {0};
- cii.cbSize = sizeof(cii);
- cii.flags = CLCIIF_GROUPFONT;
- cii.pszText = TranslateT("** All contacts **");
- hItemAll = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_ADDINFOITEM, 0, (LPARAM)&cii);
- }
+ hIml = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), (IsWinVerXPPlus()?ILC_COLOR32:ILC_COLOR16)|ILC_MASK, 3, 3);
+ ImageList_AddIcon_IconLibLoaded(hIml, SKINICON_OTHER_SMALLDOT);
+ ImageList_AddIcon_IconLibLoaded(hIml, SKINICON_STATUS_INVISIBLE);
+ ImageList_AddIcon_IconLibLoaded(hIml, SKINICON_STATUS_OFFLINE);
+ SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_SETEXTRAIMAGELIST, 0, (LPARAM)hIml);
+ hVisibleIcon = ImageList_GetIcon(hIml, 1, ILD_NORMAL);
+ SendDlgItemMessage(hwndDlg, IDC_VISIBLEICON, STM_SETICON, (WPARAM)hVisibleIcon, 0);
+ hInvisibleIcon = ImageList_GetIcon(hIml, 2, ILD_NORMAL);
+ SendDlgItemMessage(hwndDlg, IDC_INVISIBLEICON, STM_SETICON, (WPARAM)hInvisibleIcon, 0);
- SetAllContactIcons( GetDlgItem(hwndDlg, IDC_LIST));
- SetListGroupIcons( GetDlgItem(hwndDlg, IDC_LIST), (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, NULL);
- return TRUE;
- case WM_SETFOCUS:
- SetFocus( GetDlgItem(hwndDlg, IDC_LIST));
- break;
- case WM_NOTIFY:
- switch(((LPNMHDR)lParam)->idFrom) {
- case IDC_LIST:
- switch (((LPNMHDR)lParam)->code)
- {
- case CLN_NEWCONTACT:
- case CLN_LISTREBUILT:
- SetAllContactIcons( GetDlgItem(hwndDlg, IDC_LIST));
- //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 NM_CLICK:
- { HANDLE hItem;
- NMCLISTCONTROL *nm = (NMCLISTCONTROL*)lParam;
- DWORD hitFlags;
- int iImage;
- int itemType;
-
- // Make sure we have an extra column
- if (nm->iColumn == -1)
- break;
+ ResetListOptions( GetDlgItem(hwndDlg, IDC_LIST));
+ SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_SETEXTRACOLUMNS, 2, 0);
+ {
+ CLCINFOITEM cii = { sizeof(cii) };
+ cii.flags = CLCIIF_GROUPFONT;
+ cii.pszText = TranslateT("** All contacts **");
+ hItemAll = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_ADDINFOITEM, 0, (LPARAM)&cii);
+ }
+ SetAllContactIcons( GetDlgItem(hwndDlg, IDC_LIST));
+ SetListGroupIcons( GetDlgItem(hwndDlg, IDC_LIST), (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, NULL);
+ return TRUE;
- // Find clicked item
- hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_HITTEST, (WPARAM)&hitFlags, MAKELPARAM(nm->pt.x, nm->pt.y));
- // Nothing was clicked
- if (hItem == NULL) break;
- // It was not a visbility icon
- if ( !(hitFlags & CLCHT_ONITEMEXTRA)) break;
-
- // Get image in clicked column (0 = none, 1 = visible, 2 = invisible)
- iImage = SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(nm->iColumn, 0));
- if (iImage == 0)
- iImage = nm->iColumn + 1;
- else
- if (iImage == 1 || iImage == 2)
- iImage = 0;
-
- // Get item type (contact, group, etc...)
- itemType = SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETITEMTYPE, (WPARAM)hItem, 0);
-
- // Update list, making sure that the options are mutually exclusive
- if (itemType == CLCIT_CONTACT) { // A contact
- SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(nm->iColumn, iImage));
- if (iImage && SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(nm->iColumn?0:1, 0)) != EMPTY_EXTRA_ICON)
- SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(nm->iColumn?0:1, 0));
- }
- else if (itemType == CLCIT_INFO) { // All Contacts
- SetAllChildIcons( GetDlgItem(hwndDlg, IDC_LIST), hItem, nm->iColumn, iImage);
- if (iImage)
- SetAllChildIcons( GetDlgItem(hwndDlg, IDC_LIST), hItem, nm->iColumn?0:1, 0);
- }
- else if (itemType == CLCIT_GROUP) { // A group
- hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem);
- if (hItem) {
- SetAllChildIcons( GetDlgItem(hwndDlg, IDC_LIST), hItem, nm->iColumn, iImage);
- if (iImage)
- SetAllChildIcons( GetDlgItem(hwndDlg, IDC_LIST), hItem, nm->iColumn?0:1, 0);
- }
- }
- // Update the all/none icons
- SetListGroupIcons( GetDlgItem(hwndDlg, IDC_LIST), (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, NULL);
+ case WM_SETFOCUS:
+ SetFocus( GetDlgItem(hwndDlg, IDC_LIST));
+ break;
- // Activate Apply button
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
- }
+ case WM_NOTIFY:
+ switch(((LPNMHDR)lParam)->idFrom) {
+ case IDC_LIST:
+ switch (((LPNMHDR)lParam)->code) {
+ case CLN_NEWCONTACT:
+ case CLN_LISTREBUILT:
+ SetAllContactIcons( GetDlgItem(hwndDlg, IDC_LIST));
+ //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 NM_CLICK:
+ {
+ // Make sure we have an extra column
+ NMCLISTCONTROL *nm = (NMCLISTCONTROL*)lParam;
+ if (nm->iColumn == -1)
+ break;
+
+ // Find clicked item
+ DWORD hitFlags;
+ HANDLE hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_HITTEST, (WPARAM)&hitFlags, MAKELPARAM(nm->pt.x, nm->pt.y));
+ if (hItem == NULL)
+ break;
+
+ // It was not a visbility icon
+ if ( !(hitFlags & CLCHT_ONITEMEXTRA))
+ break;
+
+ // Get image in clicked column (0 = none, 1 = visible, 2 = invisible)
+ int iImage = SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(nm->iColumn, 0));
+ if (iImage == 0)
+ iImage = nm->iColumn + 1;
+ else if (iImage == 1 || iImage == 2)
+ iImage = 0;
+
+ // Get item type (contact, group, etc...)
+ int itemType = SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETITEMTYPE, (WPARAM)hItem, 0);
+
+ // Update list, making sure that the options are mutually exclusive
+ if (itemType == CLCIT_CONTACT) { // A contact
+ SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(nm->iColumn, iImage));
+ if (iImage && SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(nm->iColumn?0:1, 0)) != EMPTY_EXTRA_ICON)
+ SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(nm->iColumn?0:1, 0));
}
- break;
- case 0:
- switch (((LPNMHDR)lParam)->code)
- {
- case PSN_APPLY:
- { HANDLE hContact, hItem;
- int set, i, iImage;
-
- hContact = db_find_first();
- do {
- hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_FINDCONTACT, (WPARAM)hContact, 0);
- if (hItem) {
- set = 0;
- for (i=0;i<2;i++) {
- iImage = SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(i, 0));
- if (iImage == i+1) {
- CallContactService(hContact, PSS_SETAPPARENTMODE, iImage == 1?ID_STATUS_ONLINE:ID_STATUS_OFFLINE, 0);
- set = 1;
- break;
- }
- }
- if ( !set) CallContactService(hContact, PSS_SETAPPARENTMODE, 0, 0);
- }
- } while (hContact = db_find_next(hContact));
- return TRUE;
+ else if (itemType == CLCIT_INFO) { // All Contacts
+ SetAllChildIcons( GetDlgItem(hwndDlg, IDC_LIST), hItem, nm->iColumn, iImage);
+ if (iImage)
+ SetAllChildIcons( GetDlgItem(hwndDlg, IDC_LIST), hItem, nm->iColumn?0:1, 0);
+ }
+ else if (itemType == CLCIT_GROUP) { // A group
+ hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem);
+ if (hItem) {
+ SetAllChildIcons( GetDlgItem(hwndDlg, IDC_LIST), hItem, nm->iColumn, iImage);
+ if (iImage)
+ SetAllChildIcons( GetDlgItem(hwndDlg, IDC_LIST), hItem, nm->iColumn?0:1, 0);
}
}
- break;
+ // Update the all/none icons
+ SetListGroupIcons( GetDlgItem(hwndDlg, IDC_LIST), (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, NULL);
+
+ // Activate Apply button
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ }
}
break;
- case WM_DESTROY:
- DestroyIcon(hVisibleIcon);
- DestroyIcon(hInvisibleIcon);
- { HIMAGELIST hIml = (HIMAGELIST)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETEXTRAIMAGELIST, 0, 0);
- ImageList_Destroy(hIml);
+
+ case 0:
+ if (((LPNMHDR)lParam)->code == PSN_APPLY) {
+ HANDLE hContact = db_find_first();
+ do {
+ HANDLE hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_FINDCONTACT, (WPARAM)hContact, 0);
+ if (hItem) {
+ int set = 0;
+ for (int i=0; i < 2; i++) {
+ int iImage = SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(i, 0));
+ if (iImage == i+1) {
+ CallContactService(hContact, PSS_SETAPPARENTMODE, iImage == 1?ID_STATUS_ONLINE:ID_STATUS_OFFLINE, 0);
+ set = 1;
+ break;
+ }
+ }
+ if ( !set)
+ CallContactService(hContact, PSS_SETAPPARENTMODE, 0, 0);
+ }
+ }
+ while (hContact = db_find_next(hContact));
+ return TRUE;
}
- break;
+ }
+ break;
+
+ case WM_DESTROY:
+ DestroyIcon(hVisibleIcon);
+ DestroyIcon(hInvisibleIcon);
+
+ hIml = (HIMAGELIST)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETEXTRAIMAGELIST, 0, 0);
+ ImageList_Destroy(hIml);
+ break;
}
return FALSE;
}