diff options
41 files changed, 611 insertions, 959 deletions
diff --git a/include/m_clc.h b/include/m_clc.h index 969f5aee21..bb6befc7dc 100644 --- a/include/m_clc.h +++ b/include/m_clc.h @@ -86,6 +86,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define CLM_GETITEMTEXT (CLM_FIRST+21) //wParam = hItem, lParam = (TCHAR*)pszStr, max 120 bytes
#define CLM_GETSCROLLTIME (CLM_FIRST+22) //returns time in ms
#define CLM_GETSELECTION (CLM_FIRST+23) //returns hItem
+#define CLM_SETEXTRASPACE (CLM_FIRST+24) //wParam=extra space between icons
+
#define CLCHT_ABOVE 0x0001 //above client area
#define CLCHT_BELOW 0x0002 //below client area
#define CLCHT_TOLEFT 0x0004 //left of client area
@@ -113,9 +115,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define CLM_SETBKBITMAP (CLM_FIRST+27) //wParam = mode, lParam = hBitmap (don't delete it), NULL for none
#define CLM_SETBKCOLOR (CLM_FIRST+28) //wParam = a COLORREF, default is GetSysColor(COLOR_3DFACE)
#define CLM_SETCHECKMARK (CLM_FIRST+29) //wParam = hItem, lParam = 1 or 0
-#define CLM_SETEXTRACOLUMNS (CLM_FIRST+30) //wParam = number of extra columns (zero to MAXEXTRACOLUMNS from clc.h, currently 16)
+#define CLM_SETEXTRACOLUMNS (CLM_FIRST+30) //wParam = number of extra columns (zero to EXTRA_ICON_COUNT from clc.h, currently 16)
#define CLM_SETEXTRAIMAGE (CLM_FIRST+31) //wParam = hItem, lParam = MAKELPARAM(iColumn (0 based),iImage). iImage = 0xFF is a blank
-#define CLM_SETEXTRAIMAGELIST (CLM_FIRST+32) //lParam = HIMAGELIST, wParam = WideImageList
+#define CLM_SETEXTRAIMAGELIST (CLM_FIRST+32) //lParam = HIMAGELIST
#define FONTID_CONTACTS 0
#define FONTID_INVIS 1
@@ -190,11 +192,6 @@ typedef struct { #define CLM_GETTEXTCOLOR (CLM_FIRST+51) //wParam = FONTID_, returns COLORREF
#define CLM_SETTEXTCOLOR (CLM_FIRST+52) //wParam = FONTID_, lParam = COLORREF
-#define CLM_SETWIDEEXTRAIMAGE (CLM_FIRST+60) //wParam = hItem, lParam = MAKELPARAM(iColumn (0 based), iImage). iImage = 0xFFFF is a blank
-#define CLM_GETWIDEEXTRAIMAGE (CLM_FIRST+61) //wParam = hItem, lParam = MAKELPARAM(iColumn (0 based), 0), returns iImage or 0xFF
-#define CLM_GETWIDEEXTRAIMAGELIST (CLM_FIRST+62) //returns HWIDEIMAGELIST
-#define CLM_SETEXTRACOLUMNSSPACE (CLM_FIRST+63) //wParam=extra space between icons
-
//notifications (most are omitted because the control processes everything)
#define CLNF_ISGROUP 1
#define CLNF_ISINFO 2
diff --git a/include/m_clistint.h b/include/m_clistint.h index e82c39d565..04053e77e3 100644 --- a/include/m_clistint.h +++ b/include/m_clistint.h @@ -35,7 +35,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define IsHContactGroup(h) (((UINT_PTR)(h)^HCONTACT_ISGROUP)<(HCONTACT_ISGROUP^HCONTACT_ISINFO))
#define IsHContactInfo(h) (((UINT_PTR)(h)&HCONTACT_ISINFO) == HCONTACT_ISINFO)
#define IsHContactContact(h) (((UINT_PTR)(h)&HCONTACT_ISGROUP) == 0)
-#define MAXEXTRACOLUMNS 16
+
+#ifndef EXTRA_ICON_COUNT
+#define EXTRA_ICON_COUNT 10
+#endif
#define MAX_TIP_SIZE 2048
@@ -110,8 +113,8 @@ struct ClcContactBase ClcGroup *group;
};
};
- BYTE iExtraImage[MAXEXTRACOLUMNS];
- TCHAR szText[120-MAXEXTRACOLUMNS];
+ WORD iExtraImage[EXTRA_ICON_COUNT];
+ TCHAR szText[120-EXTRA_ICON_COUNT];
char *proto; // MS_PROTO_GETBASEPROTO
};
@@ -121,7 +124,7 @@ struct ClcDataBase int rowHeight;
int yScroll;
int selection;
- struct ClcFontInfo fontInfo[FONTID_MAX + 1];
+ ClcFontInfo fontInfo[FONTID_MAX + 1];
int scrollTime;
HIMAGELIST himlHighlight;
int groupIndent;
@@ -471,7 +474,6 @@ typedef struct /*************************************************************************************
* version 7 additions (0.11.0.x) - extra images
*************************************************************************************/
- HIMAGELIST hExtraImageList;
void (*pfnReloadExtraIcons)(void);
void (*pfnSetAllExtraIcons)(HWND hwndList,HANDLE hContact);
}
diff --git a/plugins/Clist_modern/src/hdr/modern_clc.h b/plugins/Clist_modern/src/hdr/modern_clc.h index 10be28480c..6c64663105 100644 --- a/plugins/Clist_modern/src/hdr/modern_clc.h +++ b/plugins/Clist_modern/src/hdr/modern_clc.h @@ -50,7 +50,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define HCONTACT_ISGROUP 0x80000000
#define HCONTACT_ISINFO 0xFFFF0000
-#define MAXEXTRACOLUMNS 16
#define MAXSTATUSMSGLEN 256
#define INTM_NAMECHANGED (WM_USER+10)
@@ -225,16 +224,14 @@ struct ClcContact : public ClcContactBase RECT pos_label;
RECT pos_rename_rect;
RECT pos_contact_time;
- RECT pos_extra[MAXEXTRACOLUMNS];
+ RECT pos_extra[EXTRA_ICON_COUNT];
DWORD lastPaintCounter;
BYTE bContactRate;
// For extended layout
BYTE ext_nItemsNum;
BOOL ext_fItemsValid;
- tContactItems ext_mpItemsDesc[MAXEXTRACOLUMNS+10]; //up to 10 items
-
- WORD iWideExtraImage[MAXEXTRACOLUMNS];
+ tContactItems ext_mpItemsDesc[EXTRA_ICON_COUNT+10]; //up to 10 items
};
struct ClcModernFontInfo {
@@ -355,8 +352,6 @@ struct ClcData : public ClcDataBase XPTHANDLE hCheckBoxTheme;
BYTE bCompactMode;
-
- HIMAGELIST himlWideExtraColumns;
};
struct SHORTDATA
diff --git a/plugins/Clist_modern/src/modern_cachefuncs.cpp b/plugins/Clist_modern/src/modern_cachefuncs.cpp index 2c49634412..bb6b5b6c5d 100644 --- a/plugins/Clist_modern/src/modern_cachefuncs.cpp +++ b/plugins/Clist_modern/src/modern_cachefuncs.cpp @@ -556,7 +556,7 @@ void Cache_GetFirstLineText(struct ClcData *dat, ClcContact *contact) void Cache_GetSecondLineText(struct SHORTDATA *dat, PDNCE pdnce)
{
- TCHAR Text[240-MAXEXTRACOLUMNS] = {0};
+ TCHAR Text[240-EXTRA_ICON_COUNT] = {0};
int type = TEXT_EMPTY;
if (dat->second_line_show)
@@ -585,7 +585,7 @@ void Cache_GetSecondLineText(struct SHORTDATA *dat, PDNCE pdnce) */
void Cache_GetThirdLineText(struct SHORTDATA *dat, PDNCE pdnce)
{
- TCHAR Text[240-MAXEXTRACOLUMNS] = {0};
+ TCHAR Text[240-EXTRA_ICON_COUNT] = {0};
int type = TEXT_EMPTY;
if (dat->third_line_show)
type = Cache_GetLineText(pdnce, dat->third_line_type,(TCHAR*)Text, SIZEOF(Text), dat->third_line_text,
diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp index 6ce417eef9..f0e5bc2891 100644 --- a/plugins/Clist_modern/src/modern_clc.cpp +++ b/plugins/Clist_modern/src/modern_clc.cpp @@ -1560,12 +1560,14 @@ static LRESULT clcOnLButtonUp(struct ClcData *dat, HWND hwnd, UINT msg, WPARAM w dat->iInsertionMark = -1;
return 0;
}
+
static LRESULT clcOnLButtonDblClick(struct ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
KillTimer(hwnd,TIMERID_SUBEXPAND);
hitcontact = NULL;
return corecli.pfnContactListControlWndProc(hwnd, msg, wParam, lParam);
}
+
static LRESULT clcOnDestroy(struct ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
int i=0;
@@ -1597,20 +1599,16 @@ static LRESULT clcOnDestroy(struct ClcData *dat, HWND hwnd, UINT msg, WPARAM wPa xpt_FreeThemeForWindow(hwnd);
return 0;
}
+
static LRESULT clcOnIntmGroupChanged(struct ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
ClcContact *contact;
- BYTE iExtraImage[MAXEXTRACOLUMNS];
- WORD iWideExtraImage[MAXEXTRACOLUMNS];
+ WORD iExtraImage[EXTRA_ICON_COUNT];
BYTE flags = 0;
- if ( !pcli->pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
- {
- memset(iExtraImage, 0xFF, SIZEOF(iExtraImage));
- memset((void*)iWideExtraImage, 0xFF, sizeof(iWideExtraImage));
- }
+ if ( !pcli->pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL))
+ memset(iExtraImage, 0xFF, sizeof(iExtraImage));
else {
- CopyMemory(iExtraImage, contact->iExtraImage, SIZEOF(iExtraImage));
- CopyMemory((void*)iWideExtraImage, (void*)contact->iWideExtraImage, sizeof(iWideExtraImage));
+ memcpy(iExtraImage, contact->iExtraImage, sizeof(iExtraImage));
flags = contact->flags;
}
pcli->pfnDeleteItemFromTree(hwnd, (HANDLE) wParam);
@@ -1618,8 +1616,7 @@ static LRESULT clcOnIntmGroupChanged(struct ClcData *dat, HWND hwnd, UINT msg, W NMCLISTCONTROL nm;
pcli->pfnAddContactToTree(hwnd, dat, (HANDLE) wParam, 1, 1);
if (pcli->pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL)) {
- CopyMemory(contact->iExtraImage, iExtraImage, SIZEOF(iExtraImage));
- CopyMemory((void*)contact->iWideExtraImage, (void*)iWideExtraImage, sizeof(iWideExtraImage));
+ memcpy(contact->iExtraImage, iExtraImage, sizeof(iExtraImage));
if (flags & CONTACTF_CHECKED)
contact->flags |= CONTACTF_CHECKED;
}
diff --git a/plugins/Clist_modern/src/modern_clcitems.cpp b/plugins/Clist_modern/src/modern_clcitems.cpp index c730ad66bb..48ff30bc2e 100644 --- a/plugins/Clist_modern/src/modern_clcitems.cpp +++ b/plugins/Clist_modern/src/modern_clcitems.cpp @@ -61,8 +61,7 @@ void AddSubcontacts(ClcData *dat, ClcContact *cont, BOOL showOfflineHereGroup) Cache_GetAvatar(dat, &p);
p.iImage = CallService(MS_CLIST_GETCONTACTICON,(WPARAM)cacheEntry->hContact,1);
- memset(p.iExtraImage,0xFF,sizeof(p.iExtraImage));
- memset((void*)p.iWideExtraImage,0xFF,sizeof(p.iWideExtraImage));
+ memset(p.iExtraImage, 0xFF, sizeof(p.iExtraImage));
p.proto = cacheEntry->m_cache_cszProto;
p.type = CLCIT_CONTACT;
p.flags = 0;//CONTACTF_ONLINE;
@@ -485,8 +484,7 @@ int GetNewSelection(ClcGroup *group, int selection, int direction) struct SavedContactState_t {
HANDLE hContact;
- BYTE iExtraImage[MAXEXTRACOLUMNS];
- WORD iWideExtraImage[MAXEXTRACOLUMNS];
+ WORD iExtraImage[EXTRA_ICON_COUNT];
int checked;
};
@@ -540,12 +538,7 @@ void cli_SaveStateAndRebuildList(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));
-
- CopyMemory((void*)p->iWideExtraImage, (void*)group->cl.items[group->scanIndex]->iWideExtraImage,
- sizeof(group->cl.items[group->scanIndex]->iWideExtraImage));
-
+ memcpy(p->iExtraImage, group->cl.items[group->scanIndex]->iExtraImage, sizeof(p->iExtraImage));
p->checked = group->cl.items[group->scanIndex]->flags & CONTACTF_CHECKED;
savedContact.insert( p );
}
@@ -586,12 +579,7 @@ void cli_SaveStateAndRebuildList(HWND hwnd, struct ClcData *dat) else if (group->cl.items[group->scanIndex]->type == CLCIT_CONTACT) {
for (i=0; i < savedContact.getCount(); i++)
if (savedContact[i].hContact == group->cl.items[group->scanIndex]->hContact) {
- CopyMemory(group->cl.items[group->scanIndex]->iExtraImage, savedContact[i].iExtraImage,
- sizeof(group->cl.items[group->scanIndex]->iExtraImage));
-
- CopyMemory((void*)group->cl.items[group->scanIndex]->iWideExtraImage, (void*)savedContact[i].iWideExtraImage,
- sizeof(group->cl.items[group->scanIndex]->iWideExtraImage));
-
+ 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;
@@ -632,26 +620,19 @@ WORD pdnce___GetStatus(pClcCacheEntry pdnce) return ID_STATUS_OFFLINE;
else
return pdnce->m_cache_nStatus;
- /*
- // this stub will replace direct usage of m_cache_nStatus and will be substituted by getting info from DB directrly
- if ( !pdnce) return ID_STATUS_OFFLINE;
- if ( !pdnce->m_cache_cszProto) return ID_STATUS_OFFLINE;
- if ( !pdnce->hContact) return ID_STATUS_OFFLINE;
- return DBGetContactSettingWord( pdnce->hContact, pdnce->m_cache_cszProto, "Status" , ID_STATUS_OFFLINE );
- */
}
-
void pdnce___SetStatus( pClcCacheEntry pdnce, WORD wStatus )
{
- if (pdnce) pdnce->m_cache_nStatus = wStatus;
+ if (pdnce)
+ pdnce->m_cache_nStatus = wStatus;
}
ClcContact* cliCreateClcContact()
{
- ClcContact* contact = (ClcContact*)mir_calloc(sizeof( ClcContact ));
- memset((void*)contact->iWideExtraImage,0xFF,sizeof(contact->iWideExtraImage));
- return contact;
+ ClcContact* contact = (ClcContact*)mir_calloc(sizeof( ClcContact ));
+ memset(contact->iExtraImage, 0xFF, sizeof(contact->iExtraImage));
+ return contact;
}
ClcCacheEntry* cliCreateCacheItem( HANDLE hContact )
diff --git a/plugins/Clist_modern/src/modern_clcmsgs.cpp b/plugins/Clist_modern/src/modern_clcmsgs.cpp index 5b3a3aafde..d5845db2e8 100644 --- a/plugins/Clist_modern/src/modern_clcmsgs.cpp +++ b/plugins/Clist_modern/src/modern_clcmsgs.cpp @@ -49,11 +49,6 @@ LRESULT cli_ProcessExternalMessages(HWND hwnd,struct ClcData *dat,UINT msg,WPARA }
return 0;
- case CLM_SETEXTRACOLUMNSSPACE:
- dat->extraColumnSpacing = (int)wParam;
- CLUI__cliInvalidateRect(hwnd,NULL,FALSE);
- return 0;
-
case CLM_SETFONT:
if (HIWORD(lParam) < 0 || HIWORD(lParam)>FONTID_MODERN_MAX) return 0;
@@ -226,37 +221,9 @@ LRESULT cli_ProcessExternalMessages(HWND hwnd,struct ClcData *dat,UINT msg,WPARA if ( !pcli->pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
return 0;
- contact->iExtraImage[LOWORD(lParam)] = (BYTE) HIWORD(lParam); //set oldstyle icon
- contact->iWideExtraImage[LOWORD(lParam)] = (WORD) 0xFFFF; //reset wide icon
+ contact->iExtraImage[LOWORD(lParam)] = HIWORD(lParam);
pcli->pfnInvalidateRect(hwnd, NULL, FALSE);
return 0;
-
- case CLM_SETWIDEEXTRAIMAGE:
- if (LOWORD(lParam) >= dat->extraColumnsCount)
- return 0;
-
- if ( !pcli->pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
- return 0;
-
- contact->iExtraImage[LOWORD(lParam)] = (BYTE) 0xFF; //reset oldstyle icon
- contact->iWideExtraImage[LOWORD(lParam)] = (WORD) HIWORD(lParam); //set wide icon
- pcli->pfnInvalidateRect(hwnd, NULL, FALSE);
- return 0;
-
- case CLM_SETEXTRAIMAGELIST:
- dat->himlExtraColumns = (HIMAGELIST) lParam;
- dat->himlWideExtraColumns = (HIMAGELIST) wParam;
- pcli->pfnInvalidateRect(hwnd, NULL, FALSE);
- return 0;
-
- case CLM_GETWIDEEXTRAIMAGE:
- if (LOWORD(lParam) >= dat->extraColumnsCount)
- return 0xFFFF;
-
- if ( !pcli->pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
- return 0xFFFF;
-
- return contact->iWideExtraImage[LOWORD(lParam)];
}
return corecli.pfnProcessExternalMessages(hwnd, dat, msg, wParam, lParam);
}
diff --git a/plugins/Clist_modern/src/modern_clcpaint.cpp b/plugins/Clist_modern/src/modern_clcpaint.cpp index cc567908cd..1faa3b03f9 100644 --- a/plugins/Clist_modern/src/modern_clcpaint.cpp +++ b/plugins/Clist_modern/src/modern_clcpaint.cpp @@ -814,15 +814,12 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, struct ClcData *dat, Clc {
COLORREF colourFg = dat->selBkColour;
int mode = BlendedInActiveState?BlendValue:ILD_NORMAL;
- if ( Drawing->iExtraImage[iImage] == 0xFF && Drawing->iWideExtraImage[iImage] == 0xFFFF )
- {
- {
- x += ( x>0 )?dat->extraColumnSpacing:ICON_HEIGHT;
- SetRect( &rc, fr_rc.right-x, p_rect.top, fr_rc.right-x+ICON_HEIGHT, p_rect.bottom );
- if ( dat->text_rtl != 0 ) _RTLRect( &rc, free_row_rc.right, 0 );
- Drawing->pos_extra[iImage] = rc;
- count++;
- }
+ if (Drawing->iExtraImage[iImage] == 0xFFFF) {
+ x += ( x>0 )?dat->extraColumnSpacing:ICON_HEIGHT;
+ SetRect( &rc, fr_rc.right-x, p_rect.top, fr_rc.right-x+ICON_HEIGHT, p_rect.bottom );
+ if ( dat->text_rtl != 0 ) _RTLRect( &rc, free_row_rc.right, 0 );
+ Drawing->pos_extra[iImage] = rc;
+ count++;
continue;
}
@@ -843,13 +840,9 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, struct ClcData *dat, Clc if ( dat->text_rtl != 0 ) _RTLRect( &rc, free_row_rc.right, dx );
Drawing->pos_extra[iImage] = rc;
Drawing->pos_extra[iImage] = rc;
- if ( Drawing->iExtraImage[iImage] != 0xFF )
+ if (Drawing->iExtraImage[iImage] != 0xFFFF)
ske_ImageList_DrawEx( dat->himlExtraColumns, Drawing->iExtraImage[iImage], hdcMem,
- rc.left, rc.top, 0, 0, CLR_NONE, colourFg, mode );
- else if ( Drawing->iWideExtraImage[iImage] != 0xFFFF )
- ske_ImageList_DrawEx( dat->himlWideExtraColumns, Drawing->iWideExtraImage[iImage], hdcMem,
- rc.left, rc.top, 0, 0, CLR_NONE, colourFg, mode );
-
+ rc.left, rc.top, 0, 0, CLR_NONE, colourFg, mode );
}
fr_rc.right -= x;
}
@@ -1581,14 +1574,11 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, struct ClcData *dat, Clc int count = 0;
RECT rc;
int x = 0;
- for ( iImage = 0; iImage < dat->extraColumnsCount ; iImage++ )
- {
+ for ( iImage = 0; iImage < dat->extraColumnsCount ; iImage++ ) {
COLORREF colourFg = dat->selBkColour;
int mode = BlendedInActiveState?BlendValue:ILD_NORMAL;
- if ( Drawing->iExtraImage[iImage] == 0xFF && Drawing->iWideExtraImage[iImage] == 0xFFFF )
- {
- if ( !dat->MetaIgnoreEmptyExtra )
- {
+ if (Drawing->iExtraImage[iImage] == 0xFFFF) {
+ if ( !dat->MetaIgnoreEmptyExtra) {
SetRect( &rc, p_rect.left+x, p_rect.top, p_rect.left+x+ICON_HEIGHT, p_rect.bottom );
x += dat->extraColumnSpacing;
if ( dat->text_rtl != 0 ) _RTLRect( &rc, free_row_rc.right, 0 );
@@ -1598,14 +1588,13 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, struct ClcData *dat, Clc continue;
}
- if ( selected ) mode = BlendedInActiveState?ILD_NORMAL:ILD_SELECTED;
- else if ( hottrack )
- {
+ if ( selected )
+ mode = BlendedInActiveState?ILD_NORMAL:ILD_SELECTED;
+ else if (hottrack) {
mode = BlendedInActiveState?ILD_NORMAL:ILD_FOCUS;
colourFg = dat->hotTextColour;
}
- else if ( Drawing->type == CLCIT_CONTACT && Drawing->flags&CONTACTF_NOTONLIST )
- {
+ else if (Drawing->type == CLCIT_CONTACT && (Drawing->flags & CONTACTF_NOTONLIST)) {
colourFg = dat->fontModernInfo[FONTID_NOTONLIST].colour;
mode = BlendValue;
}
@@ -1615,12 +1604,9 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, struct ClcData *dat, Clc count++;
if ( dat->text_rtl != 0 ) _RTLRect( &rc, free_row_rc.right, 0 );
Drawing->pos_extra[iImage] = rc;
- if ( Drawing->iExtraImage[iImage] != 0xFF )
+ if (Drawing->iExtraImage[iImage] != 0xFFFF)
ske_ImageList_DrawEx( dat->himlExtraColumns, Drawing->iExtraImage[iImage], hdcMem,
- rc.left, rc.top, 0, 0, CLR_NONE, colourFg, mode );
- else if ( Drawing->iWideExtraImage[iImage] != 0xFFFF )
- ske_ImageList_DrawEx( dat->himlWideExtraColumns, Drawing->iWideExtraImage[iImage], hdcMem,
- rc.left, rc.top, 0, 0, CLR_NONE, colourFg, mode );
+ rc.left, rc.top, 0, 0, CLR_NONE, colourFg, mode );
}
}
break;
@@ -1640,8 +1626,7 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, struct ClcData *dat, Clc {
int eNum = gl_RowTabAccess[i]->type-TC_EXTRA1;
if ( eNum < dat->extraColumnsCount )
- if ( Drawing->iExtraImage[eNum] != 0xFF || Drawing->iWideExtraImage[eNum] != 0xFFFF )
- {
+ if (Drawing->iExtraImage[eNum] != 0xFFFF) {
int mode = 0;
int BlendedInActiveState = dat->dbbBlendInActiveState;
int BlendValue = dat->dbbBlend25 ? ILD_BLEND25 : ILD_BLEND50;
@@ -1663,12 +1648,9 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, struct ClcData *dat, Clc }
if ( dat->text_rtl != 0 ) _RTLRect( &p_rect, free_row_rc.right, 0 );
Drawing->pos_extra[eNum] = p_rect;
- if ( Drawing->iExtraImage[eNum] != 0xFF )
+ if (Drawing->iExtraImage[eNum] != 0xFFFF)
ske_ImageList_DrawEx( dat->himlExtraColumns, Drawing->iExtraImage[eNum], hdcMem,
- p_rect.left, p_rect.top, 0, 0, CLR_NONE, colourFg, mode );
- else if ( Drawing->iWideExtraImage[eNum] != 0xFFFF )
- ske_ImageList_DrawEx( dat->himlWideExtraColumns, Drawing->iWideExtraImage[eNum], hdcMem,
- p_rect.left, p_rect.top, 0, 0, CLR_NONE, colourFg, mode );
+ p_rect.left, p_rect.top, 0, 0, CLR_NONE, colourFg, mode );
}
}
}
@@ -2558,14 +2540,11 @@ void CLCPaint::_CalcItemsPos( HWND hwnd, HDC hdcMem, struct ClcData *dat, ClcCon int count = 0;
RECT rc;
- for ( iImage = dat->extraColumnsCount-1 ; iImage >= 0 ; iImage -- )
- {
- if ( Drawing->iExtraImage[iImage] != 0xFF || Drawing->iWideExtraImage[iImage] != 0xFFFF || !dat->MetaIgnoreEmptyExtra )
- {
+ for ( iImage = dat->extraColumnsCount-1 ; iImage >= 0 ; iImage-- ) {
+ if ( Drawing->iExtraImage[iImage] != 0xFFFF || !dat->MetaIgnoreEmptyExtra ) {
rc = _GetRectangle( dat, &row_rc, &free_row_rc, &left_pos, &right_pos,
left, dat->extraColumnSpacing, dat->extraColumnSpacing, ICON_HEIGHT, 0 );
- if ( rc.left < rc.right )
- {
+ if (rc.left < rc.right) {
// Store position
_StoreItemPos( Drawing, CIT_EXTRA|( iImage&0x3F ), &rc );
//Drawing->pos_extra[iImage] = rc;
@@ -3261,17 +3240,13 @@ void CLCPaint::_DrawContactSelection( HDC hdcMem, struct ClcData *dat, ClcContac void CLCPaint::_DrawContactExtraIcon( HDC hdcMem, struct ClcData *dat, ClcContact *Drawing, int& selected, int& hottrack, RECT& text_rc, RECT * rc, int iImage )
{
//Draw extra icon
- COLORREF colourFg;
- int mode;
- if ( iImage != -1 )
- {
+ if ( iImage != -1 ) {
+ int mode;
+ COLORREF colourFg;
_GetBlendMode( dat, Drawing, selected, hottrack, GIM_EXTRAICON_AFFECT, &colourFg, &mode );
- if ( Drawing->iExtraImage[iImage] != 0xFF )
+ if (Drawing->iExtraImage[iImage] != 0xFFFF)
ske_ImageList_DrawEx( dat->himlExtraColumns, Drawing->iExtraImage[iImage], hdcMem,
- rc->left, rc->top, 0, 0, CLR_NONE, colourFg, mode );
- else if ( Drawing->iWideExtraImage[iImage] != 0xFFFF )
- ske_ImageList_DrawEx( dat->himlWideExtraColumns, Drawing->iWideExtraImage[iImage], hdcMem,
- rc->left, rc->top, 0, 0, CLR_NONE, colourFg, mode );
+ rc->left, rc->top, 0, 0, CLR_NONE, colourFg, mode );
}
}
diff --git a/plugins/Clist_modern/src/modern_clui.cpp b/plugins/Clist_modern/src/modern_clui.cpp index 79e947940b..872cb6e165 100644 --- a/plugins/Clist_modern/src/modern_clui.cpp +++ b/plugins/Clist_modern/src/modern_clui.cpp @@ -2701,7 +2701,6 @@ LRESULT CLUI::OnListRebuildNotify(NMCLISTCONTROL *pnmc) LRESULT CLUI::OnListSizeChangeNotify( NMCLISTCONTROL * pnmc )
{
-
// TODO: Check and refactor possible problem of clist resized to full screen problem
static RECT rcWindow,rcTree,rcTree2,rcWorkArea,rcOld;
int maxHeight, minHeight,newHeight;
diff --git a/plugins/Clist_modern/src/modern_rowheight_funcs.cpp b/plugins/Clist_modern/src/modern_rowheight_funcs.cpp index 2a9a1df6ef..411fa0234a 100644 --- a/plugins/Clist_modern/src/modern_rowheight_funcs.cpp +++ b/plugins/Clist_modern/src/modern_rowheight_funcs.cpp @@ -259,7 +259,7 @@ int mod_CalcRowHeight_worker(struct ClcData *dat, HWND hwnd, ClcContact *contact BOOL hasExtra = FALSE;
int width = 0;
for (int k = 0; k < dat->extraColumnsCount; k++)
- if (contact->iExtraImage[k] != 0xFF || contact->iWideExtraImage[k] != 0xFFFF || !dat->MetaIgnoreEmptyExtra) {
+ if (contact->iExtraImage[k] != 0xFFFF || !dat->MetaIgnoreEmptyExtra) {
hasExtra = TRUE;
if (item != -1) break;
width += (width>0)?dat->extraColumnSpacing:(dat->extraColumnSpacing-2);
@@ -285,7 +285,7 @@ int mod_CalcRowHeight_worker(struct ClcData *dat, HWND hwnd, ClcContact *contact {
int eNum = gl_RowTabAccess[i]->type-TC_EXTRA1;
if (eNum < dat->extraColumnsCount)
- if (contact->iExtraImage[eNum] != 255 || contact->iWideExtraImage[eNum] != 0xFFFF || !dat->MetaIgnoreEmptyExtra) {
+ if (contact->iExtraImage[eNum] != 0xFFFF || !dat->MetaIgnoreEmptyExtra) {
gl_RowTabAccess[i]->h = ICON_HEIGHT;
gl_RowTabAccess[i]->w = ICON_HEIGHT;
}
diff --git a/plugins/Clist_mw/clist_mw_10.vcxproj b/plugins/Clist_mw/clist_mw_10.vcxproj index a2ea05bbef..7a428e051e 100644 --- a/plugins/Clist_mw/clist_mw_10.vcxproj +++ b/plugins/Clist_mw/clist_mw_10.vcxproj @@ -219,9 +219,6 @@ <ClCompile Include="src\CLUIFrames\cluiframes.cpp">
<PrecompiledHeaderFile>..\commonheaders.h</PrecompiledHeaderFile>
</ClCompile>
- <ClCompile Include="src\CLUIFrames\extraimage.cpp">
- <PrecompiledHeaderFile>..\commonheaders.h</PrecompiledHeaderFile>
- </ClCompile>
<ClCompile Include="src\CLUIFrames\framesmenu.cpp">
<PrecompiledHeaderFile>..\commonheaders.h</PrecompiledHeaderFile>
</ClCompile>
diff --git a/plugins/Clist_mw/clist_mw_10.vcxproj.filters b/plugins/Clist_mw/clist_mw_10.vcxproj.filters index a8574cbca8..5c85e8914a 100644 --- a/plugins/Clist_mw/clist_mw_10.vcxproj.filters +++ b/plugins/Clist_mw/clist_mw_10.vcxproj.filters @@ -84,9 +84,6 @@ <ClCompile Include="src\CLUIFrames\cluiframes.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="src\CLUIFrames\extraimage.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
<ClCompile Include="src\CLUIFrames\framesmenu.cpp">
<Filter>Source Files</Filter>
</ClCompile>
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;
diff --git a/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp b/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp index e3f277004b..d1e36fca10 100644 --- a/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp +++ b/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp @@ -27,7 +27,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "cluiframes.h"
HFONT __fastcall ChangeToFont(HDC hdc, struct ClcData *dat, int id, int *fontHeight);
-extern HIMAGELIST himlExtraImages;
extern HWND g_hwndViewModeFrame, g_hwndEventArea;
extern StatusItems_t *StatusItems;
extern int mf_updatethread_running;
@@ -3386,75 +3385,9 @@ static int CLUIFrameOnModulesUnload(WPARAM wParam, LPARAM lParam) }
/*
-static INT_PTR SetIconForExtraColumn(WPARAM wParam, LPARAM lParam)
-{
- pIconExtraColumn piec;
-
- if (pcli->hwndContactTree == 0)
- return -1;
-
- if (wParam == 0 || lParam == 0 || IsBadCodePtr((FARPROC)lParam))
- return -1;
-
- piec = (pIconExtraColumn)lParam;
-
- if (piec->cbSize != sizeof(IconExtraColumn))
- return -1;
-
- if (cfg::dat.bMetaAvail && cfg::dat.bMetaEnabled && cfg::getByte((HANDLE)wParam, cfg::dat.szMetaName, "IsSubcontact", 0))
- PostMessage(pcli->hwndContactTree, CLM_SETEXTRAIMAGEINTMETA, wParam, MAKELONG((WORD)piec->ColumnType, (WORD)piec->hImage));
- else
- PostMessage(pcli->hwndContactTree, CLM_SETEXTRAIMAGEINT, wParam, MAKELONG((WORD)piec->ColumnType, (WORD)piec->hImage));
- return 0;
-}
-*/
-/*
* wparam=hIcon
* return hImage on success,-1 on failure
*/
-static INT_PTR AddIconToExtraImageList(WPARAM wParam, LPARAM lParam)
-{
- if (himlExtraImages == 0 || wParam == 0)
- return -1;
-
- return((int)ImageList_AddIcon(himlExtraImages, (HICON)wParam));
-}
-
-/*
-static INT_PTR SkinDrawBgService(WPARAM wParam, LPARAM lParam)
-{
- StatusItems_t item;
- HWND hwnd;
- RECT rc;
-
- SKINDRAWREQUEST *sdrq = (SKINDRAWREQUEST *)wParam;
-
- if (wParam == 0 || IsBadCodePtr((FARPROC)wParam) || pDrawAlpha == NULL)
- return 0;
-
- hwnd = WindowFromDC(sdrq->hDC);
- GetClientRect(hwnd, &rc);
- if (strstr(sdrq->szObjectID, "/Background") && EqualRect(&sdrq->rcClipRect, &sdrq->rcDestRect)) {
- SkinDrawBg(hwnd, sdrq->hDC);
- GetItemByStatus(ID_EXTBKEVTAREA, &item);
- if (item.IGNORED)
- FillRect(sdrq->hDC, &(sdrq->rcClipRect), GetSysColorBrush(COLOR_3DFACE));
- else {
- DrawAlpha(sdrq->hDC, &(sdrq->rcClipRect), item.COLOR, item.ALPHA, item.COLOR2, item.COLOR2_TRANSPARENT,
- item.GRADIENT, item.CORNER, item.BORDERSTYLE, item.imageItem);
- }
- }
- else {
- GetItemByStatus(ID_EXTBKEVTAREA, &item);
- if (item.IGNORED)
- FillRect(sdrq->hDC, &(sdrq->rcClipRect), GetSysColorBrush(COLOR_3DFACE));
- else {
- DrawAlpha(sdrq->hDC, &(sdrq->rcClipRect), item.COLOR, item.ALPHA, item.COLOR2, item.COLOR2_TRANSPARENT,
- item.GRADIENT, item.CORNER, item.BORDERSTYLE, item.imageItem);
- }
- }
-}
-*/
void RegisterCLUIFrameClasses()
{
@@ -3572,8 +3505,3 @@ int UnLoadCLUIFramesModule(void) UnitFramesMenu();
return 0;
}
-
-void ReloadExtraIcons()
-{
- NotifyEventHooks(hExtraImageListRebuilding, 0, 0);
-}
diff --git a/plugins/Clist_nicer/src/Include/clc.h b/plugins/Clist_nicer/src/Include/clc.h index eb1ea2b004..d4c69bcb4f 100644 --- a/plugins/Clist_nicer/src/Include/clc.h +++ b/plugins/Clist_nicer/src/Include/clc.h @@ -30,8 +30,6 @@ *
*/
-#define MAXEXTRACOLUMNS 16
-
#define INTM_XSTATUSCHANGED (WM_USER+26)
#define INTM_METACHANGEDEVENT (WM_USER+27)
#define INTM_CODEPAGECHANGED (WM_USER+28)
@@ -54,7 +52,6 @@ #define TIMERID_SORT 15
#define TIMERID_REFRESH 18
#define TIMERID_PAINT 19
-ClcGroup;
#define CONTACTF_ONLINE 1
#define CONTACTF_INVISTO 2
@@ -115,8 +112,6 @@ typedef ContactFloater CONTACTFLOATER; #define DSPF_DONTSEPARATEOFFLINE 32
#define DSPF_CENTERGROUPNAMES 64
-#define EXICON_COUNT 11
-
/* Extra icons settings */
typedef struct _OrderTreeData
{
@@ -129,12 +124,12 @@ typedef struct _OrderTreeData struct DisplayProfile
{
- DWORD dwFlags;
- DWORD dwExtraImageMask;
- int exIconScale;
- BOOL bCenterStatusIcons;
- BOOL bDimIdle, bNoOfflineAvatars, bShowLocalTime, bShowLocalTimeSelective, bDontSeparateOffline, bCenterGroupNames;
- BYTE dualRowMode;
+ DWORD dwFlags;
+ DWORD dwExtraImageMask;
+ int exIconScale;
+ BOOL bCenterStatusIcons;
+ BOOL bDimIdle, bNoOfflineAvatars, bShowLocalTime, bShowLocalTimeSelective, bDontSeparateOffline, bCenterGroupNames;
+ BYTE dualRowMode;
COLORREF avatarBorder;
DWORD avatarRadius;
int avatarSize;
@@ -143,7 +138,6 @@ struct DisplayProfile BYTE sortOrder[3], bUseDCMirroring, bGroupAlign;
BYTE avatarPadding;
BYTE bLeftMargin, bRightMargin, bRowSpacing, bGroupIndent, bRowHeight, bGroupRowHeight;
- BYTE exIconOrder[EXICON_COUNT];
};
typedef struct DisplayProfile DISPLAYPROFILE;
@@ -162,10 +156,8 @@ typedef struct DisplayProfileSet DISPLAYPROFILESET; struct TExtraCache
{
- WORD iExtraImage[MAXEXTRACOLUMNS];
HANDLE hContact;
HANDLE hTimeZone;
- DWORD iExtraValid;
BYTE valid;
TCHAR *statusMsg;
BYTE bStatusMsgValid;
@@ -377,7 +369,6 @@ struct TCluiData { BOOL fOnDesktop;
int group_padding;
DWORD t_now;
- BYTE exIconOrder[EXICON_COUNT];
BOOL realTimeSaving;
TCHAR tszProfilePath[MAX_PATH];
FILETIME ft;
@@ -566,18 +557,6 @@ int CoolSB_SetupScrollBar(); #define SETTING_WINDOWSTYLE_THINBORDER 2
#define SETTING_WINDOWSTYLE_NOBORDER 3
-#define EIMG_SHOW_RES0 8
-#define EIMG_SHOW_EMAIL 1
-#define EIMG_SHOW_WEB 2
-#define EIMG_SHOW_SMS 4
-#define EIMG_SHOW_ADV1 16
-#define EIMG_SHOW_ADV2 32
-#define EIMG_SHOW_ADV3 512
-#define EIMG_SHOW_CLIENT 64
-#define EIMG_SHOW_ADV4 1024
-#define EIMG_SHOW_RES1 128
-#define EIMG_SHOW_RES2 256
-
#define CLCHT_ONITEMEXTRAEX 0x1000 //on an extra icon, HIBYTE(HIWORD()) says which
#define CLCHT_ONAVATAR 0x2000
#define CLCHT_ONITEMSPACE 0x4000
diff --git a/plugins/Clist_nicer/src/Include/commonheaders.h b/plugins/Clist_nicer/src/Include/commonheaders.h index 27f0da733b..8fb2a7f6a4 100644 --- a/plugins/Clist_nicer/src/Include/commonheaders.h +++ b/plugins/Clist_nicer/src/Include/commonheaders.h @@ -36,7 +36,6 @@ #define _WIN32_IE 0x0501
#define _CRT_SECURE_NO_WARNINGS
-#define EXTRA_ICON_COUNT 11
#undef FASTCALL
diff --git a/plugins/Clist_nicer/src/clc.cpp b/plugins/Clist_nicer/src/clc.cpp index 486a81e3f4..e3163f5aaf 100644 --- a/plugins/Clist_nicer/src/clc.cpp +++ b/plugins/Clist_nicer/src/clc.cpp @@ -47,7 +47,6 @@ extern int during_sizing; extern StatusItems_t *StatusItems;
HIMAGELIST hCListImages;
-extern HIMAGELIST himlExtraImages;
HANDLE hIcoLibChanged = 0, hSvc_GetContactStatusMsg = 0;
@@ -289,7 +288,6 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L RowHeight::Init(dat);
dat->forceScroll = 0;
dat->lastRepaint = 0;
- dat->himlExtraColumns = himlExtraImages;
dat->hwndParent = GetParent(hwnd);
dat->lastSort = GetTickCount();
dat->needsResort = FALSE;
@@ -324,12 +322,12 @@ LBL_Def: return FrameNCPaint(hwnd, DefWindowProc, wParam, lParam, frameHasTitlebar);
case INTM_GROUPCHANGED: {
ClcContact *contact;
- BYTE iExtraImage[MAXEXTRACOLUMNS];
+ WORD iExtraImage[EXTRA_ICON_COUNT];
BYTE flags = 0;
if (!FindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
memset(iExtraImage, 0xFF, sizeof(iExtraImage));
else {
- CopyMemory(iExtraImage, contact->iExtraImage, sizeof(iExtraImage));
+ memcpy(iExtraImage, contact->iExtraImage, sizeof(iExtraImage));
flags = contact->flags;
}
pcli->pfnDeleteItemFromTree(hwnd, (HANDLE) wParam);
@@ -337,7 +335,7 @@ LBL_Def: NMCLISTCONTROL nm;
pcli->pfnAddContactToTree(hwnd, dat, (HANDLE) wParam, 1, 1);
if (FindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL)) {
- CopyMemory(contact->iExtraImage, iExtraImage, sizeof(iExtraImage));
+ memcpy(contact->iExtraImage, iExtraImage, sizeof(iExtraImage));
if (flags & CONTACTF_CHECKED)
contact->flags |= CONTACTF_CHECKED;
}
@@ -417,19 +415,23 @@ LBL_Def: }
case INTM_METACHANGED: {
ClcContact *contact;
- if (!pcli->pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
+ if ( !pcli->pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
break;
+
if (contact->bIsMeta && cfg::dat.bMetaAvail && !(cfg::dat.dwFlags & CLUI_USEMETAICONS)) {
contact->hSubContact = (HANDLE) CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM) contact->hContact, 0);
contact->metaProto = (char*) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) contact->hSubContact, 0);
contact->iImage = CallService(MS_CLIST_GETCONTACTICON, (WPARAM) contact->hSubContact, 0);
if (contact->extraCacheEntry >= 0 && contact->extraCacheEntry < cfg::nextCacheEntry) {
int subIndex = cfg::getCache(contact->hSubContact, contact->metaProto);
+ ClcContact *subContact;
+ if ( !pcli->pfnFindItem(hwnd, dat, (HANDLE)contact->hSubContact, &subContact, NULL, NULL))
+ break;
+
cfg::eCache[contact->extraCacheEntry].proto_status_item = GetProtocolStatusItem(contact->metaProto);
if (subIndex >= 0 && subIndex <= cfg::nextCacheEntry) {
cfg::eCache[contact->extraCacheEntry].status_item = cfg::eCache[subIndex].status_item;
- CopyMemory(cfg::eCache[contact->extraCacheEntry].iExtraImage, cfg::eCache[subIndex].iExtraImage, MAXEXTRACOLUMNS);
- cfg::eCache[contact->extraCacheEntry].iExtraValid = cfg::eCache[subIndex].iExtraValid;
+ memcpy(contact->iExtraImage, subContact->iExtraImage, sizeof(contact->iExtraImage));
}
}
}
diff --git a/plugins/Clist_nicer/src/clcitems.cpp b/plugins/Clist_nicer/src/clcitems.cpp index 97f438dbc5..3705104501 100644 --- a/plugins/Clist_nicer/src/clcitems.cpp +++ b/plugins/Clist_nicer/src/clcitems.cpp @@ -476,9 +476,6 @@ void GetExtendedInfo(ClcContact *contact, struct ClcData *dat) return;
cfg::eCache[index].isChatRoom = cfg::getByte(contact->hContact, contact->proto, "ChatRoom", 0);
-
- cfg::eCache[index].iExtraValid &= ~(EIMG_SHOW_EMAIL | EIMG_SHOW_SMS | EIMG_SHOW_WEB);
- memset(cfg::eCache[index].iExtraImage, 0xFF, sizeof(cfg::eCache[index].iExtraImage));
}
void LoadSkinItemToCache(struct TExtraCache *cEntry, const char *szProto)
diff --git a/plugins/Clist_nicer/src/clcmsgs.cpp b/plugins/Clist_nicer/src/clcmsgs.cpp index c1900f2141..0b3dd76d22 100644 --- a/plugins/Clist_nicer/src/clcmsgs.cpp +++ b/plugins/Clist_nicer/src/clcmsgs.cpp @@ -53,77 +53,19 @@ LRESULT ProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM break;
}
- case CLM_SETEXTRAIMAGEINT:
- {
- ClcContact *contact = NULL;
- int index = -1;
-
- if (LOWORD(lParam) >= MAXEXTRACOLUMNS || wParam == 0)
- return 0;
-
- if (!FindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
- return 0;
-
- index = contact->extraCacheEntry;
-
- if (contact->type != CLCIT_CONTACT) // || contact->bIsMeta)
- return 0;
-
- //if (contact->bIsMeta && LOWORD(lParam) != EIMG_EXTRA && LOWORD(lParam) != EIMG_CLIENT)
- // return 0;
-
- /*
- if (contact->hContact == 5846286) {
- _DebugTraceA("set extra image %d", LOWORD(lParam));
- }
- */
- if (index >= 0 && index < cfg::nextCacheEntry) {
- cfg::eCache[index].iExtraImage[LOWORD(lParam)] = (BYTE)HIWORD(lParam);
- cfg::eCache[index].iExtraValid = cfg::eCache[index].iExtraImage[LOWORD(lParam)] != 0xffff ? (cfg::eCache[index].iExtraValid | (1 << LOWORD(lParam))) : (cfg::eCache[index].iExtraValid & ~(1 << LOWORD(lParam)));
- PostMessage(hwnd, INTM_INVALIDATE, 0, (LPARAM)(contact ? contact->hContact : 0));
- }
- }
- return 0;
- case CLM_SETEXTRAIMAGEINTMETA:
- {
- HANDLE hMasterContact = 0;
- int index = -1;
-
- if (LOWORD(lParam) >= MAXEXTRACOLUMNS)
- return 0;
-
- index = cfg::getCache((HANDLE)wParam, NULL);
- if (index >= 0 && index < cfg::nextCacheEntry) {
- cfg::eCache[index].iExtraImage[LOWORD(lParam)] = (BYTE)HIWORD(lParam);
- cfg::eCache[index].iExtraValid = cfg::eCache[index].iExtraImage[LOWORD(lParam)] != 0xffff ? (cfg::eCache[index].iExtraValid | (1 << LOWORD(lParam))) : (cfg::eCache[index].iExtraValid & ~(1 << LOWORD(lParam)));
- }
-
- hMasterContact = (HANDLE)cfg::getDword((HANDLE)wParam, cfg::dat.szMetaName, "Handle", 0);
-
- index = cfg::getCache(hMasterContact, NULL);
- if (index >= 0 && index < cfg::nextCacheEntry) {
- cfg::eCache[index].iExtraImage[LOWORD(lParam)] = (BYTE)HIWORD(lParam);
- cfg::eCache[index].iExtraValid = cfg::eCache[index].iExtraImage[LOWORD(lParam)] != 0xffff ? (cfg::eCache[index].iExtraValid | (1 << LOWORD(lParam))) : (cfg::eCache[index].iExtraValid & ~(1 << LOWORD(lParam)));
- PostMessage(hwnd, INTM_INVALIDATE, 0, 0);
- }
- }
- return 0;
-
case CLM_GETSTATUSMSG:
- {
+ if (wParam) {
ClcContact *contact = NULL;
-
- if (wParam == 0)
- return 0;
-
if (!FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL))
return 0;
+
if (contact->type != CLCIT_CONTACT)
return 0;
- if (contact->extraCacheEntry >= 0 && contact->extraCacheEntry <= cfg::nextCacheEntry) {
+
+ if (contact->extraCacheEntry >= 0 && contact->extraCacheEntry <= cfg::nextCacheEntry)
if (cfg::eCache[contact->extraCacheEntry].bStatusMsgValid != STATUSMSG_NOTFOUND)
return((INT_PTR)cfg::eCache[contact->extraCacheEntry].statusMsg);
- } }
+ }
return 0;
case CLM_SETHIDESUBCONTACTS:
@@ -131,12 +73,8 @@ LRESULT ProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM return 0;
case CLM_TOGGLEPRIORITYCONTACT:
- {
+ if (wParam) {
ClcContact *contact = NULL;
-
- if (wParam == 0)
- return 0;
-
if (!FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL))
return 0;
if (contact->type != CLCIT_CONTACT)
@@ -144,39 +82,32 @@ LRESULT ProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM contact->flags ^= CONTACTF_PRIORITY;
cfg::writeByte(contact->hContact, "CList", "Priority", (BYTE)(contact->flags & CONTACTF_PRIORITY ? 1 : 0));
pcli->pfnClcBroadcast(CLM_AUTOREBUILD, 0, 0);
- return 0;
}
+ return 0;
+
case CLM_QUERYPRIORITYCONTACT:
- {
+ if (wParam) {
ClcContact *contact = NULL;
-
- if (wParam == 0)
- return 0;
-
if (!FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL))
return 0;
if (contact->type != CLCIT_CONTACT)
return 0;
return(contact->flags & CONTACTF_PRIORITY ? 1 : 0);
}
+ return 0;
+
case CLM_TOGGLEFLOATINGCONTACT:
- {
+ if (wParam) {
ClcContact *contact = NULL;
- BYTE state;
- int iEntry;
-
- if (wParam == 0)
- return 0;
-
if (!FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL))
return 0;
if (contact->type != CLCIT_CONTACT)
return 0;
- iEntry = contact->extraCacheEntry;
+ int iEntry = contact->extraCacheEntry;
if (iEntry >= 0 && iEntry <= cfg::nextCacheEntry) {
- state = !cfg::getByte(contact->hContact, "CList", "floating", 0);
+ BYTE state = !cfg::getByte(contact->hContact, "CList", "floating", 0);
if (state) {
if (cfg::eCache[iEntry].floater == NULL)
FLT_Create(iEntry);
@@ -190,17 +121,12 @@ LRESULT ProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM }
cfg::writeByte(contact->hContact, "CList", "floating", state);
}
- return 0;
- }
- case CLM_QUERYFLOATINGCONTACT:
- {
- return(cfg::getByte((HANDLE)wParam, "CList", "floating", 0));
}
- case CLM_SETEXTRAIMAGELIST:
- dat->himlExtraColumns = (HIMAGELIST) lParam;
- InvalidateRect(hwnd, NULL, FALSE);
return 0;
+ case CLM_QUERYFLOATINGCONTACT:
+ return cfg::getByte((HANDLE)wParam, "CList", "floating", 0);
+
case CLM_SETFONT:
if (HIWORD(lParam)<0 || HIWORD(lParam)>FONTID_LAST)
return 0;
diff --git a/plugins/Clist_nicer/src/clcopts.cpp b/plugins/Clist_nicer/src/clcopts.cpp index 7555aacb94..0f38eef919 100644 --- a/plugins/Clist_nicer/src/clcopts.cpp +++ b/plugins/Clist_nicer/src/clcopts.cpp @@ -41,9 +41,6 @@ extern INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP extern INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
extern INT_PTR CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
extern INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-extern void ReloadExtraIcons( void );
-
-extern HIMAGELIST himlExtraImages;
struct CheckBoxToStyleEx_t {
int id;
@@ -314,7 +311,6 @@ static void DSP_LoadFromDefaults(DISPLAYPROFILE *p) p->bGroupIndent = cfg::getByte("CLC", "GroupIndent", CLCDEFAULT_GROUPINDENT);
p->bRowHeight = cfg::getByte("CLC", "RowHeight", CLCDEFAULT_ROWHEIGHT);
p->bGroupRowHeight = cfg::getByte("CLC", "GRowHeight", CLCDEFAULT_ROWHEIGHT);
- CopyMemory(p->exIconOrder, cfg::dat.exIconOrder, EXICON_COUNT);
}
/*
@@ -327,7 +323,7 @@ void DSP_Apply(DISPLAYPROFILE *p) DWORD oldMask = cfg::dat.dwExtraImageMask;
int i;
DWORD exStyle;
- char temp[EXICON_COUNT + 1];
+ char temp[EXTRA_ICON_COUNT + 1];
/*
* icons page
*/
@@ -340,10 +336,6 @@ void DSP_Apply(DISPLAYPROFILE *p) cfg::writeByte("CLC", "ExIconScale", (BYTE)cfg::dat.exIconScale);
cfg::writeByte("CLC", "si_centered", (BYTE)cfg::dat.bCenterStatusIcons);
cfg::writeByte("CLC", "ShowIdle", (BYTE)p->bDimIdle);
-
- CopyMemory(cfg::dat.exIconOrder, p->exIconOrder, EXICON_COUNT);
- CopyMemory(temp, p->exIconOrder, EXICON_COUNT);
- temp[EXICON_COUNT] = 0;
cfg::writeString(NULL, "CLUI", "exIconOrder", temp);
/*
@@ -438,11 +430,9 @@ void DSP_Apply(DISPLAYPROFILE *p) for (i = 0; i < cfg::nextCacheEntry; i++)
cfg::eCache[i].dwXMask = CalcXMask(cfg::eCache[i].hContact);
- if (oldexIconScale != cfg::dat.exIconScale) {
- ImageList_RemoveAll(himlExtraImages);
- ImageList_SetIconSize(himlExtraImages, cfg::dat.exIconScale, cfg::dat.exIconScale);
+ if (oldexIconScale != cfg::dat.exIconScale)
IcoLibReloadIcons();
- }
+
pcli->pfnClcOptionsChanged();
pcli->pfnClcBroadcast(CLM_AUTOREBUILD, 0, 0);
}
@@ -1373,7 +1363,7 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, if (!GetOpenFileNameA(&ofn))
break;
SetDlgItemTextA(hwndDlg, IDC_FILENAME, str);
- }
+ }
else if (LOWORD(wParam) == IDC_FILENAME && HIWORD(wParam) != EN_CHANGE)
break;
diff --git a/plugins/Clist_nicer/src/clcpaint.cpp b/plugins/Clist_nicer/src/clcpaint.cpp index 45a525e65d..03b9e0141e 100644 --- a/plugins/Clist_nicer/src/clcpaint.cpp +++ b/plugins/Clist_nicer/src/clcpaint.cpp @@ -226,7 +226,8 @@ void PaintNotifyArea(HDC hDC, RECT *rc) DrawText(hDC, szName, -1, rc, DT_VCENTER | DT_SINGLELINE);
ImageList_DrawEx(hCListImages, (int)cfg::dat.hIconNotify, hDC, 4, (rc->bottom + rc->top - 16) / 2, 16, 16, CLR_NONE, CLR_NONE, ILD_NORMAL);
ev_lastIcon = cfg::dat.hIconNotify;
- } else if (iCount > 0) {
+ }
+ else if (iCount > 0) {
MENUITEMINFO mii = {0};
struct NotifyMenuItemExData *nmi;
TCHAR *szName;
@@ -243,7 +244,8 @@ void PaintNotifyArea(HDC hDC, RECT *rc) ImageList_DrawEx(hCListImages, nmi->iIcon, hDC, 4, (rc->bottom + rc->top) / 2 - 8, 16, 16, CLR_NONE, CLR_NONE, ILD_NORMAL);
DrawText(hDC, szName, -1, rc, DT_VCENTER | DT_SINGLELINE);
ev_lastIcon = (int)nmi->hIcon;
- } else {
+ }
+ else {
HICON hIcon = reinterpret_cast<HICON>(LoadImage(g_hInst, MAKEINTRESOURCE(IDI_BLANK), IMAGE_ICON, 16, 16, 0));
DrawText(hDC, cfg::dat.szNoEvents, lstrlen(cfg::dat.szNoEvents), rc, DT_VCENTER | DT_SINGLELINE);
DrawIconEx(hDC, 4, (rc->bottom + rc->top - 16) / 2, hIcon, 16, 16, 0, 0, DI_NORMAL | DI_COMPAT);
@@ -478,7 +480,6 @@ void __inline PaintItem(HDC hdcMem, ClcGroup *group, ClcContact *contact, int in else
cEntry = cfg::eCache;
-
if (dat->bisEmbedded)
goto set_bg_l;
@@ -491,23 +492,18 @@ void __inline PaintItem(HDC hdcMem, ClcGroup *group, ClcContact *contact, int in bg_indent_l = cfg::dat.bApplyIndentToBg ? indent * dat->groupIndent : 0;
dt_nickflags = DT_RTLREADING | DT_RIGHT;
}
- else
- bg_indent_l = cfg::dat.bApplyIndentToBg ? indent * dat->groupIndent : 0;
+ else bg_indent_l = cfg::dat.bApplyIndentToBg ? indent * dat->groupIndent : 0;
}
else if (type == CLCIT_GROUP && API::pfnSetLayout != NULL) {
if ((contact->isRtl && cfg::dat.bGroupAlign == CLC_GROUPALIGN_AUTO) || cfg::dat.bGroupAlign == CLC_GROUPALIGN_RIGHT) {
g_RTL = TRUE;
bg_indent_r = cfg::dat.bApplyIndentToBg ? indent * dat->groupIndent : 0;
}
- else
- bg_indent_l = cfg::dat.bApplyIndentToBg ? indent * dat->groupIndent : 0;
+ else bg_indent_l = cfg::dat.bApplyIndentToBg ? indent * dat->groupIndent : 0;
}
- else
- bg_indent_l = cfg::dat.bApplyIndentToBg ? indent * dat->groupIndent : 0;
+ else bg_indent_l = cfg::dat.bApplyIndentToBg ? indent * dat->groupIndent : 0;
set_bg_l:
-
-
g_hottrack = dat->exStyle & CLS_EX_TRACKSELECT && type == CLCIT_CONTACT && dat->iHotTrack == index;
if (g_hottrack == selected)
g_hottrack = 0;
@@ -522,7 +518,8 @@ set_bg_l: ChangeToFont(hdcMem, dat, FONTID_GROUPS, &fontHeight);
else
ChangeToFont(hdcMem, dat, FONTID_CONTACTS, &fontHeight);
- } else if (type == CLCIT_DIVIDER) {
+ }
+ else if (type == CLCIT_DIVIDER) {
ChangeToFont(hdcMem, dat, FONTID_DIVIDERS, &fontHeight);
GetTextExtentPoint32(hdcMem, contact->szText, lstrlen(contact->szText), &textSize);
}
@@ -857,18 +854,16 @@ set_bg_l: SetHotTrackColour(hdcMem,dat);
if (ht->IGNORED == 0)
SetTextColor(hdcMem, ht->TEXTCOLOR);
- if (!g_hottrack_done) {
- if (ht->IGNORED == 0) {
+ if (!g_hottrack_done)
+ if (ht->IGNORED == 0)
DrawAlpha(hdcMem, &rc, ht->COLOR, ht->ALPHA, ht->COLOR2, ht->COLOR2_TRANSPARENT, ht->GRADIENT,
ht->CORNER, ht->BORDERSTYLE, ht->imageItem);
- }
- }
}
if (g_RTL)
API::pfnSetLayout(hdcMem, LAYOUT_RTL | LAYOUT_BITMAPORIENTATIONPRESERVED);
-bgskipped:
+bgskipped:
rcContent.top = y + g_padding_y;
rcContent.bottom = y + rowHeight - (2 * g_padding_y);
rcContent.left = leftX;
@@ -905,7 +900,6 @@ bgskipped: else if (type == CLCIT_CONTACT)
iImage = contact->iImage;
-
if (pi_avatar && (av_left || av_right)) {
RECT rc;
@@ -976,23 +970,19 @@ bgskipped: if (type == CLCIT_CONTACT && !dat->bisEmbedded) {
BYTE bApparentModeDontCare = !((flags & CONTACTF_VISTO) ^ (flags & CONTACTF_INVISTO));
contact->extraIconRightBegin = 0;
- if (cEntry && (contact->extraCacheEntry >= 0 && contact->extraCacheEntry < cfg::nextCacheEntry && cEntry->iExtraValid)) {
- int i, iIndex;
+ if (cEntry && (contact->extraCacheEntry >= 0 && contact->extraCacheEntry < cfg::nextCacheEntry)) {
DWORD dwOldMask = cEntry->dwXMask;
- if (dwFlags & CLUI_FRAME_USEXSTATUSASSTATUS)
- cEntry->dwXMask &= ~EIMG_SHOW_ADV1;
-
- for (i = EXICON_COUNT - 1; i >= 0; i--) {
- iIndex = cfg::dat.exIconOrder[i] - 1;
- if (iIndex >= 0 && iIndex < EXICON_COUNT) {
- if (cEntry->iExtraImage[i] != 0xffff && ((1 << i) & cEntry->dwXMask)) {
- if (contact->extraIconRightBegin == 0 && i != (EXICON_COUNT - 1))
- contact->extraIconRightBegin = rcContent.right;
- ImageList_DrawEx(dat->himlExtraColumns, cEntry->iExtraImage[i], hdcMem, rcContent.right - cfg::dat.exIconScale, twoRows ? rcContent.bottom - g_exIconSpacing : y + ((rowHeight - cfg::dat.exIconScale) >> 1),
- 0, 0, CLR_NONE, CLR_NONE, ILD_NORMAL);
- rcContent.right -= g_exIconSpacing;
- rightIcons++;
- }
+//!!!!!! if (dwFlags & CLUI_FRAME_USEXSTATUSASSTATUS)
+//!!!!!! cEntry->dwXMask &= ~EIMG_SHOW_ADV1;
+
+ for (int i = EXTRA_ICON_COUNT - 1; i >= 0; i--) {
+ if (contact->iExtraImage[i] != 0xffff && ((1 << i) & cEntry->dwXMask)) {
+ if (contact->extraIconRightBegin == 0 && i != (EXTRA_ICON_COUNT - 1))
+ contact->extraIconRightBegin = rcContent.right;
+ ImageList_DrawEx(dat->himlExtraColumns, contact->iExtraImage[i], hdcMem, rcContent.right - cfg::dat.exIconScale, twoRows ? rcContent.bottom - g_exIconSpacing : y + ((rowHeight - cfg::dat.exIconScale) >> 1),
+ 0, 0, CLR_NONE, CLR_NONE, ILD_NORMAL);
+ rcContent.right -= g_exIconSpacing;
+ rightIcons++;
}
}
cEntry->dwXMask = dwOldMask;
@@ -1030,7 +1020,8 @@ text: rc.left = rc.right + 6 + textSize.cx;
rc.right = clRect->right - dat->rightMargin;
DrawEdge(hdcMem, &rc, BDR_SUNKENOUTER, BF_RECT);
- } else if (type == CLCIT_GROUP) {
+ }
+ else if (type == CLCIT_GROUP) {
RECT rc;
int leftMargin = 0, countStart = 0, leftLineEnd, rightLineStart;
fontHeight = dat->fontInfo[FONTID_GROUPS].fontHeight;
@@ -1118,7 +1109,8 @@ text: DrawEdge(hdcMem, &rc, BDR_SUNKENOUTER, BF_RECT);
}
}
- } else {
+ }
+ else {
TCHAR *szText = contact->szText;
rcContent.top = y + ((rowHeight - fontHeight) >> 1);
@@ -1142,12 +1134,8 @@ text: }
// nickname
- if (!twoRows) {
- if (dt_nickflags)
- DrawText(hdcMem, szText, -1, &rcContent, DT_EDITCONTROL | DT_NOPREFIX | DT_NOCLIP | DT_WORD_ELLIPSIS | DT_SINGLELINE | dt_nickflags);
- else
- DrawText(hdcMem, szText, -1, &rcContent, DT_EDITCONTROL | DT_NOPREFIX | DT_NOCLIP | DT_WORD_ELLIPSIS | DT_SINGLELINE);
- }
+ if (!twoRows)
+ DrawText(hdcMem, szText, -1, &rcContent, DT_EDITCONTROL | DT_NOPREFIX | DT_NOCLIP | DT_WORD_ELLIPSIS | DT_SINGLELINE | dt_nickflags);
else {
int statusFontHeight;
DWORD dtFlags = DT_WORD_ELLIPSIS | DT_NOPREFIX | DT_NOCLIP | DT_SINGLELINE;
@@ -1308,20 +1296,23 @@ nodisplay: DrawText(hdcMem, szText, qlen, &rc, DT_EDITCONTROL | DT_NOPREFIX | DT_NOCLIP | DT_WORD_ELLIPSIS | DT_SINGLELINE);
}
}
+
//extra icons
- for (iImage = 0; iImage< dat->extraColumnsCount; iImage++) {
+ for (int i = dat->extraColumnsCount-1; i >= 0; i--) {
COLORREF colourFg = dat->selBkColour;
int mode = ILD_NORMAL;
- if (contact->iExtraImage[iImage] == 0xFF)
+ if (contact->iExtraImage[i] == 0xFFFF)
continue;
+
if (selected)
mode = ILD_SELECTED;
- else if (g_hottrack) {
- mode = ILD_FOCUS; colourFg = dat->hotTextColour;
- } else if (type == CLCIT_CONTACT && flags & CONTACTF_NOTONLIST) {
- colourFg = dat->fontInfo[FONTID_NOTONLIST].colour; mode = ILD_BLEND50;
- }
- ImageList_DrawEx(dat->himlExtraColumns, contact->iExtraImage[iImage], hdcMem, clRect->right - rightOffset - dat->extraColumnSpacing * (dat->extraColumnsCount - iImage), y + ((rowHeight - 16) >> 1), 0, 0, CLR_NONE, colourFg, mode);
+ else if (g_hottrack)
+ mode = ILD_FOCUS, colourFg = dat->hotTextColour;
+ else if (type == CLCIT_CONTACT && flags & CONTACTF_NOTONLIST)
+ colourFg = dat->fontInfo[FONTID_NOTONLIST].colour, mode = ILD_BLEND50;
+
+ rightOffset += dat->extraColumnSpacing;
+ ImageList_DrawEx(dat->himlExtraColumns, contact->iExtraImage[i], hdcMem, clRect->right - rightOffset, y + ((rowHeight - 16) >> 1), 0, 0, CLR_NONE, colourFg, mode);
}
if (g_RTL)
API::pfnSetLayout(hdcMem, 0);
diff --git a/plugins/Clist_nicer/src/clcutils.cpp b/plugins/Clist_nicer/src/clcutils.cpp index bc0c144f87..0424afad7a 100644 --- a/plugins/Clist_nicer/src/clcutils.cpp +++ b/plugins/Clist_nicer/src/clcutils.cpp @@ -40,37 +40,41 @@ static int MY_pathIsAbsolute(const TCHAR *path) {
if (!path || !(lstrlen(path) > 2))
return 0;
+
if ((path[1] == ':' && path[2] == '\\') || (path[0] == '\\' && path[1] == '\\'))
- return 1;
+ return 1;
+
return 0;
}
size_t MY_pathToRelative(const TCHAR *pSrc, TCHAR *pOut)
{
if (!pSrc || !lstrlen(pSrc) || lstrlen(pSrc) > MAX_PATH)
- return 0;
- if (!MY_pathIsAbsolute(pSrc)) {
+ return 0;
+
+ if ( !MY_pathIsAbsolute(pSrc)) {
mir_sntprintf(pOut, MAX_PATH, _T("%s"), pSrc);
return lstrlen(pOut);
- } else {
- TCHAR szTmp[MAX_PATH];
- mir_sntprintf(szTmp, SIZEOF(szTmp), _T("%s"), pSrc);
- _tcslwr(szTmp);
- if (_tcsstr(szTmp, cfg::dat.tszProfilePath)) {
- mir_sntprintf(pOut, MAX_PATH, _T("%s"), pSrc + lstrlen(cfg::dat.tszProfilePath) - 1);
- pOut[0]='.';
- return lstrlen(pOut);
- } else {
- mir_sntprintf(pOut, MAX_PATH, _T("%s"), pSrc);
- return lstrlen(pOut);
- }
}
+
+ TCHAR szTmp[MAX_PATH];
+ mir_sntprintf(szTmp, SIZEOF(szTmp), _T("%s"), pSrc);
+ _tcslwr(szTmp);
+ if ( _tcsstr(szTmp, cfg::dat.tszProfilePath)) {
+ mir_sntprintf(pOut, MAX_PATH, _T("%s"), pSrc + lstrlen(cfg::dat.tszProfilePath) - 1);
+ pOut[0]='.';
+ return lstrlen(pOut);
+ }
+
+ mir_sntprintf(pOut, MAX_PATH, _T("%s"), pSrc);
+ return lstrlen(pOut);
}
size_t MY_pathToAbsolute(const TCHAR *pSrc, TCHAR *pOut)
{
if (!pSrc || !lstrlen(pSrc) || lstrlen(pSrc) > MAX_PATH)
- return 0;
+ return 0;
+
if (MY_pathIsAbsolute(pSrc)&&pSrc[0]!='.')
mir_sntprintf(pOut, MAX_PATH, _T("%s"), pSrc);
else if (pSrc[0]=='.')
@@ -86,261 +90,260 @@ size_t MY_pathToAbsolute(const TCHAR *pSrc, TCHAR *pOut) int RTL_HitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, ClcContact *hitcontact, DWORD *flags, int indent, int hit)
{
- RECT clRect;
- int right, checkboxWidth, cxSmIcon, i, width;
- DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE);
- SIZE textSize;
- HDC hdc;
- HFONT hFont;
-
- GetClientRect(hwnd, &clRect);
- right = clRect.right;
-
- // avatar check
- if (hitcontact->type == CLCIT_CONTACT && cfg::dat.dwFlags & CLUI_FRAME_AVATARS && hitcontact->ace != NULL && hitcontact->avatarLeft != -1) {
- if (testx < right - hitcontact->avatarLeft && testx > right - hitcontact->avatarLeft - cfg::dat.avatarSize) {
- if (flags)
- *flags |= CLCHT_ONAVATAR;
- }
- }
- if (testx > right - (dat->leftMargin + indent * dat->groupIndent)) {
- if (flags)
- *flags |= CLCHT_ONITEMINDENT;
- return hit;
- }
- checkboxWidth = 0;
- if (style & CLS_CHECKBOXES && hitcontact->type == CLCIT_CONTACT)
- checkboxWidth = dat->checkboxSize + 2;
- if (style & CLS_GROUPCHECKBOXES && hitcontact->type == CLCIT_GROUP)
- checkboxWidth = dat->checkboxSize + 2;
- if (hitcontact->type == CLCIT_INFO && hitcontact->flags & CLCIIF_CHECKBOX)
- checkboxWidth = dat->checkboxSize + 2;
- if (testx > right - (dat->leftMargin + indent * dat->groupIndent + checkboxWidth)) {
- if (flags)
- *flags |= CLCHT_ONITEMCHECK;
- return hit;
- }
- if (testx > right - (dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace)) {
- if (flags)
- *flags |= CLCHT_ONITEMICON;
- return hit;
- }
- cxSmIcon = GetSystemMetrics(SM_CXSMICON);
- for (i = 0; i< dat->extraColumnsCount; i++) {
- if (hitcontact->iExtraImage[i] == 0xFF)
- continue;
- if (testx >= dat->extraColumnSpacing * (dat->extraColumnsCount - i) && testx < dat->extraColumnSpacing * (dat->extraColumnsCount - i) + cxSmIcon) {
- if (flags)
- *flags |= CLCHT_ONITEMEXTRA | (i << 24);
- return hit;
- }
- }
- if (hitcontact->extraCacheEntry >= 0 && hitcontact->extraCacheEntry < cfg::nextCacheEntry && cfg::eCache[hitcontact->extraCacheEntry].iExtraValid) {
- int rightOffset = hitcontact->extraIconRightBegin;
- int images_present = 0;
-
- for (i = 5; i >= 0; i--) {
- if (cfg::eCache[hitcontact->extraCacheEntry].iExtraImage[i] == 0xFF)
- continue;
- if (!((1 << i) & cfg::eCache[hitcontact->extraCacheEntry].dwXMask))
- continue;
- images_present++;
- if (testx < right - (rightOffset - (cfg::dat.exIconScale + 2) * images_present) && testx > right - (rightOffset - (cfg::dat.exIconScale + 2) * images_present + (cfg::dat.exIconScale))) {
- if (flags)
- *flags |= (CLCHT_ONITEMEXTRAEX | ((i + 1) << 24));
- return hit;
- }
- }
- }
-
- hdc = GetDC(hwnd);
- if (hitcontact->type == CLCIT_GROUP)
- hFont = reinterpret_cast<HFONT>(SelectObject(hdc, dat->fontInfo[FONTID_GROUPS].hFont));
- else
- hFont = reinterpret_cast<HFONT>(SelectObject(hdc, dat->fontInfo[FONTID_CONTACTS].hFont));
- GetTextExtentPoint32(hdc, hitcontact->szText, lstrlen(hitcontact->szText), &textSize);
- width = textSize.cx;
- if (hitcontact->type == CLCIT_GROUP) {
- char *szCounts;
- szCounts = pcli->pfnGetGroupCountsText(dat, hitcontact);
- if (szCounts[0]) {
- GetTextExtentPoint32A(hdc, " ", 1, &textSize);
- width += textSize.cx;
- SelectObject(hdc, dat->fontInfo[FONTID_GROUPCOUNTS].hFont);
- GetTextExtentPoint32A(hdc, szCounts, lstrlenA(szCounts), &textSize);
- width += textSize.cx;
- }
- }
- SelectObject(hdc, hFont);
- ReleaseDC(hwnd, hdc);
- if (testx > right - (dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace + width + 4 + (cfg::dat.dwFlags & CLUI_FRAME_AVATARS ? cfg::dat.avatarSize : 0))) {
- if (flags)
- *flags |= CLCHT_ONITEMLABEL;
- return hit;
- }
- if (cfg::dat.dwFlags & CLUI_FULLROWSELECT && !(GetKeyState(VK_SHIFT) & 0x8000) && testx < right - (dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace + width + 4 + (cfg::dat.dwFlags & CLUI_FRAME_AVATARS ? cfg::dat.avatarSize : 0))) {
- if (flags)
- *flags |= CLCHT_ONITEMSPACE;
- return hit;
- }
- if (flags)
- *flags |= CLCHT_NOWHERE;
- return -1;
+ RECT clRect;
+ int right, checkboxWidth, cxSmIcon, i, width;
+ DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE);
+ SIZE textSize;
+ HDC hdc;
+ HFONT hFont;
+
+ GetClientRect(hwnd, &clRect);
+ right = clRect.right;
+
+ // avatar check
+ if (hitcontact->type == CLCIT_CONTACT && cfg::dat.dwFlags & CLUI_FRAME_AVATARS && hitcontact->ace != NULL && hitcontact->avatarLeft != -1) {
+ if (testx < right - hitcontact->avatarLeft && testx > right - hitcontact->avatarLeft - cfg::dat.avatarSize)
+ if (flags)
+ *flags |= CLCHT_ONAVATAR;
+ }
+ if (testx > right - (dat->leftMargin + indent * dat->groupIndent)) {
+ if (flags)
+ *flags |= CLCHT_ONITEMINDENT;
+ return hit;
+ }
+ checkboxWidth = 0;
+ if (style & CLS_CHECKBOXES && hitcontact->type == CLCIT_CONTACT)
+ checkboxWidth = dat->checkboxSize + 2;
+ if (style & CLS_GROUPCHECKBOXES && hitcontact->type == CLCIT_GROUP)
+ checkboxWidth = dat->checkboxSize + 2;
+ if (hitcontact->type == CLCIT_INFO && hitcontact->flags & CLCIIF_CHECKBOX)
+ checkboxWidth = dat->checkboxSize + 2;
+ if (testx > right - (dat->leftMargin + indent * dat->groupIndent + checkboxWidth)) {
+ if (flags)
+ *flags |= CLCHT_ONITEMCHECK;
+ return hit;
+ }
+ if (testx > right - (dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace)) {
+ if (flags)
+ *flags |= CLCHT_ONITEMICON;
+ return hit;
+ }
+ cxSmIcon = GetSystemMetrics(SM_CXSMICON);
+ for (i = 0; i< dat->extraColumnsCount; i++) {
+ if (hitcontact->iExtraImage[i] == 0xFFFF)
+ continue;
+ if (testx >= dat->extraColumnSpacing * (dat->extraColumnsCount - i) && testx < dat->extraColumnSpacing * (dat->extraColumnsCount - i) + cxSmIcon) {
+ if (flags)
+ *flags |= CLCHT_ONITEMEXTRA | (i << 24);
+ return hit;
+ }
+ }
+ if (hitcontact->extraCacheEntry >= 0 && hitcontact->extraCacheEntry < cfg::nextCacheEntry) {
+ int rightOffset = hitcontact->extraIconRightBegin;
+ int images_present = 0;
+
+ for (i = EXTRA_ICON_COUNT-1; i >= 0; i--) {
+ if (hitcontact->iExtraImage[i] == 0xFFFF)
+ continue;
+ if (!((1 << i) & cfg::eCache[hitcontact->extraCacheEntry].dwXMask))
+ continue;
+ images_present++;
+ if (testx < right - (rightOffset - (cfg::dat.exIconScale + 2) * images_present) && testx > right - (rightOffset - (cfg::dat.exIconScale + 2) * images_present + (cfg::dat.exIconScale))) {
+ if (flags)
+ *flags |= (CLCHT_ONITEMEXTRAEX | ((i + 1) << 24));
+ return hit;
+ }
+ }
+ }
+
+ hdc = GetDC(hwnd);
+ if (hitcontact->type == CLCIT_GROUP)
+ hFont = reinterpret_cast<HFONT>(SelectObject(hdc, dat->fontInfo[FONTID_GROUPS].hFont));
+ else
+ hFont = reinterpret_cast<HFONT>(SelectObject(hdc, dat->fontInfo[FONTID_CONTACTS].hFont));
+ GetTextExtentPoint32(hdc, hitcontact->szText, lstrlen(hitcontact->szText), &textSize);
+ width = textSize.cx;
+ if (hitcontact->type == CLCIT_GROUP) {
+ char *szCounts;
+ szCounts = pcli->pfnGetGroupCountsText(dat, hitcontact);
+ if (szCounts[0]) {
+ GetTextExtentPoint32A(hdc, " ", 1, &textSize);
+ width += textSize.cx;
+ SelectObject(hdc, dat->fontInfo[FONTID_GROUPCOUNTS].hFont);
+ GetTextExtentPoint32A(hdc, szCounts, lstrlenA(szCounts), &textSize);
+ width += textSize.cx;
+ }
+ }
+ SelectObject(hdc, hFont);
+ ReleaseDC(hwnd, hdc);
+ if (testx > right - (dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace + width + 4 + (cfg::dat.dwFlags & CLUI_FRAME_AVATARS ? cfg::dat.avatarSize : 0))) {
+ if (flags)
+ *flags |= CLCHT_ONITEMLABEL;
+ return hit;
+ }
+ if (cfg::dat.dwFlags & CLUI_FULLROWSELECT && !(GetKeyState(VK_SHIFT) & 0x8000) && testx < right - (dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace + width + 4 + (cfg::dat.dwFlags & CLUI_FRAME_AVATARS ? cfg::dat.avatarSize : 0))) {
+ if (flags)
+ *flags |= CLCHT_ONITEMSPACE;
+ return hit;
+ }
+ if (flags)
+ *flags |= CLCHT_NOWHERE;
+ return -1;
}
int HitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, ClcContact **contact, ClcGroup **group, DWORD *flags)
{
- ClcContact *hitcontact;
- ClcGroup *hitgroup;
- int hit, indent, width, i, cxSmIcon;
- int checkboxWidth;
- SIZE textSize;
- HDC hdc;
- RECT clRect;
- HFONT hFont;
- DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE);
+ ClcContact *hitcontact;
+ ClcGroup *hitgroup;
+ int hit, indent, width, i, cxSmIcon;
+ int checkboxWidth;
+ SIZE textSize;
+ HDC hdc;
+ RECT clRect;
+ HFONT hFont;
+ DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE);
BYTE mirror_mode = cfg::dat.bUseDCMirroring;
- if (flags)
- *flags = 0;
- GetClientRect(hwnd, &clRect);
- if (testx < 0 || testy < 0 || testy >= clRect.bottom || testx >= clRect.right) {
- if (flags) {
- if (testx < 0)
- *flags |= CLCHT_TOLEFT;
- else if (testx >= clRect.right)
- *flags |= CLCHT_TORIGHT;
- if (testy < 0)
- *flags |= CLCHT_ABOVE;
- else if (testy >= clRect.bottom)
- *flags |= CLCHT_BELOW;
- }
- return -1;
- }
- if (testx< dat->leftMargin) {
- if (flags)
- *flags |= CLCHT_INLEFTMARGIN | CLCHT_NOWHERE;
- return -1;
- }
- hit = RowHeight::hitTest(dat, dat->yScroll + testy);
+ if (flags)
+ *flags = 0;
+ GetClientRect(hwnd, &clRect);
+ if (testx < 0 || testy < 0 || testy >= clRect.bottom || testx >= clRect.right) {
+ if (flags) {
+ if (testx < 0)
+ *flags |= CLCHT_TOLEFT;
+ else if (testx >= clRect.right)
+ *flags |= CLCHT_TORIGHT;
+ if (testy < 0)
+ *flags |= CLCHT_ABOVE;
+ else if (testy >= clRect.bottom)
+ *flags |= CLCHT_BELOW;
+ }
+ return -1;
+ }
+ if (testx< dat->leftMargin) {
+ if (flags)
+ *flags |= CLCHT_INLEFTMARGIN | CLCHT_NOWHERE;
+ return -1;
+ }
+ hit = RowHeight::hitTest(dat, dat->yScroll + testy);
if (hit != -1)
hit = pcli->pfnGetRowByIndex(dat, hit, &hitcontact, &hitgroup);
- if (hit == -1) {
- if (flags)
- *flags |= CLCHT_NOWHERE | CLCHT_BELOWITEMS;
- return -1;
- }
- if (contact)
- *contact = hitcontact;
- if (group)
- *group = hitgroup;
-
- for (indent = 0; hitgroup->parent; indent++,hitgroup = hitgroup->parent) {
- ;
- }
-
- if (!dat->bisEmbedded) {
- if (hitcontact->type == CLCIT_CONTACT) {
- if (mirror_mode == 1 || (mirror_mode == 2 && cfg::eCache[hitcontact->extraCacheEntry].dwCFlags & ECF_RTLNICK))
- return RTL_HitTest(hwnd, dat, testx, testy, hitcontact, flags, indent, hit);
- }
- else if (hitcontact->type == CLCIT_GROUP) {
- if (cfg::dat.bGroupAlign == CLC_GROUPALIGN_RIGHT || (hitcontact->isRtl && cfg::dat.bGroupAlign == CLC_GROUPALIGN_AUTO))
- return RTL_HitTest(hwnd, dat, testx, testy, hitcontact, flags, indent, hit);
- }
- }
-
- // avatar check
- if (hitcontact->type == CLCIT_CONTACT && cfg::dat.dwFlags & CLUI_FRAME_AVATARS && hitcontact->ace != NULL && hitcontact->avatarLeft != -1) {
- if (testx >hitcontact->avatarLeft && testx < hitcontact->avatarLeft + cfg::dat.avatarSize) {
- if (flags)
- *flags |= CLCHT_ONAVATAR;
- }
- }
- if (testx< dat->leftMargin + indent * dat->groupIndent) {
- if (flags)
- *flags |= CLCHT_ONITEMINDENT;
- return hit;
- }
- checkboxWidth = 0;
- if (style & CLS_CHECKBOXES && hitcontact->type == CLCIT_CONTACT)
- checkboxWidth = dat->checkboxSize + 2;
- if (style & CLS_GROUPCHECKBOXES && hitcontact->type == CLCIT_GROUP)
- checkboxWidth = dat->checkboxSize + 2;
- if (hitcontact->type == CLCIT_INFO && hitcontact->flags & CLCIIF_CHECKBOX)
- checkboxWidth = dat->checkboxSize + 2;
- if (testx< dat->leftMargin + indent * dat->groupIndent + checkboxWidth) {
- if (flags)
- *flags |= CLCHT_ONITEMCHECK;
- return hit;
- }
- if (testx< dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace) {
- if (flags)
- *flags |= CLCHT_ONITEMICON;
- return hit;
- }
- cxSmIcon = GetSystemMetrics(SM_CXSMICON);
- for (i = 0; i< dat->extraColumnsCount; i++) {
- if (hitcontact->iExtraImage[i] == 0xFF)
- continue;
- if (testx >= clRect.right - dat->extraColumnSpacing * (dat->extraColumnsCount - i) && testx< clRect.right - dat->extraColumnSpacing * (dat->extraColumnsCount - i) + cxSmIcon) {
- if (flags)
- *flags |= CLCHT_ONITEMEXTRA | (i << 24);
- return hit;
- }
- }
- if (hitcontact->extraCacheEntry >= 0 && hitcontact->extraCacheEntry < cfg::nextCacheEntry && cfg::eCache[hitcontact->extraCacheEntry].iExtraValid) {
- //int rightOffset = clRect.right;
- int rightOffset = hitcontact->extraIconRightBegin;
- int images_present = 0;
-
- for (i = 5; i >= 0; i--) {
- if (cfg::eCache[hitcontact->extraCacheEntry].iExtraImage[i] == 0xFF)
- continue;
- if (!((1 << i) & cfg::eCache[hitcontact->extraCacheEntry].dwXMask))
- continue;
- images_present++;
- if (testx > (rightOffset - (cfg::dat.exIconScale + 2) * images_present) && testx < (rightOffset - (cfg::dat.exIconScale + 2) * images_present + (cfg::dat.exIconScale))) {
- if (flags)
- *flags |= (CLCHT_ONITEMEXTRAEX | ((i + 1) << 24));
- return hit;
- }
- }
- }
- hdc = GetDC(hwnd);
- if (hitcontact->type == CLCIT_GROUP)
- hFont = reinterpret_cast<HFONT>(SelectObject(hdc, dat->fontInfo[FONTID_GROUPS].hFont));
- else
- hFont = reinterpret_cast<HFONT>(SelectObject(hdc, dat->fontInfo[FONTID_CONTACTS].hFont));
- GetTextExtentPoint32(hdc, hitcontact->szText, lstrlen(hitcontact->szText), &textSize);
- width = textSize.cx;
- if (hitcontact->type == CLCIT_GROUP) {
- char *szCounts;
- szCounts = pcli->pfnGetGroupCountsText(dat, hitcontact);
- if (szCounts[0]) {
- GetTextExtentPoint32A(hdc, " ", 1, &textSize);
- width += textSize.cx;
- SelectObject(hdc, dat->fontInfo[FONTID_GROUPCOUNTS].hFont);
- GetTextExtentPoint32A(hdc, szCounts, lstrlenA(szCounts), &textSize);
- width += textSize.cx;
- }
- }
- SelectObject(hdc, hFont);
- ReleaseDC(hwnd, hdc);
- if (cfg::dat.dwFlags & CLUI_FULLROWSELECT && !(GetKeyState(VK_SHIFT) & 0x8000) && testx > dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace + width + 4 + (cfg::dat.dwFlags & CLUI_FRAME_AVATARS ? cfg::dat.avatarSize : 0)) {
- if (flags)
- *flags |= CLCHT_ONITEMSPACE;
- return hit;
- }
- if (testx< dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace + width + 4 + (cfg::dat.dwFlags & CLUI_FRAME_AVATARS ? cfg::dat.avatarSize : 0)) {
- if (flags)
- *flags |= CLCHT_ONITEMLABEL;
- return hit;
- }
- if (flags)
- *flags |= CLCHT_NOWHERE;
- return -1;
+ if (hit == -1) {
+ if (flags)
+ *flags |= CLCHT_NOWHERE | CLCHT_BELOWITEMS;
+ return -1;
+ }
+ if (contact)
+ *contact = hitcontact;
+ if (group)
+ *group = hitgroup;
+
+ for (indent = 0; hitgroup->parent; indent++,hitgroup = hitgroup->parent) {
+ ;
+ }
+
+ if (!dat->bisEmbedded) {
+ if (hitcontact->type == CLCIT_CONTACT) {
+ if (mirror_mode == 1 || (mirror_mode == 2 && cfg::eCache[hitcontact->extraCacheEntry].dwCFlags & ECF_RTLNICK))
+ return RTL_HitTest(hwnd, dat, testx, testy, hitcontact, flags, indent, hit);
+ }
+ else if (hitcontact->type == CLCIT_GROUP) {
+ if (cfg::dat.bGroupAlign == CLC_GROUPALIGN_RIGHT || (hitcontact->isRtl && cfg::dat.bGroupAlign == CLC_GROUPALIGN_AUTO))
+ return RTL_HitTest(hwnd, dat, testx, testy, hitcontact, flags, indent, hit);
+ }
+ }
+
+ // avatar check
+ if (hitcontact->type == CLCIT_CONTACT && cfg::dat.dwFlags & CLUI_FRAME_AVATARS && hitcontact->ace != NULL && hitcontact->avatarLeft != -1) {
+ if (testx >hitcontact->avatarLeft && testx < hitcontact->avatarLeft + cfg::dat.avatarSize) {
+ if (flags)
+ *flags |= CLCHT_ONAVATAR;
+ }
+ }
+ if (testx< dat->leftMargin + indent * dat->groupIndent) {
+ if (flags)
+ *flags |= CLCHT_ONITEMINDENT;
+ return hit;
+ }
+ checkboxWidth = 0;
+ if (style & CLS_CHECKBOXES && hitcontact->type == CLCIT_CONTACT)
+ checkboxWidth = dat->checkboxSize + 2;
+ if (style & CLS_GROUPCHECKBOXES && hitcontact->type == CLCIT_GROUP)
+ checkboxWidth = dat->checkboxSize + 2;
+ if (hitcontact->type == CLCIT_INFO && hitcontact->flags & CLCIIF_CHECKBOX)
+ checkboxWidth = dat->checkboxSize + 2;
+ if (testx< dat->leftMargin + indent * dat->groupIndent + checkboxWidth) {
+ if (flags)
+ *flags |= CLCHT_ONITEMCHECK;
+ return hit;
+ }
+ if (testx< dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace) {
+ if (flags)
+ *flags |= CLCHT_ONITEMICON;
+ return hit;
+ }
+ cxSmIcon = GetSystemMetrics(SM_CXSMICON);
+ for (i = 0; i< dat->extraColumnsCount; i++) {
+ if (hitcontact->iExtraImage[i] == 0xFFFF)
+ continue;
+ if (testx >= clRect.right - dat->extraColumnSpacing * (dat->extraColumnsCount - i) && testx< clRect.right - dat->extraColumnSpacing * (dat->extraColumnsCount - i) + cxSmIcon) {
+ if (flags)
+ *flags |= CLCHT_ONITEMEXTRA | (i << 24);
+ return hit;
+ }
+ }
+ if (hitcontact->extraCacheEntry >= 0 && hitcontact->extraCacheEntry < cfg::nextCacheEntry) {
+ //int rightOffset = clRect.right;
+ int rightOffset = hitcontact->extraIconRightBegin;
+ int images_present = 0;
+
+ for (i = EXTRA_ICON_COUNT; i >= 0; i--) {
+ if (hitcontact->iExtraImage[i] == 0xFFFF)
+ continue;
+ if (!((1 << i) & cfg::eCache[hitcontact->extraCacheEntry].dwXMask))
+ continue;
+ images_present++;
+ if (testx > (rightOffset - (cfg::dat.exIconScale + 2) * images_present) && testx < (rightOffset - (cfg::dat.exIconScale + 2) * images_present + (cfg::dat.exIconScale))) {
+ if (flags)
+ *flags |= (CLCHT_ONITEMEXTRAEX | ((i + 1) << 24));
+ return hit;
+ }
+ }
+ }
+ hdc = GetDC(hwnd);
+ if (hitcontact->type == CLCIT_GROUP)
+ hFont = reinterpret_cast<HFONT>(SelectObject(hdc, dat->fontInfo[FONTID_GROUPS].hFont));
+ else
+ hFont = reinterpret_cast<HFONT>(SelectObject(hdc, dat->fontInfo[FONTID_CONTACTS].hFont));
+ GetTextExtentPoint32(hdc, hitcontact->szText, lstrlen(hitcontact->szText), &textSize);
+ width = textSize.cx;
+ if (hitcontact->type == CLCIT_GROUP) {
+ char *szCounts;
+ szCounts = pcli->pfnGetGroupCountsText(dat, hitcontact);
+ if (szCounts[0]) {
+ GetTextExtentPoint32A(hdc, " ", 1, &textSize);
+ width += textSize.cx;
+ SelectObject(hdc, dat->fontInfo[FONTID_GROUPCOUNTS].hFont);
+ GetTextExtentPoint32A(hdc, szCounts, lstrlenA(szCounts), &textSize);
+ width += textSize.cx;
+ }
+ }
+ SelectObject(hdc, hFont);
+ ReleaseDC(hwnd, hdc);
+ if (cfg::dat.dwFlags & CLUI_FULLROWSELECT && !(GetKeyState(VK_SHIFT) & 0x8000) && testx > dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace + width + 4 + (cfg::dat.dwFlags & CLUI_FRAME_AVATARS ? cfg::dat.avatarSize : 0)) {
+ if (flags)
+ *flags |= CLCHT_ONITEMSPACE;
+ return hit;
+ }
+ if (testx< dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace + width + 4 + (cfg::dat.dwFlags & CLUI_FRAME_AVATARS ? cfg::dat.avatarSize : 0)) {
+ if (flags)
+ *flags |= CLCHT_ONITEMLABEL;
+ return hit;
+ }
+ if (flags)
+ *flags |= CLCHT_NOWHERE;
+ return -1;
}
void ScrollTo(HWND hwnd, struct ClcData *dat, int desty, int noSmooth)
@@ -380,10 +383,10 @@ void ScrollTo(HWND hwnd, struct ClcData *dat, int desty, int noSmooth) else
InvalidateRect(hwnd, NULL, FALSE);
previousy = dat->yScroll;
- if (cfg::dat.bSkinnedScrollbar && !dat->bisEmbedded)
- CoolSB_SetScrollPos(hwnd, SB_VERT, dat->yScroll, TRUE);
- else
- SetScrollPos(hwnd, SB_VERT, dat->yScroll, TRUE);
+ if (cfg::dat.bSkinnedScrollbar && !dat->bisEmbedded)
+ CoolSB_SetScrollPos(hwnd, SB_VERT, dat->yScroll, TRUE);
+ else
+ SetScrollPos(hwnd, SB_VERT, dat->yScroll, TRUE);
UpdateWindow(hwnd);
}
}
@@ -397,49 +400,49 @@ void ScrollTo(HWND hwnd, struct ClcData *dat, int desty, int noSmooth) else
InvalidateRect(hwnd, NULL, FALSE);
- if (cfg::dat.bSkinnedScrollbar && !dat->bisEmbedded)
- CoolSB_SetScrollPos(hwnd, SB_VERT, dat->yScroll, TRUE);
- else
- SetScrollPos(hwnd, SB_VERT, dat->yScroll, TRUE);
+ if (cfg::dat.bSkinnedScrollbar && !dat->bisEmbedded)
+ CoolSB_SetScrollPos(hwnd, SB_VERT, dat->yScroll, TRUE);
+ else
+ SetScrollPos(hwnd, SB_VERT, dat->yScroll, TRUE);
dat->forceScroll = 0;
}
void RecalcScrollBar(HWND hwnd, struct ClcData *dat)
{
- SCROLLINFO si = { 0 };
- RECT clRect;
- NMCLISTCONTROL nm;
-
- RowHeight::calcRowHeights(dat, hwnd);
-
- GetClientRect(hwnd, &clRect);
- si.cbSize = sizeof(si);
- si.fMask = SIF_ALL;
- si.nMin = 0;
- si.nMax = pcli->pfnGetRowTotalHeight(dat)-1;
- si.nPage = clRect.bottom;
- si.nPos = dat->yScroll;
-
- if (GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_CONTACTLIST) {
- if (dat->noVScrollbar == 0) {
- if (cfg::dat.bSkinnedScrollbar && !dat->bisEmbedded)
- CoolSB_SetScrollInfo(hwnd, SB_VERT, &si, TRUE);
- else
- SetScrollInfo(hwnd, SB_VERT, &si, TRUE);
- }
- }
- else {
- if (cfg::dat.bSkinnedScrollbar && !dat->bisEmbedded)
- CoolSB_SetScrollInfo(hwnd, SB_VERT, &si, TRUE);
- else
- SetScrollInfo(hwnd, SB_VERT, &si, TRUE);
- }
- ScrollTo(hwnd, dat, dat->yScroll, 1);
- nm.hdr.code = CLN_LISTSIZECHANGE;
- nm.hdr.hwndFrom = hwnd;
- nm.hdr.idFrom = GetDlgCtrlID(hwnd);
- nm.pt.y = si.nMax;
- SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM) & nm);
+ SCROLLINFO si = { 0 };
+ RECT clRect;
+ NMCLISTCONTROL nm;
+
+ RowHeight::calcRowHeights(dat, hwnd);
+
+ GetClientRect(hwnd, &clRect);
+ si.cbSize = sizeof(si);
+ si.fMask = SIF_ALL;
+ si.nMin = 0;
+ si.nMax = pcli->pfnGetRowTotalHeight(dat)-1;
+ si.nPage = clRect.bottom;
+ si.nPos = dat->yScroll;
+
+ if (GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_CONTACTLIST) {
+ if (dat->noVScrollbar == 0) {
+ if (cfg::dat.bSkinnedScrollbar && !dat->bisEmbedded)
+ CoolSB_SetScrollInfo(hwnd, SB_VERT, &si, TRUE);
+ else
+ SetScrollInfo(hwnd, SB_VERT, &si, TRUE);
+ }
+ }
+ else {
+ if (cfg::dat.bSkinnedScrollbar && !dat->bisEmbedded)
+ CoolSB_SetScrollInfo(hwnd, SB_VERT, &si, TRUE);
+ else
+ SetScrollInfo(hwnd, SB_VERT, &si, TRUE);
+ }
+ ScrollTo(hwnd, dat, dat->yScroll, 1);
+ nm.hdr.code = CLN_LISTSIZECHANGE;
+ nm.hdr.hwndFrom = hwnd;
+ nm.hdr.idFrom = GetDlgCtrlID(hwnd);
+ nm.pt.y = si.nMax;
+ SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM) & nm);
//saveRecalcScrollBar(hwnd, dat);
}
@@ -452,15 +455,15 @@ void SetGroupExpand(HWND hwnd,struct ClcData *dat,ClcGroup *group,int newState) RECT clRect;
NMCLISTCONTROL nm;
- if (newState == -1)
- group->expanded ^= 1;
- else {
- if (group->expanded == (newState != 0))
- return;
- group->expanded = newState != 0;
- }
+ if (newState == -1)
+ group->expanded ^= 1;
+ else {
+ if (group->expanded == (newState != 0))
+ return;
+ group->expanded = newState != 0;
+ }
InvalidateRect(hwnd,NULL,FALSE);
- contentCount = pcli->pfnGetGroupContentsCount(group,1);
+ contentCount = pcli->pfnGetGroupContentsCount(group,1);
groupy=pcli->pfnGetRowsPriorTo(&dat->list,group,-1);
if (dat->selection>groupy && dat->selection<groupy+contentCount) dat->selection=groupy;
@@ -489,12 +492,12 @@ static LRESULT CALLBACK RenameEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPara switch (msg) {
case WM_KEYDOWN:
switch (wParam) {
- case VK_RETURN:
- pcli->pfnEndRename(GetParent(hwnd), (struct ClcData *) GetWindowLongPtr(GetParent(hwnd), 0), 1);
- return 0;
- case VK_ESCAPE:
- pcli->pfnEndRename(GetParent(hwnd), (struct ClcData *) GetWindowLongPtr(GetParent(hwnd), 0), 0);
- return 0;
+ case VK_RETURN:
+ pcli->pfnEndRename(GetParent(hwnd), (struct ClcData *) GetWindowLongPtr(GetParent(hwnd), 0), 1);
+ return 0;
+ case VK_ESCAPE:
+ pcli->pfnEndRename(GetParent(hwnd), (struct ClcData *) GetWindowLongPtr(GetParent(hwnd), 0), 0);
+ return 0;
}
break;
case WM_GETDLGCODE:
@@ -515,55 +518,55 @@ static LRESULT CALLBACK RenameEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPara void BeginRenameSelection(HWND hwnd, struct ClcData *dat)
{
- ClcContact *contact;
- ClcGroup *group;
- int indent, x, y, h;
- RECT clRect;
-
- KillTimer(hwnd, TIMERID_RENAME);
- ReleaseCapture();
- dat->iHotTrack = -1;
- dat->selection = pcli->pfnGetRowByIndex(dat, dat->selection, &contact, &group);
- if (dat->selection == -1)
- return;
- if (contact->type != CLCIT_CONTACT && contact->type != CLCIT_GROUP)
- return;
- for (indent = 0; group->parent; indent++,group = group->parent) {
- ;
- }
- GetClientRect(hwnd, &clRect);
- x = indent * dat->groupIndent + dat->iconXSpace - 2;
- //y = dat->selection * dat->rowHeight - dat->yScroll;
- y = RowHeight::getItemTopY(dat, dat->selection)-dat->yScroll;
-
- h=dat->row_heights[dat->selection];
- {
- int i;
- for (i=0; i <= FONTID_LAST; i++)
- if (h<dat->fontInfo[i].fontHeight+2) h=dat->fontInfo[i].fontHeight+2;
- }
+ ClcContact *contact;
+ ClcGroup *group;
+ int indent, x, y, h;
+ RECT clRect;
+
+ KillTimer(hwnd, TIMERID_RENAME);
+ ReleaseCapture();
+ dat->iHotTrack = -1;
+ dat->selection = pcli->pfnGetRowByIndex(dat, dat->selection, &contact, &group);
+ if (dat->selection == -1)
+ return;
+ if (contact->type != CLCIT_CONTACT && contact->type != CLCIT_GROUP)
+ return;
+ for (indent = 0; group->parent; indent++,group = group->parent) {
+ ;
+ }
+ GetClientRect(hwnd, &clRect);
+ x = indent * dat->groupIndent + dat->iconXSpace - 2;
+ //y = dat->selection * dat->rowHeight - dat->yScroll;
+ y = RowHeight::getItemTopY(dat, dat->selection)-dat->yScroll;
+
+ h=dat->row_heights[dat->selection];
+ {
+ int i;
+ for (i=0; i <= FONTID_LAST; i++)
+ if (h<dat->fontInfo[i].fontHeight+2) h=dat->fontInfo[i].fontHeight+2;
+ }
dat->hwndRenameEdit = CreateWindowEx(0, _T("RichEdit20W"),contact->szText,WS_CHILD|WS_BORDER|ES_MULTILINE|ES_AUTOHSCROLL,x,y,clRect.right-x,h,hwnd,NULL,g_hInst,NULL);
- {
- if ((contact->type == CLCIT_CONTACT && cfg::eCache[contact->extraCacheEntry].dwCFlags & ECF_RTLNICK) || (contact->type == CLCIT_GROUP && contact->isRtl)) {
- PARAFORMAT2 pf2;
- ZeroMemory((void *)&pf2, sizeof(pf2));
- pf2.cbSize = sizeof(pf2);
- pf2.dwMask = PFM_RTLPARA;
- pf2.wEffects = PFE_RTLPARA;
- SetWindowText(dat->hwndRenameEdit, _T(""));
- SendMessage(dat->hwndRenameEdit, EM_SETPARAFORMAT, 0, (LPARAM)&pf2);
- SetWindowText(dat->hwndRenameEdit, contact->szText);
- }
- }
-
- //dat->hwndRenameEdit = CreateWindow(_T("EDIT"), contact->szText, WS_CHILD | WS_BORDER | ES_AUTOHSCROLL, x, y, clRect.right - x, dat->rowHeight, hwnd, NULL, g_hInst, NULL);
- OldRenameEditWndProc = (WNDPROC) SetWindowLongPtr(dat->hwndRenameEdit, GWLP_WNDPROC, (LONG_PTR) RenameEditSubclassProc);
- SendMessage(dat->hwndRenameEdit, WM_SETFONT, (WPARAM) (contact->type == CLCIT_GROUP ? dat->fontInfo[FONTID_GROUPS].hFont : dat->fontInfo[FONTID_CONTACTS].hFont), 0);
- SendMessage(dat->hwndRenameEdit, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN | EC_USEFONTINFO, 0);
- SendMessage(dat->hwndRenameEdit, EM_SETSEL, 0, (LPARAM) (-1));
- ShowWindow(dat->hwndRenameEdit, SW_SHOW);
- SetFocus(dat->hwndRenameEdit);
+ {
+ if ((contact->type == CLCIT_CONTACT && cfg::eCache[contact->extraCacheEntry].dwCFlags & ECF_RTLNICK) || (contact->type == CLCIT_GROUP && contact->isRtl)) {
+ PARAFORMAT2 pf2;
+ ZeroMemory((void *)&pf2, sizeof(pf2));
+ pf2.cbSize = sizeof(pf2);
+ pf2.dwMask = PFM_RTLPARA;
+ pf2.wEffects = PFE_RTLPARA;
+ SetWindowText(dat->hwndRenameEdit, _T(""));
+ SendMessage(dat->hwndRenameEdit, EM_SETPARAFORMAT, 0, (LPARAM)&pf2);
+ SetWindowText(dat->hwndRenameEdit, contact->szText);
+ }
+ }
+
+ //dat->hwndRenameEdit = CreateWindow(_T("EDIT"), contact->szText, WS_CHILD | WS_BORDER | ES_AUTOHSCROLL, x, y, clRect.right - x, dat->rowHeight, hwnd, NULL, g_hInst, NULL);
+ OldRenameEditWndProc = (WNDPROC) SetWindowLongPtr(dat->hwndRenameEdit, GWLP_WNDPROC, (LONG_PTR) RenameEditSubclassProc);
+ SendMessage(dat->hwndRenameEdit, WM_SETFONT, (WPARAM) (contact->type == CLCIT_GROUP ? dat->fontInfo[FONTID_GROUPS].hFont : dat->fontInfo[FONTID_CONTACTS].hFont), 0);
+ SendMessage(dat->hwndRenameEdit, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN | EC_USEFONTINFO, 0);
+ SendMessage(dat->hwndRenameEdit, EM_SETSEL, 0, (LPARAM) (-1));
+ ShowWindow(dat->hwndRenameEdit, SW_SHOW);
+ SetFocus(dat->hwndRenameEdit);
}
extern void ( *saveLoadClcOptions )(HWND hwnd,struct ClcData *dat);
@@ -579,7 +582,7 @@ void LoadClcOptions(HWND hwnd, struct ClcData *dat) dat->row_border = 0;
dat->rightMargin = cfg::getByte("CLC", "RightMargin", CLCDEFAULT_LEFTMARGIN);
dat->bkColour = cfg::getByte("CLC", "UseWinColours", CLCDEFAULT_USEWINDOWSCOLOURS) ?
- GetSysColor(COLOR_3DFACE) : cfg::getDword("CLC", "BkColour", CLCDEFAULT_BKCOLOUR);
+ GetSysColor(COLOR_3DFACE) : cfg::getDword("CLC", "BkColour", CLCDEFAULT_BKCOLOUR);
if (!dat->bkChanged) {
if (cfg::dat.hBrushCLCBk)
DeleteObject(cfg::dat.hBrushCLCBk);
@@ -590,7 +593,7 @@ void LoadClcOptions(HWND hwnd, struct ClcData *dat) DeleteDC(cfg::dat.hdcPic);
cfg::dat.hdcPic = 0;
cfg::dat.hbmPicOld = 0;
- } }
+ } }
cfg::dat.bmpBackground = dat->hBmpBackground;
if (cfg::dat.bmpBackground) {
diff --git a/plugins/Clist_nicer/src/clistmod.cpp b/plugins/Clist_nicer/src/clistmod.cpp index 305d4aece1..2092413e71 100644 --- a/plugins/Clist_nicer/src/clistmod.cpp +++ b/plugins/Clist_nicer/src/clistmod.cpp @@ -111,7 +111,7 @@ static INT_PTR GetCaps(WPARAM wParam, LPARAM) case CLUICAPS_FLAGS1:
return CLUIF_HIDEEMPTYGROUPS | CLUIF_DISABLEGROUPS | CLUIF_HASONTOPOPTION | CLUIF_HASAUTOHIDEOPTION;
case CLUICAPS_FLAGS2:
- return MAKELONG(MAXEXTRACOLUMNS,1);
+ return MAKELONG(EXTRA_ICON_COUNT,1);
}
return 0;
}
diff --git a/plugins/Clist_nicer/src/clui.cpp b/plugins/Clist_nicer/src/clui.cpp index 98f34ad1a4..12fa50628d 100644 --- a/plugins/Clist_nicer/src/clui.cpp +++ b/plugins/Clist_nicer/src/clui.cpp @@ -68,8 +68,6 @@ extern ButtonItem *g_ButtonItems; extern COLORREF g_CLUISkinnedBkColorRGB;
extern wndFrame *wndFrameCLC;
-HIMAGELIST himlExtraImages = 0;
-
static BYTE old_cliststate, show_on_first_autosize = FALSE;
RECT cluiPos;
@@ -82,7 +80,6 @@ extern HANDLE hNotifyFrame; int SortList(WPARAM wParam, LPARAM lParam);
int LoadCluiServices(void);
void InitGroupMenus();
-void ReloadExtraIcons();
void FS_RegisterFonts();
void LoadExtraIconModule();
int MTG_OnmodulesLoad(WPARAM wParam, LPARAM lParam);
@@ -202,7 +199,7 @@ static HWND PreCreateCLC(HWND parent) static int CreateCLC(HWND parent)
{
- ReloadExtraIcons();
+ pcli->pfnReloadExtraIcons();
CallService(MS_CLIST_SETHIDEOFFLINE, (WPARAM)oldhideoffline, 0);
disableautoupd = 0;
@@ -270,39 +267,31 @@ static HICON hIconSaved = 0; void ClearIcons(int mode)
{
- int i;
-
- for (i = IDI_OVL_OFFLINE; i <= IDI_OVL_OUTTOLUNCH; i++) {
+ for (int i = IDI_OVL_OFFLINE; i <= IDI_OVL_OUTTOLUNCH; i++) {
if (overlayicons[i - IDI_OVL_OFFLINE] != 0) {
if (mode)
DestroyIcon(overlayicons[i - IDI_OVL_OFFLINE]);
overlayicons[i - IDI_OVL_OFFLINE] = 0;
}
}
- hIconSaved = ImageList_GetIcon(himlExtraImages, 3, ILD_NORMAL);
- ImageList_RemoveAll(himlExtraImages);
}
static void CacheClientIcons()
{
- int i = 0;
- char szBuffer[128];
-
ClearIcons(0);
- for (i = IDI_OVL_OFFLINE; i <= IDI_OVL_OUTTOLUNCH; i++) {
+ for (int i = IDI_OVL_OFFLINE; i <= IDI_OVL_OUTTOLUNCH; i++) {
+ char szBuffer[128];
mir_snprintf(szBuffer, sizeof(szBuffer), "cln_ovl_%d", ID_STATUS_OFFLINE + (i - IDI_OVL_OFFLINE));
overlayicons[i - IDI_OVL_OFFLINE] = Skin_GetIcon(szBuffer);
}
+
+ /* !!!!!!!!!!!!!!!!!!!!!!
ImageList_AddIcon(himlExtraImages, Skin_GetIcon("core_main_14"));
ImageList_AddIcon(himlExtraImages, (HICON)LoadSkinnedIcon(SKINICON_EVENT_URL));
ImageList_AddIcon(himlExtraImages, Skin_GetIcon("core_main_17"));
- if (hIconSaved != 0) {
- ImageList_AddIcon(himlExtraImages, hIconSaved);
- DestroyIcon(hIconSaved);
- hIconSaved = 0;
- } else
- ImageList_AddIcon(himlExtraImages, Skin_GetIcon("core_main_17"));
+ ImageList_AddIcon(himlExtraImages, Skin_GetIcon("core_main_17"));
+ */
}
static void InitIcoLib()
@@ -437,7 +426,7 @@ void IcoLibReloadIcons() cfg::dat.hIconInvisible = Skin_GetIcon("CLN_invisible");
cfg::dat.hIconChatactive = Skin_GetIcon("CLN_chatactive");
CacheClientIcons();
- ReloadExtraIcons();
+ pcli->pfnReloadExtraIcons();
// force client icons reload
{
diff --git a/plugins/Clist_nicer/src/cluiservices.cpp b/plugins/Clist_nicer/src/cluiservices.cpp index 093f950bbb..f4b8b29e7d 100644 --- a/plugins/Clist_nicer/src/cluiservices.cpp +++ b/plugins/Clist_nicer/src/cluiservices.cpp @@ -27,7 +27,7 @@ UNICODE done #include "../cluiframes/cluiframes.h"
#include <m_icq.h>
-extern HIMAGELIST hCListImages, himlExtraImages;;
+extern HIMAGELIST hCListImages;
extern ButtonItem *g_ButtonItems;
extern PLUGININFOEX pluginInfo;
diff --git a/plugins/Clist_nicer/src/config.cpp b/plugins/Clist_nicer/src/config.cpp index 8ed431ad40..676c145c9e 100644 --- a/plugins/Clist_nicer/src/config.cpp +++ b/plugins/Clist_nicer/src/config.cpp @@ -220,8 +220,6 @@ int cfg::getCache(const HANDLE hContact, const char *szProto) }
memset(&cfg::eCache[nextCacheEntry], 0, sizeof(TExtraCache));
cfg::eCache[nextCacheEntry].hContact = hContact;
- memset(cfg::eCache[nextCacheEntry].iExtraImage, 0xffff, MAXEXTRACOLUMNS);
- cfg::eCache[nextCacheEntry].iExtraValid = 0;
cfg::eCache[nextCacheEntry].valid = FALSE;
cfg::eCache[nextCacheEntry].bStatusMsgValid = 0;
cfg::eCache[nextCacheEntry].statusMsg = NULL;
diff --git a/plugins/Clist_nicer/src/extBackg.cpp b/plugins/Clist_nicer/src/extBackg.cpp index 42767f9ad6..0a7a7cefc5 100644 --- a/plugins/Clist_nicer/src/extBackg.cpp +++ b/plugins/Clist_nicer/src/extBackg.cpp @@ -27,7 +27,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. extern int g_hottrack;
extern HWND g_hwndViewModeFrame;
-extern HIMAGELIST himlExtraImages;
StatusItems_t *StatusItems = NULL;
ImageItem *g_ImageItems = NULL, *g_glyphItem = NULL;
@@ -40,7 +39,6 @@ int ID_EXTBK_LAST = ID_EXTBK_LAST_D; //void SetTBSKinned(int mode);
void ReloadThemedOptions();
-void ReloadExtraIcons();
static void SaveCompleteStructToDB(void);
static StatusItems_t _StatusItems[] = {
@@ -1503,7 +1501,6 @@ void extbk_import(char *file, HWND hwndDlg) SendMessage(pcli->hwndContactList, WM_SIZE, 0, 0);
RedrawWindow(pcli->hwndContactList,NULL,NULL,RDW_INVALIDATE|RDW_ERASE|RDW_FRAME|RDW_UPDATENOW|RDW_ALLCHILDREN);
if (oldexIconScale != cfg::dat.exIconScale) {
- ImageList_SetIconSize(himlExtraImages, cfg::dat.exIconScale, cfg::dat.exIconScale);
IcoLibReloadIcons();
pcli->pfnClcBroadcast(CLM_AUTOREBUILD, 0, 0);
}
@@ -1849,7 +1846,7 @@ int CoolSB_SetupScrollBar() UninitializeCoolSB(pcli->hwndContactTree);
return 0;
}
-
+
if (cfg::dat.bSkinnedScrollbar) {
InitializeCoolSB(pcli->hwndContactTree);
CoolSB_SetStyle(pcli->hwndContactTree, SB_VERT, CSBS_HOTTRACKED);
diff --git a/plugins/Clist_nicer/src/init.cpp b/plugins/Clist_nicer/src/init.cpp index 2016cceccc..8837513e72 100644 --- a/plugins/Clist_nicer/src/init.cpp +++ b/plugins/Clist_nicer/src/init.cpp @@ -46,7 +46,6 @@ extern int Docking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam); extern int SetHideOffline(WPARAM wParam, LPARAM lParam);
extern DWORD g_gdiplusToken;
-extern HIMAGELIST himlExtraImages;
TIME_API tmi;
@@ -212,11 +211,6 @@ static int fnIconFromStatusMode( const char* szProto, int status, HANDLE hContac extern "C" int __declspec(dllexport) CListInitialise()
{
- int rc = 0;
- DBVARIANT dbv;
- int i;
- char szProfilePath[MAX_PATH];
-
mir_getTMI(&tmi);
mir_getLP( &pluginInfo );
@@ -278,52 +272,22 @@ extern "C" int __declspec(dllexport) CListInitialise() if (cfg::dat.bFirstRun)
cfg::writeByte("CLUI", "firstrun", 0);
- if (!cfg::getString(NULL, "CLUI", "exIconOrder", &dbv)) {
- if (lstrlenA(dbv.pszVal) < EXICON_COUNT) {
- for (i = 1; i <= EXICON_COUNT; i++)
- cfg::dat.exIconOrder[i - 1] = i;
- } else {
- for (i = 0; i < EXICON_COUNT; i++)
- if (dbv.pszVal[i] < EXICON_COUNT+1 && dbv.pszVal[i] >0)
- cfg::dat.exIconOrder[i] = dbv.pszVal[i];
- else
- cfg::dat.exIconOrder[i] = i+1;
- }
- DBFreeVariant(&dbv);
- } else {
- for (i = 1; i <= EXICON_COUNT; i++)
- cfg::dat.exIconOrder[i - 1] = i;
- }
ReloadThemedOptions();
FLT_ReadOptions();
Reload3dBevelColors();
- himlExtraImages = ImageList_Create(16, 16, ILC_MASK | (IsWinVerXPPlus() ? ILC_COLOR32 : ILC_COLOR16), 30, 2);
- ImageList_SetIconSize(himlExtraImages, cfg::dat.exIconScale, cfg::dat.exIconScale);
cfg::dat.dwFlags = cfg::getDword("CLUI", "Frameflags", CLUI_FRAME_STATUSICONS | CLUI_FRAME_SHOWBOTTOMBUTTONS |
CLUI_FRAME_BUTTONSFLAT | CLUI_FRAME_CLISTSUNKEN);
cfg::dat.dwFlags |= (cfg::getByte("CLUI", "ShowSBar", 1) ? CLUI_FRAME_SBARSHOW : 0);
cfg::dat.soundsOff = cfg::getByte("CLUI", "NoSounds", 0);
- CallService(MS_DB_GETPROFILEPATH, MAX_PATH, (LPARAM)szProfilePath);
-
- MultiByteToWideChar(CP_ACP, 0, szProfilePath, MAX_PATH, cfg::dat.tszProfilePath, MAX_PATH);
- cfg::dat.tszProfilePath[MAX_PATH - 1] = 0;
-
+ CallService(MS_DB_GETPROFILEPATHT, MAX_PATH, (LPARAM)cfg::dat.tszProfilePath);
_tcslwr(cfg::dat.tszProfilePath);
PreloadContactListModule();
// get the clist interface
pcli = ( CLIST_INTERFACE* )CallService(MS_CLIST_RETRIEVE_INTERFACE, 0, (LPARAM)g_hInst);
- if ( (INT_PTR)pcli == CALLSERVICE_NOTFOUND ) {
-LBL_Error:
- MessageBoxA( NULL, "This plugin requires Miranda IM 0.8.0.9 or later", "Fatal error", MB_OK );
- return 1;
- }
- if ( pcli->version < 6 ) // don't join it with the previous if ()
- goto LBL_Error;
-
pcli->pfnBuildGroupPopupMenu = BuildGroupPopupMenu;
pcli->pfnCluiProtocolStatusChanged = CluiProtocolStatusChanged;
pcli->pfnCompareContacts = CompareContacts;
@@ -363,7 +327,7 @@ LBL_Error: saveRecalcScrollBar = pcli->pfnRecalcScrollBar; pcli->pfnRecalcScrollBar = RecalcScrollBar;
saveTrayIconProcessMessage = pcli->pfnTrayIconProcessMessage; pcli->pfnTrayIconProcessMessage = TrayIconProcessMessage;
- rc = LoadContactListModule();
+ int rc = LoadContactListModule();
if (rc == 0)
rc = LoadCLCModule();
LoadCLUIModule();
@@ -382,7 +346,6 @@ extern "C" int __declspec(dllexport) Unload(void) {
if (IsWindow(pcli->hwndContactList))
DestroyWindow(pcli->hwndContactList);
- ImageList_Destroy(himlExtraImages);
ClcShutdown(0, 0);
UnLoadCLUIFramesModule();
return 0;
diff --git a/src/core/stdclist/src/clcpaint.cpp b/src/core/stdclist/src/clcpaint.cpp index 3abf98778a..278e2e493b 100644 --- a/src/core/stdclist/src/clcpaint.cpp +++ b/src/core/stdclist/src/clcpaint.cpp @@ -500,7 +500,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) for (iImage = 0; iImage < dat->extraColumnsCount; iImage++) {
COLORREF colourFg = dat->selBkColour;
int mode = ILD_NORMAL;
- if (group->cl.items[group->scanIndex]->iExtraImage[iImage] == 0xFF)
+ if (group->cl.items[group->scanIndex]->iExtraImage[iImage] == 0xFFFF)
continue;
if (selected)
mode = ILD_SELECTED;
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;
}
|