From e3ffab889d900847fa6fb9807bc5f818da28c358 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 14 Jul 2012 19:06:59 +0000 Subject: much less crazy way to organize clist data git-svn-id: http://svn.miranda-ng.org/main/trunk@973 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_mw/clc.cpp | 16 +++++----- plugins/Clist_mw/clc.h | 63 ++++------------------------------------ plugins/Clist_mw/clcitems.cpp | 12 ++++---- plugins/Clist_mw/commonheaders.h | 2 +- 4 files changed, 20 insertions(+), 73 deletions(-) (limited to 'plugins/Clist_mw') 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 #include #include -#include #include #include #include @@ -59,6 +58,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include "m_genmenu.h" #include "m_clui.h" + #include "clc.h" #include "clist.h" #include "m_icolib.h" -- cgit v1.2.3