summaryrefslogtreecommitdiff
path: root/plugins/Clist_modern/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-07-14 19:06:59 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-07-14 19:06:59 +0000
commite3ffab889d900847fa6fb9807bc5f818da28c358 (patch)
tree5722d206bdaeaec951c1c293bb671cd7347ebad7 /plugins/Clist_modern/src
parente2e713063780dd623c8025b6f4762c1e32bc784d (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
Diffstat (limited to 'plugins/Clist_modern/src')
-rw-r--r--plugins/Clist_modern/src/hdr/modern_clc.h118
-rw-r--r--plugins/Clist_modern/src/hdr/modern_commonheaders.h1
-rw-r--r--plugins/Clist_modern/src/modern_clc.cpp34
-rw-r--r--plugins/Clist_modern/src/modern_clcitems.cpp17
-rw-r--r--plugins/Clist_modern/src/modern_clcutils.cpp5
-rw-r--r--plugins/Clist_modern/src/modern_rowheight_funcs.cpp8
6 files changed, 61 insertions, 122 deletions
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 ];
}