summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-11-04 22:36:16 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-11-04 22:36:16 +0000
commit0a668c8eb335ba601d97fc7c8dbbecb1c7455408 (patch)
tree5ea7696fe3e98623abfad58e62422b5538e2a36e /src/modules
parent3ed8130e44a7f076fba9f4957c09920716441f48 (diff)
massive extinction of clutches:
- nicer own extra icons; - duplicate cache entries in modern - many other quirks git-svn-id: http://svn.miranda-ng.org/main/trunk@2201 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/clist/clc.cpp8
-rw-r--r--src/modules/clist/clcitems.cpp10
-rw-r--r--src/modules/clist/clcmsgs.cpp21
-rw-r--r--src/modules/clist/clcutils.cpp2
-rw-r--r--src/modules/extraicons/extraicons.cpp23
-rw-r--r--src/modules/protocols/protochains.cpp2
6 files changed, 37 insertions, 29 deletions
diff --git a/src/modules/clist/clc.cpp b/src/modules/clist/clc.cpp
index ec5b36b624..3f513f337a 100644
--- a/src/modules/clist/clc.cpp
+++ b/src/modules/clist/clc.cpp
@@ -476,12 +476,12 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
case INTM_GROUPCHANGED:
{
ClcContact *contact;
- BYTE iExtraImage[MAXEXTRACOLUMNS];
+ WORD iExtraImage[EXTRA_ICON_COUNT];
BYTE flags = 0;
if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
- memset(iExtraImage, 0xFF, SIZEOF(iExtraImage));
+ memset(iExtraImage, 0xFF, sizeof(iExtraImage));
else {
- CopyMemory(iExtraImage, contact->iExtraImage, SIZEOF(iExtraImage));
+ memcpy(iExtraImage, contact->iExtraImage, sizeof(iExtraImage));
flags = contact->flags;
}
cli.pfnDeleteItemFromTree(hwnd, (HANDLE) wParam);
@@ -489,7 +489,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
NMCLISTCONTROL nm;
cli.pfnAddContactToTree(hwnd, dat, (HANDLE) wParam, 1, 1);
if (cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL)) {
- CopyMemory(contact->iExtraImage, iExtraImage, SIZEOF(iExtraImage));
+ memcpy(contact->iExtraImage, iExtraImage, sizeof(iExtraImage));
if (flags & CONTACTF_CHECKED)
contact->flags |= CONTACTF_CHECKED;
}
diff --git a/src/modules/clist/clcitems.cpp b/src/modules/clist/clcitems.cpp
index 149017d8f7..94280f0bcf 100644
--- a/src/modules/clist/clcitems.cpp
+++ b/src/modules/clist/clcitems.cpp
@@ -31,7 +31,7 @@ int fnAddItemToGroup(ClcGroup *group, int iAboveItem)
newItem->type = CLCIT_DIVIDER;
newItem->flags = 0;
newItem->szText[0] = '\0';
- memset(newItem->iExtraImage, 0xFF, SIZEOF(newItem->iExtraImage));
+ memset(newItem->iExtraImage, 0xFF, sizeof(newItem->iExtraImage));
List_Insert((SortedList*)&group->cl, newItem, iAboveItem);
return iAboveItem;
@@ -580,7 +580,7 @@ void fnSortCLC(HWND hwnd, struct ClcData *dat, int useInsertionSort)
struct SavedContactState_t
{
HANDLE hContact;
- BYTE iExtraImage[MAXEXTRACOLUMNS];
+ WORD iExtraImage[EXTRA_ICON_COUNT];
int checked;
};
@@ -633,8 +633,7 @@ void fnSaveStateAndRebuildList(HWND hwnd, struct ClcData *dat)
else if (group->cl.items[group->scanIndex]->type == CLCIT_CONTACT) {
SavedContactState_t* p = new SavedContactState_t;
p->hContact = group->cl.items[group->scanIndex]->hContact;
- CopyMemory(p->iExtraImage, group->cl.items[group->scanIndex]->iExtraImage,
- sizeof(group->cl.items[group->scanIndex]->iExtraImage));
+ memcpy(p->iExtraImage, group->cl.items[group->scanIndex]->iExtraImage, sizeof(p->iExtraImage));
p->checked = group->cl.items[group->scanIndex]->flags & CONTACTF_CHECKED;
saveContact.insert(p);
}
@@ -672,8 +671,7 @@ void fnSaveStateAndRebuildList(HWND hwnd, struct ClcData *dat)
SavedContactState_t tmp, *p;
tmp.hContact = group->cl.items[group->scanIndex]->hContact;
if ((p = saveContact.find(&tmp)) != NULL) {
- CopyMemory(group->cl.items[group->scanIndex]->iExtraImage, p->iExtraImage,
- SIZEOF(group->cl.items[group->scanIndex]->iExtraImage));
+ memcpy(group->cl.items[group->scanIndex]->iExtraImage, p->iExtraImage, sizeof(p->iExtraImage));
if (p->checked)
group->cl.items[group->scanIndex]->flags |= CONTACTF_CHECKED;
} }
diff --git a/src/modules/clist/clcmsgs.cpp b/src/modules/clist/clcmsgs.cpp
index 3c209fb62a..7d5664ec20 100644
--- a/src/modules/clist/clcmsgs.cpp
+++ b/src/modules/clist/clcmsgs.cpp
@@ -151,16 +151,23 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR
return contact->group->expanded;
}
+ case CLM_SETEXTRASPACE:
+ dat->extraColumnSpacing = (int)wParam;
+ cli.pfnInvalidateRect(hwnd,NULL,FALSE);
+ return 0;
+
case CLM_GETEXTRACOLUMNS:
return dat->extraColumnsCount;
case CLM_GETEXTRAIMAGE:
{
- ClcContact *contact;
if (LOWORD(lParam) >= dat->extraColumnsCount)
- return 0xFF;
+ return 0xFFFF;
+
+ ClcContact *contact;
if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
- return 0xFF;
+ return 0xFFFF;
+
return contact->iExtraImage[LOWORD(lParam)];
}
@@ -361,7 +368,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR
}
case CLM_SETEXTRACOLUMNS:
- if (wParam > MAXEXTRACOLUMNS)
+ if (wParam > EXTRA_ICON_COUNT)
return 0;
dat->extraColumnsCount = wParam;
cli.pfnInvalidateRect(hwnd, NULL, FALSE);
@@ -369,12 +376,14 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR
case CLM_SETEXTRAIMAGE:
{
- ClcContact *contact;
if (LOWORD(lParam) >= dat->extraColumnsCount)
return 0;
+
+ ClcContact *contact;
if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
return 0;
- contact->iExtraImage[LOWORD(lParam)] = (BYTE) HIWORD(lParam);
+
+ contact->iExtraImage[LOWORD(lParam)] = HIWORD(lParam);
cli.pfnInvalidateRect(hwnd, NULL, FALSE);
break;
}
diff --git a/src/modules/clist/clcutils.cpp b/src/modules/clist/clcutils.cpp
index e59d16ffe3..fe2685ccbc 100644
--- a/src/modules/clist/clcutils.cpp
+++ b/src/modules/clist/clcutils.cpp
@@ -154,7 +154,7 @@ int fnHitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, ClcContact *
}
for (i=0; i < dat->extraColumnsCount; i++) {
- if (hitcontact->iExtraImage[i] == 0xFF)
+ if (hitcontact->iExtraImage[i] == 0xFFFF)
continue;
if (testx >= clRect.right - dat->extraColumnSpacing * (dat->extraColumnsCount - i) &&
testx < clRect.right - dat->extraColumnSpacing * (dat->extraColumnsCount - i) + g_IconWidth) {
diff --git a/src/modules/extraicons/extraicons.cpp b/src/modules/extraicons/extraicons.cpp
index 9688ec364c..7a4f1a40e6 100644
--- a/src/modules/extraicons/extraicons.cpp
+++ b/src/modules/extraicons/extraicons.cpp
@@ -96,7 +96,7 @@ int Clist_SetExtraIcon(HANDLE hContact, int slot, HANDLE hImage)
if (hItem == 0)
return -1;
- SendMessage(cli.hwndContactTree, CLM_SETWIDEEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(icol,hImage));
+ SendMessage(cli.hwndContactTree, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(icol,hImage));
return 0;
}
@@ -276,33 +276,34 @@ int ClistExtraClick(WPARAM wParam, LPARAM lParam)
static HANDLE hEventExtraImageListRebuilding, hEventExtraImageApplying, hEventExtraClick;
static bool bImageCreated = false;
static int g_mutex_bSetAllExtraIconsCycle = 0;
+static HIMAGELIST hExtraImageList;
HANDLE ExtraIcon_Add(HICON hIcon)
{
- if (cli.hExtraImageList == 0 || hIcon == 0)
+ if (hExtraImageList == 0 || hIcon == 0)
return INVALID_HANDLE_VALUE;
- int res = ImageList_AddIcon(cli.hExtraImageList, hIcon);
+ int res = ImageList_AddIcon(hExtraImageList, hIcon);
return (res > 0xFFFE) ? INVALID_HANDLE_VALUE : (HANDLE)res;
}
void fnReloadExtraIcons()
{
- SendMessage(cli.hwndContactTree, CLM_SETEXTRACOLUMNSSPACE, db_get_b(NULL,"CLUI","ExtraColumnSpace",18), 0);
+ SendMessage(cli.hwndContactTree, CLM_SETEXTRASPACE, db_get_b(NULL,"CLUI","ExtraColumnSpace",18), 0);
SendMessage(cli.hwndContactTree, CLM_SETEXTRAIMAGELIST, 0, 0);
- if (cli.hExtraImageList)
- ImageList_Destroy(cli.hExtraImageList);
+ if (hExtraImageList)
+ ImageList_Destroy(hExtraImageList);
- cli.hExtraImageList = ImageList_Create(GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),ILC_COLOR32|ILC_MASK,1,256);
+ hExtraImageList = ImageList_Create(GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),ILC_COLOR32|ILC_MASK,1,256);
- SendMessage(cli.hwndContactTree,CLM_SETEXTRAIMAGELIST,(WPARAM)cli.hExtraImageList,0);
- SendMessage(cli.hwndContactTree,CLM_SETEXTRACOLUMNS, EXTRA_ICON_COUNT, 0);
+ SendMessage(cli.hwndContactTree, CLM_SETEXTRAIMAGELIST, 0, (LPARAM)hExtraImageList);
+ SendMessage(cli.hwndContactTree, CLM_SETEXTRACOLUMNS, EXTRA_ICON_COUNT, 0);
NotifyEventHooks(hEventExtraImageListRebuilding,0,0);
bImageCreated = true;
}
-void fnSetAllExtraIcons(HWND hwndList,HANDLE hContact)
+void fnSetAllExtraIcons(HWND hwndList, HANDLE hContact)
{
if (cli.hwndContactTree == 0)
return;
@@ -313,7 +314,7 @@ void fnSetAllExtraIcons(HWND hwndList,HANDLE hContact)
if (!bImageCreated)
cli.pfnReloadExtraIcons();
- SendMessage(cli.hwndContactTree,CLM_SETEXTRACOLUMNS, EXTRA_ICON_COUNT, 0);
+ SendMessage(cli.hwndContactTree, CLM_SETEXTRACOLUMNS, EXTRA_ICON_COUNT, 0);
if (hContact == NULL)
hContact = db_find_first();
diff --git a/src/modules/protocols/protochains.cpp b/src/modules/protocols/protochains.cpp
index 3e86014fed..53600c6a50 100644
--- a/src/modules/protocols/protochains.cpp
+++ b/src/modules/protocols/protochains.cpp
@@ -53,7 +53,7 @@ static int GetProtocolP(HANDLE hContact, char *szBuf, int cbLen)
if (cc == NULL)
cc = currDb->m_cache->AddContactToCache(hContact);
- cc->szProto = currDb->m_cache->GetCachedSetting(NULL, szBuf, 0, strlen(szBuf));
+ cc->szProto = currDb->m_cache->GetCachedSetting(NULL, szBuf, 0, (int)strlen(szBuf));
}
return res;
}