From e58823d961a630eb62e60d2ccb443761ba5f1704 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 14 Jun 2012 15:51:34 +0000 Subject: - all MS_CLIST_ADD*ITEM services replaced with Menu_Add*Item stubs. - massive cleanup of the menu-related code git-svn-id: http://svn.miranda-ng.org/main/trunk@410 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/modules/clist/Docking.cpp | 6 +- src/modules/clist/clc.cpp | 46 +++++----- src/modules/clist/clc.h | 12 +-- src/modules/clist/clcfiledrop.cpp | 2 +- src/modules/clist/clcidents.cpp | 2 +- src/modules/clist/clcitems.cpp | 10 +-- src/modules/clist/clcmsgs.cpp | 12 +-- src/modules/clist/clcutils.cpp | 8 +- src/modules/clist/clistcore.cpp | 8 +- src/modules/clist/clistevents.cpp | 18 ++-- src/modules/clist/clistmenus.cpp | 172 ++++++++++++++++++------------------ src/modules/clist/clistmod.cpp | 6 +- src/modules/clist/clistsettings.cpp | 8 +- src/modules/clist/clisttray.cpp | 30 +++---- src/modules/clist/clui.cpp | 48 +++++----- src/modules/clist/cluiservices.cpp | 6 +- src/modules/clist/contact.cpp | 28 +++--- src/modules/clist/genmenu.cpp | 72 +++++++-------- src/modules/clist/genmenu.h | 16 ++-- src/modules/clist/genmenuopt.cpp | 166 +++++++++++++++++----------------- src/modules/clist/groups.cpp | 4 +- src/modules/clist/keyboard.cpp | 48 +++++----- src/modules/clist/movetogroup.cpp | 16 ++-- src/modules/clist/protocolorder.cpp | 10 +-- 24 files changed, 374 insertions(+), 380 deletions(-) (limited to 'src/modules/clist') diff --git a/src/modules/clist/Docking.cpp b/src/modules/clist/Docking.cpp index 4c32b7335e..95bffa718f 100644 --- a/src/modules/clist/Docking.cpp +++ b/src/modules/clist/Docking.cpp @@ -11,7 +11,7 @@ modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. -This program is distributed in the hope that it will be useful, +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -349,9 +349,9 @@ int fnDocking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) GetCursorPos(&pt); PostMessage(msg->hwnd, WM_NCLBUTTONDOWN, HTCAPTION, MAKELPARAM(pt.x, pt.y)); SetWindowPos(msg->hwnd, 0, pt.x - rc.right / 2, - pt.y - GetSystemMetrics(SM_CYFRAME) - GetSystemMetrics(SM_CYSMCAPTION) / 2, + pt.y - GetSystemMetrics(SM_CYFRAME) - GetSystemMetrics(SM_CYSMCAPTION) / 2, DBGetContactSettingDword(NULL, "CList", "Width", 0), - DBGetContactSettingDword(NULL, "CList", "Height", 0), + DBGetContactSettingDword(NULL, "CList", "Height", 0), SWP_NOZORDER); Docking_Command(msg->hwnd, ABM_REMOVE); } diff --git a/src/modules/clist/clc.cpp b/src/modules/clist/clc.cpp index f260a8c452..1a9e32617f 100644 --- a/src/modules/clist/clc.cpp +++ b/src/modules/clist/clc.cpp @@ -2,7 +2,7 @@ Miranda IM: the free IM client for Microsoft* Windows* -Copyright 2000-2009 Miranda ICQ/IM project, +Copyright 2000-2009 Miranda ICQ/IM project, all portions of this codebase are copyrighted to the people listed in contributors.txt. @@ -11,7 +11,7 @@ modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. -This program is distributed in the hope that it will be useful, +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -151,7 +151,7 @@ static int ClcProtoAck(WPARAM, LPARAM lParam) int i; if (ack->type == ACKTYPE_STATUS) { - WindowList_BroadcastAsync(hClcWindowList,INTM_INVALIDATE,0,0); + WindowList_BroadcastAsync(hClcWindowList, INTM_INVALIDATE, 0, 0); if (ack->result == ACKRESULT_SUCCESS) { for (i = 0; i < cli.hClcProtoCount; i++) { if (!lstrcmpA(cli.clcProto[i].szProto, ack->szModule)) { @@ -166,25 +166,25 @@ static int ClcProtoAck(WPARAM, LPARAM lParam) static int ClcContactAdded(WPARAM wParam, LPARAM lParam) { - WindowList_BroadcastAsync(hClcWindowList,INTM_CONTACTADDED,wParam,lParam); + WindowList_BroadcastAsync(hClcWindowList, INTM_CONTACTADDED, wParam, lParam); return 0; } static int ClcContactDeleted(WPARAM wParam, LPARAM lParam) { - WindowList_BroadcastAsync(hClcWindowList,INTM_CONTACTDELETED,wParam,lParam); + WindowList_BroadcastAsync(hClcWindowList, INTM_CONTACTDELETED, wParam, lParam); return 0; } static int ClcContactIconChanged(WPARAM wParam, LPARAM lParam) { - WindowList_BroadcastAsync(hClcWindowList,INTM_ICONCHANGED,wParam,lParam); + WindowList_BroadcastAsync(hClcWindowList, INTM_ICONCHANGED, wParam, lParam); return 0; } static int ClcIconsChanged(WPARAM, LPARAM) { - WindowList_BroadcastAsync(hClcWindowList,INTM_INVALIDATE,0,0); + WindowList_BroadcastAsync(hClcWindowList, INTM_INVALIDATE, 0, 0); return 0; } @@ -287,10 +287,10 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, dat->needsResort = 1; cli.pfnLoadClcOptions(hwnd, dat); if (!IsWindowVisible(hwnd)) - SetTimer(hwnd,TIMERID_REBUILDAFTER,10,NULL); + SetTimer(hwnd, TIMERID_REBUILDAFTER, 10, NULL); else { - cli.pfnRebuildEntireList(hwnd,dat); + cli.pfnRebuildEntireList(hwnd, dat); NMCLISTCONTROL nm; nm.hdr.code = CLN_LISTREBUILT; nm.hdr.hwndFrom = hwnd; @@ -321,7 +321,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, cli.pfnRecalcScrollBar(hwnd, dat); { // creating imagelist containing blue line for highlight HBITMAP hBmp, hBmpMask, hoBmp, hoMaskBmp; - HDC hdc,hdcMem; + HDC hdc, hdcMem; RECT rc; int depth; HBRUSH hBrush; @@ -509,7 +509,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM) & nm); dat->needsResort = 1; } - SetTimer(hwnd,TIMERID_REBUILDAFTER,1,NULL); + SetTimer(hwnd, TIMERID_REBUILDAFTER, 1, NULL); break; } case INTM_ICONCHANGED: @@ -579,7 +579,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, if (!cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL)) break; - lstrcpyn(contact->szText, cli.pfnGetContactDisplayName((HANDLE)wParam,0), SIZEOF(contact->szText)); + lstrcpyn(contact->szText, cli.pfnGetContactDisplayName((HANDLE)wParam, 0), SIZEOF(contact->szText)); dat->needsResort = 1; SortClcByTimer(hwnd); break; @@ -591,7 +591,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, break; contact->proto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0); cli.pfnInvalidateDisplayNameCacheEntry((HANDLE)wParam); - lstrcpyn(contact->szText, cli.pfnGetContactDisplayName((HANDLE)wParam,0), SIZEOF(contact->szText)); + lstrcpyn(contact->szText, cli.pfnGetContactDisplayName((HANDLE)wParam, 0), SIZEOF(contact->szText)); SortClcByTimer(hwnd); break; } @@ -680,7 +680,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, HDC hdc; PAINTSTRUCT ps; hdc = BeginPaint(hwnd, &ps); - /* we get so many cli.pfnInvalidateRect()'s that there is no point painting, + /* we get so many cli.pfnInvalidateRect()'s that there is no point painting, Windows in theory shouldn't queue up WM_PAINTs in this case but it does so we'll just ignore them */ if (IsWindowVisible(hwnd)) @@ -909,16 +909,16 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, break; } case TIMERID_REBUILDAFTER: - KillTimer(hwnd,TIMERID_REBUILDAFTER); - cli.pfnInvalidateRect(hwnd,NULL,FALSE); - cli.pfnSaveStateAndRebuildList(hwnd,dat); + KillTimer(hwnd, TIMERID_REBUILDAFTER); + cli.pfnInvalidateRect(hwnd, NULL, FALSE); + cli.pfnSaveStateAndRebuildList(hwnd, dat); break; case TIMERID_DELAYEDRESORTCLC: - KillTimer(hwnd,TIMERID_DELAYEDRESORTCLC); - cli.pfnInvalidateRect(hwnd,NULL,FALSE); - cli.pfnSortCLC(hwnd,dat,1); - cli.pfnRecalcScrollBar(hwnd,dat); + KillTimer(hwnd, TIMERID_DELAYEDRESORTCLC); + cli.pfnInvalidateRect(hwnd, NULL, FALSE); + cli.pfnSortCLC(hwnd, dat, 1); + cli.pfnRecalcScrollBar(hwnd, dat); break; } break; @@ -958,7 +958,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, cli.pfnSetGroupExpand(hwnd, dat, contact->group, -1); if (dat->selection != -1) { dat->selection = - cli.pfnGetRowsPriorTo(&dat->list, selgroup, List_IndexOf((SortedList*)&selgroup->cl,selcontact)); + cli.pfnGetRowsPriorTo(&dat->list, selgroup, List_IndexOf((SortedList*)&selgroup->cl, selcontact)); if (dat->selection == -1) dat->selection = cli.pfnGetRowsPriorTo(&dat->list, contact->group, -1); } @@ -1321,7 +1321,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, case POPUP_GROUPHIDEOFFLINE: if (contact->type != CLCIT_GROUP) break; - CallService(MS_CLIST_GROUPSETFLAGS, contact->groupId, + CallService(MS_CLIST_GROUPSETFLAGS, contact->groupId, MAKELPARAM(contact->group->hideOffline ? 0 : GROUPF_HIDEOFFLINE, GROUPF_HIDEOFFLINE)); break; } diff --git a/src/modules/clist/clc.h b/src/modules/clist/clc.h index 0bbf197b44..f9ac61e634 100644 --- a/src/modules/clist/clc.h +++ b/src/modules/clist/clc.h @@ -2,7 +2,7 @@ Miranda IM: the free IM client for Microsoft* Windows* -Copyright 2000-2009 Miranda ICQ/IM project, +Copyright 2000-2009 Miranda ICQ/IM project, all portions of this codebase are copyrighted to the people listed in contributors.txt. @@ -11,7 +11,7 @@ modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. -This program is distributed in the hope that it will be useful, +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -103,7 +103,7 @@ struct ClcGroup* fnRemoveItemFromGroup(HWND hwnd, struct ClcGroup *group, struct void fnFreeContact( struct ClcContact *p ); void fnFreeGroup( struct ClcGroup *group ); int fnAddInfoItemToGroup(struct ClcGroup *group, int flags, const TCHAR *pszText); -int fnAddItemToGroup( struct ClcGroup *group,int iAboveItem ); +int fnAddItemToGroup( struct ClcGroup *group, int iAboveItem ); void fnAddContactToTree( HWND hwnd, struct ClcData *dat, HANDLE hContact, int updateTotalCount, int checkHideOffline); int fnAddContactToGroup( struct ClcData *dat, struct ClcGroup *group, HANDLE hContact); void fnDeleteItemFromTree( HWND hwnd, HANDLE hItem ); @@ -149,9 +149,9 @@ int fnGetRowTotalHeight(struct ClcData *dat); int fnRowHitTest(struct ClcData *dat, int y); /* clcopts.c */ -int ClcOptInit(WPARAM wParam,LPARAM lParam); +int ClcOptInit(WPARAM wParam, LPARAM lParam); DWORD GetDefaultExStyle(void); -void GetFontSetting(int i,LOGFONTA *lf,COLORREF *colour); +void GetFontSetting(int i, LOGFONTA *lf, COLORREF *colour); /* clistmenus.c */ HGENMENU fnGetProtocolMenu( const char* ); @@ -224,7 +224,7 @@ VOID CALLBACK fnTrayCycleTimerProc(HWND hwnd, UINT message, UINT_PTR idEvent, DW /* clui.c */ LRESULT CALLBACK fnContactListWndProc ( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ); void fnLoadCluiGlobalOpts( void ); -void fnCluiProtocolStatusChanged(int,const char*); +void fnCluiProtocolStatusChanged(int, const char*); void fnDrawMenuItem(DRAWITEMSTRUCT *dis, HICON hIcon, HICON eventIcon); /* contact.c */ diff --git a/src/modules/clist/clcfiledrop.cpp b/src/modules/clist/clcfiledrop.cpp index beff769bce..54660267c9 100644 --- a/src/modules/clist/clcfiledrop.cpp +++ b/src/modules/clist/clcfiledrop.cpp @@ -11,7 +11,7 @@ modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. -This program is distributed in the hope that it will be useful, +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. diff --git a/src/modules/clist/clcidents.cpp b/src/modules/clist/clcidents.cpp index 37a7bb7f0e..1256ad4c8b 100644 --- a/src/modules/clist/clcidents.cpp +++ b/src/modules/clist/clcidents.cpp @@ -11,7 +11,7 @@ modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. -This program is distributed in the hope that it will be useful, +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. diff --git a/src/modules/clist/clcitems.cpp b/src/modules/clist/clcitems.cpp index f5c0e87300..261710c078 100644 --- a/src/modules/clist/clcitems.cpp +++ b/src/modules/clist/clcitems.cpp @@ -11,7 +11,7 @@ modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. -This program is distributed in the hope that it will be useful, +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -205,7 +205,7 @@ int fnAddContactToGroup(struct ClcData *dat, struct ClcGroup *group, HANDLE hCon idleMode = szProto != NULL ? DBGetContactSettingDword(hContact, szProto, "IdleTS", 0) : 0; if (idleMode) group->cl.items[i]->flags |= CONTACTF_IDLE; - lstrcpyn(group->cl.items[i]->szText, cli.pfnGetContactDisplayName(hContact,0), SIZEOF(group->cl.items[i]->szText)); + lstrcpyn(group->cl.items[i]->szText, cli.pfnGetContactDisplayName(hContact, 0), SIZEOF(group->cl.items[i]->szText)); { ClcCacheEntryBase* p = cli.pfnGetCacheEntry(hContact); if ( p != NULL ) { @@ -573,7 +573,7 @@ void fnSortCLC(HWND hwnd, struct ClcData *dat, int useInsertionSort) } if (hSelItem) if (cli.pfnFindItem(hwnd, dat, hSelItem, &selcontact, &selgroup, NULL)) - dat->selection = cli.pfnGetRowsPriorTo(&dat->list, selgroup, List_IndexOf((SortedList*)&selgroup->cl,selcontact)); + dat->selection = cli.pfnGetRowsPriorTo(&dat->list, selgroup, List_IndexOf((SortedList*)&selgroup->cl, selcontact)); cli.pfnRecalcScrollBar(hwnd, dat); } @@ -637,7 +637,7 @@ void fnSaveStateAndRebuildList(HWND hwnd, struct ClcData *dat) else if (group->cl.items[group->scanIndex]->type == CLCIT_CONTACT) { SavedContactState_t* p = new SavedContactState_t; p->hContact = group->cl.items[group->scanIndex]->hContact; - CopyMemory( p->iExtraImage, group->cl.items[group->scanIndex]->iExtraImage, + CopyMemory( p->iExtraImage, group->cl.items[group->scanIndex]->iExtraImage, sizeof(group->cl.items[group->scanIndex]->iExtraImage)); p->checked = group->cl.items[group->scanIndex]->flags & CONTACTF_CHECKED; saveContact.insert( p ); @@ -676,7 +676,7 @@ void fnSaveStateAndRebuildList(HWND hwnd, struct ClcData *dat) SavedContactState_t tmp, *p; tmp.hContact = group->cl.items[group->scanIndex]->hContact; if (( p = saveContact.find( &tmp )) != NULL ) { - CopyMemory(group->cl.items[group->scanIndex]->iExtraImage, p->iExtraImage, + CopyMemory(group->cl.items[group->scanIndex]->iExtraImage, p->iExtraImage, SIZEOF(group->cl.items[group->scanIndex]->iExtraImage)); if (p->checked) group->cl.items[group->scanIndex]->flags |= CONTACTF_CHECKED; diff --git a/src/modules/clist/clcmsgs.cpp b/src/modules/clist/clcmsgs.cpp index 17bf8834e7..116beb3486 100644 --- a/src/modules/clist/clcmsgs.cpp +++ b/src/modules/clist/clcmsgs.cpp @@ -2,7 +2,7 @@ Miranda IM: the free IM client for Microsoft* Windows* -Copyright 2000-2009 Miranda ICQ/IM project, +Copyright 2000-2009 Miranda ICQ/IM project, all portions of this codebase are copyrighted to the people listed in contributors.txt. @@ -11,7 +11,7 @@ modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. -This program is distributed in the hope that it will be useful, +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -76,7 +76,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR } case CLM_AUTOREBUILD: - KillTimer(hwnd,TIMERID_REBUILDAFTER); + KillTimer(hwnd, TIMERID_REBUILDAFTER); cli.pfnSaveStateAndRebuildList(hwnd, dat); break; @@ -103,7 +103,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR break; for (tgroup = group; tgroup; tgroup = tgroup->parent) cli.pfnSetGroupExpand(hwnd, dat, tgroup, 1); - cli.pfnEnsureVisible(hwnd, dat, cli.pfnGetRowsPriorTo(&dat->list, group, List_IndexOf((SortedList*)&group->cl,contact)), 0); + cli.pfnEnsureVisible(hwnd, dat, cli.pfnGetRowsPriorTo(&dat->list, group, List_IndexOf((SortedList*)&group->cl, contact)), 0); break; } @@ -219,7 +219,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR if (!cli.pfnFindItem(hwnd, dat, (HANDLE) lParam, &contact, &group, NULL)) return NULL; - int i = List_IndexOf((SortedList*)&group->cl,contact); + int i = List_IndexOf((SortedList*)&group->cl, contact); switch (wParam) { case CLGN_CHILD: if (contact->type != CLCIT_GROUP) @@ -324,7 +324,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR break; for (tgroup = group; tgroup; tgroup = tgroup->parent) cli.pfnSetGroupExpand(hwnd, dat, tgroup, 1); - dat->selection = cli.pfnGetRowsPriorTo(&dat->list, group, List_IndexOf((SortedList*)&group->cl,contact)); + dat->selection = cli.pfnGetRowsPriorTo(&dat->list, group, List_IndexOf((SortedList*)&group->cl, contact)); cli.pfnEnsureVisible(hwnd, dat, dat->selection, 0); break; } diff --git a/src/modules/clist/clcutils.cpp b/src/modules/clist/clcutils.cpp index 40b923d78e..054657878f 100644 --- a/src/modules/clist/clcutils.cpp +++ b/src/modules/clist/clcutils.cpp @@ -2,7 +2,7 @@ Miranda IM: the free IM client for Microsoft* Windows* -Copyright 2000-2009 Miranda ICQ/IM project, +Copyright 2000-2009 Miranda ICQ/IM project, all portions of this codebase are copyrighted to the people listed in contributors.txt. @@ -11,7 +11,7 @@ modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. -This program is distributed in the hope that it will be useful, +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -410,7 +410,7 @@ void fnEndRename(HWND, struct ClcData *dat, int save) if (contact->type == CLCIT_GROUP) { if (contact->group->parent && contact->group->parent->parent) { TCHAR szFullName[256]; - mir_sntprintf(szFullName, SIZEOF(szFullName), _T("%s\\%s"), + mir_sntprintf(szFullName, SIZEOF(szFullName), _T("%s\\%s"), cli.pfnGetGroupName(contact->group->parent->groupId, NULL), text); cli.pfnRenameGroup(contact->groupId, szFullName); } @@ -734,7 +734,7 @@ void fnLoadClcOptions(HWND hwnd, struct ClcData *dat) dat->fontInfo[i].hFont = CreateFontIndirect(&lf); dat->fontInfo[i].changed = 0; - HFONT holdfont = (HFONT)SelectObject(hdc,dat->fontInfo[i].hFont); + HFONT holdfont = (HFONT)SelectObject(hdc, dat->fontInfo[i].hFont); GetTextExtentPoint32(hdc, _T("x"), 1, &fontSize); SelectObject(hdc, holdfont); diff --git a/src/modules/clist/clistcore.cpp b/src/modules/clist/clistcore.cpp index 6821b3a577..ad3f6832de 100644 --- a/src/modules/clist/clistcore.cpp +++ b/src/modules/clist/clistcore.cpp @@ -2,7 +2,7 @@ Miranda IM: the free IM client for Microsoft* Windows* -Copyright 2000-2009 Miranda ICQ/IM project, +Copyright 2000-2009 Miranda ICQ/IM project, all portions of this codebase are copyrighted to the people listed in contributors.txt. @@ -11,7 +11,7 @@ modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. -This program is distributed in the hope that it will be useful, +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -44,7 +44,7 @@ static struct ClcContact* fnCreateClcContact( void ) return ( struct ClcContact* )mir_calloc( sizeof( struct ClcContact )); } -static BOOL fnInvalidateRect( HWND hwnd, CONST RECT* lpRect,BOOL bErase ) +static BOOL fnInvalidateRect( HWND hwnd, CONST RECT* lpRect, BOOL bErase ) { return InvalidateRect( hwnd, lpRect, bErase ); } @@ -58,7 +58,7 @@ static void fnReloadProtoMenus( void ) RebuildMenuOrder(); if (DBGetContactSettingByte(NULL, "CList", "MoveProtoMenus", TRUE)) BuildProtoMenus(); - cli.pfnCluiProtocolStatusChanged(0,0); + cli.pfnCluiProtocolStatusChanged(0, 0); } static INT_PTR srvRetrieveInterface( WPARAM, LPARAM lParam ) diff --git a/src/modules/clist/clistevents.cpp b/src/modules/clist/clistevents.cpp index 6f8b0c4049..9ccaa40c09 100644 --- a/src/modules/clist/clistevents.cpp +++ b/src/modules/clist/clistevents.cpp @@ -2,7 +2,7 @@ Miranda IM: the free IM client for Microsoft* Windows* -Copyright 2000-2009 Miranda ICQ/IM project, +Copyright 2000-2009 Miranda ICQ/IM project, all portions of this codebase are copyrighted to the people listed in contributors.txt. @@ -11,7 +11,7 @@ modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. -This program is distributed in the hope that it will be useful, +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -113,7 +113,7 @@ static void ShowEventsInTray() { int j; for (j=0; j=nTrayProtoCnt ) j=0; //event was not found so assume first icon if ( pTrayProtos[j] ) //if not already set @@ -218,8 +218,8 @@ int fnRemoveEvent( HANDLE hContact, HANDLE dbEvent ) // Update contact's icon szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); - cli.pfnChangeContactIcon(cli.events.items[i]->cle.hContact, - CallService(MS_CLIST_GETCONTACTICON, (WPARAM)cli.events.items[i]->cle.hContact, 1), + cli.pfnChangeContactIcon(cli.events.items[i]->cle.hContact, + CallService(MS_CLIST_GETCONTACTICON, (WPARAM)cli.events.items[i]->cle.hContact, 1), 0); // Free any memory allocated to the event @@ -236,7 +236,7 @@ int fnRemoveEvent( HANDLE hContact, HANDLE dbEvent ) szEventProto=(char *) cli.events.items[i]->cle.lpszProtocol; else szEventProto = NULL; - if (szEventProto && szProto && !lstrcmpA(szEventProto,szProto)) + if (szEventProto && szProto && !lstrcmpA(szEventProto, szProto)) nSameProto++; } @@ -391,10 +391,10 @@ static int CListEventSettingsChanged(WPARAM wParam, LPARAM lParam) /***************************************************************************************/ -INT_PTR AddEventSyncStub(WPARAM wParam, LPARAM lParam) { return CallServiceSync(MS_CLIST_ADDEVENT"_SYNC",wParam, lParam); } +INT_PTR AddEventSyncStub(WPARAM wParam, LPARAM lParam) { return CallServiceSync(MS_CLIST_ADDEVENT"_SYNC", wParam, lParam); } INT_PTR AddEventStub(WPARAM, LPARAM lParam) { return cli.pfnAddEvent((CLISTEVENT*)lParam ) == NULL; } -INT_PTR RemoveEventStub(WPARAM wParam, LPARAM lParam) { return cli.pfnRemoveEvent((HANDLE)wParam,(HANDLE)lParam ); } -INT_PTR GetEventStub(WPARAM wParam, LPARAM lParam) { return (INT_PTR)cli.pfnGetEvent((HANDLE)wParam,(int)lParam); } +INT_PTR RemoveEventStub(WPARAM wParam, LPARAM lParam) { return cli.pfnRemoveEvent((HANDLE)wParam, (HANDLE)lParam ); } +INT_PTR GetEventStub(WPARAM wParam, LPARAM lParam) { return (INT_PTR)cli.pfnGetEvent((HANDLE)wParam, (int)lParam); } int InitCListEvents(void) { diff --git a/src/modules/clist/clistmenus.cpp b/src/modules/clist/clistmenus.cpp index 051cc4cee6..2a77fbb731 100644 --- a/src/modules/clist/clistmenus.cpp +++ b/src/modules/clist/clistmenus.cpp @@ -2,7 +2,7 @@ Miranda IM: the free IM client for Microsoft* Windows* -Copyright 2000-2010 Miranda ICQ/IM project, +Copyright 2000-2010 Miranda ICQ/IM project, all portions of this codebase are copyrighted to the people listed in contributors.txt. @@ -11,7 +11,7 @@ modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. -This program is distributed in the hope that it will be useful, +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -40,7 +40,7 @@ typedef struct { int iconId; CLISTMENUITEM mi; } - CListIntMenuItem,*lpCListIntMenuItem; + CListIntMenuItem, *lpCListIntMenuItem; //new menu sys HANDLE hMainMenuObject = 0; @@ -57,22 +57,22 @@ HANDLE hPreBuildMainMenuEvent, hStatusModeChangeEvent, hPreBuildContactMenuEvent static HANDLE hAckHook; -static HMENU hMainMenu,hStatusMenu = 0; +static HMENU hMainMenu, hStatusMenu = 0; static const int statusModeList[ MAX_STATUS_COUNT ] = { - ID_STATUS_OFFLINE, ID_STATUS_ONLINE, ID_STATUS_AWAY, ID_STATUS_NA, ID_STATUS_OCCUPIED, + ID_STATUS_OFFLINE, ID_STATUS_ONLINE, ID_STATUS_AWAY, ID_STATUS_NA, ID_STATUS_OCCUPIED, ID_STATUS_DND, ID_STATUS_FREECHAT, ID_STATUS_INVISIBLE, ID_STATUS_ONTHEPHONE, ID_STATUS_OUTTOLUNCH }; static const int skinIconStatusList[ MAX_STATUS_COUNT ] = { - SKINICON_STATUS_OFFLINE, SKINICON_STATUS_ONLINE, SKINICON_STATUS_AWAY, SKINICON_STATUS_NA, SKINICON_STATUS_OCCUPIED, + SKINICON_STATUS_OFFLINE, SKINICON_STATUS_ONLINE, SKINICON_STATUS_AWAY, SKINICON_STATUS_NA, SKINICON_STATUS_OCCUPIED, SKINICON_STATUS_DND, SKINICON_STATUS_FREE4CHAT, SKINICON_STATUS_INVISIBLE, SKINICON_STATUS_ONTHEPHONE, SKINICON_STATUS_OUTTOLUNCH }; static const int statusModePf2List[ MAX_STATUS_COUNT ] = { - 0xFFFFFFFF, PF2_ONLINE, PF2_SHORTAWAY, PF2_LONGAWAY, PF2_LIGHTDND, + 0xFFFFFFFF, PF2_ONLINE, PF2_SHORTAWAY, PF2_LONGAWAY, PF2_LIGHTDND, PF2_HEAVYDND, PF2_FREECHAT, PF2_INVISIBLE, PF2_ONTHEPHONE, PF2_OUTTOLUNCH }; @@ -87,7 +87,7 @@ typedef struct int protostatus[ MAX_STATUS_COUNT ]; PMO_IntMenuItem menuhandle[ MAX_STATUS_COUNT ]; } - tStatusMenuHandles,*lpStatusMenuHandles; + tStatusMenuHandles, *lpStatusMenuHandles; lpStatusMenuHandles hStatusMenuHandles; int hStatusMenuHandlesCnt; @@ -99,7 +99,7 @@ typedef struct TCHAR *szMenuName; int Param1; } - MainMenuExecParam,*lpMainMenuExecParam; + MainMenuExecParam, *lpMainMenuExecParam; //contactmenu exec param(ownerdata) //also used in checkservice @@ -109,7 +109,7 @@ typedef struct char *pszContactOwner;//for check proc int param; } - ContactMenuExecParam,*lpContactMenuExecParam; + ContactMenuExecParam, *lpContactMenuExecParam; typedef struct { @@ -129,7 +129,7 @@ typedef struct char *svc; HANDLE hMenuItem; } - StatusMenuExecParam,*lpStatusMenuExecParam; + StatusMenuExecParam, *lpStatusMenuExecParam; typedef struct _MenuItemHandles { @@ -192,7 +192,7 @@ return 0 on success. static INT_PTR RemoveMainMenuItem(WPARAM wParam, LPARAM) { - CallService(MO_REMOVEMENUITEM,wParam,0); + CallService(MO_REMOVEMENUITEM, wParam, 0); return 0; } @@ -201,10 +201,10 @@ static INT_PTR BuildMainMenu(WPARAM, LPARAM) ListParam param = { 0 }; param.MenuObjectHandle = hMainMenuObject; - NotifyEventHooks(hPreBuildMainMenuEvent,(WPARAM)0,(LPARAM)0); + NotifyEventHooks(hPreBuildMainMenuEvent, (WPARAM)0, (LPARAM)0); - CallService(MO_BUILDMENU,(WPARAM)hMainMenu,(LPARAM)¶m); - DrawMenuBar((HWND)CallService("CLUI/GetHwnd",(WPARAM)0,(LPARAM)0)); + CallService(MO_BUILDMENU, (WPARAM)hMainMenu, (LPARAM)¶m); + DrawMenuBar((HWND)CallService("CLUI/GetHwnd", (WPARAM)0, (LPARAM)0)); return (INT_PTR)hMainMenu; } @@ -270,11 +270,11 @@ INT_PTR MainMenuExecService(WPARAM wParam, LPARAM lParam) { lpMainMenuExecParam mmep = ( lpMainMenuExecParam )wParam; if ( mmep != NULL ) { - // bug in help.c,it used wparam as parent window handle without reason. - if ( !lstrcmpA(mmep->szServiceName,"Help/AboutCommand")) + // bug in help.c, it used wparam as parent window handle without reason. + if ( !lstrcmpA(mmep->szServiceName, "Help/AboutCommand")) mmep->Param1 = 0; - CallService(mmep->szServiceName,mmep->Param1,lParam); + CallService(mmep->szServiceName, mmep->Param1, lParam); } return 1; } @@ -294,7 +294,7 @@ INT_PTR FreeOwnerDataMainMenu(WPARAM, LPARAM lParam) static INT_PTR RemoveContactMenuItem(WPARAM wParam, LPARAM) { - CallService(MO_REMOVEMENUITEM,wParam,0); + CallService(MO_REMOVEMENUITEM, wParam, 0); return 0; } @@ -351,21 +351,21 @@ static INT_PTR AddContactMenuItem(WPARAM, LPARAM lParam) static INT_PTR BuildContactMenu(WPARAM wParam, LPARAM) { HANDLE hContact = ( HANDLE )wParam; - NotifyEventHooks(hPreBuildContactMenuEvent,(WPARAM)hContact,0); + NotifyEventHooks(hPreBuildContactMenuEvent, (WPARAM)hContact, 0); - char *szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hContact,0); + char *szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); BuildContactParam bcp; bcp.szProto = szProto; - bcp.isOnList = ( DBGetContactSettingByte(hContact,"CList","NotOnList",0) == 0 ); - bcp.isOnline = ( szProto != NULL && ID_STATUS_OFFLINE != DBGetContactSettingWord(hContact,szProto,"Status",ID_STATUS_OFFLINE)); + bcp.isOnList = ( DBGetContactSettingByte(hContact, "CList", "NotOnList", 0) == 0 ); + bcp.isOnline = ( szProto != NULL && ID_STATUS_OFFLINE != DBGetContactSettingWord(hContact, szProto, "Status", ID_STATUS_OFFLINE)); ListParam param = { 0 }; param.MenuObjectHandle = hContactMenuObject; param.wParam = (WPARAM)&bcp; HMENU hMenu = CreatePopupMenu(); - CallService(MO_BUILDMENU,(WPARAM)hMenu,(LPARAM)¶m); + CallService(MO_BUILDMENU, (WPARAM)hMenu, (LPARAM)¶m); return (INT_PTR)hMenu; } @@ -373,18 +373,18 @@ static INT_PTR BuildContactMenu(WPARAM wParam, LPARAM) //called with: //wparam - ownerdata //lparam - lparam from winproc -INT_PTR ContactMenuExecService(WPARAM wParam,LPARAM lParam) +INT_PTR ContactMenuExecService(WPARAM wParam, LPARAM lParam) { if (wParam != 0) { lpContactMenuExecParam cmep=(lpContactMenuExecParam)wParam; - //call with wParam=(WPARAM)(HANDLE)hContact,lparam=popupposition - CallService(cmep->szServiceName,lParam,cmep->param); + //call with wParam=(WPARAM)(HANDLE)hContact, lparam=popupposition + CallService(cmep->szServiceName, lParam, cmep->param); } return 0; } -//true - ok,false ignore -INT_PTR ContactMenuCheckService(WPARAM wParam,LPARAM) +//true - ok, false ignore +INT_PTR ContactMenuCheckService(WPARAM wParam, LPARAM) { PCheckProcParam pcpp = ( PCheckProcParam )wParam; BuildContactParam *bcp=NULL; @@ -442,7 +442,7 @@ BOOL FindMenuHandleByGlobalID(HMENU hMenu, PMO_IntMenuItem id, MenuItemData* itd mii.cbSize = MENUITEMINFO_V4_SIZE; mii.fMask = MIIM_SUBMENU | MIIM_DATA; for ( i = GetMenuItemCount( hMenu )-1; i >= 0; i-- ) { - GetMenuItemInfo(hMenu,i,TRUE,&mii); + GetMenuItemInfo(hMenu, i, TRUE, &mii); if ( mii.fType == MFT_SEPARATOR ) continue; if ( mii.hSubMenu ) @@ -543,7 +543,7 @@ INT_PTR StatusMenuCheckService(WPARAM wParam, LPARAM) } } } } else if ( smep && smep->status && !smep->custom ) { - int curProtoStatus = ( smep->proto ) ? CallProtoService(smep->proto,PS_GETSTATUS,0,0) : GetAverageMode(); + int curProtoStatus = ( smep->proto ) ? CallProtoService(smep->proto, PS_GETSTATUS, 0, 0) : GetAverageMode(); if ( smep->status == curProtoStatus ) timi->mi.flags |= CMIF_CHECKED; else @@ -568,13 +568,13 @@ INT_PTR StatusMenuCheckService(WPARAM wParam, LPARAM) if ( Proto_GetAccount( prot ) == NULL ) return TRUE; - if (( curProtoStatus = CallProtoService(prot,PS_GETSTATUS,0,0)) == CALLSERVICE_NOTFOUND ) + if (( curProtoStatus = CallProtoService(prot, PS_GETSTATUS, 0, 0)) == CALLSERVICE_NOTFOUND ) curProtoStatus = 0; if ( curProtoStatus >= ID_STATUS_OFFLINE && curProtoStatus < ID_STATUS_IDLE ) - timi->mi.hIcon = LoadSkinProtoIcon(prot,curProtoStatus); + timi->mi.hIcon = LoadSkinProtoIcon(prot, curProtoStatus); else { - timi->mi.hIcon=(HICON)CallProtoService(prot,PS_LOADICON,PLI_PROTOCOL|PLIF_SMALL,0); + timi->mi.hIcon=(HICON)CallProtoService(prot, PS_LOADICON, PLI_PROTOCOL|PLIF_SMALL, 0); if ( timi->mi.hIcon == (HICON)CALLSERVICE_NOTFOUND ) timi->mi.hIcon = NULL; else @@ -588,7 +588,7 @@ INT_PTR StatusMenuCheckService(WPARAM wParam, LPARAM) DestroyIcon( timi->mi.hIcon ); timi->mi.hIcon = NULL; } - else IconLib_ReleaseIcon(timi->mi.hIcon,0); + else IconLib_ReleaseIcon(timi->mi.hIcon, 0); } } return TRUE; @@ -608,8 +608,8 @@ INT_PTR StatusMenuExecService(WPARAM wParam, LPARAM) char *prot = smep->proto; char szHumanName[64]={0}; PROTOACCOUNT * acc = Proto_GetAccount( smep->proto ); - int i=(DBGetContactSettingByte(NULL,prot,"LockMainStatus",0)?0:1); - DBWriteContactSettingByte(NULL,prot,"LockMainStatus",(BYTE)i); + int i=(DBGetContactSettingByte(NULL, prot, "LockMainStatus", 0)?0:1); + DBWriteContactSettingByte(NULL, prot, "LockMainStatus", (BYTE)i); CallProtoService( smep->proto, PS_GETNAME, (WPARAM)SIZEOF(szHumanName), (LPARAM)szHumanName ); pimi = MO_GetIntMenuItem(( HGENMENU )smep->protoindex ); @@ -620,7 +620,7 @@ INT_PTR StatusMenuExecService(WPARAM wParam, LPARAM) TCHAR buf[256]; pimi->mi.flags|=CMIF_CHECKED; if ( cli.bDisplayLocked ) { - mir_sntprintf(buf,SIZEOF(buf),TranslateT("%s (locked)"),acc->tszAccountName); + mir_sntprintf(buf, SIZEOF(buf), TranslateT("%s (locked)"), acc->tszAccountName); pimi->mi.ptszName = mir_tstrdup( buf ); root->mi.ptszName = mir_tstrdup( buf ); } @@ -683,7 +683,7 @@ INT_PTR FreeOwnerDataStatusMenu(WPARAM, LPARAM lParam) // Other menu functions //wparam MenuItemHandle -static INT_PTR ModifyCustomMenuItem(WPARAM wParam,LPARAM lParam) +static INT_PTR ModifyCustomMenuItem(WPARAM wParam, LPARAM lParam) { CLISTMENUITEM *mi=(CLISTMENUITEM*)lParam; TMO_MenuItem tmi; @@ -701,7 +701,7 @@ static INT_PTR ModifyCustomMenuItem(WPARAM wParam,LPARAM lParam) return MO_ModifyMenuItem(( PMO_IntMenuItem )wParam, &tmi ); } -INT_PTR MenuProcessCommand(WPARAM wParam,LPARAM lParam) +INT_PTR MenuProcessCommand(WPARAM wParam, LPARAM lParam) { WORD cmd = LOWORD(wParam); @@ -774,7 +774,7 @@ static int MenuIconsChanged(WPARAM, LPARAM) { //just rebuild menu RebuildMenuOrder(); - cli.pfnCluiProtocolStatusChanged(0,0); + cli.pfnCluiProtocolStatusChanged(0, 0); return 0; } @@ -802,7 +802,7 @@ int RecursiveDeleteMenu(HMENU hMenu) static INT_PTR MenuGetMain(WPARAM, LPARAM) { RecursiveDeleteMenu(hMainMenu); - BuildMainMenu(0,0); + BuildMainMenu(0, 0); return (INT_PTR)hMainMenu; } @@ -812,7 +812,7 @@ static INT_PTR BuildStatusMenu(WPARAM, LPARAM) param.MenuObjectHandle = hStatusMenuObject; RecursiveDeleteMenu(hStatusMenu); - CallService(MO_BUILDMENU,(WPARAM)hStatusMenu,(LPARAM)¶m); + CallService(MO_BUILDMENU, (WPARAM)hStatusMenu, (LPARAM)¶m); return (INT_PTR)hStatusMenu; } @@ -867,7 +867,7 @@ int fnGetAccountIndexByPos(int Pos) void RebuildMenuOrder( void ) { - int i,j,s; + int i, j, s; DWORD flags; BYTE bHideStatusMenu = DBGetContactSettingByte( NULL, "CLUI", "DontHideStatusMenu", 0 ); // cool perversion, though @@ -877,7 +877,7 @@ void RebuildMenuOrder( void ) //status menu if ( hStatusMenuObject != 0 ) { - CallService(MO_REMOVEMENUOBJECT,(WPARAM)hStatusMenuObject,0); + CallService(MO_REMOVEMENUOBJECT, (WPARAM)hStatusMenuObject, 0); mir_free( hStatusMainMenuHandles ); mir_free( hStatusMenuHandles ); } @@ -888,7 +888,7 @@ void RebuildMenuOrder( void ) tmp.CheckService = "StatusMenuCheckService"; tmp.name = "StatusMenu"; - hStatusMenuObject=(HANDLE)CallService(MO_CREATENEWMENUOBJECT,(WPARAM)0,(LPARAM)&tmp); + hStatusMenuObject=(HANDLE)CallService(MO_CREATENEWMENUOBJECT, (WPARAM)0, (LPARAM)&tmp); MO_SetOptionsMenuObject( hStatusMenuObject, OPT_MENUOBJECT_SET_FREE_SERVICE, (INT_PTR)"CLISTMENUS/FreeOwnerDataStatusMenu" ); hStatusMainMenuHandles = ( PMO_IntMenuItem* )mir_calloc( SIZEOF(statusModeList) * sizeof( PMO_IntMenuItem* )); @@ -935,7 +935,7 @@ void RebuildMenuOrder( void ) } PMO_IntMenuItem rootmenu = MO_AddNewMenuItem( hStatusMenuObject, &tmi ); - memset(&tmi,0,sizeof(tmi)); + memset(&tmi, 0, sizeof(tmi)); tmi.cbSize = sizeof(tmi); tmi.flags = CMIF_TCHAR | CMIF_ROOTHANDLE | CMIF_KEEPUNTRANSLATED; tmi.root = rootmenu; @@ -963,7 +963,7 @@ void RebuildMenuOrder( void ) MO_ModifyMenuItem( menuHandle, &tmi ); cli.menuProtos=(MenuProto*)mir_realloc(cli.menuProtos, sizeof(MenuProto)*(cli.menuProtoCount+1)); - memset(&(cli.menuProtos[cli.menuProtoCount]),0,sizeof(MenuProto)); + memset(&(cli.menuProtos[cli.menuProtoCount]), 0, sizeof(MenuProto)); cli.menuProtos[cli.menuProtoCount].pMenu = rootmenu; cli.menuProtos[cli.menuProtoCount].szProto = mir_strdup(pa->szModuleName); @@ -1005,10 +1005,10 @@ void RebuildMenuOrder( void ) hStatusMenuHandles[i].menuhandle[j] = MO_AddNewMenuItem( hStatusMenuObject, &tmi ); { char buf[ 256 ]; - mir_snprintf(buf, SIZEOF(buf), "ProtocolIcon_%s_%s",pa->szModuleName,tmi.pszName); + mir_snprintf(buf, SIZEOF(buf), "ProtocolIcon_%s_%s", pa->szModuleName, tmi.pszName); MO_SetOptionsMenuItem( hStatusMenuHandles[i].menuhandle[j], OPT_MENUITEMSETUNIQNAME, ( INT_PTR )buf ); } - IconLib_ReleaseIcon(tmi.hIcon,0); + IconLib_ReleaseIcon(tmi.hIcon, 0); } } NotifyEventHooks(cli.hPreBuildStatusMenuEvent, 0, 0); @@ -1033,7 +1033,7 @@ void RebuildMenuOrder( void ) tmi.hIcon = LoadSkinIcon( skinIconStatusList[j] ); tmi.position = pos++; - tmi.hotKey = MAKELPARAM(MOD_CONTROL,'0'+j); + tmi.hotKey = MAKELPARAM(MOD_CONTROL, '0'+j); { //owner data lpStatusMenuExecParam smep = ( lpStatusMenuExecParam )mir_alloc( sizeof( StatusMenuExecParam )); @@ -1047,7 +1047,7 @@ void RebuildMenuOrder( void ) TCHAR buf[ 256 ], hotkeyName[ 100 ]; WORD hotKey = GetHotkeyValue( statusHotkeys[j] ); HotkeyToName( hotkeyName, SIZEOF(hotkeyName), HIBYTE(hotKey), LOBYTE(hotKey)); - mir_sntprintf( buf, SIZEOF( buf ), TranslateT("%s\t%s"), + mir_sntprintf( buf, SIZEOF( buf ), TranslateT("%s\t%s"), cli.pfnGetStatusModeDescription( statusModeList[j], 0 ), hotkeyName ); tmi.ptszName = buf; tmi.hotKey = MAKELONG(HIBYTE(hotKey), LOBYTE(hotKey)); @@ -1062,7 +1062,7 @@ void RebuildMenuOrder( void ) break; } } - BuildStatusMenu(0,0); + BuildStatusMenu(0, 0); } ///////////////////////////////////////////////////////////////////////////////////////// @@ -1077,7 +1077,7 @@ static int sttRebuildHotkeys( WPARAM, LPARAM ) TCHAR buf[ 256 ], hotkeyName[ 100 ]; WORD hotKey = GetHotkeyValue( statusHotkeys[j] ); HotkeyToName( hotkeyName, SIZEOF(hotkeyName), HIBYTE(hotKey), LOBYTE(hotKey)); - mir_sntprintf( buf, SIZEOF( buf ), TranslateT("%s\t%s"), + mir_sntprintf( buf, SIZEOF( buf ), TranslateT("%s\t%s"), cli.pfnGetStatusModeDescription( statusModeList[j], 0 ), hotkeyName ); tmi.ptszName = buf; tmi.hotKey = MAKELONG(HIBYTE(hotKey), LOBYTE(hotKey)); @@ -1114,7 +1114,7 @@ static int MenuProtoAck(WPARAM, LPARAM lParam) overallStatus = GetAverageMode(); - memset(&tmi,0,sizeof(tmi)); + memset(&tmi, 0, sizeof(tmi)); tmi.cbSize=sizeof(tmi); if (overallStatus >= ID_STATUS_OFFLINE) { int pos = statustopos(cli.currentStatusMenuItem); @@ -1144,7 +1144,7 @@ static int MenuProtoAck(WPARAM, LPARAM lParam) tmi.flags = CMIM_FLAGS | CMIF_ROOTHANDLE; MO_ModifyMenuItem( hStatusMainMenuHandles[pos], &tmi ); } - //SetMenuDefaultItem(hStatusMenu,-1,FALSE); + //SetMenuDefaultItem(hStatusMenu, -1, FALSE); cli.currentStatusMenuItem=0; } @@ -1169,7 +1169,7 @@ static int MenuProtoAck(WPARAM, LPARAM lParam) break; } } - //BuildStatusMenu(0,0); + //BuildStatusMenu(0, 0); return 0; } @@ -1195,7 +1195,7 @@ HGENMENU fnGetProtocolMenu( const char* proto ) return NULL; } -static INT_PTR AddStatusMenuItem(WPARAM wParam,LPARAM lParam) +static INT_PTR AddStatusMenuItem(WPARAM wParam, LPARAM lParam) { CLISTMENUITEM *mi = ( CLISTMENUITEM* )lParam; if ( mi->cbSize != sizeof( CLISTMENUITEM )) @@ -1284,7 +1284,7 @@ static INT_PTR AddStatusMenuItem(WPARAM wParam,LPARAM lParam) return ( INT_PTR )menuHandle; } -static INT_PTR HotkeySetStatus(WPARAM wParam,LPARAM lParam) +static INT_PTR HotkeySetStatus(WPARAM wParam, LPARAM lParam) { return SetStatusMode( lParam, 0 ); } @@ -1292,7 +1292,7 @@ static INT_PTR HotkeySetStatus(WPARAM wParam,LPARAM lParam) ///////////////////////////////////////////////////////////////////////////////////////// // PROTOCOL MENU -static INT_PTR AddProtoMenuItem(WPARAM wParam,LPARAM lParam) +static INT_PTR AddProtoMenuItem(WPARAM wParam, LPARAM lParam) { if ( DBGetContactSettingByte( NULL, "CList", "MoveProtoMenus", TRUE )) return AddStatusMenuItem( wParam, lParam ); @@ -1304,47 +1304,47 @@ static INT_PTR AddProtoMenuItem(WPARAM wParam,LPARAM lParam) void InitCustomMenus(void) { - CreateServiceFunction("MainMenuExecService",MainMenuExecService); + CreateServiceFunction("MainMenuExecService", MainMenuExecService); - CreateServiceFunction("ContactMenuExecService",ContactMenuExecService); - CreateServiceFunction("ContactMenuCheckService",ContactMenuCheckService); + CreateServiceFunction("ContactMenuExecService", ContactMenuExecService); + CreateServiceFunction("ContactMenuCheckService", ContactMenuCheckService); - CreateServiceFunction("StatusMenuExecService",StatusMenuExecService); - CreateServiceFunction("StatusMenuCheckService",StatusMenuCheckService); + CreateServiceFunction("StatusMenuExecService", StatusMenuExecService); + CreateServiceFunction("StatusMenuCheckService", StatusMenuCheckService); //free services - CreateServiceFunction("CLISTMENUS/FreeOwnerDataMainMenu",FreeOwnerDataMainMenu); - CreateServiceFunction("CLISTMENUS/FreeOwnerDataContactMenu",FreeOwnerDataContactMenu); - CreateServiceFunction("CLISTMENUS/FreeOwnerDataStatusMenu",FreeOwnerDataStatusMenu); + CreateServiceFunction("CLISTMENUS/FreeOwnerDataMainMenu", FreeOwnerDataMainMenu); + CreateServiceFunction("CLISTMENUS/FreeOwnerDataContactMenu", FreeOwnerDataContactMenu); + CreateServiceFunction("CLISTMENUS/FreeOwnerDataStatusMenu", FreeOwnerDataStatusMenu); CreateServiceFunction(MS_CLIST_SETSTATUSMODE, SetStatusMode); - CreateServiceFunction(MS_CLIST_ADDMAINMENUITEM,AddMainMenuItem); - CreateServiceFunction(MS_CLIST_ADDSTATUSMENUITEM,AddStatusMenuItem); - CreateServiceFunction(MS_CLIST_MENUGETMAIN,MenuGetMain); - CreateServiceFunction(MS_CLIST_REMOVEMAINMENUITEM,RemoveMainMenuItem); - CreateServiceFunction(MS_CLIST_MENUBUILDMAIN,BuildMainMenu); + CreateServiceFunction("CList/AddMainMenuItem", AddMainMenuItem); + CreateServiceFunction("CList/AddStatusMenuItem", AddStatusMenuItem); + CreateServiceFunction(MS_CLIST_MENUGETMAIN, MenuGetMain); + CreateServiceFunction(MS_CLIST_REMOVEMAINMENUITEM, RemoveMainMenuItem); + CreateServiceFunction(MS_CLIST_MENUBUILDMAIN, BuildMainMenu); - CreateServiceFunction(MS_CLIST_ADDCONTACTMENUITEM,AddContactMenuItem); - CreateServiceFunction(MS_CLIST_MENUBUILDCONTACT,BuildContactMenu); - CreateServiceFunction(MS_CLIST_REMOVECONTACTMENUITEM,RemoveContactMenuItem); + CreateServiceFunction("CList/AddContactMenuItem", AddContactMenuItem); + CreateServiceFunction(MS_CLIST_MENUBUILDCONTACT, BuildContactMenu); + CreateServiceFunction(MS_CLIST_REMOVECONTACTMENUITEM, RemoveContactMenuItem); - CreateServiceFunction(MS_CLIST_MODIFYMENUITEM,ModifyCustomMenuItem); - CreateServiceFunction(MS_CLIST_MENUMEASUREITEM,MeasureMenuItem); - CreateServiceFunction(MS_CLIST_MENUDRAWITEM,DrawMenuItem); + CreateServiceFunction(MS_CLIST_MODIFYMENUITEM, ModifyCustomMenuItem); + CreateServiceFunction(MS_CLIST_MENUMEASUREITEM, MeasureMenuItem); + CreateServiceFunction(MS_CLIST_MENUDRAWITEM, DrawMenuItem); - CreateServiceFunction(MS_CLIST_MENUGETSTATUS,BuildStatusMenu); - CreateServiceFunction(MS_CLIST_MENUPROCESSCOMMAND,MenuProcessCommand); - CreateServiceFunction(MS_CLIST_MENUPROCESSHOTKEY,MenuProcessHotkey); + CreateServiceFunction(MS_CLIST_MENUGETSTATUS, BuildStatusMenu); + CreateServiceFunction(MS_CLIST_MENUPROCESSCOMMAND, MenuProcessCommand); + CreateServiceFunction(MS_CLIST_MENUPROCESSHOTKEY, MenuProcessHotkey); - CreateServiceFunction(MS_CLIST_ADDPROTOMENUITEM,AddProtoMenuItem); + CreateServiceFunction("CList/AddProtoMenuItem", AddProtoMenuItem); hPreBuildContactMenuEvent=CreateHookableEvent(ME_CLIST_PREBUILDCONTACTMENU); hPreBuildMainMenuEvent=CreateHookableEvent(ME_CLIST_PREBUILDMAINMENU); cli.hPreBuildStatusMenuEvent=CreateHookableEvent(ME_CLIST_PREBUILDSTATUSMENU); hStatusModeChangeEvent = CreateHookableEvent( ME_CLIST_STATUSMODECHANGE ); - hAckHook=(HANDLE)HookEvent(ME_PROTO_ACK,MenuProtoAck); + hAckHook=(HANDLE)HookEvent(ME_PROTO_ACK, MenuProtoAck); hMainMenu = CreatePopupMenu(); hStatusMenu = CreatePopupMenu(); @@ -1365,7 +1365,7 @@ void InitCustomMenus(void) tmp.CheckService=NULL; tmp.ExecService="MainMenuExecService"; tmp.name="MainMenu"; - hMainMenuObject=(HANDLE)CallService(MO_CREATENEWMENUOBJECT,(WPARAM)0,(LPARAM)&tmp); + hMainMenuObject=(HANDLE)CallService(MO_CREATENEWMENUOBJECT, (WPARAM)0, (LPARAM)&tmp); } MO_SetOptionsMenuObject( hMainMenuObject, OPT_USERDEFINEDITEMS, TRUE ); @@ -1378,7 +1378,7 @@ void InitCustomMenus(void) tmp.CheckService="ContactMenuCheckService"; tmp.ExecService="ContactMenuExecService"; tmp.name="ContactMenu"; - hContactMenuObject=(HANDLE)CallService(MO_CREATENEWMENUOBJECT,(WPARAM)0,(LPARAM)&tmp); + hContactMenuObject=(HANDLE)CallService(MO_CREATENEWMENUOBJECT, (WPARAM)0, (LPARAM)&tmp); } MO_SetOptionsMenuObject( hContactMenuObject, OPT_USERDEFINEDITEMS, TRUE ); diff --git a/src/modules/clist/clistmod.cpp b/src/modules/clist/clistmod.cpp index ab8ca13965..ff667bcb38 100644 --- a/src/modules/clist/clistmod.cpp +++ b/src/modules/clist/clistmod.cpp @@ -2,7 +2,7 @@ Miranda IM: the free IM client for Microsoft* Windows* -Copyright 2000-2009 Miranda ICQ/IM project, +Copyright 2000-2009 Miranda ICQ/IM project, all portions of this codebase are copyrighted to the people listed in contributors.txt. @@ -11,7 +11,7 @@ modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. -This program is distributed in the hope that it will be useful, +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -194,7 +194,7 @@ static INT_PTR GetContactIcon(WPARAM wParam, LPARAM) char *szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0); HANDLE hContact = (HANDLE)wParam; - return cli.pfnIconFromStatusMode(szProto, + return cli.pfnIconFromStatusMode(szProto, szProto == NULL ? ID_STATUS_OFFLINE : DBGetContactSettingWord(hContact, szProto, "Status", ID_STATUS_OFFLINE), hContact); } diff --git a/src/modules/clist/clistsettings.cpp b/src/modules/clist/clistsettings.cpp index 0efc919ba8..f8a0501358 100644 --- a/src/modules/clist/clistsettings.cpp +++ b/src/modules/clist/clistsettings.cpp @@ -11,7 +11,7 @@ modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. -This program is distributed in the hope that it will be useful, +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -317,9 +317,9 @@ int ContactSettingChanged(WPARAM wParam, LPARAM lParam) szProto = NULL; else szProto = cws->value.pszVal; - cli.pfnChangeContactIcon(hContact, - cli.pfnIconFromStatusMode(szProto, - szProto == NULL ? ID_STATUS_OFFLINE : DBGetContactSettingWord(hContact, szProto, "Status", + cli.pfnChangeContactIcon(hContact, + cli.pfnIconFromStatusMode(szProto, + szProto == NULL ? ID_STATUS_OFFLINE : DBGetContactSettingWord(hContact, szProto, "Status", ID_STATUS_OFFLINE), hContact), 0); } } diff --git a/src/modules/clist/clisttray.cpp b/src/modules/clist/clisttray.cpp index 00d4074b33..519cf0f875 100644 --- a/src/modules/clist/clisttray.cpp +++ b/src/modules/clist/clisttray.cpp @@ -2,7 +2,7 @@ Miranda IM: the free IM client for Microsoft* Windows* -Copyright 2000-2009 Miranda ICQ/IM project, +Copyright 2000-2009 Miranda ICQ/IM project, all portions of this codebase are copyrighted to the people listed in contributors.txt. @@ -11,7 +11,7 @@ modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. -This program is distributed in the hope that it will be useful, +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -161,7 +161,7 @@ TCHAR* fnTrayIconMakeTooltip( const TCHAR *szPrefix, const char *szProto ) if ( DBGetContactSettingByte( NULL, "CList", "AlwaysStatus", SETTING_ALWAYSSTATUS_DEFAULT )) { if ( mToolTipTrayTips ) { if ( ProtoXStatus ) - mir_sntprintf(cli.szTip, MAX_TIP_SIZE, _T("%s%s%-12.12s\t%s%s%-24.24s"), szPrefix, szSeparator, pa->tszAccountName, szStatus,szSeparator,ProtoXStatus); + mir_sntprintf(cli.szTip, MAX_TIP_SIZE, _T("%s%s%-12.12s\t%s%s%-24.24s"), szPrefix, szSeparator, pa->tszAccountName, szStatus, szSeparator, ProtoXStatus); else mir_sntprintf(cli.szTip, MAX_TIP_SIZE, _T("%s%s%-12.12s\t%s"), szPrefix, szSeparator, pa->tszAccountName, szStatus); } @@ -172,7 +172,7 @@ TCHAR* fnTrayIconMakeTooltip( const TCHAR *szPrefix, const char *szProto ) else { if ( mToolTipTrayTips ) { if ( ProtoXStatus ) - mir_sntprintf( cli.szTip, MAX_TIP_SIZE, _T("%-12.12s\t%s\n%-24.24s"), pa->tszAccountName, szStatus,ProtoXStatus); + mir_sntprintf( cli.szTip, MAX_TIP_SIZE, _T("%-12.12s\t%s\n%-24.24s"), pa->tszAccountName, szStatus, ProtoXStatus); else mir_sntprintf( cli.szTip, MAX_TIP_SIZE, _T("%-12.12s\t%s"), pa->tszAccountName, szStatus); } @@ -357,7 +357,7 @@ static VOID CALLBACK RefreshTimerProc(HWND, UINT, UINT_PTR, DWORD) { int i; if ( RefreshTimerId ) { - KillTimer(NULL,RefreshTimerId); + KillTimer(NULL, RefreshTimerId); RefreshTimerId=0; } for (i=0; i < accounts.getCount(); i++) { @@ -422,13 +422,13 @@ int fnTrayIconUpdate(HICON hNewIcon, const TCHAR *szNewTip, const char *szPrefer SetTaskBarIcon(NULL, NULL); cli.trayIcon[i].isBase = isBase; - if (DBGetContactSettingByte(NULL,"CList","TrayIcon",SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_MULTI) + if (DBGetContactSettingByte(NULL, "CList", "TrayIcon", SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_MULTI) { - DWORD time1=DBGetContactSettingWord(NULL,"CList","CycleTime",SETTING_CYCLETIME_DEFAULT)*200; - DWORD time2=DBGetContactSettingWord(NULL,"CList","IconFlashTime",550)+1000; - DWORD time=max(max(2000,time1),time2); - if (RefreshTimerId) {KillTimer(NULL,RefreshTimerId); RefreshTimerId=0;} - RefreshTimerId=SetTimer(NULL,0,time,RefreshTimerProc); // if unknown base was changed - than show preffered proto icon for 2 sec and reset it to original one after timeout + DWORD time1=DBGetContactSettingWord(NULL, "CList", "CycleTime", SETTING_CYCLETIME_DEFAULT)*200; + DWORD time2=DBGetContactSettingWord(NULL, "CList", "IconFlashTime", 550)+1000; + DWORD time=max(max(2000, time1), time2); + if (RefreshTimerId) {KillTimer(NULL, RefreshTimerId); RefreshTimerId=0;} + RefreshTimerId=SetTimer(NULL, 0, time, RefreshTimerProc); // if unknown base was changed - than show preffered proto icon for 2 sec and reset it to original one after timeout } { ulock; return i; } } @@ -455,8 +455,8 @@ int fnTrayIconSetBaseInfo(HICON hIcon, const char *szPreferredProto) } if ((cli.pfnGetProtocolVisibility(szPreferredProto)) && (GetAverageMode() == -1) - && (DBGetContactSettingByte(NULL,"CList","TrayIcon",SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_MULTI) - && !(DBGetContactSettingByte(NULL,"CList","AlwaysMulti",SETTING_ALWAYSMULTI_DEFAULT))) + && (DBGetContactSettingByte(NULL, "CList", "TrayIcon", SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_MULTI) + && !(DBGetContactSettingByte(NULL, "CList", "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT))) goto LBL_Error; } @@ -555,7 +555,7 @@ void fnTrayIconUpdateBase(const char *szChangedProto) szProto = NULL; else szProto = dbv.pszVal; - changed = cli.pfnTrayIconSetBaseInfo( cli.pfnGetIconFromStatusMode( NULL, szProto, szProto ? CallProtoService(szProto, PS_GETSTATUS, 0,0) : CallService(MS_CLIST_GETSTATUSMODE, 0, 0)), szProto ); + changed = cli.pfnTrayIconSetBaseInfo( cli.pfnGetIconFromStatusMode( NULL, szProto, szProto ? CallProtoService(szProto, PS_GETSTATUS, 0, 0) : CallService(MS_CLIST_GETSTATUSMODE, 0, 0)), szProto ); DBFreeVariant(&dbv); break; } @@ -564,7 +564,7 @@ void fnTrayIconUpdateBase(const char *szChangedProto) SetTimer(NULL, 0, DBGetContactSettingWord(NULL, "CList", "CycleTime", SETTING_CYCLETIME_DEFAULT) * 1000, cli.pfnTrayCycleTimerProc); changed = cli.pfnTrayIconSetBaseInfo(ImageList_GetIcon - (hCListImages, cli.pfnIconFromStatusMode(szChangedProto, CallProtoService(szChangedProto, PS_GETSTATUS, 0, 0), NULL), + (hCListImages, cli.pfnIconFromStatusMode(szChangedProto, CallProtoService(szChangedProto, PS_GETSTATUS, 0, 0), NULL), ILD_NORMAL), NULL); break; case SETTING_TRAYICON_MULTI: diff --git a/src/modules/clist/clui.cpp b/src/modules/clist/clui.cpp index a9619b6302..d5bceade30 100644 --- a/src/modules/clist/clui.cpp +++ b/src/modules/clist/clui.cpp @@ -2,7 +2,7 @@ Miranda IM: the free IM client for Microsoft* Windows* - Copyright 2000-2010 Miranda ICQ/IM project, + Copyright 2000-2010 Miranda ICQ/IM project, all portions of this codebase are copyrighted to the people listed in contributors.txt. @@ -11,7 +11,7 @@ as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -52,7 +52,7 @@ void fnLoadCluiGlobalOpts() { cluiopt.showsbar = DBGetContactSettingByte(NULL, "CLUI", "ShowSBar", 1); cluiopt.showgrip = DBGetContactSettingByte(NULL, "CLUI", "ShowGrip", 1); - cluiopt.transparent = DBGetContactSettingByte(NULL,"CList","Transparent",SETTING_TRANSPARENT_DEFAULT); + cluiopt.transparent = DBGetContactSettingByte(NULL, "CList", "Transparent", SETTING_TRANSPARENT_DEFAULT); cluiopt.alpha = DBGetContactSettingByte(NULL, "CList", "Alpha", SETTING_ALPHA_DEFAULT); } @@ -205,8 +205,8 @@ static INT_PTR MenuItem_DeleteContact(WPARAM wParam, LPARAM lParam) if (status == ID_STATUS_OFFLINE || (status >= ID_STATUS_CONNECTING && status < ID_STATUS_CONNECTING + MAX_CONNECT_RETRIES)) { // Set a flag so we remember to delete the contact when the protocol goes online the next time DBWriteContactSettingByte((HANDLE) wParam, "CList", "Delete", 1); - MessageBox( NULL, - TranslateT("This contact is on an instant messaging system which stores its contact list on a central server. The contact will be removed from the server and from your contact list when you next connect to that network."), + MessageBox( NULL, + TranslateT("This contact is on an instant messaging system which stores its contact list on a central server. The contact will be removed from the server and from your contact list when you next connect to that network."), TranslateT("Delete Contact"), MB_OK); return 0; } } } @@ -322,13 +322,13 @@ int LoadCLUIModule(void) Utils_AssertInsideScreen(&pos); cli.hwndContactList = CreateWindowEx( - (DBGetContactSettingByte(NULL, "CList", "ToolWindow", SETTING_TOOLWINDOW_DEFAULT) ? WS_EX_TOOLWINDOW : WS_EX_APPWINDOW), - _T(MIRANDACLASS), - titleText, + (DBGetContactSettingByte(NULL, "CList", "ToolWindow", SETTING_TOOLWINDOW_DEFAULT) ? WS_EX_TOOLWINDOW : WS_EX_APPWINDOW), + _T(MIRANDACLASS), + titleText, WS_POPUPWINDOW | WS_THICKFRAME | WS_CLIPCHILDREN | (DBGetContactSettingByte(NULL, "CLUI", "ShowCaption", SETTING_SHOWCAPTION_DEFAULT) ? WS_CAPTION | WS_SYSMENU | - (DBGetContactSettingByte(NULL, "CList", "Min2Tray", SETTING_MIN2TRAY_DEFAULT) ? 0 : WS_MINIMIZEBOX) : 0), - pos.left, pos.top, pos.right - pos.left, pos.bottom - pos.top, + (DBGetContactSettingByte(NULL, "CList", "Min2Tray", SETTING_MIN2TRAY_DEFAULT) ? 0 : WS_MINIMIZEBOX) : 0), + pos.left, pos.top, pos.right - pos.left, pos.bottom - pos.top, NULL, NULL, cli.hInst, NULL); if (DBGetContactSettingByte(NULL, "CList", "OnDesktop", 0)) { @@ -365,7 +365,7 @@ int LoadCLUIModule(void) mi.pszContactOwner = NULL; //on every contact mi.pszName = LPGEN("De&lete"); mi.pszService = "CList/DeleteContactCommand"; - CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM) & mi); + Menu_AddContactMenuItem(&mi); CreateServiceFunction("CList/RenameContactCommand", MenuItem_RenameContact); mi.position = 2000050000; @@ -373,7 +373,7 @@ int LoadCLUIModule(void) mi.pszContactOwner = NULL; //on every contact mi.pszName = LPGEN("&Rename"); mi.pszService = "CList/RenameContactCommand"; - hRenameMenuItem = (HANDLE) CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM) & mi); + hRenameMenuItem = Menu_AddContactMenuItem(&mi); CreateServiceFunction("CList/AddToListContactCommand", MenuItem_AddContactToList); mi.position = -2050000000; @@ -381,7 +381,7 @@ int LoadCLUIModule(void) mi.icolibItem = GetSkinIconHandle( SKINICON_OTHER_ADDCONTACT ); mi.pszName = LPGEN("&Add permanently to list"); mi.pszService = "CList/AddToListContactCommand"; - CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM) & mi); + Menu_AddContactMenuItem(&mi); HookEvent(ME_CLIST_PREBUILDCONTACTMENU, MenuItem_PreBuild); } @@ -527,7 +527,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM return FALSE; case M_CREATECLC: - cli.hwndContactTree = CreateWindow( CLISTCONTROL_CLASS, _T(""), + cli.hwndContactTree = CreateWindow( CLISTCONTROL_CLASS, _T(""), WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | CLS_CONTACTLIST | (DBGetContactSettingByte(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT) ? CLS_USEGROUPS : 0) @@ -637,9 +637,9 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case WM_SETCURSOR: if (cluiopt.transparent) { if (!transparentFocus && GetForegroundWindow() != hwnd && setLayeredWindowAttributes) { - setLayeredWindowAttributes(hwnd, RGB(0,0,0), (BYTE)cluiopt.alpha, LWA_ALPHA); + setLayeredWindowAttributes(hwnd, RGB(0, 0, 0), (BYTE)cluiopt.alpha, LWA_ALPHA); transparentFocus=1; - SetTimer(hwnd, TM_AUTOALPHA,250,NULL); + SetTimer(hwnd, TM_AUTOALPHA, 250, NULL); } } return DefWindowProc(hwnd, msg, wParam, lParam); @@ -711,7 +711,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM thisTick = GetTickCount(); if (thisTick >= startTick + 200) break; - setLayeredWindowAttributes(hwnd, RGB(0, 0, 0), + setLayeredWindowAttributes(hwnd, RGB(0, 0, 0), (BYTE) (sourceAlpha + (destAlpha - sourceAlpha) * (int) (thisTick - startTick) / 200), LWA_ALPHA); } setLayeredWindowAttributes(hwnd, RGB(0, 0, 0), (BYTE) destAlpha, LWA_ALPHA); @@ -906,7 +906,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM if (rcWindow.bottom > rcWorkArea.bottom) rcWindow.bottom = rcWorkArea.bottom; } - SetWindowPos(hwnd, 0, rcWindow.left, rcWindow.top, rcWindow.right - rcWindow.left, rcWindow.bottom - rcWindow.top, + SetWindowPos(hwnd, 0, rcWindow.left, rcWindow.top, rcWindow.right - rcWindow.left, rcWindow.bottom - rcWindow.top, SWP_NOZORDER | SWP_NOACTIVATE); break; } @@ -1004,10 +1004,10 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM HMENU hMenu; hMenu = GetSubMenu(LoadMenu(cli.hInst, MAKEINTRESOURCE(IDR_CONTEXT)), 1); CallService(MS_LANGPACK_TRANSLATEMENU, (WPARAM) hMenu, 0); - CheckMenuItem(hMenu, POPUP_HIDEOFFLINE, + CheckMenuItem(hMenu, POPUP_HIDEOFFLINE, DBGetContactSettingByte(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT) ? MF_CHECKED : MF_UNCHECKED); CheckMenuItem(hMenu, POPUP_HIDEOFFLINEROOT, SendMessage(cli.hwndContactTree, CLM_GETHIDEOFFLINEROOT, 0, 0) ? MF_CHECKED : MF_UNCHECKED); - CheckMenuItem(hMenu, POPUP_HIDEEMPTYGROUPS, + CheckMenuItem(hMenu, POPUP_HIDEEMPTYGROUPS, GetWindowLongPtr(cli.hwndContactTree, GWL_STYLE) & CLS_HIDEEMPTYGROUPS ? MF_CHECKED : MF_UNCHECKED); CheckMenuItem(hMenu, POPUP_DISABLEGROUPS, GetWindowLongPtr(cli.hwndContactTree, GWL_STYLE) & CLS_USEGROUPS ? MF_UNCHECKED : MF_CHECKED); TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, hwnd, NULL); @@ -1047,15 +1047,15 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM x = dis->rcItem.left; if (showOpts & 1) { HICON hIcon = LoadSkinProtoIcon(szProto, status); - DrawIconEx(dis->hDC, x, (dis->rcItem.top + dis->rcItem.bottom - g_IconHeight) >> 1, hIcon, + DrawIconEx(dis->hDC, x, (dis->rcItem.top + dis->rcItem.bottom - g_IconHeight) >> 1, hIcon, g_IconWidth, g_IconHeight, 0, NULL, DI_NORMAL); - IconLib_ReleaseIcon(hIcon,0); + IconLib_ReleaseIcon(hIcon, 0); if ( Proto_IsAccountLocked( Proto_GetAccount( szProto ))) { hIcon = LoadSkinnedIcon(SKINICON_OTHER_STATUS_LOCKED); if (hIcon != NULL) { - DrawIconEx(dis->hDC, x, (dis->rcItem.top + dis->rcItem.bottom - g_IconHeight) >> 1, hIcon, + DrawIconEx(dis->hDC, x, (dis->rcItem.top + dis->rcItem.bottom - g_IconHeight) >> 1, hIcon, g_IconWidth, g_IconHeight, 0, NULL, DI_NORMAL); - IconLib_ReleaseIcon(hIcon,0); + IconLib_ReleaseIcon(hIcon, 0); } } diff --git a/src/modules/clist/cluiservices.cpp b/src/modules/clist/cluiservices.cpp index 2d8f06ab2f..d96f688997 100644 --- a/src/modules/clist/cluiservices.cpp +++ b/src/modules/clist/cluiservices.cpp @@ -2,7 +2,7 @@ Miranda IM: the free IM client for Microsoft* Windows* -Copyright 2000-2009 Miranda ICQ/IM project, +Copyright 2000-2009 Miranda ICQ/IM project, all portions of this codebase are copyrighted to the people listed in contributors.txt. @@ -11,7 +11,7 @@ modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. -This program is distributed in the hope that it will be useful, +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -135,7 +135,7 @@ static INT_PTR GetCaps(WPARAM wParam, LPARAM) void LoadCluiServices(void) { CreateServiceFunction(MS_CLUI_GETHWND, GetHwnd); - CreateServiceFunction(MS_CLUI_GETHWNDTREE,GetHwndTree); + CreateServiceFunction(MS_CLUI_GETHWNDTREE, GetHwndTree); CreateServiceFunction(MS_CLUI_PROTOCOLSTATUSCHANGED, CluiProtocolStatusChanged); CreateServiceFunction(MS_CLUI_GROUPADDED, GroupAdded); CreateServiceFunction(MS_CLUI_CONTACTSETICON, ContactSetIcon); diff --git a/src/modules/clist/contact.cpp b/src/modules/clist/contact.cpp index d122ef4836..c0b1c9e8d1 100644 --- a/src/modules/clist/contact.cpp +++ b/src/modules/clist/contact.cpp @@ -11,7 +11,7 @@ modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. -This program is distributed in the hope that it will be useful, +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -30,18 +30,18 @@ int sortByStatus; int sortByProto; static const struct { - int status,order; + int status, order; } statusModeOrder[]={ - {ID_STATUS_OFFLINE,500}, - {ID_STATUS_ONLINE,10}, - {ID_STATUS_AWAY,200}, - {ID_STATUS_DND,110}, - {ID_STATUS_NA,450}, - {ID_STATUS_OCCUPIED,100}, - {ID_STATUS_FREECHAT,0}, - {ID_STATUS_INVISIBLE,20}, - {ID_STATUS_ONTHEPHONE,150}, - {ID_STATUS_OUTTOLUNCH,425}}; + {ID_STATUS_OFFLINE, 500}, + {ID_STATUS_ONLINE, 10}, + {ID_STATUS_AWAY, 200}, + {ID_STATUS_DND, 110}, + {ID_STATUS_NA, 450}, + {ID_STATUS_OCCUPIED, 100}, + {ID_STATUS_FREECHAT, 0}, + {ID_STATUS_INVISIBLE, 20}, + {ID_STATUS_ONTHEPHONE, 150}, + {ID_STATUS_OUTTOLUNCH, 425}}; static int GetContactStatus(HANDLE hContact) { @@ -167,7 +167,7 @@ INT_PTR ContactChangeGroup(WPARAM wParam, LPARAM lParam) grpChg.pszNewName = cli.pfnGetGroupName(lParam, NULL); DBWriteContactSettingTString((HANDLE) wParam, "CList", "Group", grpChg.pszNewName); } - CallService(MS_CLUI_CONTACTADDED, wParam, + CallService(MS_CLUI_CONTACTADDED, wParam, cli.pfnIconFromStatusMode((char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0), GetContactStatus((HANDLE) wParam), (HANDLE) wParam)); NotifyEventHooks(hGroupChangeEvent, wParam, (LPARAM)&grpChg); @@ -184,7 +184,7 @@ int fnSetHideOffline(WPARAM wParam, LPARAM) DBWriteContactSettingByte(NULL, "CList", "HideOffline", 1); break; case -1: - DBWriteContactSettingByte(NULL, "CList", "HideOffline", + DBWriteContactSettingByte(NULL, "CList", "HideOffline", (BYTE) ! DBGetContactSettingByte(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT)); break; } diff --git a/src/modules/clist/genmenu.cpp b/src/modules/clist/genmenu.cpp index 73b3e972d5..13e9d61e46 100644 --- a/src/modules/clist/genmenu.cpp +++ b/src/modules/clist/genmenu.cpp @@ -2,7 +2,7 @@ Miranda IM: the free IM client for Microsoft* Windows* -Copyright 2000-2010 Miranda ICQ/IM project, +Copyright 2000-2010 Miranda ICQ/IM project, all portions of this codebase are copyrighted to the people listed in contributors.txt. @@ -11,7 +11,7 @@ modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. -This program is distributed in the hope that it will be useful, +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -115,7 +115,7 @@ int MO_MeasureMenuItem( LPMEASUREITEMSTRUCT mis ) if ( pimi->iconId == -1 ) return FALSE; - mis->itemWidth = max(0,GetSystemMetrics(SM_CXSMICON)-GetSystemMetrics(SM_CXMENUCHECK)+4); + mis->itemWidth = max(0, GetSystemMetrics(SM_CXSMICON)-GetSystemMetrics(SM_CXMENUCHECK)+4); mis->itemHeight = GetSystemMetrics(SM_CYSMICON)+2; return TRUE; } @@ -154,16 +154,16 @@ int MO_DrawMenuItem( LPDRAWITEMSTRUCT dis ) RECT rc; rc.left = 0; rc.right = GetSystemMetrics(SM_CXSMICON)+4; rc.top = y-2; rc.bottom = rc.top + GetSystemMetrics(SM_CYSMICON)+4; - DrawEdge(dis->hDC,&rc,BDR_SUNKENOUTER,BF_RECT); - InflateRect(&rc,-1,-1); + DrawEdge(dis->hDC, &rc, BDR_SUNKENOUTER, BF_RECT); + InflateRect(&rc, -1, -1); COLORREF menuCol = GetSysColor(COLOR_MENU); COLORREF hiliteCol = GetSysColor(COLOR_3DHIGHLIGHT); - HBRUSH hBrush = CreateSolidBrush(RGB((GetRValue(menuCol)+GetRValue(hiliteCol))/2,(GetGValue(menuCol)+GetGValue(hiliteCol))/2,(GetBValue(menuCol)+GetBValue(hiliteCol))/2)); - FillRect(dis->hDC,&rc,GetSysColorBrush(COLOR_MENU)); + HBRUSH hBrush = CreateSolidBrush(RGB((GetRValue(menuCol)+GetRValue(hiliteCol))/2, (GetGValue(menuCol)+GetGValue(hiliteCol))/2, (GetBValue(menuCol)+GetBValue(hiliteCol))/2)); + FillRect(dis->hDC, &rc, GetSysColorBrush(COLOR_MENU)); DeleteObject(hBrush); - ImageList_DrawEx(pimi->parent->m_hMenuIcons,pimi->iconId,dis->hDC,2,y,0,0,CLR_NONE,GetSysColor(COLOR_MENU),ILD_BLEND50); + ImageList_DrawEx(pimi->parent->m_hMenuIcons, pimi->iconId, dis->hDC, 2, y, 0, 0, CLR_NONE, GetSysColor(COLOR_MENU), ILD_BLEND50); } - else ImageList_DrawEx(pimi->parent->m_hMenuIcons,pimi->iconId,dis->hDC,2,y,0,0,CLR_NONE,CLR_NONE,ILD_NORMAL); + else ImageList_DrawEx(pimi->parent->m_hMenuIcons, pimi->iconId, dis->hDC, 2, y, 0, 0, CLR_NONE, CLR_NONE, ILD_NORMAL); } LeaveCriticalSection( &csMenuHook ); return TRUE; @@ -230,7 +230,7 @@ INT_PTR MO_ProcessHotKeys( HANDLE menuHandle, INT_PTR vKey ) return FALSE; } -INT_PTR MO_GetProtoRootMenu(WPARAM wParam,LPARAM lParam) +INT_PTR MO_GetProtoRootMenu(WPARAM wParam, LPARAM lParam) { char* szProto = ( char* )wParam; if ( szProto == NULL ) @@ -257,7 +257,7 @@ INT_PTR MO_GetProtoRootMenu(WPARAM wParam,LPARAM lParam) //wparam=MenuItemHandle //lparam=PMO_MenuItem -INT_PTR MO_GetMenuItem(WPARAM wParam,LPARAM lParam) +INT_PTR MO_GetMenuItem(WPARAM wParam, LPARAM lParam) { PMO_MenuItem mi = (PMO_MenuItem)lParam; if ( !bIsGenMenuInited || mi == NULL ) @@ -316,7 +316,7 @@ int MO_ModifyMenuItem( PMO_IntMenuItem menuHandle, PMO_MenuItem pmi ) if ( pmi->flags & CMIM_NAME ) { FreeAndNil(( void** )&pimi->mi.pszName ); -#if defined( _UNICODE ) + if ( pmi->flags & CMIF_UNICODE ) pimi->mi.ptszName = mir_tstrdup(( pmi->flags & CMIF_KEEPUNTRANSLATED ) ? pmi->ptszName : TranslateTS( pmi->ptszName )); else { @@ -328,9 +328,6 @@ int MO_ModifyMenuItem( PMO_IntMenuItem menuHandle, PMO_MenuItem pmi ) } else pimi->mi.ptszName = LangPackPcharToTchar( pmi->pszName ); } -#else - pimi->mi.ptszName = mir_strdup(( pmi->flags & CMIF_KEEPUNTRANSLATED ) ? pmi->ptszName : Translate( pmi->ptszName )); -#endif } if ( pmi->flags & CMIM_FLAGS ) { oldflags = pimi->mi.flags & ( CMIF_ROOTHANDLE | CMIF_ICONFROMICOLIB ); @@ -364,7 +361,7 @@ int MO_ModifyMenuItem( PMO_IntMenuItem menuHandle, PMO_MenuItem pmi ) } //wparam MenuItemHandle -//return ownerdata useful to free ownerdata before delete menu item, +//return ownerdata useful to free ownerdata before delete menu item, //NULL on error. INT_PTR MO_MenuItemGetOwnerData(WPARAM wParam, LPARAM) { @@ -432,7 +429,7 @@ int MO_ProcessCommandBySubMenuIdent(int menuID, int command, LPARAM lParam) return -1; } -INT_PTR MO_ProcessCommandByMenuIdent(WPARAM wParam,LPARAM lParam) +INT_PTR MO_ProcessCommandByMenuIdent(WPARAM wParam, LPARAM lParam) { if ( !bIsGenMenuInited ) return -1; @@ -656,18 +653,15 @@ PMO_IntMenuItem MO_AddNewMenuItem( HANDLE menuobjecthandle, PMO_MenuItem pmi ) p->iconId = -1; p->OverrideShow = TRUE; p->originalPosition = pmi->position; - #if defined( _UNICODE ) - if ( pmi->flags & CMIF_UNICODE ) - p->mi.ptszName = mir_tstrdup(( pmi->flags & CMIF_KEEPUNTRANSLATED ) ? pmi->ptszName : TranslateTS( pmi->ptszName )); - else { - if ( pmi->flags & CMIF_KEEPUNTRANSLATED ) - p->mi.ptszName = mir_a2u(pmi->pszName); - else - p->mi.ptszName = LangPackPcharToTchar( pmi->pszName ); - } - #else - p->mi.ptszName = mir_strdup(( pmi->flags & CMIF_KEEPUNTRANSLATED ) ? pmi->ptszName : Translate( pmi->ptszName )); - #endif + + if ( pmi->flags & CMIF_UNICODE ) + p->mi.ptszName = mir_tstrdup(( pmi->flags & CMIF_KEEPUNTRANSLATED ) ? pmi->ptszName : TranslateTS( pmi->ptszName )); + else { + if ( pmi->flags & CMIF_KEEPUNTRANSLATED ) + p->mi.ptszName = mir_a2u(pmi->pszName); + else + p->mi.ptszName = LangPackPcharToTchar( pmi->pszName ); + } if ( pmi->hIcon != NULL && !bIconsDisabled ) { if ( pmi->flags & CMIF_ICONFROMICOLIB ) { @@ -733,10 +727,10 @@ PMO_IntMenuItem MO_AddOldNewMenuItem( HANDLE menuobjecthandle, PMO_MenuItem pmi //is item with popup or not if ( pmi->root == 0 ) { - //yes,this without popup + //yes, this without popup pmi->root = NULL; //first level } - else { // no,search for needed root and create it if need + else { // no, search for needed root and create it if need TCHAR* tszRoot; #if defined( _UNICODE ) if ( pmi->flags & CMIF_UNICODE ) @@ -751,7 +745,7 @@ PMO_IntMenuItem MO_AddOldNewMenuItem( HANDLE menuobjecthandle, PMO_MenuItem pmi mir_free( tszRoot ); if ( oldroot == NULL ) { - //not found,creating root + //not found, creating root TMO_MenuItem tmi = { 0 }; tmi = *pmi; tmi.flags |= CMIF_ROOTHANDLE; @@ -871,7 +865,7 @@ static void InsertMenuItemWithSeparators(HMENU hMenu, int uItem, MENUITEMINFO *l //wparam started hMenu //lparam ListParam* //result hMenu -INT_PTR MO_BuildMenu(WPARAM wParam,LPARAM lParam) +INT_PTR MO_BuildMenu(WPARAM wParam, LPARAM lParam) { if ( !bIsGenMenuInited ) return -1; @@ -1029,7 +1023,7 @@ HMENU BuildRecursiveMenu(HMENU hMenu, PMO_IntMenuItem pRootMenu, ListParam *para #ifdef PUTPOSITIONSONMENU if ( GetKeyState(VK_CONTROL) & 0x8000) { TCHAR str[256]; - mir_sntprintf( str, SIZEOF(str), _T( "%s (%d,id %x)" ), mi->pszName, mi->position, mii.dwItemData ); + mir_sntprintf( str, SIZEOF(str), _T( "%s (%d, id %x)" ), mi->pszName, mi->position, mii.dwItemData ); mii.dwTypeData = str; } #endif @@ -1044,7 +1038,7 @@ HMENU BuildRecursiveMenu(HMENU hMenu, PMO_IntMenuItem pRootMenu, ListParam *para #ifdef PUTPOSITIONSONMENU if ( GetKeyState(VK_CONTROL) & 0x8000) { TCHAR str[256]; - mir_sntprintf( str, SIZEOF(str), _T("%s (%d,id %x)"), mi->pszName, mi->position, mii.dwItemData ); + mir_sntprintf( str, SIZEOF(str), _T("%s (%d, id %x)"), mi->pszName, mi->position, mii.dwItemData ); mii.dwTypeData = str; } #endif @@ -1069,7 +1063,7 @@ static int MO_ReloadIcon( PMO_IntMenuItem pmi, void* ) if ( newIcon ) ImageList_ReplaceIcon( pmi->parent->m_hMenuIcons, pmi->iconId, newIcon ); - IconLib_ReleaseIcon(newIcon,0); + IconLib_ReleaseIcon(newIcon, 0); } return FALSE; @@ -1120,7 +1114,7 @@ static int MO_RegisterIcon( PMO_IntMenuItem pmi, void* ) if (( start = strchr( start, '&' )) == NULL ) break; - memmove(start,start+1,strlen(start+1)+1); + memmove(start, start+1, strlen(start+1)+1); if (*start != '\0') start++; else break; } @@ -1170,7 +1164,7 @@ int TryProcessDoubleClick( HANDLE hContact ) { int iMenuID = GetMenuObjbyId( (int)hContactMenuObject ); if ( iMenuID != -1 ) { - NotifyEventHooks(hPreBuildContactMenuEvent,(WPARAM)hContact,0); + NotifyEventHooks(hPreBuildContactMenuEvent, (WPARAM)hContact, 0); PMO_IntMenuItem pimi = ( PMO_IntMenuItem )MO_GetDefaultMenuItem(( WPARAM )g_menus[ iMenuID ]->m_items.first, 0 ); if ( pimi != NULL ) { @@ -1195,7 +1189,7 @@ static VOID CALLBACK PostRegisterIcons( HWND, UINT, UINT_PTR, DWORD ) static int OnModulesLoaded(WPARAM, LPARAM) { posttimerid = SetTimer(( HWND )NULL, 0, 5, ( TIMERPROC )PostRegisterIcons ); - HookEvent(ME_SKIN2_ICONSCHANGED,OnIconLibChanges); + HookEvent(ME_SKIN2_ICONSCHANGED, OnIconLibChanges); return 0; } diff --git a/src/modules/clist/genmenu.h b/src/modules/clist/genmenu.h index 63c665b940..14d820575e 100644 --- a/src/modules/clist/genmenu.h +++ b/src/modules/clist/genmenu.h @@ -2,7 +2,7 @@ Miranda IM: the free IM client for Microsoft* Windows* -Copyright 2000-2010 Miranda ICQ/IM project, +Copyright 2000-2010 Miranda ICQ/IM project, all portions of this codebase are copyrighted to the people listed in contributors.txt. @@ -11,7 +11,7 @@ modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. -This program is distributed in the hope that it will be useful, +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -54,7 +54,7 @@ typedef struct _tagIntMenuItem TMO_LinkedList *owner; TMO_LinkedList submenu; } - TMO_IntMenuItem,*PMO_IntMenuItem; + TMO_IntMenuItem, *PMO_IntMenuItem; struct TIntMenuObject { @@ -118,7 +118,7 @@ INT_PTR MO_ProcessHotKeys( HANDLE menuHandle, INT_PTR vKey ); int MO_SetOptionsMenuItem( PMO_IntMenuItem menuobjecthandle, int setting, INT_PTR value ); int MO_SetOptionsMenuObject( HANDLE menuobjecthandle, int setting, INT_PTR value ); -INT_PTR MO_ProcessCommandByMenuIdent(WPARAM wParam,LPARAM lParam); +INT_PTR MO_ProcessCommandByMenuIdent(WPARAM wParam, LPARAM lParam); int MO_ProcessCommandBySubMenuIdent(int menuID, int command, LPARAM lParam); // function returns TRUE if the walk should be immediately stopped @@ -138,9 +138,9 @@ BOOL FindMenuHanleByGlobalID(HMENU hMenu, int globalID, struct _MenuItemHandles int GenMenuOptInit(WPARAM wParam, LPARAM lParam); int GetMenuObjbyId(const int id); -int GetMenuItembyId(const int objpos,const int id); -INT_PTR MO_GetMenuItem(WPARAM wParam,LPARAM lParam); +int GetMenuItembyId(const int objpos, const int id); +INT_PTR MO_GetMenuItem(WPARAM wParam, LPARAM lParam); void FreeAndNil(void **p); -static int RemoveFromList(int pos,void **lpList,int *ListElemCount,int ElemSize); -static int RemoveFromList(int pos,void **lpList,int *ListElemCount,int ElemSize); +static int RemoveFromList(int pos, void **lpList, int *ListElemCount, int ElemSize); +static int RemoveFromList(int pos, void **lpList, int *ListElemCount, int ElemSize); #endif diff --git a/src/modules/clist/genmenuopt.cpp b/src/modules/clist/genmenuopt.cpp index 84fbaa9e6a..421616b5e5 100644 --- a/src/modules/clist/genmenuopt.cpp +++ b/src/modules/clist/genmenuopt.cpp @@ -2,7 +2,7 @@ Miranda IM: the free IM client for Microsoft* Windows* -Copyright 2000-2010 Miranda ICQ/IM project, +Copyright 2000-2010 Miranda ICQ/IM project, all portions of this codebase are copyrighted to the people listed in contributors.txt. @@ -11,7 +11,7 @@ modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. -This program is distributed in the hope that it will be useful, +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -50,7 +50,7 @@ typedef struct tagMenuItemOptData PMO_IntMenuItem pimi; } - MenuItemOptData,*lpMenuItemOptData; + MenuItemOptData, *lpMenuItemOptData; static BOOL GetCurrentMenuObjectID(HWND hwndDlg, int* result) { @@ -130,7 +130,7 @@ static int SaveTree(HWND hwndDlg) static int BuildMenuObjectsTree(HWND hwndDlg) { TVINSERTSTRUCT tvis; - HWND hTree = GetDlgItem(hwndDlg,IDC_MENUOBJECTS); + HWND hTree = GetDlgItem(hwndDlg, IDC_MENUOBJECTS); int i; tvis.hParent = NULL; @@ -153,9 +153,9 @@ static int BuildMenuObjectsTree(HWND hwndDlg) return 1; } -static int sortfunc(const void *a,const void *b) +static int sortfunc(const void *a, const void *b) { - lpMenuItemOptData *sd1,*sd2; + lpMenuItemOptData *sd1, *sd2; sd1=(lpMenuItemOptData *)a; sd2=(lpMenuItemOptData *)b; if ((*sd1)->pos > (*sd2)->pos) @@ -203,7 +203,7 @@ static int InsertSeparator(HWND hwndDlg) static void FreeTreeData( HWND hwndDlg ) { - HTREEITEM hItem = TreeView_GetRoot(GetDlgItem(hwndDlg,IDC_MENUITEMS)); + HTREEITEM hItem = TreeView_GetRoot(GetDlgItem(hwndDlg, IDC_MENUITEMS)); while ( hItem != NULL ) { TVITEM tvi; tvi.mask = TVIF_HANDLE | TVIF_PARAM; @@ -217,18 +217,18 @@ static void FreeTreeData( HWND hwndDlg ) } tvi.lParam = 0; - TreeView_SetItem(GetDlgItem(hwndDlg,IDC_MENUITEMS), &tvi); + TreeView_SetItem(GetDlgItem(hwndDlg, IDC_MENUITEMS), &tvi); - hItem = TreeView_GetNextSibling(GetDlgItem(hwndDlg,IDC_MENUITEMS), hItem); + hItem = TreeView_GetNextSibling(GetDlgItem(hwndDlg, IDC_MENUITEMS), hItem); } } -static int BuildTree(HWND hwndDlg,int MenuObjectId, BOOL bReread) +static int BuildTree(HWND hwndDlg, int MenuObjectId, BOOL bReread) { - char menuItemName[256],MenuNameItems[256]; + char menuItemName[256], MenuNameItems[256]; char buf[256]; FreeTreeData( hwndDlg ); - TreeView_DeleteAllItems(GetDlgItem(hwndDlg,IDC_MENUITEMS)); + TreeView_DeleteAllItems(GetDlgItem(hwndDlg, IDC_MENUITEMS)); int menupos = GetMenuObjbyId( MenuObjectId ); if ( menupos == -1 ) @@ -319,7 +319,7 @@ static int BuildTree(HWND hwndDlg,int MenuObjectId, BOOL bReread) HTREEITEM hti = (HTREEITEM)SendDlgItemMessage(hwndDlg, IDC_MENUITEMS, TVM_INSERTITEM, 0, (LPARAM)&tvis); if ( first ) { - TreeView_SelectItem(GetDlgItem(hwndDlg,IDC_MENUITEMS),hti); + TreeView_SelectItem(GetDlgItem(hwndDlg, IDC_MENUITEMS), hti); first=FALSE; } @@ -328,7 +328,7 @@ static int BuildTree(HWND hwndDlg,int MenuObjectId, BOOL bReread) SendDlgItemMessage( hwndDlg, IDC_MENUITEMS, WM_SETREDRAW, TRUE, 0 ); mir_free( PDar ); - ShowWindow( GetDlgItem( hwndDlg, IDC_NOTSUPPORTWARNING ),( pimo->m_bUseUserDefinedItems ) ? SW_HIDE : SW_SHOW ); + ShowWindow( GetDlgItem( hwndDlg, IDC_NOTSUPPORTWARNING ), ( pimo->m_bUseUserDefinedItems ) ? SW_HIDE : SW_SHOW ); EnableWindow( GetDlgItem( hwndDlg, IDC_MENUITEMS ), pimo->m_bUseUserDefinedItems ); EnableWindow( GetDlgItem( hwndDlg, IDC_INSERTSEPARATOR ), pimo->m_bUseUserDefinedItems ); return 1; @@ -369,7 +369,7 @@ static HTREEITEM MoveItemAbove(HWND hTreeWnd, HTREEITEM hItem, HTREEITEM hInsert tvis.item.iImage = tvis.item.iSelectedImage = (( MenuItemOptData* )tvi.lParam)->show; if (!SendMessage(hTreeWnd, TVM_GETITEM, 0, (LPARAM)&tvis.item)) return NULL; - if (!TreeView_DeleteItem(hTreeWnd,hItem)) + if (!TreeView_DeleteItem(hTreeWnd, hItem)) return NULL; tvis.hParent=NULL; tvis.hInsertAfter=hInsertAfter; @@ -380,16 +380,16 @@ static HTREEITEM MoveItemAbove(HWND hTreeWnd, HTREEITEM hItem, HTREEITEM hInsert WNDPROC MyOldWindowProc=NULL; -LRESULT CALLBACK LBTNDOWNProc(HWND hwnd,UINT uMsg, WPARAM wParam, LPARAM lParam) +LRESULT CALLBACK LBTNDOWNProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { if (uMsg == WM_LBUTTONDOWN && !(GetKeyState(VK_CONTROL)&0x8000)) { TVHITTESTINFO hti; hti.pt.x=(short)LOWORD(lParam); hti.pt.y=(short)HIWORD(lParam); - // ClientToScreen(hwndDlg,&hti.pt); - // ScreenToClient(GetDlgItem(hwndDlg,IDC_MENUITEMS),&hti.pt); - TreeView_HitTest(hwnd,&hti); + // ClientToScreen(hwndDlg, &hti.pt); + // ScreenToClient(GetDlgItem(hwndDlg, IDC_MENUITEMS), &hti.pt); + TreeView_HitTest(hwnd, &hti); if (hti.flags&TVHT_ONITEMLABEL) { /// LabelClicked Set/unset selection TVITEM tvi; @@ -415,36 +415,36 @@ LRESULT CALLBACK LBTNDOWNProc(HWND hwnd,UINT uMsg, WPARAM wParam, LPARAM lParam) ((MenuItemOptData *)tvi.lParam)->isSelected=1; TreeView_SetItem(tvw, &tvi); } - while (hit=TreeView_GetNextSibling(tvw,hit)); + while (hit=TreeView_GetNextSibling(tvw, hit)); } } } - return CallWindowProc(MyOldWindowProc,hwnd,uMsg,wParam,lParam); + return CallWindowProc(MyOldWindowProc, hwnd, uMsg, wParam, lParam); } static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { - struct OrderData *dat = (struct OrderData*)GetWindowLongPtr(GetDlgItem(hwndDlg,IDC_MENUITEMS),GWLP_USERDATA); + struct OrderData *dat = (struct OrderData*)GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_MENUITEMS), GWLP_USERDATA); LPNMHDR hdr; switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); dat=(struct OrderData*)mir_alloc(sizeof(struct OrderData)); - SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_MENUITEMS),GWLP_USERDATA,(LONG_PTR)dat); + SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_MENUITEMS), GWLP_USERDATA, (LONG_PTR)dat); dat->dragging = 0; dat->iInitMenuValue = DBGetContactSettingByte( NULL, "CList", "MoveProtoMenus", TRUE ); - MyOldWindowProc = (WNDPROC)GetWindowLongPtr(GetDlgItem(hwndDlg,IDC_MENUITEMS),GWLP_WNDPROC); - SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_MENUITEMS),GWLP_WNDPROC,(LONG_PTR)&LBTNDOWNProc); + MyOldWindowProc = (WNDPROC)GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_MENUITEMS), GWLP_WNDPROC); + SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_MENUITEMS), GWLP_WNDPROC, (LONG_PTR)&LBTNDOWNProc); { HIMAGELIST himlCheckBoxes; - himlCheckBoxes=ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), + himlCheckBoxes=ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), (IsWinVerXPPlus() ? ILC_COLOR32 : ILC_COLOR16) | ILC_MASK, 2, 2); ImageList_AddIcon_IconLibLoaded(himlCheckBoxes, SKINICON_OTHER_NOTICK); ImageList_AddIcon_IconLibLoaded(himlCheckBoxes, SKINICON_OTHER_TICK); - TreeView_SetImageList(GetDlgItem(hwndDlg,IDC_MENUOBJECTS),himlCheckBoxes,TVSIL_NORMAL); - TreeView_SetImageList(GetDlgItem(hwndDlg,IDC_MENUITEMS),himlCheckBoxes,TVSIL_NORMAL); + TreeView_SetImageList(GetDlgItem(hwndDlg, IDC_MENUOBJECTS), himlCheckBoxes, TVSIL_NORMAL); + TreeView_SetImageList(GetDlgItem(hwndDlg, IDC_MENUITEMS), himlCheckBoxes, TVSIL_NORMAL); } CheckDlgButton(hwndDlg, dat->iInitMenuValue ? IDC_RADIO2 : IDC_RADIO1, TRUE ); CheckDlgButton(hwndDlg, IDC_DISABLEMENUICONS, bIconsDisabled ); @@ -476,13 +476,13 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA HTREEITEM hti; MenuItemOptData *iod; - hti=TreeView_GetSelection(GetDlgItem(hwndDlg,IDC_MENUITEMS)); + hti=TreeView_GetSelection(GetDlgItem(hwndDlg, IDC_MENUITEMS)); if (hti == NULL) break; tvi.mask=TVIF_HANDLE|TVIF_IMAGE|TVIF_SELECTEDIMAGE|TVIF_PARAM; tvi.hItem=hti; - TreeView_GetItem(GetDlgItem(hwndDlg,IDC_MENUITEMS),&tvi); + TreeView_GetItem(GetDlgItem(hwndDlg, IDC_MENUITEMS), &tvi); iod = ( MenuItemOptData * )tvi.lParam; if ( iod->name && _tcsstr( iod->name, STR_SEPARATOR )) @@ -504,7 +504,7 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA TCHAR buf[256]; MenuItemOptData *iod; - HTREEITEM hti = TreeView_GetSelection( GetDlgItem( hwndDlg,IDC_MENUITEMS )); + HTREEITEM hti = TreeView_GetSelection( GetDlgItem( hwndDlg, IDC_MENUITEMS )); if ( hti == NULL ) break; @@ -516,7 +516,7 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA if ( iod->name && _tcsstr(iod->name, STR_SEPARATOR )) break; - ZeroMemory(buf,sizeof( buf )); + ZeroMemory(buf, sizeof( buf )); GetDlgItemText( hwndDlg, IDC_GENMENU_CUSTOMNAME, buf, SIZEOF( buf )); if (iod->name) mir_free(iod->name); @@ -557,7 +557,7 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA switch (hdr->code) { case NM_CUSTOMDRAW: { - int i= handleCustomDraw(GetDlgItem(hwndDlg,IDC_MENUITEMS),(LPNMTVCUSTOMDRAW) lParam); + int i= handleCustomDraw(GetDlgItem(hwndDlg, IDC_MENUITEMS), (LPNMTVCUSTOMDRAW) lParam); SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, i); return TRUE; } @@ -566,7 +566,7 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA SetCapture(hwndDlg); dat->dragging=1; dat->hDragItem=((LPNMTREEVIEW)lParam)->itemNew.hItem; - TreeView_SelectItem(GetDlgItem(hwndDlg,IDC_MENUITEMS),dat->hDragItem); + TreeView_SelectItem(GetDlgItem(hwndDlg, IDC_MENUITEMS), dat->hDragItem); break; case NM_CLICK: @@ -574,21 +574,21 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA TVHITTESTINFO hti; hti.pt.x=(short)LOWORD(GetMessagePos()); hti.pt.y=(short)HIWORD(GetMessagePos()); - ScreenToClient(hdr->hwndFrom,&hti.pt); - if (TreeView_HitTest(hdr->hwndFrom,&hti)) { + ScreenToClient(hdr->hwndFrom, &hti.pt); + if (TreeView_HitTest(hdr->hwndFrom, &hti)) { if (hti.flags&TVHT_ONITEMICON) { TVITEM tvi; tvi.mask=TVIF_HANDLE|TVIF_IMAGE|TVIF_SELECTEDIMAGE|TVIF_PARAM; tvi.hItem=hti.hItem; - TreeView_GetItem(hdr->hwndFrom,&tvi); + TreeView_GetItem(hdr->hwndFrom, &tvi); tvi.iImage=tvi.iSelectedImage=!tvi.iImage; ((MenuItemOptData *)tvi.lParam)->show=tvi.iImage; - TreeView_SetItem(hdr->hwndFrom,&tvi); + TreeView_SetItem(hdr->hwndFrom, &tvi); SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); //all changes take effect in runtime - //ShowWindow(GetDlgItem(hwndDlg,IDC_BUTTONORDERTREEWARNING),SW_SHOW); + //ShowWindow(GetDlgItem(hwndDlg, IDC_BUTTONORDERTREEWARNING), SW_SHOW); } /*--------MultiSelection----------*/ if (hti.flags&TVHT_ONITEMLABEL) { @@ -597,13 +597,13 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA HWND tvw=hdr->hwndFrom; tvi.mask=TVIF_HANDLE|TVIF_PARAM; tvi.hItem=hti.hItem; - TreeView_GetItem(tvw,&tvi); + TreeView_GetItem(tvw, &tvi); if (GetKeyState(VK_CONTROL)&0x8000) { if (((MenuItemOptData *)tvi.lParam)->isSelected) ((MenuItemOptData *)tvi.lParam)->isSelected=0; else ((MenuItemOptData *)tvi.lParam)->isSelected=1; //current selection order++. - TreeView_SetItem(tvw,&tvi); + TreeView_SetItem(tvw, &tvi); } else if (GetKeyState(VK_SHIFT)&0x8000) { ; // shifted click @@ -617,15 +617,15 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA TVITEM tvi={0}; tvi.mask=TVIF_HANDLE|TVIF_PARAM; tvi.hItem=hit; - TreeView_GetItem(tvw,&tvi); + TreeView_GetItem(tvw, &tvi); if (hti.hItem != hit) ((MenuItemOptData *)tvi.lParam)->isSelected=0; else ((MenuItemOptData *)tvi.lParam)->isSelected=1; - TreeView_SetItem(tvw,&tvi); + TreeView_SetItem(tvw, &tvi); } - while (hit=TreeView_GetNextSibling(tvw,hit)); + while (hit=TreeView_GetNextSibling(tvw, hit)); } } } break; } @@ -646,20 +646,20 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA HTREEITEM hti; MenuItemOptData *iod; - SetDlgItemTextA(hwndDlg,IDC_GENMENU_CUSTOMNAME,""); - SetDlgItemTextA(hwndDlg,IDC_GENMENU_SERVICE,""); + SetDlgItemTextA(hwndDlg, IDC_GENMENU_CUSTOMNAME, ""); + SetDlgItemTextA(hwndDlg, IDC_GENMENU_SERVICE, ""); - EnableWindow(GetDlgItem(hwndDlg,IDC_GENMENU_CUSTOMNAME),FALSE); - EnableWindow(GetDlgItem(hwndDlg,IDC_GENMENU_DEFAULT),FALSE); - EnableWindow(GetDlgItem(hwndDlg,IDC_GENMENU_SET),FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_GENMENU_CUSTOMNAME), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_GENMENU_DEFAULT), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_GENMENU_SET), FALSE); - hti=TreeView_GetSelection(GetDlgItem(hwndDlg,IDC_MENUITEMS)); + hti=TreeView_GetSelection(GetDlgItem(hwndDlg, IDC_MENUITEMS)); if (hti == NULL) break; tvi.mask=TVIF_HANDLE|TVIF_IMAGE|TVIF_SELECTEDIMAGE|TVIF_PARAM; tvi.hItem=hti; - TreeView_GetItem(GetDlgItem(hwndDlg,IDC_MENUITEMS),&tvi); + TreeView_GetItem(GetDlgItem(hwndDlg, IDC_MENUITEMS), &tvi); if ( tvi.lParam == 0 ) break; @@ -669,14 +669,14 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA if ( iod->name && _tcsstr(iod->name, STR_SEPARATOR)) break; - SetDlgItemText(hwndDlg,IDC_GENMENU_CUSTOMNAME,iod->name); + SetDlgItemText(hwndDlg, IDC_GENMENU_CUSTOMNAME, iod->name); if (iod->pimi->submenu.first == NULL && iod->uniqname) SetDlgItemTextA(hwndDlg, IDC_GENMENU_SERVICE, iod->uniqname); - EnableWindow(GetDlgItem(hwndDlg,IDC_GENMENU_DEFAULT), lstrcmp(iod->name, iod->defname) != 0); - EnableWindow(GetDlgItem(hwndDlg,IDC_GENMENU_SET),TRUE); - EnableWindow(GetDlgItem(hwndDlg,IDC_GENMENU_CUSTOMNAME),TRUE); + EnableWindow(GetDlgItem(hwndDlg, IDC_GENMENU_DEFAULT), lstrcmp(iod->name, iod->defname) != 0); + EnableWindow(GetDlgItem(hwndDlg, IDC_GENMENU_SET), TRUE); + EnableWindow(GetDlgItem(hwndDlg, IDC_GENMENU_CUSTOMNAME), TRUE); break; } break; @@ -690,22 +690,22 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA hti.pt.x=(short)LOWORD(lParam); hti.pt.y=(short)HIWORD(lParam); - ClientToScreen(hwndDlg,&hti.pt); - ScreenToClient(GetDlgItem(hwndDlg,IDC_MENUITEMS),&hti.pt); - TreeView_HitTest(GetDlgItem(hwndDlg,IDC_MENUITEMS),&hti); + ClientToScreen(hwndDlg, &hti.pt); + ScreenToClient(GetDlgItem(hwndDlg, IDC_MENUITEMS), &hti.pt); + TreeView_HitTest(GetDlgItem(hwndDlg, IDC_MENUITEMS), &hti); if (hti.flags&(TVHT_ONITEM|TVHT_ONITEMRIGHT)) { HTREEITEM it = hti.hItem; - hti.pt.y -= TreeView_GetItemHeight(GetDlgItem(hwndDlg,IDC_MENUITEMS))/2; - TreeView_HitTest(GetDlgItem(hwndDlg,IDC_MENUITEMS),&hti); + hti.pt.y -= TreeView_GetItemHeight(GetDlgItem(hwndDlg, IDC_MENUITEMS))/2; + TreeView_HitTest(GetDlgItem(hwndDlg, IDC_MENUITEMS), &hti); if (!(hti.flags&TVHT_ABOVE)) - TreeView_SetInsertMark(GetDlgItem(hwndDlg,IDC_MENUITEMS),hti.hItem,1); + TreeView_SetInsertMark(GetDlgItem(hwndDlg, IDC_MENUITEMS), hti.hItem, 1); else - TreeView_SetInsertMark(GetDlgItem(hwndDlg,IDC_MENUITEMS),it,0); + TreeView_SetInsertMark(GetDlgItem(hwndDlg, IDC_MENUITEMS), it, 0); } else { - if (hti.flags&TVHT_ABOVE) SendDlgItemMessage(hwndDlg,IDC_MENUITEMS,WM_VSCROLL,MAKEWPARAM(SB_LINEUP,0),0); - if (hti.flags&TVHT_BELOW) SendDlgItemMessage(hwndDlg,IDC_MENUITEMS,WM_VSCROLL,MAKEWPARAM(SB_LINEDOWN,0),0); - TreeView_SetInsertMark(GetDlgItem(hwndDlg,IDC_MENUITEMS),NULL,0); + if (hti.flags&TVHT_ABOVE) SendDlgItemMessage(hwndDlg, IDC_MENUITEMS, WM_VSCROLL, MAKEWPARAM(SB_LINEUP, 0), 0); + if (hti.flags&TVHT_BELOW) SendDlgItemMessage(hwndDlg, IDC_MENUITEMS, WM_VSCROLL, MAKEWPARAM(SB_LINEDOWN, 0), 0); + TreeView_SetInsertMark(GetDlgItem(hwndDlg, IDC_MENUITEMS), NULL, 0); } } break; @@ -713,17 +713,17 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA if (!dat->dragging) break; - TreeView_SetInsertMark(GetDlgItem(hwndDlg,IDC_MENUITEMS),NULL,0); + TreeView_SetInsertMark(GetDlgItem(hwndDlg, IDC_MENUITEMS), NULL, 0); dat->dragging=0; ReleaseCapture(); { TVHITTESTINFO hti; hti.pt.x=(short)LOWORD(lParam); hti.pt.y=(short)HIWORD(lParam); - ClientToScreen(hwndDlg,&hti.pt); - ScreenToClient(GetDlgItem(hwndDlg,IDC_MENUITEMS),&hti.pt); - hti.pt.y-=TreeView_GetItemHeight(GetDlgItem(hwndDlg,IDC_MENUITEMS))/2; - TreeView_HitTest(GetDlgItem(hwndDlg,IDC_MENUITEMS),&hti); + ClientToScreen(hwndDlg, &hti.pt); + ScreenToClient(GetDlgItem(hwndDlg, IDC_MENUITEMS), &hti.pt); + hti.pt.y-=TreeView_GetItemHeight(GetDlgItem(hwndDlg, IDC_MENUITEMS))/2; + TreeView_HitTest(GetDlgItem(hwndDlg, IDC_MENUITEMS), &hti); if (hti.flags&TVHT_ABOVE) hti.hItem=TVI_FIRST; if (dat->hDragItem == hti.hItem) break; dat->hDragItem=NULL; @@ -731,8 +731,8 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA HWND tvw; HTREEITEM * pSIT; HTREEITEM FirstItem=NULL; - UINT uITCnt,uSic ; - tvw=GetDlgItem(hwndDlg,IDC_MENUITEMS); + UINT uITCnt, uSic ; + tvw=GetDlgItem(hwndDlg, IDC_MENUITEMS); uITCnt=TreeView_GetCount(tvw); uSic=0; if (uITCnt) { @@ -745,20 +745,20 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA TVITEM tvi={0}; tvi.mask=TVIF_HANDLE|TVIF_PARAM; tvi.hItem=hit; - TreeView_GetItem(tvw,&tvi); + TreeView_GetItem(tvw, &tvi); if (((MenuItemOptData *)tvi.lParam)->isSelected) { pSIT[uSic]=tvi.hItem; uSic++; } - }while (hit=TreeView_GetNextSibling(tvw,hit)); + }while (hit=TreeView_GetNextSibling(tvw, hit)); // Proceed moving { UINT i; HTREEITEM insertAfter; insertAfter=hti.hItem; for (i=0; inmcd.hdc,tvi.pszText,lstrlen(tvi.pszText),&sz); + GetTextExtentPoint32(pNMTVCD->nmcd.hdc, tvi.pszText, lstrlen(tvi.pszText), &sz); if (sz.cx+3>pNMTVCD->nmcd.rc.right-pNMTVCD->nmcd.rc.left) rc=pNMTVCD->nmcd.rc; - else SetRect(&rc,pNMTVCD->nmcd.rc.left,pNMTVCD->nmcd.rc.top,pNMTVCD->nmcd.rc.left+sz.cx+3,pNMTVCD->nmcd.rc.bottom); + else SetRect(&rc, pNMTVCD->nmcd.rc.left, pNMTVCD->nmcd.rc.top, pNMTVCD->nmcd.rc.left+sz.cx+3, pNMTVCD->nmcd.rc.bottom); br=CreateSolidBrush(pNMTVCD->clrTextBk); - SetTextColor(pNMTVCD->nmcd.hdc,pNMTVCD->clrText); - SetBkColor(pNMTVCD->nmcd.hdc,pNMTVCD->clrTextBk); - FillRect(pNMTVCD->nmcd.hdc,&rc,br); + SetTextColor(pNMTVCD->nmcd.hdc, pNMTVCD->clrText); + SetBkColor(pNMTVCD->nmcd.hdc, pNMTVCD->clrTextBk); + FillRect(pNMTVCD->nmcd.hdc, &rc, br); DeleteObject(br); - DrawText(pNMTVCD->nmcd.hdc,tvi.pszText,lstrlen(tvi.pszText),&pNMTVCD->nmcd.rc,DT_LEFT|DT_VCENTER|DT_NOPREFIX); + DrawText(pNMTVCD->nmcd.hdc, tvi.pszText, lstrlen(tvi.pszText), &pNMTVCD->nmcd.rc, DT_LEFT|DT_VCENTER|DT_NOPREFIX); } return CDRF_NEWFONT|(k?CDRF_SKIPDEFAULT:0); diff --git a/src/modules/clist/groups.cpp b/src/modules/clist/groups.cpp index ddf7c287b4..c958823ebb 100644 --- a/src/modules/clist/groups.cpp +++ b/src/modules/clist/groups.cpp @@ -2,7 +2,7 @@ Miranda IM: the free IM client for Microsoft* Windows* -Copyright 2000-2009 Miranda ICQ/IM project, +Copyright 2000-2009 Miranda ICQ/IM project, all portions of this codebase are copyrighted to the people listed in contributors.txt. @@ -11,7 +11,7 @@ modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. -This program is distributed in the hope that it will be useful, +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. diff --git a/src/modules/clist/keyboard.cpp b/src/modules/clist/keyboard.cpp index e02abed203..cb8a428f22 100644 --- a/src/modules/clist/keyboard.cpp +++ b/src/modules/clist/keyboard.cpp @@ -2,7 +2,7 @@ Miranda IM: the free IM client for Microsoft* Windows* -Copyright 2000-2009 Miranda ICQ/IM project, +Copyright 2000-2009 Miranda ICQ/IM project, all portions of this codebase are copyrighted to the people listed in contributors.txt. @@ -11,7 +11,7 @@ modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. -This program is distributed in the hope that it will be useful, +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -26,15 +26,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static INT_PTR hkHideShow(WPARAM, LPARAM) { - cli.pfnShowHide(0,0); + cli.pfnShowHide(0, 0); return 0; } /* -INT_PTR hkSearch(WPARAM wParam,LPARAM lParam) +INT_PTR hkSearch(WPARAM wParam, LPARAM lParam) { DBVARIANT dbv={0}; - if (!DBGetContactSettingString(NULL,"CList","SearchUrl",&dbv)) { - CallService(MS_UTILS_OPENURL,DBGetContactSettingByte(NULL,"CList","HKSearchNewWnd",0),(LPARAM)dbv.pszVal); + if (!DBGetContactSettingString(NULL, "CList", "SearchUrl", &dbv)) { + CallService(MS_UTILS_OPENURL, DBGetContactSettingByte(NULL, "CList", "HKSearchNewWnd", 0), (LPARAM)dbv.pszVal); DBFreeVariant(&dbv); } return 0; @@ -50,17 +50,17 @@ static INT_PTR hkRead(WPARAM, LPARAM) static INT_PTR hkOpts(WPARAM, LPARAM) { - CallService("Options/OptionsCommand",0, 0); + CallService("Options/OptionsCommand", 0, 0); return 0; } /* -static INT_PTR hkCloseMiranda(WPARAM wParam,LPARAM lParam) +static INT_PTR hkCloseMiranda(WPARAM wParam, LPARAM lParam) { CallService("CloseAction", 0, 0); return 0; } -INT_PTR hkRestoreStatus(WPARAM wParam,LPARAM lParam) +INT_PTR hkRestoreStatus(WPARAM wParam, LPARAM lParam) { int nStatus = DBGetContactSettingWord(NULL, "CList", "Status", ID_STATUS_OFFLINE); CallService(MS_CLIST_SETSTATUSMODE, nStatus, 0); @@ -77,12 +77,12 @@ int InitClistHotKeys(void) { HOTKEYDESC shk = {0}; - CreateServiceFunction("CLIST/HK/SHOWHIDE",hkHideShow); - CreateServiceFunction("CLIST/HK/Opts",hkOpts); - CreateServiceFunction("CLIST/HK/Read",hkRead); -// CreateServiceFunction("CLIST/HK/CloseMiranda",hkCloseMiranda); -// CreateServiceFunction("CLIST/HK/RestoreStatus",hkRestoreStatus); -// CreateServiceFunction("CLIST/HK/AllOffline",hkAllOffline); + CreateServiceFunction("CLIST/HK/SHOWHIDE", hkHideShow); + CreateServiceFunction("CLIST/HK/Opts", hkOpts); + CreateServiceFunction("CLIST/HK/Read", hkRead); +// CreateServiceFunction("CLIST/HK/CloseMiranda", hkCloseMiranda); +// CreateServiceFunction("CLIST/HK/RestoreStatus", hkRestoreStatus); +// CreateServiceFunction("CLIST/HK/AllOffline", hkAllOffline); shk.cbSize=sizeof(shk); shk.pszDescription="Show Hide Contact List"; @@ -90,42 +90,42 @@ int InitClistHotKeys(void) shk.pszSection="Main"; shk.pszService="CLIST/HK/SHOWHIDE"; shk.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL|HOTKEYF_SHIFT, 'A'); - CallService(MS_HOTKEY_REGISTER,0,(LPARAM)&shk); + CallService(MS_HOTKEY_REGISTER, 0, (LPARAM)&shk); shk.pszDescription="Read Message"; shk.pszName="ReadMessage"; shk.pszSection="Main"; shk.pszService="CLIST/HK/Read"; shk.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL|HOTKEYF_SHIFT, 'I'); - CallService(MS_HOTKEY_REGISTER,0,(LPARAM)&shk); + CallService(MS_HOTKEY_REGISTER, 0, (LPARAM)&shk); /* shk.pszDescription="Search in site"; shk.pszName="SearchInWeb"; shk.pszSection="Main"; shk.pszService="CLIST/HK/Search"; shk.DefHotKey=846; - CallService(MS_HOTKEY_REGISTER,0,(LPARAM)&shk); + CallService(MS_HOTKEY_REGISTER, 0, (LPARAM)&shk); */ shk.pszDescription = "Open Options Page"; shk.pszName = "ShowOptions"; shk.pszSection = "Main"; shk.pszService = "CLIST/HK/Opts"; shk.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL|HOTKEYF_SHIFT, 'O') | HKF_MIRANDA_LOCAL; - CallService(MS_HOTKEY_REGISTER,0,(LPARAM)&shk); + CallService(MS_HOTKEY_REGISTER, 0, (LPARAM)&shk); shk.pszDescription = "Open Logging Options"; shk.pszName = "ShowLogOptions"; shk.pszSection = "Main"; shk.pszService = "Netlib/Log/Win"; shk.DefHotKey = 0; - CallService(MS_HOTKEY_REGISTER,0,(LPARAM)&shk); + CallService(MS_HOTKEY_REGISTER, 0, (LPARAM)&shk); shk.pszDescription="Open Find User Dialog"; shk.pszName="FindUsers"; shk.pszSection="Main"; shk.pszService="FindAdd/FindAddCommand"; shk.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL|HOTKEYF_SHIFT, 'F') | HKF_MIRANDA_LOCAL; - CallService(MS_HOTKEY_REGISTER,0,(LPARAM)&shk); + CallService(MS_HOTKEY_REGISTER, 0, (LPARAM)&shk); /* shk.pszDescription="Close Miranda"; @@ -133,21 +133,21 @@ int InitClistHotKeys(void) shk.pszSection="Main"; shk.pszService="CLIST/HK/CloseMiranda"; shk.DefHotKey=0; - CallService(MS_HOTKEY_REGISTER,0,(LPARAM)&shk); + CallService(MS_HOTKEY_REGISTER, 0, (LPARAM)&shk); shk.pszDescription="Restore last status"; shk.pszName="RestoreLastStatus"; shk.pszSection="Status"; shk.pszService="CLIST/HK/RestoreStatus"; shk.DefHotKey=0; - CallService(MS_HOTKEY_REGISTER,0,(LPARAM)&shk); + CallService(MS_HOTKEY_REGISTER, 0, (LPARAM)&shk); shk.pszDescription="Set All Offline"; shk.pszName="AllOffline"; shk.pszSection="Status"; shk.pszService="CLIST/HK/AllOffline"; shk.DefHotKey=0; - CallService(MS_HOTKEY_REGISTER,0,(LPARAM)&shk); + CallService(MS_HOTKEY_REGISTER, 0, (LPARAM)&shk); */ return 0; } diff --git a/src/modules/clist/movetogroup.cpp b/src/modules/clist/movetogroup.cpp index 4cdda53de8..5fd05e87a0 100644 --- a/src/modules/clist/movetogroup.cpp +++ b/src/modules/clist/movetogroup.cpp @@ -2,7 +2,7 @@ Miranda IM: the free IM client for Microsoft* Windows* -Copyright 2000-2010 Miranda ICQ/IM project, +Copyright 2000-2010 Miranda ICQ/IM project, all portions of this codebase are copyrighted to the people listed in contributors.txt. @@ -11,7 +11,7 @@ modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. -This program is distributed in the hope that it will be useful, +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -76,13 +76,13 @@ static void AddGroupItem(HGENMENU hRoot, TCHAR* name, int pos, WPARAM param, boo if ( checked ) mi.flags |= CMIF_CHECKED; mi.pszService = MTG_MOVE; - HANDLE result = ( HANDLE )CallService(MS_CLIST_ADDCONTACTMENUITEM, param, (LPARAM)&mi); + HANDLE result = Menu_AddContactMenuItem(&mi); mir_free( mi.ptszName ); lphGroupsItems.insert((HANDLE*)result); } -static int OnContactMenuBuild(WPARAM wParam,LPARAM) +static int OnContactMenuBuild(WPARAM wParam, LPARAM) { int i; OBJLIST groups(10, GroupItemSort::compare); @@ -97,7 +97,7 @@ static int OnContactMenuBuild(WPARAM wParam,LPARAM) mi.flags = CMIF_ROOTHANDLE | CMIF_ICONFROMICOLIB; mi.icolibItem = GetSkinIconHandle(SKINICON_OTHER_GROUP); - hMoveToGroupItem = (HGENMENU)CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM)&mi); + hMoveToGroupItem = Menu_AddContactMenuItem(&mi); } for (i = 0; i < lphGroupsItems.getCount(); i++) @@ -139,7 +139,7 @@ static int OnContactMenuBuild(WPARAM wParam,LPARAM) return 0; } -static INT_PTR MTG_DOMOVE(WPARAM wParam,LPARAM lParam) +static INT_PTR MTG_DOMOVE(WPARAM wParam, LPARAM lParam) { CallService(MS_CLIST_CONTACTCHANGEGROUP, wParam, lParam < 0 ? 0 : lParam); return 0; @@ -147,8 +147,8 @@ static INT_PTR MTG_DOMOVE(WPARAM wParam,LPARAM lParam) void MTG_OnmodulesLoad() { - hOnCntMenuBuild=HookEvent(ME_CLIST_PREBUILDCONTACTMENU,OnContactMenuBuild); - CreateServiceFunction(MTG_MOVE,MTG_DOMOVE); + hOnCntMenuBuild=HookEvent(ME_CLIST_PREBUILDCONTACTMENU, OnContactMenuBuild); + CreateServiceFunction(MTG_MOVE, MTG_DOMOVE); } int UnloadMoveToGroup(void) diff --git a/src/modules/clist/protocolorder.cpp b/src/modules/clist/protocolorder.cpp index c40792a095..41a5b5beba 100644 --- a/src/modules/clist/protocolorder.cpp +++ b/src/modules/clist/protocolorder.cpp @@ -2,7 +2,7 @@ Miranda IM: the free IM client for Microsoft* Windows* -Copyright 2000-2010 Miranda ICQ/IM project, +Copyright 2000-2010 Miranda ICQ/IM project, all portions of this codebase are copyrighted to the people listed in contributors.txt. @@ -11,7 +11,7 @@ modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. -This program is distributed in the hope that it will be useful, +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -254,19 +254,19 @@ INT_PTR CALLBACK ProtocolOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM TVHITTESTINFO hti; hti.pt.x=(short)LOWORD(GetMessagePos()); hti.pt.y=(short)HIWORD(GetMessagePos()); - ScreenToClient(((LPNMHDR)lParam)->hwndFrom,&hti.pt); + ScreenToClient(((LPNMHDR)lParam)->hwndFrom, &hti.pt); if ( TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom, &hti )) { if ( hti.flags & TVHT_ONITEMICON ) { TVITEMA tvi; tvi.mask = TVIF_HANDLE|TVIF_IMAGE|TVIF_SELECTEDIMAGE; tvi.hItem = hti.hItem; - TreeView_GetItem(((LPNMHDR)lParam)->hwndFrom,&tvi); + TreeView_GetItem(((LPNMHDR)lParam)->hwndFrom, &tvi); ProtocolData *pData = ( ProtocolData* )tvi.lParam; if ( pData->enabled ) { tvi.iImage = tvi.iSelectedImage = !tvi.iImage; pData->show = tvi.iImage; - TreeView_SetItem(((LPNMHDR)lParam)->hwndFrom,&tvi); + TreeView_SetItem(((LPNMHDR)lParam)->hwndFrom, &tvi); SendMessage(GetParent(hwndDlg), PSM_CHANGED, (WPARAM)hwndDlg, 0); } } } } } break; -- cgit v1.2.3