diff options
author | George Hazan <george.hazan@gmail.com> | 2012-07-14 19:06:59 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-07-14 19:06:59 +0000 |
commit | e3ffab889d900847fa6fb9807bc5f818da28c358 (patch) | |
tree | 5722d206bdaeaec951c1c293bb671cd7347ebad7 | |
parent | e2e713063780dd623c8025b6f4762c1e32bc784d (diff) |
much less crazy way to organize clist data
git-svn-id: http://svn.miranda-ng.org/main/trunk@973 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
23 files changed, 239 insertions, 405 deletions
diff --git a/include/m_clistint.h b/include/m_clistint.h index 1f93b4a422..c57cedc47e 100644 --- a/include/m_clistint.h +++ b/include/m_clistint.h @@ -24,6 +24,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef M_CLISTINT_H__
#define M_CLISTINT_H__ 1
+#include <CommCtrl.h>
+
+#include "m_clc.h"
#include "m_genmenu.h"
#include "m_protocols.h"
@@ -61,30 +64,21 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define TIMERID_TRAYHOVER 16
#define TIMERID_TRAYHOVER_2 17
-
#define GROUP_ALLOCATE_STEP 8
-struct ClcContact;
-struct ClcData;
-struct CListEvent;
-
-/* templates, where are you... */
-
-typedef struct
+struct ContactList
{
struct ClcContact** items;
int count, limit, increment;
void* sortFunc;
-}
- ContactList;
+};
-typedef struct
+struct EventList
{
struct CListEvent** items;
int count, limit, increment;
void* sortFunc;
-}
- EventList;
+};
struct ClcGroup
{
@@ -102,6 +96,72 @@ struct ClcFontInfo COLORREF colour;
};
+struct ClcContactBase
+{
+ BYTE type;
+ BYTE flags;
+ union {
+ struct {
+ WORD iImage;
+ HANDLE hContact;
+ };
+ struct {
+ WORD groupId;
+ struct ClcGroup *group;
+ };
+ };
+ BYTE iExtraImage[MAXEXTRACOLUMNS];
+ TCHAR szText[120-MAXEXTRACOLUMNS];
+ char * proto; // MS_PROTO_GETBASEPROTO
+};
+
+struct ClcDataBase
+{
+ struct ClcGroup list;
+ int rowHeight;
+ int yScroll;
+ int selection;
+ struct ClcFontInfo fontInfo[FONTID_MAX + 1];
+ int scrollTime;
+ HIMAGELIST himlHighlight;
+ int groupIndent;
+ TCHAR szQuickSearch[128];
+ int iconXSpace;
+ HWND hwndRenameEdit;
+ COLORREF bkColour, selBkColour, selTextColour, hotTextColour, quickSearchColour;
+ int iDragItem, iInsertionMark;
+ int dragStage;
+ POINT ptDragStart;
+ int dragAutoScrolling;
+ int dragAutoScrollHeight;
+ int leftMargin;
+ int insertionMarkHitHeight;
+ HBITMAP hBmpBackground;
+ int backgroundBmpUse, bkChanged;
+ int iHotTrack;
+ int gammaCorrection;
+ DWORD greyoutFlags; //see m_clc.h
+ DWORD offlineModes;
+ DWORD exStyle;
+ POINT ptInfoTip;
+ int infoTipTimeout;
+ HANDLE hInfoTipItem;
+ HIMAGELIST himlExtraColumns;
+ int extraColumnsCount;
+ int extraColumnSpacing;
+ int checkboxSize;
+ int showSelAlways;
+ int showIdle;
+ int noVScrollbar;
+ int useWindowsColours;
+ int needsResort;
+ int filterSearch;
+};
+
+struct ClcContact;
+struct ClcData;
+struct CListEvent;
+
struct trayIconInfo_t
{
int id;
diff --git a/plugins/Clist_classic/src/clc.h b/plugins/Clist_classic/src/clc.h index 472dc12eab..d089a213da 100644 --- a/plugins/Clist_classic/src/clc.h +++ b/plugins/Clist_classic/src/clc.h @@ -23,61 +23,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define FONTID_LAST 7
-struct ClcContact {
- BYTE type;
- BYTE flags;
- union {
- struct {
- WORD iImage;
- HANDLE hContact;
- };
- struct {
- WORD groupId;
- struct ClcGroup *group;
- };
- };
- BYTE iExtraImage[MAXEXTRACOLUMNS];
- TCHAR szText[120-MAXEXTRACOLUMNS];
- char * proto; // MS_PROTO_GETBASEPROTO
+struct ClcContact : public ClcContactBase
+{
};
-struct ClcData {
- struct ClcGroup list;
- int rowHeight;
- int yScroll;
- int selection;
- struct ClcFontInfo fontInfo[FONTID_MAX+1];
- int scrollTime;
- HIMAGELIST himlHighlight;
- int groupIndent;
- TCHAR szQuickSearch[128];
- int iconXSpace;
- HWND hwndRenameEdit;
- COLORREF bkColour,selBkColour,selTextColour,hotTextColour,quickSearchColour;
- int iDragItem,iInsertionMark;
- int dragStage;
- POINT ptDragStart;
- int dragAutoScrolling;
- int dragAutoScrollHeight;
- int leftMargin;
- int insertionMarkHitHeight;
- HBITMAP hBmpBackground;
- int backgroundBmpUse,bkChanged;
- int iHotTrack;
- int gammaCorrection;
- DWORD greyoutFlags; //see m_clc.h
- DWORD offlineModes;
- DWORD exStyle;
- POINT ptInfoTip;
- int infoTipTimeout;
- HANDLE hInfoTipItem;
- HIMAGELIST himlExtraColumns;
- int extraColumnsCount;
- int extraColumnSpacing;
- int checkboxSize;
- int showSelAlways;
- int showIdle;
- int noVScrollbar;
- int useWindowsColours;
- int needsResort;
-};
+struct ClcData : public ClcDataBase
+{
+};
\ No newline at end of file diff --git a/plugins/Clist_classic/src/commonheaders.h b/plugins/Clist_classic/src/commonheaders.h index 4ae328c54d..d046660d0c 100644 --- a/plugins/Clist_classic/src/commonheaders.h +++ b/plugins/Clist_classic/src/commonheaders.h @@ -43,7 +43,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <win2k.h>
#include <newpluginapi.h>
#include <m_clist.h>
-#include <m_clc.h>
#include <m_clistint.h>
#include <m_clui.h>
#include <m_plugins.h>
diff --git a/plugins/Clist_modern/src/hdr/modern_clc.h b/plugins/Clist_modern/src/hdr/modern_clc.h index 56c7a8b4c0..e17ee3e03c 100644 --- a/plugins/Clist_modern/src/hdr/modern_clc.h +++ b/plugins/Clist_modern/src/hdr/modern_clc.h @@ -74,8 +74,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define INTM_AVATARCHANGED (WM_USER+28)
#define INTM_TIMEZONECHANGED (WM_USER+29)
-
-
#define CLM_SETEXTRACOLUMNSSPACE (CLM_FIRST+73) //wParam=extra space between icons
#define CLBF_TILEVTOROWHEIGHT 0x0100
@@ -202,42 +200,25 @@ enum { CIT_EXTRA=64 //use bit compare for extra icon, the mask &0x3F will return number of extra icon
};
-
-typedef struct _tagContactItems
+struct tContactItems
{
BYTE itemType; //one of above CIT_ definitions
RECT itemRect;
-}tContactItems;
-
-struct ClcContact {
- BYTE type;
- BYTE flags;
- union {
- struct {
- int iImage;
- HANDLE hContact;
- };
- struct {
- WORD groupId;
- struct ClcGroup *group;
- };
- };
- BYTE iExtraImage[MAXEXTRACOLUMNS];
- TCHAR szText[120 - MAXEXTRACOLUMNS];
- char * proto; // MS_PROTO_GETBASEPROTO
+};
+struct ClcContact : public ClcContactBase
+{
struct ClcContact *subcontacts;
BYTE SubAllocated;
BYTE SubExpanded;
BYTE isSubcontact;
-// int status;
+ // int status;
BOOL image_is_special;
int avatar_pos;
struct avatarCacheEntry *avatar_data;
SIZE avatar_size;
CSmileyString ssText;
-
// For hittest
int pos_indent;
RECT pos_check;
@@ -247,70 +228,28 @@ struct ClcContact { RECT pos_rename_rect;
RECT pos_contact_time;
RECT pos_extra[MAXEXTRACOLUMNS];
- DWORD lastPaintCounter;
- BYTE bContactRate;
+ 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];
-
+ WORD iWideExtraImage[MAXEXTRACOLUMNS];
};
-
-
struct ClcModernFontInfo {
HFONT hFont;
int fontHeight,changed;
COLORREF colour;
- BYTE effect;
- COLORREF effectColour1;
- COLORREF effectColour2;
+ BYTE effect;
+ COLORREF effectColour1;
+ COLORREF effectColour2;
};
-struct ClcData {
- struct ClcGroup list;
- int max_row_height;
-
- int yScroll;
- int selection;
- struct ClcFontInfo fontInfo[FONTID_MAX+1];
- int scrollTime;
- HIMAGELIST himlHighlight;
- int groupIndent;
- TCHAR szQuickSearch[128];
- int iconXSpace;
- HWND hwndRenameEdit;
- COLORREF bkColour,selBkColour,selTextColour,hotTextColour,quickSearchColour;
- int iDragItem,iInsertionMark;
- int dragStage;
- POINT ptDragStart;
- int dragAutoScrolling;
- int dragAutoScrollHeight;
- int leftMargin;
- int insertionMarkHitHeight;
- HBITMAP hBmpBackground;
- int backgroundBmpUse,bkChanged;
- int iHotTrack;
- int gammaCorrection;
- DWORD greyoutFlags; //see m_clc.h
- DWORD offlineModes;
- DWORD exStyle;
- POINT ptInfoTip;
- int infoTipTimeout;
- HANDLE hInfoTipItem;
- HIMAGELIST himlExtraColumns;
- int extraColumnsCount;
- int extraColumnSpacing;
- int checkboxSize;
- int showSelAlways;
- int showIdle;
- int noVScrollbar;
- int useWindowsColours;
- int NeedResort;
+struct ClcData : public ClcDataBase
+{
SortedList lCLCContactsCache;
BYTE HiLightMode;
BYTE doubleClickExpand;
@@ -356,7 +295,7 @@ struct ClcData { BOOL avatars_ignore_size_for_row_height;
BOOL avatars_draw_overlay;
int avatars_overlay_type;
-
+
int avatars_maxheight_size;
int avatars_maxwidth_size;
@@ -407,10 +346,10 @@ struct ClcData { HWND hWnd;
BYTE menuOwnerType;
int menuOwnerID;
- DWORD m_paintCouter; //range is enoght to 49 days if painting will occure each one millisecond
- BYTE useMetaIcon;
- BYTE drawOverlayedStatus;
- int nInsertionLevel;
+ DWORD m_paintCouter; //range is enoght to 49 days if painting will occure each one millisecond
+ BYTE useMetaIcon;
+ BYTE drawOverlayedStatus;
+ int nInsertionLevel;
BYTE dbbMetaHideExtra;
BYTE dbbBlendInActiveState;
@@ -418,18 +357,17 @@ struct ClcData { XPTHANDLE hCheckBoxTheme;
BYTE bCompactMode;
-
- HIMAGELIST himlWideExtraColumns;
+ HIMAGELIST himlWideExtraColumns;
};
struct SHORTDATA
{
- HWND hWnd;
- BOOL contact_time_show_only_if_different;
- int text_smiley_height;
- BOOL text_replace_smileys;
- BOOL text_use_protocol_smileys;
+ HWND hWnd;
+ BOOL contact_time_show_only_if_different;
+ int text_smiley_height;
+ BOOL text_replace_smileys;
+ BOOL text_use_protocol_smileys;
// Second line
BOOL second_line_show;
@@ -455,10 +393,10 @@ struct SHORTDATA typedef struct tagOVERLAYICONINFO
{
- char *name;
- char *description;
- int id;
- int listID;
+ char *name;
+ char *description;
+ int id;
+ int listID;
} OVERLAYICONINFO;
//clc.c
diff --git a/plugins/Clist_modern/src/hdr/modern_commonheaders.h b/plugins/Clist_modern/src/hdr/modern_commonheaders.h index 922e0b0d90..738b402ec2 100644 --- a/plugins/Clist_modern/src/hdr/modern_commonheaders.h +++ b/plugins/Clist_modern/src/hdr/modern_commonheaders.h @@ -106,7 +106,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <m_avatars.h>
#include <m_genmenu.h>
#include <m_clui.h>
-#include <m_clc.h>
#include <m_icolib.h>
#include <m_userinfo.h>
#include <m_addcontact.h>
diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp index 57d4da274b..3b6034128d 100644 --- a/plugins/Clist_modern/src/modern_clc.cpp +++ b/plugins/Clist_modern/src/modern_clc.cpp @@ -406,7 +406,7 @@ static LRESULT clcOnCreate(struct ClcData *dat, HWND hwnd, UINT msg, WPARAM wPar RowHeights_Initialize(dat);
- dat->NeedResort = 1;
+ dat->needsResort = 1;
dat->MetaIgnoreEmptyExtra = db_get_b(NULL,"CLC","MetaIgnoreEmptyExtra",SETTING_METAIGNOREEMPTYEXTRA_DEFAULT);
dat->IsMetaContactsEnabled = (!(GetWindowLongPtr(hwnd,GWL_STYLE)&CLS_MANUALUPDATE)) &&
@@ -586,15 +586,11 @@ static LRESULT clcOnKeyDown(struct ClcData *dat, HWND hwnd, UINT msg, WPARAM wPa if (CallService(MS_CLIST_MENUPROCESSHOTKEY,wParam,MPCF_CONTACTMENU))
return 0;
- {
- RECT clRect;
- GetClientRect(hwnd,&clRect);
- if (dat->max_row_height) pageSize = clRect.bottom/dat->max_row_height;
- else pageSize = 0;
- }
+ RECT clRect;
+ GetClientRect(hwnd,&clRect);
+ pageSize = (dat->rowHeight) ? clRect.bottom/dat->rowHeight : 0;
- switch(wParam)
- {
+ switch(wParam) {
case VK_DOWN:
case VK_UP:
{
@@ -690,7 +686,7 @@ static LRESULT clcOnKeyDown(struct ClcData *dat, HWND hwnd, UINT msg, WPARAM wPa contact->SubExpanded = 0;
db_set_b(contact->hContact,"CList","Expanded",0);
ht = contact;
- dat->NeedResort = 1;
+ dat->needsResort = 1;
pcli->pfnSortCLC(hwnd,dat,1);
cliRecalcScrollBar(hwnd,dat);
hitcontact = NULL;
@@ -707,7 +703,7 @@ static LRESULT clcOnKeyDown(struct ClcData *dat, HWND hwnd, UINT msg, WPARAM wPa contact->SubExpanded = 1;
db_set_b(contact->hContact,"CList","Expanded",1);
ht = contact;
- dat->NeedResort = 1;
+ dat->needsResort = 1;
pcli->pfnSortCLC(hwnd,dat,1);
cliRecalcScrollBar(hwnd,dat);
if (ht)
@@ -830,7 +826,7 @@ static LRESULT clcOnTimer(struct ClcData *dat, HWND hwnd, UINT msg, WPARAM wPara ht = &(hitcontact->subcontacts[hitcontact->SubAllocated-1]);
}
- dat->NeedResort = 1;
+ dat->needsResort = 1;
pcli->pfnSortCLC(hwnd,dat,1);
cliRecalcScrollBar(hwnd,dat);
if (ht) {
@@ -1619,7 +1615,7 @@ static LRESULT clcOnIntmGroupChanged(struct ClcData *dat, HWND hwnd, UINT msg, W nm.flags = 0;
nm.hItem = (HANDLE) wParam;
SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM) & nm);
- dat->NeedResort = 1;
+ dat->needsResort = 1;
}
SetTimer(hwnd,TIMERID_REBUILDAFTER,1,NULL);
return 0;
@@ -1674,7 +1670,7 @@ static LRESULT clcOnIntmIconChanged(struct ClcData *dat, HWND hwnd, UINT msg, WP contact->iImage = lParam;
contact->image_is_special = image_is_special;
pcli->pfnNotifyNewContact(hwnd, (HANDLE) wParam);
- dat->NeedResort = 1;
+ dat->needsResort = 1;
}
}
}
@@ -1694,7 +1690,7 @@ static LRESULT clcOnIntmIconChanged(struct ClcData *dat, HWND hwnd, UINT msg, WP pcli->pfnRemoveItemFromGroup(hwnd, group, contact, (style & CLS_CONTACTLIST) == 0);
needRepaint = TRUE;
recalcScrollBar = 1;
- dat->NeedResort = 1;
+ dat->needsResort = 1;
}
else if (contact)
{
@@ -1706,7 +1702,7 @@ static LRESULT clcOnIntmIconChanged(struct ClcData *dat, HWND hwnd, UINT msg, WP contact->image_is_special = image_is_special;
if ( !image_is_special) //Only if it is status changing
{
- dat->NeedResort = 1;
+ dat->needsResort = 1;
needRepaint = TRUE;
}
else if (dat->m_paintCouter == contact->lastPaintCounter) //if contacts is visible
@@ -1723,9 +1719,9 @@ static LRESULT clcOnIntmIconChanged(struct ClcData *dat, HWND hwnd, UINT msg, WP else
dat->selection = -1;
}
- // dat->NeedResort = 1;
+ // dat->needsResort = 1;
// SortClcByTimer(hwnd);
- if (dat->NeedResort)
+ if (dat->needsResort)
{
TRACE("Sort required\n");
clcSetDelayTimer( TIMERID_DELAYEDRESORTCLC, hwnd );
@@ -1786,7 +1782,7 @@ static LRESULT clcOnIntmNameChanged(struct ClcData *dat, HWND hwnd, UINT msg, WP Cache_GetText(dat,contact,1);
cliRecalcScrollBar(hwnd,dat);
}
- dat->NeedResort = 1;
+ dat->needsResort = 1;
pcli->pfnSortContacts();
return ret;
diff --git a/plugins/Clist_modern/src/modern_clcitems.cpp b/plugins/Clist_modern/src/modern_clcitems.cpp index 7a29b5e82a..1da4ce23c2 100644 --- a/plugins/Clist_modern/src/modern_clcitems.cpp +++ b/plugins/Clist_modern/src/modern_clcitems.cpp @@ -240,7 +240,7 @@ static struct ClcContact * AddContactToGroup(struct ClcData *dat,struct ClcGroup if (group == NULL) return NULL;
if (dat == NULL) return NULL;
hContact = cacheEntry->hContact;
- dat->NeedResort = 1;
+ dat->needsResort = 1;
for (i = group->cl.count-1;i >= 0;i--)
if (group->cl.items[i]->type != CLCIT_INFO || !(group->cl.items[i]->flags&CLCIIF_BELOWCONTACTS)) break;
i = cli_AddItemToGroup(group,i+1);
@@ -304,7 +304,7 @@ void cli_DeleteItemFromTree(HWND hwnd,HANDLE hItem) //check here contacts are not resorting
if (hwnd == pcli->hwndContactTree)
pcli->pfnFreeCacheItem(pcli->pfnGetCacheEntry(hItem));
- dat->NeedResort = 1;
+ dat->needsResort = 1;
ClearRowByIndexCache();
}
@@ -375,7 +375,7 @@ void cliRebuildEntireList(HWND hwnd,struct ClcData *dat) dat->list.hideOffline = db_get_b(NULL,"CLC","HideOfflineRoot",SETTING_HIDEOFFLINEATROOT_DEFAULT) && style&CLS_USEGROUPS;
dat->list.cl.count = dat->list.cl.limit = 0;
dat->list.cl.increment = 50;
- dat->NeedResort = 1;
+ dat->needsResort = 1;
HANDLE hSelected = SaveSelection( dat );
dat->selection = -1;
@@ -541,7 +541,7 @@ void cli_SaveStateAndRebuildList(HWND hwnd, struct ClcData *dat) KillTimer(hwnd, TIMERID_RENAME);
pcli->pfnEndRename(hwnd, dat, 1);
- dat->NeedResort = 1;
+ dat->needsResort = 1;
group = &dat->list;
group->scanIndex = 0;
for (;;) {
@@ -757,10 +757,15 @@ int __fastcall CLVM_GetContactHiddenStatus(HANDLE hContact, char *szProto, struc PDNCE pdnce = (PDNCE)pcli->pfnGetCacheEntry(hContact);
BOOL fEmbedded = dat->force_in_dialog;
// always hide subcontacts (but show them on embedded contact lists)
-
+
+ if (dat->filterSearch && dat->szQuickSearch) {
+ // search filtering
+ return _tcsnicmp(dat->szQuickSearch, pdnce->tszName, lstrlen(dat->szQuickSearch));
+ //return _tcsstr(CharLowerW(pdnce->tszName), CharLowerW(dat->szQuickSearch)) ? 0 : 1; // this will search in whole string, but highlighting isn't supporting it...
+ }
if (g_CluiData.bMetaAvail && dat != NULL && dat->IsMetaContactsEnabled && g_szMetaModuleName && db_get_b(hContact, g_szMetaModuleName, "IsSubcontact", 0))
return -1; //subcontact
- if (pdnce && pdnce->isUnknown && !fEmbedded)
+ if (pdnce && pdnce->isUnknown && !fEmbedded)
return 1; //'Unknown Contact'
if (pdnce && g_CluiData.bFilterEffective && !fEmbedded)
{
diff --git a/plugins/Clist_modern/src/modern_clcutils.cpp b/plugins/Clist_modern/src/modern_clcutils.cpp index 9e6066c13a..efd26e437c 100644 --- a/plugins/Clist_modern/src/modern_clcutils.cpp +++ b/plugins/Clist_modern/src/modern_clcutils.cpp @@ -708,8 +708,9 @@ void LoadCLCOptions(HWND hwnd, struct ClcData *dat ) dat->gammaCorrection = db_get_b(NULL,"CLC","GammaCorrect",CLCDEFAULT_GAMMACORRECT);
dat->showIdle = db_get_b(NULL,"CLC","ShowIdle",CLCDEFAULT_SHOWIDLE);
dat->noVScrollbar = db_get_b(NULL,"CLC","NoVScrollBar",CLCDEFAULT_NOVSCROLL);
+ dat->filterSearch = db_get_b(NULL, "CLC", "FilterSearch", 0);
SendMessage(hwnd,INTM_SCROLLBARCHANGED,0,0);
-
+
if (dat->hBmpBackground) {DeleteObject(dat->hBmpBackground); dat->hBmpBackground = NULL;}
if (dat->hMenuBackground) {DeleteObject(dat->hMenuBackground); dat->hMenuBackground = NULL;}
@@ -796,7 +797,7 @@ int ExpandMetaContact(HWND hwnd, struct ClcContact * contact, struct ClcData * d if (contact->type != CLCIT_CONTACT || contact->SubAllocated == 0 || contact->SubExpanded == bExpand || !db_get_b(NULL,"CLC","MetaExpanding",SETTING_METAEXPANDING_DEFAULT)) return 0;
contact->SubExpanded = bExpand;
db_set_b(contact->hContact,"CList","Expanded",contact->SubExpanded);
- dat->NeedResort = 1;
+ dat->needsResort = 1;
pcli->pfnSortCLC(hwnd,dat,1);
cliRecalcScrollBar(hwnd,dat);
return contact->SubExpanded;
diff --git a/plugins/Clist_modern/src/modern_rowheight_funcs.cpp b/plugins/Clist_modern/src/modern_rowheight_funcs.cpp index 238962baa2..3839cafc97 100644 --- a/plugins/Clist_modern/src/modern_rowheight_funcs.cpp +++ b/plugins/Clist_modern/src/modern_rowheight_funcs.cpp @@ -361,7 +361,7 @@ int mod_CalcRowHeight_worker(struct ClcData *dat, HWND hwnd, struct ClcContact * BOOL RowHeights_Initialize(struct ClcData *dat)
{
- dat->max_row_height = 0;
+ dat->rowHeight = 0;
dat->row_heights_size = 0;
dat->row_heights_allocated = 0;
dat->row_heights = NULL;
@@ -511,7 +511,7 @@ int RowHeights_GetMaxRowHeight(struct ClcData *dat, HWND hwnd) // Min size
max_height = max(max_height, dat->row_min_heigh);
- dat->max_row_height = max_height;
+ dat->rowHeight = max_height;
return max_height;
}
@@ -709,7 +709,7 @@ int RowHeights_GetRowHeight_worker(struct ClcData *dat, HWND hwnd, struct ClcCon }
else
{
- height = dat->max_row_height;
+ height = dat->rowHeight;
}
dat->row_heights[item] = height;
@@ -791,6 +791,6 @@ int cliRowHitTest(struct ClcData *dat, int pos_y) int cliGetRowHeight(struct ClcData *dat, int item)
{
if ( item >= dat->row_heights_size || item < 0 )
- return dat->max_row_height;
+ return dat->rowHeight;
return dat->row_heights[ item ];
}
diff --git a/plugins/Clist_mw/clc.cpp b/plugins/Clist_mw/clc.cpp index 1b57dcf9bd..40eddc02eb 100644 --- a/plugins/Clist_mw/clc.cpp +++ b/plugins/Clist_mw/clc.cpp @@ -150,7 +150,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L pdisplayNameCacheEntry cacheEntry = GetContactFullCacheEntry((HANDLE)wParam);
WORD status;
- int NeedResort = 0;
+ int needsResort = 0;
char *szProto = cacheEntry->szProto;
if (szProto == NULL)
@@ -164,13 +164,13 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L if (dat->selection>=0 && GetRowByIndex(dat,dat->selection,&selcontact,NULL) != -1)
hSelItem = pcli->pfnContactToHItem(selcontact);
AddContactToTree(hwnd,dat,(HANDLE)wParam,0,0);
- NeedResort = 1;
+ needsResort = 1;
recalcScrollBar = 1;
FindItem(hwnd,dat,(HANDLE)wParam,&contact,NULL,NULL);
if (contact) {
contact->iImage = (WORD)lParam;
pcli->pfnNotifyNewContact(hwnd,(HANDLE)wParam);
- dat->NeedResort = 1;
+ dat->needsResort = 1;
}
}
}
@@ -178,14 +178,14 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L //item in list already
DWORD style = GetWindowLongPtr(hwnd,GWL_STYLE);
if (contact->iImage == (WORD)lParam) break;
- if (sortByStatus) dat->NeedResort = 1;
+ if (sortByStatus) dat->needsResort = 1;
if (!shouldShow && !(style&CLS_NOHIDEOFFLINE) && (style&CLS_HIDEOFFLINE || group->hideOffline)) {
if (dat->selection>=0 && GetRowByIndex(dat,dat->selection,&selcontact,NULL) != -1)
hSelItem = pcli->pfnContactToHItem(selcontact);
RemoveItemFromGroup(hwnd,group,contact,0);
recalcScrollBar = 1;
- dat->NeedResort = 1;
+ dat->needsResort = 1;
}
else {
int oldflags;
@@ -194,7 +194,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L if (!pcli->pfnIsHiddenMode(dat,status)||cacheEntry->noHiddenOffline) contact->flags |= CONTACTF_ONLINE;
else contact->flags &= ~CONTACTF_ONLINE;
if (oldflags != contact->flags)
- dat->NeedResort = 1;
+ dat->needsResort = 1;
} }
if (hSelItem) {
struct ClcGroup *selgroup;
@@ -228,7 +228,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L DBFreeVariant(&dbv);
if (_tcslen(contact->szStatusMsg)>0) {
contact->flags |= CONTACTF_STATUSMSG;
- dat->NeedResort = TRUE;
+ dat->needsResort = TRUE;
}
}
}
@@ -253,7 +253,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L DBWriteContactSettingByte(hitcontact->hContact,"CList","Expanded",hitcontact->SubExpanded);
}
hitcontact = NULL;
- dat->NeedResort = 1;
+ dat->needsResort = 1;
SortCLC(hwnd,dat,1);
RecalcScrollBar(hwnd,dat);
break;
diff --git a/plugins/Clist_mw/clc.h b/plugins/Clist_mw/clc.h index 6bb37c2beb..29b7086d20 100644 --- a/plugins/Clist_mw/clc.h +++ b/plugins/Clist_mw/clc.h @@ -61,70 +61,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define MAXSTATUSMSGLEN 256
-struct ClcContact {
- BYTE type;
- BYTE flags;
- union {
- struct {
- WORD iImage;
- HANDLE hContact;
- };
- struct {
- WORD groupId;
- struct ClcGroup *group;
- };
- };
- BYTE iExtraImage[MAXEXTRACOLUMNS];
- TCHAR szText[120-MAXEXTRACOLUMNS];
- char * proto; // MS_PROTO_GETBASEPROTO
-
- struct ClcContact *subcontacts;
+struct ClcContact : public ClcContactBase
+{
+ ClcContact *subcontacts;
BYTE SubAllocated;
BYTE SubExpanded;
BYTE isSubcontact;
TCHAR szStatusMsg[MAXSTATUSMSGLEN];
};
-struct ClcData {
- struct ClcGroup list;
- int rowHeight;
- int yScroll;
- int selection;
- struct ClcFontInfo fontInfo[FONTID_MAX+1];
- int scrollTime;
- HIMAGELIST himlHighlight;
- int groupIndent;
- TCHAR szQuickSearch[128];
- int iconXSpace;
- HWND hwndRenameEdit;
- COLORREF bkColour,selBkColour,selTextColour,hotTextColour,quickSearchColour;
- int iDragItem,iInsertionMark;
- int dragStage;
- POINT ptDragStart;
- int dragAutoScrolling;
- int dragAutoScrollHeight;
- int leftMargin;
- int insertionMarkHitHeight;
- HBITMAP hBmpBackground;
- int backgroundBmpUse,bkChanged;
- int iHotTrack;
- int gammaCorrection;
- DWORD greyoutFlags; //see m_clc.h
- DWORD offlineModes;
- DWORD exStyle;
- POINT ptInfoTip;
- int infoTipTimeout;
- HANDLE hInfoTipItem;
- HIMAGELIST himlExtraColumns;
- int extraColumnsCount;
- int extraColumnSpacing;
- int checkboxSize;
- int showSelAlways;
- int showIdle;
- int noVScrollbar;
- int useWindowsColours;
- int NeedResort;
-
+struct ClcData : public ClcDataBase
+{
DWORD style;
SortedList lCLCContactsCache;
BYTE doubleClickExpand;
diff --git a/plugins/Clist_mw/clcitems.cpp b/plugins/Clist_mw/clcitems.cpp index d1d5561b90..788cc8f3fd 100644 --- a/plugins/Clist_mw/clcitems.cpp +++ b/plugins/Clist_mw/clcitems.cpp @@ -92,7 +92,7 @@ struct ClcGroup *AddGroup(HWND hwnd,struct ClcData *dat,const TCHAR *szName,DWOR struct ClcGroup* result;
ClearRowByIndexCache();
- dat->NeedResort = 1;
+ dat->needsResort = 1;
result = saveAddGroup( hwnd, dat, szName, flags, groupId, calcTotalMembers);
ClearRowByIndexCache();
return result;
@@ -128,7 +128,7 @@ static struct ClcContact * AddContactToGroup(struct ClcData *dat,struct ClcGroup hContact = cacheEntry->hContact;
- dat->NeedResort = 1;
+ dat->needsResort = 1;
for (i = group->cl.count-1;i>=0;i--)
if (group->cl.items[i]->type != CLCIT_INFO || !(group->cl.items[i]->flags&CLCIIF_BELOWCONTACTS)) break;
i = AddItemToGroup(group,i+1);
@@ -198,7 +198,7 @@ void AddContactToTree(HWND hwnd,struct ClcData *dat,HANDLE hContact,int updateTo char *szProto = cacheEntry->szProto;
- dat->NeedResort = 1;
+ dat->needsResort = 1;
ClearRowByIndexCache();
ClearClcContactCache(dat,hContact);
@@ -286,7 +286,7 @@ void DeleteItemFromTree(HWND hwnd,HANDLE hItem) struct ClcData *dat = (struct ClcData*)GetWindowLongPtr(hwnd,0);
ClearRowByIndexCache();
- dat->NeedResort = 1;
+ dat->needsResort = 1;
if (!FindItem(hwnd,dat,hItem,&contact,&group,NULL)) {
DBVARIANT dbv;
@@ -338,7 +338,7 @@ void RebuildEntireList(HWND hwnd,struct ClcData *dat) dat->list.hideOffline = DBGetContactSettingByte(NULL,"CLC","HideOfflineRoot",0);
memset( &dat->list.cl, 0, sizeof( dat->list.cl ));
dat->list.cl.increment = 30;
- dat->NeedResort = 1;
+ dat->needsResort = 1;
dat->selection = -1;
{
int i;
@@ -503,7 +503,7 @@ void SortCLC(HWND hwnd,struct ClcData *dat,int useInsertionSort) #ifdef _DEBUG
DWORD tick = GetTickCount();
#endif
- int oldSort = dat->NeedResort;
+ int oldSort = dat->needsResort;
saveSortCLC(hwnd, dat, useInsertionSort);
if ( oldSort )
ClearRowByIndexCache();
diff --git a/plugins/Clist_mw/commonheaders.h b/plugins/Clist_mw/commonheaders.h index 8052fbbcfb..bee4da96c1 100644 --- a/plugins/Clist_mw/commonheaders.h +++ b/plugins/Clist_mw/commonheaders.h @@ -51,7 +51,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <m_button.h>
#include <m_options.h>
#include <m_protosvc.h>
-#include <m_clc.h>
#include <m_clist.h>
#include <m_clistint.h>
#include <m_skin.h>
@@ -59,6 +58,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <m_plugins.h>
#include "m_genmenu.h"
#include "m_clui.h"
+
#include "clc.h"
#include "clist.h"
#include "m_icolib.h"
diff --git a/plugins/Clist_nicer/INCLUDE/clc.h b/plugins/Clist_nicer/INCLUDE/clc.h index eedb76fc43..879fc52553 100644 --- a/plugins/Clist_nicer/INCLUDE/clc.h +++ b/plugins/Clist_nicer/INCLUDE/clc.h @@ -127,7 +127,8 @@ typedef struct _OrderTreeData BOOL fReserved;
} *PORDERTREEDATA, ORDERTREEDATA;
-struct DisplayProfile {
+struct DisplayProfile
+{
DWORD dwFlags;
DWORD dwExtraImageMask;
int exIconScale;
@@ -159,7 +160,8 @@ typedef struct DisplayProfileSet DISPLAYPROFILESET; #define DSP_PROFILES_MODULE "CLN_DspProfiles" // db module for display profiles
-struct TExtraCache {
+struct TExtraCache
+{
BYTE iExtraImage[MAXEXTRACOLUMNS];
HANDLE hContact;
HANDLE hTimeZone;
@@ -177,29 +179,12 @@ struct TExtraCache { BOOL isChatRoom;
};
-struct ClcContact {
- BYTE type;
- BYTE flags;
- union {
- struct {
- WORD iImage;
- HANDLE hContact;
- };
- struct {
- WORD groupId;
- struct ClcGroup *group;
- };
- };
- BYTE iExtraImage[MAXEXTRACOLUMNS];
- TCHAR szText[120 - MAXEXTRACOLUMNS];
- char * proto; // MS_PROTO_GETBASEPROTO
-
- // inherited from standard
+struct ClcContact : public ClcContactBase
+{
BOOL bIsMeta;
HANDLE hSubContact;
BYTE xStatus;
char *metaProto;
- //int clientId;
DWORD codePage;
struct avatarCacheEntry *ace;
WORD wStatus;
@@ -208,7 +193,6 @@ struct ClcContact { int isRtl;
DWORD cFlags;
BYTE bSecondLine;
- //int iRowHeight; // index into the row height table (for caching)
};
#define DRAGSTAGE_NOTMOVED 0
@@ -231,46 +215,8 @@ struct ClcContact { #define FONTID_TIMESTAMP 11
#define FONTID_LAST FONTID_TIMESTAMP
-struct ClcData {
- struct ClcGroup list;
- int max_row_height;
- int yScroll;
- int selection;
- struct ClcFontInfo fontInfo[FONTID_MAX + 1];
- int scrollTime;
- HIMAGELIST himlHighlight;
- int groupIndent;
- TCHAR szQuickSearch[128];
- int iconXSpace;
- HWND hwndRenameEdit;
- COLORREF bkColour, selBkColour, selTextColour, hotTextColour, quickSearchColour;
- int iDragItem, iInsertionMark;
- int dragStage;
- POINT ptDragStart;
- int dragAutoScrolling;
- int dragAutoScrollHeight;
- int leftMargin;
- int insertionMarkHitHeight;
- HBITMAP hBmpBackground;
- int backgroundBmpUse, bkChanged;
- int iHotTrack;
- int gammaCorrection;
- DWORD greyoutFlags; //see m_clc.h
- DWORD offlineModes;
- DWORD exStyle;
- POINT ptInfoTip;
- int infoTipTimeout;
- HANDLE hInfoTipItem;
- HIMAGELIST himlExtraColumns;
- int extraColumnsCount;
- int extraColumnSpacing;
- int checkboxSize;
- int showSelAlways;
- int showIdle;
- int noVScrollbar;
- int useWindowsColours;
- BOOL bNeedSort;
-
+struct ClcData : public ClcDataBase
+{
int *row_heights;
int row_heights_size;
int row_heights_allocated;
diff --git a/plugins/Clist_nicer/INCLUDE/commonheaders.h b/plugins/Clist_nicer/INCLUDE/commonheaders.h index 6a2e363544..91de256f0a 100644 --- a/plugins/Clist_nicer/INCLUDE/commonheaders.h +++ b/plugins/Clist_nicer/INCLUDE/commonheaders.h @@ -62,7 +62,6 @@ #include <win2k.h>
#include <m_clist.h>
#include <m_clistint.h>
-#include <m_clc.h>
#include <m_clui.h>
#include <m_plugins.h>
#include <m_system.h>
diff --git a/plugins/Clist_nicer/SRC/clc.cpp b/plugins/Clist_nicer/SRC/clc.cpp index b63a77a7bb..98348ca0e0 100644 --- a/plugins/Clist_nicer/SRC/clc.cpp +++ b/plugins/Clist_nicer/SRC/clc.cpp @@ -288,7 +288,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L dat->himlExtraColumns = himlExtraImages;
dat->hwndParent = GetParent(hwnd);
dat->lastSort = GetTickCount();
- dat->bNeedSort = FALSE;
+ dat->needsResort = FALSE;
{
CREATESTRUCT *cs = (CREATESTRUCT *)lParam;
if (cs->lpCreateParams == (LPVOID)0xff00ff00) {
@@ -344,7 +344,7 @@ LBL_Def: nm.hItem = (HANDLE) wParam;
SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM) &nm);
}
- dat->bNeedSort = TRUE;
+ dat->needsResort = TRUE;
PostMessage(hwnd, INTM_SORTCLC, 0, 1);
goto LBL_Def;
}
@@ -404,7 +404,7 @@ LBL_Def: else
dat->selection = -1;
}
- dat->bNeedSort = TRUE;
+ dat->needsResort = TRUE;
PostMessage(hwnd, INTM_SORTCLC, 0, recalcScrollBar);
PostMessage(hwnd, INTM_INVALIDATE, 0, (LPARAM)(contactRemoved ? 0 : wParam));
if (recalcScrollBar)
@@ -448,7 +448,7 @@ LBL_Def: RTL_DetectAndSet(contact, 0);
- dat->bNeedSort = TRUE;
+ dat->needsResort = TRUE;
PostMessage(hwnd, INTM_SORTCLC, 0, 0);
goto LBL_Def;
}
@@ -536,7 +536,7 @@ LBL_Def: RTL_DetectAndSet(contact, 0);
- dat->bNeedSort = TRUE;
+ dat->needsResort = TRUE;
PostMessage(hwnd, INTM_SORTCLC, 0, 0);
goto LBL_Def;
}
@@ -574,12 +574,12 @@ LBL_Def: goto LBL_Def;
}
case INTM_FORCESORT:
- dat->bNeedSort = TRUE;
+ dat->needsResort = TRUE;
return SendMessage(hwnd, INTM_SORTCLC, wParam, lParam);
case INTM_SORTCLC:
- if (dat->bNeedSort) {
+ if (dat->needsResort) {
pcli->pfnSortCLC(hwnd, dat, TRUE);
- dat->bNeedSort = FALSE;
+ dat->needsResort = FALSE;
}
if (lParam)
pcli->pfnRecalcScrollBar(hwnd, dat);
diff --git a/plugins/Clist_nicer/SRC/cluiopts.cpp b/plugins/Clist_nicer/SRC/cluiopts.cpp index 843925d5dd..f836995f68 100644 --- a/plugins/Clist_nicer/SRC/cluiopts.cpp +++ b/plugins/Clist_nicer/SRC/cluiopts.cpp @@ -41,7 +41,7 @@ INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l switch (msg) {
case WM_INITDIALOG:
{
- opt_clui_changed = 0;
+ opt_clui_changed = 0;
TranslateDialogDefault(hwndDlg);
CheckDlgButton(hwndDlg, IDC_BRINGTOFRONT, cfg::getByte("CList", "BringToFront", SETTING_BRINGTOFRONT_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_ALWAYSHIDEONTASKBAR, cfg::getByte("CList", "AlwaysHideOnTB", 1) ? BST_CHECKED : BST_UNCHECKED);
@@ -164,9 +164,9 @@ INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l SetDlgItemTextA(hwndDlg, IDC_ACTIVEPERC, str);
}
if (wParam != 0x12345678) {
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- opt_clui_changed = 1;
- }
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ opt_clui_changed = 1;
+ }
break;
case WM_NOTIFY:
switch (((LPNMHDR) lParam)->code) {
diff --git a/plugins/Clist_nicer/SRC/extBackg.cpp b/plugins/Clist_nicer/SRC/extBackg.cpp index 9cc8f0fd44..972ba79b1f 100644 --- a/plugins/Clist_nicer/SRC/extBackg.cpp +++ b/plugins/Clist_nicer/SRC/extBackg.cpp @@ -1843,7 +1843,7 @@ int CoolSB_SetupScrollBar() !StatusItems[ID_EXTBKSCROLLBUTTONHOVER - ID_STATUS_OFFLINE].imageItem ||
!StatusItems[ID_EXTBKSCROLLBUTTONPRESSED - ID_STATUS_OFFLINE].imageItem)
- cfg::dat.bSkinnedScrollbar = FALSE;
+ cfg::dat.bSkinnedScrollbar = FALSE;
if(cfg::getByte("CLC", "NoVScrollBar", 0)) {
UninitializeCoolSB(pcli->hwndContactTree);
diff --git a/plugins/Clist_nicer/SRC/rowheight_funcs.cpp b/plugins/Clist_nicer/SRC/rowheight_funcs.cpp index 8328d3f7bb..25a7b6b68d 100644 --- a/plugins/Clist_nicer/SRC/rowheight_funcs.cpp +++ b/plugins/Clist_nicer/SRC/rowheight_funcs.cpp @@ -35,7 +35,7 @@ BOOL RowHeight::Init(ClcData *dat)
{
- dat->max_row_height = 0;
+ dat->rowHeight = 0;
dat->row_heights_size = 0;
dat->row_heights_allocated = 0;
dat->row_heights = NULL;
@@ -133,7 +133,7 @@ int RowHeight::getMaxRowHeight(ClcData *dat, const HWND hwnd) max_height = max(max_height, dat->min_row_heigh);
max_height += cfg::dat.bRowSpacing;
- dat->max_row_height = max_height;
+ dat->rowHeight = max_height;
return max_height;
}
diff --git a/src/modules/clist/clc.cpp b/src/modules/clist/clc.cpp index 56a8b66c35..f7d9ba1411 100644 --- a/src/modules/clist/clc.cpp +++ b/src/modules/clist/clc.cpp @@ -738,7 +738,16 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, case VK_END: dat->selection = cli.pfnGetGroupContentsCount(&dat->list, 1) - 1; selMoved = 1; break;
case VK_LEFT: changeGroupExpand = 1; break;
case VK_RIGHT: changeGroupExpand = 2; break;
- case VK_RETURN: cli.pfnDoSelectionDefaultAction(hwnd, dat); return 0;
+ case VK_RETURN: cli.pfnDoSelectionDefaultAction(hwnd, dat);
+ // TODO: clear filtering here somehow?
+ /*if (dat->filterSearch) {
+ dat->szQuickSearch[0] = 0;
+ cli.pfnSaveStateAndRebuildList(hwnd, dat);
+ //cli.pfnRebuildEntireList(hwnd, dat);
+ } else {
+ dat->szQuickSearch[0] = 0;
+ }*/
+ return 0;
case VK_F2: cli.pfnBeginRenameSelection(hwnd, dat); return 0;
case VK_DELETE: cli.pfnDeleteFromContactList(hwnd, dat); return 0;
default:
@@ -757,7 +766,11 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, int hit;
struct ClcContact *contact;
struct ClcGroup *group;
- dat->szQuickSearch[0] = 0;
+ if (dat->filterSearch) {
+ // this shouldn't clear filtering, but it should refresh highlighting somehow?
+ } else {
+ dat->szQuickSearch[0] = 0;
+ }
hit = cli.pfnGetRowByIndex(dat, dat->selection, &contact, &group);
if (hit != -1) {
if (changeGroupExpand == 1 && contact->type == CLCIT_CONTACT) {
@@ -776,7 +789,11 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, return 0;
}
if (selMoved) {
- dat->szQuickSearch[0] = 0;
+ if (dat->filterSearch) {
+ // this shouldn't clear filtering, but it should refresh highlighting somehow?
+ } else {
+ dat->szQuickSearch[0] = 0;
+ }
if (dat->selection >= cli.pfnGetGroupContentsCount(&dat->list, 1))
dat->selection = cli.pfnGetGroupContentsCount(&dat->list, 1) - 1;
if (dat->selection < 0)
@@ -827,6 +844,11 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, }
_tcscat(dat->szQuickSearch, szNew);
}
+
+ if (dat->filterSearch) {
+ cli.pfnSaveStateAndRebuildList(hwnd, dat);
+ //cli.pfnRebuildEntireList(hwnd, dat);
+ }
if (dat->szQuickSearch[0]) {
int index;
index = cli.pfnFindRowByText(hwnd, dat, dat->szQuickSearch, 1);
@@ -835,6 +857,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, else {
MessageBeep(MB_OK);
dat->szQuickSearch[ lstrlen(dat->szQuickSearch) - 1] = '\0';
+ cli.pfnSaveStateAndRebuildList(hwnd, dat);
}
cli.pfnInvalidateRect(hwnd, NULL, FALSE);
cli.pfnEnsureVisible(hwnd, dat, dat->selection, 0);
@@ -928,7 +951,11 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, cli.pfnEndRename(hwnd, dat, 1);
dat->ptDragStart.x = (short) LOWORD(lParam);
dat->ptDragStart.y = (short) HIWORD(lParam);
- dat->szQuickSearch[0] = 0;
+ if (dat->filterSearch) {
+ // this shouldn't clear filtering, but it should refresh highlighting somehow?
+ } else {
+ dat->szQuickSearch[0] = 0;
+ }
hit = cli.pfnHitTest(hwnd, dat, (short) LOWORD(lParam), (short) HIWORD(lParam), &contact, &group, &hitFlags);
if (hit != -1) {
if (hit == dat->selection && hitFlags & CLCHT_ONITEMLABEL && dat->exStyle & CLS_EX_EDITLABELS) {
@@ -1210,7 +1237,11 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, cli.pfnHideInfoTip(hwnd, dat);
KillTimer(hwnd, TIMERID_RENAME);
KillTimer(hwnd, TIMERID_INFOTIP);
- dat->szQuickSearch[0] = 0;
+ if (dat->filterSearch) {
+ // this should remove filtering (same as pressing ENTER)?
+ } else {
+ dat->szQuickSearch[0] = 0;
+ }
dat->selection = cli.pfnHitTest(hwnd, dat, (short) LOWORD(lParam), (short) HIWORD(lParam), &contact, NULL, &hitFlags);
cli.pfnInvalidateRect(hwnd, NULL, FALSE);
if (dat->selection != -1)
@@ -1235,7 +1266,11 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, if (GetFocus() != hwnd)
SetFocus(hwnd);
dat->iHotTrack = -1;
- dat->szQuickSearch[0] = 0;
+ if (dat->filterSearch) {
+ // this shouldn't remove filtering
+ } else {
+ dat->szQuickSearch[0] = 0;
+ }
pt.x = (short) LOWORD(lParam);
pt.y = (short) HIWORD(lParam);
if (pt.x == -1 && pt.y == -1) {
diff --git a/src/modules/clist/clc.h b/src/modules/clist/clc.h index 3662cea1c6..bbcdf85528 100644 --- a/src/modules/clist/clc.h +++ b/src/modules/clist/clc.h @@ -21,63 +21,12 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-struct ClcContact {
- BYTE type;
- BYTE flags;
- union {
- struct {
- WORD iImage;
- HANDLE hContact;
- };
- struct {
- WORD groupId;
- struct ClcGroup *group;
- };
- };
- BYTE iExtraImage[MAXEXTRACOLUMNS];
- TCHAR szText[120-MAXEXTRACOLUMNS];
- char * proto; // MS_PROTO_GETBASEPROTO
+struct ClcContact : public ClcContactBase
+{
};
-struct ClcData {
- struct ClcGroup list;
- int rowHeight;
- int yScroll;
- int selection;
- struct ClcFontInfo fontInfo[FONTID_MAX + 1];
- int scrollTime;
- HIMAGELIST himlHighlight;
- int groupIndent;
- TCHAR szQuickSearch[128];
- int iconXSpace;
- HWND hwndRenameEdit;
- COLORREF bkColour, selBkColour, selTextColour, hotTextColour, quickSearchColour;
- int iDragItem, iInsertionMark;
- int dragStage;
- POINT ptDragStart;
- int dragAutoScrolling;
- int dragAutoScrollHeight;
- int leftMargin;
- int insertionMarkHitHeight;
- HBITMAP hBmpBackground;
- int backgroundBmpUse, bkChanged;
- int iHotTrack;
- int gammaCorrection;
- DWORD greyoutFlags; //see m_clc.h
- DWORD offlineModes;
- DWORD exStyle;
- POINT ptInfoTip;
- int infoTipTimeout;
- HANDLE hInfoTipItem;
- HIMAGELIST himlExtraColumns;
- int extraColumnsCount;
- int extraColumnSpacing;
- int checkboxSize;
- int showSelAlways;
- int showIdle;
- int noVScrollbar;
- int useWindowsColours;
- int needsResort;
+struct ClcData : public ClcDataBase
+{
};
/* clc.c */
diff --git a/src/modules/clist/clcitems.cpp b/src/modules/clist/clcitems.cpp index 7c0feb52ba..f52d0bc234 100644 --- a/src/modules/clist/clcitems.cpp +++ b/src/modules/clist/clcitems.cpp @@ -394,7 +394,17 @@ void fnRebuildEntireList(HWND hwnd, struct ClcData *dat) if (group != NULL) {
group->totalMembers++;
- if ( !(style & CLS_NOHIDEOFFLINE) && (style & CLS_HIDEOFFLINE || group->hideOffline)) {
+ /*if (dat->filterSearch && dat->szQuickSearch) {
+ // search filtering
+
+ // how to get contact's visible name? this code is crashing :)
+ ClcCacheEntryBase* cache = cli.pfnGetCacheEntry(hContact);
+ if (cache) {
+ //if (!_tcsstr(CharLowerW(pdnce->tszName), CharLowerW(dat->szQuickSearch)))
+ if (_tcsnicmp(dat->szQuickSearch, cache->tszName, lstrlen(dat->szQuickSearch)))
+ cli.pfnAddContactToGroup(dat, group, hContact);
+ }
+ } else*/ if ( !(style & CLS_NOHIDEOFFLINE) && (style & CLS_HIDEOFFLINE || group->hideOffline)) {
szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
if (szProto == NULL) {
if ( !cli.pfnIsHiddenMode(dat, ID_STATUS_OFFLINE))
diff --git a/src/modules/clist/clcutils.cpp b/src/modules/clist/clcutils.cpp index 8617d82f9a..6c1b1e94e7 100644 --- a/src/modules/clist/clcutils.cpp +++ b/src/modules/clist/clcutils.cpp @@ -749,6 +749,7 @@ void fnLoadClcOptions(HWND hwnd, struct ClcData *dat) dat->gammaCorrection = DBGetContactSettingByte(NULL, "CLC", "GammaCorrect", CLCDEFAULT_GAMMACORRECT);
dat->showIdle = DBGetContactSettingByte(NULL, "CLC", "ShowIdle", CLCDEFAULT_SHOWIDLE);
dat->noVScrollbar = DBGetContactSettingByte(NULL, "CLC", "NoVScrollBar", 0);
+ dat->filterSearch = DBGetContactSettingByte(NULL, "CLC", "FilterSearch", 1);
SendMessage(hwnd, INTM_SCROLLBARCHANGED, 0, 0);
if ( !dat->bkChanged) {
DBVARIANT dbv;
|