diff options
author | George Hazan <george.hazan@gmail.com> | 2014-07-04 21:17:37 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-07-04 21:17:37 +0000 |
commit | e693f1d803f736478a30dd76c6748839796fca77 (patch) | |
tree | a98fa46db871e9edbf2f9ef4de566228daee299c | |
parent | f1bbd65bbaa4291c194244424668aa16c357ca0f (diff) |
standardizing the control over checkboxes in clist
git-svn-id: http://svn.miranda-ng.org/main/trunk@9682 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | include/m_clistint.h | 1 | ||||
-rw-r--r-- | plugins/Clist_modern/src/hdr/modern_commonprototypes.h | 33 | ||||
-rw-r--r-- | plugins/Clist_modern/src/init.cpp | 1 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_clc.cpp | 8 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_clcitems.cpp | 8 | ||||
-rw-r--r-- | src/modules/clist/clc.h | 1 | ||||
-rw-r--r-- | src/modules/clist/clcutils.cpp | 26 | ||||
-rw-r--r-- | src/modules/clist/clistcore.cpp | 1 |
8 files changed, 47 insertions, 32 deletions
diff --git a/include/m_clistint.h b/include/m_clistint.h index 3f754715bd..8b61830160 100644 --- a/include/m_clistint.h +++ b/include/m_clistint.h @@ -480,6 +480,7 @@ typedef struct int (*pfnTrayCalcChanged)(const char *szChangedProto, int averageMode, int iProtoCount);
int (*pfnGetAverageMode)(int *pNetProtoCount);
void (*pfnInitAutoRebuild)(HWND hwnd);
+ void (*pfnSetContactCheckboxes)(ClcContact *cc, int checked);
}
CLIST_INTERFACE;
diff --git a/plugins/Clist_modern/src/hdr/modern_commonprototypes.h b/plugins/Clist_modern/src/hdr/modern_commonprototypes.h index 3dca9f0ca8..aadbddc498 100644 --- a/plugins/Clist_modern/src/hdr/modern_commonprototypes.h +++ b/plugins/Clist_modern/src/hdr/modern_commonprototypes.h @@ -264,42 +264,43 @@ void ToolbarButtonUnloadModule(); // INTERFACES
void cliCheckCacheItem(ClcCacheEntry *pdnce);
-void cliFreeCacheItem( ClcCacheEntry *p );
-void cliRebuildEntireList(HWND hwnd,ClcData *dat);
-void cliRecalcScrollBar(HWND hwnd,ClcData *dat);
+void cliFreeCacheItem(ClcCacheEntry *p);
+void cliRebuildEntireList(HWND hwnd, ClcData *dat);
+void cliRecalcScrollBar(HWND hwnd, ClcData *dat);
void CLUI_cliOnCreateClc(void);
int cli_AddItemToGroup(ClcGroup *group, int iAboveItem);
-int cli_AddInfoItemToGroup(ClcGroup *group,int flags,const TCHAR *pszText);
+int cli_AddInfoItemToGroup(ClcGroup *group, int flags, const TCHAR *pszText);
int cliGetGroupContentsCount(ClcGroup *group, int visibleOnly);
int cliFindRowByText(HWND hwnd, ClcData *dat, const TCHAR *text, int prefixOk);
-int cliGetRowsPriorTo(ClcGroup *group,ClcGroup *subgroup,int contactIndex);
-int cli_IconFromStatusMode(const char *szProto,int nStatus, MCONTACT hContact);
+int cliGetRowsPriorTo(ClcGroup *group, ClcGroup *subgroup, int contactIndex);
+int cli_IconFromStatusMode(const char *szProto, int nStatus, MCONTACT hContact);
int cli_GetContactIcon(MCONTACT hContact);
int cli_RemoveEvent(MCONTACT hContact, HANDLE hDbEvent);
-void cli_AddContactToTree(HWND hwnd,ClcData *dat,MCONTACT hContact,int updateTotalCount,int checkHideOffline);
+void cli_AddContactToTree(HWND hwnd, ClcData *dat, MCONTACT hContact, int updateTotalCount, int checkHideOffline);
void cli_DeleteItemFromTree(HWND hwnd, MCONTACT hItem);
-void cli_FreeContact( ClcContact* );
-void cli_FreeGroup( ClcGroup* );
+void cli_FreeContact(ClcContact*);
+void cli_FreeGroup(ClcGroup*);
char* cli_GetGroupCountsText(ClcData *dat, ClcContact *contact);
-void cli_ChangeContactIcon(MCONTACT hContact,int iIcon,int add);
-LRESULT cli_ProcessExternalMessages(HWND hwnd,ClcData *dat,UINT msg,WPARAM wParam, LPARAM lParam);
-struct CListEvent* cliCreateEvent( void );
+void cli_ChangeContactIcon(MCONTACT hContact, int iIcon, int add);
+void cli_SetContactCheckboxes(ClcContact*, int);
+LRESULT cli_ProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wParam, LPARAM lParam);
+struct CListEvent* cliCreateEvent(void);
struct CListEvent* cli_AddEvent(CLISTEVENT *cle);
LRESULT CALLBACK cli_ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
int cliShowHide(WPARAM wParam, LPARAM lParam);
-BOOL CLUI__cliInvalidateRect(HWND hWnd, CONST RECT* lpRect,BOOL bErase );
-int cliCompareContacts(const ClcContact *contact1,const ClcContact *contact2);
+BOOL CLUI__cliInvalidateRect(HWND hWnd, CONST RECT* lpRect, BOOL bErase);
+int cliCompareContacts(const ClcContact *contact1, const ClcContact *contact2);
int cliFindItem(HWND hwnd, ClcData *dat, DWORD dwItem, ClcContact **contact, ClcGroup **subgroup, int *isVisible);
int cliTrayCalcChanged(const char *szChangedProto, int averageMode, int netProtoCount);
int cliTrayIconPauseAutoHide(WPARAM wParam, LPARAM lParam);
-void cliCluiProtocolStatusChanged(int status,const char * proto);
+void cliCluiProtocolStatusChanged(int status, const char * proto);
HMENU cliBuildGroupPopupMenu(ClcGroup *group);
void cliInvalidateDisplayNameCacheEntry(MCONTACT hContact);
void cliCheckCacheItem(ClcCacheEntry *pdnce);
void cli_SaveStateAndRebuildList(HWND hwnd, ClcData *dat);
void CLUI_cli_LoadCluiGlobalOpts(void);
INT_PTR cli_TrayIconProcessMessage(WPARAM wParam, LPARAM lParam);
-BOOL CLUI__cliInvalidateRect(HWND hWnd, CONST RECT* lpRect,BOOL bErase );
+BOOL CLUI__cliInvalidateRect(HWND hWnd, CONST RECT* lpRect, BOOL bErase);
ClcContact* cliCreateClcContact( void );
ClcCacheEntry* cliCreateCacheItem(MCONTACT hContact);
diff --git a/plugins/Clist_modern/src/init.cpp b/plugins/Clist_modern/src/init.cpp index 7736c45cf6..8387f6f17d 100644 --- a/plugins/Clist_modern/src/init.cpp +++ b/plugins/Clist_modern/src/init.cpp @@ -190,6 +190,7 @@ static HRESULT SubclassClistInterface() pcli->pfnFreeContact = cli_FreeContact;
pcli->pfnFreeGroup = cli_FreeGroup;
pcli->pfnChangeContactIcon = cli_ChangeContactIcon;
+ pcli->pfnSetContactCheckboxes = cli_SetContactCheckboxes;
pcli->pfnTrayIconProcessMessage = cli_TrayIconProcessMessage;
pcli->pfnSaveStateAndRebuildList = cli_SaveStateAndRebuildList;
pcli->pfnContactListControlWndProc = cli_ContactListControlWndProc;
diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp index 55ff08eb3c..27d53a83cf 100644 --- a/plugins/Clist_modern/src/modern_clc.cpp +++ b/plugins/Clist_modern/src/modern_clc.cpp @@ -903,12 +903,12 @@ static LRESULT clcOnLButtonDown(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam }
if (hit != -1 && !(hitFlags & CLCHT_NOWHERE) && (hitFlags & CLCHT_ONITEMCHECK)) {
- contact->flags ^= CONTACTF_CHECKED;
- for (int i = 0; i < contact->SubAllocated; i++)
- contact->subcontacts[i].flags ^= CONTACTF_CHECKED;
+ int bNewState = (contact->flags & CONTACTF_CHECKED) == 0; // inversion
if (contact->type == CLCIT_GROUP)
- pcli->pfnSetGroupChildCheckboxes(contact->group, contact->flags&CONTACTF_CHECKED);
+ pcli->pfnSetGroupChildCheckboxes(contact->group, bNewState);
+ else
+ pcli->pfnSetContactCheckboxes(contact, bNewState);
pcli->pfnRecalculateGroupCheckboxes(hwnd, dat);
CLUI__cliInvalidateRect(hwnd, NULL, FALSE);
diff --git a/plugins/Clist_modern/src/modern_clcitems.cpp b/plugins/Clist_modern/src/modern_clcitems.cpp index 02812c1d09..a4ed57af90 100644 --- a/plugins/Clist_modern/src/modern_clcitems.cpp +++ b/plugins/Clist_modern/src/modern_clcitems.cpp @@ -630,6 +630,14 @@ void cliInvalidateDisplayNameCacheEntry(MCONTACT hContact) }
}
+void cli_SetContactCheckboxes(ClcContact *cc, int checked)
+{
+ corecli.pfnSetContactCheckboxes(cc, checked);
+
+ for (int i = 0; i < cc->SubAllocated; i++)
+ corecli.pfnSetContactCheckboxes(&cc->subcontacts[i], checked);
+}
+
char* cli_GetGroupCountsText(ClcData *dat, ClcContact *contact)
{
return corecli.pfnGetGroupCountsText(dat, contact);
diff --git a/src/modules/clist/clc.h b/src/modules/clist/clc.h index 9bd95c3c9d..acb5279007 100644 --- a/src/modules/clist/clc.h +++ b/src/modules/clist/clc.h @@ -95,6 +95,7 @@ void fnGetFontSetting(int i, LOGFONT* lf, COLORREF* colour); void fnLoadClcOptions(HWND hwnd, struct ClcData *dat);
void fnRecalculateGroupCheckboxes(HWND hwnd, struct ClcData *dat);
void fnSetGroupChildCheckboxes(ClcGroup *group, int checked);
+void fnSetContactCheckboxes(ClcContact *cc, int checked);
void fnInvalidateItem(HWND hwnd, struct ClcData *dat, int iItem);
int fnGetRowBottomY(struct ClcData *dat, int item);
diff --git a/src/modules/clist/clcutils.cpp b/src/modules/clist/clcutils.cpp index 470936f9e4..92ed6de693 100644 --- a/src/modules/clist/clcutils.cpp +++ b/src/modules/clist/clcutils.cpp @@ -818,22 +818,24 @@ void fnRecalculateGroupCheckboxes(HWND, struct ClcData *dat) }
}
+void fnSetContactCheckboxes(ClcContact *cc, int checked)
+{
+ if (checked)
+ cc->flags |= CONTACTF_CHECKED;
+ else
+ cc->flags &= ~CONTACTF_CHECKED;
+}
+
void fnSetGroupChildCheckboxes(ClcGroup *group, int checked)
{
for (int i=0; i < group->cl.count; i++) {
- if (group->cl.items[i]->type == CLCIT_GROUP) {
- cli.pfnSetGroupChildCheckboxes(group->cl.items[i]->group, checked);
- if (checked)
- group->cl.items[i]->flags |= CONTACTF_CHECKED;
- else
- group->cl.items[i]->flags &= ~CONTACTF_CHECKED;
- }
- else if (group->cl.items[i]->type == CLCIT_CONTACT) {
- if (checked)
- group->cl.items[i]->flags |= CONTACTF_CHECKED;
- else
- group->cl.items[i]->flags &= ~CONTACTF_CHECKED;
+ ClcContact *cc = group->cl.items[i];
+ if (cc->type == CLCIT_GROUP) {
+ cli.pfnSetGroupChildCheckboxes(cc->group, checked);
+ cli.pfnSetContactCheckboxes(cc, checked);
}
+ else if (cc->type == CLCIT_CONTACT)
+ cli.pfnSetContactCheckboxes(cc, checked);
}
}
diff --git a/src/modules/clist/clistcore.cpp b/src/modules/clist/clistcore.cpp index 89f6770927..156f1149f7 100644 --- a/src/modules/clist/clistcore.cpp +++ b/src/modules/clist/clistcore.cpp @@ -127,6 +127,7 @@ static INT_PTR srvRetrieveInterface(WPARAM, LPARAM) cli.pfnLoadClcOptions = fnLoadClcOptions;
cli.pfnRecalculateGroupCheckboxes = fnRecalculateGroupCheckboxes;
cli.pfnSetGroupChildCheckboxes = fnSetGroupChildCheckboxes;
+ cli.pfnSetContactCheckboxes = fnSetContactCheckboxes;
cli.pfnInvalidateItem = fnInvalidateItem;
cli.pfnGetRowBottomY = fnGetRowBottomY;
cli.pfnGetRowHeight = fnGetRowHeight;
|