diff options
author | George Hazan <george.hazan@gmail.com> | 2012-11-04 22:36:16 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-11-04 22:36:16 +0000 |
commit | 0a668c8eb335ba601d97fc7c8dbbecb1c7455408 (patch) | |
tree | 5ea7696fe3e98623abfad58e62422b5538e2a36e /plugins/Clist_mw/src | |
parent | 3ed8130e44a7f076fba9f4957c09920716441f48 (diff) |
massive extinction of clutches:
- nicer own extra icons;
- duplicate cache entries in modern
- many other quirks
git-svn-id: http://svn.miranda-ng.org/main/trunk@2201 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Clist_mw/src')
-rw-r--r-- | plugins/Clist_mw/src/CLUIFrames/extraimage.cpp | 25 | ||||
-rw-r--r-- | plugins/Clist_mw/src/clc.cpp | 2 | ||||
-rw-r--r-- | plugins/Clist_mw/src/clc.h | 2 | ||||
-rw-r--r-- | plugins/Clist_mw/src/clcitems.cpp | 21 | ||||
-rw-r--r-- | plugins/Clist_mw/src/clcpaint.cpp | 9 | ||||
-rw-r--r-- | plugins/Clist_mw/src/clcutils.cpp | 51 | ||||
-rw-r--r-- | plugins/Clist_mw/src/clui.cpp | 11 |
7 files changed, 48 insertions, 73 deletions
diff --git a/plugins/Clist_mw/src/CLUIFrames/extraimage.cpp b/plugins/Clist_mw/src/CLUIFrames/extraimage.cpp deleted file mode 100644 index c435e744f9..0000000000 --- a/plugins/Clist_mw/src/CLUIFrames/extraimage.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include "../commonheaders.h"
-
-extern int DefaultImageListColorDepth;
-
-static HANDLE hExtraImageListRebuilding,hExtraImageApplying;
-HANDLE hExtraImageClick;
-
-static HIMAGELIST hExtraImageList;
-extern HINSTANCE g_hInst;
-extern HIMAGELIST hCListImages;
-
-extern int ClcIconsChanged(WPARAM,LPARAM);
-
-void SetAllExtraIcons(HWND hwndList,HANDLE hContact)
-{
- /// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-}
-
-boolean ImageCreated = FALSE;
-void ReloadExtraIcons();
-
-int ColumnNumToExtra(int column)
-{
- return column+1;
-}
diff --git a/plugins/Clist_mw/src/clc.cpp b/plugins/Clist_mw/src/clc.cpp index b9ee5105a1..9a52b8b4cc 100644 --- a/plugins/Clist_mw/src/clc.cpp +++ b/plugins/Clist_mw/src/clc.cpp @@ -298,7 +298,7 @@ static INT_PTR CLUIGetCapsService(WPARAM wParam,LPARAM lParam) case CLUICAPS_FLAGS1:
return CLUIF_HIDEEMPTYGROUPS | CLUIF_DISABLEGROUPS | CLUIF_HASONTOPOPTION | CLUIF_HASAUTOHIDEOPTION;
case CLUICAPS_FLAGS2:
- return MAKELONG(MAXEXTRACOLUMNS,1);
+ return MAKELONG(EXTRA_ICON_COUNT,1);
}
return 0;
}
diff --git a/plugins/Clist_mw/src/clc.h b/plugins/Clist_mw/src/clc.h index 94de40448a..7d8e8c7e82 100644 --- a/plugins/Clist_mw/src/clc.h +++ b/plugins/Clist_mw/src/clc.h @@ -144,8 +144,6 @@ typedef struct { extern ExternDrawer SED;
-#define CLM_SETEXTRACOLUMNSSPACE (CLM_FIRST+73) //wParam = extra space between icons
-
void FreeAndNil( void** p );
#endif /* _CLC_H_ */
diff --git a/plugins/Clist_mw/src/clcitems.cpp b/plugins/Clist_mw/src/clcitems.cpp index 718a238cb8..5eb8a8c9d6 100644 --- a/plugins/Clist_mw/src/clcitems.cpp +++ b/plugins/Clist_mw/src/clcitems.cpp @@ -59,7 +59,7 @@ void AddSubcontacts(struct ClcContact * cont) {
cont->subcontacts[i].hContact = cacheEntry->hContact;
cont->subcontacts[i].iImage = CallService(MS_CLIST_GETCONTACTICON,(WPARAM)cacheEntry->hContact,0);
- memset(cont->subcontacts[i].iExtraImage,0xFF,SIZEOF(cont->subcontacts[i].iExtraImage));
+ memset(cont->subcontacts[i].iExtraImage, 0xFF, sizeof(cont->subcontacts[i].iExtraImage));
cont->subcontacts[i].proto = cacheEntry->szProto;
lstrcpyn(cont->subcontacts[i].szText,cacheEntry->tszName,SIZEOF(cont->subcontacts[i].szText));
cont->subcontacts[i].type = CLCIT_CONTACT;
@@ -525,7 +525,7 @@ void SortCLC(HWND hwnd,struct ClcData *dat,int useInsertionSort) struct SavedContactState_t
{
HANDLE hContact;
- BYTE iExtraImage[MAXEXTRACOLUMNS];
+ WORD iExtraImage[EXTRA_ICON_COUNT];
int checked;
};
@@ -585,7 +585,7 @@ void SaveStateAndRebuildList(HWND hwnd,struct ClcData *dat) savedContact = (struct SavedContactState_t*)mir_realloc(savedContact,sizeof(struct SavedContactState_t)*savedContactAlloced);
}
savedContact[savedContactCount-1].hContact = group->cl.items[group->scanIndex]->hContact;
- CopyMemory(savedContact[savedContactCount-1].iExtraImage, group->cl.items[group->scanIndex]->iExtraImage, MAXEXTRACOLUMNS);
+ memcpy(savedContact[savedContactCount-1].iExtraImage, group->cl.items[group->scanIndex]->iExtraImage, sizeof(contact->iExtraImage));
savedContact[savedContactCount-1].checked = group->cl.items[group->scanIndex]->flags & CONTACTF_CHECKED;
if (group->cl.items[group->scanIndex]->SubAllocated>0)
{
@@ -597,7 +597,7 @@ void SaveStateAndRebuildList(HWND hwnd,struct ClcData *dat) savedContact = (struct SavedContactState_t*)mir_realloc(savedContact,sizeof(struct SavedContactState_t)*savedContactAlloced);
}
savedContact[savedContactCount-1].hContact = group->cl.items[group->scanIndex]->subcontacts[l].hContact;
- CopyMemory(savedContact[savedContactCount-1].iExtraImage ,group->cl.items[group->scanIndex]->subcontacts[l].iExtraImage,MAXEXTRACOLUMNS);
+ memcpy(savedContact[savedContactCount-1].iExtraImage, group->cl.items[group->scanIndex]->subcontacts[l].iExtraImage, sizeof(contact->iExtraImage));
savedContact[savedContactCount-1].checked = group->cl.items[group->scanIndex]->subcontacts[l].flags&CONTACTF_CHECKED;
}
}
@@ -640,18 +640,19 @@ void SaveStateAndRebuildList(HWND hwnd,struct ClcData *dat) else if (group->cl.items[group->scanIndex]->type == CLCIT_CONTACT) {
for (i = 0;i<savedContactCount;i++)
if (savedContact[i].hContact == group->cl.items[group->scanIndex]->hContact) {
- CopyMemory(group->cl.items[group->scanIndex]->iExtraImage,savedContact[i].iExtraImage,MAXEXTRACOLUMNS);
- if (savedContact[i].checked) group->cl.items[group->scanIndex]->flags |= CONTACTF_CHECKED;
+ memcpy(group->cl.items[group->scanIndex]->iExtraImage, savedContact[i].iExtraImage, sizeof(contact->iExtraImage));
+ if (savedContact[i].checked)
+ group->cl.items[group->scanIndex]->flags |= CONTACTF_CHECKED;
break;
}
if (group->cl.items[group->scanIndex]->SubAllocated>0)
{
- int l;
- for (l = 0; l<group->cl.items[group->scanIndex]->SubAllocated; l++)
+ for (int l = 0; l<group->cl.items[group->scanIndex]->SubAllocated; l++)
for (i = 0;i<savedContactCount;i++)
if (savedContact[i].hContact == group->cl.items[group->scanIndex]->subcontacts[l].hContact) {
- CopyMemory(group->cl.items[group->scanIndex]->subcontacts[l].iExtraImage,savedContact[i].iExtraImage,MAXEXTRACOLUMNS);
- if (savedContact[i].checked) group->cl.items[group->scanIndex]->subcontacts[l].flags |= CONTACTF_CHECKED;
+ memcpy(group->cl.items[group->scanIndex]->subcontacts[l].iExtraImage, savedContact[i].iExtraImage, sizeof(contact->iExtraImage));
+ if (savedContact[i].checked)
+ group->cl.items[group->scanIndex]->subcontacts[l].flags |= CONTACTF_CHECKED;
break;
}
}
diff --git a/plugins/Clist_mw/src/clcpaint.cpp b/plugins/Clist_mw/src/clcpaint.cpp index ee5e17fb53..b74f3f7eb6 100644 --- a/plugins/Clist_mw/src/clcpaint.cpp +++ b/plugins/Clist_mw/src/clcpaint.cpp @@ -487,7 +487,8 @@ void InternalPaintClc(HWND hwnd,struct ClcData *dat,HDC hdc,RECT *rcPaint) //calc if extra icons present
int enabledextraicons = 0;
for (iImage = 0;iImage<dat->extraColumnsCount;iImage++) {
- if (Drawing->iExtraImage[iImage] == 0xFF) continue;
+ if (Drawing->iExtraImage[iImage] == 0xFFFF)
+ continue;
enabledextraicons++;
}
rc.top = y+(dat->rowHeight>>1); rc.bottom = rc.top+2;
@@ -542,7 +543,9 @@ void InternalPaintClc(HWND hwnd,struct ClcData *dat,HDC hdc,RECT *rcPaint) COLORREF colourFg = dat->selBkColour;
int mode = ILD_NORMAL;
- if (Drawing->iExtraImage[iImage] == 0xFF) continue;
+ if (Drawing->iExtraImage[iImage] == 0xFFFF)
+ continue;
+
if (selected) mode = ILD_SELECTED;
else if (hottrack) {mode = ILD_FOCUS; colourFg = dat->hotTextColour;}
else if (Drawing->type == CLCIT_CONTACT && Drawing->flags&CONTACTF_NOTONLIST) {colourFg = dat->fontInfo[FONTID_NOTONLIST].colour; mode = ILD_BLEND50;}
@@ -568,7 +571,7 @@ void InternalPaintClc(HWND hwnd,struct ClcData *dat,HDC hdc,RECT *rcPaint) int mode = ILD_NORMAL;
int x;
- if (Drawing->iExtraImage[iImage] == 0xFF)
+ if (Drawing->iExtraImage[iImage] == 0xFFFF)
continue;
if (hottrack) {
diff --git a/plugins/Clist_mw/src/clcutils.cpp b/plugins/Clist_mw/src/clcutils.cpp index db47677f84..aca0b80d1f 100644 --- a/plugins/Clist_mw/src/clcutils.cpp +++ b/plugins/Clist_mw/src/clcutils.cpp @@ -92,38 +92,37 @@ int HitTest(HWND hwnd,struct ClcData *dat,int testx,int testy,struct ClcContact for (i = 0;i<dat->extraColumnsCount;i++) {
int x;
- if (hitcontact->iExtraImage[i] == 0xFF) continue;
+ if (hitcontact->iExtraImage[i] == 0xFFFF)
+ continue;
- if ((style&CLS_EX_MULTICOLUMNALIGNLEFT))
- {
- x = (dat->leftMargin+indent*dat->groupIndent+checkboxWidth+dat->iconXSpace-2+width);
- x += 16;
- x = x+dat->extraColumnSpacing*(ic);
- if (i == dat->extraColumnsCount-1) {x = clRect.right-18;}
- }else
- {
- int ir;
- if (dat->MetaIgnoreEmptyExtra)
- {
- int j;
- ir = 0;
- for (j = i;j<dat->extraColumnsCount;j++)
- if (hitcontact->iExtraImage[j] != 0xFF)
- ir++;
- }else
- ir = dat->extraColumnsCount-i;
-
- x = clRect.right-dat->extraColumnSpacing*ir;
+ if ((style & CLS_EX_MULTICOLUMNALIGNLEFT)) {
+ x = (dat->leftMargin+indent*dat->groupIndent+checkboxWidth+dat->iconXSpace-2+width);
+ x += 16;
+ x = x+dat->extraColumnSpacing*(ic);
+ if (i == dat->extraColumnsCount-1) {x = clRect.right-18;}
+ }
+ else {
+ int ir;
+ if (dat->MetaIgnoreEmptyExtra) {
+ ir = 0;
+ for (int j = i;j<dat->extraColumnsCount;j++)
+ if (hitcontact->iExtraImage[j] != 0xFFFF)
+ ir++;
}
+ else ir = dat->extraColumnsCount-i;
+
+ x = clRect.right-dat->extraColumnSpacing*ir;
+ }
ic++;
- if (testx>=x &&
- testx<x+cxSmIcon) {
- if (flags) *flags |= CLCHT_ONITEMEXTRA|(i<<24);
-
+ if (testx >= x && testx < x + cxSmIcon) {
+ if (flags)
+ *flags |= CLCHT_ONITEMEXTRA|(i<<24);
+
ReleaseDC(hwnd,hdc);
return hit;
- } }
+ }
+ }
if (hitcontact->type == CLCIT_GROUP)
oldfont = (HFONT)SelectObject(hdc,dat->fontInfo[FONTID_GROUPS].hFont);
diff --git a/plugins/Clist_mw/src/clui.cpp b/plugins/Clist_mw/src/clui.cpp index 0f80d347a4..c4ce950db4 100644 --- a/plugins/Clist_mw/src/clui.cpp +++ b/plugins/Clist_mw/src/clui.cpp @@ -64,7 +64,6 @@ int SortList(WPARAM wParam,LPARAM lParam); void CluiProtocolStatusChanged(int parStatus, const char* szProto);
-extern void SetAllExtraIcons(HWND hwndList,HANDLE hContact);
extern void ReloadExtraIcons();
extern HWND CreateStatusBarhWnd(HWND parent);
extern HANDLE CreateStatusBarFrame();
@@ -72,7 +71,6 @@ extern int CLUIFramesUpdateFrame(WPARAM wParam,LPARAM lParam); extern void DrawDataForStatusBar(LPDRAWITEMSTRUCT dis);
extern void InitGroupMenus();
extern int UseOwnerDrawStatusBar;
-extern HANDLE hExtraImageClick;
HICON GetConnectingIconForProto(char *szProto,int b);
HICON GetConnectingIconForProto_DLL(char *szProto,int b);
@@ -607,11 +605,12 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l {
NMCLISTCONTROL *nm = (NMCLISTCONTROL *)lParam;
if (nm != NULL)
- SetAllExtraIcons(pcli->hwndContactTree,nm->hItem );
+ pcli->pfnSetAllExtraIcons(pcli->hwndContactTree, nm->hItem);
return TRUE;
}
+
case CLN_LISTREBUILT:
- SetAllExtraIcons(pcli->hwndContactTree,0);
+ pcli->pfnSetAllExtraIcons(pcli->hwndContactTree, 0);
return(FALSE);
case CLN_LISTSIZECHANGE:
@@ -660,8 +659,8 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l if (hitFlags & CLCHT_ONITEMEXTRA)
if (!IsHContactGroup(hItem) && !IsHContactInfo(hItem)) {
pClcCacheEntry pdnce = (pClcCacheEntry)pcli->pfnGetCacheEntry(nm->hItem);
- if (pdnce)
- NotifyEventHooks(hExtraImageClick, (WPARAM)nm->hItem, nm->iColumn+1);
+// if (pdnce)
+// NotifyEventHooks(hExtraImageClick, (WPARAM)nm->hItem, nm->iColumn+1);
}
if (hItem) break;
|