From c730f12da81f636ecf65aa656a46b9337daaa37a Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Sun, 14 Dec 2014 21:30:16 +0000 Subject: Clist_modern: changed warning lavel to w4 git-svn-id: http://svn.miranda-ng.org/main/trunk@11425 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_modern/src/modern_clcmsgs.cpp | 233 ++++++++++++++-------------- 1 file changed, 115 insertions(+), 118 deletions(-) (limited to 'plugins/Clist_modern/src/modern_clcmsgs.cpp') diff --git a/plugins/Clist_modern/src/modern_clcmsgs.cpp b/plugins/Clist_modern/src/modern_clcmsgs.cpp index 5ea6fac23b..3c37af72c4 100644 --- a/plugins/Clist_modern/src/modern_clcmsgs.cpp +++ b/plugins/Clist_modern/src/modern_clcmsgs.cpp @@ -28,12 +28,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. //processing of all the CLM_ messages incoming -LRESULT cli_ProcessExternalMessages(HWND hwnd,ClcData *dat,UINT msg,WPARAM wParam, LPARAM lParam) +LRESULT cli_ProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wParam, LPARAM lParam) { - ClcContact *contact; - ClcGroup *group; + ClcContact *contact = NULL; + ClcGroup *group = NULL; - switch(msg) { + switch (msg) { case CLM_DELETEITEM: pcli->pfnDeleteItemFromTree(hwnd, wParam); clcSetDelayTimer(TIMERID_DELAYEDRESORTCLC, hwnd, 1); //pcli->pfnSortCLC(hwnd, dat, 1); @@ -50,7 +50,7 @@ LRESULT cli_ProcessExternalMessages(HWND hwnd,ClcData *dat,UINT msg,WPARAM wPara return 0; case CLM_SETFONT: - if (HIWORD(lParam)>FONTID_MODERN_MAX) return 0; + if (HIWORD(lParam) > FONTID_MODERN_MAX) return 0; dat->fontModernInfo[HIWORD(lParam)].hFont = (HFONT)wParam; dat->fontModernInfo[HIWORD(lParam)].changed = 1; @@ -58,21 +58,21 @@ LRESULT cli_ProcessExternalMessages(HWND hwnd,ClcData *dat,UINT msg,WPARAM wPara RowHeights_GetMaxRowHeight(dat, hwnd); if (LOWORD(lParam)) - CLUI__cliInvalidateRect(hwnd,NULL,FALSE); + CLUI__cliInvalidateRect(hwnd, NULL, FALSE); return 0; case CLM_SETHIDEEMPTYGROUPS: - { - BOOL old = ((GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_HIDEEMPTYGROUPS) != 0); - if (wParam) - SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) | CLS_HIDEEMPTYGROUPS); - else - SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) &~ CLS_HIDEEMPTYGROUPS); - BOOL newval = ((GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_HIDEEMPTYGROUPS) != 0); - if (newval != old) - pcli->pfnInitAutoRebuild(hwnd); - } - return 0; + { + BOOL old = ((GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_HIDEEMPTYGROUPS) != 0); + if (wParam) + SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) | CLS_HIDEEMPTYGROUPS); + else + SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) &~CLS_HIDEEMPTYGROUPS); + BOOL newval = ((GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_HIDEEMPTYGROUPS) != 0); + if (newval != old) + pcli->pfnInitAutoRebuild(hwnd); + } + return 0; case CLM_SETTEXTCOLOR: if (wParam > FONTID_MODERN_MAX) break; @@ -81,7 +81,7 @@ LRESULT cli_ProcessExternalMessages(HWND hwnd,ClcData *dat,UINT msg,WPARAM wPara dat->force_in_dialog = TRUE; // Issue 40: option knows nothing about moderns colors // others who know have to set colors from lowest to highest - switch ( wParam ) { + switch (wParam) { case FONTID_CONTACTS: dat->fontModernInfo[FONTID_SECONDLINE].colour = lParam; dat->fontModernInfo[FONTID_THIRDLINE].colour = lParam; @@ -105,113 +105,110 @@ LRESULT cli_ProcessExternalMessages(HWND hwnd,ClcData *dat,UINT msg,WPARAM wPara return 0; case CLM_GETNEXTITEM: - { - int i; - if (wParam != CLGN_ROOT) { - if (!pcli->pfnFindItem(hwnd, dat, lParam, &contact, &group, NULL)) - return NULL; - i = List_IndexOf((SortedList*)&group->cl,contact); - if (i < 0) return 0; - } - switch (wParam) { - case CLGN_ROOT: - if (dat->list.cl.count) - return (LRESULT)pcli->pfnContactToHItem(dat->list.cl.items[0]); - else - return NULL; - case CLGN_CHILD: - if (contact->type != CLCIT_GROUP) - return NULL; - group = contact->group; - if (group->cl.count == 0) - return NULL; - return (LRESULT)pcli->pfnContactToHItem(group->cl.items[0]); - case CLGN_PARENT: - return group->groupId | HCONTACT_ISGROUP; - case CLGN_NEXT: - do { - if (++i >= group->cl.count) - return NULL; - } - while (group->cl.items[i]->type == CLCIT_DIVIDER); - return (LRESULT)pcli->pfnContactToHItem(group->cl.items[i]); - case CLGN_PREVIOUS: - do { - if (--i < 0) - return NULL; - } - while (group->cl.items[i]->type == CLCIT_DIVIDER); - return (LRESULT)pcli->pfnContactToHItem(group->cl.items[i]); - case CLGN_NEXTCONTACT: - for (i++; i < group->cl.count; i++) - if (group->cl.items[i]->type == CLCIT_CONTACT) - break; - if (i >= group->cl.count) - return NULL; - return (LRESULT) pcli->pfnContactToHItem(group->cl.items[i]); - case CLGN_PREVIOUSCONTACT: - if (i >= group->cl.count) - return NULL; - for (i--; i >= 0; i--) - if (group->cl.items[i]->type == CLCIT_CONTACT) - break; - if (i < 0) - return NULL; - return (LRESULT)pcli->pfnContactToHItem(group->cl.items[i]); - case CLGN_NEXTGROUP: - for (i++; i < group->cl.count; i++) - if (group->cl.items[i]->type == CLCIT_GROUP) - break; - if (i >= group->cl.count) - return NULL; - return (LRESULT) pcli->pfnContactToHItem(group->cl.items[i]); - case CLGN_PREVIOUSGROUP: - if (i >= group->cl.count) + { + int i = 0; + if (wParam != CLGN_ROOT) { + if (!pcli->pfnFindItem(hwnd, dat, lParam, &contact, &group, NULL)) + return NULL; + i = List_IndexOf((SortedList*)&group->cl, contact); + if (i < 0) return 0; + } + switch (wParam) { + case CLGN_ROOT: + if (dat->list.cl.count) + return (LRESULT)pcli->pfnContactToHItem(dat->list.cl.items[0]); + else + return NULL; + case CLGN_CHILD: + if (contact->type != CLCIT_GROUP) + return NULL; + group = contact->group; + if (group->cl.count == 0) + return NULL; + return (LRESULT)pcli->pfnContactToHItem(group->cl.items[0]); + case CLGN_PARENT: + return group->groupId | HCONTACT_ISGROUP; + case CLGN_NEXT: + do { + if (++i >= group->cl.count) return NULL; - for (i--; i >= 0; i--) - if (group->cl.items[i]->type == CLCIT_GROUP) - break; - if (i < 0) + } while (group->cl.items[i]->type == CLCIT_DIVIDER); + return (LRESULT)pcli->pfnContactToHItem(group->cl.items[i]); + case CLGN_PREVIOUS: + do { + if (--i < 0) return NULL; - return (LRESULT) pcli->pfnContactToHItem(group->cl.items[i]); - } - return NULL; + } while (group->cl.items[i]->type == CLCIT_DIVIDER); + return (LRESULT)pcli->pfnContactToHItem(group->cl.items[i]); + case CLGN_NEXTCONTACT: + for (i++; i < group->cl.count; i++) + if (group->cl.items[i]->type == CLCIT_CONTACT) + break; + if (i >= group->cl.count) + return NULL; + return (LRESULT)pcli->pfnContactToHItem(group->cl.items[i]); + case CLGN_PREVIOUSCONTACT: + if (i >= group->cl.count) + return NULL; + for (i--; i >= 0; i--) + if (group->cl.items[i]->type == CLCIT_CONTACT) + break; + if (i < 0) + return NULL; + return (LRESULT)pcli->pfnContactToHItem(group->cl.items[i]); + case CLGN_NEXTGROUP: + for (i++; i < group->cl.count; i++) + if (group->cl.items[i]->type == CLCIT_GROUP) + break; + if (i >= group->cl.count) + return NULL; + return (LRESULT)pcli->pfnContactToHItem(group->cl.items[i]); + case CLGN_PREVIOUSGROUP: + if (i >= group->cl.count) + return NULL; + for (i--; i >= 0; i--) + if (group->cl.items[i]->type == CLCIT_GROUP) + break; + if (i < 0) + return NULL; + return (LRESULT)pcli->pfnContactToHItem(group->cl.items[i]); } - return 0; + return NULL; + } case CLM_SELECTITEM: - { - ClcGroup *tgroup; - int index = -1; - int mainindex = -1; - if (!pcli->pfnFindItem(hwnd, dat, wParam, &contact, &group, NULL)) - break; - for (tgroup = group; tgroup; tgroup = tgroup->parent) - pcli->pfnSetGroupExpand(hwnd, dat, tgroup, 1); - - if (!contact->isSubcontact) { - index = List_IndexOf((SortedList*)&group->cl,contact); - mainindex = index; - } - else { - index = List_IndexOf((SortedList*)&group->cl,contact->subcontacts); - mainindex = index; - index += contact->isSubcontact; - } + { + ClcGroup *tgroup; + int index = -1; + int mainindex = -1; + if (!pcli->pfnFindItem(hwnd, dat, wParam, &contact, &group, NULL)) + break; + for (tgroup = group; tgroup; tgroup = tgroup->parent) + pcli->pfnSetGroupExpand(hwnd, dat, tgroup, 1); - BYTE k = db_get_b(NULL,"CLC","MetaExpanding",SETTING_METAEXPANDING_DEFAULT); - if (k) { - for (int i=0; i < mainindex; i++) - { - ClcContact *tempCont = group->cl.items[i]; - if (tempCont->type == CLCIT_CONTACT && tempCont->SubAllocated && tempCont->SubExpanded) - index += tempCont->SubAllocated; - } - } + if (!contact->isSubcontact) { + index = List_IndexOf((SortedList*)&group->cl, contact); + mainindex = index; + } + else { + index = List_IndexOf((SortedList*)&group->cl, contact->subcontacts); + mainindex = index; + index += contact->isSubcontact; + } - dat->selection = pcli->pfnGetRowsPriorTo(&dat->list, group, index); - pcli->pfnEnsureVisible(hwnd, dat, dat->selection, 0); + BYTE k = db_get_b(NULL, "CLC", "MetaExpanding", SETTING_METAEXPANDING_DEFAULT); + if (k) { + for (int i = 0; i < mainindex; i++) + { + ClcContact *tempCont = group->cl.items[i]; + if (tempCont->type == CLCIT_CONTACT && tempCont->SubAllocated && tempCont->SubExpanded) + index += tempCont->SubAllocated; + } } - return 0; + + dat->selection = pcli->pfnGetRowsPriorTo(&dat->list, group, index); + pcli->pfnEnsureVisible(hwnd, dat, dat->selection, 0); + } + return 0; case CLM_SETEXTRAIMAGE: if (LOWORD(lParam) >= dat->extraColumnsCount) -- cgit v1.2.3