diff options
author | George Hazan <george.hazan@gmail.com> | 2012-06-18 20:53:59 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-06-18 20:53:59 +0000 |
commit | 3f23417a1099f73dc28ec1b7d6ec2a1a7fc2b7a2 (patch) | |
tree | 3e0bcd88c55dad310da0dc980e252bf9fbfa6dc5 /src/modules/clist | |
parent | 537b94169bf2483798a651ee3b96f7904eebe7b4 (diff) |
- PLUGININFO structure removed at all;
- Options_AddPage & UserInfo_AddPage replaced MS_OPT_ADDPAGE & MS_USERINFO_ADDPAGE services respectively
- total internal redesign of options' translation
- code reformatting
git-svn-id: http://svn.miranda-ng.org/main/trunk@477 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/clist')
24 files changed, 1604 insertions, 1604 deletions
diff --git a/src/modules/clist/Docking.cpp b/src/modules/clist/Docking.cpp index 95bffa718f..b02a039f3f 100644 --- a/src/modules/clist/Docking.cpp +++ b/src/modules/clist/Docking.cpp @@ -108,7 +108,7 @@ static void Docking_AdjustPosition(HWND hwnd, LPRECT rcDisplay, LPRECT rc, bool else
rc->left = rc->right - cx;
- if (!query)
+ if ( !query)
{
Docking_PosCommand(hwnd, rc, false);
dockPos = *(LPPOINT)rc;
@@ -161,7 +161,7 @@ int fnDocking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) }
}
- if (!docked && msg->message != WM_CREATE && msg->message != WM_MOVING)
+ if ( !docked && msg->message != WM_CREATE && msg->message != WM_MOVING)
return 0;
switch (msg->message)
@@ -190,7 +190,7 @@ int fnDocking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) if (vis)
{
- if (!(wp->flags & (SWP_NOMOVE | SWP_NOSIZE)))
+ if ( !(wp->flags & (SWP_NOMOVE | SWP_NOSIZE)))
{
bool addbar = Docking_Command(msg->hwnd, ABM_NEW) != 0;
@@ -198,12 +198,12 @@ int fnDocking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) GetWindowRect(msg->hwnd, &rc);
int cx = rc.right - rc.left;
- if (!(wp->flags & SWP_NOMOVE)) { rc.left = wp->x; rc.top = wp->y; }
+ if ( !(wp->flags & SWP_NOMOVE)) { rc.left = wp->x; rc.top = wp->y; }
if (addbar)
Docking_RectToDock(&rc);
- if (!(wp->flags & SWP_NOSIZE))
+ if ( !(wp->flags & SWP_NOSIZE))
{
rc.right = rc.left + wp->cx;
rc.bottom = rc.top + wp->cy;
@@ -212,8 +212,8 @@ int fnDocking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) Docking_SetSize(msg->hwnd, &rc, !addbar, false);
- if (!(wp->flags & SWP_NOMOVE)) { wp->x = rc.left; wp->y = rc.top; }
- if (!(wp->flags & SWP_NOSIZE)) wp->cy = rc.bottom - rc.top;
+ if ( !(wp->flags & SWP_NOMOVE)) { wp->x = rc.left; wp->y = rc.top; }
+ if ( !(wp->flags & SWP_NOSIZE)) wp->cy = rc.bottom - rc.top;
*((LRESULT *) lParam) = TRUE;
return TRUE;
@@ -248,7 +248,7 @@ int fnDocking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) if (wp->flags & SWP_HIDEWINDOW)
vis = false;
- if (!vis)
+ if ( !vis)
Docking_Command(msg->hwnd, ABM_REMOVE);
else
Docking_Command(msg->hwnd, ABM_WINDOWPOSCHANGED);
@@ -266,7 +266,7 @@ int fnDocking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) break;
case WM_MOVING:
- if (!docked)
+ if ( !docked)
{
RECT rcMonitor;
POINT ptCursor;
@@ -340,7 +340,7 @@ int fnDocking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) RECT rc;
POINT pt;
GetClientRect(msg->hwnd, &rc);
- if ((docked == DOCKED_LEFT && (short) LOWORD(msg->lParam) > rc.right) ||
+ if ((docked == DOCKED_LEFT && (short) LOWORD(msg->lParam) > rc.right) ||
(docked == DOCKED_RIGHT && (short) LOWORD(msg->lParam) < 0))
{
ReleaseCapture();
diff --git a/src/modules/clist/clc.cpp b/src/modules/clist/clc.cpp index 087cc34e30..168fae2746 100644 --- a/src/modules/clist/clc.cpp +++ b/src/modules/clist/clc.cpp @@ -23,13 +23,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "..\..\core\commonheaders.h"
#include "clc.h"
-int InitGenMenu( void );
-int UnitGenMenu( void );
+int InitGenMenu(void);
+int UnitGenMenu(void);
-void InitCustomMenus( void );
-void UninitCustomMenus( void );
+void InitCustomMenus(void);
+void UninitCustomMenus(void);
-void MTG_OnmodulesLoad( void );
+void MTG_OnmodulesLoad(void);
static BOOL bModuleInitialized = FALSE;
static HANDLE hClcWindowList;
@@ -42,17 +42,17 @@ int g_IconWidth, g_IconHeight; void FreeDisplayNameCache(void);
-void fnClcBroadcast( int msg, WPARAM wParam, LPARAM lParam )
+void fnClcBroadcast(int msg, WPARAM wParam, LPARAM lParam)
{
WindowList_Broadcast(hClcWindowList, msg, wParam, lParam);
}
void fnClcOptionsChanged(void)
{
- cli.pfnClcBroadcast( INTM_RELOADOPTIONS, 0, 0);
+ cli.pfnClcBroadcast(INTM_RELOADOPTIONS, 0, 0);
}
-HMENU fnBuildGroupPopupMenu( struct ClcGroup* group )
+HMENU fnBuildGroupPopupMenu(struct ClcGroup* group)
{
HMENU hMenu = LoadMenu(cli.hInst, MAKEINTRESOURCE(IDR_CONTEXT));
HMENU hGroupMenu = GetSubMenu(hMenu, 2);
@@ -72,49 +72,49 @@ static int ClcSettingChanged(WPARAM wParam, LPARAM lParam) char *szProto;
DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *) lParam;
if ((HANDLE)wParam != NULL && !strcmp(cws->szModule, "CList")) {
- if (!strcmp(cws->szSetting, "MyHandle")) {
+ if ( !strcmp(cws->szSetting, "MyHandle")) {
cli.pfnInvalidateDisplayNameCacheEntry((HANDLE) wParam);
- cli.pfnClcBroadcast( INTM_NAMECHANGED, wParam, lParam);
+ cli.pfnClcBroadcast(INTM_NAMECHANGED, wParam, lParam);
}
- else if (!strcmp(cws->szSetting, "Group"))
- cli.pfnClcBroadcast( INTM_GROUPCHANGED, wParam, lParam);
- else if (!strcmp(cws->szSetting, "Hidden"))
- cli.pfnClcBroadcast( INTM_HIDDENCHANGED, wParam, lParam);
- else if (!strcmp(cws->szSetting, "NotOnList"))
- cli.pfnClcBroadcast( INTM_NOTONLISTCHANGED, wParam, lParam);
- else if (!strcmp(cws->szSetting, "Status"))
- cli.pfnClcBroadcast( INTM_INVALIDATE, 0, 0);
- else if (!strcmp(cws->szSetting, "NameOrder"))
- cli.pfnClcBroadcast( INTM_NAMEORDERCHANGED, 0, 0);
+ else if ( !strcmp(cws->szSetting, "Group"))
+ cli.pfnClcBroadcast(INTM_GROUPCHANGED, wParam, lParam);
+ else if ( !strcmp(cws->szSetting, "Hidden"))
+ cli.pfnClcBroadcast(INTM_HIDDENCHANGED, wParam, lParam);
+ else if ( !strcmp(cws->szSetting, "NotOnList"))
+ cli.pfnClcBroadcast(INTM_NOTONLISTCHANGED, wParam, lParam);
+ else if ( !strcmp(cws->szSetting, "Status"))
+ cli.pfnClcBroadcast(INTM_INVALIDATE, 0, 0);
+ else if ( !strcmp(cws->szSetting, "NameOrder"))
+ cli.pfnClcBroadcast(INTM_NAMEORDERCHANGED, 0, 0);
}
- else if (!strcmp(cws->szModule, "CListGroups")) {
- cli.pfnClcBroadcast( INTM_GROUPSCHANGED, wParam, lParam);
+ else if ( !strcmp(cws->szModule, "CListGroups")) {
+ cli.pfnClcBroadcast(INTM_GROUPSCHANGED, wParam, lParam);
}
else {
szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0);
if (szProto != NULL && (HANDLE) wParam != NULL) {
char *id = NULL;
- if (!strcmp(cws->szModule, "Protocol") && !strcmp(cws->szSetting, "p")) {
- cli.pfnClcBroadcast( INTM_PROTOCHANGED, wParam, lParam);
+ if ( !strcmp(cws->szModule, "Protocol") && !strcmp(cws->szSetting, "p")) {
+ cli.pfnClcBroadcast(INTM_PROTOCHANGED, wParam, lParam);
}
// something is being written to a protocol module
- if (!strcmp(szProto, cws->szModule)) {
+ if ( !strcmp(szProto, cws->szModule)) {
// was a unique setting key written?
id = (char *) CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
if ((INT_PTR) id != CALLSERVICE_NOTFOUND && id != NULL && !strcmp(id, cws->szSetting)) {
- cli.pfnClcBroadcast( INTM_PROTOCHANGED, wParam, lParam);
+ cli.pfnClcBroadcast(INTM_PROTOCHANGED, wParam, lParam);
}
}
}
if (szProto == NULL || strcmp(szProto, cws->szModule))
return 0;
- if (!strcmp(cws->szSetting, "Nick") || !strcmp(cws->szSetting, "FirstName") || !strcmp(cws->szSetting, "e-mail")
- || !strcmp(cws->szSetting, "LastName") || !strcmp(cws->szSetting, "UIN"))
- cli.pfnClcBroadcast( INTM_NAMECHANGED, wParam, lParam);
- else if (!strcmp(cws->szSetting, "ApparentMode"))
- cli.pfnClcBroadcast( INTM_APPARENTMODECHANGED, wParam, lParam);
- else if (!strcmp(cws->szSetting, "IdleTS"))
- cli.pfnClcBroadcast( INTM_IDLECHANGED, wParam, lParam);
+ if ( !strcmp(cws->szSetting, "Nick") || !strcmp(cws->szSetting, "FirstName") || !strcmp(cws->szSetting, "e-mail")
+ || !strcmp(cws->szSetting, "LastName") || !strcmp(cws->szSetting, "UIN"))
+ cli.pfnClcBroadcast(INTM_NAMECHANGED, wParam, lParam);
+ else if ( !strcmp(cws->szSetting, "ApparentMode"))
+ cli.pfnClcBroadcast(INTM_APPARENTMODECHANGED, wParam, lParam);
+ else if ( !strcmp(cws->szSetting, "IdleTS"))
+ cli.pfnClcBroadcast(INTM_IDLECHANGED, wParam, lParam);
}
return 0;
}
@@ -154,7 +154,7 @@ static int ClcProtoAck(WPARAM, LPARAM lParam) 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)) {
+ if ( !lstrcmpA(cli.clcProto[i].szProto, ack->szModule)) {
cli.clcProto[i].dwStatus = (WORD) ack->lParam;
break;
}
@@ -191,7 +191,7 @@ static int ClcIconsChanged(WPARAM, LPARAM) static INT_PTR SetInfoTipHoverTime(WPARAM wParam, LPARAM)
{
DBWriteContactSettingWord(NULL, "CLC", "InfoTipHoverTime", (WORD) wParam);
- cli.pfnClcBroadcast( INTM_SETINFOTIPHOVERTIME, wParam, 0);
+ cli.pfnClcBroadcast(INTM_SETINFOTIPHOVERTIME, wParam, 0);
return 0;
}
@@ -200,10 +200,10 @@ static INT_PTR GetInfoTipHoverTime(WPARAM, LPARAM) return DBGetContactSettingWord(NULL, "CLC", "InfoTipHoverTime", 750);
}
-static void SortClcByTimer( HWND hwnd )
+static void SortClcByTimer(HWND hwnd)
{
- KillTimer( hwnd, TIMERID_DELAYEDRESORTCLC );
- SetTimer( hwnd, TIMERID_DELAYEDRESORTCLC, 200, NULL );
+ KillTimer(hwnd, TIMERID_DELAYEDRESORTCLC);
+ SetTimer(hwnd, TIMERID_DELAYEDRESORTCLC, 200, NULL);
}
int LoadCLCModule(void)
@@ -236,7 +236,7 @@ int LoadCLCModule(void) void UnloadClcModule()
{
- if ( !bModuleInitialized ) return;
+ if ( !bModuleInitialized) return;
UnhookEvent(hAckHook);
UnhookEvent(hClcSettingsChanged);
@@ -264,7 +264,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, case WM_CREATE:
WindowList_Add(hClcWindowList, hwnd, NULL);
cli.pfnRegisterFileDropping(hwnd);
- if ( dat == NULL ) {
+ if (dat == NULL) {
dat = (struct ClcData *) mir_calloc(sizeof(struct ClcData));
SetWindowLongPtr(hwnd, 0, (LONG_PTR) dat);
}
@@ -286,7 +286,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, dat->list.cl.increment = 30;
dat->needsResort = 1;
cli.pfnLoadClcOptions(hwnd, dat);
- if (!IsWindowVisible(hwnd))
+ if ( !IsWindowVisible(hwnd))
SetTimer(hwnd, TIMERID_REBUILDAFTER, 10, NULL);
else
{
@@ -342,8 +342,8 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, FillRect(hdcMem, &rc, hBrush);
DeleteObject(hBrush);
- hoMaskBmp = ( HBITMAP )SelectObject(hdcMem, hBmpMask);
- FillRect(hdcMem, &rc, ( HBRUSH )GetStockObject(BLACK_BRUSH));
+ hoMaskBmp = (HBITMAP)SelectObject(hdcMem, hBmpMask);
+ FillRect(hdcMem, &rc, (HBRUSH)GetStockObject(BLACK_BRUSH));
SelectObject(hdcMem, hoMaskBmp);
SelectObject(hdcMem, hoBmp);
DeleteDC(hdcMem);
@@ -416,24 +416,24 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, szFullName[0] = '\0';
break;
}
- memmove(szFullName + 1 + nameLen, szFullName, sizeof( TCHAR )*( lstrlen(szFullName) + 1));
- memcpy(szFullName, group->cl.items[i]->szText, sizeof( TCHAR )*nameLen);
+ memmove(szFullName + 1 + nameLen, szFullName, sizeof(TCHAR)*(lstrlen(szFullName) + 1));
+ memcpy(szFullName, group->cl.items[i]->szText, sizeof(TCHAR)*nameLen);
szFullName[nameLen] = '\\';
}
- if ( dbcws->value.type == DBVT_ASCIIZ ) {
+ if (dbcws->value.type == DBVT_ASCIIZ) {
WCHAR* wszGrpName = mir_a2u(dbcws->value.pszVal+1);
- eq = !lstrcmp( szFullName, wszGrpName );
- mir_free( wszGrpName );
+ eq = !lstrcmp(szFullName, wszGrpName);
+ mir_free(wszGrpName);
}
else {
char* szGrpName = NEWSTR_ALLOCA(dbcws->value.pszVal+1);
WCHAR* wszGrpName;
- Utf8Decode(szGrpName, &wszGrpName );
- eq = !lstrcmp( szFullName, wszGrpName );
- mir_free( wszGrpName );
+ Utf8Decode(szGrpName, &wszGrpName);
+ eq = !lstrcmp(szFullName, wszGrpName);
+ mir_free(wszGrpName);
}
- if ( eq && (contact->group->hideOffline != 0) == ((dbcws->value.pszVal[0] & GROUPF_HIDEOFFLINE) != 0))
+ if (eq && (contact->group->hideOffline != 0) == ((dbcws->value.pszVal[0] & GROUPF_HIDEOFFLINE) != 0))
break; //only expanded has changed: no action reqd
}
}
@@ -477,7 +477,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, struct ClcContact *contact;
BYTE iExtraImage[MAXEXTRACOLUMNS];
BYTE flags = 0;
- if (!cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
+ if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
memset(iExtraImage, 0xFF, SIZEOF(iExtraImage));
else {
CopyMemory(iExtraImage, contact->iExtraImage, SIZEOF(iExtraImage));
@@ -521,9 +521,9 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE);
shouldShow = (style & CLS_SHOWHIDDEN || !DBGetContactSettingByte((HANDLE) wParam, "CList", "Hidden", 0))
- && (!cli.pfnIsHiddenMode(dat, status)
- || CallService(MS_CLIST_GETCONTACTICON, wParam, 0) != lParam); // this means an offline msg is flashing, so the contact should be shown
- if (!cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, &group, NULL)) {
+ && ( !cli.pfnIsHiddenMode(dat, status)
+ || CallService(MS_CLIST_GETCONTACTICON, wParam, 0) != lParam); // this means an offline msg is flashing, so the contact should be shown
+ if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, &group, NULL)) {
if (shouldShow && CallService(MS_DB_CONTACT_IS, wParam, 0)) {
if (dat->selection >= 0 && cli.pfnGetRowByIndex(dat, dat->selection, &selcontact, NULL) != -1)
hSelItem = cli.pfnContactToHItem(selcontact);
@@ -539,7 +539,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, else { // item in list already
if (contact->iImage == (WORD) lParam)
break;
- if (!shouldShow && !(style & CLS_NOHIDEOFFLINE) && (style & CLS_HIDEOFFLINE || group->hideOffline)) {
+ if ( !shouldShow && !(style & CLS_NOHIDEOFFLINE) && (style & CLS_HIDEOFFLINE || group->hideOffline)) {
if (dat->selection >= 0 && cli.pfnGetRowByIndex(dat, dat->selection, &selcontact, NULL) != -1)
hSelItem = cli.pfnContactToHItem(selcontact);
cli.pfnRemoveItemFromGroup(hwnd, group, contact, (style & CLS_CONTACTLIST) == 0);
@@ -547,7 +547,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, }
else {
contact->iImage = (WORD) lParam;
- if (!cli.pfnIsHiddenMode(dat, status))
+ if ( !cli.pfnIsHiddenMode(dat, status))
contact->flags |= CONTACTF_ONLINE;
else
contact->flags &= ~CONTACTF_ONLINE;
@@ -557,7 +557,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, if (hSelItem) {
struct ClcGroup *selgroup;
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));
else
dat->selection = -1;
}
@@ -567,7 +567,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, case INTM_NAMECHANGED:
{
struct ClcContact *contact;
- if (!cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
+ if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
break;
lstrcpyn(contact->szText, cli.pfnGetContactDisplayName((HANDLE)wParam, 0), SIZEOF(contact->szText));
@@ -578,7 +578,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, case INTM_PROTOCHANGED:
{
struct ClcContact *contact = NULL;
- if (!cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
+ if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
break;
contact->proto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0);
cli.pfnInvalidateDisplayNameCacheEntry((HANDLE)wParam);
@@ -590,7 +590,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, {
DBCONTACTWRITESETTING *dbcws = (DBCONTACTWRITESETTING *) lParam;
struct ClcContact *contact;
- if (!cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
+ if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
break;
if (contact->type != CLCIT_CONTACT)
break;
@@ -610,7 +610,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, WORD apparentMode;
char *szProto;
struct ClcContact *contact;
- if (!cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
+ if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
break;
szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0);
if (szProto == NULL)
@@ -634,7 +634,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, {
char *szProto;
struct ClcContact *contact;
- if (!cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
+ if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
break;
szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0);
if (szProto == NULL)
@@ -711,7 +711,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, cli.pfnHideInfoTip(hwnd, dat);
KillTimer(hwnd, TIMERID_INFOTIP);
KillTimer(hwnd, TIMERID_RENAME);
- if (!SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, &scrollLines, FALSE))
+ if ( !SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, &scrollLines, FALSE))
scrollLines = 3;
cli.pfnScrollTo(hwnd, dat, dat->yScroll - (short) HIWORD(wParam) * dat->rowHeight * (signed) scrollLines / WHEEL_DELTA, 0);
return 0;
@@ -859,7 +859,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, return 0;
case WM_TIMER:
- switch( wParam ) {
+ switch(wParam) {
case TIMERID_RENAME:
cli.pfnBeginRenameSelection(hwnd, dat);
break;
@@ -971,7 +971,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, nm.hItem = cli.pfnContactToItemHandle(contact, &nm.flags);
SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM) & nm);
}
- if (!(hitFlags & (CLCHT_ONITEMICON | CLCHT_ONITEMLABEL | CLCHT_ONITEMCHECK))) {
+ if ( !(hitFlags & (CLCHT_ONITEMICON | CLCHT_ONITEMLABEL | CLCHT_ONITEMCHECK))) {
NMCLISTCONTROL nm;
nm.hdr.code = NM_CLICK;
nm.hdr.hwndFrom = hwnd;
@@ -1030,7 +1030,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, }
if ((dat->dragStage & DRAGSTAGEM_STAGE) == DRAGSTAGE_NOTMOVED && !(dat->exStyle & CLS_EX_DISABLEDRAGDROP)) {
if (abs((short) LOWORD(lParam) - dat->ptDragStart.x) >= GetSystemMetrics(SM_CXDRAG)
- || abs((short) HIWORD(lParam) - dat->ptDragStart.y) >= GetSystemMetrics(SM_CYDRAG))
+ || abs((short) HIWORD(lParam) - dat->ptDragStart.y) >= GetSystemMetrics(SM_CYDRAG))
dat->dragStage = (dat->dragStage & ~DRAGSTAGEM_STAGE) | DRAGSTAGE_ACTIVE;
}
if ((dat->dragStage & DRAGSTAGEM_STAGE) == DRAGSTAGE_ACTIVE) {
@@ -1078,8 +1078,8 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, if (pt.x >= 0 && pt.x < clRect.right
&& ((pt.y < 0 && pt.y > -dat->dragAutoScrollHeight)
- || (pt.y >= clRect.bottom && pt.y < clRect.bottom + dat->dragAutoScrollHeight))) {
- if (!dat->dragAutoScrolling) {
+ || (pt.y >= clRect.bottom && pt.y < clRect.bottom + dat->dragAutoScrollHeight))) {
+ if ( !dat->dragAutoScrolling) {
if (pt.y < 0)
dat->dragAutoScrolling = -1;
else
@@ -1150,7 +1150,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, TCHAR szNewName[120];
TCHAR* szGroup = cli.pfnGetGroupName(contactn->groupId, NULL);
mir_sntprintf(szNewName, SIZEOF(szNewName), _T("%s\\%s"), szGroup, contacto->szText);
- cli.pfnRenameGroup( contacto->groupId, szNewName );
+ cli.pfnRenameGroup(contacto->groupId, szNewName);
}
break;
}
@@ -1195,7 +1195,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, else if (contact->type == CLCIT_GROUP) { //dropee is a group
TCHAR szNewName[120];
lstrcpyn(szNewName, contact->szText, SIZEOF(szNewName));
- cli.pfnRenameGroup( contact->groupId, szNewName );
+ cli.pfnRenameGroup(contact->groupId, szNewName);
} } } } }
cli.pfnInvalidateRect(hwnd, NULL, FALSE);
@@ -1217,7 +1217,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, cli.pfnInvalidateRect(hwnd, NULL, FALSE);
if (dat->selection != -1)
cli.pfnEnsureVisible(hwnd, dat, dat->selection, 0);
- if (!(hitFlags & (CLCHT_ONITEMICON | CLCHT_ONITEMLABEL)))
+ if ( !(hitFlags & (CLCHT_ONITEMICON | CLCHT_ONITEMLABEL)))
break;
UpdateWindow(hwnd);
cli.pfnDoSelectionDefaultAction(hwnd, dat);
@@ -1323,14 +1323,14 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, {
int i;
for (i = 0; i <= FONTID_MAX; i++)
- if (!dat->fontInfo[i].changed)
+ if ( !dat->fontInfo[i].changed)
DeleteObject(dat->fontInfo[i].hFont);
}
if (dat->himlHighlight)
ImageList_Destroy(dat->himlHighlight);
if (dat->hwndRenameEdit)
DestroyWindow(dat->hwndRenameEdit);
- if (!dat->bkChanged && dat->hBmpBackground)
+ if ( !dat->bkChanged && dat->hBmpBackground)
DeleteObject(dat->hBmpBackground);
cli.pfnFreeGroup(&dat->list);
mir_free(dat);
diff --git a/src/modules/clist/clc.h b/src/modules/clist/clc.h index ba12d8b70a..3662cea1c6 100644 --- a/src/modules/clist/clc.h +++ b/src/modules/clist/clc.h @@ -83,64 +83,64 @@ struct ClcData { /* clc.c */
extern int g_IconWidth, g_IconHeight;
-void fnClcOptionsChanged( void );
-void fnClcBroadcast( int msg, WPARAM wParam, LPARAM lParam );
-HMENU fnBuildGroupPopupMenu( struct ClcGroup* group );
+void fnClcOptionsChanged(void);
+void fnClcBroadcast(int msg, WPARAM wParam, LPARAM lParam);
+HMENU fnBuildGroupPopupMenu(struct ClcGroup* group);
LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
/* clcidents.c */
-int fnGetRowsPriorTo( struct ClcGroup *group, struct ClcGroup *subgroup, int contactIndex );
-int fnFindItem( HWND hwnd, struct ClcData *dat, HANDLE hItem, struct ClcContact **contact, struct ClcGroup **subgroup, int *isVisible );
-int fnGetRowByIndex( struct ClcData *dat, int testindex, struct ClcContact **contact, struct ClcGroup **subgroup );
-HANDLE fnContactToHItem( struct ClcContact* contact );
-HANDLE fnContactToItemHandle( struct ClcContact * contact, DWORD * nmFlags );
+int fnGetRowsPriorTo(struct ClcGroup *group, struct ClcGroup *subgroup, int contactIndex);
+int fnFindItem(HWND hwnd, struct ClcData *dat, HANDLE hItem, struct ClcContact **contact, struct ClcGroup **subgroup, int *isVisible);
+int fnGetRowByIndex(struct ClcData *dat, int testindex, struct ClcContact **contact, struct ClcGroup **subgroup);
+HANDLE fnContactToHItem(struct ClcContact* contact);
+HANDLE fnContactToItemHandle(struct ClcContact * contact, DWORD * nmFlags);
/* clcitems.c */
-struct ClcGroup* fnAddGroup( HWND hwnd, struct ClcData *dat, const TCHAR *szName, DWORD flags, int groupId, int calcTotalMembers );
+struct ClcGroup* fnAddGroup(HWND hwnd, struct ClcData *dat, const TCHAR *szName, DWORD flags, int groupId, int calcTotalMembers);
struct ClcGroup* fnRemoveItemFromGroup(HWND hwnd, struct ClcGroup *group, struct ClcContact *contact, int updateTotalCount);
-void fnFreeContact( struct ClcContact *p );
-void fnFreeGroup( struct ClcGroup *group );
+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 );
-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 );
-void fnRebuildEntireList( HWND hwnd, struct ClcData *dat );
-int fnGetGroupContentsCount( struct ClcGroup *group, int visibleOnly );
-void fnSortCLC( HWND hwnd, struct ClcData *dat, int useInsertionSort );
+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);
+void fnRebuildEntireList(HWND hwnd, struct ClcData *dat);
+int fnGetGroupContentsCount(struct ClcGroup *group, int visibleOnly);
+void fnSortCLC(HWND hwnd, struct ClcData *dat, int useInsertionSort);
void fnSaveStateAndRebuildList(HWND hwnd, struct ClcData *dat);
/* clcmsgs.c */
-LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM wParam, LPARAM lParam );
+LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM wParam, LPARAM lParam);
/* clcutils.c */
-char* fnGetGroupCountsText(struct ClcData *dat, struct ClcContact *contact );
-int fnHitTest( HWND hwnd, struct ClcData *dat, int testx, int testy, struct ClcContact **contact, struct ClcGroup **group, DWORD * flags );
-void fnScrollTo( HWND hwnd, struct ClcData *dat, int desty, int noSmooth );
-void fnEnsureVisible(HWND hwnd, struct ClcData *dat, int iItem, int partialOk );
-void fnRecalcScrollBar( HWND hwnd, struct ClcData *dat );
-void fnSetGroupExpand( HWND hwnd, struct ClcData *dat, struct ClcGroup *group, int newState );
-void fnDoSelectionDefaultAction( HWND hwnd, struct ClcData *dat );
-int fnFindRowByText(HWND hwnd, struct ClcData *dat, const TCHAR *text, int prefixOk );
-void fnEndRename(HWND hwnd, struct ClcData *dat, int save );
-void fnDeleteFromContactList( HWND hwnd, struct ClcData *dat );
-void fnBeginRenameSelection( HWND hwnd, struct ClcData *dat );
-void fnCalcEipPosition( struct ClcData *dat, struct ClcContact *contact, struct ClcGroup *group, POINT *result);
-int fnGetDropTargetInformation( HWND hwnd, struct ClcData *dat, POINT pt );
-int fnClcStatusToPf2( int status );
-int fnIsHiddenMode( struct ClcData *dat, int status );
-void fnHideInfoTip( HWND hwnd, struct ClcData *dat );
-void fnNotifyNewContact( HWND hwnd, HANDLE hContact );
-DWORD fnGetDefaultExStyle( void );
-void fnGetSetting( int i, LOGFONT* lf, COLORREF* colour );
+char* fnGetGroupCountsText(struct ClcData *dat, struct ClcContact *contact);
+int fnHitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, struct ClcContact **contact, struct ClcGroup **group, DWORD * flags);
+void fnScrollTo(HWND hwnd, struct ClcData *dat, int desty, int noSmooth);
+void fnEnsureVisible(HWND hwnd, struct ClcData *dat, int iItem, int partialOk);
+void fnRecalcScrollBar(HWND hwnd, struct ClcData *dat);
+void fnSetGroupExpand(HWND hwnd, struct ClcData *dat, struct ClcGroup *group, int newState);
+void fnDoSelectionDefaultAction(HWND hwnd, struct ClcData *dat);
+int fnFindRowByText(HWND hwnd, struct ClcData *dat, const TCHAR *text, int prefixOk);
+void fnEndRename(HWND hwnd, struct ClcData *dat, int save);
+void fnDeleteFromContactList(HWND hwnd, struct ClcData *dat);
+void fnBeginRenameSelection(HWND hwnd, struct ClcData *dat);
+void fnCalcEipPosition(struct ClcData *dat, struct ClcContact *contact, struct ClcGroup *group, POINT *result);
+int fnGetDropTargetInformation(HWND hwnd, struct ClcData *dat, POINT pt);
+int fnClcStatusToPf2(int status);
+int fnIsHiddenMode(struct ClcData *dat, int status);
+void fnHideInfoTip(HWND hwnd, struct ClcData *dat);
+void fnNotifyNewContact(HWND hwnd, HANDLE hContact);
+DWORD fnGetDefaultExStyle(void);
+void fnGetSetting(int i, LOGFONT* lf, COLORREF* colour);
void fnGetDefaultFontSetting(int i, LOGFONT* lf, COLORREF* colour);
-void fnGetFontSetting( int i, LOGFONT* lf, COLORREF* colour );
-void fnLoadClcOptions( HWND hwnd, struct ClcData *dat );
-void fnRecalculateGroupCheckboxes( HWND hwnd, struct ClcData *dat );
-void fnSetGroupChildCheckboxes( struct ClcGroup *group, int checked );
-void fnInvalidateItem( HWND hwnd, struct ClcData *dat, int iItem );
+void fnGetFontSetting(int i, LOGFONT* lf, COLORREF* colour);
+void fnLoadClcOptions(HWND hwnd, struct ClcData *dat);
+void fnRecalculateGroupCheckboxes(HWND hwnd, struct ClcData *dat);
+void fnSetGroupChildCheckboxes(struct ClcGroup *group, int checked);
+void fnInvalidateItem(HWND hwnd, struct ClcData *dat, int iItem);
int fnGetRowBottomY(struct ClcData *dat, int item);
int fnGetRowHeight(struct ClcData *dat, int item);
@@ -154,96 +154,96 @@ DWORD GetDefaultExStyle(void); void GetFontSetting(int i, LOGFONTA *lf, COLORREF *colour);
/* clistmenus.c */
-HGENMENU fnGetProtocolMenu( const char* );
-int fnGetProtocolVisibility( const char* accName );
-int fnConvertMenu( CLISTMENUITEM*, TMO_MenuItem* );
+HGENMENU fnGetProtocolMenu(const char*);
+int fnGetProtocolVisibility(const char* accName);
+int fnConvertMenu(CLISTMENUITEM*, TMO_MenuItem*);
int fnGetAccountIndexByPos(int Pos);
int fnGetProtoIndexByPos(PROTOCOLDESCRIPTOR ** proto, int protoCnt, int Pos);
-void RebuildMenuOrder( void );
+void RebuildMenuOrder(void);
INT_PTR MenuProcessCommand(WPARAM wParam, LPARAM lParam);
/* clistsettings.c */
-TCHAR* fnGetContactDisplayName( HANDLE hContact, int mode );
-void fnGetDefaultFontSetting( int i, LOGFONT* lf, COLORREF * colour);
-void fnInvalidateDisplayNameCacheEntry( HANDLE hContact );
+TCHAR* fnGetContactDisplayName(HANDLE hContact, int mode);
+void fnGetDefaultFontSetting(int i, LOGFONT* lf, COLORREF * colour);
+void fnInvalidateDisplayNameCacheEntry(HANDLE hContact);
-ClcCacheEntryBase* fnGetCacheEntry( HANDLE hContact );
-ClcCacheEntryBase* fnCreateCacheItem ( HANDLE hContact );
-void fnCheckCacheItem( ClcCacheEntryBase* p );
-void fnFreeCacheItem( ClcCacheEntryBase* p );
+ClcCacheEntryBase* fnGetCacheEntry(HANDLE hContact);
+ClcCacheEntryBase* fnCreateCacheItem (HANDLE hContact);
+void fnCheckCacheItem(ClcCacheEntryBase* p);
+void fnFreeCacheItem(ClcCacheEntryBase* p);
/* clcfiledrop.c */
void InitFileDropping(void);
-void fnRegisterFileDropping ( HWND hwnd );
-void fnUnregisterFileDropping ( HWND hwnd );
+void fnRegisterFileDropping (HWND hwnd);
+void fnUnregisterFileDropping (HWND hwnd);
/* clistevents.c */
-struct CListEvent* fnAddEvent( CLISTEVENT *cle );
-CLISTEVENT* fnGetEvent( HANDLE hContact, int idx );
+struct CListEvent* fnAddEvent(CLISTEVENT *cle);
+CLISTEVENT* fnGetEvent(HANDLE hContact, int idx);
-struct CListEvent* fnCreateEvent( void );
-void fnFreeEvent( struct CListEvent* p );
+struct CListEvent* fnCreateEvent(void);
+void fnFreeEvent(struct CListEvent* p);
-int fnEventsProcessContactDoubleClick( HANDLE hContact );
-int fnEventsProcessTrayDoubleClick( int );
+int fnEventsProcessContactDoubleClick(HANDLE hContact);
+int fnEventsProcessTrayDoubleClick(int);
int fnGetImlIconIndex(HICON hIcon);
-int fnRemoveEvent( HANDLE hContact, HANDLE dbEvent );
+int fnRemoveEvent(HANDLE hContact, HANDLE dbEvent);
/* clistmod.c */
int fnIconFromStatusMode(const char *szProto, int status, HANDLE hContact);
-int fnShowHide( WPARAM wParam, LPARAM lParam );
-HICON fnGetIconFromStatusMode( HANDLE hContact, const char *szProto, int status );
-TCHAR* fnGetStatusModeDescription( int wParam, int lParam);
+int fnShowHide(WPARAM wParam, LPARAM lParam);
+HICON fnGetIconFromStatusMode(HANDLE hContact, const char *szProto, int status);
+TCHAR* fnGetStatusModeDescription(int wParam, int lParam);
int fnGetWindowVisibleState(HWND hWnd, int iStepX, int iStepY);
/* clisttray.c */
-void fnInitTray( void );
-void fnUninitTray( void );
-void fnLockTray( void );
-void fnUnlockTray( void );
+void fnInitTray(void);
+void fnUninitTray(void);
+void fnLockTray(void);
+void fnUnlockTray(void);
int fnCListTrayNotify(MIRANDASYSTRAYNOTIFY *msn);
int fnTrayIconAdd(HWND hwnd, const char *szProto, const char *szIconProto, int status);
-int fnTrayIconDestroy( HWND hwnd );
-void fnTrayIconIconsChanged ( void );
-int fnTrayIconInit( HWND hwnd );
-TCHAR* fnTrayIconMakeTooltip( const TCHAR *szPrefix, const char *szProto );
-int fnTrayIconPauseAutoHide ( WPARAM wParam, LPARAM lParam );
-INT_PTR fnTrayIconProcessMessage ( WPARAM wParam, LPARAM lParam );
+int fnTrayIconDestroy(HWND hwnd);
+void fnTrayIconIconsChanged (void);
+int fnTrayIconInit(HWND hwnd);
+TCHAR* fnTrayIconMakeTooltip(const TCHAR *szPrefix, const char *szProto);
+int fnTrayIconPauseAutoHide (WPARAM wParam, LPARAM lParam);
+INT_PTR fnTrayIconProcessMessage (WPARAM wParam, LPARAM lParam);
void fnTrayIconRemove(HWND hwnd, const char *szProto);
int fnTrayIconSetBaseInfo(HICON hIcon, const char *szPreferredProto);
-void fnTrayIconSetToBase ( char *szPreferredProto );
-void fnTrayIconTaskbarCreated( HWND hwnd );
-int fnTrayIconUpdate( HICON hNewIcon, const TCHAR *szNewTip, const char *szPreferredProto, int isBase );
-void fnTrayIconUpdateBase ( const char *szChangedProto );
-void fnTrayIconUpdateWithImageList ( int iImage, const TCHAR *szNewTip, char *szPreferredProto );
+void fnTrayIconSetToBase (char *szPreferredProto);
+void fnTrayIconTaskbarCreated(HWND hwnd);
+int fnTrayIconUpdate(HICON hNewIcon, const TCHAR *szNewTip, const char *szPreferredProto, int isBase);
+void fnTrayIconUpdateBase (const char *szChangedProto);
+void fnTrayIconUpdateWithImageList (int iImage, const TCHAR *szNewTip, char *szPreferredProto);
VOID CALLBACK fnTrayCycleTimerProc(HWND hwnd, UINT message, UINT_PTR idEvent, DWORD dwTime);
/* clui.c */
-LRESULT CALLBACK fnContactListWndProc ( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam );
-void fnLoadCluiGlobalOpts( void );
+LRESULT CALLBACK fnContactListWndProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
+void fnLoadCluiGlobalOpts(void);
void fnCluiProtocolStatusChanged(int, const char*);
void fnDrawMenuItem(DRAWITEMSTRUCT *dis, HICON hIcon, HICON eventIcon);
/* contact.c */
-void fnChangeContactIcon ( HANDLE hContact, int iIcon, int add );
-void fnLoadContactTree ( void );
-int fnCompareContacts ( const struct ClcContact *contact1, const struct ClcContact *contact2);
-void fnSortContacts ( void );
-int fnSetHideOffline ( WPARAM wParam, LPARAM lParam );
+void fnChangeContactIcon (HANDLE hContact, int iIcon, int add);
+void fnLoadContactTree (void);
+int fnCompareContacts (const struct ClcContact *contact1, const struct ClcContact *contact2);
+void fnSortContacts (void);
+int fnSetHideOffline (WPARAM wParam, LPARAM lParam);
/* docking.c */
-int fnDocking_ProcessWindowMessage ( WPARAM wParam, LPARAM lParam );
+int fnDocking_ProcessWindowMessage (WPARAM wParam, LPARAM lParam);
/* group.c */
-TCHAR* fnGetGroupName ( int idx, DWORD* pdwFlags );
-int fnRenameGroup ( int groupID, TCHAR* newName );
+TCHAR* fnGetGroupName (int idx, DWORD* pdwFlags);
+int fnRenameGroup (int groupID, TCHAR* newName);
/* keyboard.c */
-int fnHotKeysRegister ( HWND hwnd );
-void fnHotKeysUnregister ( HWND hwnd );
-int fnHotKeysProcess ( HWND hwnd, WPARAM wParam, LPARAM lParam );
-int fnHotkeysProcessMessage ( WPARAM wParam, LPARAM lParam );
+int fnHotKeysRegister (HWND hwnd);
+void fnHotKeysUnregister (HWND hwnd);
+int fnHotKeysProcess (HWND hwnd, WPARAM wParam, LPARAM lParam);
+int fnHotkeysProcessMessage (WPARAM wParam, LPARAM lParam);
diff --git a/src/modules/clist/clcfiledrop.cpp b/src/modules/clist/clcfiledrop.cpp index 54660267c9..8af901284b 100644 --- a/src/modules/clist/clcfiledrop.cpp +++ b/src/modules/clist/clcfiledrop.cpp @@ -83,7 +83,7 @@ static HANDLE HContactFromPoint(HWND hwnd, struct ClcData *dat, int x, int y, in if (szProto == NULL)
return NULL;
protoCaps = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0);
- if (!(protoCaps & PF1_FILESEND))
+ if ( !(protoCaps & PF1_FILESEND))
return NULL;
if (ID_STATUS_OFFLINE == DBGetContactSettingWord(contact->hContact, szProto, "Status", ID_STATUS_OFFLINE))
return NULL;
@@ -148,7 +148,7 @@ HRESULT CDropTarget::DragEnter(IDataObject *pDataObj, DWORD grfKeyState, POINTL shortPt.y = pt.y;
hwnd = WindowFromPoint(shortPt);
GetClassName(hwnd, szWindowClass, SIZEOF(szWindowClass));
- if (!lstrcmp(szWindowClass, CLISTCONTROL_CLASS)) {
+ if ( !lstrcmp(szWindowClass, CLISTCONTROL_CLASS)) {
struct ClcData *dat;
hwndCurrentDrag = hwnd;
dat = (struct ClcData *) GetWindowLongPtr(hwndCurrentDrag, 0);
@@ -188,7 +188,7 @@ static void AddToFileList(TCHAR ***pppFiles, int *totalCount, const TCHAR *szFil lstrcat(szPath, _T("\\*"));
if (hFind = FindFirstFile(szPath, &fd)) {
do {
- if (!lstrcmp(fd.cFileName, _T(".")) || !lstrcmp(fd.cFileName, _T("..")))
+ if ( !lstrcmp(fd.cFileName, _T(".")) || !lstrcmp(fd.cFileName, _T("..")))
continue;
lstrcpy(szPath, szFilename);
lstrcat(szPath, _T("\\"));
@@ -234,7 +234,7 @@ HRESULT CDropTarget::Drop(IDataObject * pDataObj, DWORD /*fKeyState*/, POINTL pt AddToFileList(&ppFiles, &totalCount, szFilename);
}
- if (!CallService(MS_FILE_SENDSPECIFICFILEST, (WPARAM) hContact, (LPARAM) ppFiles))
+ if ( !CallService(MS_FILE_SENDSPECIFICFILEST, (WPARAM) hContact, (LPARAM) ppFiles))
*pdwEffect = DROPEFFECT_COPY;
for (i = 0; ppFiles[i]; i++)
diff --git a/src/modules/clist/clcidents.cpp b/src/modules/clist/clcidents.cpp index 1256ad4c8b..60e8fb6c3b 100644 --- a/src/modules/clist/clcidents.cpp +++ b/src/modules/clist/clcidents.cpp @@ -85,7 +85,7 @@ int fnFindItem(HWND hwnd, struct ClcData *dat, HANDLE hItem, struct ClcContact * break;
nowVisible = 1;
for (tgroup = group; tgroup; tgroup = tgroup->parent)
- if (!group->expanded) {
+ if ( !group->expanded) {
nowVisible = 0;
break;
}
@@ -102,7 +102,7 @@ int fnFindItem(HWND hwnd, struct ClcData *dat, HANDLE hItem, struct ClcContact * && group->cl.items[group->scanIndex]->hContact == (HANDLE) ((UINT_PTR)hItem & ~HCONTACT_ISINFO)))
{
if (isVisible) {
- if (!nowVisible)
+ if ( !nowVisible)
*isVisible = 0;
else {
int posY = cli.pfnGetRowTopY(dat, index+1);
diff --git a/src/modules/clist/clcitems.cpp b/src/modules/clist/clcitems.cpp index 261710c078..74e951c276 100644 --- a/src/modules/clist/clcitems.cpp +++ b/src/modules/clist/clcitems.cpp @@ -31,9 +31,9 @@ int fnAddItemToGroup(struct ClcGroup *group, int iAboveItem) newItem->type = CLCIT_DIVIDER;
newItem->flags = 0;
newItem->szText[0] = '\0';
- memset( newItem->iExtraImage, 0xFF, SIZEOF(newItem->iExtraImage));
+ memset(newItem->iExtraImage, 0xFF, SIZEOF(newItem->iExtraImage));
- List_Insert(( SortedList* )&group->cl, newItem, iAboveItem );
+ List_Insert((SortedList*)&group->cl, newItem, iAboveItem);
return iAboveItem;
}
@@ -44,10 +44,10 @@ struct ClcGroup* fnAddGroup(HWND hwnd, struct ClcData *dat, const TCHAR *szName, int i, compareResult;
dat->needsResort = 1;
- if (!(GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_USEGROUPS))
+ if ( !(GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_USEGROUPS))
return &dat->list;
- pNextField = ( TCHAR* )szName;
+ pNextField = (TCHAR*)szName;
do {
pBackslash = _tcschr(pNextField, '\\');
if (pBackslash == NULL) {
@@ -55,7 +55,7 @@ struct ClcGroup* fnAddGroup(HWND hwnd, struct ClcData *dat, const TCHAR *szName, pNextField = NULL;
}
else {
- lstrcpyn(szThisField, pNextField, min( SIZEOF(szThisField), pBackslash - pNextField + 1 ));
+ lstrcpyn(szThisField, pNextField, min(SIZEOF(szThisField), pBackslash - pNextField + 1));
pNextField = pBackslash + 1;
}
compareResult = 1;
@@ -79,7 +79,7 @@ struct ClcGroup* fnAddGroup(HWND hwnd, struct ClcData *dat, const TCHAR *szName, }
if (pNextField == NULL && group->cl.items[i]->groupId == 0)
break;
- if (!(dat->exStyle & CLS_EX_SORTGROUPSALPHA) && groupId && group->cl.items[i]->groupId > groupId)
+ if ( !(dat->exStyle & CLS_EX_SORTGROUPSALPHA) && groupId && group->cl.items[i]->groupId > groupId)
break;
}
if (compareResult) {
@@ -87,12 +87,12 @@ struct ClcGroup* fnAddGroup(HWND hwnd, struct ClcData *dat, const TCHAR *szName, return NULL;
i = cli.pfnAddItemToGroup(group, i);
group->cl.items[i]->type = CLCIT_GROUP;
- lstrcpyn(group->cl.items[i]->szText, szThisField, SIZEOF( group->cl.items[i]->szText ));
+ lstrcpyn(group->cl.items[i]->szText, szThisField, SIZEOF(group->cl.items[i]->szText));
group->cl.items[i]->groupId = (WORD) (pNextField ? 0 : groupId);
group->cl.items[i]->group = (struct ClcGroup *) mir_alloc(sizeof(struct ClcGroup));
group->cl.items[i]->group->parent = group;
group = group->cl.items[i]->group;
- memset( &group->cl, 0, sizeof( group->cl ));
+ memset(&group->cl, 0, sizeof(group->cl));
group->cl.increment = 10;
if (flags == (DWORD) - 1 || pNextField != NULL) {
group->expanded = 0;
@@ -108,8 +108,8 @@ struct ClcGroup* fnAddGroup(HWND hwnd, struct ClcData *dat, const TCHAR *szName, DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE);
HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
while (hContact) {
- ClcCacheEntryBase* cache = cli.pfnGetCacheEntry( hContact );
- if ( !lstrcmp( cache->group, szName) && (style & CLS_SHOWHIDDEN || !cache->isHidden ))
+ ClcCacheEntryBase* cache = cli.pfnGetCacheEntry(hContact);
+ if ( !lstrcmp(cache->group, szName) && (style & CLS_SHOWHIDDEN || !cache->isHidden))
group->totalMembers++;
hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
@@ -163,7 +163,7 @@ int fnAddInfoItemToGroup(struct ClcGroup *group, int flags, const TCHAR *pszText group->cl.items[i]->type = CLCIT_INFO;
group->cl.items[i]->flags = (BYTE) flags;
group->cl.items[i]->hContact = (HANDLE)++ iInfoItemUniqueHandle;
- lstrcpyn(group->cl.items[i]->szText, pszText, SIZEOF( group->cl.items[i]->szText ));
+ lstrcpyn(group->cl.items[i]->szText, pszText, SIZEOF(group->cl.items[i]->szText));
return i;
}
@@ -177,10 +177,10 @@ int fnAddContactToGroup(struct ClcData *dat, struct ClcGroup *group, HANDLE hCon dat->needsResort = 1;
for (i = group->cl.count - 1; i >= 0; i--) {
- if (group->cl.items[i]->hContact == hContact )
+ if (group->cl.items[i]->hContact == hContact)
return i;
- if ( index == -1 )
+ if (index == -1)
if (group->cl.items[i]->type != CLCIT_INFO || !(group->cl.items[i]->flags & CLCIIF_BELOWCONTACTS))
index = i;
}
@@ -208,8 +208,8 @@ int fnAddContactToGroup(struct ClcData *dat, struct ClcGroup *group, HANDLE hCon lstrcpyn(group->cl.items[i]->szText, cli.pfnGetContactDisplayName(hContact, 0), SIZEOF(group->cl.items[i]->szText));
{ ClcCacheEntryBase* p = cli.pfnGetCacheEntry(hContact);
- if ( p != NULL ) {
- if ( p->group ) mir_free( p->group );
+ if (p != NULL) {
+ if (p->group) mir_free(p->group);
p->group = NULL;
} }
@@ -231,7 +231,7 @@ void fnAddContactToTree(HWND hwnd, struct ClcData *dat, HANDLE hContact, int upd if (szProto != NULL)
status = DBGetContactSettingWord(hContact, szProto, "Status", ID_STATUS_OFFLINE);
- if ( DBGetContactSettingTString(hContact, "CList", "Group", &dbv))
+ if (DBGetContactSettingTString(hContact, "CList", "Group", &dbv))
group = &dat->list;
else {
group = cli.pfnAddGroup(hwnd, dat, dbv.ptszVal, (DWORD) - 1, 0, 0);
@@ -239,7 +239,7 @@ void fnAddContactToTree(HWND hwnd, struct ClcData *dat, HANDLE hContact, int upd int i, len;
DWORD groupFlags;
TCHAR *szGroupName;
- if (!(style & CLS_HIDEEMPTYGROUPS)) {
+ if ( !(style & CLS_HIDEEMPTYGROUPS)) {
mir_free(dbv.ptszVal);
return;
}
@@ -250,7 +250,7 @@ void fnAddContactToTree(HWND hwnd, struct ClcData *dat, HANDLE hContact, int upd mir_free(dbv.ptszVal);
return;
} //never happens
- if (!lstrcmp(szGroupName, dbv.ptszVal))
+ if ( !lstrcmp(szGroupName, dbv.ptszVal))
break;
}
if (groupFlags & GROUPF_HIDEOFFLINE) {
@@ -264,10 +264,10 @@ void fnAddContactToTree(HWND hwnd, struct ClcData *dat, HANDLE hContact, int upd mir_free(dbv.ptszVal);
return;
} //never happens
- if (!lstrcmp(szGroupName, dbv.ptszVal))
+ if ( !lstrcmp(szGroupName, dbv.ptszVal))
break;
len = lstrlen(szGroupName);
- if (!_tcsncmp(szGroupName, dbv.ptszVal, len) && dbv.ptszVal[len] == '\\')
+ if ( !_tcsncmp(szGroupName, dbv.ptszVal, len) && dbv.ptszVal[len] == '\\')
cli.pfnAddGroup(hwnd, dat, szGroupName, groupFlags, i, 1);
}
group = cli.pfnAddGroup(hwnd, dat, dbv.ptszVal, groupFlags, i, 1);
@@ -289,21 +289,21 @@ void fnAddContactToTree(HWND hwnd, struct ClcData *dat, HANDLE hContact, int upd struct ClcGroup* fnRemoveItemFromGroup(HWND hwnd, struct ClcGroup *group, struct ClcContact *contact, int updateTotalCount)
{
int iContact;
- if (( iContact = List_IndexOf(( SortedList* )&group->cl, contact )) == -1 )
+ if ((iContact = List_IndexOf((SortedList*)&group->cl, contact)) == -1)
return group;
if (updateTotalCount && contact->type == CLCIT_CONTACT)
group->totalMembers--;
{ ClcCacheEntryBase* p = cli.pfnGetCacheEntry(contact->hContact);
- if ( p != NULL ) {
- if ( p->group ) mir_free( p->group );
+ if (p != NULL) {
+ if (p->group) mir_free(p->group);
p->group = NULL;
} }
- cli.pfnFreeContact( group->cl.items[iContact] );
- mir_free( group->cl.items[iContact] );
- List_Remove(( SortedList* )&group->cl, iContact );
+ cli.pfnFreeContact(group->cl.items[iContact]);
+ mir_free(group->cl.items[iContact]);
+ List_Remove((SortedList*)&group->cl, iContact);
if ((GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_HIDEEMPTYGROUPS) && group->cl.count == 0) {
int i;
@@ -326,10 +326,10 @@ void fnDeleteItemFromTree(HWND hwnd, HANDLE hItem) struct ClcData *dat = (struct ClcData *) GetWindowLongPtr(hwnd, 0);
dat->needsResort = 1;
- if (!cli.pfnFindItem(hwnd, dat, hItem, &contact, &group, NULL)) {
+ if ( !cli.pfnFindItem(hwnd, dat, hItem, &contact, &group, NULL)) {
DBVARIANT dbv;
int i, nameOffset;
- if (!IsHContactContact(hItem))
+ if ( !IsHContactContact(hItem))
return;
if (DBGetContactSettingTString(hItem, "CList", "Group", &dbv))
return;
@@ -342,7 +342,7 @@ void fnDeleteItemFromTree(HWND hwnd, HANDLE hItem) break;
if (group->cl.items[i]->type == CLCIT_GROUP) {
int len = lstrlen(group->cl.items[i]->szText);
- if (!_tcsncmp(group->cl.items[i]->szText, dbv.ptszVal + nameOffset, len) &&
+ if ( !_tcsncmp(group->cl.items[i]->szText, dbv.ptszVal + nameOffset, len) &&
(dbv.ptszVal[nameOffset + len] == '\\' || dbv.ptszVal[nameOffset + len] == '\0')) {
group->totalMembers--;
if (dbv.ptszVal[nameOffset + len] == '\0')
@@ -394,13 +394,13 @@ void fnRebuildEntireList(HWND hwnd, struct ClcData *dat) if (group != NULL) {
group->totalMembers++;
- if (!(style & CLS_NOHIDEOFFLINE) && (style & CLS_HIDEOFFLINE || group->hideOffline)) {
+ if ( !(style & CLS_NOHIDEOFFLINE) && (style & CLS_HIDEOFFLINE || group->hideOffline)) {
szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
if (szProto == NULL) {
- if (!cli.pfnIsHiddenMode(dat, ID_STATUS_OFFLINE))
+ if ( !cli.pfnIsHiddenMode(dat, ID_STATUS_OFFLINE))
cli.pfnAddContactToGroup(dat, group, hContact);
}
- else if (!cli.pfnIsHiddenMode(dat, DBGetContactSettingWord(hContact, szProto, "Status", ID_STATUS_OFFLINE)))
+ else if ( !cli.pfnIsHiddenMode(dat, DBGetContactSettingWord(hContact, szProto, "Status", ID_STATUS_OFFLINE)))
cli.pfnAddContactToGroup(dat, group, hContact);
}
else cli.pfnAddContactToGroup(dat, group, hContact);
@@ -447,7 +447,7 @@ int fnGetGroupContentsCount(struct ClcGroup *group, int visibleOnly) break;
group = group->parent;
}
- else if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP && (!visibleOnly || group->cl.items[group->scanIndex]->group->expanded)) {
+ else if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP && ( !visibleOnly || group->cl.items[group->scanIndex]->group->expanded)) {
group = group->cl.items[group->scanIndex]->group;
group->scanIndex = 0;
count += group->cl.count;
@@ -460,16 +460,16 @@ int fnGetGroupContentsCount(struct ClcGroup *group, int visibleOnly) static int __cdecl GroupSortProc(const void* p1, const void* p2)
{
- ClcContact **contact1 = ( ClcContact** )p1, **contact2 = ( ClcContact** )p2;
+ ClcContact **contact1 = (ClcContact**)p1, **contact2 = (ClcContact**)p2;
return lstrcmpi(contact1[0]->szText, contact2[0]->szText);
}
static int __cdecl ContactSortProc(const void* p1, const void* p2)
{
- ClcContact **contact1 = ( ClcContact** )p1, **contact2 = ( ClcContact** )p2;
+ ClcContact **contact1 = (ClcContact**)p1, **contact2 = (ClcContact**)p2;
- int result = cli.pfnCompareContacts( contact1[0], contact2[0] );
+ int result = cli.pfnCompareContacts(contact1[0], contact2[0]);
if (result)
return result;
//nothing to distinguish them, so make sure they stay in the same order
@@ -498,8 +498,8 @@ static void SortGroup(struct ClcData *dat, struct ClcGroup *group, int useInsert for (i = group->cl.count - 1; i >= 0; i--) {
if (group->cl.items[i]->type == CLCIT_DIVIDER) {
- mir_free( group->cl.items[i] );
- List_Remove(( SortedList* )&group->cl, i );
+ mir_free(group->cl.items[i]);
+ List_Remove((SortedList*)&group->cl, i);
} }
for (i = 0; i < group->cl.count; i++)
@@ -550,7 +550,7 @@ void fnSortCLC(HWND hwnd, struct ClcData *dat, int useInsertionSort) struct ClcGroup *group = &dat->list, *selgroup;
HANDLE hSelItem;
- if ( dat->needsResort ) {
+ if (dat->needsResort) {
if (cli.pfnGetRowByIndex(dat, dat->selection, &selcontact, NULL) == -1)
hSelItem = NULL;
else
@@ -611,9 +611,9 @@ void fnSaveStateAndRebuildList(HWND hwnd, struct ClcData *dat) KillTimer(hwnd, TIMERID_RENAME);
cli.pfnEndRename(hwnd, dat, 1);
- OBJLIST<SavedContactState_t> saveContact( 10, HandleKeySortT );
- OBJLIST<SavedGroupState_t> saveGroup( 100, NumericKeySortT );
- OBJLIST<SavedInfoState_t> saveInfo( 10, NumericKeySortT );
+ OBJLIST<SavedContactState_t> saveContact(10, HandleKeySortT);
+ OBJLIST<SavedGroupState_t> saveGroup(100, NumericKeySortT);
+ OBJLIST<SavedInfoState_t> saveInfo(10, NumericKeySortT);
dat->needsResort = 1;
group = &dat->list;
@@ -631,22 +631,22 @@ void fnSaveStateAndRebuildList(HWND hwnd, struct ClcData *dat) SavedGroupState_t* p = new SavedGroupState_t;
p->groupId = group->groupId;
p->expanded = group->expanded;
- saveGroup.insert( p );
+ saveGroup.insert(p);
continue;
}
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 );
+ saveContact.insert(p);
}
else if (group->cl.items[group->scanIndex]->type == CLCIT_INFO) {
SavedInfoState_t* p = new SavedInfoState_t;
p->parentId = (group->parent == NULL) ? -1 : group->groupId;
p->contact = *group->cl.items[group->scanIndex];
- saveInfo.insert( p );
+ saveInfo.insert(p);
}
group->scanIndex++;
}
@@ -668,14 +668,14 @@ void fnSaveStateAndRebuildList(HWND hwnd, struct ClcData *dat) SavedGroupState_t tmp, *p;
tmp.groupId = group->groupId;
- if (( p = saveGroup.find( &tmp )) != NULL )
+ if ((p = saveGroup.find(&tmp)) != NULL)
group->expanded = p->expanded;
continue;
}
else if (group->cl.items[group->scanIndex]->type == CLCIT_CONTACT) {
SavedContactState_t tmp, *p;
tmp.hContact = group->cl.items[group->scanIndex]->hContact;
- if (( p = saveContact.find( &tmp )) != NULL ) {
+ if ((p = saveContact.find(&tmp)) != NULL) {
CopyMemory(group->cl.items[group->scanIndex]->iExtraImage, p->iExtraImage,
SIZEOF(group->cl.items[group->scanIndex]->iExtraImage));
if (p->checked)
@@ -689,7 +689,7 @@ void fnSaveStateAndRebuildList(HWND hwnd, struct ClcData *dat) if (saveInfo[i].parentId == -1)
group = &dat->list;
else {
- if (!cli.pfnFindItem(hwnd, dat, (HANDLE) (saveInfo[i].parentId | HCONTACT_ISGROUP), &contact, NULL, NULL))
+ if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) (saveInfo[i].parentId | HCONTACT_ISGROUP), &contact, NULL, NULL))
continue;
group = contact->group;
}
diff --git a/src/modules/clist/clcmsgs.cpp b/src/modules/clist/clcmsgs.cpp index 6757f7ae41..8c4de5232d 100644 --- a/src/modules/clist/clcmsgs.cpp +++ b/src/modules/clist/clcmsgs.cpp @@ -57,14 +57,14 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR if (cii->hParentGroup == NULL)
group = &dat->list;
else {
- if (!cli.pfnFindItem(hwnd, dat, (HANDLE) ((UINT_PTR) cii->hParentGroup | HCONTACT_ISGROUP), &groupContact, NULL, NULL))
+ if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) ((UINT_PTR) cii->hParentGroup | HCONTACT_ISGROUP), &groupContact, NULL, NULL))
return (LRESULT) (HANDLE) NULL;
group = groupContact->group;
}
- if ( msg == CLM_ADDINFOITEMA )
- { WCHAR* wszText = mir_a2u(( char* )cii->pszText );
+ if (msg == CLM_ADDINFOITEMA)
+ { WCHAR* wszText = mir_a2u((char*)cii->pszText);
i = cli.pfnAddInfoItemToGroup(group, cii->flags, wszText);
- mir_free( wszText );
+ mir_free(wszText);
}
else i = cli.pfnAddInfoItemToGroup(group, cii->flags, cii->pszText);
cli.pfnRecalcScrollBar(hwnd, dat);
@@ -95,7 +95,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR {
ClcContact *contact;
ClcGroup *group, *tgroup;
- if (!cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, &group, NULL))
+ if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, &group, NULL))
break;
for (tgroup = group; tgroup; tgroup = tgroup->parent)
cli.pfnSetGroupExpand(hwnd, dat, tgroup, 1);
@@ -106,7 +106,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR case CLM_EXPAND:
{
ClcContact *contact;
- if (!cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
+ if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
break;
if (contact->type != CLCIT_GROUP)
break;
@@ -115,12 +115,12 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR }
case CLM_FINDCONTACT:
- if (!cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, NULL, NULL, NULL))
+ if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, NULL, NULL, NULL))
return (LRESULT) (HANDLE) NULL;
return wParam;
case CLM_FINDGROUP:
- if (!cli.pfnFindItem(hwnd, dat, (HANDLE) (wParam | HCONTACT_ISGROUP), NULL, NULL, NULL))
+ if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) (wParam | HCONTACT_ISGROUP), NULL, NULL, NULL))
return (LRESULT) (HANDLE) NULL;
return wParam | HCONTACT_ISGROUP;
@@ -130,7 +130,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR case CLM_GETCHECKMARK:
{
ClcContact *contact;
- if (!cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
+ if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
return 0;
return (contact->flags & CONTACTF_CHECKED) != 0;
}
@@ -144,7 +144,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR case CLM_GETEXPAND:
{
ClcContact *contact;
- if (!cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
+ if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
return CLE_INVALID;
if (contact->type != CLCIT_GROUP)
return CLE_INVALID;
@@ -159,7 +159,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR ClcContact *contact;
if (LOWORD(lParam) >= dat->extraColumnsCount)
return 0xFF;
- if (!cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
+ if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
return 0xFF;
return contact->iExtraImage[LOWORD(lParam)];
}
@@ -179,22 +179,22 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR return dat->groupIndent;
case CLM_GETISEARCHSTRING:
- lstrcpy(( TCHAR* ) lParam, dat->szQuickSearch);
+ lstrcpy((TCHAR*) lParam, dat->szQuickSearch);
return lstrlen(dat->szQuickSearch);
case CLM_GETITEMTEXT:
{
ClcContact *contact;
- if (!cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
+ if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
return 0;
- lstrcpy(( TCHAR* ) lParam, contact->szText);
+ lstrcpy((TCHAR*) lParam, contact->szText);
return lstrlen(contact->szText);
}
case CLM_GETITEMTYPE:
{
ClcContact *contact;
- if (!cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
+ if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
return CLCIT_INVALID;
return contact->type;
}
@@ -212,7 +212,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR ClcContact *contact;
ClcGroup *group;
- if (!cli.pfnFindItem(hwnd, dat, (HANDLE) lParam, &contact, &group, NULL))
+ if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) lParam, &contact, &group, NULL))
return NULL;
int i = List_IndexOf((SortedList*)&group->cl, contact);
@@ -316,7 +316,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR {
ClcContact *contact;
ClcGroup *group, *tgroup;
- if (!cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, &group, NULL))
+ if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, &group, NULL))
break;
for (tgroup = group; tgroup; tgroup = tgroup->parent)
cli.pfnSetGroupExpand(hwnd, dat, tgroup, 1);
@@ -326,7 +326,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR }
case CLM_SETBKBITMAP:
- if (!dat->bkChanged && dat->hBmpBackground) {
+ if ( !dat->bkChanged && dat->hBmpBackground) {
DeleteObject(dat->hBmpBackground);
dat->hBmpBackground = NULL;
}
@@ -337,7 +337,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR break;
case CLM_SETBKCOLOR:
- if (!dat->bkChanged && dat->hBmpBackground) {
+ if ( !dat->bkChanged && dat->hBmpBackground) {
DeleteObject(dat->hBmpBackground);
dat->hBmpBackground = NULL;
}
@@ -349,7 +349,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR case CLM_SETCHECKMARK:
{
ClcContact *contact;
- if (!cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
+ if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
return 0;
if (lParam)
contact->flags |= CONTACTF_CHECKED;
@@ -372,7 +372,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR ClcContact *contact;
if (LOWORD(lParam) >= dat->extraColumnsCount)
return 0;
- if (!cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
+ if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
return 0;
contact->iExtraImage[LOWORD(lParam)] = (BYTE) HIWORD(lParam);
cli.pfnInvalidateRect(hwnd, NULL, FALSE);
@@ -428,9 +428,9 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR case CLM_SETITEMTEXT:
{
ClcContact *contact;
- if (!cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
+ if ( !cli.pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL))
break;
- lstrcpyn(contact->szText, ( TCHAR* )lParam, SIZEOF( contact->szText ));
+ lstrcpyn(contact->szText, (TCHAR*)lParam, SIZEOF(contact->szText));
cli.pfnSortCLC(hwnd, dat, 1);
cli.pfnInvalidateRect(hwnd, NULL, FALSE);
break;
diff --git a/src/modules/clist/clcutils.cpp b/src/modules/clist/clcutils.cpp index 054657878f..e49e9621b3 100644 --- a/src/modules/clist/clcutils.cpp +++ b/src/modules/clist/clcutils.cpp @@ -76,7 +76,7 @@ int fnHitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, struct ClcCo DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE);
POINT pt;
- if ( flags )
+ if (flags)
*flags = 0;
pt.x = testx;
@@ -95,15 +95,15 @@ int fnHitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, struct ClcCo pt1, CWP_SKIPINVISIBLE | CWP_SKIPTRANSPARENT);
if (h != hwndTemp)
{
- if (!hwndParent || !(GetWindowLongPtr(hwndTemp, GWL_STYLE) & BS_GROUPBOX))
+ if ( !hwndParent || !(GetWindowLongPtr(hwndTemp, GWL_STYLE) & BS_GROUPBOX))
return -1;
}
}
while (hwndParent);
GetClientRect(hwnd, &clRect);
- if ( testx < 0 || testy < 0 || testy >= clRect.bottom || testx >= clRect.right ) {
- if ( flags ) {
+ if (testx < 0 || testy < 0 || testy >= clRect.bottom || testx >= clRect.right) {
+ if (flags) {
if (testx < 0)
*flags |= CLCHT_TOLEFT;
else if (testx >= clRect.right)
@@ -121,7 +121,7 @@ int fnHitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, struct ClcCo return -1;
}
hit = cli.pfnRowHitTest(dat, dat->yScroll + testy);
- if ( hit != -1 )
+ if (hit != -1)
hit = cli.pfnGetRowByIndex(dat, hit, &hitcontact, &hitgroup);
if (hit == -1) {
if (flags)
@@ -160,7 +160,7 @@ int fnHitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, struct ClcCo if (hitcontact->iExtraImage[i] == 0xFF)
continue;
if (testx >= clRect.right - dat->extraColumnSpacing * (dat->extraColumnsCount - i) &&
- testx < clRect.right - dat->extraColumnSpacing * (dat->extraColumnsCount - i) + g_IconWidth ) {
+ testx < clRect.right - dat->extraColumnSpacing * (dat->extraColumnsCount - i) + g_IconWidth) {
if (flags)
*flags |= CLCHT_ONITEMEXTRA | (i << 24);
return hit;
@@ -168,9 +168,9 @@ int fnHitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, struct ClcCo }
hdc = GetDC(hwnd);
if (hitcontact->type == CLCIT_GROUP)
- hFont = ( HFONT )SelectObject(hdc, dat->fontInfo[FONTID_GROUPS].hFont);
+ hFont = (HFONT)SelectObject(hdc, dat->fontInfo[FONTID_GROUPS].hFont);
else
- hFont = ( HFONT )SelectObject(hdc, dat->fontInfo[FONTID_CONTACTS].hFont);
+ hFont = (HFONT)SelectObject(hdc, dat->fontInfo[FONTID_CONTACTS].hFont);
GetTextExtentPoint32(hdc, hitcontact->szText, lstrlen(hitcontact->szText), &textSize);
width = textSize.cx;
if (hitcontact->type == CLCIT_GROUP) {
@@ -217,10 +217,10 @@ void fnScrollTo(HWND hwnd, struct ClcData *dat, int desty, int noSmooth) desty = 0;
if (abs(desty - dat->yScroll) < 4)
noSmooth = 1;
- if (!noSmooth && dat->exStyle & CLS_EX_NOSMOOTHSCROLLING)
+ if ( !noSmooth && dat->exStyle & CLS_EX_NOSMOOTHSCROLLING)
noSmooth = 1;
previousy = dat->yScroll;
- if (!noSmooth) {
+ if ( !noSmooth) {
startTick = GetTickCount();
for (;;) {
nowTick = GetTickCount();
@@ -372,8 +372,8 @@ int fnFindRowByText(HWND hwnd, struct ClcData *dat, const TCHAR *text, int prefi continue;
}
if (group->cl.items[group->scanIndex]->type != CLCIT_DIVIDER) {
- if ((prefixOk && !_tcsnicmp(text, group->cl.items[group->scanIndex]->szText, testlen)) ||
- (!prefixOk && !lstrcmpi(text, group->cl.items[group->scanIndex]->szText))) {
+ if ((prefixOk && !_tcsnicmp(text, group->cl.items[group->scanIndex]->szText, testlen)) ||
+ ( !prefixOk && !lstrcmpi(text, group->cl.items[group->scanIndex]->szText))) {
struct ClcGroup *contactGroup = group;
int contactScanIndex = group->scanIndex;
for (; group; group = group->parent)
@@ -381,7 +381,7 @@ int fnFindRowByText(HWND hwnd, struct ClcData *dat, const TCHAR *text, int prefi return cli.pfnGetRowsPriorTo(&dat->list, contactGroup, contactScanIndex);
}
if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP) {
- if (!(dat->exStyle & CLS_EX_QUICKSEARCHVISONLY) || group->cl.items[group->scanIndex]->group->expanded) {
+ if ( !(dat->exStyle & CLS_EX_QUICKSEARCHVISONLY) || group->cl.items[group->scanIndex]->group->expanded) {
group = group->cl.items[group->scanIndex]->group;
group->scanIndex = 0;
continue;
@@ -420,7 +420,7 @@ void fnEndRename(HWND, struct ClcData *dat, int save) else if (contact->type == CLCIT_CONTACT) {
cli.pfnInvalidateDisplayNameCacheEntry(contact->hContact);
TCHAR* otherName = cli.pfnGetContactDisplayName(contact->hContact, GCDNF_NOMYHANDLE);
- if (!text[0] || !lstrcmp(otherName, text))
+ if ( !text[0] || !lstrcmp(otherName, text))
DBDeleteContactSetting(contact->hContact, "CList", "MyHandle");
else
DBWriteContactSettingTString(contact->hContact, "CList", "MyHandle", text);
@@ -445,7 +445,7 @@ void fnDeleteFromContactList(HWND hwnd, struct ClcData *dat) CallService(MS_CLIST_GROUPDELETE, (WPARAM)contact->groupId, 0);
break;
case CLCIT_CONTACT:
- CallService("CList/DeleteContactCommand", (WPARAM)contact->hContact, (LPARAM)hwnd );
+ CallService("CList/DeleteContactCommand", (WPARAM)contact->hContact, (LPARAM)hwnd);
break;
} }
@@ -496,9 +496,9 @@ void fnBeginRenameSelection(HWND hwnd, struct ClcData *dat) if (contact->type != CLCIT_CONTACT && contact->type != CLCIT_GROUP)
return;
GetClientRect(hwnd, &clRect);
- cli.pfnCalcEipPosition( dat, contact, group, &pt );
+ cli.pfnCalcEipPosition(dat, contact, group, &pt);
h = cli.pfnGetRowHeight(dat, dat->selection);
- dat->hwndRenameEdit = CreateWindow( _T("EDIT"), contact->szText, WS_CHILD | WS_BORDER | ES_AUTOHSCROLL, pt.x, pt.y, clRect.right - pt.x, h, hwnd, NULL, cli.hInst, NULL);
+ dat->hwndRenameEdit = CreateWindow(_T("EDIT"), contact->szText, WS_CHILD | WS_BORDER | ES_AUTOHSCROLL, pt.x, pt.y, clRect.right - pt.x, h, hwnd, NULL, cli.hInst, NULL);
OldRenameEditWndProc = (WNDPROC) SetWindowLongPtr(dat->hwndRenameEdit, GWLP_WNDPROC, (LONG_PTR) RenameEditSubclassProc);
SendMessage(dat->hwndRenameEdit, WM_SETFONT, (WPARAM) (contact->type == CLCIT_GROUP ? dat->fontInfo[FONTID_GROUPS].hFont : dat->fontInfo[FONTID_CONTACTS].hFont), 0);
SendMessage(dat->hwndRenameEdit, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN | EC_USEFONTINFO, 0);
@@ -507,7 +507,7 @@ void fnBeginRenameSelection(HWND hwnd, struct ClcData *dat) SetFocus(dat->hwndRenameEdit);
}
-void fnCalcEipPosition( struct ClcData *dat, struct ClcContact *, struct ClcGroup *group, POINT *result)
+void fnCalcEipPosition(struct ClcData *dat, struct ClcContact *, struct ClcGroup *group, POINT *result)
{
int indent;
for (indent = 0; group->parent; indent++, group = group->parent);
@@ -526,7 +526,7 @@ int fnGetDropTargetInformation(HWND hwnd, struct ClcData *dat, POINT pt) GetClientRect(hwnd, &clRect);
dat->selection = dat->iDragItem;
dat->iInsertionMark = -1;
- if (!PtInRect(&clRect, pt))
+ if ( !PtInRect(&clRect, pt))
return DROPTARGET_OUTSIDE;
hit = cli.pfnHitTest(hwnd, dat, pt.x, pt.y, &contact, &group, &hitFlags);
@@ -691,7 +691,7 @@ void fnGetFontSetting(int i, LOGFONT* lf, COLORREF* colour) cli.pfnGetDefaultFontSetting(i, lf, colour);
mir_snprintf(idstr, SIZEOF(idstr), "Font%dName", i);
- if ( !DBGetContactSettingTString(NULL, "CLC", idstr, &dbv )) {
+ if ( !DBGetContactSettingTString(NULL, "CLC", idstr, &dbv)) {
lstrcpy(lf->lfFaceName, dbv.ptszVal);
mir_free(dbv.pszVal);
}
@@ -725,7 +725,7 @@ void fnLoadClcOptions(HWND hwnd, struct ClcData *dat) HDC hdc = GetDC(hwnd);
for (i = 0; i <= FONTID_MAX; i++)
{
- if (!dat->fontInfo[i].changed)
+ if ( !dat->fontInfo[i].changed)
DeleteObject(dat->fontInfo[i].hFont);
cli.pfnGetFontSetting(i, &lf, &dat->fontInfo[i].colour);
@@ -750,7 +750,7 @@ void fnLoadClcOptions(HWND hwnd, struct ClcData *dat) dat->showIdle = DBGetContactSettingByte(NULL, "CLC", "ShowIdle", CLCDEFAULT_SHOWIDLE);
dat->noVScrollbar = DBGetContactSettingByte(NULL, "CLC", "NoVScrollBar", 0);
SendMessage(hwnd, INTM_SCROLLBARCHANGED, 0, 0);
- if (!dat->bkChanged) {
+ if ( !dat->bkChanged) {
DBVARIANT dbv;
dat->bkColour = DBGetContactSettingDword(NULL, "CLC", "BkColour", CLCDEFAULT_BKCOLOUR);
if (dat->hBmpBackground) {
@@ -758,7 +758,7 @@ void fnLoadClcOptions(HWND hwnd, struct ClcData *dat) dat->hBmpBackground = NULL;
}
if (DBGetContactSettingByte(NULL, "CLC", "UseBitmap", CLCDEFAULT_USEBITMAP)) {
- if (!DBGetContactSettingString(NULL, "CLC", "BkBitmap", &dbv)) {
+ if ( !DBGetContactSettingString(NULL, "CLC", "BkBitmap", &dbv)) {
dat->hBmpBackground = (HBITMAP) CallService(MS_UTILS_LOADBITMAP, 0, (LPARAM) dbv.pszVal);
mir_free(dbv.pszVal);
}
@@ -813,7 +813,7 @@ void fnRecalculateGroupCheckboxes(HWND, struct ClcData *dat) }
else if (group->cl.items[(group->scanIndex & GSIF_INDEXMASK)]->type == CLCIT_CONTACT) {
group->scanIndex |= GSIF_HASMEMBERS;
- if (!(group->cl.items[(group->scanIndex & GSIF_INDEXMASK)]->flags & CONTACTF_CHECKED))
+ if ( !(group->cl.items[(group->scanIndex & GSIF_INDEXMASK)]->flags & CONTACTF_CHECKED))
group->scanIndex &= ~GSIF_ALLCHECKED;
}
group->scanIndex++;
@@ -844,7 +844,7 @@ void fnSetGroupChildCheckboxes(struct ClcGroup *group, int checked) void fnInvalidateItem(HWND hwnd, struct ClcData *dat, int iItem)
{
RECT rc;
- if ( iItem == -1 )
+ if (iItem == -1)
return;
GetClientRect(hwnd, &rc);
@@ -873,7 +873,7 @@ int fnGetRowHeight(struct ClcData *dat, int) }
int fnRowHitTest(struct ClcData *dat, int y)
-{ if (!dat->rowHeight)
+{ if ( !dat->rowHeight)
return y;
return y / dat->rowHeight;
}
diff --git a/src/modules/clist/clistcore.cpp b/src/modules/clist/clistcore.cpp index ae662be16f..924634ad06 100644 --- a/src/modules/clist/clistcore.cpp +++ b/src/modules/clist/clistcore.cpp @@ -29,31 +29,31 @@ CLIST_INTERFACE cli = { 0 }; static TCHAR szTip[MAX_TIP_SIZE+1];
-int LoadContactListModule2( void );
-int LoadCLCModule( void );
-void BuildProtoMenus( void );
+int LoadContactListModule2(void);
+int LoadCLCModule(void);
+void BuildProtoMenus(void);
static int interfaceInited = 0;
-static void fnPaintClc( HWND, ClcData*, HDC, RECT* )
+static void fnPaintClc(HWND, ClcData*, HDC, RECT*)
{
}
-static struct ClcContact* fnCreateClcContact( void )
+static struct ClcContact* fnCreateClcContact(void)
{
- return ( struct ClcContact* )mir_calloc( sizeof( struct ClcContact ));
+ 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 );
+ return InvalidateRect(hwnd, lpRect, bErase);
}
-static void fnOnCreateClc( void )
+static void fnOnCreateClc(void)
{
}
-static void fnReloadProtoMenus( void )
+static void fnReloadProtoMenus(void)
{
RebuildMenuOrder();
if (DBGetContactSettingByte(NULL, "CList", "MoveProtoMenus", TRUE))
@@ -61,11 +61,11 @@ static void fnReloadProtoMenus( void ) cli.pfnCluiProtocolStatusChanged(0, 0);
}
-static INT_PTR srvRetrieveInterface( WPARAM, LPARAM lParam )
+static INT_PTR srvRetrieveInterface(WPARAM, LPARAM lParam)
{
int rc;
- if ( interfaceInited == 0 ) {
+ if (interfaceInited == 0) {
cli.version = 6;
cli.bDisplayLocked = TRUE;
@@ -207,7 +207,7 @@ static INT_PTR srvRetrieveInterface( WPARAM, LPARAM lParam ) cli.pfnGetProtocolMenu = fnGetProtocolMenu;
cli.pfnConvertMenu = fnConvertMenu;
- cli.hInst = ( HMODULE )lParam;
+ cli.hInst = (HMODULE)lParam;
rc = LoadContactListModule2();
if (rc == 0)
@@ -215,11 +215,11 @@ static INT_PTR srvRetrieveInterface( WPARAM, LPARAM lParam ) interfaceInited = 1;
}
- return ( LPARAM )&cli;
+ return (LPARAM)&cli;
}
int LoadContactListModule()
{
- CreateServiceFunction( MS_CLIST_RETRIEVE_INTERFACE, srvRetrieveInterface );
+ CreateServiceFunction(MS_CLIST_RETRIEVE_INTERFACE, srvRetrieveInterface);
return 0;
}
diff --git a/src/modules/clist/clistevents.cpp b/src/modules/clist/clistevents.cpp index 46045daa04..8177e233d4 100644 --- a/src/modules/clist/clistevents.cpp +++ b/src/modules/clist/clistevents.cpp @@ -90,7 +90,7 @@ static void ShowEventsInTray() char ** pTrayProtos;
char nTrayProtoCnt;
int nTrayCnt=cli.trayIconCount;
- if (!cli.events.count || !nTrayCnt) return;
+ if ( !cli.events.count || !nTrayCnt) return;
if (cli.events.count == 1 || nTrayCnt == 1)
{
ShowOneEventInTray(0); //for only one icon in tray show topmost event
@@ -113,10 +113,10 @@ static void ShowEventsInTray() {
int j;
for (j=0; j<nTrayProtoCnt; j++)
- if ( iEventProto && pTrayProtos[j] && !lstrcmpA(pTrayProtos[j], iEventProto))
+ if (iEventProto && pTrayProtos[j] && !lstrcmpA(pTrayProtos[j], iEventProto))
break;
- if ( j>=nTrayProtoCnt ) j=0; //event was not found so assume first icon
- if ( pTrayProtos[j] ) //if not already set
+ if (j>=nTrayProtoCnt) j=0; //event was not found so assume first icon
+ if (pTrayProtos[j]) //if not already set
ShowOneEventInTray(i); //show it
pTrayProtos[j]=NULL; //and clear slot
}
@@ -137,18 +137,18 @@ static VOID CALLBACK IconFlashTimer(HWND, UINT, UINT_PTR idEvent, DWORD) //decrease eflashes in any case - no need to collect all events
if (cli.events.items[i]->cle.flags & CLEF_ONLYAFEW) {
if (0 >= --cli.events.items[i]->flashesDone)
- cli.pfnRemoveEvent( cli.events.items[i]->cle.hContact, cli.events.items[i]->cle.hDbEvent);
+ cli.pfnRemoveEvent(cli.events.items[i]->cle.hContact, cli.events.items[i]->cle.hDbEvent);
} }
if (cli.events.count == 0) {
KillTimer(NULL, idEvent);
- cli.pfnTrayIconSetToBase( NULL );
+ cli.pfnTrayIconSetToBase(NULL);
}
iconsOn = !iconsOn;
}
-struct CListEvent* fnAddEvent( CLISTEVENT *cle )
+struct CListEvent* fnAddEvent(CLISTEVENT *cle)
{
int i;
struct CListEvent* p;
@@ -158,15 +158,15 @@ struct CListEvent* fnAddEvent( CLISTEVENT *cle ) if (cle->flags & CLEF_URGENT) {
for (i = 0; i < cli.events.count; i++)
- if (!(cli.events.items[i]->cle.flags & CLEF_URGENT))
+ if ( !(cli.events.items[i]->cle.flags & CLEF_URGENT))
break;
}
else i = cli.events.count;
- if (( p = ( struct CListEvent* )cli.pfnCreateEvent()) == NULL )
+ if ((p = (struct CListEvent*)cli.pfnCreateEvent()) == NULL)
return NULL;
- List_Insert(( SortedList* )&cli.events, p, i );
+ List_Insert((SortedList*)&cli.events, p, i);
p->cle = *cle;
p->imlIconIndex = fnGetImlIconIndex(cli.events.items[i]->cle.hIcon);
p->flashesDone = 12;
@@ -188,7 +188,7 @@ struct CListEvent* fnAddEvent( CLISTEVENT *cle ) szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)cle->hContact, 0);
iconsOn = 1;
flashTimerId = SetTimer(NULL, 0, DBGetContactSettingWord(NULL, "CList", "IconFlashTime", 550), IconFlashTimer);
- cli.pfnTrayIconUpdateWithImageList( p->imlIconIndex, p->cle.ptszTooltip, szProto);
+ cli.pfnTrayIconUpdateWithImageList(p->imlIconIndex, p->cle.ptszTooltip, szProto);
}
cli.pfnChangeContactIcon(cle->hContact, p->imlIconIndex, 1);
cli.pfnSortContacts();
@@ -197,7 +197,7 @@ struct CListEvent* fnAddEvent( CLISTEVENT *cle ) // Removes an event from the contact list's queue
// Returns 0 if the event was successfully removed, or nonzero if the event was not found
-int fnRemoveEvent( HANDLE hContact, HANDLE dbEvent )
+int fnRemoveEvent(HANDLE hContact, HANDLE dbEvent)
{
int i;
char *szProto;
@@ -219,8 +219,8 @@ int fnRemoveEvent( HANDLE hContact, HANDLE dbEvent ) 0);
// Free any memory allocated to the event
- cli.pfnFreeEvent( cli.events.items[i] );
- List_Remove(( SortedList* )&cli.events, i );
+ cli.pfnFreeEvent(cli.events.items[i]);
+ List_Remove((SortedList*)&cli.events, i);
{
//count same protocoled events
char * szEventProto;
@@ -241,7 +241,7 @@ int fnRemoveEvent( HANDLE hContact, HANDLE dbEvent ) if (cli.events.count == 0 || nSameProto == 0) {
if (cli.events.count == 0)
KillTimer(NULL, flashTimerId);
- cli.pfnTrayIconSetToBase( hContact == NULL ? NULL : szProto);
+ cli.pfnTrayIconSetToBase(hContact == NULL ? NULL : szProto);
}
else {
if (cli.events.items[0]->cle.hContact == NULL)
@@ -254,9 +254,9 @@ int fnRemoveEvent( HANDLE hContact, HANDLE dbEvent ) return 0;
}
-CLISTEVENT* fnGetEvent( HANDLE hContact, int idx )
+CLISTEVENT* fnGetEvent(HANDLE hContact, int idx)
{
- if ( hContact == INVALID_HANDLE_VALUE) {
+ if (hContact == INVALID_HANDLE_VALUE) {
if (idx >= cli.events.count)
return NULL;
return &cli.events.items[idx]->cle;
@@ -303,10 +303,10 @@ int fnEventsProcessTrayDoubleClick(int index) char * eventProto=NULL;
if (cli.events.items[i]->cle.hContact)
eventProto=(char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)cli.events.items[i]->cle.hContact, 0);
- if (!eventProto)
+ if ( !eventProto)
eventProto=cli.events.items[i]->cle.lpszProtocol;
- if (!eventProto || !_strcmpi(eventProto, szProto)) {
+ if ( !eventProto || !_strcmpi(eventProto, szProto)) {
eventIndex=i;
break;
} }
@@ -319,7 +319,7 @@ int fnEventsProcessTrayDoubleClick(int index) char * eventProto=NULL;
if (cli.events.items[i]->cle.hContact)
eventProto=(char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)cli.events.items[i]->cle.hContact, 0);
- if (!eventProto)
+ if ( !eventProto)
eventProto=cli.events.items[i]->cle.lpszProtocol;
if (eventProto) {
for (j=0; j<cli.trayIconCount; j++)
@@ -338,7 +338,7 @@ int fnEventsProcessTrayDoubleClick(int index) cli.pfnUnlockTray();
hContact = cli.events.items[eventIndex]->cle.hContact;
hDbEvent = cli.events.items[eventIndex]->cle.hDbEvent;
- //if (!ServiceExists(cli.events.items[eventIndex]->cle.pszService))
+ //if ( !ServiceExists(cli.events.items[eventIndex]->cle.pszService))
// ; may be better to show send msg?
CallService(cli.events.items[eventIndex]->cle.pszService, (WPARAM) NULL, (LPARAM) & cli.events.items[eventIndex]->cle);
cli.pfnRemoveEvent(hContact, hDbEvent);
@@ -388,13 +388,13 @@ static int CListEventSettingsChanged(WPARAM wParam, LPARAM 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 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 InitCListEvents(void)
{
- memset( &cli.events, 0, sizeof(cli.events));
+ memset(&cli.events, 0, sizeof(cli.events));
cli.events.increment = 10;
disableTrayFlash = DBGetContactSettingByte(NULL, "CList", "DisableTrayFlash", 0);
@@ -408,18 +408,18 @@ int InitCListEvents(void) return 0;
}
-struct CListEvent* fnCreateEvent( void )
+struct CListEvent* fnCreateEvent(void)
{
- return (struct CListEvent*)mir_calloc( sizeof(struct CListEvent));
+ return (struct CListEvent*)mir_calloc(sizeof(struct CListEvent));
}
-void fnFreeEvent( struct CListEvent* p )
+void fnFreeEvent(struct CListEvent* p)
{
- if ( p->cle.pszService )
- mir_free( p->cle.pszService );
- if ( p->cle.pszTooltip )
- mir_free( p->cle.pszTooltip );
- mir_free( p );
+ if (p->cle.pszService)
+ mir_free(p->cle.pszService);
+ if (p->cle.pszTooltip)
+ mir_free(p->cle.pszTooltip);
+ mir_free(p);
}
void UninitCListEvents(void)
@@ -429,9 +429,9 @@ void UninitCListEvents(void) if (cli.events.count) KillTimer(NULL, flashTimerId);
for (i = 0; i < cli.events.count; i++)
- cli.pfnFreeEvent(( struct CListEvent* )cli.events.items[i] );
- List_Destroy(( SortedList* )&cli.events );
+ cli.pfnFreeEvent((struct CListEvent*)cli.events.items[i]);
+ List_Destroy((SortedList*)&cli.events);
- if ( imlIcon != NULL )
- mir_free( imlIcon );
+ if (imlIcon != NULL)
+ mir_free(imlIcon);
}
diff --git a/src/modules/clist/clistmenus.cpp b/src/modules/clist/clistmenus.cpp index e26ca5f13f..c9cc9212a9 100644 --- a/src/modules/clist/clistmenus.cpp +++ b/src/modules/clist/clistmenus.cpp @@ -141,16 +141,16 @@ typedef struct _MenuItemHandles /////////////////////////////////////////////////////////////////////////////////////////
// service functions
-void FreeMenuProtos( void )
+void FreeMenuProtos(void)
{
int i;
- if ( cli.menuProtos ) {
- for ( i=0; i < cli.menuProtoCount; i++ )
- if ( cli.menuProtos[i].szProto )
+ if (cli.menuProtos) {
+ for (i=0; i < cli.menuProtoCount; i++)
+ if (cli.menuProtos[i].szProto)
mir_free(cli.menuProtos[i].szProto);
- mir_free( cli.menuProtos );
+ mir_free(cli.menuProtos);
cli.menuProtos = NULL;
}
cli.menuProtoCount = 0;
@@ -163,16 +163,16 @@ int GetAverageMode(int* pNetProtoCount = NULL) int netProtoCount = 0;
int averageMode = 0;
- for ( int i=0; i < accounts.getCount(); i++ ) {
+ for (int i=0; i < accounts.getCount(); i++) {
PROTOACCOUNT* pa = accounts[i];
- if ( cli.pfnGetProtocolVisibility( pa->szModuleName ) == 0 )
+ if (cli.pfnGetProtocolVisibility(pa->szModuleName) == 0)
continue;
netProtoCount++;
- if ( averageMode == 0 )
- averageMode = CallProtoService( pa->szModuleName, PS_GETSTATUS, 0, 0 );
- else if ( averageMode > 0 && averageMode != CallProtoService( pa->szModuleName, PS_GETSTATUS, 0, 0 )) {
+ if (averageMode == 0)
+ averageMode = CallProtoService(pa->szModuleName, PS_GETSTATUS, 0, 0);
+ else if (averageMode > 0 && averageMode != CallProtoService(pa->szModuleName, PS_GETSTATUS, 0, 0)) {
averageMode = -1;
if (pNetProtoCount == NULL) break;
}
@@ -215,8 +215,8 @@ static INT_PTR AddMainMenuItem(WPARAM, LPARAM lParam) if ( !cli.pfnConvertMenu(mi, &tmi))
return 0;
- lpMainMenuExecParam mmep = ( lpMainMenuExecParam )mir_alloc( sizeof( MainMenuExecParam ));
- if ( mmep == NULL )
+ lpMainMenuExecParam mmep = (lpMainMenuExecParam)mir_alloc(sizeof(MainMenuExecParam));
+ if (mmep == NULL)
return 0;
//we need just one parametr.
@@ -225,7 +225,7 @@ static INT_PTR AddMainMenuItem(WPARAM, LPARAM lParam) mmep->szMenuName = tmi.ptszName;
tmi.ownerdata = mmep;
- PMO_IntMenuItem pimi = MO_AddNewMenuItem( hMainMenuObject, &tmi );
+ PMO_IntMenuItem pimi = MO_AddNewMenuItem(hMainMenuObject, &tmi);
char* name;
bool needFree = false;
@@ -233,15 +233,15 @@ static INT_PTR AddMainMenuItem(WPARAM, LPARAM lParam) if (mi->pszService)
name = mi->pszService;
else if (mi->flags & CMIF_UNICODE) {
- name = mir_t2a( mi->ptszName );
+ name = mir_t2a(mi->ptszName);
needFree = true;
}
else name = mi->pszName;
- MO_SetOptionsMenuItem( pimi, OPT_MENUITEMSETUNIQNAME, ( INT_PTR )name );
+ MO_SetOptionsMenuItem(pimi, OPT_MENUITEMSETUNIQNAME, (INT_PTR)name);
if (needFree) mir_free(name);
- return ( INT_PTR )pimi;
+ return (INT_PTR)pimi;
}
int MainMenuCheckService(WPARAM, LPARAM)
@@ -254,8 +254,8 @@ int MainMenuCheckService(WPARAM, LPARAM) //lparam - lparam from winproc
INT_PTR MainMenuExecService(WPARAM wParam, LPARAM lParam)
{
- lpMainMenuExecParam mmep = ( lpMainMenuExecParam )wParam;
- if ( mmep != NULL ) {
+ 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"))
mmep->Param1 = 0;
@@ -267,10 +267,10 @@ INT_PTR MainMenuExecService(WPARAM wParam, LPARAM lParam) INT_PTR FreeOwnerDataMainMenu(WPARAM, LPARAM lParam)
{
- lpMainMenuExecParam mmep = ( lpMainMenuExecParam )lParam;
- if ( mmep != NULL ) {
- FreeAndNil(( void** )&mmep->szServiceName);
- FreeAndNil(( void** )&mmep);
+ lpMainMenuExecParam mmep = (lpMainMenuExecParam)lParam;
+ if (mmep != NULL) {
+ FreeAndNil((void**)&mmep->szServiceName);
+ FreeAndNil((void**)&mmep);
}
return 0;
}
@@ -291,52 +291,52 @@ static INT_PTR AddContactMenuItem(WPARAM, LPARAM lParam) if ( !cli.pfnConvertMenu(mi, &tmi))
return 0;
- if ( !( mi->flags & CMIF_ROOTHANDLE )) {
+ if ( !(mi->flags & CMIF_ROOTHANDLE)) {
//old system
tmi.flags |= CMIF_ROOTHANDLE;
tmi.root = NULL;
}
//owner data
- lpContactMenuExecParam cmep = ( lpContactMenuExecParam )mir_calloc(sizeof(ContactMenuExecParam));
- cmep->szServiceName = mir_strdup( mi->pszService );
- if ( mi->pszContactOwner != NULL )
- cmep->pszContactOwner = mir_strdup( mi->pszContactOwner );
+ lpContactMenuExecParam cmep = (lpContactMenuExecParam)mir_calloc(sizeof(ContactMenuExecParam));
+ cmep->szServiceName = mir_strdup(mi->pszService);
+ if (mi->pszContactOwner != NULL)
+ cmep->pszContactOwner = mir_strdup(mi->pszContactOwner);
cmep->param = mi->popupPosition;
tmi.ownerdata = cmep;
//may be need to change how UniqueName is formed?
- PMO_IntMenuItem menuHandle = MO_AddNewMenuItem( hContactMenuObject, &tmi );
+ PMO_IntMenuItem menuHandle = MO_AddNewMenuItem(hContactMenuObject, &tmi);
char buf[ 256 ];
if (mi->pszService)
- mir_snprintf( buf, SIZEOF(buf), "%s/%s", (mi->pszContactOwner) ? mi->pszContactOwner : "", (mi->pszService) ? mi->pszService : "" );
+ mir_snprintf(buf, SIZEOF(buf), "%s/%s", (mi->pszContactOwner) ? mi->pszContactOwner : "", (mi->pszService) ? mi->pszService : "");
else if (mi->ptszName)
{
if (tmi.flags&CMIF_UNICODE)
{
char * temp = mir_t2a(mi->ptszName);
- mir_snprintf( buf, SIZEOF(buf), "%s/NoService/%s", (mi->pszContactOwner) ? mi->pszContactOwner : "", temp );
+ mir_snprintf(buf, SIZEOF(buf), "%s/NoService/%s", (mi->pszContactOwner) ? mi->pszContactOwner : "", temp);
mir_free(temp);
}
else
- mir_snprintf( buf, SIZEOF(buf), "%s/NoService/%s", (mi->pszContactOwner) ? mi->pszContactOwner : "", mi->ptszName );
+ mir_snprintf(buf, SIZEOF(buf), "%s/NoService/%s", (mi->pszContactOwner) ? mi->pszContactOwner : "", mi->ptszName);
}
else buf[0]='\0';
- if (buf[0]) MO_SetOptionsMenuItem( menuHandle, OPT_MENUITEMSETUNIQNAME, ( INT_PTR )buf );
- return ( INT_PTR )menuHandle;
+ if (buf[0]) MO_SetOptionsMenuItem(menuHandle, OPT_MENUITEMSETUNIQNAME, (INT_PTR)buf);
+ return (INT_PTR)menuHandle;
}
static INT_PTR BuildContactMenu(WPARAM wParam, LPARAM)
{
- HANDLE hContact = ( HANDLE )wParam;
+ HANDLE hContact = (HANDLE)wParam;
NotifyEventHooks(hPreBuildContactMenuEvent, (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;
@@ -364,41 +364,41 @@ INT_PTR ContactMenuExecService(WPARAM wParam, LPARAM lParam) //true - ok, false ignore
INT_PTR ContactMenuCheckService(WPARAM wParam, LPARAM)
{
- PCheckProcParam pcpp = ( PCheckProcParam )wParam;
- if ( pcpp == NULL )
+ PCheckProcParam pcpp = (PCheckProcParam)wParam;
+ if (pcpp == NULL)
return FALSE;
- BuildContactParam *bcp = ( BuildContactParam* )pcpp->wParam;
- if ( bcp == NULL )
+ BuildContactParam *bcp = (BuildContactParam*)pcpp->wParam;
+ if (bcp == NULL)
return FALSE;
- lpContactMenuExecParam cmep = ( lpContactMenuExecParam )pcpp->MenuItemOwnerData;
- if ( cmep == NULL ) //this is root...build it
+ lpContactMenuExecParam cmep = (lpContactMenuExecParam)pcpp->MenuItemOwnerData;
+ if (cmep == NULL) //this is root...build it
return TRUE;
- if ( cmep->pszContactOwner != NULL ) {
- if ( bcp->szProto == NULL ) return FALSE;
- if ( strcmp( cmep->pszContactOwner, bcp->szProto )) return FALSE;
+ if (cmep->pszContactOwner != NULL) {
+ if (bcp->szProto == NULL) return FALSE;
+ if (strcmp(cmep->pszContactOwner, bcp->szProto)) return FALSE;
}
TMO_MenuItem mi;
- if ( MO_GetMenuItem(( WPARAM )pcpp->MenuItemHandle, ( LPARAM )&mi ) == 0 ) {
- if ( mi.flags & CMIF_HIDDEN ) return FALSE;
- if ( mi.flags & CMIF_NOTONLIST && bcp->isOnList ) return FALSE;
- if ( mi.flags & CMIF_NOTOFFLIST && !bcp->isOnList ) return FALSE;
- if ( mi.flags & CMIF_NOTONLINE && bcp->isOnline ) return FALSE;
- if ( mi.flags & CMIF_NOTOFFLINE && !bcp->isOnline ) return FALSE;
+ if (MO_GetMenuItem((WPARAM)pcpp->MenuItemHandle, (LPARAM)&mi) == 0) {
+ if (mi.flags & CMIF_HIDDEN) return FALSE;
+ if (mi.flags & CMIF_NOTONLIST && bcp->isOnList) return FALSE;
+ if (mi.flags & CMIF_NOTOFFLIST && !bcp->isOnList) return FALSE;
+ if (mi.flags & CMIF_NOTONLINE && bcp->isOnline) return FALSE;
+ if (mi.flags & CMIF_NOTOFFLINE && !bcp->isOnline) return FALSE;
}
return TRUE;
}
INT_PTR FreeOwnerDataContactMenu (WPARAM, LPARAM lParam)
{
- lpContactMenuExecParam cmep = ( lpContactMenuExecParam )lParam;
- if ( cmep != NULL ) {
- FreeAndNil(( void** )&cmep->szServiceName);
- FreeAndNil(( void** )&cmep->pszContactOwner);
- FreeAndNil(( void** )&cmep);
+ lpContactMenuExecParam cmep = (lpContactMenuExecParam)lParam;
+ if (cmep != NULL) {
+ FreeAndNil((void**)&cmep->szServiceName);
+ FreeAndNil((void**)&cmep->pszContactOwner);
+ FreeAndNil((void**)&cmep);
}
return 0;
}
@@ -408,26 +408,26 @@ INT_PTR FreeOwnerDataContactMenu (WPARAM, LPARAM lParam) BOOL FindMenuHandleByGlobalID(HMENU hMenu, PMO_IntMenuItem id, MenuItemData* itdat)
{
- if (!itdat)
+ if ( !itdat)
return FALSE;
MENUITEMINFO mii = {0};
mii.cbSize = MENUITEMINFO_V4_SIZE;
mii.fMask = MIIM_SUBMENU | MIIM_DATA;
- for ( int i = GetMenuItemCount( hMenu )-1; i >= 0; i-- ) {
+ for (int i = GetMenuItemCount(hMenu)-1; i >= 0; i--) {
GetMenuItemInfo(hMenu, i, TRUE, &mii);
- if ( mii.fType == MFT_SEPARATOR )
+ if (mii.fType == MFT_SEPARATOR)
continue;
BOOL inSub = FALSE;
- if ( mii.hSubMenu )
+ if (mii.hSubMenu)
inSub = FindMenuHandleByGlobalID(mii.hSubMenu, id, itdat);
- if ( inSub )
+ if (inSub)
return inSub;
- PMO_IntMenuItem pimi = MO_GetIntMenuItem(( HGENMENU )mii.dwItemData );
- if ( pimi != NULL ) {
- if ( pimi == id ) {
+ PMO_IntMenuItem pimi = MO_GetIntMenuItem((HGENMENU)mii.dwItemData);
+ if (pimi != NULL) {
+ if (pimi == id) {
itdat->OwnerMenu = hMenu;
itdat->position = i;
return TRUE;
@@ -438,20 +438,20 @@ BOOL FindMenuHandleByGlobalID(HMENU hMenu, PMO_IntMenuItem id, MenuItemData* itd INT_PTR StatusMenuCheckService(WPARAM wParam, LPARAM)
{
- PCheckProcParam pcpp = ( PCheckProcParam )wParam;
- if ( !pcpp )
+ PCheckProcParam pcpp = (PCheckProcParam)wParam;
+ if ( !pcpp)
return TRUE;
- PMO_IntMenuItem timi = MO_GetIntMenuItem( pcpp->MenuItemHandle );
- if ( !timi )
+ PMO_IntMenuItem timi = MO_GetIntMenuItem(pcpp->MenuItemHandle);
+ if ( !timi)
return TRUE;
- StatusMenuExecParam *smep = ( StatusMenuExecParam* )pcpp->MenuItemOwnerData;
- if (smep && !smep->status && smep->custom ) {
- if ( wildcmp(smep->svc, "*XStatus*")) {
+ StatusMenuExecParam *smep = (StatusMenuExecParam*)pcpp->MenuItemOwnerData;
+ if (smep && !smep->status && smep->custom) {
+ if (wildcmp(smep->svc, "*XStatus*")) {
int XStatus = CallProtoService(smep->proto, "/GetXStatus", 0, 0);
char buf[255];
- mir_snprintf( buf, sizeof(buf), "*XStatus%d", XStatus );
+ mir_snprintf(buf, sizeof(buf), "*XStatus%d", XStatus);
bool check = wildcmp(smep->svc, buf);
bool reset = wildcmp(smep->svc, "*XStatus0");
@@ -461,15 +461,15 @@ INT_PTR StatusMenuCheckService(WPARAM wParam, LPARAM) else
timi->mi.flags &= ~CMIF_CHECKED;
- if ( reset || check ) {
- PMO_IntMenuItem timiParent = MO_GetIntMenuItem( timi->mi.root );
+ if (reset || check) {
+ PMO_IntMenuItem timiParent = MO_GetIntMenuItem(timi->mi.root);
if (timiParent) {
CLISTMENUITEM mi2 = {0};
mi2.cbSize = sizeof(mi2);
mi2.flags = CMIM_NAME | CMIF_TCHAR;
mi2.ptszName = LangPackTranslateStringT(timi->mi.hLangpack, timi->mi.hIcon ? timi->mi.ptszName : LPGENT("Custom status"));
- timiParent = MO_GetIntMenuItem( timi->mi.root );
+ timiParent = MO_GetIntMenuItem(timi->mi.root);
MenuItemData it = {0};
@@ -478,15 +478,15 @@ INT_PTR StatusMenuCheckService(WPARAM wParam, LPARAM) TCHAR d[100];
GetMenuString(it.OwnerMenu, it.position, d, SIZEOF(d), MF_BYPOSITION);
- if (!IsWinVer98Plus()) {
+ if ( !IsWinVer98Plus()) {
mi.cbSize = MENUITEMINFO_V4_SIZE;
mi.fMask = MIIM_TYPE | MIIM_STATE;
mi.fType = MFT_STRING;
}
else {
- mi.cbSize = sizeof( mi );
+ mi.cbSize = sizeof(mi);
mi.fMask = MIIM_STRING | MIIM_STATE;
- if ( timi->iconId != -1 ) {
+ if (timi->iconId != -1) {
mi.fMask |= MIIM_BITMAP;
if (IsWinVerVistaPlus() && isThemeActive()) {
if (timi->hBmp == NULL)
@@ -498,7 +498,7 @@ INT_PTR StatusMenuCheckService(WPARAM wParam, LPARAM) }
}
- mi.fState |= (check && !reset ? MFS_CHECKED : MFS_UNCHECKED );
+ mi.fState |= (check && !reset ? MFS_CHECKED : MFS_UNCHECKED);
mi.dwTypeData = mi2.ptszName;
SetMenuItemInfo(it.OwnerMenu, it.position, TRUE, &mi);
}
@@ -509,14 +509,14 @@ INT_PTR StatusMenuCheckService(WPARAM wParam, LPARAM) timiParent->hBmp = NULL;
} } }
}
- else if ( smep && smep->status && !smep->custom ) {
- int curProtoStatus = ( smep->proto ) ? CallProtoService(smep->proto, PS_GETSTATUS, 0, 0) : GetAverageMode();
- if ( smep->status == curProtoStatus )
+ else if (smep && smep->status && !smep->custom) {
+ int curProtoStatus = (smep->proto) ? CallProtoService(smep->proto, PS_GETSTATUS, 0, 0) : GetAverageMode();
+ if (smep->status == curProtoStatus)
timi->mi.flags |= CMIF_CHECKED;
else
timi->mi.flags &= ~CMIF_CHECKED;
}
- else if (( !smep || smep->proto ) && timi->mi.pszName ) {
+ else if (( !smep || smep->proto) && timi->mi.pszName) {
int curProtoStatus=0;
BOOL IconNeedDestroy=FALSE;
char* prot;
@@ -525,20 +525,20 @@ INT_PTR StatusMenuCheckService(WPARAM wParam, LPARAM) else
{
char *prn=mir_u2a(timi->mi.ptszName);
- prot = NEWSTR_ALLOCA( prn );
+ prot = NEWSTR_ALLOCA(prn);
if (prn) mir_free(prn);
}
- if ( Proto_GetAccount( prot ) == NULL )
+ 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 )
+ if (curProtoStatus >= ID_STATUS_OFFLINE && curProtoStatus < ID_STATUS_IDLE)
timi->mi.hIcon = LoadSkinProtoIcon(prot, curProtoStatus);
else {
timi->mi.hIcon=(HICON)CallProtoService(prot, PS_LOADICON, PLI_PROTOCOL|PLIF_SMALL, 0);
- if ( timi->mi.hIcon == (HICON)CALLSERVICE_NOTFOUND )
+ if (timi->mi.hIcon == (HICON)CALLSERVICE_NOTFOUND)
timi->mi.hIcon = NULL;
else
IconNeedDestroy = TRUE;
@@ -546,9 +546,9 @@ INT_PTR StatusMenuCheckService(WPARAM wParam, LPARAM) if (timi->mi.hIcon) {
timi->mi.flags |= CMIM_ICON;
- MO_ModifyMenuItem( timi, &timi->mi );
- if ( IconNeedDestroy ) {
- DestroyIcon( timi->mi.hIcon );
+ MO_ModifyMenuItem(timi, &timi->mi);
+ if (IconNeedDestroy) {
+ DestroyIcon(timi->mi.hIcon);
timi->mi.hIcon = NULL;
}
else IconLib_ReleaseIcon(timi->mi.hIcon, 0);
@@ -559,71 +559,71 @@ INT_PTR StatusMenuCheckService(WPARAM wParam, LPARAM) INT_PTR StatusMenuExecService(WPARAM wParam, LPARAM)
{
- lpStatusMenuExecParam smep = ( lpStatusMenuExecParam )wParam;
- if ( smep != NULL ) {
- if ( smep->custom ) {
+ lpStatusMenuExecParam smep = (lpStatusMenuExecParam)wParam;
+ if (smep != NULL) {
+ if (smep->custom) {
if (smep->svc && *smep->svc)
CallService(smep->svc, 0, (LPARAM)smep->hMenuItem);
}
else {
- if ( smep->status == 0 && smep->protoindex != 0 && smep->proto != NULL ) {
+ if (smep->status == 0 && smep->protoindex != 0 && smep->proto != NULL) {
PMO_IntMenuItem pimi;
char *prot = smep->proto;
char szHumanName[64]={0};
- PROTOACCOUNT * acc = Proto_GetAccount( smep->proto );
+ PROTOACCOUNT * acc = Proto_GetAccount(smep->proto);
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 );
+ CallProtoService(smep->proto, PS_GETNAME, (WPARAM)SIZEOF(szHumanName), (LPARAM)szHumanName);
+ pimi = MO_GetIntMenuItem((HGENMENU)smep->protoindex);
PMO_IntMenuItem root = (PMO_IntMenuItem)pimi->mi.root;
- mir_free( pimi->mi.pszName );
- mir_free( root->mi.pszName );
- if ( i ) {
+ mir_free(pimi->mi.pszName);
+ mir_free(root->mi.pszName);
+ if (i) {
TCHAR buf[256];
pimi->mi.flags|=CMIF_CHECKED;
- if ( cli.bDisplayLocked ) {
+ if (cli.bDisplayLocked) {
mir_sntprintf(buf, SIZEOF(buf), LPGENT("%s (locked)"), acc->tszAccountName);
- pimi->mi.ptszName = mir_tstrdup( buf );
- root->mi.ptszName = mir_tstrdup( buf );
+ pimi->mi.ptszName = mir_tstrdup(buf);
+ root->mi.ptszName = mir_tstrdup(buf);
}
else {
- pimi->mi.ptszName = mir_tstrdup( acc->tszAccountName );
- root->mi.ptszName = mir_tstrdup( acc->tszAccountName );
+ pimi->mi.ptszName = mir_tstrdup(acc->tszAccountName);
+ root->mi.ptszName = mir_tstrdup(acc->tszAccountName);
}
}
else {
- pimi->mi.ptszName = mir_tstrdup( acc->tszAccountName );
- root->mi.ptszName = mir_tstrdup( acc->tszAccountName );
+ pimi->mi.ptszName = mir_tstrdup(acc->tszAccountName);
+ root->mi.ptszName = mir_tstrdup(acc->tszAccountName);
pimi->mi.flags &= ~CMIF_CHECKED;
}
- if ( cli.hwndStatus )
- InvalidateRect( cli.hwndStatus, NULL, TRUE );
+ if (cli.hwndStatus)
+ InvalidateRect(cli.hwndStatus, NULL, TRUE);
}
- else if ( smep->proto != NULL ) {
+ else if (smep->proto != NULL) {
Proto_SetStatus(smep->proto, smep->status);
NotifyEventHooks(hStatusModeChangeEvent, smep->status, (LPARAM)smep->proto);
}
else {
int MenusProtoCount = 0;
- for ( int i=0; i < accounts.getCount(); i++ )
- if ( cli.pfnGetProtocolVisibility( accounts[i]->szModuleName ))
+ for (int i=0; i < accounts.getCount(); i++)
+ if (cli.pfnGetProtocolVisibility(accounts[i]->szModuleName))
MenusProtoCount++;
cli.currentDesiredStatusMode = smep->status;
- for ( int j=0; j < accounts.getCount(); j++ ) {
+ for (int j=0; j < accounts.getCount(); j++) {
PROTOACCOUNT* pa = accounts[j];
- if ( !Proto_IsAccountEnabled( pa ))
+ if ( !Proto_IsAccountEnabled(pa))
continue;
- if ( MenusProtoCount > 1 && Proto_IsAccountLocked( pa ))
+ if (MenusProtoCount > 1 && Proto_IsAccountLocked(pa))
continue;
Proto_SetStatus(pa->szModuleName, cli.currentDesiredStatusMode);
}
- NotifyEventHooks( hStatusModeChangeEvent, cli.currentDesiredStatusMode, 0 );
- DBWriteContactSettingWord( NULL, "CList", "Status", ( WORD )cli.currentDesiredStatusMode );
+ NotifyEventHooks(hStatusModeChangeEvent, cli.currentDesiredStatusMode, 0);
+ DBWriteContactSettingWord(NULL, "CList", "Status", (WORD)cli.currentDesiredStatusMode);
return 1;
} } }
@@ -633,10 +633,10 @@ INT_PTR StatusMenuExecService(WPARAM wParam, LPARAM) INT_PTR FreeOwnerDataStatusMenu(WPARAM, LPARAM lParam)
{
lpStatusMenuExecParam smep = (lpStatusMenuExecParam)lParam;
- if ( smep != NULL ) {
- FreeAndNil(( void** )&smep->proto);
- FreeAndNil(( void** )&smep->svc);
- FreeAndNil(( void** )&smep);
+ if (smep != NULL) {
+ FreeAndNil((void**)&smep->proto);
+ FreeAndNil((void**)&smep->svc);
+ FreeAndNil((void**)&smep);
}
return (0);
@@ -653,30 +653,30 @@ static INT_PTR ModifyCustomMenuItem(WPARAM wParam, LPARAM lParam) if ( !cli.pfnConvertMenu(mi, &tmi))
return 0;
- return MO_ModifyMenuItem(( PMO_IntMenuItem )wParam, &tmi );
+ return MO_ModifyMenuItem((PMO_IntMenuItem)wParam, &tmi);
}
INT_PTR MenuProcessCommand(WPARAM wParam, LPARAM lParam)
{
WORD cmd = LOWORD(wParam);
- if ( HIWORD(wParam) & MPCF_MAINMENU ) {
- int hst = LOWORD( wParam );
- if ( hst >= ID_STATUS_OFFLINE && hst <= ID_STATUS_OUTTOLUNCH ) {
- int pos = statustopos( hst );
- if ( pos != -1 && hStatusMainMenuHandles != NULL )
- return MO_ProcessCommand( hStatusMainMenuHandles[ pos ], lParam );
+ if (HIWORD(wParam) & MPCF_MAINMENU) {
+ int hst = LOWORD(wParam);
+ if (hst >= ID_STATUS_OFFLINE && hst <= ID_STATUS_OUTTOLUNCH) {
+ int pos = statustopos(hst);
+ if (pos != -1 && hStatusMainMenuHandles != NULL)
+ return MO_ProcessCommand(hStatusMainMenuHandles[ pos ], lParam);
} }
- if ( !( cmd >= CLISTMENUIDMIN && cmd <= CLISTMENUIDMAX ))
+ if ( !(cmd >= CLISTMENUIDMIN && cmd <= CLISTMENUIDMAX))
return 0; // DO NOT process ids outside from clist menu id range v0.7.0.27+
//process old menu sys
- if ( HIWORD(wParam) & MPCF_CONTACTMENU )
- return MO_ProcessCommandBySubMenuIdent((int)hContactMenuObject, LOWORD(wParam), lParam );
+ if (HIWORD(wParam) & MPCF_CONTACTMENU)
+ return MO_ProcessCommandBySubMenuIdent((int)hContactMenuObject, LOWORD(wParam), lParam);
//unknown old menu
- return MO_ProcessCommandByMenuIdent( LOWORD(wParam), lParam );
+ return MO_ProcessCommandByMenuIdent(LOWORD(wParam), lParam);
}
BOOL FindMenuHanleByGlobalID(HMENU hMenu, PMO_IntMenuItem id, MenuItemData* itdat)
@@ -686,24 +686,24 @@ BOOL FindMenuHanleByGlobalID(HMENU hMenu, PMO_IntMenuItem id, MenuItemData* itda MENUITEMINFO mii = {0};
BOOL inSub=FALSE;
- if ( !itdat )
+ if ( !itdat)
return FALSE;
mii.cbSize = MENUITEMINFO_V4_SIZE;
mii.fMask = MIIM_SUBMENU | MIIM_DATA;
- for ( i = GetMenuItemCount( hMenu )-1; i >= 0; i-- ) {
- GetMenuItemInfo( hMenu, i, TRUE, &mii );
- if ( mii.fType == MFT_SEPARATOR )
+ for (i = GetMenuItemCount(hMenu)-1; i >= 0; i--) {
+ GetMenuItemInfo(hMenu, i, TRUE, &mii);
+ if (mii.fType == MFT_SEPARATOR)
continue;
- if ( mii.hSubMenu )
- inSub = FindMenuHanleByGlobalID( mii.hSubMenu, id, itdat );
+ if (mii.hSubMenu)
+ inSub = FindMenuHanleByGlobalID(mii.hSubMenu, id, itdat);
if (inSub)
return inSub;
- pimi = MO_GetIntMenuItem(( HGENMENU )mii.dwItemData);
- if ( pimi != NULL ) {
- if ( pimi == id ) {
+ pimi = MO_GetIntMenuItem((HGENMENU)mii.dwItemData);
+ if (pimi != NULL) {
+ if (pimi == id) {
itdat->OwnerMenu = hMenu;
itdat->position = i;
return TRUE;
@@ -717,8 +717,8 @@ static INT_PTR MenuProcessHotkey(WPARAM vKey, LPARAM) prochotkey = true;
bool res =
- MO_ProcessHotKeys( hStatusMenuObject, vKey ) ||
- MO_ProcessHotKeys( hMainMenuObject, vKey );
+ MO_ProcessHotKeys(hStatusMenuObject, vKey) ||
+ MO_ProcessHotKeys(hMainMenuObject, vKey);
prochotkey = false;
@@ -735,18 +735,18 @@ static int MenuIconsChanged(WPARAM, LPARAM) static INT_PTR MeasureMenuItem(WPARAM, LPARAM lParam)
{
- return MO_MeasureMenuItem(( LPMEASUREITEMSTRUCT )lParam );
+ return MO_MeasureMenuItem((LPMEASUREITEMSTRUCT)lParam);
}
static INT_PTR DrawMenuItem(WPARAM, LPARAM lParam)
{
- return MO_DrawMenuItem(( LPDRAWITEMSTRUCT )lParam );
+ return MO_DrawMenuItem((LPDRAWITEMSTRUCT)lParam);
}
int RecursiveDeleteMenu(HMENU hMenu)
{
int cnt = GetMenuItemCount(hMenu);
- for ( int i=0; i < cnt; i++ ) {
+ for (int i=0; i < cnt; i++) {
HMENU submenu = GetSubMenu(hMenu, 0);
if (submenu) DestroyMenu(submenu);
DeleteMenu(hMenu, 0, MF_BYPOSITION);
@@ -781,10 +781,10 @@ static INT_PTR SetStatusMode(WPARAM wParam, LPARAM) int fnGetProtocolVisibility(const char* accName)
{
- if ( accName ) {
- PROTOACCOUNT* pa = Proto_GetAccount( accName );
- return pa && pa->bIsVisible && Proto_IsAccountEnabled( pa ) &&
- pa->ppro && (pa->ppro->GetCaps( PFLAGNUM_2, 0 ) & ~pa->ppro->GetCaps( PFLAGNUM_5, 0 ));
+ if (accName) {
+ PROTOACCOUNT* pa = Proto_GetAccount(accName);
+ return pa && pa->bIsVisible && Proto_IsAccountEnabled(pa) &&
+ pa->ppro && (pa->ppro->GetCaps(PFLAGNUM_2, 0) & ~pa->ppro->GetCaps(PFLAGNUM_5, 0));
}
return FALSE;
@@ -796,15 +796,15 @@ int fnGetProtoIndexByPos(PROTOCOLDESCRIPTOR ** proto, int protoCnt, int Pos) char buf[10];
DBVARIANT dbv;
- _itoa( Pos, buf, 10 );
- if ( !DBGetContactSetting( NULL, "Protocols", buf, &dbv )) {
- for ( p=0; p < protoCnt; p++ ) {
- if ( lstrcmpA( proto[p]->szName, dbv.pszVal ) == 0 ) {
- DBFreeVariant( &dbv );
+ _itoa(Pos, buf, 10);
+ if ( !DBGetContactSetting(NULL, "Protocols", buf, &dbv)) {
+ for (p=0; p < protoCnt; p++) {
+ if (lstrcmpA(proto[p]->szName, dbv.pszVal) == 0) {
+ DBFreeVariant(&dbv);
return p;
} }
- DBFreeVariant( &dbv );
+ DBFreeVariant(&dbv);
}
return -1;
@@ -813,28 +813,28 @@ int fnGetProtoIndexByPos(PROTOCOLDESCRIPTOR ** proto, int protoCnt, int Pos) int fnGetAccountIndexByPos(int Pos)
{
int i;
- for ( i=0; i < accounts.getCount(); i++ )
- if ( accounts[i]->iOrder == Pos )
+ for (i=0; i < accounts.getCount(); i++)
+ if (accounts[i]->iOrder == Pos)
return i;
return -1;
}
-void RebuildMenuOrder( void )
+void RebuildMenuOrder(void)
{
int i, j, s;
DWORD flags;
- BYTE bHideStatusMenu = DBGetContactSettingByte( NULL, "CLUI", "DontHideStatusMenu", 0 ); // cool perversion, though
+ BYTE bHideStatusMenu = DBGetContactSettingByte(NULL, "CLUI", "DontHideStatusMenu", 0); // cool perversion, though
//clear statusmenu
RecursiveDeleteMenu(hStatusMenu);
//status menu
- if ( hStatusMenuObject != 0 ) {
+ if (hStatusMenuObject != 0) {
CallService(MO_REMOVEMENUOBJECT, (WPARAM)hStatusMenuObject, 0);
- mir_free( hStatusMainMenuHandles );
- mir_free( hStatusMenuHandles );
+ mir_free(hStatusMainMenuHandles);
+ mir_free(hStatusMenuHandles);
}
TMenuParam tmp = { 0 };
@@ -844,27 +844,27 @@ void RebuildMenuOrder( void ) tmp.name = "StatusMenu";
hStatusMenuObject=(HANDLE)CallService(MO_CREATENEWMENUOBJECT, (WPARAM)0, (LPARAM)&tmp);
- MO_SetOptionsMenuObject( hStatusMenuObject, OPT_MENUOBJECT_SET_FREE_SERVICE, (INT_PTR)"CLISTMENUS/FreeOwnerDataStatusMenu" );
+ MO_SetOptionsMenuObject(hStatusMenuObject, OPT_MENUOBJECT_SET_FREE_SERVICE, (INT_PTR)"CLISTMENUS/FreeOwnerDataStatusMenu");
- hStatusMainMenuHandles = ( PMO_IntMenuItem* )mir_calloc( SIZEOF(statusModeList) * sizeof( PMO_IntMenuItem* ));
+ hStatusMainMenuHandles = (PMO_IntMenuItem*)mir_calloc(SIZEOF(statusModeList) * sizeof(PMO_IntMenuItem*));
hStatusMainMenuHandlesCnt = SIZEOF(statusModeList);
- hStatusMenuHandles = ( tStatusMenuHandles* )mir_calloc(sizeof(tStatusMenuHandles)*accounts.getCount());
+ hStatusMenuHandles = (tStatusMenuHandles*)mir_calloc(sizeof(tStatusMenuHandles)*accounts.getCount());
hStatusMenuHandlesCnt = accounts.getCount();
FreeMenuProtos();
- for ( s=0; s < accounts.getCount(); s++ ) {
- i = cli.pfnGetAccountIndexByPos( s );
- if ( i == -1 )
+ for (s=0; s < accounts.getCount(); s++) {
+ i = cli.pfnGetAccountIndexByPos(s);
+ if (i == -1)
continue;
PROTOACCOUNT* pa = accounts[i];
int pos = 0;
- if ( !bHideStatusMenu && !cli.pfnGetProtocolVisibility( pa->szModuleName ))
+ if ( !bHideStatusMenu && !cli.pfnGetProtocolVisibility(pa->szModuleName))
continue;
- flags = pa->ppro->GetCaps( PFLAGNUM_2, 0 ) & ~pa->ppro->GetCaps( PFLAGNUM_5, 0 );
+ flags = pa->ppro->GetCaps(PFLAGNUM_2, 0) & ~pa->ppro->GetCaps(PFLAGNUM_5, 0);
int j;
HICON ic;
TCHAR tbuf[256];
@@ -874,21 +874,21 @@ void RebuildMenuOrder( void ) tmi.cbSize = sizeof(tmi);
tmi.flags = CMIF_TCHAR | CMIF_ROOTHANDLE | CMIF_KEEPUNTRANSLATED;
tmi.position = pos++;
- tmi.hIcon = ic = (HICON)CallProtoService( pa->szModuleName, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0 );
+ tmi.hIcon = ic = (HICON)CallProtoService(pa->szModuleName, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0);
- if ( Proto_IsAccountLocked( pa ) && cli.bDisplayLocked ) {
- mir_sntprintf( tbuf, SIZEOF(tbuf), LPGENT("%s (locked)"), pa->tszAccountName );
+ if (Proto_IsAccountLocked(pa) && cli.bDisplayLocked) {
+ mir_sntprintf(tbuf, SIZEOF(tbuf), LPGENT("%s (locked)"), pa->tszAccountName);
tmi.ptszName = tbuf;
}
else tmi.ptszName = pa->tszAccountName;
{
//owner data
- lpStatusMenuExecParam smep = ( lpStatusMenuExecParam )mir_calloc( sizeof( StatusMenuExecParam ));
+ lpStatusMenuExecParam smep = (lpStatusMenuExecParam)mir_calloc(sizeof(StatusMenuExecParam));
smep->proto = mir_strdup(pa->szModuleName);
tmi.ownerdata = smep;
}
- PMO_IntMenuItem rootmenu = MO_AddNewMenuItem( hStatusMenuObject, &tmi );
+ PMO_IntMenuItem rootmenu = MO_AddNewMenuItem(hStatusMenuObject, &tmi);
memset(&tmi, 0, sizeof(tmi));
tmi.cbSize = sizeof(tmi);
@@ -898,24 +898,24 @@ void RebuildMenuOrder( void ) tmi.hIcon = ic;
{
//owner data
- lpStatusMenuExecParam smep = ( lpStatusMenuExecParam )mir_alloc( sizeof( StatusMenuExecParam ));
- memset( smep, 0, sizeof( *smep ));
+ lpStatusMenuExecParam smep = (lpStatusMenuExecParam)mir_alloc(sizeof(StatusMenuExecParam));
+ memset(smep, 0, sizeof(*smep));
smep->proto = mir_strdup(pa->szModuleName);
tmi.ownerdata = smep;
}
- if ( Proto_IsAccountLocked( pa ))
+ if (Proto_IsAccountLocked(pa))
tmi.flags |= CMIF_CHECKED;
- if (( tmi.flags & CMIF_CHECKED ) && cli.bDisplayLocked ) {
- mir_sntprintf( tbuf, SIZEOF(tbuf), LPGENT("%s (locked)"), pa->tszAccountName );
+ if ((tmi.flags & CMIF_CHECKED) && cli.bDisplayLocked) {
+ mir_sntprintf(tbuf, SIZEOF(tbuf), LPGENT("%s (locked)"), pa->tszAccountName);
tmi.ptszName = tbuf;
}
else tmi.ptszName = pa->tszAccountName;
- PMO_IntMenuItem menuHandle = MO_AddNewMenuItem( hStatusMenuObject, &tmi );
- ((lpStatusMenuExecParam)tmi.ownerdata)->protoindex = ( int )menuHandle;
- MO_ModifyMenuItem( menuHandle, &tmi );
+ PMO_IntMenuItem menuHandle = MO_AddNewMenuItem(hStatusMenuObject, &tmi);
+ ((lpStatusMenuExecParam)tmi.ownerdata)->protoindex = (int)menuHandle;
+ MO_ModifyMenuItem(menuHandle, &tmi);
cli.menuProtos=(MenuProto*)mir_realloc(cli.menuProtos, sizeof(MenuProto)*(cli.menuProtoCount+1));
memset(&(cli.menuProtos[cli.menuProtoCount]), 0, sizeof(MenuProto));
@@ -925,29 +925,29 @@ void RebuildMenuOrder( void ) cli.menuProtoCount++;
{
char buf[256];
- mir_snprintf( buf, SIZEOF(buf), "RootProtocolIcon_%s", pa->szModuleName );
- MO_SetOptionsMenuItem( menuHandle, OPT_MENUITEMSETUNIQNAME, ( INT_PTR )buf );
+ mir_snprintf(buf, SIZEOF(buf), "RootProtocolIcon_%s", pa->szModuleName);
+ MO_SetOptionsMenuItem(menuHandle, OPT_MENUITEMSETUNIQNAME, (INT_PTR)buf);
}
DestroyIcon(ic);
pos += 500000;
- for ( j=0; j < SIZEOF(statusModeList); j++ ) {
- if ( !( flags & statusModePf2List[j] ))
+ for (j=0; j < SIZEOF(statusModeList); j++) {
+ if ( !(flags & statusModePf2List[j]))
continue;
//adding
- memset( &tmi, 0, sizeof( tmi ));
+ memset(&tmi, 0, sizeof(tmi));
tmi.cbSize = sizeof(tmi);
tmi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR;
- if ( statusModeList[j] == ID_STATUS_OFFLINE )
+ if (statusModeList[j] == ID_STATUS_OFFLINE)
tmi.flags |= CMIF_CHECKED;
tmi.root = rootmenu;
tmi.position = pos++;
- tmi.ptszName = cli.pfnGetStatusModeDescription( statusModeList[j], GSMDF_UNTRANSLATED );
- tmi.hIcon = LoadSkinProtoIcon( pa->szModuleName, statusModeList[j] );
+ tmi.ptszName = cli.pfnGetStatusModeDescription(statusModeList[j], GSMDF_UNTRANSLATED);
+ tmi.hIcon = LoadSkinProtoIcon(pa->szModuleName, statusModeList[j]);
{
//owner data
- lpStatusMenuExecParam smep = ( lpStatusMenuExecParam )mir_calloc( sizeof( StatusMenuExecParam ));
+ lpStatusMenuExecParam smep = (lpStatusMenuExecParam)mir_calloc(sizeof(StatusMenuExecParam));
smep->custom = FALSE;
smep->status = statusModeList[j];
smep->protoindex = i;
@@ -957,11 +957,11 @@ void RebuildMenuOrder( void ) hStatusMenuHandles[i].protoindex = i;
hStatusMenuHandles[i].protostatus[j] = statusModeList[j];
- hStatusMenuHandles[i].menuhandle[j] = MO_AddNewMenuItem( hStatusMenuObject, &tmi );
+ hStatusMenuHandles[i].menuhandle[j] = MO_AddNewMenuItem(hStatusMenuObject, &tmi);
{
char buf[ 256 ];
mir_snprintf(buf, SIZEOF(buf), "ProtocolIcon_%s_%s", pa->szModuleName, tmi.pszName);
- MO_SetOptionsMenuItem( hStatusMenuHandles[i].menuhandle[j], OPT_MENUITEMSETUNIQNAME, ( INT_PTR )buf );
+ MO_SetOptionsMenuItem(hStatusMenuHandles[i].menuhandle[j], OPT_MENUITEMSETUNIQNAME, (INT_PTR)buf);
}
IconLib_ReleaseIcon(tmi.hIcon, 0);
} }
@@ -970,28 +970,28 @@ void RebuildMenuOrder( void ) int pos = 200000;
//add to root menu
- for ( j=0; j < SIZEOF(statusModeList); j++ ) {
- for ( i=0; i < accounts.getCount(); i++ ) {
+ for (j=0; j < SIZEOF(statusModeList); j++) {
+ for (i=0; i < accounts.getCount(); i++) {
PROTOACCOUNT* pa = accounts[i];
- if ( !bHideStatusMenu && !cli.pfnGetProtocolVisibility( pa->szModuleName ))
+ if ( !bHideStatusMenu && !cli.pfnGetProtocolVisibility(pa->szModuleName))
continue;
flags = pa->ppro->GetCaps(PFLAGNUM_2, 0) & ~pa->ppro->GetCaps(PFLAGNUM_5, 0);
- if ( !( flags & statusModePf2List[j] ))
+ if ( !(flags & statusModePf2List[j]))
continue;
TMO_MenuItem tmi = { 0 };
- tmi.cbSize = sizeof( tmi );
+ tmi.cbSize = sizeof(tmi);
tmi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR;
- if ( statusModeList[j] == ID_STATUS_OFFLINE )
+ if (statusModeList[j] == ID_STATUS_OFFLINE)
tmi.flags |= CMIF_CHECKED;
- tmi.hIcon = LoadSkinIcon( skinIconStatusList[j] );
+ tmi.hIcon = LoadSkinIcon(skinIconStatusList[j]);
tmi.position = pos++;
tmi.hotKey = MAKELPARAM(MOD_CONTROL, '0'+j);
//owner data
- lpStatusMenuExecParam smep = ( lpStatusMenuExecParam )mir_alloc( sizeof( StatusMenuExecParam ));
+ lpStatusMenuExecParam smep = (lpStatusMenuExecParam)mir_alloc(sizeof(StatusMenuExecParam));
smep->custom = FALSE;
smep->status = statusModeList[j];
smep->proto = NULL;
@@ -999,20 +999,20 @@ void RebuildMenuOrder( void ) tmi.ownerdata = smep;
{
TCHAR buf[ 256 ], hotkeyName[ 100 ];
- WORD hotKey = GetHotkeyValue( statusHotkeys[j] );
- HotkeyToName( hotkeyName, SIZEOF(hotkeyName), HIBYTE(hotKey), LOBYTE(hotKey));
- mir_sntprintf( buf, SIZEOF( buf ), LPGENT("%s\t%s"),
- cli.pfnGetStatusModeDescription( statusModeList[j], 0 ), hotkeyName );
+ WORD hotKey = GetHotkeyValue(statusHotkeys[j]);
+ HotkeyToName(hotkeyName, SIZEOF(hotkeyName), HIBYTE(hotKey), LOBYTE(hotKey));
+ mir_sntprintf(buf, SIZEOF(buf), LPGENT("%s\t%s"),
+ cli.pfnGetStatusModeDescription(statusModeList[j], 0), hotkeyName);
tmi.ptszName = buf;
tmi.hotKey = MAKELONG(HIBYTE(hotKey), LOBYTE(hotKey));
- hStatusMainMenuHandles[j] = MO_AddNewMenuItem( hStatusMenuObject, &tmi );
+ hStatusMainMenuHandles[j] = MO_AddNewMenuItem(hStatusMenuObject, &tmi);
}
{
char buf[ 256 ];
- mir_snprintf( buf, sizeof( buf ), "Root2ProtocolIcon_%s_%s", pa->szModuleName, tmi.pszName );
- MO_SetOptionsMenuItem( hStatusMainMenuHandles[j], OPT_MENUITEMSETUNIQNAME, ( INT_PTR )buf );
+ mir_snprintf(buf, sizeof(buf), "Root2ProtocolIcon_%s_%s", pa->szModuleName, tmi.pszName);
+ MO_SetOptionsMenuItem(hStatusMainMenuHandles[j], OPT_MENUITEMSETUNIQNAME, (INT_PTR)buf);
}
- IconLib_ReleaseIcon( tmi.hIcon, 0 );
+ IconLib_ReleaseIcon(tmi.hIcon, 0);
break;
} }
@@ -1021,21 +1021,21 @@ void RebuildMenuOrder( void ) /////////////////////////////////////////////////////////////////////////////////////////
-static int sttRebuildHotkeys( WPARAM, LPARAM )
+static int sttRebuildHotkeys(WPARAM, LPARAM)
{
TMO_MenuItem tmi = { 0 };
- tmi.cbSize = sizeof( tmi );
+ tmi.cbSize = sizeof(tmi);
tmi.flags = CMIM_HOTKEY | CMIM_NAME | CMIF_TCHAR;
- for ( int j=0; j < SIZEOF(statusModeList); j++ ) {
+ for (int j=0; j < SIZEOF(statusModeList); j++) {
TCHAR buf[ 256 ], hotkeyName[ 100 ];
- WORD hotKey = GetHotkeyValue( statusHotkeys[j] );
- HotkeyToName( hotkeyName, SIZEOF(hotkeyName), HIBYTE(hotKey), LOBYTE(hotKey));
- mir_sntprintf( buf, SIZEOF( buf ), LPGENT("%s\t%s"),
- cli.pfnGetStatusModeDescription( statusModeList[j], 0 ), hotkeyName );
+ WORD hotKey = GetHotkeyValue(statusHotkeys[j]);
+ HotkeyToName(hotkeyName, SIZEOF(hotkeyName), HIBYTE(hotKey), LOBYTE(hotKey));
+ mir_sntprintf(buf, SIZEOF(buf), LPGENT("%s\t%s"),
+ cli.pfnGetStatusModeDescription(statusModeList[j], 0), hotkeyName);
tmi.ptszName = buf;
tmi.hotKey = MAKELONG(HIBYTE(hotKey), LOBYTE(hotKey));
- MO_ModifyMenuItem( hStatusMainMenuHandles[j], &tmi );
+ MO_ModifyMenuItem(hStatusMainMenuHandles[j], &tmi);
}
return 0;
@@ -1046,8 +1046,8 @@ static int sttRebuildHotkeys( WPARAM, LPARAM ) int statustopos(int status)
{
int j;
- for ( j = 0; j < SIZEOF(statusModeList); j++ )
- if ( status == statusModeList[j] )
+ for (j = 0; j < SIZEOF(statusModeList); j++)
+ if (status == statusModeList[j])
return j;
return -1;
@@ -1056,10 +1056,10 @@ int statustopos(int status) static int MenuProtoAck(WPARAM, LPARAM lParam)
{
ACKDATA* ack=(ACKDATA*)lParam;
- if ( ack->type != ACKTYPE_STATUS ) return 0;
- if ( ack->result != ACKRESULT_SUCCESS ) return 0;
- if ( hStatusMainMenuHandles == NULL ) return 0;
- if ( cli.pfnGetProtocolVisibility( ack->szModule ) == 0 ) return 0;
+ if (ack->type != ACKTYPE_STATUS) return 0;
+ if (ack->result != ACKRESULT_SUCCESS) return 0;
+ if (hStatusMainMenuHandles == NULL) return 0;
+ if (cli.pfnGetProtocolVisibility(ack->szModule) == 0) return 0;
int overallStatus = GetAverageMode();
@@ -1074,44 +1074,44 @@ static int MenuProtoAck(WPARAM, LPARAM lParam) for (int pos2 = 0; pos2<hStatusMainMenuHandlesCnt; pos2++) {
if (pos2 >= 0 && pos2 < hStatusMainMenuHandlesCnt) {
tmi.flags = CMIM_FLAGS | CMIF_ROOTHANDLE;
- MO_ModifyMenuItem( hStatusMainMenuHandles[pos2], &tmi );
+ MO_ModifyMenuItem(hStatusMainMenuHandles[pos2], &tmi);
} }
cli.currentStatusMenuItem=overallStatus;
pos = statustopos(cli.currentStatusMenuItem);
if (pos>=0 && pos < hStatusMainMenuHandlesCnt) {
tmi.flags = CMIM_FLAGS | CMIF_ROOTHANDLE | CMIF_CHECKED;
- MO_ModifyMenuItem( hStatusMainMenuHandles[pos], &tmi );
+ MO_ModifyMenuItem(hStatusMainMenuHandles[pos], &tmi);
}
// cli.currentDesiredStatusMode = cli.currentStatusMenuItem;
}
else {
- int pos = statustopos( cli.currentStatusMenuItem );
- if ( pos == -1 ) pos=0;
- if ( pos >= 0 && pos < hStatusMainMenuHandlesCnt ) {
+ int pos = statustopos(cli.currentStatusMenuItem);
+ if (pos == -1) pos=0;
+ if (pos >= 0 && pos < hStatusMainMenuHandlesCnt) {
tmi.flags = CMIM_FLAGS | CMIF_ROOTHANDLE;
- MO_ModifyMenuItem( hStatusMainMenuHandles[pos], &tmi );
+ MO_ModifyMenuItem(hStatusMainMenuHandles[pos], &tmi);
}
cli.currentStatusMenuItem=0;
}
- for ( int i=0; i < accounts.getCount(); i++ ) {
- if ( !lstrcmpA( accounts[i]->szModuleName, ack->szModule )) {
- if ((( int )ack->hProcess >= ID_STATUS_OFFLINE || ( int )ack->hProcess == 0 ) && ( int )ack->hProcess < ID_STATUS_OFFLINE + SIZEOF(statusModeList)) {
- int pos = statustopos(( int )ack->hProcess);
- if ( pos == -1 )
+ for (int i=0; i < accounts.getCount(); i++) {
+ if ( !lstrcmpA(accounts[i]->szModuleName, ack->szModule)) {
+ if (((int)ack->hProcess >= ID_STATUS_OFFLINE || (int)ack->hProcess == 0) && (int)ack->hProcess < ID_STATUS_OFFLINE + SIZEOF(statusModeList)) {
+ int pos = statustopos((int)ack->hProcess);
+ if (pos == -1)
pos = 0;
- for ( pos = 0; pos < SIZEOF(statusModeList); pos++ ) {
+ for (pos = 0; pos < SIZEOF(statusModeList); pos++) {
tmi.flags = CMIM_FLAGS | CMIF_ROOTHANDLE;
- MO_ModifyMenuItem( hStatusMenuHandles[i].menuhandle[pos], &tmi );
+ MO_ModifyMenuItem(hStatusMenuHandles[i].menuhandle[pos], &tmi);
} }
- if ( ack->lParam >= ID_STATUS_OFFLINE && ack->lParam < ID_STATUS_OFFLINE + SIZEOF(statusModeList)) {
- int pos = statustopos(( int )ack->lParam );
- if ( pos >= 0 && pos < SIZEOF(statusModeList)) {
+ if (ack->lParam >= ID_STATUS_OFFLINE && ack->lParam < ID_STATUS_OFFLINE + SIZEOF(statusModeList)) {
+ int pos = statustopos((int)ack->lParam);
+ if (pos >= 0 && pos < SIZEOF(statusModeList)) {
tmi.flags = CMIM_FLAGS | CMIF_ROOTHANDLE | CMIF_CHECKED;
- MO_ModifyMenuItem( hStatusMenuHandles[i].menuhandle[pos], &tmi );
+ MO_ModifyMenuItem(hStatusMenuHandles[i].menuhandle[pos], &tmi);
}
}
break;
@@ -1123,7 +1123,7 @@ static int MenuProtoAck(WPARAM, LPARAM lParam) /////////////////////////////////////////////////////////////////////////////////////////
-int fnConvertMenu( CLISTMENUITEM* mi, TMO_MenuItem* pmi )
+int fnConvertMenu(CLISTMENUITEM* mi, TMO_MenuItem* pmi)
{
if (mi == NULL || pmi == NULL)
return FALSE;
@@ -1147,23 +1147,23 @@ int fnConvertMenu( CLISTMENUITEM* mi, TMO_MenuItem* pmi ) /////////////////////////////////////////////////////////////////////////////////////////
-static MenuProto* FindProtocolMenu( const char* proto )
+static MenuProto* FindProtocolMenu(const char* proto)
{
for (int i=0; i < cli.menuProtoCount; i++)
- if ( cli.menuProtos[i].pMenu && !lstrcmpiA( cli.menuProtos[i].szProto, proto ))
+ if (cli.menuProtos[i].pMenu && !lstrcmpiA(cli.menuProtos[i].szProto, proto))
return &cli.menuProtos[i];
- if ( cli.menuProtoCount == 1 )
- if ( !lstrcmpiA( cli.menuProtos[0].szProto, proto ))
+ if (cli.menuProtoCount == 1)
+ if ( !lstrcmpiA(cli.menuProtos[0].szProto, proto))
return &cli.menuProtos[0];
return NULL;
}
-HGENMENU fnGetProtocolMenu( const char* proto )
+HGENMENU fnGetProtocolMenu(const char* proto)
{
- MenuProto* mp = FindProtocolMenu( proto );
- if ( mp )
+ MenuProto* mp = FindProtocolMenu(proto);
+ if (mp)
return mp->pMenu;
return NULL;
@@ -1180,19 +1180,19 @@ static INT_PTR AddStatusMenuItem(WPARAM wParam, LPARAM lParam) // for new style menus the pszPopupName contains the root menu handle
PMO_IntMenuItem pRoot = NULL;
- if ( mi->flags & CMIF_ROOTHANDLE )
- pRoot = MO_GetIntMenuItem( mi->hParentMenu );
+ if (mi->flags & CMIF_ROOTHANDLE)
+ pRoot = MO_GetIntMenuItem(mi->hParentMenu);
// for old style menus the pszPopupName really means the popup name
else {
- MenuProto* mp = FindProtocolMenu( mi->pszContactOwner );
- if ( mp && mi->pszPopupName ) {
- if ( mp->pMenu ) {
- TCHAR* ptszName = ( mi->flags & CMIF_UNICODE ) ? mir_tstrdup(mi->ptszPopupName) : mir_a2t(mi->pszPopupName);
- pRoot = MO_RecursiveWalkMenu( mp->pMenu->submenu.first, FindRoot, ptszName );
- mir_free( ptszName );
+ MenuProto* mp = FindProtocolMenu(mi->pszContactOwner);
+ if (mp && mi->pszPopupName) {
+ if (mp->pMenu) {
+ TCHAR* ptszName = (mi->flags & CMIF_UNICODE) ? mir_tstrdup(mi->ptszPopupName) : mir_a2t(mi->pszPopupName);
+ pRoot = MO_RecursiveWalkMenu(mp->pMenu->submenu.first, FindRoot, ptszName);
+ mir_free(ptszName);
}
- if ( pRoot == NULL ) {
+ if (pRoot == NULL) {
TMO_MenuItem tmi = { 0 };
tmi.cbSize = sizeof(tmi);
tmi.flags = (mi->flags & CMIF_UNICODE) | CMIF_ROOTHANDLE;
@@ -1200,7 +1200,7 @@ static INT_PTR AddStatusMenuItem(WPARAM wParam, LPARAM lParam) tmi.root = mp->pMenu;
tmi.hIcon = NULL;
tmi.pszName = mi->pszPopupName;
- pRoot = MO_AddNewMenuItem( hStatusMenuObject, &tmi );
+ pRoot = MO_AddNewMenuItem(hStatusMenuObject, &tmi);
}
tmi.flags |= CMIF_ROOTHANDLE;
@@ -1209,13 +1209,13 @@ static INT_PTR AddStatusMenuItem(WPARAM wParam, LPARAM lParam) if (wParam) {
int * res=(int*)wParam;
- *res = ( int )pRoot;
+ *res = (int)pRoot;
}
//owner data
lpStatusMenuExecParam smep = NULL;
- if ( mi->pszService ) {
- smep = ( lpStatusMenuExecParam )mir_calloc(sizeof(StatusMenuExecParam));
+ if (mi->pszService) {
+ smep = (lpStatusMenuExecParam)mir_calloc(sizeof(StatusMenuExecParam));
smep->custom = TRUE;
smep->svc=mir_strdup(mi->pszService);
{
@@ -1228,28 +1228,28 @@ static INT_PTR AddStatusMenuItem(WPARAM wParam, LPARAM lParam) }
tmi.ownerdata = smep;
}
- PMO_IntMenuItem menuHandle = MO_AddNewMenuItem( hStatusMenuObject, &tmi );
- if ( smep )
+ PMO_IntMenuItem menuHandle = MO_AddNewMenuItem(hStatusMenuObject, &tmi);
+ if (smep)
smep->hMenuItem = menuHandle;
char buf[MAX_PATH+64];
{
- char* p = ( pRoot ) ? mir_t2a( pRoot->mi.ptszName ) : NULL;
- mir_snprintf( buf, SIZEOF(buf), "%s/%s", ( p ) ? p : "", mi->pszService ? mi->pszService : "" );
- mir_free( p );
+ char* p = (pRoot) ? mir_t2a(pRoot->mi.ptszName) : NULL;
+ mir_snprintf(buf, SIZEOF(buf), "%s/%s", (p) ? p : "", mi->pszService ? mi->pszService : "");
+ mir_free(p);
}
- MO_SetOptionsMenuItem( menuHandle, OPT_MENUITEMSETUNIQNAME, ( INT_PTR )buf );
+ MO_SetOptionsMenuItem(menuHandle, OPT_MENUITEMSETUNIQNAME, (INT_PTR)buf);
- return ( INT_PTR )menuHandle;
+ return (INT_PTR)menuHandle;
}
/////////////////////////////////////////////////////////////////////////////////////////
static INT_PTR HotkeySetStatus(WPARAM wParam, LPARAM lParam)
{
- return SetStatusMode( lParam, 0 );
+ return SetStatusMode(lParam, 0);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -1257,10 +1257,10 @@ static INT_PTR HotkeySetStatus(WPARAM wParam, LPARAM lParam) static INT_PTR AddProtoMenuItem(WPARAM wParam, LPARAM lParam)
{
- if ( DBGetContactSettingByte( NULL, "CList", "MoveProtoMenus", TRUE ))
- return AddStatusMenuItem( wParam, lParam );
+ if (DBGetContactSettingByte(NULL, "CList", "MoveProtoMenus", TRUE))
+ return AddStatusMenuItem(wParam, lParam);
- return AddMainMenuItem( wParam, lParam );
+ return AddMainMenuItem(wParam, lParam);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -1305,7 +1305,7 @@ void InitCustomMenus(void) hPreBuildContactMenuEvent=CreateHookableEvent(ME_CLIST_PREBUILDCONTACTMENU);
hPreBuildMainMenuEvent=CreateHookableEvent(ME_CLIST_PREBUILDMAINMENU);
cli.hPreBuildStatusMenuEvent=CreateHookableEvent(ME_CLIST_PREBUILDSTATUSMENU);
- hStatusModeChangeEvent = CreateHookableEvent( ME_CLIST_STATUSMODECHANGE );
+ hStatusModeChangeEvent = CreateHookableEvent(ME_CLIST_STATUSMODECHANGE);
hAckHook=(HANDLE)HookEvent(ME_PROTO_ACK, MenuProtoAck);
@@ -1331,8 +1331,8 @@ void InitCustomMenus(void) hMainMenuObject=(HANDLE)CallService(MO_CREATENEWMENUOBJECT, (WPARAM)0, (LPARAM)&tmp);
}
- MO_SetOptionsMenuObject( hMainMenuObject, OPT_USERDEFINEDITEMS, TRUE );
- MO_SetOptionsMenuObject( hMainMenuObject, OPT_MENUOBJECT_SET_FREE_SERVICE, (INT_PTR)"CLISTMENUS/FreeOwnerDataMainMenu" );
+ MO_SetOptionsMenuObject(hMainMenuObject, OPT_USERDEFINEDITEMS, TRUE);
+ MO_SetOptionsMenuObject(hMainMenuObject, OPT_MENUOBJECT_SET_FREE_SERVICE, (INT_PTR)"CLISTMENUS/FreeOwnerDataMainMenu");
//contact menu
{
@@ -1344,46 +1344,46 @@ void InitCustomMenus(void) hContactMenuObject=(HANDLE)CallService(MO_CREATENEWMENUOBJECT, (WPARAM)0, (LPARAM)&tmp);
}
- MO_SetOptionsMenuObject( hContactMenuObject, OPT_USERDEFINEDITEMS, TRUE );
- MO_SetOptionsMenuObject( hContactMenuObject, OPT_MENUOBJECT_SET_FREE_SERVICE, (INT_PTR)"CLISTMENUS/FreeOwnerDataContactMenu" );
+ MO_SetOptionsMenuObject(hContactMenuObject, OPT_USERDEFINEDITEMS, TRUE);
+ MO_SetOptionsMenuObject(hContactMenuObject, OPT_MENUOBJECT_SET_FREE_SERVICE, (INT_PTR)"CLISTMENUS/FreeOwnerDataContactMenu");
// initialize hotkeys
CreateServiceFunction(MS_CLIST_HKSTATUS, HotkeySetStatus);
HOTKEYDESC hkd = { 0 };
- hkd.cbSize = sizeof( hkd );
+ hkd.cbSize = sizeof(hkd);
hkd.ptszSection = _T("Status");
hkd.dwFlags = HKD_TCHAR;
- for ( int i = 0; i < SIZEOF(statusHotkeys); i++ ) {
+ for (int i = 0; i < SIZEOF(statusHotkeys); i++) {
char szName[30];
- mir_snprintf( szName, SIZEOF(szName), "StatusHotKey_%d", i );
+ mir_snprintf(szName, SIZEOF(szName), "StatusHotKey_%d", i);
hkd.pszName = szName;
hkd.lParam = statusModeList[i];
- hkd.ptszDescription = fnGetStatusModeDescription( hkd.lParam, 0 );
- hkd.DefHotKey = HOTKEYCODE( HOTKEYF_CONTROL, '0'+i ) | HKF_MIRANDA_LOCAL;
+ hkd.ptszDescription = fnGetStatusModeDescription(hkd.lParam, 0);
+ hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL, '0'+i) | HKF_MIRANDA_LOCAL;
hkd.pszService = MS_CLIST_HKSTATUS;
- statusHotkeys[i] = CallService( MS_HOTKEY_REGISTER, 0, LPARAM( &hkd ));
+ statusHotkeys[i] = CallService(MS_HOTKEY_REGISTER, 0, LPARAM(&hkd));
}
- HookEvent( ME_HOTKEYS_CHANGED, sttRebuildHotkeys );
+ HookEvent(ME_HOTKEYS_CHANGED, sttRebuildHotkeys);
// add exit command to menu
{
CLISTMENUITEM mi = { 0 };
- mi.cbSize = sizeof( mi );
+ mi.cbSize = sizeof(mi);
mi.position = 0x7fffffff;
mi.flags = CMIF_ICONFROMICOLIB;
mi.pszService = "CloseAction";
mi.pszName = LPGEN("E&xit");
- mi.icolibItem = GetSkinIconHandle( SKINICON_OTHER_EXIT );
- AddMainMenuItem( 0, ( LPARAM )&mi );
+ mi.icolibItem = GetSkinIconHandle(SKINICON_OTHER_EXIT);
+ AddMainMenuItem(0, (LPARAM)&mi);
}
cli.currentStatusMenuItem=ID_STATUS_OFFLINE;
cli.currentDesiredStatusMode=ID_STATUS_OFFLINE;
- if ( IsWinVer98Plus() )
- HookEvent(ME_SKIN_ICONSCHANGED, MenuIconsChanged );
+ if (IsWinVer98Plus())
+ HookEvent(ME_SKIN_ICONSCHANGED, MenuIconsChanged);
}
void UninitCustomMenus(void)
@@ -1391,11 +1391,11 @@ void UninitCustomMenus(void) mir_free(hStatusMainMenuHandles);
hStatusMainMenuHandles = NULL;
- mir_free( hStatusMenuHandles );
+ mir_free(hStatusMenuHandles);
hStatusMenuHandles = NULL;
- if ( hMainMenuObject ) CallService( MO_REMOVEMENUOBJECT, (WPARAM)hMainMenuObject, 0 );
- if ( hStatusMenuObject ) CallService( MO_REMOVEMENUOBJECT, (WPARAM)hMainMenuObject, 0 );
+ if (hMainMenuObject) CallService(MO_REMOVEMENUOBJECT, (WPARAM)hMainMenuObject, 0);
+ if (hStatusMenuObject) CallService(MO_REMOVEMENUOBJECT, (WPARAM)hMainMenuObject, 0);
UnloadMoveToGroup();
FreeMenuProtos();
diff --git a/src/modules/clist/clistmod.cpp b/src/modules/clist/clistmod.cpp index 4c8df451d0..26ad72ae7c 100644 --- a/src/modules/clist/clistmod.cpp +++ b/src/modules/clist/clistmod.cpp @@ -57,7 +57,7 @@ OBJLIST<ProtoIconIndex> protoIconIndex(5); static HANDLE hProtoAckHook;
static HANDLE hContactSettingChanged;
-TCHAR* fnGetStatusModeDescription( int mode, int flags )
+TCHAR* fnGetStatusModeDescription(int mode, int flags)
{
static TCHAR szMode[64];
TCHAR* descr;
@@ -111,19 +111,19 @@ TCHAR* fnGetStatusModeDescription( int mode, int flags ) return NULL;
}
if (noPrefixReqd || !(flags & GSMDF_PREFIXONLINE))
- return ( flags & GSMDF_UNTRANSLATED ) ? descr : TranslateTS( descr );
+ return (flags & GSMDF_UNTRANSLATED) ? descr : TranslateTS(descr);
- lstrcpy( szMode, TranslateT( "Online" ));
- lstrcat( szMode, _T(": "));
- lstrcat( szMode, ( flags & GSMDF_UNTRANSLATED ) ? descr : TranslateTS( descr ));
+ lstrcpy(szMode, TranslateT("Online"));
+ lstrcat(szMode, _T(": "));
+ lstrcat(szMode, (flags & GSMDF_UNTRANSLATED) ? descr : TranslateTS(descr));
return szMode;
}
static INT_PTR GetStatusModeDescription(WPARAM wParam, LPARAM lParam)
{
- TCHAR* buf1 = cli.pfnGetStatusModeDescription( wParam, lParam );
+ TCHAR* buf1 = cli.pfnGetStatusModeDescription(wParam, lParam);
- if ( !( lParam & GSMDF_TCHAR ))
+ if ( !(lParam & GSMDF_TCHAR))
{
static char szMode[64];
char *buf2 = mir_u2a(buf1);
@@ -164,24 +164,24 @@ static int ProtocolAck(WPARAM, LPARAM lParam) return 0;
}
-HICON fnGetIconFromStatusMode( HANDLE hContact, const char *szProto, int status )
+HICON fnGetIconFromStatusMode(HANDLE hContact, const char *szProto, int status)
{
- return ImageList_GetIcon( hCListImages, cli.pfnIconFromStatusMode( szProto, status, hContact ), ILD_NORMAL);
+ return ImageList_GetIcon(hCListImages, cli.pfnIconFromStatusMode(szProto, status, hContact), ILD_NORMAL);
}
-int fnIconFromStatusMode(const char *szProto, int status, HANDLE )
+int fnIconFromStatusMode(const char *szProto, int status, HANDLE)
{
int index, i;
- for ( index = 0; index < SIZEOF(statusModeList); index++ )
- if ( status == statusModeList[index] )
+ for (index = 0; index < SIZEOF(statusModeList); index++)
+ if (status == statusModeList[index])
break;
- if ( index == SIZEOF(statusModeList))
+ if (index == SIZEOF(statusModeList))
index = 0;
if (szProto == NULL)
return index + 1;
- for ( i = 0; i < protoIconIndex.getCount(); i++ ) {
+ for (i = 0; i < protoIconIndex.getCount(); i++) {
if (strcmp(szProto, protoIconIndex[i].szProto) == 0)
return protoIconIndex[i].iIconBase + index;
}
@@ -197,19 +197,19 @@ static INT_PTR GetContactIcon(WPARAM wParam, LPARAM) szProto == NULL ? ID_STATUS_OFFLINE : DBGetContactSettingWord(hContact, szProto, "Status", ID_STATUS_OFFLINE), hContact);
}
-static void AddProtoIconIndex( PROTOACCOUNT* pa )
+static void AddProtoIconIndex(PROTOACCOUNT* pa)
{
ProtoIconIndex *pii = new ProtoIconIndex;
pii->szProto = pa->szModuleName;
for (int i = 0; i < SIZEOF(statusModeList); i++) {
- int iImg = ImageList_AddIcon_ProtoIconLibLoaded(hCListImages, pa->szModuleName, statusModeList[i] );
+ int iImg = ImageList_AddIcon_ProtoIconLibLoaded(hCListImages, pa->szModuleName, statusModeList[i]);
if (i == 0)
pii->iIconBase = iImg;
}
protoIconIndex.insert(pii);
}
-static void RemoveProtoIconIndex( PROTOACCOUNT* pa )
+static void RemoveProtoIconIndex(PROTOACCOUNT* pa)
{
for (int i = 0; i < protoIconIndex.getCount(); i++)
if (strcmp(protoIconIndex[i].szProto, pa->szModuleName) == 0) {
@@ -220,14 +220,14 @@ static void RemoveProtoIconIndex( PROTOACCOUNT* pa ) static int ContactListModulesLoaded(WPARAM, LPARAM)
{
- if ( !ServiceExists( MS_DB_CONTACT_GETSETTING_STR )) {
- MessageBox( NULL, TranslateT( "This plugin requires db3x plugin version 0.5.1.0 or later" ), _T("CList"), MB_OK );
+ if ( !ServiceExists(MS_DB_CONTACT_GETSETTING_STR)) {
+ MessageBox(NULL, TranslateT("This plugin requires db3x plugin version 0.5.1.0 or later"), _T("CList"), MB_OK);
return 1;
}
RebuildMenuOrder();
for (int i = 0; i < accounts.getCount(); i++)
- AddProtoIconIndex( accounts[i] );
+ AddProtoIconIndex(accounts[i]);
cli.pfnLoadContactTree();
@@ -238,37 +238,37 @@ static int ContactListModulesLoaded(WPARAM, LPARAM) return 0;
}
-static int ContactListAccountsChanged( WPARAM eventCode, LPARAM lParam )
+static int ContactListAccountsChanged(WPARAM eventCode, LPARAM lParam)
{
switch (eventCode)
{
case PRAC_ADDED:
- AddProtoIconIndex(( PROTOACCOUNT* )lParam );
+ AddProtoIconIndex((PROTOACCOUNT*)lParam);
break;
case PRAC_REMOVED:
- RemoveProtoIconIndex(( PROTOACCOUNT* )lParam );
+ RemoveProtoIconIndex((PROTOACCOUNT*)lParam);
break;
}
cli.pfnReloadProtoMenus();
cli.pfnTrayIconIconsChanged();
- cli.pfnClcBroadcast( INTM_RELOADOPTIONS, 0, 0 );
- cli.pfnClcBroadcast( INTM_INVALIDATE, 0, 0 );
+ cli.pfnClcBroadcast(INTM_RELOADOPTIONS, 0, 0);
+ cli.pfnClcBroadcast(INTM_INVALIDATE, 0, 0);
return 0;
}
static INT_PTR ContactDoubleClicked(WPARAM wParam, LPARAM)
{
// Try to process event myself
- if ( cli.pfnEventsProcessContactDoubleClick(( HANDLE )wParam ) == 0 )
+ if (cli.pfnEventsProcessContactDoubleClick((HANDLE)wParam) == 0)
return 0;
// Allow third-party plugins to process a dblclick
- if ( NotifyEventHooks( hContactDoubleClicked, wParam, 0 ))
+ if (NotifyEventHooks(hContactDoubleClicked, wParam, 0))
return 0;
// Otherwise try to execute the default action
- TryProcessDoubleClick(( HANDLE )wParam );
+ TryProcessDoubleClick((HANDLE)wParam);
return 0;
}
@@ -288,14 +288,14 @@ static int CListIconsChanged(WPARAM, LPARAM) int i, j;
for (i = 0; i < SIZEOF(statusModeList); i++)
- ImageList_ReplaceIcon_IconLibLoaded(hCListImages, i + 1, LoadSkinIcon( skinIconStatusList[i] ));
- ImageList_ReplaceIcon_IconLibLoaded(hCListImages, IMAGE_GROUPOPEN, LoadSkinIcon( SKINICON_OTHER_GROUPOPEN ));
- ImageList_ReplaceIcon_IconLibLoaded(hCListImages, IMAGE_GROUPSHUT, LoadSkinIcon( SKINICON_OTHER_GROUPSHUT ));
+ ImageList_ReplaceIcon_IconLibLoaded(hCListImages, i + 1, LoadSkinIcon(skinIconStatusList[i]));
+ ImageList_ReplaceIcon_IconLibLoaded(hCListImages, IMAGE_GROUPOPEN, LoadSkinIcon(SKINICON_OTHER_GROUPOPEN));
+ ImageList_ReplaceIcon_IconLibLoaded(hCListImages, IMAGE_GROUPSHUT, LoadSkinIcon(SKINICON_OTHER_GROUPSHUT));
for (i = 0; i < protoIconIndex.getCount(); i++)
for (j = 0; j < SIZEOF(statusModeList); j++)
- ImageList_ReplaceIcon_IconLibLoaded(hCListImages, protoIconIndex[i].iIconBase + j, LoadSkinProtoIcon(protoIconIndex[i].szProto, statusModeList[j] ));
+ ImageList_ReplaceIcon_IconLibLoaded(hCListImages, protoIconIndex[i].iIconBase + j, LoadSkinProtoIcon(protoIconIndex[i].szProto, statusModeList[j]));
cli.pfnTrayIconIconsChanged();
- cli.pfnInvalidateRect( cli.hwndContactList, NULL, TRUE);
+ cli.pfnInvalidateRect(cli.hwndContactList, NULL, TRUE);
return 0;
}
@@ -382,7 +382,7 @@ int fnShowHide(WPARAM, LPARAM) switch (iVisibleState) {
case GWVS_PARTIALLY_COVERED:
//If we don't want to bring it to top, we can use a simple break. This goes against readability ;-) but the comment explains it.
- if (!DBGetContactSettingByte(NULL, "CList", "BringToFront", SETTING_BRINGTOFRONT_DEFAULT))
+ if ( !DBGetContactSettingByte(NULL, "CList", "BringToFront", SETTING_BRINGTOFRONT_DEFAULT))
break;
case GWVS_COVERED: //Fall through (and we're already falling)
case GWVS_HIDDEN:
@@ -398,7 +398,7 @@ int fnShowHide(WPARAM, LPARAM) RECT rcWindow;
ShowWindow(cli.hwndContactList, SW_RESTORE);
- if (!DBGetContactSettingByte(NULL, "CList", "OnTop", SETTING_ONTOP_DEFAULT))
+ if ( !DBGetContactSettingByte(NULL, "CList", "OnTop", SETTING_ONTOP_DEFAULT))
SetWindowPos(cli.hwndContactList, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
else
SetWindowPos(cli.hwndContactList, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
@@ -441,7 +441,7 @@ int fnShowHide(WPARAM, LPARAM) int GetStatusModeOrdering(int statusMode);
extern int sortByStatus, sortByProto;
-static INT_PTR CompareContacts( WPARAM wParam, LPARAM lParam )
+static INT_PTR CompareContacts(WPARAM wParam, LPARAM lParam)
{
HANDLE a = (HANDLE) wParam, b = (HANDLE) lParam;
TCHAR namea[128], *nameb;
@@ -480,10 +480,10 @@ static INT_PTR CompareContacts( WPARAM wParam, LPARAM lParam ) }
}
- nameb = cli.pfnGetContactDisplayName( a, 0);
+ nameb = cli.pfnGetContactDisplayName(a, 0);
_tcsncpy(namea, nameb, SIZEOF(namea));
namea[ SIZEOF(namea)-1 ] = 0;
- nameb = cli.pfnGetContactDisplayName( b, 0);
+ nameb = cli.pfnGetContactDisplayName(b, 0);
//otherwise just compare names
return _tcsicmp(namea, nameb);
@@ -491,12 +491,12 @@ static INT_PTR CompareContacts( WPARAM wParam, LPARAM lParam ) /***************************************************************************************/
-static INT_PTR TrayIconProcessMessageStub( WPARAM wParam, LPARAM lParam ) { return cli.pfnTrayIconProcessMessage( wParam, lParam ); }
-static INT_PTR TrayIconPauseAutoHideStub( WPARAM wParam, LPARAM lParam ) { return cli.pfnTrayIconPauseAutoHide( wParam, lParam ); }
-static INT_PTR ShowHideStub( WPARAM wParam, LPARAM lParam ) { return cli.pfnShowHide( wParam, lParam ); }
-static INT_PTR SetHideOfflineStub( WPARAM wParam, LPARAM lParam ) { return cli.pfnSetHideOffline( wParam, lParam ); }
-static INT_PTR Docking_ProcessWindowMessageStub( WPARAM wParam, LPARAM lParam ) { return cli.pfnDocking_ProcessWindowMessage( wParam, lParam ); }
-static INT_PTR HotkeysProcessMessageStub( WPARAM wParam, LPARAM lParam ) { return cli.pfnHotkeysProcessMessage( wParam, lParam ); }
+static INT_PTR TrayIconProcessMessageStub(WPARAM wParam, LPARAM lParam) { return cli.pfnTrayIconProcessMessage(wParam, lParam); }
+static INT_PTR TrayIconPauseAutoHideStub(WPARAM wParam, LPARAM lParam) { return cli.pfnTrayIconPauseAutoHide(wParam, lParam); }
+static INT_PTR ShowHideStub(WPARAM wParam, LPARAM lParam) { return cli.pfnShowHide(wParam, lParam); }
+static INT_PTR SetHideOfflineStub(WPARAM wParam, LPARAM lParam) { return cli.pfnSetHideOffline(wParam, lParam); }
+static INT_PTR Docking_ProcessWindowMessageStub(WPARAM wParam, LPARAM lParam) { return cli.pfnDocking_ProcessWindowMessage(wParam, lParam); }
+static INT_PTR HotkeysProcessMessageStub(WPARAM wParam, LPARAM lParam) { return cli.pfnHotkeysProcessMessage(wParam, lParam); }
int LoadContactListModule2(void)
{
@@ -513,7 +513,7 @@ int LoadContactListModule2(void) CreateServiceFunction(MS_CLIST_GETSTATUSMODEDESCRIPTION, GetStatusModeDescription);
CreateServiceFunction(MS_CLIST_GETCONTACTDISPLAYNAME, GetContactDisplayName);
CreateServiceFunction(MS_CLIST_INVALIDATEDISPLAYNAME, InvalidateDisplayName);
- CreateServiceFunction(MS_CLIST_TRAYICONPROCESSMESSAGE, TrayIconProcessMessageStub );
+ CreateServiceFunction(MS_CLIST_TRAYICONPROCESSMESSAGE, TrayIconProcessMessageStub);
CreateServiceFunction(MS_CLIST_PAUSEAUTOHIDE, TrayIconPauseAutoHideStub);
CreateServiceFunction(MS_CLIST_CONTACTSCOMPARE, CompareContacts);
CreateServiceFunction(MS_CLIST_CONTACTCHANGEGROUP, ContactChangeGroup);
@@ -539,18 +539,18 @@ int LoadContactListModule2(void) int i;
//now all core skin icons are loaded via icon lib. so lets release them
for (i = 0; i < SIZEOF(statusModeList); i++)
- ImageList_AddIcon_IconLibLoaded(hCListImages, skinIconStatusList[i] );
+ ImageList_AddIcon_IconLibLoaded(hCListImages, skinIconStatusList[i]);
}
//see IMAGE_GROUP... in clist.h if you add more images above here
- ImageList_AddIcon_IconLibLoaded(hCListImages, SKINICON_OTHER_GROUPOPEN );
- ImageList_AddIcon_IconLibLoaded(hCListImages, SKINICON_OTHER_GROUPSHUT );
+ ImageList_AddIcon_IconLibLoaded(hCListImages, SKINICON_OTHER_GROUPOPEN);
+ ImageList_AddIcon_IconLibLoaded(hCListImages, SKINICON_OTHER_GROUPSHUT);
return 0;
}
void UnloadContactListModule()
{
- if ( hCListImages ) {
+ if (hCListImages) {
//remove transitory contacts
HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
while (hContact != NULL) {
diff --git a/src/modules/clist/clistsettings.cpp b/src/modules/clist/clistsettings.cpp index 07684d5c0a..710bd6aaf0 100644 --- a/src/modules/clist/clistsettings.cpp +++ b/src/modules/clist/clistsettings.cpp @@ -25,63 +25,63 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. SortedList* clistCache = NULL;
-static int compareContacts( ClcCacheEntryBase* p1, ClcCacheEntryBase* p2 )
+static int compareContacts(ClcCacheEntryBase* p1, ClcCacheEntryBase* p2)
{
- return ( char* )p1->hContact - ( char* )p2->hContact;
+ return (char*)p1->hContact - (char*)p2->hContact;
}
void InitDisplayNameCache(void)
{
- clistCache = List_Create( 0, 50 );
- clistCache->sortFunc = ( FSortFunc )compareContacts;
+ clistCache = List_Create(0, 50);
+ clistCache->sortFunc = (FSortFunc)compareContacts;
}
void FreeDisplayNameCache(void)
{
- if ( clistCache != NULL ) {
+ if (clistCache != NULL) {
int i;
- for ( i = 0; i < clistCache->realCount; i++) {
- cli.pfnFreeCacheItem(( ClcCacheEntryBase* )clistCache->items[i] );
- mir_free( clistCache->items[i] );
+ for (i = 0; i < clistCache->realCount; i++) {
+ cli.pfnFreeCacheItem((ClcCacheEntryBase*)clistCache->items[i]);
+ mir_free(clistCache->items[i]);
}
- List_Destroy( clistCache );
+ List_Destroy(clistCache);
mir_free(clistCache);
clistCache = NULL;
} }
// default handlers for the cache item creation and destruction
-ClcCacheEntryBase* fnCreateCacheItem( HANDLE hContact )
+ClcCacheEntryBase* fnCreateCacheItem(HANDLE hContact)
{
- ClcCacheEntryBase* p = ( ClcCacheEntryBase* )mir_calloc( sizeof( ClcCacheEntryBase ));
- if ( p == NULL )
+ ClcCacheEntryBase* p = (ClcCacheEntryBase*)mir_calloc(sizeof(ClcCacheEntryBase));
+ if (p == NULL)
return NULL;
p->hContact = hContact;
return p;
}
-void fnCheckCacheItem( ClcCacheEntryBase* p )
+void fnCheckCacheItem(ClcCacheEntryBase* p)
{
DBVARIANT dbv;
- if ( p->group == NULL ) {
- if ( !DBGetContactSettingTString( p->hContact, "CList", "Group", &dbv )) {
- p->group = mir_tstrdup( dbv.ptszVal );
- mir_free( dbv.ptszVal );
+ if (p->group == NULL) {
+ if ( !DBGetContactSettingTString(p->hContact, "CList", "Group", &dbv)) {
+ p->group = mir_tstrdup(dbv.ptszVal);
+ mir_free(dbv.ptszVal);
}
- else p->group = mir_tstrdup( _T("") );
+ else p->group = mir_tstrdup(_T(""));
}
- if ( p->isHidden == -1 )
- p->isHidden = DBGetContactSettingByte( p->hContact, "CList", "Hidden", 0 );
+ if (p->isHidden == -1)
+ p->isHidden = DBGetContactSettingByte(p->hContact, "CList", "Hidden", 0);
}
-void fnFreeCacheItem( ClcCacheEntryBase* p )
+void fnFreeCacheItem(ClcCacheEntryBase* p)
{
- if ( p->name ) { mir_free( p->name ); p->name = NULL; }
- if ( p->szName ) { mir_free( p->szName); p->szName = NULL; }
- if ( p->group ) { mir_free( p->group ); p->group = NULL; }
+ if (p->name) { mir_free(p->name); p->name = NULL; }
+ if (p->szName) { mir_free(p->szName); p->szName = NULL; }
+ if (p->group) { mir_free(p->group); p->group = NULL; }
p->isHidden = -1;
}
@@ -89,15 +89,15 @@ ClcCacheEntryBase* fnGetCacheEntry(HANDLE hContact) {
ClcCacheEntryBase* p;
int idx;
- if ( !List_GetIndex( clistCache, &hContact, &idx )) {
- if (( p = cli.pfnCreateCacheItem( hContact )) != NULL ) {
- List_Insert( clistCache, p, idx );
- cli.pfnInvalidateDisplayNameCacheEntry( p );
+ if ( !List_GetIndex(clistCache, &hContact, &idx)) {
+ if ((p = cli.pfnCreateCacheItem(hContact)) != NULL) {
+ List_Insert(clistCache, p, idx);
+ cli.pfnInvalidateDisplayNameCacheEntry(p);
}
}
- else p = ( ClcCacheEntryBase* )clistCache->items[idx];
+ else p = (ClcCacheEntryBase*)clistCache->items[idx];
- cli.pfnCheckCacheItem( p );
+ cli.pfnCheckCacheItem(p);
return p;
}
@@ -110,21 +110,21 @@ void fnInvalidateDisplayNameCacheEntry(HANDLE hContact) }
else {
int idx;
- if ( List_GetIndex( clistCache, &hContact, &idx ))
- cli.pfnFreeCacheItem(( ClcCacheEntryBase* )clistCache->items[idx] );
+ if (List_GetIndex(clistCache, &hContact, &idx))
+ cli.pfnFreeCacheItem((ClcCacheEntryBase*)clistCache->items[idx]);
} }
-TCHAR* fnGetContactDisplayName( HANDLE hContact, int mode )
+TCHAR* fnGetContactDisplayName(HANDLE hContact, int mode)
{
CONTACTINFO ci;
TCHAR *buffer;
ClcCacheEntryBase* cacheEntry = NULL;
- if ( mode & GCDNF_NOCACHE )
+ if (mode & GCDNF_NOCACHE)
mode &= ~GCDNF_NOCACHE;
- else if ( mode != GCDNF_NOMYHANDLE) {
- cacheEntry = cli.pfnGetCacheEntry( hContact );
- if ( cacheEntry->name )
+ else if (mode != GCDNF_NOMYHANDLE) {
+ cacheEntry = cli.pfnGetCacheEntry(hContact);
+ if (cacheEntry->name)
return cacheEntry->name;
}
ZeroMemory(&ci, sizeof(ci));
@@ -133,33 +133,33 @@ TCHAR* fnGetContactDisplayName( HANDLE hContact, int mode ) if (ci.hContact == NULL)
ci.szProto = "ICQ";
ci.dwFlag = ((mode == GCDNF_NOMYHANDLE) ? CNF_DISPLAYNC : CNF_DISPLAY) | CNF_TCHAR;
- if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM) & ci)) {
+ if ( !CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM) & ci)) {
if (ci.type == CNFT_ASCIIZ) {
if (cacheEntry == NULL)
return ci.pszVal;
cacheEntry->name = ci.pszVal;
- cacheEntry->szName = mir_u2a( ci.pszVal );
+ cacheEntry->szName = mir_u2a(ci.pszVal);
return ci.pszVal;
}
if (ci.type == CNFT_DWORD) {
if (cacheEntry == NULL) {
- buffer = (TCHAR*) mir_alloc(15 * sizeof( TCHAR ));
- _ltot(ci.dVal, buffer, 10 );
+ buffer = (TCHAR*) mir_alloc(15 * sizeof(TCHAR));
+ _ltot(ci.dVal, buffer, 10);
return buffer;
}
else {
- buffer = (TCHAR*) mir_alloc(15 * sizeof( TCHAR ));
- _ltot(ci.dVal, buffer, 10 );
+ buffer = (TCHAR*) mir_alloc(15 * sizeof(TCHAR));
+ _ltot(ci.dVal, buffer, 10);
cacheEntry->name = buffer;
- cacheEntry->szName = mir_u2a( buffer );
+ cacheEntry->szName = mir_u2a(buffer);
return buffer;
} } }
CallContactService(hContact, PSS_GETINFO, SGIF_MINIMAL, 0);
buffer = TranslateT("(Unknown Contact)");
- return ( cacheEntry == NULL ) ? mir_tstrdup( buffer ) : buffer;
+ return (cacheEntry == NULL) ? mir_tstrdup(buffer) : buffer;
}
INT_PTR GetContactDisplayName(WPARAM wParam, LPARAM lParam)
@@ -169,12 +169,12 @@ INT_PTR GetContactDisplayName(WPARAM wParam, LPARAM lParam) char *buffer;
HANDLE hContact = (HANDLE)wParam;
- if ( lParam & GCDNF_UNICODE )
- return ( INT_PTR )cli.pfnGetContactDisplayName(hContact, lParam & ~GCDNF_UNICODE );
+ if (lParam & GCDNF_UNICODE)
+ return (INT_PTR)cli.pfnGetContactDisplayName(hContact, lParam & ~GCDNF_UNICODE);
if ((int) lParam != GCDNF_NOMYHANDLE) {
cacheEntry = cli.pfnGetCacheEntry(hContact);
- if ( cacheEntry->szName )
+ if (cacheEntry->szName)
return (INT_PTR)cacheEntry->szName;
}
ZeroMemory(&ci, sizeof(ci));
@@ -183,30 +183,30 @@ INT_PTR GetContactDisplayName(WPARAM wParam, LPARAM lParam) if (ci.hContact == NULL)
ci.szProto = "ICQ";
ci.dwFlag = ((lParam == GCDNF_NOMYHANDLE) ? CNF_DISPLAYNC : CNF_DISPLAY) | CNF_TCHAR;
- if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM) & ci)) {
+ if ( !CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM) & ci)) {
if (ci.type == CNFT_ASCIIZ) {
if (cacheEntry == NULL) {
- buffer = mir_u2a( ci.pszVal );
+ buffer = mir_u2a(ci.pszVal);
mir_free(ci.pszVal);
return (INT_PTR) buffer;
}
else {
cacheEntry->name = ci.pszVal;
- cacheEntry->szName = mir_u2a( ci.pszVal );
+ cacheEntry->szName = mir_u2a(ci.pszVal);
return (INT_PTR)cacheEntry->szName;
}
}
if (ci.type == CNFT_DWORD) {
if (cacheEntry == NULL) {
- buffer = ( char* )mir_alloc(15);
- _ltoa(ci.dVal, buffer, 10 );
+ buffer = (char*)mir_alloc(15);
+ _ltoa(ci.dVal, buffer, 10);
return (INT_PTR) buffer;
}
else {
- buffer = ( char* )mir_alloc(15);
- _ltoa(ci.dVal, buffer, 10 );
+ buffer = (char*)mir_alloc(15);
+ _ltoa(ci.dVal, buffer, 10);
cacheEntry->szName = buffer;
- cacheEntry->name = mir_a2u( buffer );
+ cacheEntry->name = mir_a2u(buffer);
return (INT_PTR) buffer;
} } }
@@ -241,19 +241,19 @@ int ContactSettingChanged(WPARAM wParam, LPARAM lParam) HANDLE hContact = (HANDLE)wParam;
// Early exit
- if ( hContact == NULL)
+ if (hContact == NULL)
return 0;
dbv.pszVal = NULL;
- if (!DBGetContactSetting(hContact, "Protocol", "p", &dbv)) {
- if (!strcmp(cws->szModule, dbv.pszVal)) {
+ if ( !DBGetContactSetting(hContact, "Protocol", "p", &dbv)) {
+ if ( !strcmp(cws->szModule, dbv.pszVal)) {
cli.pfnInvalidateDisplayNameCacheEntry(hContact);
- if (!strcmp(cws->szSetting, "UIN") || !strcmp(cws->szSetting, "Nick") || !strcmp(cws->szSetting, "FirstName")
- || !strcmp(cws->szSetting, "LastName") || !strcmp(cws->szSetting, "e-mail")) {
+ if ( !strcmp(cws->szSetting, "UIN") || !strcmp(cws->szSetting, "Nick") || !strcmp(cws->szSetting, "FirstName")
+ || !strcmp(cws->szSetting, "LastName") || !strcmp(cws->szSetting, "e-mail")) {
CallService(MS_CLUI_CONTACTRENAMED, wParam, 0);
}
- else if (!strcmp(cws->szSetting, "Status")) {
- if (!DBGetContactSettingByte(hContact, "CList", "Hidden", 0)) {
+ else if ( !strcmp(cws->szSetting, "Status")) {
+ if ( !DBGetContactSettingByte(hContact, "CList", "Hidden", 0)) {
if (DBGetContactSettingByte(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT)) {
// User's state is changing, and we are hideOffline-ing
if (cws->value.wVal == ID_STATUS_OFFLINE) {
@@ -274,8 +274,8 @@ int ContactSettingChanged(WPARAM wParam, LPARAM lParam) cli.pfnSortContacts();
} }
- if (!strcmp(cws->szModule, "CList")) {
- if (!strcmp(cws->szSetting, "Hidden")) {
+ if ( !strcmp(cws->szModule, "CList")) {
+ if ( !strcmp(cws->szSetting, "Hidden")) {
if (cws->value.type == DBVT_DELETED || cws->value.bVal == 0) {
char *szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0);
cli.pfnChangeContactIcon(hContact, cli.pfnIconFromStatusMode(szProto, szProto == NULL ? ID_STATUS_OFFLINE : DBGetContactSettingWord(hContact, szProto, "Status", ID_STATUS_OFFLINE), hContact), 1);
@@ -283,12 +283,12 @@ int ContactSettingChanged(WPARAM wParam, LPARAM lParam) else
CallService(MS_CLUI_CONTACTDELETED, wParam, 0);
}
- if (!strcmp(cws->szSetting, "MyHandle"))
+ if ( !strcmp(cws->szSetting, "MyHandle"))
cli.pfnInvalidateDisplayNameCacheEntry(hContact);
}
- if (!strcmp(cws->szModule, "Protocol")) {
- if (!strcmp(cws->szSetting, "p")) {
+ if ( !strcmp(cws->szModule, "Protocol")) {
+ if ( !strcmp(cws->szSetting, "p")) {
char *szProto;
if (cws->value.type == DBVT_DELETED)
szProto = NULL;
diff --git a/src/modules/clist/clisttray.cpp b/src/modules/clist/clisttray.cpp index 8480c6026b..608f692028 100644 --- a/src/modules/clist/clisttray.cpp +++ b/src/modules/clist/clisttray.cpp @@ -45,25 +45,25 @@ static CRITICAL_SECTION trayLockCS; #define lock cli.pfnLockTray()
#define ulock cli.pfnUnlockTray()
-#define initcheck if (!fTrayInited) return
+#define initcheck if ( !fTrayInited) return
static BOOL fTrayInited=FALSE;
-static TCHAR* sttGetXStatus( const char* szProto )
+static TCHAR* sttGetXStatus(const char* szProto)
{
TCHAR* result = NULL;
- if ( CallProtoService( szProto, PS_GETSTATUS, 0, 0 ) > ID_STATUS_OFFLINE ) {
+ if (CallProtoService(szProto, PS_GETSTATUS, 0, 0) > ID_STATUS_OFFLINE) {
char str[MAXMODULELABELLENGTH];
- mir_snprintf( str, sizeof(str), "%s/GetXStatus", szProto );
- if ( ServiceExists( str )) {
+ mir_snprintf(str, sizeof(str), "%s/GetXStatus", szProto);
+ if (ServiceExists(str)) {
char* dbTitle = "XStatusName";
char* dbTitle2 = NULL;
- int xstatus = CallProtoService( szProto, "/GetXStatus", ( WPARAM )&dbTitle, ( LPARAM )&dbTitle2 );
- if ( dbTitle && xstatus ) {
+ int xstatus = CallProtoService(szProto, "/GetXStatus", (WPARAM)&dbTitle, (LPARAM)&dbTitle2);
+ if (dbTitle && xstatus) {
DBVARIANT dbv={0};
- if ( !DBGetContactSettingTString(NULL, szProto, dbTitle, &dbv )) {
- if ( dbv.ptszVal[0] != 0 )
+ if ( !DBGetContactSettingTString(NULL, szProto, dbTitle, &dbv)) {
+ if (dbv.ptszVal[0] != 0)
result = mir_tstrdup(dbv.ptszVal);
DBFreeVariant(&dbv);
} } } }
@@ -83,7 +83,7 @@ static void SetTaskBarIcon(const HICON hIcon, const TCHAR *szNewTip) }
}
-TCHAR* fnTrayIconMakeTooltip( const TCHAR *szPrefix, const char *szProto )
+TCHAR* fnTrayIconMakeTooltip(const TCHAR *szPrefix, const char *szProto)
{
TCHAR *szStatus, *szSeparator;
TCHAR *ProtoXStatus=NULL;
@@ -91,7 +91,7 @@ TCHAR* fnTrayIconMakeTooltip( const TCHAR *szPrefix, const char *szProto ) PROTOACCOUNT* pa;
initcheck NULL;
lock;
- if ( !mToolTipTrayTips )
+ if ( !mToolTipTrayTips)
szSeparator = (IsWinVerMEPlus()) ? szSeparator = _T("\n") : _T(" | ");
else
szSeparator = _T("\n");
@@ -108,36 +108,36 @@ TCHAR* fnTrayIconMakeTooltip( const TCHAR *szPrefix, const char *szProto ) if (szPrefix && szPrefix[0]) {
lstrcpyn(cli.szTip, szPrefix, MAX_TIP_SIZE);
- if (!DBGetContactSettingByte(NULL, "CList", "AlwaysStatus", SETTING_ALWAYSSTATUS_DEFAULT))
+ if ( !DBGetContactSettingByte(NULL, "CList", "AlwaysStatus", SETTING_ALWAYSSTATUS_DEFAULT))
{ ulock; return cli.szTip; }
}
else cli.szTip[0] = '\0';
cli.szTip[ MAX_TIP_SIZE-1 ] = '\0';
- for ( t = 0; t < accounts.getCount(); t++ ) {
- int i = cli.pfnGetAccountIndexByPos( t );
- if ( i == -1 )
+ for (t = 0; t < accounts.getCount(); t++) {
+ int i = cli.pfnGetAccountIndexByPos(t);
+ if (i == -1)
continue;
pa = accounts[i];
- if ( !cli.pfnGetProtocolVisibility( pa->szModuleName ))
+ if ( !cli.pfnGetProtocolVisibility(pa->szModuleName))
continue;
- szStatus = cli.pfnGetStatusModeDescription( CallProtoService( pa->szModuleName, PS_GETSTATUS, 0, 0), 0);
- if ( !szStatus )
+ szStatus = cli.pfnGetStatusModeDescription(CallProtoService(pa->szModuleName, PS_GETSTATUS, 0, 0), 0);
+ if ( !szStatus)
continue;
- ProtoXStatus = sttGetXStatus( pa->szModuleName );
+ ProtoXStatus = sttGetXStatus(pa->szModuleName);
- if ( mToolTipTrayTips ) {
+ if (mToolTipTrayTips) {
TCHAR tipline[256];
mir_sntprintf(tipline, SIZEOF(tipline), _T("<b>%-12.12s</b>\t%s"), pa->tszAccountName, szStatus);
- if ( cli.szTip[0] )
+ if (cli.szTip[0])
_tcsncat(cli.szTip, szSeparator, MAX_TIP_SIZE - _tcslen(cli.szTip));
_tcsncat(cli.szTip, tipline, MAX_TIP_SIZE - _tcslen(cli.szTip));
if (ProtoXStatus) {
mir_sntprintf(tipline, SIZEOF(tipline), _T("%-24.24s\n"), ProtoXStatus);
- if ( cli.szTip[0] )
+ if (cli.szTip[0])
_tcsncat(cli.szTip, szSeparator, MAX_TIP_SIZE - _tcslen(cli.szTip));
_tcsncat(cli.szTip, tipline, MAX_TIP_SIZE - _tcslen(cli.szTip));
}
@@ -150,17 +150,17 @@ TCHAR* fnTrayIconMakeTooltip( const TCHAR *szPrefix, const char *szProto ) _tcsncat(cli.szTip, _T(" "), MAX_TIP_SIZE - _tcslen(cli.szTip));
_tcsncat(cli.szTip, szStatus, MAX_TIP_SIZE - _tcslen(cli.szTip));
}
- mir_free( ProtoXStatus );
+ mir_free(ProtoXStatus);
}
}
else {
- if (( pa = Proto_GetAccount( szProto )) != NULL ) {
- ProtoXStatus = sttGetXStatus( szProto );
+ if ((pa = Proto_GetAccount(szProto)) != NULL) {
+ ProtoXStatus = sttGetXStatus(szProto);
szStatus = cli.pfnGetStatusModeDescription(CallProtoService(szProto, PS_GETSTATUS, 0, 0), 0);
- if ( szPrefix && szPrefix[0] ) {
- if ( DBGetContactSettingByte( NULL, "CList", "AlwaysStatus", SETTING_ALWAYSSTATUS_DEFAULT )) {
- if ( mToolTipTrayTips ) {
- if ( ProtoXStatus )
+ if (szPrefix && szPrefix[0]) {
+ if (DBGetContactSettingByte(NULL, "CList", "AlwaysStatus", SETTING_ALWAYSSTATUS_DEFAULT)) {
+ if (mToolTipTrayTips) {
+ if (ProtoXStatus)
mir_sntprintf(cli.szTip, MAX_TIP_SIZE, _T("%s%s<b>%-12.12s</b>\t%s%s%-24.24s"), szPrefix, szSeparator, pa->tszAccountName, szStatus, szSeparator, ProtoXStatus);
else
mir_sntprintf(cli.szTip, MAX_TIP_SIZE, _T("%s%s<b>%-12.12s</b>\t%s"), szPrefix, szSeparator, pa->tszAccountName, szStatus);
@@ -170,11 +170,11 @@ TCHAR* fnTrayIconMakeTooltip( const TCHAR *szPrefix, const char *szProto ) else lstrcpyn(cli.szTip, szPrefix, MAX_TIP_SIZE);
}
else {
- if ( mToolTipTrayTips ) {
- if ( ProtoXStatus )
- mir_sntprintf( cli.szTip, MAX_TIP_SIZE, _T("<b>%-12.12s</b>\t%s\n%-24.24s"), pa->tszAccountName, szStatus, ProtoXStatus);
+ if (mToolTipTrayTips) {
+ if (ProtoXStatus)
+ mir_sntprintf(cli.szTip, MAX_TIP_SIZE, _T("<b>%-12.12s</b>\t%s\n%-24.24s"), pa->tszAccountName, szStatus, ProtoXStatus);
else
- mir_sntprintf( cli.szTip, MAX_TIP_SIZE, _T("<b>%-12.12s</b>\t%s"), pa->tszAccountName, szStatus);
+ mir_sntprintf(cli.szTip, MAX_TIP_SIZE, _T("<b>%-12.12s</b>\t%s"), pa->tszAccountName, szStatus);
}
else mir_sntprintf(cli.szTip, MAX_TIP_SIZE, _T("%s %s"), pa->tszAccountName, szStatus);
}
@@ -197,9 +197,9 @@ int fnTrayIconAdd(HWND hwnd, const char *szProto, const char *szIconProto, int s cli.trayIcon[i].id = TRAYICON_ID_BASE + i;
cli.trayIcon[i].szProto = (char *) szProto;
- cli.trayIcon[i].hBaseIcon = cli.pfnGetIconFromStatusMode( NULL, szIconProto ? szIconProto : cli.trayIcon[i].szProto, status );
+ cli.trayIcon[i].hBaseIcon = cli.pfnGetIconFromStatusMode(NULL, szIconProto ? szIconProto : cli.trayIcon[i].szProto, status);
- nid.cbSize = ( cli.shellVersion >= 5 ) ? sizeof(nid) : NOTIFYICONDATA_V1_SIZE;
+ nid.cbSize = (cli.shellVersion >= 5) ? sizeof(nid) : NOTIFYICONDATA_V1_SIZE;
nid.hWnd = hwnd;
nid.uID = cli.trayIcon[i].id;
nid.uFlags = mToolTipTrayTips ? NIF_ICON | NIF_MESSAGE : NIF_ICON | NIF_MESSAGE | NIF_TIP;
@@ -209,10 +209,10 @@ int fnTrayIconAdd(HWND hwnd, const char *szProto, const char *szIconProto, int s if (cli.shellVersion >= 5)
nid.uFlags |= NIF_INFO;
- cli.pfnTrayIconMakeTooltip( NULL, cli.trayIcon[i].szProto );
- if ( !mToolTipTrayTips )
- lstrcpyn( nid.szTip, cli.szTip, SIZEOF( nid.szTip ));
- cli.trayIcon[i].ptszToolTip = mir_tstrdup( cli.szTip );
+ cli.pfnTrayIconMakeTooltip(NULL, cli.trayIcon[i].szProto);
+ if ( !mToolTipTrayTips)
+ lstrcpyn(nid.szTip, cli.szTip, SIZEOF(nid.szTip));
+ cli.trayIcon[i].ptszToolTip = mir_tstrdup(cli.szTip);
Shell_NotifyIcon(NIM_ADD, &nid);
cli.trayIcon[i].isBase = 1;
@@ -228,11 +228,11 @@ void fnTrayIconRemove(HWND hwnd, const char *szProto) int i;
initcheck;
lock;
- for ( i = 0; i < cli.trayIconCount; i++ ) {
+ for (i = 0; i < cli.trayIconCount; i++) {
struct trayIconInfo_t* pii = &cli.trayIcon[i];
- if ( pii->id != 0 && !lstrcmpA( szProto, pii->szProto )) {
+ if (pii->id != 0 && !lstrcmpA(szProto, pii->szProto)) {
NOTIFYICONDATA nid = { 0 };
- nid.cbSize = ( cli.shellVersion >= 5 ) ? sizeof(nid) : NOTIFYICONDATA_V1_SIZE;
+ nid.cbSize = (cli.shellVersion >= 5) ? sizeof(nid) : NOTIFYICONDATA_V1_SIZE;
nid.hWnd = hwnd;
nid.uID = pii->id;
Shell_NotifyIcon(NIM_DELETE, &nid);
@@ -258,7 +258,7 @@ int fnTrayIconInit(HWND hwnd) int averageMode = GetAverageMode(&netProtoCount);
mToolTipTrayTips = ServiceExists("mToolTip/ShowTip") != 0;
- if ( cli.cycleTimerId ) {
+ if (cli.cycleTimerId) {
KillTimer(NULL, cli.cycleTimerId);
cli.cycleTimerId = 0;
}
@@ -275,8 +275,8 @@ int fnTrayIconInit(HWND hwnd) {
DBVARIANT dbv = { DBVT_DELETED };
char *szProto;
- if (!DBGetContactSettingString(NULL, "CList", "PrimaryStatus", &dbv)
- && (averageMode < 0 || DBGetContactSettingByte(NULL, "CList", "AlwaysPrimary", 0) ))
+ if ( !DBGetContactSettingString(NULL, "CList", "PrimaryStatus", &dbv)
+ && (averageMode < 0 || DBGetContactSettingByte(NULL, "CList", "AlwaysPrimary", 0)))
szProto = dbv.pszVal;
else
szProto = NULL;
@@ -285,7 +285,7 @@ int fnTrayIconInit(HWND hwnd) DBFreeVariant(&dbv);
}
else if (trayIconSetting == SETTING_TRAYICON_MULTI &&
- (averageMode < 0 || DBGetContactSettingByte(NULL, "CList", "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT )))
+ (averageMode < 0 || DBGetContactSettingByte(NULL, "CList", "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT)))
{
cli.trayIconCount = netProtoCount;
for (int i = 0; i < accounts.getCount(); ++i)
@@ -327,15 +327,15 @@ int fnTrayIconDestroy(HWND hwnd) if (cli.trayIconCount == 1)
SetTaskBarIcon(NULL, NULL);
- nid.cbSize = ( cli.shellVersion >= 5 ) ? sizeof(nid) : NOTIFYICONDATA_V1_SIZE;
+ nid.cbSize = (cli.shellVersion >= 5) ? sizeof(nid) : NOTIFYICONDATA_V1_SIZE;
nid.hWnd = hwnd;
- for ( i = 0; i < cli.trayIconCount; i++ ) {
- if ( cli.trayIcon[i].id == 0 )
+ for (i = 0; i < cli.trayIconCount; i++) {
+ if (cli.trayIcon[i].id == 0)
continue;
nid.uID = cli.trayIcon[i].id;
- Shell_NotifyIcon( NIM_DELETE, &nid );
- DestroyIcon( cli.trayIcon[i].hBaseIcon );
- mir_free( cli.trayIcon[i].ptszToolTip );
+ Shell_NotifyIcon(NIM_DELETE, &nid);
+ DestroyIcon(cli.trayIcon[i].hBaseIcon);
+ mir_free(cli.trayIcon[i].ptszToolTip);
}
mir_free(cli.trayIcon);
cli.trayIcon = NULL;
@@ -356,12 +356,12 @@ void fnTrayIconTaskbarCreated(HWND hwnd) static VOID CALLBACK RefreshTimerProc(HWND, UINT, UINT_PTR, DWORD)
{
int i;
- if ( RefreshTimerId ) {
+ if (RefreshTimerId) {
KillTimer(NULL, RefreshTimerId);
RefreshTimerId=0;
}
for (i=0; i < accounts.getCount(); i++) {
- cli.pfnTrayIconUpdateBase( accounts[i]->szModuleName );
+ cli.pfnTrayIconUpdateBase(accounts[i]->szModuleName);
}
}
@@ -372,11 +372,11 @@ int fnTrayIconUpdate(HICON hNewIcon, const TCHAR *szNewTip, const char *szPrefer initcheck -1;
lock;
- nid.cbSize = ( cli.shellVersion >= 5 ) ? sizeof(nid) : NOTIFYICONDATA_V1_SIZE;
+ nid.cbSize = (cli.shellVersion >= 5) ? sizeof(nid) : NOTIFYICONDATA_V1_SIZE;
nid.hWnd = cli.hwndContactList;
nid.uFlags = mToolTipTrayTips ? NIF_ICON : NIF_ICON | NIF_TIP;
nid.hIcon = hNewIcon;
- if (!hNewIcon)
+ if ( !hNewIcon)
{ ulock; return -1; }
for (i = 0; i < cli.trayIconCount; i++) {
@@ -387,9 +387,9 @@ int fnTrayIconUpdate(HICON hNewIcon, const TCHAR *szNewTip, const char *szPrefer nid.uID = cli.trayIcon[i].id;
cli.pfnTrayIconMakeTooltip(szNewTip, cli.trayIcon[i].szProto);
- mir_free( cli.trayIcon[i].ptszToolTip );
- cli.trayIcon[i].ptszToolTip = mir_tstrdup( cli.szTip );
- if (!mToolTipTrayTips)
+ mir_free(cli.trayIcon[i].ptszToolTip);
+ cli.trayIcon[i].ptszToolTip = mir_tstrdup(cli.szTip);
+ if ( !mToolTipTrayTips)
lstrcpyn(nid.szTip, cli.szTip, SIZEOF(nid.szTip));
Shell_NotifyIcon(NIM_MODIFY, &nid);
@@ -410,9 +410,9 @@ int fnTrayIconUpdate(HICON hNewIcon, const TCHAR *szNewTip, const char *szPrefer nid.uID = cli.trayIcon[i].id;
cli.pfnTrayIconMakeTooltip(szNewTip, cli.trayIcon[i].szProto);
- mir_free( cli.trayIcon[i].ptszToolTip );
- cli.trayIcon[i].ptszToolTip = mir_tstrdup( cli.szTip );
- if (!mToolTipTrayTips)
+ mir_free(cli.trayIcon[i].ptszToolTip);
+ cli.trayIcon[i].ptszToolTip = mir_tstrdup(cli.szTip);
+ if ( !mToolTipTrayTips)
lstrcpyn(nid.szTip, cli.szTip, SIZEOF(nid.szTip));
Shell_NotifyIcon(NIM_MODIFY, &nid);
@@ -490,7 +490,7 @@ VOID CALLBACK fnTrayCycleTimerProc(HWND, UINT, UINT_PTR, DWORD) int i;
for (i = accounts.getCount() + 1; --i;) {
cycleStep = (cycleStep + 1) % accounts.getCount();
- if ( cli.pfnGetProtocolVisibility( accounts[cycleStep]->szModuleName ))
+ if (cli.pfnGetProtocolVisibility(accounts[cycleStep]->szModuleName))
break;
}
@@ -498,7 +498,7 @@ VOID CALLBACK fnTrayCycleTimerProc(HWND, UINT, UINT_PTR, DWORD) {
DestroyIcon(cli.trayIcon[0].hBaseIcon);
cli.trayIcon[0].hBaseIcon = cli.pfnGetIconFromStatusMode(NULL, accounts[cycleStep]->szModuleName,
- CallProtoService( accounts[cycleStep]->szModuleName, PS_GETSTATUS, 0, 0 ));
+ CallProtoService(accounts[cycleStep]->szModuleName, PS_GETSTATUS, 0, 0));
if (cli.trayIcon[0].isBase)
cli.pfnTrayIconUpdate(cli.trayIcon[0].hBaseIcon, NULL, NULL, 1);
}
@@ -508,7 +508,7 @@ VOID CALLBACK fnTrayCycleTimerProc(HWND, UINT, UINT_PTR, DWORD) void fnTrayIconUpdateBase(const char *szChangedProto)
{
- if ( !cli.pfnGetProtocolVisibility( szChangedProto )) return;
+ if ( !cli.pfnGetProtocolVisibility(szChangedProto)) return;
int i, netProtoCount, changed = -1;
HWND hwnd = cli.hwndContactList;
@@ -522,7 +522,7 @@ void fnTrayIconUpdateBase(const char *szChangedProto) }
for (i = 0; i < accounts.getCount(); i++) {
- if (!lstrcmpA(szChangedProto, accounts[i]->szModuleName ))
+ if ( !lstrcmpA(szChangedProto, accounts[i]->szModuleName))
cycleStep = i - 1;
}
@@ -533,17 +533,17 @@ void fnTrayIconUpdateBase(const char *szChangedProto) if (averageMode > 0) {
if (trayIconSetting == SETTING_TRAYICON_MULTI) {
if (DBGetContactSettingByte(NULL, "CList", "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT))
- //changed = cli.pfnTrayIconSetBaseInfo( cli.pfnGetIconFromStatusMode((char*)szChangedProto, NULL, averageMode), (char*)szChangedProto);
- changed = cli.pfnTrayIconSetBaseInfo( cli.pfnGetIconFromStatusMode( NULL, szChangedProto, CallProtoService(szChangedProto, PS_GETSTATUS, 0, 0)), (char*)szChangedProto );
+ //changed = cli.pfnTrayIconSetBaseInfo(cli.pfnGetIconFromStatusMode((char*)szChangedProto, NULL, averageMode), (char*)szChangedProto);
+ changed = cli.pfnTrayIconSetBaseInfo(cli.pfnGetIconFromStatusMode(NULL, szChangedProto, CallProtoService(szChangedProto, PS_GETSTATUS, 0, 0)), (char*)szChangedProto);
else if (cli.trayIcon && cli.trayIcon[0].szProto != NULL) {
cli.pfnTrayIconDestroy(hwnd);
cli.pfnTrayIconInit(hwnd);
}
else
- changed = cli.pfnTrayIconSetBaseInfo( cli.pfnGetIconFromStatusMode(NULL, NULL, averageMode), NULL );
+ changed = cli.pfnTrayIconSetBaseInfo(cli.pfnGetIconFromStatusMode(NULL, NULL, averageMode), NULL);
}
else
- changed = cli.pfnTrayIconSetBaseInfo( cli.pfnGetIconFromStatusMode(NULL, NULL, averageMode), NULL);
+ changed = cli.pfnTrayIconSetBaseInfo(cli.pfnGetIconFromStatusMode(NULL, NULL, averageMode), NULL);
}
else {
switch (trayIconSetting) {
@@ -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;
}
@@ -568,11 +568,11 @@ void fnTrayIconUpdateBase(const char *szChangedProto) ILD_NORMAL), NULL);
break;
case SETTING_TRAYICON_MULTI:
- if (!cli.trayIcon) {
+ if ( !cli.trayIcon) {
cli.pfnTrayIconRemove(NULL, NULL);
}
- else if ((cli.trayIconCount > 1 || netProtoCount == 1) || DBGetContactSettingByte( NULL, "CList", "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT ))
- changed = cli.pfnTrayIconSetBaseInfo( cli.pfnGetIconFromStatusMode( NULL, szChangedProto, CallProtoService(szChangedProto, PS_GETSTATUS, 0, 0)), (char*)szChangedProto );
+ else if ((cli.trayIconCount > 1 || netProtoCount == 1) || DBGetContactSettingByte(NULL, "CList", "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT))
+ changed = cli.pfnTrayIconSetBaseInfo(cli.pfnGetIconFromStatusMode(NULL, szChangedProto, CallProtoService(szChangedProto, PS_GETSTATUS, 0, 0)), (char*)szChangedProto);
else {
cli.pfnTrayIconDestroy(hwnd);
cli.pfnTrayIconInit(hwnd);
@@ -596,19 +596,19 @@ void fnTrayIconSetToBase(char *szPreferredProto) lock;
for (i = 0; i < cli.trayIconCount; i++) {
- if ( cli.trayIcon[i].id == 0 )
+ if (cli.trayIcon[i].id == 0)
continue;
- if ( lstrcmpA( cli.trayIcon[i].szProto, szPreferredProto ))
+ if (lstrcmpA(cli.trayIcon[i].szProto, szPreferredProto))
continue;
- cli.pfnTrayIconUpdate( cli.trayIcon[i].hBaseIcon, NULL, szPreferredProto, 1);
+ cli.pfnTrayIconUpdate(cli.trayIcon[i].hBaseIcon, NULL, szPreferredProto, 1);
ulock; return;
}
//if there wasn't a specific icon, there will only be one suitable
- for ( i = 0; i < cli.trayIconCount; i++) {
- if ( cli.trayIcon[i].id == 0 )
+ for (i = 0; i < cli.trayIconCount; i++) {
+ if (cli.trayIcon[i].id == 0)
continue;
- cli.pfnTrayIconUpdate( cli.trayIcon[i].hBaseIcon, NULL, szPreferredProto, 1);
+ cli.pfnTrayIconUpdate(cli.trayIcon[i].hBaseIcon, NULL, szPreferredProto, 1);
ulock; return;
}
ulock; return;
@@ -644,7 +644,7 @@ int fnTrayIconPauseAutoHide(WPARAM, LPARAM) initcheck 0;
lock;
if (DBGetContactSettingByte(NULL, "CList", "AutoHide", SETTING_AUTOHIDE_DEFAULT)) {
- if ( GetActiveWindow() != cli.hwndContactList ) {
+ if (GetActiveWindow() != cli.hwndContactList) {
KillTimer(NULL, autoHideTimerId);
autoHideTimerId = SetTimer(NULL, 0, 1000 * DBGetContactSettingWord(NULL, "CList", "HideTime", SETTING_HIDETIME_DEFAULT), TrayIconAutoHideTimer);
}
@@ -661,45 +661,45 @@ static POINT tray_hover_pos = {0}; static void CALLBACK TrayHideToolTipTimerProc(HWND hwnd, UINT, UINT_PTR, DWORD)
{
- if ( g_trayTooltipActive ) {
+ if (g_trayTooltipActive) {
POINT pt;
GetCursorPos(&pt);
- if ( abs(pt.x - tray_hover_pos.x) > TOOLTIP_TOLERANCE || abs(pt.y - tray_hover_pos.y) > TOOLTIP_TOLERANCE ) {
+ if (abs(pt.x - tray_hover_pos.x) > TOOLTIP_TOLERANCE || abs(pt.y - tray_hover_pos.y) > TOOLTIP_TOLERANCE) {
CallService("mToolTip/HideTip", 0, 0);
g_trayTooltipActive = FALSE;
- KillTimer( hwnd, TIMERID_TRAYHOVER_2 );
+ KillTimer(hwnd, TIMERID_TRAYHOVER_2);
}
}
- else KillTimer( hwnd, TIMERID_TRAYHOVER_2 );
+ else KillTimer(hwnd, TIMERID_TRAYHOVER_2);
}
static void CALLBACK TrayToolTipTimerProc(HWND hwnd, UINT, UINT_PTR id, DWORD)
{
- if ( !g_trayTooltipActive && !cli.bTrayMenuOnScreen ) {
+ if ( !g_trayTooltipActive && !cli.bTrayMenuOnScreen) {
CLCINFOTIP ti = {0};
POINT pt;
- GetCursorPos( &pt );
- if ( abs(pt.x - tray_hover_pos.x) <= TOOLTIP_TOLERANCE && abs(pt.y - tray_hover_pos.y) <= TOOLTIP_TOLERANCE ) {
+ GetCursorPos(&pt);
+ if (abs(pt.x - tray_hover_pos.x) <= TOOLTIP_TOLERANCE && abs(pt.y - tray_hover_pos.y) <= TOOLTIP_TOLERANCE) {
TCHAR* szTipCur = cli.szTip;
{
int n = s_LastHoverIconID-100;
- if ( n >= 0 && n < cli.trayIconCount )
+ if (n >= 0 && n < cli.trayIconCount)
szTipCur = cli.trayIcon[n].ptszToolTip;
}
ti.rcItem.left = pt.x - 10;
ti.rcItem.right = pt.x + 10;
ti.rcItem.top = pt.y - 10;
ti.rcItem.bottom = pt.y + 10;
- ti.cbSize = sizeof( ti );
+ ti.cbSize = sizeof(ti);
ti.isTreeFocused = GetFocus() == cli.hwndContactList ? 1 : 0;
- if (CallService( "mToolTip/ShowTipW", (WPARAM)szTipCur, (LPARAM)&ti ) == CALLSERVICE_NOTFOUND)
+ if (CallService("mToolTip/ShowTipW", (WPARAM)szTipCur, (LPARAM)&ti) == CALLSERVICE_NOTFOUND)
{
- char* p = mir_u2a( szTipCur );
- CallService( "mToolTip/ShowTip", (WPARAM)p, (LPARAM)&ti );
- mir_free( p );
+ char* p = mir_u2a(szTipCur);
+ CallService("mToolTip/ShowTip", (WPARAM)p, (LPARAM)&ti);
+ mir_free(p);
}
- GetCursorPos( &tray_hover_pos );
- SetTimer( cli.hwndContactList, TIMERID_TRAYHOVER_2, 600, TrayHideToolTipTimerProc );
+ GetCursorPos(&tray_hover_pos);
+ SetTimer(cli.hwndContactList, TIMERID_TRAYHOVER_2, 600, TrayHideToolTipTimerProc);
g_trayTooltipActive = TRUE;
} }
@@ -711,8 +711,8 @@ INT_PTR fnTrayIconProcessMessage(WPARAM wParam, LPARAM lParam) MSG *msg = (MSG *) wParam;
switch (msg->message) {
case WM_CREATE: {
- WM_TASKBARCREATED = RegisterWindowMessage( _T("TaskbarCreated"));
- WM_TASKBARBUTTONCREATED = RegisterWindowMessage( _T("TaskbarButtonCreated"));
+ WM_TASKBARCREATED = RegisterWindowMessage(_T("TaskbarCreated"));
+ WM_TASKBARBUTTONCREATED = RegisterWindowMessage(_T("TaskbarButtonCreated"));
PostMessage(msg->hwnd, TIM_CREATE, 0, 0);
break;
}
@@ -735,12 +735,12 @@ INT_PTR fnTrayIconProcessMessage(WPARAM wParam, LPARAM lParam) break;
case TIM_CALLBACK:
- if ( msg->lParam == WM_RBUTTONDOWN || msg->lParam == WM_LBUTTONDOWN || msg->lParam == WM_RBUTTONDOWN && g_trayTooltipActive ) {
+ if (msg->lParam == WM_RBUTTONDOWN || msg->lParam == WM_LBUTTONDOWN || msg->lParam == WM_RBUTTONDOWN && g_trayTooltipActive) {
CallService("mToolTip/HideTip", 0, 0);
g_trayTooltipActive = FALSE;
}
- if ( msg->lParam == WM_MBUTTONUP )
+ if (msg->lParam == WM_MBUTTONUP)
cli.pfnShowHide(0, 0);
else if (msg->lParam == (DBGetContactSettingByte(NULL, "CList", "Tray1Click", SETTING_TRAY1CLICK_DEFAULT) ? WM_LBUTTONUP : WM_LBUTTONDBLCLK)) {
if ((GetAsyncKeyState(VK_CONTROL) & 0x8000))
@@ -752,7 +752,7 @@ INT_PTR fnTrayIconProcessMessage(WPARAM wParam, LPARAM lParam) {
if ((unsigned)cli.trayIcon[i].id == msg->wParam)
{
- if (!cli.trayIcon[i].szProto) break;
+ if ( !cli.trayIcon[i].szProto) break;
int ind = 0;
for (int j = 0; j < accounts.getCount(); ++j)
@@ -760,7 +760,7 @@ INT_PTR fnTrayIconProcessMessage(WPARAM wParam, LPARAM lParam) int k = cli.pfnGetAccountIndexByPos(j);
if (k >= 0)
{
- if (!strcmp(cli.trayIcon[i].szProto, accounts[k]->szModuleName))
+ if ( !strcmp(cli.trayIcon[i].szProto, accounts[k]->szModuleName))
{
HMENU hm = GetSubMenu(hMenu, ind);
if (hm) hMenu = hm;
@@ -811,12 +811,12 @@ INT_PTR fnTrayIconProcessMessage(WPARAM wParam, LPARAM lParam) RemoveMenu(hMenu, 1, MF_BYPOSITION);
DestroyMenu(hMainMenu);
}
- else if ( msg->lParam == WM_MOUSEMOVE ) {
+ else if (msg->lParam == WM_MOUSEMOVE) {
s_LastHoverIconID = msg->wParam;
- if ( g_trayTooltipActive ) {
+ if (g_trayTooltipActive) {
POINT pt;
- GetCursorPos( &pt );
- if ( abs(pt.x - tray_hover_pos.x) > TOOLTIP_TOLERANCE || abs(pt.y - tray_hover_pos.y) > TOOLTIP_TOLERANCE ) {
+ GetCursorPos(&pt);
+ if (abs(pt.x - tray_hover_pos.x) > TOOLTIP_TOLERANCE || abs(pt.y - tray_hover_pos.y) > TOOLTIP_TOLERANCE) {
CallService("mToolTip/HideTip", 0, 0);
g_trayTooltipActive = FALSE;
ReleaseCapture();
@@ -851,62 +851,62 @@ INT_PTR fnTrayIconProcessMessage(WPARAM wParam, LPARAM lParam) /////////////////////////////////////////////////////////////////////////////////////////
// processes tray icon's notifications
-int fnCListTrayNotify( MIRANDASYSTRAYNOTIFY* msn )
+int fnCListTrayNotify(MIRANDASYSTRAYNOTIFY* msn)
{
UINT iconId = 0;
- if ( msn == NULL )
+ if (msn == NULL)
return 1;
- if ( msn->cbSize != sizeof(MIRANDASYSTRAYNOTIFY) || msn->szInfo == NULL || msn->szInfoTitle == NULL )
+ if (msn->cbSize != sizeof(MIRANDASYSTRAYNOTIFY) || msn->szInfo == NULL || msn->szInfoTitle == NULL)
return 1;
- if ( cli.trayIcon == NULL )
+ if (cli.trayIcon == NULL)
return 2;
- if ( msn->szProto ) {
+ if (msn->szProto) {
int j;
- for ( j = 0; j < cli.trayIconCount; j++ ) {
- if ( cli.trayIcon[j].szProto != NULL ) {
- if ( !strcmp( msn->szProto, cli.trayIcon[j].szProto )) {
+ for (j = 0; j < cli.trayIconCount; j++) {
+ if (cli.trayIcon[j].szProto != NULL) {
+ if ( !strcmp(msn->szProto, cli.trayIcon[j].szProto)) {
iconId = cli.trayIcon[j].id;
break;
}
}
- else if ( cli.trayIcon[j].isBase ) {
+ else if (cli.trayIcon[j].isBase) {
iconId = cli.trayIcon[j].id;
break;
} }
}
else iconId = cli.trayIcon[0].id;
- if ( msn->dwInfoFlags & NIIF_INTERN_UNICODE ) {
+ if (msn->dwInfoFlags & NIIF_INTERN_UNICODE) {
NOTIFYICONDATAW nid = {0};
- nid.cbSize = ( cli.shellVersion >= 5 ) ? sizeof(nid) : NOTIFYICONDATAW_V1_SIZE;
+ nid.cbSize = (cli.shellVersion >= 5) ? sizeof(nid) : NOTIFYICONDATAW_V1_SIZE;
nid.hWnd = cli.hwndContactList;
nid.uID = iconId;
nid.uFlags = NIF_INFO;
- lstrcpynW( nid.szInfo, msn->tszInfo, SIZEOF( nid.szInfo ));
- lstrcpynW( nid.szInfoTitle, msn->tszInfoTitle, SIZEOF( nid.szInfoTitle ));
+ lstrcpynW(nid.szInfo, msn->tszInfo, SIZEOF(nid.szInfo));
+ lstrcpynW(nid.szInfoTitle, msn->tszInfoTitle, SIZEOF(nid.szInfoTitle));
nid.szInfo[ SIZEOF(nid.szInfo)-1 ] = 0;
nid.szInfoTitle[ SIZEOF(nid.szInfoTitle)-1 ] = 0;
nid.uTimeout = msn->uTimeout;
nid.dwInfoFlags = (msn->dwInfoFlags & ~NIIF_INTERN_UNICODE);
- return Shell_NotifyIconW( NIM_MODIFY, &nid ) == 0;
+ return Shell_NotifyIconW(NIM_MODIFY, &nid) == 0;
}
else
{
NOTIFYICONDATAA nid = { 0 };
- nid.cbSize = ( cli.shellVersion >= 5 ) ? sizeof(nid) : NOTIFYICONDATAA_V1_SIZE;
+ nid.cbSize = (cli.shellVersion >= 5) ? sizeof(nid) : NOTIFYICONDATAA_V1_SIZE;
nid.hWnd = cli.hwndContactList;
nid.uID = iconId;
nid.uFlags = NIF_INFO;
- lstrcpynA( nid.szInfo, msn->szInfo, sizeof( nid.szInfo ));
- lstrcpynA( nid.szInfoTitle, msn->szInfoTitle, sizeof( nid.szInfoTitle ));
+ lstrcpynA(nid.szInfo, msn->szInfo, sizeof(nid.szInfo));
+ lstrcpynA(nid.szInfoTitle, msn->szInfoTitle, sizeof(nid.szInfoTitle));
nid.uTimeout = msn->uTimeout;
nid.dwInfoFlags = msn->dwInfoFlags;
- return Shell_NotifyIconA( NIM_MODIFY, &nid ) == 0;
+ return Shell_NotifyIconA(NIM_MODIFY, &nid) == 0;
} }
/////////////////////////////////////////////////////////////////////////////////////////
@@ -925,49 +925,49 @@ typedef HRESULT(CALLBACK * DLLGETVERSIONPROC) (DLLVERSIONINFO *); static DLLVERSIONINFO dviShell;
-static INT_PTR pfnCListTrayNotifyStub(WPARAM, LPARAM lParam )
-{ return cli.pfnCListTrayNotify(( MIRANDASYSTRAYNOTIFY* )lParam );
+static INT_PTR pfnCListTrayNotifyStub(WPARAM, LPARAM lParam)
+{ return cli.pfnCListTrayNotify((MIRANDASYSTRAYNOTIFY*)lParam);
}
-void fnInitTray( void )
+void fnInitTray(void)
{
HMODULE hLib = GetModuleHandleA("shell32");
- if ( hLib ) {
+ if (hLib) {
DLLGETVERSIONPROC proc;
dviShell.cbSize = sizeof(dviShell);
- proc = ( DLLGETVERSIONPROC )GetProcAddress( hLib, "DllGetVersion" );
+ proc = (DLLGETVERSIONPROC)GetProcAddress(hLib, "DllGetVersion");
if (proc) {
- proc( &dviShell );
+ proc(&dviShell);
cli.shellVersion = dviShell.dwMajorVersion;
}
FreeLibrary(hLib);
}
InitializeCriticalSection(&trayLockCS);
- if ( cli.shellVersion >= 5 )
- CreateServiceFunction(MS_CLIST_SYSTRAY_NOTIFY, pfnCListTrayNotifyStub );
+ if (cli.shellVersion >= 5)
+ CreateServiceFunction(MS_CLIST_SYSTRAY_NOTIFY, pfnCListTrayNotifyStub);
fTrayInited=TRUE;
}
-void fnUninitTray( void )
+void fnUninitTray(void)
{
fTrayInited=FALSE;
- DeleteCriticalSection( &trayLockCS );
+ DeleteCriticalSection(&trayLockCS);
}
-void fnLockTray( void )
+void fnLockTray(void)
{
// return; //stub to be removed
initcheck;
- EnterCriticalSection( &trayLockCS );
+ EnterCriticalSection(&trayLockCS);
}
-void fnUnlockTray( void )
+void fnUnlockTray(void)
{
// return; //stub to be removed
initcheck;
#ifdef _DEBUG
if (trayLockCS.RecursionCount == 0) DebugBreak(); //try to unlock already
#endif
- LeaveCriticalSection( &trayLockCS );
+ LeaveCriticalSection(&trayLockCS);
}
#undef lock
diff --git a/src/modules/clist/clui.cpp b/src/modules/clist/clui.cpp index 8f128e7c25..78ed09174d 100644 --- a/src/modules/clist/clui.cpp +++ b/src/modules/clist/clui.cpp @@ -76,7 +76,7 @@ static void DisconnectAll() {
int nProto;
for (nProto = 0; nProto < accounts.getCount(); nProto++)
- CallProtoService( accounts[nProto]->szModuleName, PS_SETSTATUS, ID_STATUS_OFFLINE, 0);
+ CallProtoService(accounts[nProto]->szModuleName, PS_SETSTATUS, ID_STATUS_OFFLINE, 0);
}
static int CluiIconsChanged(WPARAM, LPARAM)
@@ -98,9 +98,9 @@ static int MenuItem_PreBuild(WPARAM, LPARAM) mi.cbSize = sizeof(mi);
mi.flags = CMIM_FLAGS;
GetClassName(hwndClist, cls, SIZEOF(cls));
- hwndClist = (!lstrcmp(CLISTCONTROL_CLASS, cls)) ? hwndClist : cli.hwndContactList;
+ hwndClist = ( !lstrcmp(CLISTCONTROL_CLASS, cls)) ? hwndClist : cli.hwndContactList;
hItem = (HANDLE) SendMessage(hwndClist, CLM_GETSELECTION, 0, 0);
- if (!hItem) {
+ if ( !hItem) {
mi.flags = CMIM_FLAGS | CMIF_HIDDEN;
}
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) hRenameMenuItem, (LPARAM) & mi);
@@ -114,7 +114,7 @@ static INT_PTR MenuItem_RenameContact(WPARAM, LPARAM) HWND hwndClist = GetFocus();
GetClassName(hwndClist, cls, SIZEOF(cls));
// worst case scenario, the rename is sent to the main contact list
- hwndClist = (!lstrcmp(CLISTCONTROL_CLASS, cls)) ? hwndClist : cli.hwndContactList;
+ hwndClist = ( !lstrcmp(CLISTCONTROL_CLASS, cls)) ? hwndClist : cli.hwndContactList;
hItem = (HANDLE) SendMessage(hwndClist, CLM_GETSELECTION, 0, 0);
if (hItem) {
SetFocus(hwndClist);
@@ -181,7 +181,7 @@ static INT_PTR MenuItem_DeleteContact(WPARAM wParam, LPARAM lParam) UINT_PTR action;
if (DBGetContactSettingByte(NULL, "CList", "ConfirmDelete", SETTING_CONFIRMDELETE_DEFAULT) &&
- !(GetKeyState(VK_SHIFT)&0x8000) )
+ !(GetKeyState(VK_SHIFT)&0x8000))
// Ask user for confirmation, and if the contact should be archived (hidden, not deleted)
action = DialogBoxParam(hMirandaInst, MAKEINTRESOURCE(IDD_DELETECONTACT), (HWND) lParam, AskForConfirmationDlgProc, wParam);
else
@@ -205,7 +205,7 @@ 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,
+ 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;
@@ -251,14 +251,14 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l m.message=msg;
m.wParam=wParam;
m.lParam=lParam;
- if ( cli.pfnDocking_ProcessWindowMessage(( WPARAM )&m, ( LPARAM )&result ))
+ if (cli.pfnDocking_ProcessWindowMessage((WPARAM)&m, (LPARAM)&result))
return result;
- if ( cli.pfnTrayIconProcessMessage(( WPARAM )&m, ( LPARAM )&result ))
+ if (cli.pfnTrayIconProcessMessage((WPARAM)&m, (LPARAM)&result))
return result;
- if ( cli.pfnHotkeysProcessMessage(( WPARAM )&m, ( LPARAM )&result ))
+ if (cli.pfnHotkeysProcessMessage((WPARAM)&m, (LPARAM)&result))
return result;
- return cli.pfnContactListWndProc( hwnd, msg, wParam, lParam );
+ return cli.pfnContactListWndProc(hwnd, msg, wParam, lParam);
}
int LoadCLUIModule(void)
@@ -266,7 +266,7 @@ int LoadCLUIModule(void) DBVARIANT dbv;
TCHAR titleText[256];
- uMsgProcessProfile = RegisterWindowMessage( _T("Miranda::ProcessProfile"));
+ uMsgProcessProfile = RegisterWindowMessage(_T("Miranda::ProcessProfile"));
cli.pfnLoadCluiGlobalOpts();
HookEvent(ME_SYSTEM_MODULESLOADED, CluiModulesLoaded);
@@ -307,7 +307,7 @@ int LoadCLUIModule(void) RegisterClassEx(&wndclass);
if (DBGetContactSettingTString(NULL, "CList", "TitleText", &dbv))
- lstrcpyn(titleText, _T(MIRANDANAME), SIZEOF( titleText ));
+ lstrcpyn(titleText, _T(MIRANDANAME), SIZEOF(titleText));
else {
lstrcpyn(titleText, dbv.ptszVal, SIZEOF(titleText));
DBFreeVariant(&dbv);
@@ -344,7 +344,7 @@ int LoadCLUIModule(void) {
int state = DBGetContactSettingByte(NULL, "CList", "State", SETTING_STATE_NORMAL);
cli.hMenuMain = GetMenu(cli.hwndContactList);
- if (!DBGetContactSettingByte(NULL, "CLUI", "ShowMainMenu", SETTING_SHOWMAINMENU_DEFAULT))
+ if ( !DBGetContactSettingByte(NULL, "CLUI", "ShowMainMenu", SETTING_SHOWMAINMENU_DEFAULT))
SetMenu(cli.hwndContactList, NULL);
if (state == SETTING_STATE_NORMAL)
ShowWindow(cli.hwndContactList, SW_SHOW);
@@ -361,7 +361,7 @@ int LoadCLUIModule(void) CreateServiceFunction("CList/DeleteContactCommand", MenuItem_DeleteContact);
mi.position = 2000070000;
mi.flags = CMIF_ICONFROMICOLIB;
- mi.icolibItem = GetSkinIconHandle( SKINICON_OTHER_DELETE );
+ mi.icolibItem = GetSkinIconHandle(SKINICON_OTHER_DELETE);
mi.pszContactOwner = NULL; //on every contact
mi.pszName = LPGEN("De&lete");
mi.pszService = "CList/DeleteContactCommand";
@@ -369,7 +369,7 @@ int LoadCLUIModule(void) CreateServiceFunction("CList/RenameContactCommand", MenuItem_RenameContact);
mi.position = 2000050000;
- mi.icolibItem = GetSkinIconHandle( SKINICON_OTHER_RENAME );
+ mi.icolibItem = GetSkinIconHandle(SKINICON_OTHER_RENAME);
mi.pszContactOwner = NULL; //on every contact
mi.pszName = LPGEN("&Rename");
mi.pszService = "CList/RenameContactCommand";
@@ -378,7 +378,7 @@ int LoadCLUIModule(void) CreateServiceFunction("CList/AddToListContactCommand", MenuItem_AddContactToList);
mi.position = -2050000000;
mi.flags |= CMIF_NOTONLIST;
- mi.icolibItem = GetSkinIconHandle( SKINICON_OTHER_ADDCONTACT );
+ mi.icolibItem = GetSkinIconHandle(SKINICON_OTHER_ADDCONTACT);
mi.pszName = LPGEN("&Add permanently to list");
mi.pszService = "CList/AddToListContactCommand";
Menu_AddContactMenuItem(&mi);
@@ -393,7 +393,7 @@ int LoadCLUIModule(void) void fnDrawMenuItem(DRAWITEMSTRUCT *dis, HICON hIcon, HICON eventIcon)
{
- if (!IsWinVerXPPlus()) {
+ if ( !IsWinVerXPPlus()) {
FillRect(dis->hDC, &dis->rcItem, GetSysColorBrush(COLOR_MENU));
if (dis->itemState & ODS_HOTLIGHT)
DrawEdge(dis->hDC, &dis->rcItem, BDR_RAISEDINNER, BF_RECT);
@@ -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)
@@ -586,7 +586,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM }
if (wParam == SIZE_MINIMIZED)
{
- if ((GetWindowLongPtr(hwnd, GWL_EXSTYLE) & WS_EX_TOOLWINDOW) ||
+ if ((GetWindowLongPtr(hwnd, GWL_EXSTYLE) & WS_EX_TOOLWINDOW) ||
DBGetContactSettingByte(NULL, "CList", "Min2Tray", SETTING_MIN2TRAY_DEFAULT))
{
ShowWindow(hwnd, SW_HIDE);
@@ -600,11 +600,11 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM }
// drop thru
case WM_MOVE:
- if (!IsIconic(hwnd)) {
+ if ( !IsIconic(hwnd)) {
RECT rc;
GetWindowRect(hwnd, &rc);
- if (!CallService(MS_CLIST_DOCKINGISDOCKED, 0, 0)) { //if docked, dont remember pos (except for width)
+ if ( !CallService(MS_CLIST_DOCKINGISDOCKED, 0, 0)) { //if docked, dont remember pos (except for width)
DBWriteContactSettingDword(NULL, "CList", "Height", (DWORD) (rc.bottom - rc.top));
DBWriteContactSettingDword(NULL, "CList", "x", (DWORD) rc.left);
DBWriteContactSettingDword(NULL, "CList", "y", (DWORD) rc.top);
@@ -636,7 +636,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case WM_SETCURSOR:
if (cluiopt.transparent) {
- if (!transparentFocus && GetForegroundWindow() != hwnd && setLayeredWindowAttributes) {
+ if ( !transparentFocus && GetForegroundWindow() != hwnd && setLayeredWindowAttributes) {
setLayeredWindowAttributes(hwnd, RGB(0, 0, 0), (BYTE)cluiopt.alpha, LWA_ALPHA);
transparentFocus=1;
SetTimer(hwnd, TM_AUTOALPHA, 250, NULL);
@@ -648,7 +648,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM {
LRESULT result;
result = DefWindowProc(hwnd, WM_NCHITTEST, wParam, lParam);
- if (result == HTSIZE || result == HTTOP || result == HTTOPLEFT || result == HTTOPRIGHT ||
+ if (result == HTSIZE || result == HTTOP || result == HTTOPLEFT || result == HTTOPRIGHT ||
result == HTBOTTOM || result == HTBOTTOMRIGHT || result == HTBOTTOMLEFT)
if (DBGetContactSettingByte(NULL, "CLUI", "AutoSize", 0))
return HTCLIENT;
@@ -678,7 +678,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM else
setLayeredWindowAttributes(hwnd, RGB(0, 0, 0), (BYTE) DBGetContactSettingByte(NULL, "CList", "AutoAlpha", SETTING_AUTOALPHA_DEFAULT), LWA_ALPHA);
}
- if (!transparentFocus)
+ if ( !transparentFocus)
KillTimer(hwnd, TM_AUTOALPHA);
}
return TRUE;
@@ -690,7 +690,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM break;
if (noRecurse)
break;
- if (!DBGetContactSettingByte(NULL, "CLUI", "FadeInOut", 0) || !IsWinVer2000Plus())
+ if ( !DBGetContactSettingByte(NULL, "CLUI", "FadeInOut", 0) || !IsWinVer2000Plus())
break;
if (GetWindowLongPtr(hwnd, GWL_EXSTYLE) & WS_EX_LAYERED) {
DWORD thisTick, startTick;
@@ -741,7 +741,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case SC_MINIMIZE:
case SC_CLOSE:
- if ((GetWindowLongPtr(hwnd, GWL_EXSTYLE) & WS_EX_TOOLWINDOW) ||
+ if ((GetWindowLongPtr(hwnd, GWL_EXSTYLE) & WS_EX_TOOLWINDOW) ||
DBGetContactSettingByte(NULL, "CList", "Min2Tray", SETTING_MIN2TRAY_DEFAULT))
{
ShowWindow(hwnd, SW_HIDE);
@@ -839,7 +839,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM {
NMCLISTCONTROL *nmc = (NMCLISTCONTROL *) lParam;
ClientToScreen(hwnd, &nmc->pt);
- if (!(nmc->flags & CLNF_ISGROUP))
+ if ( !(nmc->flags & CLNF_ISGROUP))
if (NotifyEventHooks(hContactDraggingEvent, (WPARAM) nmc->hItem, MAKELPARAM(nmc->pt.x, nmc->pt.y))) {
SetCursor(LoadCursor(cli.hInst, MAKEINTRESOURCE(IDC_DROPUSER)));
return TRUE;
@@ -849,7 +849,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case CLN_DRAGSTOP:
{
NMCLISTCONTROL *nmc = (NMCLISTCONTROL *) lParam;
- if (!(nmc->flags & CLNF_ISGROUP))
+ if ( !(nmc->flags & CLNF_ISGROUP))
NotifyEventHooks(hContactDragStopEvent, (WPARAM) nmc->hItem, 0);
break;
}
@@ -857,7 +857,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM {
NMCLISTCONTROL *nmc = (NMCLISTCONTROL *) lParam;
ClientToScreen(hwnd, &nmc->pt);
- if (!(nmc->flags & CLNF_ISGROUP))
+ if ( !(nmc->flags & CLNF_ISGROUP))
if (NotifyEventHooks(hContactDroppedEvent, (WPARAM) nmc->hItem, MAKELPARAM(nmc->pt.x, nmc->pt.y))) {
SetCursor(LoadCursor(cli.hInst, MAKEINTRESOURCE(IDC_DROPUSER)));
return TRUE;
@@ -875,7 +875,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM RECT rcWindow, rcTree, rcWorkArea;
int maxHeight, newHeight;
- if (!DBGetContactSettingByte(NULL, "CLUI", "AutoSize", 0))
+ if ( !DBGetContactSettingByte(NULL, "CLUI", "AutoSize", 0))
break;
if (CallService(MS_CLIST_DOCKINGISDOCKED, 0, 0))
break;
@@ -973,7 +973,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM POINT pt;
GetCursorPos(&pt);
if ((pos == 0 || pos == 1) && (HIWORD(wParam) & MF_POPUP) &&
- (!(HIWORD(wParam) & MF_MOUSESELECT) || MenuItemFromPoint(hwnd, cli.hMenuMain, pt) != -1)) {
+ ( !(HIWORD(wParam) & MF_MOUSESELECT) || MenuItemFromPoint(hwnd, cli.hMenuMain, pt) != -1)) {
MENUITEMINFO mii = { 0 };
mii.cbSize = MENUITEMINFO_V4_SIZE;
mii.fMask = MIIM_SUBMENU;
@@ -995,7 +995,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM // all this is done in screen-coords!
GetCursorPos(&pt);
// the mouse isnt near the window, so put it in the middle of the window
- if (!PtInRect(&rc, pt)) {
+ if ( !PtInRect(&rc, pt)) {
pt.x = rc.left + (rc.right - rc.left) / 2;
pt.y = rc.top + (rc.bottom - rc.top) / 2;
}
@@ -1050,7 +1050,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM 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);
- if ( Proto_IsAccountLocked( Proto_GetAccount( szProto ))) {
+ 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,
@@ -1066,8 +1066,8 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM if (showOpts & 2) {
PROTOACCOUNT* pa;
TCHAR tszName[64];
- if (( pa = Proto_GetAccount( szProto )) != NULL )
- mir_sntprintf( tszName, SIZEOF(tszName), _T("%s "), pa->tszAccountName );
+ if ((pa = Proto_GetAccount(szProto)) != NULL)
+ mir_sntprintf(tszName, SIZEOF(tszName), _T("%s "), pa->tszAccountName);
else
tszName[0] = 0;
@@ -1076,11 +1076,11 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM x += textSize.cx;
}
if (showOpts & 4) {
- TCHAR* szStatus = cli.pfnGetStatusModeDescription( status, 0 );
- if ( !szStatus )
+ TCHAR* szStatus = cli.pfnGetStatusModeDescription(status, 0);
+ if ( !szStatus)
szStatus = _T("");
- GetTextExtentPoint32( dis->hDC, szStatus, lstrlen(szStatus), &textSize );
- TextOut( dis->hDC, x, (dis->rcItem.top + dis->rcItem.bottom - textSize.cy ) >> 1, szStatus, lstrlen( szStatus ));
+ GetTextExtentPoint32(dis->hDC, szStatus, lstrlen(szStatus), &textSize);
+ TextOut(dis->hDC, x, (dis->rcItem.top + dis->rcItem.bottom - textSize.cy) >> 1, szStatus, lstrlen(szStatus));
}
}
else if (dis->CtlType == ODT_MENU) {
@@ -1100,11 +1100,11 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM return FALSE;
case WM_DESTROY:
- if (!IsIconic(hwnd)) {
+ if ( !IsIconic(hwnd)) {
RECT rc;
GetWindowRect(hwnd, &rc);
- if (!CallService(MS_CLIST_DOCKINGISDOCKED, 0, 0)) { //if docked, dont remember pos (except for width)
+ if ( !CallService(MS_CLIST_DOCKINGISDOCKED, 0, 0)) { //if docked, dont remember pos (except for width)
DBWriteContactSettingDword(NULL, "CList", "Height", (DWORD) (rc.bottom - rc.top));
DBWriteContactSettingDword(NULL, "CList", "x", (DWORD) rc.left);
DBWriteContactSettingDword(NULL, "CList", "y", (DWORD) rc.top);
@@ -1115,8 +1115,8 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM RemoveMenu(cli.hMenuMain, 0, MF_BYPOSITION);
RemoveMenu(cli.hMenuMain, 0, MF_BYPOSITION);
- if ( cli.hwndStatus ) {
- DestroyWindow( cli.hwndStatus );
+ if (cli.hwndStatus) {
+ DestroyWindow(cli.hwndStatus);
cli.hwndStatus = NULL;
}
diff --git a/src/modules/clist/cluiservices.cpp b/src/modules/clist/cluiservices.cpp index d96f688997..e1123ecd05 100644 --- a/src/modules/clist/cluiservices.cpp +++ b/src/modules/clist/cluiservices.cpp @@ -35,7 +35,7 @@ static INT_PTR GetHwndTree(WPARAM, LPARAM) static INT_PTR CluiProtocolStatusChanged(WPARAM wParam, LPARAM lParam)
{
- cli.pfnCluiProtocolStatusChanged( wParam, (const char*)lParam );
+ cli.pfnCluiProtocolStatusChanged(wParam, (const char*)lParam);
return 0;
}
@@ -54,7 +54,7 @@ static INT_PTR GroupAdded(WPARAM wParam, LPARAM lParam) HWND hwndFocus = GetFocus();
GetClassName(hwndFocus, szFocusClass, SIZEOF(szFocusClass));
- if (!lstrcmp(szFocusClass, CLISTCONTROL_CLASS)) {
+ if ( !lstrcmp(szFocusClass, CLISTCONTROL_CLASS)) {
hItem = (HANDLE) SendMessage(hwndFocus, CLM_FINDGROUP, wParam, 0);
if (hItem)
SendMessage(hwndFocus, CLM_EDITLABEL, (WPARAM) hItem, 0);
@@ -151,27 +151,27 @@ void LoadCluiServices(void) /////////////////////////////////////////////////////////////////////////////////////////
// default protocol status notification handler
-void fnCluiProtocolStatusChanged(int, const char* )
+void fnCluiProtocolStatusChanged(int, const char*)
{
int i, *partWidths;
int borders[3];
int flags = 0;
- if ( cli.menuProtoCount == 0 ) {
+ if (cli.menuProtoCount == 0) {
SendMessage(cli.hwndStatus, SB_SETPARTS, 0, 0);
- SendMessage( cli.hwndStatus, SB_SETTEXT, SBT_OWNERDRAW, 0 );
+ SendMessage(cli.hwndStatus, SB_SETTEXT, SBT_OWNERDRAW, 0);
return;
}
- SendMessage(cli.hwndStatus, SB_GETBORDERS, 0, ( LPARAM )&borders);
+ SendMessage(cli.hwndStatus, SB_GETBORDERS, 0, (LPARAM)&borders);
- partWidths = ( int* )alloca( cli.menuProtoCount * sizeof( int ));
- if ( DBGetContactSettingByte( NULL, "CLUI", "EqualSections", 0 )) {
+ partWidths = (int*)alloca(cli.menuProtoCount * sizeof(int));
+ if (DBGetContactSettingByte(NULL, "CLUI", "EqualSections", 0)) {
RECT rc;
- GetClientRect( cli.hwndStatus, &rc );
- rc.right -= borders[0] * 2 + ( DBGetContactSettingByte( NULL, "CLUI", "ShowGrip", 1 ) ? GetSystemMetrics( SM_CXVSCROLL ) : 0 );
- for ( i = 0; i < cli.menuProtoCount; i++ )
- partWidths[ i ] = ( i+1 ) * rc.right / cli.menuProtoCount - (borders[2] >> 1);
+ GetClientRect(cli.hwndStatus, &rc);
+ rc.right -= borders[0] * 2 + (DBGetContactSettingByte(NULL, "CLUI", "ShowGrip", 1) ? GetSystemMetrics(SM_CXVSCROLL) : 0);
+ for (i = 0; i < cli.menuProtoCount; i++)
+ partWidths[ i ] = (i+1) * rc.right / cli.menuProtoCount - (borders[2] >> 1);
}
else {
HDC hdc;
@@ -180,42 +180,42 @@ void fnCluiProtocolStatusChanged(int, const char* ) hdc = GetDC(NULL);
SelectObject(hdc, (HFONT) SendMessage(cli.hwndStatus, WM_GETFONT, 0, 0));
- for ( i = 0; i < cli.menuProtoCount; i++ ) { //count down since built in ones tend to go at the end
+ for (i = 0; i < cli.menuProtoCount; i++) { //count down since built in ones tend to go at the end
int x = 2;
- if ( showOpts & 1 )
+ if (showOpts & 1)
x += g_IconWidth;
- if ( showOpts & 2 ) {
+ if (showOpts & 2) {
TCHAR tszName[64];
- PROTOACCOUNT* pa = Proto_GetAccount( cli.menuProtos[i].szProto );
- if ( pa )
- mir_sntprintf( tszName, SIZEOF(tszName), _T("%s "), pa->tszAccountName );
+ PROTOACCOUNT* pa = Proto_GetAccount(cli.menuProtos[i].szProto);
+ if (pa)
+ mir_sntprintf(tszName, SIZEOF(tszName), _T("%s "), pa->tszAccountName);
else
tszName[0] = 0;
- if ( showOpts & 4 && lstrlen(tszName) < SIZEOF(tszName)-1 )
- lstrcat( tszName, _T(" "));
+ if (showOpts & 4 && lstrlen(tszName) < SIZEOF(tszName)-1)
+ lstrcat(tszName, _T(" "));
GetTextExtentPoint32(hdc, tszName, lstrlen(tszName), &textSize);
x += textSize.cx;
x += GetSystemMetrics(SM_CXBORDER) * 4; // The SB panel doesnt allocate enough room
}
- if ( showOpts & 4 ) {
- TCHAR* modeDescr = cli.pfnGetStatusModeDescription( CallProtoService( cli.menuProtos[i].szProto, PS_GETSTATUS, 0, 0), 0 );
+ if (showOpts & 4) {
+ TCHAR* modeDescr = cli.pfnGetStatusModeDescription(CallProtoService(cli.menuProtos[i].szProto, PS_GETSTATUS, 0, 0), 0);
GetTextExtentPoint32(hdc, modeDescr, lstrlen(modeDescr), &textSize);
x += textSize.cx;
x += GetSystemMetrics(SM_CXBORDER) * 4; // The SB panel doesnt allocate enough room
}
- partWidths[ i ] = ( i ? partWidths[ i-1] : 0 ) + x + 2;
+ partWidths[ i ] = (i ? partWidths[ i-1] : 0) + x + 2;
}
ReleaseDC(NULL, hdc);
}
partWidths[ cli.menuProtoCount-1 ] = -1;
SendMessage(cli.hwndStatus, SB_SETMINHEIGHT, g_IconHeight, 0);
- SendMessage(cli.hwndStatus, SB_SETPARTS, cli.menuProtoCount, ( LPARAM )partWidths);
+ SendMessage(cli.hwndStatus, SB_SETPARTS, cli.menuProtoCount, (LPARAM)partWidths);
flags = SBT_OWNERDRAW;
- if ( DBGetContactSettingByte( NULL, "CLUI", "SBarBevel", 1 ) == 0 )
+ if (DBGetContactSettingByte(NULL, "CLUI", "SBarBevel", 1) == 0)
flags |= SBT_NOBORDERS;
- for ( i = 0; i < cli.menuProtoCount; i++ ) {
- SendMessage( cli.hwndStatus, SB_SETTEXT, i | flags, ( LPARAM )cli.menuProtos[i].szProto );
+ for (i = 0; i < cli.menuProtoCount; i++) {
+ SendMessage(cli.hwndStatus, SB_SETTEXT, i | flags, (LPARAM)cli.menuProtos[i].szProto);
}
}
diff --git a/src/modules/clist/contact.cpp b/src/modules/clist/contact.cpp index c0b1c9e8d1..5fce5cb1f4 100644 --- a/src/modules/clist/contact.cpp +++ b/src/modules/clist/contact.cpp @@ -45,7 +45,7 @@ static const struct { static int GetContactStatus(HANDLE hContact)
{
- char* szProto = ( char* )CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
+ char* szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
if (szProto == NULL)
return ID_STATUS_OFFLINE;
return DBGetContactSettingWord(hContact, szProto, "Status", ID_STATUS_OFFLINE);
@@ -73,7 +73,7 @@ void fnLoadContactTree(void) CallService(MS_CLUI_LISTBEGINREBUILD, 0, 0);
for (i = 1;; i++) {
- if ( cli.pfnGetGroupName(i, NULL) == NULL)
+ if (cli.pfnGetGroupName(i, NULL) == NULL)
break;
CallService(MS_CLUI_GROUPADDED, i, 0);
}
@@ -82,7 +82,7 @@ void fnLoadContactTree(void) hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
while (hContact != NULL) {
status = GetContactStatus(hContact);
- if ((!hideOffline || status != ID_STATUS_OFFLINE) && !DBGetContactSettingByte(hContact, "CList", "Hidden", 0))
+ if (( !hideOffline || status != ID_STATUS_OFFLINE) && !DBGetContactSettingByte(hContact, "CList", "Hidden", 0))
cli.pfnChangeContactIcon(hContact, cli.pfnIconFromStatusMode((char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0), status, hContact), 1);
hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
}
@@ -108,7 +108,7 @@ int fnCompareContacts(const struct ClcContact* c1, const struct ClcContact* c2) return 2 * (statusa == ID_STATUS_OFFLINE) - 1;
}
/* both are online, now check protocols */
- rc = lstrcmpA( c1->proto, c2->proto);
+ rc = lstrcmpA(c1->proto, c2->proto);
if (rc != 0 && (c1->proto != NULL && c2->proto != NULL))
return rc;
/* protocols are the same, order by display name */
@@ -128,10 +128,10 @@ int fnCompareContacts(const struct ClcContact* c1, const struct ClcContact* c2) }
}
- nameb = cli.pfnGetContactDisplayName( a, 0);
+ nameb = cli.pfnGetContactDisplayName(a, 0);
_tcsncpy(namea, nameb, SIZEOF(namea));
namea[ SIZEOF(namea)-1 ] = 0;
- nameb = cli.pfnGetContactDisplayName( b, 0);
+ nameb = cli.pfnGetContactDisplayName(b, 0);
//otherwise just compare names
return _tcsicmp(namea, nameb);
@@ -176,7 +176,7 @@ INT_PTR ContactChangeGroup(WPARAM wParam, LPARAM lParam) int fnSetHideOffline(WPARAM wParam, LPARAM)
{
- switch(( int )wParam ) {
+ switch((int)wParam) {
case 0:
DBWriteContactSettingByte(NULL, "CList", "HideOffline", 0);
break;
diff --git a/src/modules/clist/genmenu.cpp b/src/modules/clist/genmenu.cpp index 4c6edd416d..7fcb9b32c7 100644 --- a/src/modules/clist/genmenu.cpp +++ b/src/modules/clist/genmenu.cpp @@ -29,44 +29,44 @@ static CRITICAL_SECTION csMenuHook; static int NextObjectId = 0x100, NextObjectMenuItemId = CLISTMENUIDMIN;
-#if defined( _DEBUG )
-static void DumpMenuItem( TMO_IntMenuItem* pParent, int level = 0 )
+#if defined(_DEBUG)
+static void DumpMenuItem(TMO_IntMenuItem* pParent, int level = 0)
{
char temp[ 30 ];
- memset( temp, '\t', level );
+ memset(temp, '\t', level);
temp[ level ] = 0;
- for ( PMO_IntMenuItem pimi = pParent; pimi != NULL; pimi = pimi->next ) {
- Netlib_Logf( NULL, "%sMenu item %08p [%08p]: %S", temp, pimi, pimi->mi.root, pimi->mi.ptszName );
+ for (PMO_IntMenuItem pimi = pParent; pimi != NULL; pimi = pimi->next) {
+ Netlib_Logf(NULL, "%sMenu item %08p [%08p]: %S", temp, pimi, pimi->mi.root, pimi->mi.ptszName);
PMO_IntMenuItem submenu = pimi->submenu.first;
- if ( submenu )
- DumpMenuItem( submenu, level+1 );
+ if (submenu)
+ DumpMenuItem(submenu, level+1);
} }
#endif
-static int CompareMenus( const TIntMenuObject* p1, const TIntMenuObject* p2 )
+static int CompareMenus(const TIntMenuObject* p1, const TIntMenuObject* p2)
{
- return lstrcmpA( p1->Name, p2->Name );
+ return lstrcmpA(p1->Name, p2->Name);
}
-LIST<TIntMenuObject> g_menus( 10, CompareMenus );
+LIST<TIntMenuObject> g_menus(10, CompareMenus);
-void FreeAndNil( void **p )
+void FreeAndNil(void **p)
{
- if ( p == NULL )
+ if (p == NULL)
return;
- if ( *p != NULL ) {
- mir_free( *p );
+ if (*p != NULL) {
+ mir_free(*p);
*p = NULL;
} }
-int GetMenuObjbyId( const int id )
+int GetMenuObjbyId(const int id)
{
- for ( int i=0; i < g_menus.getCount(); i++ )
- if ( g_menus[i]->id == id )
+ for (int i=0; i < g_menus.getCount(); i++)
+ if (g_menus[i]->id == id)
return i;
return -1;
@@ -80,21 +80,21 @@ LPTSTR GetMenuItemText(PMO_IntMenuItem pimi) return LangPackTranslateStringT(pimi->mi.hLangpack, pimi->mi.ptszName);
}
-PMO_IntMenuItem MO_RecursiveWalkMenu( PMO_IntMenuItem parent, pfnWalkFunc func, void* param )
+PMO_IntMenuItem MO_RecursiveWalkMenu(PMO_IntMenuItem parent, pfnWalkFunc func, void* param)
{
- if ( parent == NULL )
+ if (parent == NULL)
return FALSE;
PMO_IntMenuItem pnext;
- for ( PMO_IntMenuItem pimi = parent; pimi != NULL; pimi = pnext ) {
+ for (PMO_IntMenuItem pimi = parent; pimi != NULL; pimi = pnext) {
PMO_IntMenuItem submenu = pimi->submenu.first;
pnext = pimi->next;
- if ( func( pimi, param )) // it can destroy the menu item
+ if (func(pimi, param)) // it can destroy the menu item
return pimi;
- if ( submenu ) {
- PMO_IntMenuItem res = MO_RecursiveWalkMenu( submenu, func, param );
- if ( res )
+ if (submenu) {
+ PMO_IntMenuItem res = MO_RecursiveWalkMenu(submenu, func, param);
+ if (res)
return res;
}
}
@@ -104,23 +104,23 @@ PMO_IntMenuItem MO_RecursiveWalkMenu( PMO_IntMenuItem parent, pfnWalkFunc func, //wparam=0
//lparam=LPMEASUREITEMSTRUCT
-int MO_MeasureMenuItem( LPMEASUREITEMSTRUCT mis )
+int MO_MeasureMenuItem(LPMEASUREITEMSTRUCT mis)
{
// prevent win9x from ugly menus displaying when there is no icon
mis->itemWidth = 0;
mis->itemHeight = 0;
- if ( !bIsGenMenuInited )
+ if ( !bIsGenMenuInited)
return -1;
- if ( mis == NULL )
+ if (mis == NULL)
return FALSE;
- PMO_IntMenuItem pimi = MO_GetIntMenuItem(( HGENMENU )mis->itemData );
- if ( pimi == NULL )
+ PMO_IntMenuItem pimi = MO_GetIntMenuItem((HGENMENU)mis->itemData);
+ if (pimi == NULL)
return FALSE;
- if ( pimi->iconId == -1 )
+ if (pimi->iconId == -1)
return FALSE;
mis->itemWidth = max(0, GetSystemMetrics(SM_CXSMICON)-GetSystemMetrics(SM_CXMENUCHECK)+4);
@@ -130,35 +130,35 @@ int MO_MeasureMenuItem( LPMEASUREITEMSTRUCT mis ) //wparam=0
//lparam=LPDRAWITEMSTRUCT
-int MO_DrawMenuItem( LPDRAWITEMSTRUCT dis )
+int MO_DrawMenuItem(LPDRAWITEMSTRUCT dis)
{
- if ( !bIsGenMenuInited )
+ if ( !bIsGenMenuInited)
return -1;
- if ( dis == NULL )
+ if (dis == NULL)
return FALSE;
- EnterCriticalSection( &csMenuHook );
+ EnterCriticalSection(&csMenuHook);
- PMO_IntMenuItem pimi = MO_GetIntMenuItem(( HGENMENU )dis->itemData );
- if ( pimi == NULL || pimi->iconId == -1 ) {
- LeaveCriticalSection( &csMenuHook );
+ PMO_IntMenuItem pimi = MO_GetIntMenuItem((HGENMENU)dis->itemData);
+ if (pimi == NULL || pimi->iconId == -1) {
+ LeaveCriticalSection(&csMenuHook);
return FALSE;
}
int y = (dis->rcItem.bottom - dis->rcItem.top - GetSystemMetrics(SM_CYSMICON))/2+1;
- if ( dis->itemState & ODS_SELECTED ) {
- if ( dis->itemState & ODS_CHECKED ) {
+ if (dis->itemState & ODS_SELECTED) {
+ if (dis->itemState & ODS_CHECKED) {
RECT rc;
rc.left = 2; rc.right = GetSystemMetrics(SM_CXSMICON)+2;
rc.top = y; rc.bottom = rc.top+GetSystemMetrics(SM_CYSMICON)+2;
- FillRect(dis->hDC, &rc, GetSysColorBrush( COLOR_HIGHLIGHT ));
- ImageList_DrawEx( pimi->parent->m_hMenuIcons, pimi->iconId, dis->hDC, 2, y, 0, 0, CLR_NONE, CLR_DEFAULT, ILD_SELECTED );
+ FillRect(dis->hDC, &rc, GetSysColorBrush(COLOR_HIGHLIGHT));
+ ImageList_DrawEx(pimi->parent->m_hMenuIcons, pimi->iconId, dis->hDC, 2, y, 0, 0, CLR_NONE, CLR_DEFAULT, ILD_SELECTED);
}
- else ImageList_DrawEx( pimi->parent->m_hMenuIcons, pimi->iconId, dis->hDC, 2, y, 0, 0, CLR_NONE, CLR_DEFAULT, ILD_FOCUS );
+ else ImageList_DrawEx(pimi->parent->m_hMenuIcons, pimi->iconId, dis->hDC, 2, y, 0, 0, CLR_NONE, CLR_DEFAULT, ILD_FOCUS);
}
else {
- if ( dis->itemState & ODS_CHECKED) {
+ if (dis->itemState & ODS_CHECKED) {
RECT rc;
rc.left = 0; rc.right = GetSystemMetrics(SM_CXSMICON)+4;
rc.top = y-2; rc.bottom = rc.top + GetSystemMetrics(SM_CYSMICON)+4;
@@ -173,14 +173,14 @@ int MO_DrawMenuItem( LPDRAWITEMSTRUCT dis ) }
else ImageList_DrawEx(pimi->parent->m_hMenuIcons, pimi->iconId, dis->hDC, 2, y, 0, 0, CLR_NONE, CLR_NONE, ILD_NORMAL);
}
- LeaveCriticalSection( &csMenuHook );
+ LeaveCriticalSection(&csMenuHook);
return TRUE;
}
int MO_RemoveAllObjects()
{
int i;
- for ( i=0; i < g_menus.getCount(); i++ )
+ for (i=0; i < g_menus.getCount(); i++)
delete g_menus[i];
g_menus.destroy();
@@ -193,74 +193,74 @@ INT_PTR MO_RemoveMenuObject(WPARAM wParam, LPARAM) int objidx;
if ( !bIsGenMenuInited) return -1;
- EnterCriticalSection( &csMenuHook );
+ EnterCriticalSection(&csMenuHook);
- objidx = GetMenuObjbyId(( int )wParam );
- if ( objidx == -1 ) {
- LeaveCriticalSection( &csMenuHook );
+ objidx = GetMenuObjbyId((int)wParam);
+ if (objidx == -1) {
+ LeaveCriticalSection(&csMenuHook);
return -1;
}
delete g_menus[ objidx ];
- g_menus.remove( objidx );
- LeaveCriticalSection( &csMenuHook );
+ g_menus.remove(objidx);
+ LeaveCriticalSection(&csMenuHook);
return 0;
}
//wparam=MenuObjectHandle
//lparam=vKey
-INT_PTR MO_ProcessHotKeys( HANDLE menuHandle, INT_PTR vKey )
+INT_PTR MO_ProcessHotKeys(HANDLE menuHandle, INT_PTR vKey)
{
if ( !bIsGenMenuInited)
return -1;
- EnterCriticalSection( &csMenuHook );
+ EnterCriticalSection(&csMenuHook);
- int objidx = GetMenuObjbyId((int)menuHandle );
- if ( objidx == -1 ) {
- LeaveCriticalSection( &csMenuHook );
+ int objidx = GetMenuObjbyId((int)menuHandle);
+ if (objidx == -1) {
+ LeaveCriticalSection(&csMenuHook);
return FALSE;
}
- for ( PMO_IntMenuItem pimi = g_menus[objidx]->m_items.first; pimi != NULL; pimi = pimi->next ) {
- if ( pimi->mi.hotKey == 0 ) continue;
- if ( HIWORD(pimi->mi.hotKey) != vKey) continue;
- if ( !(LOWORD(pimi->mi.hotKey) & MOD_ALT ) != !( GetKeyState( VK_MENU ) & 0x8000)) continue;
- if ( !(LOWORD(pimi->mi.hotKey) & MOD_CONTROL ) != !( GetKeyState( VK_CONTROL ) & 0x8000)) continue;
- if ( !(LOWORD(pimi->mi.hotKey) & MOD_SHIFT ) != !( GetKeyState( VK_SHIFT ) & 0x8000)) continue;
+ for (PMO_IntMenuItem pimi = g_menus[objidx]->m_items.first; pimi != NULL; pimi = pimi->next) {
+ if (pimi->mi.hotKey == 0) continue;
+ if (HIWORD(pimi->mi.hotKey) != vKey) continue;
+ if ( !(LOWORD(pimi->mi.hotKey) & MOD_ALT) != !(GetKeyState(VK_MENU) & 0x8000)) continue;
+ if ( !(LOWORD(pimi->mi.hotKey) & MOD_CONTROL) != !(GetKeyState(VK_CONTROL) & 0x8000)) continue;
+ if ( !(LOWORD(pimi->mi.hotKey) & MOD_SHIFT) != !(GetKeyState(VK_SHIFT) & 0x8000)) continue;
- MO_ProcessCommand( pimi, 0 );
- LeaveCriticalSection( &csMenuHook );
+ MO_ProcessCommand(pimi, 0);
+ LeaveCriticalSection(&csMenuHook);
return TRUE;
}
- LeaveCriticalSection( &csMenuHook );
+ LeaveCriticalSection(&csMenuHook);
return FALSE;
}
INT_PTR MO_GetProtoRootMenu(WPARAM wParam, LPARAM lParam)
{
- char* szProto = ( char* )wParam;
- if ( szProto == NULL )
+ char* szProto = (char*)wParam;
+ if (szProto == NULL)
return 0;
- if ( DBGetContactSettingByte( NULL, "CList", "MoveProtoMenus", TRUE ))
- return ( INT_PTR )cli.pfnGetProtocolMenu( szProto );
+ if (DBGetContactSettingByte(NULL, "CList", "MoveProtoMenus", TRUE))
+ return (INT_PTR)cli.pfnGetProtocolMenu(szProto);
- int objidx = GetMenuObjbyId(( int )hMainMenuObject );
- if ( objidx == -1 )
+ int objidx = GetMenuObjbyId((int)hMainMenuObject);
+ if (objidx == -1)
return NULL;
- EnterCriticalSection( &csMenuHook );
+ EnterCriticalSection(&csMenuHook);
TIntMenuObject* pmo = g_menus[objidx];
PMO_IntMenuItem p;
- for ( p = pmo->m_items.first; p != NULL; p = p->next )
- if ( !lstrcmpA( p->UniqName, szProto ))
+ for (p = pmo->m_items.first; p != NULL; p = p->next)
+ if ( !lstrcmpA(p->UniqName, szProto))
break;
- LeaveCriticalSection( &csMenuHook );
- return ( INT_PTR )p;
+ LeaveCriticalSection(&csMenuHook);
+ return (INT_PTR)p;
}
//wparam=MenuItemHandle
@@ -268,88 +268,88 @@ INT_PTR MO_GetProtoRootMenu(WPARAM wParam, LPARAM lParam) INT_PTR MO_GetMenuItem(WPARAM wParam, LPARAM lParam)
{
PMO_MenuItem mi = (PMO_MenuItem)lParam;
- if ( !bIsGenMenuInited || mi == NULL )
+ if ( !bIsGenMenuInited || mi == NULL)
return -1;
- PMO_IntMenuItem pimi = MO_GetIntMenuItem(( HGENMENU )wParam);
- EnterCriticalSection( &csMenuHook );
- if ( !pimi ) {
- LeaveCriticalSection( &csMenuHook );
+ PMO_IntMenuItem pimi = MO_GetIntMenuItem((HGENMENU)wParam);
+ EnterCriticalSection(&csMenuHook);
+ if ( !pimi) {
+ LeaveCriticalSection(&csMenuHook);
return -1;
}
*mi = pimi->mi;
- LeaveCriticalSection( &csMenuHook );
+ LeaveCriticalSection(&csMenuHook);
return 0;
}
-static int FindDefaultItem( PMO_IntMenuItem pimi, void* )
+static int FindDefaultItem(PMO_IntMenuItem pimi, void*)
{
- if ( pimi->mi.flags & ( CMIF_GRAYED | CMIF_HIDDEN ))
+ if (pimi->mi.flags & (CMIF_GRAYED | CMIF_HIDDEN))
return FALSE;
- return ( pimi->mi.flags & CMIF_DEFAULT ) ? TRUE : FALSE;
+ return (pimi->mi.flags & CMIF_DEFAULT) ? TRUE : FALSE;
}
INT_PTR MO_GetDefaultMenuItem(WPARAM wParam, LPARAM)
{
- if ( !bIsGenMenuInited )
+ if ( !bIsGenMenuInited)
return -1;
- PMO_IntMenuItem pimi = MO_GetIntMenuItem(( HGENMENU )wParam);
- EnterCriticalSection( &csMenuHook );
- if ( pimi )
- pimi = MO_RecursiveWalkMenu( pimi, FindDefaultItem, NULL );
+ PMO_IntMenuItem pimi = MO_GetIntMenuItem((HGENMENU)wParam);
+ EnterCriticalSection(&csMenuHook);
+ if (pimi)
+ pimi = MO_RecursiveWalkMenu(pimi, FindDefaultItem, NULL);
- LeaveCriticalSection( &csMenuHook );
- return ( INT_PTR )pimi;
+ LeaveCriticalSection(&csMenuHook);
+ return (INT_PTR)pimi;
}
//wparam MenuItemHandle
//lparam PMO_MenuItem
-int MO_ModifyMenuItem( PMO_IntMenuItem menuHandle, PMO_MenuItem pmi )
+int MO_ModifyMenuItem(PMO_IntMenuItem menuHandle, PMO_MenuItem pmi)
{
int oldflags;
- if ( !bIsGenMenuInited || pmi == NULL || pmi->cbSize != sizeof( TMO_MenuItem ))
+ if ( !bIsGenMenuInited || pmi == NULL || pmi->cbSize != sizeof(TMO_MenuItem))
return -1;
- EnterCriticalSection( &csMenuHook );
+ EnterCriticalSection(&csMenuHook);
- PMO_IntMenuItem pimi = MO_GetIntMenuItem(( HGENMENU )menuHandle );
- if ( !pimi ) {
- LeaveCriticalSection( &csMenuHook );
+ PMO_IntMenuItem pimi = MO_GetIntMenuItem((HGENMENU)menuHandle);
+ if ( !pimi) {
+ LeaveCriticalSection(&csMenuHook);
return -1;
}
- if ( pmi->flags & CMIM_NAME ) {
- FreeAndNil(( void** )&pimi->mi.pszName );
+ if (pmi->flags & CMIM_NAME) {
+ FreeAndNil((void**)&pimi->mi.pszName);
- if ( pmi->flags & CMIF_UNICODE )
+ if (pmi->flags & CMIF_UNICODE)
pimi->mi.ptszName = mir_tstrdup(pmi->ptszName);
else
pimi->mi.ptszName = mir_a2t(pmi->pszName);
}
- if ( pmi->flags & CMIM_FLAGS ) {
- oldflags = pimi->mi.flags & ( CMIF_ROOTHANDLE | CMIF_ICONFROMICOLIB );
+ if (pmi->flags & CMIM_FLAGS) {
+ oldflags = pimi->mi.flags & (CMIF_ROOTHANDLE | CMIF_ICONFROMICOLIB);
pimi->mi.flags = (pmi->flags & ~CMIM_ALL) | oldflags;
}
- if ((pmi->flags & CMIM_ICON) && !bIconsDisabled ) {
- if ( pimi->mi.flags & CMIF_ICONFROMICOLIB ) {
- HICON hIcon = IcoLib_GetIconByHandle( pmi->hIcolibItem, false );
- if ( hIcon != NULL ) {
+ if ((pmi->flags & CMIM_ICON) && !bIconsDisabled) {
+ if (pimi->mi.flags & CMIF_ICONFROMICOLIB) {
+ HICON hIcon = IcoLib_GetIconByHandle(pmi->hIcolibItem, false);
+ if (hIcon != NULL) {
pimi->hIcolibItem = pmi->hIcolibItem;
- pimi->iconId = ImageList_ReplaceIcon( pimi->parent->m_hMenuIcons, pimi->iconId, hIcon );
- IconLib_ReleaseIcon( hIcon, 0 );
+ pimi->iconId = ImageList_ReplaceIcon(pimi->parent->m_hMenuIcons, pimi->iconId, hIcon);
+ IconLib_ReleaseIcon(hIcon, 0);
}
else pimi->iconId = -1, pimi->hIcolibItem = NULL;
}
else {
pimi->mi.hIcon = pmi->hIcon;
- if ( pmi->hIcon != NULL )
- pimi->iconId = ImageList_ReplaceIcon( pimi->parent->m_hMenuIcons, pimi->iconId, pmi->hIcon );
+ if (pmi->hIcon != NULL)
+ pimi->iconId = ImageList_ReplaceIcon(pimi->parent->m_hMenuIcons, pimi->iconId, pmi->hIcon);
else
pimi->iconId = -1; //fixme, should remove old icon & shuffle all iconIds
}
@@ -359,10 +359,10 @@ int MO_ModifyMenuItem( PMO_IntMenuItem menuHandle, PMO_MenuItem pmi ) }
}
- if ( pmi->flags & CMIM_HOTKEY )
+ if (pmi->flags & CMIM_HOTKEY)
pimi->mi.hotKey = pmi->hotKey;
- LeaveCriticalSection( &csMenuHook );
+ LeaveCriticalSection(&csMenuHook);
return 0;
}
@@ -371,33 +371,33 @@ int MO_ModifyMenuItem( PMO_IntMenuItem menuHandle, PMO_MenuItem pmi ) //NULL on error.
INT_PTR MO_MenuItemGetOwnerData(WPARAM wParam, LPARAM)
{
- if ( !bIsGenMenuInited )
+ if ( !bIsGenMenuInited)
return -1;
- EnterCriticalSection( &csMenuHook );
- PMO_IntMenuItem pimi = MO_GetIntMenuItem(( HGENMENU )wParam );
- if ( !pimi ) {
- LeaveCriticalSection( &csMenuHook );
+ EnterCriticalSection(&csMenuHook);
+ PMO_IntMenuItem pimi = MO_GetIntMenuItem((HGENMENU)wParam);
+ if ( !pimi) {
+ LeaveCriticalSection(&csMenuHook);
return -1;
}
- INT_PTR res = ( INT_PTR )pimi->mi.ownerdata;
- LeaveCriticalSection( &csMenuHook );
+ INT_PTR res = (INT_PTR)pimi->mi.ownerdata;
+ LeaveCriticalSection(&csMenuHook);
return res;
}
PMO_IntMenuItem MO_GetIntMenuItem(HGENMENU wParam)
{
- PMO_IntMenuItem result = ( PMO_IntMenuItem )wParam;
- if ( result == NULL || wParam == (HGENMENU)0xffff1234 || wParam == HGENMENU_ROOT)
+ PMO_IntMenuItem result = (PMO_IntMenuItem)wParam;
+ if (result == NULL || wParam == (HGENMENU)0xffff1234 || wParam == HGENMENU_ROOT)
return NULL;
__try
{
- if ( result->signature != MENUITEM_SIGNATURE )
+ if (result->signature != MENUITEM_SIGNATURE)
result = NULL;
}
- __except( EXCEPTION_EXECUTE_HANDLER )
+ __except(EXCEPTION_EXECUTE_HANDLER)
{
result = NULL;
}
@@ -407,80 +407,80 @@ PMO_IntMenuItem MO_GetIntMenuItem(HGENMENU wParam) //LOWORD(wparam) menuident
-static int FindMenuByCommand( PMO_IntMenuItem pimi, void* pCommand )
+static int FindMenuByCommand(PMO_IntMenuItem pimi, void* pCommand)
{
- return ( pimi->iCommand == (int)pCommand );
+ return (pimi->iCommand == (int)pCommand);
}
int MO_ProcessCommandBySubMenuIdent(int menuID, int command, LPARAM lParam)
{
- if ( !bIsGenMenuInited )
+ if ( !bIsGenMenuInited)
return -1;
- EnterCriticalSection( &csMenuHook );
+ EnterCriticalSection(&csMenuHook);
- int objidx = GetMenuObjbyId( menuID );
- if ( objidx == -1 ) {
- LeaveCriticalSection( &csMenuHook );
+ int objidx = GetMenuObjbyId(menuID);
+ if (objidx == -1) {
+ LeaveCriticalSection(&csMenuHook);
return -1;
}
- PMO_IntMenuItem pimi = MO_RecursiveWalkMenu( g_menus[objidx]->m_items.first, FindMenuByCommand, ( void* )command );
- if ( pimi ) {
- LeaveCriticalSection( &csMenuHook );
- return MO_ProcessCommand( pimi, lParam );
+ PMO_IntMenuItem pimi = MO_RecursiveWalkMenu(g_menus[objidx]->m_items.first, FindMenuByCommand, (void*)command);
+ if (pimi) {
+ LeaveCriticalSection(&csMenuHook);
+ return MO_ProcessCommand(pimi, lParam);
}
- LeaveCriticalSection( &csMenuHook );
+ LeaveCriticalSection(&csMenuHook);
return -1;
}
INT_PTR MO_ProcessCommandByMenuIdent(WPARAM wParam, LPARAM lParam)
{
- if ( !bIsGenMenuInited )
+ if ( !bIsGenMenuInited)
return -1;
- EnterCriticalSection( &csMenuHook );
+ EnterCriticalSection(&csMenuHook);
- for ( int i=0; i < g_menus.getCount(); i++ ) {
- PMO_IntMenuItem pimi = MO_RecursiveWalkMenu( g_menus[i]->m_items.first, FindMenuByCommand, ( void* )wParam );
- if ( pimi ) {
- LeaveCriticalSection( &csMenuHook );
- return MO_ProcessCommand( pimi, lParam );
+ for (int i=0; i < g_menus.getCount(); i++) {
+ PMO_IntMenuItem pimi = MO_RecursiveWalkMenu(g_menus[i]->m_items.first, FindMenuByCommand, (void*)wParam);
+ if (pimi) {
+ LeaveCriticalSection(&csMenuHook);
+ return MO_ProcessCommand(pimi, lParam);
} }
- LeaveCriticalSection( &csMenuHook );
+ LeaveCriticalSection(&csMenuHook);
return FALSE;
}
-int MO_ProcessCommand( PMO_IntMenuItem aHandle, LPARAM lParam )
+int MO_ProcessCommand(PMO_IntMenuItem aHandle, LPARAM lParam)
{
- if ( !bIsGenMenuInited )
+ if ( !bIsGenMenuInited)
return -1;
- EnterCriticalSection( &csMenuHook );
- PMO_IntMenuItem pimi = MO_GetIntMenuItem( aHandle );
- if ( !pimi ) {
- LeaveCriticalSection( &csMenuHook );
+ EnterCriticalSection(&csMenuHook);
+ PMO_IntMenuItem pimi = MO_GetIntMenuItem(aHandle);
+ if ( !pimi) {
+ LeaveCriticalSection(&csMenuHook);
return -1;
}
char *srvname = pimi->parent->ExecService;
void *ownerdata = pimi->mi.ownerdata;
- LeaveCriticalSection( &csMenuHook );
- CallService( srvname, ( WPARAM )ownerdata, lParam );
+ LeaveCriticalSection(&csMenuHook);
+ CallService(srvname, (WPARAM)ownerdata, lParam);
return 1;
}
-int MO_SetOptionsMenuItem( PMO_IntMenuItem aHandle, int setting, INT_PTR value )
+int MO_SetOptionsMenuItem(PMO_IntMenuItem aHandle, int setting, INT_PTR value)
{
- if ( !bIsGenMenuInited )
+ if ( !bIsGenMenuInited)
return -1;
- EnterCriticalSection( &csMenuHook );
- PMO_IntMenuItem pimi = MO_GetIntMenuItem( aHandle );
- if ( !pimi ) {
- LeaveCriticalSection( &csMenuHook );
+ EnterCriticalSection(&csMenuHook);
+ PMO_IntMenuItem pimi = MO_GetIntMenuItem(aHandle);
+ if ( !pimi) {
+ LeaveCriticalSection(&csMenuHook);
return -1;
}
@@ -488,58 +488,58 @@ int MO_SetOptionsMenuItem( PMO_IntMenuItem aHandle, int setting, INT_PTR value ) __try
{
res = 1;
- if ( setting == OPT_MENUITEMSETUNIQNAME ) {
- mir_free( pimi->UniqName );
- pimi->UniqName = mir_strdup(( char* )value );
+ if (setting == OPT_MENUITEMSETUNIQNAME) {
+ mir_free(pimi->UniqName);
+ pimi->UniqName = mir_strdup((char*)value);
}
}
- __except( EXCEPTION_EXECUTE_HANDLER ) {}
+ __except(EXCEPTION_EXECUTE_HANDLER) {}
- LeaveCriticalSection( &csMenuHook );
+ LeaveCriticalSection(&csMenuHook);
return res;
}
-int MO_SetOptionsMenuObject( HANDLE handle, int setting, INT_PTR value )
+int MO_SetOptionsMenuObject(HANDLE handle, int setting, INT_PTR value)
{
int pimoidx;
int res = 0;
- if ( !bIsGenMenuInited )
+ if ( !bIsGenMenuInited)
return -1;
- EnterCriticalSection( &csMenuHook );
+ EnterCriticalSection(&csMenuHook);
__try
{
- pimoidx = GetMenuObjbyId((int)handle );
+ pimoidx = GetMenuObjbyId((int)handle);
res = pimoidx != -1;
- if ( res ) {
+ if (res) {
TIntMenuObject* pmo = g_menus[pimoidx];
- switch ( setting ) {
+ switch (setting) {
case OPT_MENUOBJECT_SET_ONADD_SERVICE:
- FreeAndNil(( void** )&pmo->onAddService );
- pmo->onAddService = mir_strdup(( char* )value );
+ FreeAndNil((void**)&pmo->onAddService);
+ pmo->onAddService = mir_strdup((char*)value);
break;
case OPT_MENUOBJECT_SET_FREE_SERVICE:
- FreeAndNil(( void** )&pmo->FreeService );
- pmo->FreeService = mir_strdup(( char* )value );
+ FreeAndNil((void**)&pmo->FreeService);
+ pmo->FreeService = mir_strdup((char*)value);
break;
case OPT_MENUOBJECT_SET_CHECK_SERVICE:
- FreeAndNil(( void** )&pmo->CheckService );
- pmo->CheckService = mir_strdup(( char* )value);
+ FreeAndNil((void**)&pmo->CheckService);
+ pmo->CheckService = mir_strdup((char*)value);
break;
case OPT_USERDEFINEDITEMS:
- pmo->m_bUseUserDefinedItems = ( BOOL )value;
+ pmo->m_bUseUserDefinedItems = (BOOL)value;
break;
}
}
}
- __except( EXCEPTION_EXECUTE_HANDLER ) {}
+ __except(EXCEPTION_EXECUTE_HANDLER) {}
- LeaveCriticalSection( &csMenuHook );
+ LeaveCriticalSection(&csMenuHook);
return res;
}
@@ -548,71 +548,71 @@ int MO_SetOptionsMenuObject( HANDLE handle, int setting, INT_PTR value ) //result=MenuObjectHandle
INT_PTR MO_CreateNewMenuObject(WPARAM, LPARAM lParam)
{
- PMenuParam pmp = ( PMenuParam )lParam;
- if ( !bIsGenMenuInited || pmp == NULL )
+ PMenuParam pmp = (PMenuParam)lParam;
+ if ( !bIsGenMenuInited || pmp == NULL)
return -1;
- EnterCriticalSection( &csMenuHook );
+ EnterCriticalSection(&csMenuHook);
TIntMenuObject* p = new TIntMenuObject();
p->id = NextObjectId++;
- p->Name = mir_strdup( pmp->name );
- p->CheckService = mir_strdup( pmp->CheckService );
- p->ExecService = mir_strdup( pmp->ExecService );
- p->m_hMenuIcons = ImageList_Create( GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON),
- (IsWinVerXPPlus() ? ILC_COLOR32 : ILC_COLOR16) | ILC_MASK, 15, 100 );
+ p->Name = mir_strdup(pmp->name);
+ p->CheckService = mir_strdup(pmp->CheckService);
+ p->ExecService = mir_strdup(pmp->ExecService);
+ p->m_hMenuIcons = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON),
+ (IsWinVerXPPlus() ? ILC_COLOR32 : ILC_COLOR16) | ILC_MASK, 15, 100);
g_menus.insert(p);
- LeaveCriticalSection( &csMenuHook );
+ LeaveCriticalSection(&csMenuHook);
return p->id;
}
//wparam=MenuItemHandle
//lparam=0
-static int FreeMenuItem( TMO_IntMenuItem* pimi, void* )
+static int FreeMenuItem(TMO_IntMenuItem* pimi, void*)
{
- pimi->parent->freeItem( pimi );
+ pimi->parent->freeItem(pimi);
return FALSE;
}
-static int FindParent( TMO_IntMenuItem* pimi, void* p )
+static int FindParent(TMO_IntMenuItem* pimi, void* p)
{
return pimi->next == p;
}
INT_PTR MO_RemoveMenuItem(WPARAM wParam, LPARAM)
{
- EnterCriticalSection( &csMenuHook );
- PMO_IntMenuItem pimi = MO_GetIntMenuItem(( HGENMENU )wParam );
- if ( !pimi ) {
- LeaveCriticalSection( &csMenuHook );
+ EnterCriticalSection(&csMenuHook);
+ PMO_IntMenuItem pimi = MO_GetIntMenuItem((HGENMENU)wParam);
+ if ( !pimi) {
+ LeaveCriticalSection(&csMenuHook);
return -1;
}
- if ( pimi->submenu.first ) {
- MO_RecursiveWalkMenu( pimi->submenu.first, FreeMenuItem, NULL );
+ if (pimi->submenu.first) {
+ MO_RecursiveWalkMenu(pimi->submenu.first, FreeMenuItem, NULL);
pimi->submenu.first = NULL;
}
- PMO_IntMenuItem prev = MO_RecursiveWalkMenu( pimi->owner->first, FindParent, pimi );
- if ( prev )
+ PMO_IntMenuItem prev = MO_RecursiveWalkMenu(pimi->owner->first, FindParent, pimi);
+ if (prev)
prev->next = pimi->next;
- if ( pimi->owner->first == pimi )
+ if (pimi->owner->first == pimi)
pimi->owner->first = pimi->next;
- if ( pimi->owner->last == pimi )
+ if (pimi->owner->last == pimi)
pimi->owner->last = prev;
pimi->signature = 0; // invalidate all future calls to that object
- pimi->parent->freeItem( pimi );
+ pimi->parent->freeItem(pimi);
- LeaveCriticalSection( &csMenuHook );
+ LeaveCriticalSection(&csMenuHook);
return 0;
}
///////////////////////////////////////////////////////////////////////////////
// we presume that this function is being called inside csMenuHook only
-static int PackMenuItems( PMO_IntMenuItem pimi, void* )
+static int PackMenuItems(PMO_IntMenuItem pimi, void*)
{
pimi->iCommand = NextObjectMenuItemId++;
return FALSE;
@@ -621,10 +621,10 @@ static int PackMenuItems( PMO_IntMenuItem pimi, void* ) static int GetNextObjectMenuItemId()
{
// if menu commands are exausted, pack the menu array
- if ( NextObjectMenuItemId >= CLISTMENUIDMAX ) {
+ if (NextObjectMenuItemId >= CLISTMENUIDMAX) {
NextObjectMenuItemId = CLISTMENUIDMIN;
- for ( int i=0; i < g_menus.getCount(); i++ )
- MO_RecursiveWalkMenu( g_menus[i]->m_items.first, PackMenuItems, NULL );
+ for (int i=0; i < g_menus.getCount(); i++)
+ MO_RecursiveWalkMenu(g_menus[i]->m_items.first, PackMenuItems, NULL);
}
return NextObjectMenuItemId++;
@@ -633,25 +633,25 @@ static int GetNextObjectMenuItemId() //wparam=MenuObjectHandle
//lparam=PMO_MenuItem
//return MenuItemHandle
-PMO_IntMenuItem MO_AddNewMenuItem( HANDLE menuobjecthandle, PMO_MenuItem pmi )
+PMO_IntMenuItem MO_AddNewMenuItem(HANDLE menuobjecthandle, PMO_MenuItem pmi)
{
- if ( !bIsGenMenuInited || pmi == NULL || pmi->cbSize != sizeof( TMO_MenuItem ))
+ if ( !bIsGenMenuInited || pmi == NULL || pmi->cbSize != sizeof(TMO_MenuItem))
return NULL;
//old mode
- if ( !( pmi->flags & CMIF_ROOTHANDLE ))
- return MO_AddOldNewMenuItem( menuobjecthandle, pmi );
+ if ( !(pmi->flags & CMIF_ROOTHANDLE))
+ return MO_AddOldNewMenuItem(menuobjecthandle, pmi);
- EnterCriticalSection( &csMenuHook );
- int objidx = GetMenuObjbyId((int)menuobjecthandle );
- if ( objidx == -1 ) {
- LeaveCriticalSection( &csMenuHook );
+ EnterCriticalSection(&csMenuHook);
+ int objidx = GetMenuObjbyId((int)menuobjecthandle);
+ if (objidx == -1) {
+ LeaveCriticalSection(&csMenuHook);
return NULL;
}
TIntMenuObject* pmo = g_menus[objidx];
- TMO_IntMenuItem* p = ( TMO_IntMenuItem* )mir_calloc( sizeof( TMO_IntMenuItem ));
+ TMO_IntMenuItem* p = (TMO_IntMenuItem*)mir_calloc(sizeof(TMO_IntMenuItem));
p->parent = pmo;
p->signature = MENUITEM_SIGNATURE;
p->iCommand = GetNextObjectMenuItemId();
@@ -660,89 +660,89 @@ PMO_IntMenuItem MO_AddNewMenuItem( HANDLE menuobjecthandle, PMO_MenuItem pmi ) p->OverrideShow = TRUE;
p->originalPosition = pmi->position;
- if ( pmi->flags & CMIF_UNICODE )
+ if (pmi->flags & CMIF_UNICODE)
p->mi.ptszName = mir_tstrdup(pmi->ptszName);
else
p->mi.ptszName = mir_a2u(pmi->pszName);
- if ( pmi->hIcon != NULL && !bIconsDisabled ) {
- if ( pmi->flags & CMIF_ICONFROMICOLIB ) {
- HICON hIcon = IcoLib_GetIconByHandle( pmi->hIcolibItem, false );
- p->iconId = ImageList_AddIcon( pmo->m_hMenuIcons, hIcon );
+ if (pmi->hIcon != NULL && !bIconsDisabled) {
+ if (pmi->flags & CMIF_ICONFROMICOLIB) {
+ HICON hIcon = IcoLib_GetIconByHandle(pmi->hIcolibItem, false);
+ p->iconId = ImageList_AddIcon(pmo->m_hMenuIcons, hIcon);
p->hIcolibItem = pmi->hIcolibItem;
- IconLib_ReleaseIcon( hIcon, 0 );
+ IconLib_ReleaseIcon(hIcon, 0);
}
else {
- HANDLE hIcolibItem = IcoLib_IsManaged( pmi->hIcon );
- if ( hIcolibItem ) {
- p->iconId = ImageList_AddIcon( pmo->m_hMenuIcons, pmi->hIcon );
+ HANDLE hIcolibItem = IcoLib_IsManaged(pmi->hIcon);
+ if (hIcolibItem) {
+ p->iconId = ImageList_AddIcon(pmo->m_hMenuIcons, pmi->hIcon);
p->hIcolibItem = hIcolibItem;
}
- else p->iconId = ImageList_AddIcon( pmo->m_hMenuIcons, pmi->hIcon );
+ else p->iconId = ImageList_AddIcon(pmo->m_hMenuIcons, pmi->hIcon);
} }
- if ( p->mi.root == HGENMENU_ROOT )
+ if (p->mi.root == HGENMENU_ROOT)
p->mi.root = NULL;
- PMO_IntMenuItem pRoot = ( p->mi.root != NULL ) ? MO_GetIntMenuItem( p->mi.root ) : NULL;
- if ( pRoot )
+ PMO_IntMenuItem pRoot = (p->mi.root != NULL) ? MO_GetIntMenuItem(p->mi.root) : NULL;
+ if (pRoot)
p->owner = &pRoot->submenu;
else
p->owner = &pmo->m_items;
- if ( !p->owner->first )
+ if ( !p->owner->first)
p->owner->first = p;
- if ( p->owner->last )
+ if (p->owner->last)
p->owner->last->next = p;
p->owner->last = p;
- LeaveCriticalSection( &csMenuHook );
+ LeaveCriticalSection(&csMenuHook);
return p;
}
//wparam=MenuObjectHandle
//lparam=PMO_MenuItem
-int FindRoot( PMO_IntMenuItem pimi, void* param )
+int FindRoot(PMO_IntMenuItem pimi, void* param)
{
- if ( pimi->mi.pszName != NULL )
- if ( pimi->submenu.first && !_tcscmp( pimi->mi.ptszName, ( TCHAR* )param ))
+ if (pimi->mi.pszName != NULL)
+ if (pimi->submenu.first && !_tcscmp(pimi->mi.ptszName, (TCHAR*)param))
return TRUE;
return FALSE;
}
-PMO_IntMenuItem MO_AddOldNewMenuItem( HANDLE menuobjecthandle, PMO_MenuItem pmi )
+PMO_IntMenuItem MO_AddOldNewMenuItem(HANDLE menuobjecthandle, PMO_MenuItem pmi)
{
- if ( !bIsGenMenuInited || pmi == NULL )
+ if ( !bIsGenMenuInited || pmi == NULL)
return NULL;
- int objidx = GetMenuObjbyId((int)menuobjecthandle );
- if ( objidx == -1 )
+ int objidx = GetMenuObjbyId((int)menuobjecthandle);
+ if (objidx == -1)
return NULL;
- if ( pmi->cbSize != sizeof( TMO_MenuItem ))
+ if (pmi->cbSize != sizeof(TMO_MenuItem))
return NULL;
- if ( pmi->flags & CMIF_ROOTHANDLE )
+ if (pmi->flags & CMIF_ROOTHANDLE)
return NULL;
//is item with popup or not
- if ( pmi->root == 0 ) {
+ if (pmi->root == 0) {
//yes, this without popup
pmi->root = NULL; //first level
}
else { // no, search for needed root and create it if need
TCHAR* tszRoot;
- if ( pmi->flags & CMIF_UNICODE )
- tszRoot = mir_tstrdup(( TCHAR* )pmi->root );
+ if (pmi->flags & CMIF_UNICODE)
+ tszRoot = mir_tstrdup((TCHAR*)pmi->root);
else
- tszRoot = mir_a2t(( char* )pmi->root );
+ tszRoot = mir_a2t((char*)pmi->root);
- PMO_IntMenuItem oldroot = MO_RecursiveWalkMenu( g_menus[objidx]->m_items.first, FindRoot, tszRoot );
- mir_free( tszRoot );
+ PMO_IntMenuItem oldroot = MO_RecursiveWalkMenu(g_menus[objidx]->m_items.first, FindRoot, tszRoot);
+ mir_free(tszRoot);
- if ( oldroot == NULL ) {
+ if (oldroot == NULL) {
//not found, creating root
TMO_MenuItem tmi = { 0 };
tmi = *pmi;
@@ -750,9 +750,9 @@ PMO_IntMenuItem MO_AddOldNewMenuItem( HANDLE menuobjecthandle, PMO_MenuItem pmi tmi.ownerdata = 0;
tmi.root = NULL;
//copy pszPopupName
- tmi.ptszName = ( TCHAR* )pmi->root;
- if (( oldroot = MO_AddNewMenuItem( menuobjecthandle, &tmi )) != NULL )
- MO_SetOptionsMenuItem( oldroot, OPT_MENUITEMSETUNIQNAME, (INT_PTR)pmi->root );
+ tmi.ptszName = (TCHAR*)pmi->root;
+ if ((oldroot = MO_AddNewMenuItem(menuobjecthandle, &tmi)) != NULL)
+ MO_SetOptionsMenuItem(oldroot, OPT_MENUITEMSETUNIQNAME, (INT_PTR)pmi->root);
}
pmi->root = oldroot;
@@ -760,20 +760,20 @@ PMO_IntMenuItem MO_AddOldNewMenuItem( HANDLE menuobjecthandle, PMO_MenuItem pmi }
pmi->flags |= CMIF_ROOTHANDLE;
//add popup(root allready exists)
- return MO_AddNewMenuItem( menuobjecthandle, pmi );
+ return MO_AddNewMenuItem(menuobjecthandle, pmi);
}
-static int WhereToPlace( HMENU hMenu, PMO_MenuItem mi )
+static int WhereToPlace(HMENU hMenu, PMO_MenuItem mi)
{
MENUITEMINFO mii = { 0 };
mii.cbSize = MENUITEMINFO_V4_SIZE;
mii.fMask = MIIM_SUBMENU | MIIM_DATA;
- for ( int i=GetMenuItemCount( hMenu )-1; i >= 0; i-- ) {
- GetMenuItemInfo( hMenu, i, TRUE, &mii );
- if ( mii.fType != MFT_SEPARATOR ) {
- PMO_IntMenuItem pimi = MO_GetIntMenuItem(( HGENMENU )mii.dwItemData);
- if ( pimi != NULL )
- if ( pimi->mi.position <= mi->position )
+ for (int i=GetMenuItemCount(hMenu)-1; i >= 0; i--) {
+ GetMenuItemInfo(hMenu, i, TRUE, &mii);
+ if (mii.fType != MFT_SEPARATOR) {
+ PMO_IntMenuItem pimi = MO_GetIntMenuItem((HGENMENU)mii.dwItemData);
+ if (pimi != NULL)
+ if (pimi->mi.position <= mi->position)
return i+1;
} }
@@ -797,7 +797,7 @@ static UINT GetMenuItemTypeData(HMENU hMenu, int uItem, PMO_IntMenuItem& p) mii.cbSize = MENUITEMINFO_V4_SIZE;
mii.fMask = MIIM_DATA | MIIM_TYPE;
GetMenuItemInfo(hMenu, uItem, TRUE, &mii);
- p = MO_GetIntMenuItem(( HGENMENU )mii.dwItemData );
+ p = MO_GetIntMenuItem((HGENMENU)mii.dwItemData);
return mii.fType;
}
@@ -807,30 +807,30 @@ static void InsertSeparator(HMENU hMenu, int uItem) mii.cbSize = MENUITEMINFO_V4_SIZE;
mii.fMask = MIIM_TYPE;
mii.fType = MFT_SEPARATOR;
- InsertMenuItem( hMenu, uItem, TRUE, &mii );
+ InsertMenuItem(hMenu, uItem, TRUE, &mii);
}
static void InsertMenuItemWithSeparators(HMENU hMenu, int uItem, MENUITEMINFO *lpmii)
{
- PMO_IntMenuItem pimi = MO_GetIntMenuItem(( HGENMENU )lpmii->dwItemData ), p;
+ PMO_IntMenuItem pimi = MO_GetIntMenuItem((HGENMENU)lpmii->dwItemData), p;
if (pimi == NULL)
return;
//check for separator before
if (uItem) {
- UINT fType = GetMenuItemTypeData( hMenu, uItem-1, p);
+ UINT fType = GetMenuItemTypeData(hMenu, uItem-1, p);
if (p != NULL && fType != MFT_SEPARATOR) {
if ((p->mi.position / SEPARATORPOSITIONINTERVAL) != (pimi->mi.position / SEPARATORPOSITIONINTERVAL)) {
//but might be supposed to be after the next one instead
- if ( uItem < GetMenuItemCount(hMenu) && GetMenuItemType(hMenu, uItem) != MFT_SEPARATOR)
+ if (uItem < GetMenuItemCount(hMenu) && GetMenuItemType(hMenu, uItem) != MFT_SEPARATOR)
InsertSeparator(hMenu, uItem);
uItem++;
} } }
//check for separator after
- if ( uItem < GetMenuItemCount( hMenu )) {
- UINT fType = GetMenuItemTypeData( hMenu, uItem, p);
+ if (uItem < GetMenuItemCount(hMenu)) {
+ UINT fType = GetMenuItemTypeData(hMenu, uItem, p);
if (p != NULL && fType != MFT_SEPARATOR)
if ((p->mi.position / SEPARATORPOSITIONINTERVAL) != (pimi->mi.position / SEPARATORPOSITIONINTERVAL))
InsertSeparator(hMenu, uItem);
@@ -840,8 +840,8 @@ static void InsertMenuItemWithSeparators(HMENU hMenu, int uItem, MENUITEMINFO *l MENUITEMINFO mii = *lpmii;
int count = GetMenuItemCount(hMenu);
- if (count != 0 && (count % 33) == 0 && pimi->mi.root != NULL ) {
- if ( !( mii.fMask & MIIM_FTYPE ))
+ if (count != 0 && (count % 33) == 0 && pimi->mi.root != NULL) {
+ if ( !(mii.fMask & MIIM_FTYPE))
mii.fType = 0;
mii.fMask |= MIIM_FTYPE;
mii.fType |= MFT_MENUBARBREAK;
@@ -849,7 +849,7 @@ static void InsertMenuItemWithSeparators(HMENU hMenu, int uItem, MENUITEMINFO *l mii.dwTypeData = GetMenuItemText(pimi);
- InsertMenuItem( hMenu, uItem, TRUE, &mii);
+ InsertMenuItem(hMenu, uItem, TRUE, &mii);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -859,24 +859,24 @@ static void InsertMenuItemWithSeparators(HMENU hMenu, int uItem, MENUITEMINFO *l INT_PTR MO_BuildMenu(WPARAM wParam, LPARAM lParam)
{
- if ( !bIsGenMenuInited )
+ if ( !bIsGenMenuInited)
return -1;
- EnterCriticalSection( &csMenuHook );
+ EnterCriticalSection(&csMenuHook);
- ListParam *lp = ( ListParam* )lParam;
- int pimoidx = GetMenuObjbyId((int)lp->MenuObjectHandle );
- if ( pimoidx == -1 ) {
- LeaveCriticalSection( &csMenuHook );
+ ListParam *lp = (ListParam*)lParam;
+ int pimoidx = GetMenuObjbyId((int)lp->MenuObjectHandle);
+ if (pimoidx == -1) {
+ LeaveCriticalSection(&csMenuHook);
return 0;
}
- #if defined( _DEBUG )
- // DumpMenuItem( g_menus[pimoidx]->m_items.first );
+ #if defined(_DEBUG)
+ // DumpMenuItem(g_menus[pimoidx]->m_items.first);
#endif
- INT_PTR res = (INT_PTR)BuildRecursiveMenu(( HMENU )wParam, g_menus[pimoidx]->m_items.first, ( ListParam* )lParam );
- LeaveCriticalSection( &csMenuHook );
+ INT_PTR res = (INT_PTR)BuildRecursiveMenu((HMENU)wParam, g_menus[pimoidx]->m_items.first, (ListParam*)lParam);
+ LeaveCriticalSection(&csMenuHook);
return res;
}
@@ -884,53 +884,53 @@ INT_PTR MO_BuildMenu(WPARAM wParam, LPARAM lParam) #define PUTPOSITIONSONMENU
#endif
-void GetMenuItemName( PMO_IntMenuItem pMenuItem, char* pszDest, size_t cbDestSize )
+void GetMenuItemName(PMO_IntMenuItem pMenuItem, char* pszDest, size_t cbDestSize)
{
- if ( pMenuItem->UniqName )
- mir_snprintf( pszDest, cbDestSize, "{%s}", pMenuItem->UniqName );
+ if (pMenuItem->UniqName)
+ mir_snprintf(pszDest, cbDestSize, "{%s}", pMenuItem->UniqName);
else if (pMenuItem->mi.flags & CMIF_UNICODE) {
- char* name = mir_t2a( pMenuItem->mi.ptszName );
- mir_snprintf( pszDest, cbDestSize, "{%s}", name );
+ char* name = mir_t2a(pMenuItem->mi.ptszName);
+ mir_snprintf(pszDest, cbDestSize, "{%s}", name);
mir_free(name);
}
else
- mir_snprintf( pszDest, cbDestSize, "{%s}", pMenuItem->mi.pszName );
+ mir_snprintf(pszDest, cbDestSize, "{%s}", pMenuItem->mi.pszName);
}
HMENU BuildRecursiveMenu(HMENU hMenu, PMO_IntMenuItem pRootMenu, ListParam *param)
{
- if ( param == NULL || pRootMenu == NULL )
+ if (param == NULL || pRootMenu == NULL)
return NULL;
TIntMenuObject* pmo = pRootMenu->parent;
- int rootlevel = ( param->rootlevel == -1 ) ? 0 : param->rootlevel;
+ int rootlevel = (param->rootlevel == -1) ? 0 : param->rootlevel;
ListParam localparam = *param;
- while ( rootlevel == 0 && GetMenuItemCount( hMenu ) > 0 )
- DeleteMenu( hMenu, 0, MF_BYPOSITION );
+ while (rootlevel == 0 && GetMenuItemCount(hMenu) > 0)
+ DeleteMenu(hMenu, 0, MF_BYPOSITION);
- for ( PMO_IntMenuItem pmi = pRootMenu; pmi != NULL; pmi = pmi->next ) {
+ for (PMO_IntMenuItem pmi = pRootMenu; pmi != NULL; pmi = pmi->next) {
PMO_MenuItem mi = &pmi->mi;
- if ( mi->cbSize != sizeof( TMO_MenuItem ))
+ if (mi->cbSize != sizeof(TMO_MenuItem))
continue;
- if ( mi->flags & CMIF_HIDDEN )
+ if (mi->flags & CMIF_HIDDEN)
continue;
- if ( pmo->CheckService != NULL ) {
+ if (pmo->CheckService != NULL) {
TCheckProcParam CheckParam;
CheckParam.lParam = param->lParam;
CheckParam.wParam = param->wParam;
CheckParam.MenuItemOwnerData = mi->ownerdata;
CheckParam.MenuItemHandle = pmi;
- if ( CallService( pmo->CheckService, ( WPARAM )&CheckParam, 0 ) == FALSE )
+ if (CallService(pmo->CheckService, (WPARAM)&CheckParam, 0) == FALSE)
continue;
}
/**************************************/
- if ( rootlevel == 0 && mi->root == NULL && pmo->m_bUseUserDefinedItems ) {
+ if (rootlevel == 0 && mi->root == NULL && pmo->m_bUseUserDefinedItems) {
char DBString[256];
DBVARIANT dbv = { 0 };
int pos;
@@ -938,33 +938,33 @@ HMENU BuildRecursiveMenu(HMENU hMenu, PMO_IntMenuItem pRootMenu, ListParam *para mir_snprintf(MenuNameItems, SIZEOF(MenuNameItems), "%s_Items", pmo->Name);
char menuItemName[256];
- GetMenuItemName( pmi, menuItemName, sizeof( menuItemName ));
+ GetMenuItemName(pmi, menuItemName, sizeof(menuItemName));
// check if it visible
- mir_snprintf( DBString, SIZEOF(DBString), "%s_visible", menuItemName );
- if ( DBGetContactSettingByte( NULL, MenuNameItems, DBString, -1 ) == -1 )
- DBWriteContactSettingByte( NULL, MenuNameItems, DBString, 1 );
+ mir_snprintf(DBString, SIZEOF(DBString), "%s_visible", menuItemName);
+ if (DBGetContactSettingByte(NULL, MenuNameItems, DBString, -1) == -1)
+ DBWriteContactSettingByte(NULL, MenuNameItems, DBString, 1);
pmi->OverrideShow = TRUE;
- if ( !DBGetContactSettingByte( NULL, MenuNameItems, DBString, 1 )) {
+ if ( !DBGetContactSettingByte(NULL, MenuNameItems, DBString, 1)) {
pmi->OverrideShow = FALSE;
continue; // find out what value to return if not getting added
}
// mi.pszName
- mir_snprintf( DBString, SIZEOF(DBString), "%s_name", menuItemName );
- if ( !DBGetContactSettingTString( NULL, MenuNameItems, DBString, &dbv )) {
- if ( _tcslen( dbv.ptszVal ) > 0 ) {
- if ( pmi->CustomName ) mir_free( pmi->CustomName );
- pmi->CustomName = mir_tstrdup( dbv.ptszVal );
+ mir_snprintf(DBString, SIZEOF(DBString), "%s_name", menuItemName);
+ if ( !DBGetContactSettingTString(NULL, MenuNameItems, DBString, &dbv)) {
+ if (_tcslen(dbv.ptszVal) > 0) {
+ if (pmi->CustomName) mir_free(pmi->CustomName);
+ pmi->CustomName = mir_tstrdup(dbv.ptszVal);
}
- DBFreeVariant( &dbv );
+ DBFreeVariant(&dbv);
}
- mir_snprintf( DBString, SIZEOF(DBString), "%s_pos", menuItemName );
- if (( pos = DBGetContactSettingDword( NULL, MenuNameItems, DBString, -1 )) == -1 ) {
- DBWriteContactSettingDword( NULL, MenuNameItems, DBString, mi->position );
- if ( pmi->submenu.first )
+ mir_snprintf(DBString, SIZEOF(DBString), "%s_pos", menuItemName);
+ if ((pos = DBGetContactSettingDword(NULL, MenuNameItems, DBString, -1)) == -1) {
+ DBWriteContactSettingDword(NULL, MenuNameItems, DBString, mi->position);
+ if (pmi->submenu.first)
mi->position = 0;
}
else mi->position = pos;
@@ -972,13 +972,13 @@ HMENU BuildRecursiveMenu(HMENU hMenu, PMO_IntMenuItem pRootMenu, ListParam *para /**************************************/
- if ( rootlevel != (int)pmi->mi.root )
+ if (rootlevel != (int)pmi->mi.root)
continue;
MENUITEMINFO mii = { 0 };
- mii.dwItemData = ( LPARAM )pmi;
+ mii.dwItemData = (LPARAM)pmi;
- int i = WhereToPlace( hMenu, mi );
+ int i = WhereToPlace(hMenu, mi);
if ( !IsWinVer98Plus()) {
mii.cbSize = MENUITEMINFO_V4_SIZE;
@@ -986,9 +986,9 @@ HMENU BuildRecursiveMenu(HMENU hMenu, PMO_IntMenuItem pRootMenu, ListParam *para mii.fType = MFT_STRING;
}
else {
- mii.cbSize = sizeof( mii );
+ mii.cbSize = sizeof(mii);
mii.fMask = MIIM_DATA | MIIM_ID | MIIM_STRING;
- if ( pmi->iconId != -1 ) {
+ if (pmi->iconId != -1) {
mii.fMask |= MIIM_BITMAP;
if (IsWinVerVistaPlus() && isThemeActive()) {
if (pmi->hBmp == NULL)
@@ -1000,46 +1000,46 @@ HMENU BuildRecursiveMenu(HMENU hMenu, PMO_IntMenuItem pRootMenu, ListParam *para }
mii.fMask |= MIIM_STATE;
- mii.fState = (( pmi->mi.flags & CMIF_GRAYED ) ? MFS_GRAYED : MFS_ENABLED );
- mii.fState |= (( pmi->mi.flags & CMIF_CHECKED) ? MFS_CHECKED : MFS_UNCHECKED );
- if ( pmi->mi.flags & CMIF_DEFAULT )
+ mii.fState = ((pmi->mi.flags & CMIF_GRAYED) ? MFS_GRAYED : MFS_ENABLED);
+ mii.fState |= ((pmi->mi.flags & CMIF_CHECKED) ? MFS_CHECKED : MFS_UNCHECKED);
+ if (pmi->mi.flags & CMIF_DEFAULT)
mii.fState |= MFS_DEFAULT;
- mii.dwTypeData = ( pmi->CustomName ) ? pmi->CustomName : mi->ptszName;
+ mii.dwTypeData = (pmi->CustomName) ? pmi->CustomName : mi->ptszName;
// it's a submenu
- if ( pmi->submenu.first ) {
+ if (pmi->submenu.first) {
mii.fMask |= MIIM_SUBMENU;
mii.hSubMenu = CreatePopupMenu();
#ifdef PUTPOSITIONSONMENU
- if ( GetKeyState(VK_CONTROL) & 0x8000) {
+ 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
InsertMenuItemWithSeparators(hMenu, i, &mii);
- localparam.rootlevel = LPARAM( pmi );
+ localparam.rootlevel = LPARAM(pmi);
BuildRecursiveMenu(mii.hSubMenu, pmi->submenu.first, &localparam);
}
else {
mii.wID = pmi->iCommand;
#ifdef PUTPOSITIONSONMENU
- if ( GetKeyState(VK_CONTROL) & 0x8000) {
+ 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
- if ( pmo->onAddService != NULL )
- if ( CallService( pmo->onAddService, ( WPARAM )&mii, ( LPARAM )pmi ) == FALSE )
+ if (pmo->onAddService != NULL)
+ if (CallService(pmo->onAddService, (WPARAM)&mii, (LPARAM)pmi) == FALSE)
continue;
- InsertMenuItemWithSeparators( hMenu, i, &mii );
+ InsertMenuItemWithSeparators(hMenu, i, &mii);
} }
return hMenu;
@@ -1048,12 +1048,12 @@ HMENU BuildRecursiveMenu(HMENU hMenu, PMO_IntMenuItem pRootMenu, ListParam *para /////////////////////////////////////////////////////////////////////////////////////////
// iconlib in menu
-static int MO_ReloadIcon( PMO_IntMenuItem pmi, void* )
+static int MO_ReloadIcon(PMO_IntMenuItem pmi, void*)
{
- if ( pmi->hIcolibItem ) {
- HICON newIcon = IcoLib_GetIconByHandle( pmi->hIcolibItem, false );
- if ( newIcon )
- ImageList_ReplaceIcon( pmi->parent->m_hMenuIcons, pmi->iconId, newIcon );
+ if (pmi->hIcolibItem) {
+ HICON newIcon = IcoLib_GetIconByHandle(pmi->hIcolibItem, false);
+ if (newIcon)
+ ImageList_ReplaceIcon(pmi->parent->m_hMenuIcons, pmi->iconId, newIcon);
IconLib_ReleaseIcon(newIcon, 0);
}
@@ -1063,12 +1063,12 @@ static int MO_ReloadIcon( PMO_IntMenuItem pmi, void* ) int OnIconLibChanges(WPARAM, LPARAM)
{
- EnterCriticalSection( &csMenuHook );
- for ( int mo=0; mo < g_menus.getCount(); mo++ )
- if ((int)hStatusMenuObject != g_menus[mo]->id ) //skip status menu
- MO_RecursiveWalkMenu( g_menus[mo]->m_items.first, MO_ReloadIcon, 0 );
+ EnterCriticalSection(&csMenuHook);
+ for (int mo=0; mo < g_menus.getCount(); mo++)
+ if ((int)hStatusMenuObject != g_menus[mo]->id) //skip status menu
+ MO_RecursiveWalkMenu(g_menus[mo]->m_items.first, MO_ReloadIcon, 0);
- LeaveCriticalSection( &csMenuHook );
+ LeaveCriticalSection(&csMenuHook);
cli.pfnReloadProtoMenus();
return 0;
@@ -1077,28 +1077,28 @@ int OnIconLibChanges(WPARAM, LPARAM) /////////////////////////////////////////////////////////////////////////////////////////
//
-static int MO_RegisterIcon( PMO_IntMenuItem pmi, void* )
+static int MO_RegisterIcon(PMO_IntMenuItem pmi, void*)
{
char *uname, *descr;
uname = pmi->UniqName;
- if ( uname == NULL )
+ if (uname == NULL)
uname = mir_u2a(pmi->CustomName);
descr = mir_u2a(pmi->mi.ptszName);
- if ( !uname && !descr )
+ if ( !uname && !descr)
return FALSE;
- if ( !pmi->hIcolibItem ) {
- HICON hIcon = ImageList_GetIcon( pmi->parent->m_hMenuIcons, pmi->iconId, 0 );
- char* buf = NEWSTR_ALLOCA( descr );
+ if ( !pmi->hIcolibItem) {
+ HICON hIcon = ImageList_GetIcon(pmi->parent->m_hMenuIcons, pmi->iconId, 0);
+ char* buf = NEWSTR_ALLOCA(descr);
char sectionName[256], iconame[256];
- mir_snprintf( sectionName, sizeof(sectionName), "Menu Icons/%s", pmi->parent->Name );
+ mir_snprintf(sectionName, sizeof(sectionName), "Menu Icons/%s", pmi->parent->Name);
// remove '&'
char* start = buf;
- while ( start ) {
- if (( start = strchr( start, '&' )) == NULL )
+ while (start) {
+ if ((start = strchr(start, '&')) == NULL)
break;
memmove(start, start+1, strlen(start+1)+1);
@@ -1117,18 +1117,18 @@ static int MO_RegisterIcon( PMO_IntMenuItem pmi, void* ) sid.pszDefaultFile = NULL;
sid.pszDescription = buf;
sid.hDefaultIcon = hIcon;
- pmi->hIcolibItem = ( HANDLE )CallService(MS_SKIN2_ADDICON, 0, (LPARAM)&sid);
+ pmi->hIcolibItem = (HANDLE)CallService(MS_SKIN2_ADDICON, 0, (LPARAM)&sid);
- Safe_DestroyIcon( hIcon );
- if ( hIcon = ( HICON )CallService( MS_SKIN2_GETICON, 0, (LPARAM)iconame )) {
- ImageList_ReplaceIcon( pmi->parent->m_hMenuIcons, pmi->iconId, hIcon );
- IconLib_ReleaseIcon( hIcon, 0 );
+ Safe_DestroyIcon(hIcon);
+ if (hIcon = (HICON)CallService(MS_SKIN2_GETICON, 0, (LPARAM)iconame)) {
+ ImageList_ReplaceIcon(pmi->parent->m_hMenuIcons, pmi->iconId, hIcon);
+ IconLib_ReleaseIcon(hIcon, 0);
} }
- if ( !pmi->UniqName )
- mir_free( uname );
- mir_free( descr );
+ if ( !pmi->UniqName)
+ mir_free(uname);
+ mir_free(descr);
return FALSE;
@@ -1137,25 +1137,25 @@ static int MO_RegisterIcon( PMO_IntMenuItem pmi, void* ) int RegisterAllIconsInIconLib()
{
//register all icons
- for ( int mo=0; mo < g_menus.getCount(); mo++ ) {
- if ((int)hStatusMenuObject == g_menus[mo]->id ) //skip status menu
+ for (int mo=0; mo < g_menus.getCount(); mo++) {
+ if ((int)hStatusMenuObject == g_menus[mo]->id) //skip status menu
continue;
- MO_RecursiveWalkMenu( g_menus[mo]->m_items.first, MO_RegisterIcon, 0 );
+ MO_RecursiveWalkMenu(g_menus[mo]->m_items.first, MO_RegisterIcon, 0);
}
return 0;
}
-int TryProcessDoubleClick( HANDLE hContact )
+int TryProcessDoubleClick(HANDLE hContact)
{
- int iMenuID = GetMenuObjbyId((int)hContactMenuObject );
- if ( iMenuID != -1 ) {
+ int iMenuID = GetMenuObjbyId((int)hContactMenuObject);
+ if (iMenuID != -1) {
NotifyEventHooks(hPreBuildContactMenuEvent, (WPARAM)hContact, 0);
- PMO_IntMenuItem pimi = ( PMO_IntMenuItem )MO_GetDefaultMenuItem(( WPARAM )g_menus[ iMenuID ]->m_items.first, 0 );
- if ( pimi != NULL ) {
- MO_ProcessCommand( pimi, ( LPARAM )hContact );
+ PMO_IntMenuItem pimi = (PMO_IntMenuItem)MO_GetDefaultMenuItem((WPARAM)g_menus[ iMenuID ]->m_items.first, 0);
+ if (pimi != NULL) {
+ MO_ProcessCommand(pimi, (LPARAM)hContact);
return 0;
} }
@@ -1167,77 +1167,77 @@ int TryProcessDoubleClick( HANDLE hContact ) int posttimerid;
-static VOID CALLBACK PostRegisterIcons( HWND, UINT, UINT_PTR, DWORD )
+static VOID CALLBACK PostRegisterIcons(HWND, UINT, UINT_PTR, DWORD)
{
- KillTimer( 0, posttimerid );
+ KillTimer(0, posttimerid);
RegisterAllIconsInIconLib();
}
static int OnModulesLoaded(WPARAM, LPARAM)
{
- posttimerid = SetTimer(( HWND )NULL, 0, 5, ( TIMERPROC )PostRegisterIcons );
+ posttimerid = SetTimer((HWND)NULL, 0, 5, (TIMERPROC)PostRegisterIcons);
HookEvent(ME_SKIN2_ICONSCHANGED, OnIconLibChanges);
return 0;
}
-static INT_PTR SRVMO_SetOptionsMenuObject( WPARAM, LPARAM lParam)
+static INT_PTR SRVMO_SetOptionsMenuObject(WPARAM, LPARAM lParam)
{
- lpOptParam lpop = ( lpOptParam )lParam;
- if ( lpop == NULL )
+ lpOptParam lpop = (lpOptParam)lParam;
+ if (lpop == NULL)
return 0;
- return MO_SetOptionsMenuObject( lpop->Handle, lpop->Setting, lpop->Value );
+ return MO_SetOptionsMenuObject(lpop->Handle, lpop->Setting, lpop->Value);
}
-static INT_PTR SRVMO_SetOptionsMenuItem( WPARAM, LPARAM lParam)
+static INT_PTR SRVMO_SetOptionsMenuItem(WPARAM, LPARAM lParam)
{
- lpOptParam lpop = ( lpOptParam )lParam;
- if ( lpop == NULL )
+ lpOptParam lpop = (lpOptParam)lParam;
+ if (lpop == NULL)
return 0;
- return MO_SetOptionsMenuItem(( PMO_IntMenuItem )lpop->Handle, lpop->Setting, lpop->Value );
+ return MO_SetOptionsMenuItem((PMO_IntMenuItem)lpop->Handle, lpop->Setting, lpop->Value);
}
int InitGenMenu()
{
- InitializeCriticalSection( &csMenuHook );
- CreateServiceFunction( MO_BUILDMENU, MO_BuildMenu );
-
- CreateServiceFunction( MO_PROCESSCOMMAND, ( MIRANDASERVICE )MO_ProcessCommand );
- CreateServiceFunction( MO_CREATENEWMENUOBJECT, MO_CreateNewMenuObject );
- CreateServiceFunction( MO_REMOVEMENUITEM, MO_RemoveMenuItem );
- CreateServiceFunction( MO_ADDNEWMENUITEM, ( MIRANDASERVICE )MO_AddNewMenuItem );
- CreateServiceFunction( MO_MENUITEMGETOWNERDATA, MO_MenuItemGetOwnerData );
- CreateServiceFunction( MO_MODIFYMENUITEM, ( MIRANDASERVICE )MO_ModifyMenuItem );
- CreateServiceFunction( MO_GETMENUITEM, MO_GetMenuItem );
- CreateServiceFunction( MO_GETDEFAULTMENUITEM, MO_GetDefaultMenuItem );
- CreateServiceFunction( MO_PROCESSCOMMANDBYMENUIDENT, MO_ProcessCommandByMenuIdent );
- CreateServiceFunction( MO_PROCESSHOTKEYS, ( MIRANDASERVICE )MO_ProcessHotKeys );
- CreateServiceFunction( MO_REMOVEMENUOBJECT, MO_RemoveMenuObject );
- CreateServiceFunction( MO_GETPROTOROOTMENU, MO_GetProtoRootMenu );
-
- CreateServiceFunction( MO_SETOPTIONSMENUOBJECT, SRVMO_SetOptionsMenuObject );
- CreateServiceFunction( MO_SETOPTIONSMENUITEM, SRVMO_SetOptionsMenuItem );
+ InitializeCriticalSection(&csMenuHook);
+ CreateServiceFunction(MO_BUILDMENU, MO_BuildMenu);
+
+ CreateServiceFunction(MO_PROCESSCOMMAND, (MIRANDASERVICE)MO_ProcessCommand);
+ CreateServiceFunction(MO_CREATENEWMENUOBJECT, MO_CreateNewMenuObject);
+ CreateServiceFunction(MO_REMOVEMENUITEM, MO_RemoveMenuItem);
+ CreateServiceFunction(MO_ADDNEWMENUITEM, (MIRANDASERVICE)MO_AddNewMenuItem);
+ CreateServiceFunction(MO_MENUITEMGETOWNERDATA, MO_MenuItemGetOwnerData);
+ CreateServiceFunction(MO_MODIFYMENUITEM, (MIRANDASERVICE)MO_ModifyMenuItem);
+ CreateServiceFunction(MO_GETMENUITEM, MO_GetMenuItem);
+ CreateServiceFunction(MO_GETDEFAULTMENUITEM, MO_GetDefaultMenuItem);
+ CreateServiceFunction(MO_PROCESSCOMMANDBYMENUIDENT, MO_ProcessCommandByMenuIdent);
+ CreateServiceFunction(MO_PROCESSHOTKEYS, (MIRANDASERVICE)MO_ProcessHotKeys);
+ CreateServiceFunction(MO_REMOVEMENUOBJECT, MO_RemoveMenuObject);
+ CreateServiceFunction(MO_GETPROTOROOTMENU, MO_GetProtoRootMenu);
+
+ CreateServiceFunction(MO_SETOPTIONSMENUOBJECT, SRVMO_SetOptionsMenuObject);
+ CreateServiceFunction(MO_SETOPTIONSMENUITEM, SRVMO_SetOptionsMenuItem);
bIconsDisabled = DBGetContactSettingByte(NULL, "CList", "DisableMenuIcons", 0) != 0;
- EnterCriticalSection( &csMenuHook );
+ EnterCriticalSection(&csMenuHook);
bIsGenMenuInited = true;
- LeaveCriticalSection( &csMenuHook );
+ LeaveCriticalSection(&csMenuHook);
- HookEvent( ME_SYSTEM_MODULESLOADED, OnModulesLoaded );
- HookEvent( ME_OPT_INITIALISE, GenMenuOptInit );
+ HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
+ HookEvent(ME_OPT_INITIALISE, GenMenuOptInit);
return 0;
}
int UnitGenMenu()
{
- if ( bIsGenMenuInited ) {
- EnterCriticalSection( &csMenuHook );
+ if (bIsGenMenuInited) {
+ EnterCriticalSection(&csMenuHook);
MO_RemoveAllObjects();
bIsGenMenuInited=false;
- LeaveCriticalSection( &csMenuHook );
+ LeaveCriticalSection(&csMenuHook);
DeleteCriticalSection(&csMenuHook);
}
return 0;
@@ -1251,25 +1251,25 @@ TIntMenuObject::TIntMenuObject() TIntMenuObject::~TIntMenuObject()
{
- MO_RecursiveWalkMenu( m_items.first, FreeMenuItem, NULL );
+ MO_RecursiveWalkMenu(m_items.first, FreeMenuItem, NULL);
- FreeAndNil(( void** )&FreeService );
- FreeAndNil(( void** )&onAddService );
- FreeAndNil(( void** )&CheckService );
- FreeAndNil(( void** )&ExecService );
- FreeAndNil(( void** )&Name );
+ FreeAndNil((void**)&FreeService);
+ FreeAndNil((void**)&onAddService);
+ FreeAndNil((void**)&CheckService);
+ FreeAndNil((void**)&ExecService);
+ FreeAndNil((void**)&Name);
ImageList_Destroy(m_hMenuIcons);
}
-void TIntMenuObject::freeItem( TMO_IntMenuItem* p )
+void TIntMenuObject::freeItem(TMO_IntMenuItem* p)
{
- if ( FreeService )
- CallService( FreeService, ( WPARAM )p, ( LPARAM )p->mi.ownerdata );
-
- FreeAndNil(( void** )&p->mi.pszName );
- FreeAndNil(( void** )&p->UniqName );
- FreeAndNil(( void** )&p->CustomName );
- if ( p->hBmp ) DeleteObject( p->hBmp );
- mir_free( p );
+ if (FreeService)
+ CallService(FreeService, (WPARAM)p, (LPARAM)p->mi.ownerdata);
+
+ FreeAndNil((void**)&p->mi.pszName);
+ FreeAndNil((void**)&p->UniqName);
+ FreeAndNil((void**)&p->CustomName);
+ if (p->hBmp) DeleteObject(p->hBmp);
+ mir_free(p);
}
diff --git a/src/modules/clist/genmenu.h b/src/modules/clist/genmenu.h index b67ca92e39..aa924656e0 100644 --- a/src/modules/clist/genmenu.h +++ b/src/modules/clist/genmenu.h @@ -62,11 +62,11 @@ struct TIntMenuObject TIntMenuObject();
~TIntMenuObject();
- __inline void* operator new( size_t size )
- { return mir_calloc( size );
+ __inline void* operator new(size_t size)
+ { return mir_calloc(size);
}
- __inline void operator delete( void* p )
- { mir_free( p );
+ __inline void operator delete(void* p)
+ { mir_free(p);
}
char* Name;
@@ -95,7 +95,7 @@ struct TIntMenuObject HIMAGELIST m_hMenuIcons;
BOOL m_bUseUserDefinedItems;
- void freeItem( TMO_IntMenuItem* );
+ void freeItem(TMO_IntMenuItem*);
};
extern LIST<TIntMenuObject> g_menus;
@@ -104,35 +104,35 @@ extern LIST<TIntMenuObject> g_menus; //internal usage
HMENU BuildRecursiveMenu(HMENU hMenu, PMO_IntMenuItem, ListParam *param);
-void GetMenuItemName( PMO_IntMenuItem pMenuItem, char* pszDest, size_t cbDestSize );
+void GetMenuItemName(PMO_IntMenuItem pMenuItem, char* pszDest, size_t cbDestSize);
-PMO_IntMenuItem MO_GetIntMenuItem( HGENMENU );
+PMO_IntMenuItem MO_GetIntMenuItem(HGENMENU);
-PMO_IntMenuItem MO_AddNewMenuItem( HANDLE menuobjecthandle, PMO_MenuItem pmi );
-PMO_IntMenuItem MO_AddOldNewMenuItem( HANDLE menuobjecthandle, PMO_MenuItem pmi );
+PMO_IntMenuItem MO_AddNewMenuItem(HANDLE menuobjecthandle, PMO_MenuItem pmi);
+PMO_IntMenuItem MO_AddOldNewMenuItem(HANDLE menuobjecthandle, PMO_MenuItem pmi);
-int MO_DrawMenuItem( LPDRAWITEMSTRUCT dis );
-int MO_MeasureMenuItem( LPMEASUREITEMSTRUCT mis );
-int MO_ModifyMenuItem( PMO_IntMenuItem menuHandle, PMO_MenuItem pmiparam );
-int MO_ProcessCommand( PMO_IntMenuItem pimi, LPARAM lParam );
-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 MO_DrawMenuItem(LPDRAWITEMSTRUCT dis);
+int MO_MeasureMenuItem(LPMEASUREITEMSTRUCT mis);
+int MO_ModifyMenuItem(PMO_IntMenuItem menuHandle, PMO_MenuItem pmiparam);
+int MO_ProcessCommand(PMO_IntMenuItem pimi, LPARAM lParam);
+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 MO_ProcessCommandBySubMenuIdent(int menuID, int command, LPARAM lParam);
// function returns TRUE if the walk should be immediately stopped
-typedef int ( *pfnWalkFunc )( PMO_IntMenuItem, void* );
+typedef int (*pfnWalkFunc)(PMO_IntMenuItem, void*);
// returns the item, on which pfnWalkFunc returned TRUE
-PMO_IntMenuItem MO_RecursiveWalkMenu( PMO_IntMenuItem, pfnWalkFunc, void* );
+PMO_IntMenuItem MO_RecursiveWalkMenu(PMO_IntMenuItem, pfnWalkFunc, void*);
//general stuff
int InitGenMenu();
int UnitGenMenu();
-int FindRoot( PMO_IntMenuItem pimi, void* param );
+int FindRoot(PMO_IntMenuItem pimi, void* param);
TMO_IntMenuItem * GetMenuItemByGlobalID(int globalMenuID);
BOOL FindMenuHanleByGlobalID(HMENU hMenu, int globalID, struct _MenuItemHandles * dat); //GenMenu.c
diff --git a/src/modules/clist/genmenuopt.cpp b/src/modules/clist/genmenuopt.cpp index ed58a53145..e16fd49d18 100644 --- a/src/modules/clist/genmenuopt.cpp +++ b/src/modules/clist/genmenuopt.cpp @@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. extern bool bIconsDisabled;
extern int DefaultImageListColorDepth;
long handleCustomDraw(HWND hWndTreeView, LPNMTVCUSTOMDRAW pNMTVCD);
-void RebuildProtoMenus( int );
+void RebuildProtoMenus(int);
struct OrderData
{
@@ -57,7 +57,7 @@ static BOOL GetCurrentMenuObjectID(HWND hwndDlg, int* result) TVITEM tvi;
HWND hTree = GetDlgItem(hwndDlg, IDC_MENUOBJECTS);
HTREEITEM hti = TreeView_GetSelection(hTree);
- if ( hti == NULL )
+ if (hti == NULL)
return FALSE;
tvi.mask = TVIF_HANDLE | TVIF_PARAM;
@@ -77,51 +77,51 @@ static int SaveTree(HWND hwndDlg) int MenuObjectId, runtimepos;
TIntMenuObject* pimo;
MenuItemOptData* iod;
- HWND hTree = GetDlgItem( hwndDlg, IDC_MENUITEMS );
+ HWND hTree = GetDlgItem(hwndDlg, IDC_MENUITEMS);
- if ( !GetCurrentMenuObjectID( hwndDlg, &MenuObjectId ))
+ if ( !GetCurrentMenuObjectID(hwndDlg, &MenuObjectId))
return 0;
- tvi.hItem = TreeView_GetRoot( hTree );
+ tvi.hItem = TreeView_GetRoot(hTree);
tvi.cchTextMax = 99;
tvi.mask = TVIF_TEXT | TVIF_PARAM | TVIF_HANDLE;
tvi.pszText = idstr;
count = 0;
- menupos = GetMenuObjbyId( MenuObjectId );
- if ( menupos == -1 )
+ menupos = GetMenuObjbyId(MenuObjectId);
+ if (menupos == -1)
return -1;
pimo = g_menus[menupos];
- mir_snprintf( MenuNameItems, sizeof(MenuNameItems), "%s_Items", pimo->Name);
+ mir_snprintf(MenuNameItems, sizeof(MenuNameItems), "%s_Items", pimo->Name);
runtimepos = 100;
- while ( tvi.hItem != NULL ) {
- TreeView_GetItem( hTree, &tvi );
- iod = ( MenuItemOptData* )tvi.lParam;
- if ( iod->pimi ) {
- GetMenuItemName( iod->pimi, menuItemName, sizeof( menuItemName ));
+ while (tvi.hItem != NULL) {
+ TreeView_GetItem(hTree, &tvi);
+ iod = (MenuItemOptData*)tvi.lParam;
+ if (iod->pimi) {
+ GetMenuItemName(iod->pimi, menuItemName, sizeof(menuItemName));
- mir_snprintf( DBString, SIZEOF(DBString), "%s_visible", menuItemName );
- DBWriteContactSettingByte( NULL, MenuNameItems, DBString, iod->show );
+ mir_snprintf(DBString, SIZEOF(DBString), "%s_visible", menuItemName);
+ DBWriteContactSettingByte(NULL, MenuNameItems, DBString, iod->show);
- mir_snprintf( DBString, SIZEOF(DBString), "%s_pos", menuItemName );
- DBWriteContactSettingDword( NULL, MenuNameItems, DBString, runtimepos );
+ mir_snprintf(DBString, SIZEOF(DBString), "%s_pos", menuItemName);
+ DBWriteContactSettingDword(NULL, MenuNameItems, DBString, runtimepos);
- mir_snprintf( DBString, SIZEOF(DBString), "%s_name", menuItemName );
- if ( lstrcmp( iod->name, iod->defname ) != 0 )
- DBWriteContactSettingTString( NULL, MenuNameItems, DBString, iod->name );
+ mir_snprintf(DBString, SIZEOF(DBString), "%s_name", menuItemName);
+ if (lstrcmp(iod->name, iod->defname) != 0)
+ DBWriteContactSettingTString(NULL, MenuNameItems, DBString, iod->name);
else
- DBDeleteContactSetting( NULL, MenuNameItems, DBString );
+ DBDeleteContactSetting(NULL, MenuNameItems, DBString);
runtimepos += 100;
}
- if ( iod->name && !_tcscmp( iod->name, STR_SEPARATOR) && iod->show )
+ if (iod->name && !_tcscmp(iod->name, STR_SEPARATOR) && iod->show)
runtimepos += SEPARATORPOSITIONINTERVAL;
- tvi.hItem = TreeView_GetNextSibling( hTree, tvi.hItem );
+ tvi.hItem = TreeView_GetNextSibling(hTree, tvi.hItem);
count++;
}
return 1;
@@ -136,19 +136,19 @@ static int BuildMenuObjectsTree(HWND hwndDlg) tvis.hParent = NULL;
tvis.hInsertAfter = TVI_LAST;
tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
- TreeView_DeleteAllItems( hTree );
- if ( g_menus.getCount() == 0 )
+ TreeView_DeleteAllItems(hTree);
+ if (g_menus.getCount() == 0)
return FALSE;
- for ( i=0; i < g_menus.getCount(); i++ ) {
- if ( g_menus[i]->id == (int)hStatusMenuObject || !g_menus[i]->m_bUseUserDefinedItems )
+ for (i=0; i < g_menus.getCount(); i++) {
+ if (g_menus[i]->id == (int)hStatusMenuObject || !g_menus[i]->m_bUseUserDefinedItems)
continue;
- tvis.item.lParam = ( LPARAM )g_menus[i]->id;
- tvis.item.pszText = LangPackPcharToTchar( g_menus[i]->Name );
+ tvis.item.lParam = (LPARAM)g_menus[i]->id;
+ tvis.item.pszText = LangPackPcharToTchar(g_menus[i]->Name);
tvis.item.iImage = tvis.item.iSelectedImage = TRUE;
- TreeView_InsertItem( hTree, &tvis );
- mir_free( tvis.item.pszText );
+ TreeView_InsertItem(hTree, &tvis);
+ mir_free(tvis.item.pszText);
}
return 1;
}
@@ -173,21 +173,21 @@ static int InsertSeparator(HWND hwndDlg) TVINSERTSTRUCT tvis = {0};
TVITEM tvi = {0};
HTREEITEM hti = {0};
- HWND hMenuTree = GetDlgItem( hwndDlg, IDC_MENUITEMS );
+ HWND hMenuTree = GetDlgItem(hwndDlg, IDC_MENUITEMS);
- hti = TreeView_GetSelection( hMenuTree );
- if ( hti == NULL )
+ hti = TreeView_GetSelection(hMenuTree);
+ if (hti == NULL)
return 1;
tvi.mask = TVIF_HANDLE | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM | TVIF_TEXT;
tvi.hItem = hti;
- if ( TreeView_GetItem( hMenuTree, &tvi) == FALSE )
+ if (TreeView_GetItem(hMenuTree, &tvi) == FALSE)
return 1;
- PD = ( MenuItemOptData* )mir_alloc( sizeof( MenuItemOptData ));
- ZeroMemory( PD, sizeof( MenuItemOptData ));
+ PD = (MenuItemOptData*)mir_alloc(sizeof(MenuItemOptData));
+ ZeroMemory(PD, sizeof(MenuItemOptData));
PD->id = -1;
- PD->name = mir_tstrdup( STR_SEPARATOR );
+ PD->name = mir_tstrdup(STR_SEPARATOR);
PD->show = TRUE;
PD->pos = ((MenuItemOptData *)tvi.lParam)->pos-1;
@@ -197,23 +197,23 @@ static int InsertSeparator(HWND hwndDlg) tvis.hParent = NULL;
tvis.hInsertAfter = hti;
tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
- TreeView_InsertItem( hMenuTree, &tvis );
+ TreeView_InsertItem(hMenuTree, &tvis);
return 1;
}
-static void FreeTreeData( HWND hwndDlg )
+static void FreeTreeData(HWND hwndDlg)
{
HTREEITEM hItem = TreeView_GetRoot(GetDlgItem(hwndDlg, IDC_MENUITEMS));
- while ( hItem != NULL ) {
+ while (hItem != NULL) {
TVITEM tvi;
tvi.mask = TVIF_HANDLE | TVIF_PARAM;
tvi.hItem = hItem;
- TreeView_GetItem( GetDlgItem( hwndDlg, IDC_MENUITEMS ), &tvi );
+ TreeView_GetItem(GetDlgItem(hwndDlg, IDC_MENUITEMS), &tvi);
{ MenuItemOptData* O = (MenuItemOptData *)tvi.lParam;
- if ( O->name ) mir_free( O->name );
- if ( O->defname ) mir_free( O->defname );
- if ( O->uniqname ) mir_free( O->uniqname );
- mir_free( O );
+ if (O->name) mir_free(O->name);
+ if (O->defname) mir_free(O->defname);
+ if (O->uniqname) mir_free(O->uniqname);
+ mir_free(O);
}
tvi.lParam = 0;
@@ -227,69 +227,69 @@ static int BuildTree(HWND hwndDlg, int MenuObjectId, BOOL bReread) char menuItemName[256], MenuNameItems[256];
char buf[256];
- FreeTreeData( hwndDlg );
+ FreeTreeData(hwndDlg);
TreeView_DeleteAllItems(GetDlgItem(hwndDlg, IDC_MENUITEMS));
- int menupos = GetMenuObjbyId( MenuObjectId );
- if ( menupos == -1 )
+ int menupos = GetMenuObjbyId(MenuObjectId);
+ if (menupos == -1)
return FALSE;
TIntMenuObject* pimo = g_menus[menupos];
- if ( pimo->m_items.first == NULL )
+ if (pimo->m_items.first == NULL)
return FALSE;
- mir_snprintf( MenuNameItems, sizeof(MenuNameItems), "%s_Items", pimo->Name );
+ mir_snprintf(MenuNameItems, sizeof(MenuNameItems), "%s_Items", pimo->Name);
int count = 0;
{
- for ( PMO_IntMenuItem p = pimo->m_items.first; p != NULL; p = p->next )
- if ( p->mi.root == ( HGENMENU )-1 || p->mi.root == NULL )
+ for (PMO_IntMenuItem p = pimo->m_items.first; p != NULL; p = p->next)
+ if (p->mi.root == (HGENMENU)-1 || p->mi.root == NULL)
count++;
}
- lpMenuItemOptData *PDar = ( lpMenuItemOptData* )mir_alloc( sizeof( lpMenuItemOptData )*count );
+ lpMenuItemOptData *PDar = (lpMenuItemOptData*)mir_alloc(sizeof(lpMenuItemOptData)*count);
count = 0;
{
- for ( PMO_IntMenuItem p = pimo->m_items.first; p != NULL; p = p->next ) {
- if ( p->mi.root != ( HGENMENU )-1 && p->mi.root != NULL )
+ for (PMO_IntMenuItem p = pimo->m_items.first; p != NULL; p = p->next) {
+ if (p->mi.root != (HGENMENU)-1 && p->mi.root != NULL)
continue;
- MenuItemOptData *PD = ( MenuItemOptData* )mir_calloc( sizeof( MenuItemOptData ));
- GetMenuItemName( p, menuItemName, sizeof( menuItemName ));
+ MenuItemOptData *PD = (MenuItemOptData*)mir_calloc(sizeof(MenuItemOptData));
+ GetMenuItemName(p, menuItemName, sizeof(menuItemName));
{
DBVARIANT dbv;
mir_snprintf(buf, SIZEOF(buf), "%s_name", menuItemName);
- if ( !DBGetContactSettingTString( NULL, MenuNameItems, buf, &dbv )) {
- PD->name = mir_tstrdup( dbv.ptszVal );
- DBFreeVariant( &dbv );
+ if ( !DBGetContactSettingTString(NULL, MenuNameItems, buf, &dbv)) {
+ PD->name = mir_tstrdup(dbv.ptszVal);
+ DBFreeVariant(&dbv);
}
- else PD->name = mir_tstrdup( GetMenuItemText(p));
+ else PD->name = mir_tstrdup(GetMenuItemText(p));
}
PD->pimi = p;
- PD->defname = mir_tstrdup( GetMenuItemText(p));
+ PD->defname = mir_tstrdup(GetMenuItemText(p));
- mir_snprintf( buf, SIZEOF(buf), "%s_visible", menuItemName );
- PD->show = DBGetContactSettingByte( NULL, MenuNameItems, buf, 1 );
+ mir_snprintf(buf, SIZEOF(buf), "%s_visible", menuItemName);
+ PD->show = DBGetContactSettingByte(NULL, MenuNameItems, buf, 1);
- if ( bReread ) {
- mir_snprintf( buf, SIZEOF(buf), "%s_pos", menuItemName );
- PD->pos = DBGetContactSettingDword( NULL, MenuNameItems, buf, 1 );
+ if (bReread) {
+ mir_snprintf(buf, SIZEOF(buf), "%s_pos", menuItemName);
+ PD->pos = DBGetContactSettingDword(NULL, MenuNameItems, buf, 1);
}
- else PD->pos = ( PD->pimi ) ? PD->pimi->originalPosition : 0;
+ else PD->pos = (PD->pimi) ? PD->pimi->originalPosition : 0;
PD->id = p->iCommand;
- if ( p->UniqName )
- PD->uniqname = mir_strdup( p->UniqName );
+ if (p->UniqName)
+ PD->uniqname = mir_strdup(p->UniqName);
PDar[ count ] = PD;
count++;
} }
- qsort( PDar, count, sizeof( lpMenuItemOptData ), sortfunc );
+ qsort(PDar, count, sizeof(lpMenuItemOptData), sortfunc);
SendDlgItemMessage(hwndDlg, IDC_MENUITEMS, WM_SETREDRAW, FALSE, 0);
int lastpos = 0;
@@ -299,26 +299,26 @@ static int BuildTree(HWND hwndDlg, int MenuObjectId, BOOL bReread) tvis.hParent = NULL;
tvis.hInsertAfter = TVI_LAST;
tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
- for ( int i=0; i < count; i++ ) {
- if ( PDar[i]->pos - lastpos >= SEPARATORPOSITIONINTERVAL ) {
- MenuItemOptData *PD = ( MenuItemOptData* )mir_calloc( sizeof( MenuItemOptData ));
+ for (int i=0; i < count; i++) {
+ if (PDar[i]->pos - lastpos >= SEPARATORPOSITIONINTERVAL) {
+ MenuItemOptData *PD = (MenuItemOptData*)mir_calloc(sizeof(MenuItemOptData));
PD->id = -1;
- PD->name = mir_tstrdup( STR_SEPARATOR );
+ PD->name = mir_tstrdup(STR_SEPARATOR);
PD->pos = PDar[i]->pos - 1;
PD->show = TRUE;
- tvis.item.lParam = ( LPARAM )PD;
+ tvis.item.lParam = (LPARAM)PD;
tvis.item.pszText = PD->name;
tvis.item.iImage = tvis.item.iSelectedImage = PD->show;
SendDlgItemMessage(hwndDlg, IDC_MENUITEMS, TVM_INSERTITEM, 0, (LPARAM)&tvis);
}
- tvis.item.lParam = ( LPARAM )PDar[i];
+ tvis.item.lParam = (LPARAM)PDar[i];
tvis.item.pszText = PDar[i]->name;
tvis.item.iImage = tvis.item.iSelectedImage = PDar[i]->show;
HTREEITEM hti = (HTREEITEM)SendDlgItemMessage(hwndDlg, IDC_MENUITEMS, TVM_INSERTITEM, 0, (LPARAM)&tvis);
- if ( first ) {
+ if (first) {
TreeView_SelectItem(GetDlgItem(hwndDlg, IDC_MENUITEMS), hti);
first=FALSE;
}
@@ -326,26 +326,26 @@ static int BuildTree(HWND hwndDlg, int MenuObjectId, BOOL bReread) lastpos = PDar[i]->pos;
}
- SendDlgItemMessage( hwndDlg, IDC_MENUITEMS, WM_SETREDRAW, TRUE, 0 );
- mir_free( PDar );
- 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 );
+ SendDlgItemMessage(hwndDlg, IDC_MENUITEMS, WM_SETREDRAW, TRUE, 0);
+ mir_free(PDar);
+ 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;
}
-static void RebuildCurrent( HWND hwndDlg )
+static void RebuildCurrent(HWND hwndDlg)
{
int MenuObjectID;
- if ( GetCurrentMenuObjectID( hwndDlg, &MenuObjectID ))
- BuildTree( hwndDlg, MenuObjectID, TRUE );
+ if (GetCurrentMenuObjectID(hwndDlg, &MenuObjectID))
+ BuildTree(hwndDlg, MenuObjectID, TRUE);
}
-static void ResetMenuItems( HWND hwndDlg )
+static void ResetMenuItems(HWND hwndDlg)
{
int MenuObjectID;
- if ( GetCurrentMenuObjectID( hwndDlg, &MenuObjectID ))
- BuildTree( hwndDlg, MenuObjectID, FALSE );
+ if (GetCurrentMenuObjectID(hwndDlg, &MenuObjectID))
+ BuildTree(hwndDlg, MenuObjectID, FALSE);
}
static HTREEITEM MoveItemAbove(HWND hTreeWnd, HTREEITEM hItem, HTREEITEM hInsertAfter)
@@ -353,23 +353,23 @@ static HTREEITEM MoveItemAbove(HWND hTreeWnd, HTREEITEM hItem, HTREEITEM hInsert TVITEM tvi = { 0 };
tvi.mask = TVIF_HANDLE | TVIF_PARAM;
tvi.hItem = hItem;
- if ( !SendMessage(hTreeWnd, TVM_GETITEM, 0, ( LPARAM )&tvi ))
+ if ( !SendMessage(hTreeWnd, TVM_GETITEM, 0, (LPARAM)&tvi))
return NULL;
- if ( hItem && hInsertAfter ) {
+ if (hItem && hInsertAfter) {
TVINSERTSTRUCT tvis;
TCHAR name[128];
- if ( hItem == hInsertAfter )
+ if (hItem == hInsertAfter)
return hItem;
tvis.item.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
tvis.item.stateMask = 0xFFFFFFFF;
tvis.item.pszText = name;
- tvis.item.cchTextMax = sizeof( name );
+ tvis.item.cchTextMax = sizeof(name);
tvis.item.hItem = hItem;
- tvis.item.iImage = tvis.item.iSelectedImage = (( MenuItemOptData* )tvi.lParam)->show;
- if (!SendMessage(hTreeWnd, TVM_GETITEM, 0, (LPARAM)&tvis.item))
+ 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;
@@ -396,9 +396,9 @@ LRESULT CALLBACK LBTNDOWNProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam HWND tvw=hwnd;
tvi.mask=TVIF_HANDLE|TVIF_PARAM;
tvi.hItem=hti.hItem;
- TreeView_GetItem( tvw, &tvi );
+ TreeView_GetItem(tvw, &tvi);
- if (!((MenuItemOptData *)tvi.lParam)->isSelected) { /* is not Selected*/
+ if ( !((MenuItemOptData *)tvi.lParam)->isSelected) { /* is not Selected*/
// reset all selection except current
HTREEITEM hit;
hit=TreeView_GetRoot(tvw);
@@ -432,7 +432,7 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA dat=(struct OrderData*)mir_alloc(sizeof(struct OrderData));
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_MENUITEMS), GWLP_USERDATA, (LONG_PTR)dat);
dat->dragging = 0;
- dat->iInitMenuValue = DBGetContactSettingByte( NULL, "CList", "MoveProtoMenus", TRUE );
+ 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);
{
@@ -446,28 +446,28 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA 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 );
+ CheckDlgButton(hwndDlg, dat->iInitMenuValue ? IDC_RADIO2 : IDC_RADIO1, TRUE);
+ CheckDlgButton(hwndDlg, IDC_DISABLEMENUICONS, bIconsDisabled);
BuildMenuObjectsTree(hwndDlg);
return TRUE;
case WM_COMMAND:
- if ( HIWORD(wParam) == BN_CLICKED || HIWORD( wParam ) == BN_DBLCLK ) {
- switch ( LOWORD( wParam )) {
+ if (HIWORD(wParam) == BN_CLICKED || HIWORD(wParam) == BN_DBLCLK) {
+ switch (LOWORD(wParam)) {
case IDC_INSERTSEPARATOR:
InsertSeparator(hwndDlg);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
case IDC_RESETMENU:
- ResetMenuItems( hwndDlg );
- SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
+ ResetMenuItems(hwndDlg);
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
case IDC_DISABLEMENUICONS:
case IDC_RADIO1:
case IDC_RADIO2:
- SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
case IDC_GENMENU_DEFAULT:
@@ -483,18 +483,18 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA tvi.mask=TVIF_HANDLE|TVIF_IMAGE|TVIF_SELECTEDIMAGE|TVIF_PARAM;
tvi.hItem=hti;
TreeView_GetItem(GetDlgItem(hwndDlg, IDC_MENUITEMS), &tvi);
- iod = ( MenuItemOptData * )tvi.lParam;
+ iod = (MenuItemOptData *)tvi.lParam;
- if ( iod->name && _tcsstr( iod->name, STR_SEPARATOR ))
+ if (iod->name && _tcsstr(iod->name, STR_SEPARATOR))
break;
if (iod->name)
mir_free(iod->name);
- iod->name = mir_tstrdup( iod->defname );
+ iod->name = mir_tstrdup(iod->defname);
SaveTree(hwndDlg);
RebuildCurrent(hwndDlg);
- SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
break;
@@ -504,20 +504,20 @@ 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 ));
- if ( hti == NULL )
+ HTREEITEM hti = TreeView_GetSelection(GetDlgItem(hwndDlg, IDC_MENUITEMS));
+ if (hti == NULL)
break;
tvi.mask = TVIF_HANDLE|TVIF_IMAGE|TVIF_SELECTEDIMAGE|TVIF_PARAM;
tvi.hItem = hti;
SendDlgItemMessage(hwndDlg, IDC_MENUITEMS, TVM_GETITEM, 0, (LPARAM)&tvi);
- iod = ( MenuItemOptData * )tvi.lParam;
+ iod = (MenuItemOptData *)tvi.lParam;
- if ( iod->name && _tcsstr(iod->name, STR_SEPARATOR ))
+ if (iod->name && _tcsstr(iod->name, STR_SEPARATOR))
break;
- ZeroMemory(buf, sizeof( buf ));
- GetDlgItemText( hwndDlg, IDC_GENMENU_CUSTOMNAME, buf, SIZEOF( buf ));
+ ZeroMemory(buf, sizeof(buf));
+ GetDlgItemText(hwndDlg, IDC_GENMENU_CUSTOMNAME, buf, SIZEOF(buf));
if (iod->name)
mir_free(iod->name);
@@ -525,7 +525,7 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA SaveTree(hwndDlg);
RebuildCurrent(hwndDlg);
- SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
break;
} }
@@ -533,15 +533,15 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA case WM_NOTIFY:
hdr = (LPNMHDR)lParam;
- switch( hdr->idFrom ) {
+ switch(hdr->idFrom) {
case 0:
- if (hdr->code == PSN_APPLY ) {
+ if (hdr->code == PSN_APPLY) {
bIconsDisabled = IsDlgButtonChecked(hwndDlg, IDC_DISABLEMENUICONS) != 0;
DBWriteContactSettingByte(NULL, "CList", "DisableMenuIcons", bIconsDisabled);
SaveTree(hwndDlg);
int iNewMenuValue = IsDlgButtonChecked(hwndDlg, IDC_RADIO1) ? 0 : 1;
- if ( iNewMenuValue != dat->iInitMenuValue ) {
- RebuildProtoMenus( iNewMenuValue );
+ if (iNewMenuValue != dat->iInitMenuValue) {
+ RebuildProtoMenus(iNewMenuValue);
dat->iInitMenuValue = iNewMenuValue;
}
RebuildCurrent(hwndDlg);
@@ -549,8 +549,8 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA break;
case IDC_MENUOBJECTS:
- if (hdr->code == TVN_SELCHANGEDA )
- RebuildCurrent( hwndDlg );
+ if (hdr->code == TVN_SELCHANGEDA)
+ RebuildCurrent(hwndDlg);
break;
case IDC_MENUITEMS:
@@ -661,12 +661,12 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA tvi.hItem=hti;
TreeView_GetItem(GetDlgItem(hwndDlg, IDC_MENUITEMS), &tvi);
- if ( tvi.lParam == 0 )
+ if (tvi.lParam == 0)
break;
- iod = ( MenuItemOptData * )tvi.lParam;
+ iod = (MenuItemOptData *)tvi.lParam;
- if ( iod->name && _tcsstr(iod->name, STR_SEPARATOR))
+ if (iod->name && _tcsstr(iod->name, STR_SEPARATOR))
break;
SetDlgItemText(hwndDlg, IDC_GENMENU_CUSTOMNAME, iod->name);
@@ -684,7 +684,7 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA break;
case WM_MOUSEMOVE:
- if (!dat||!dat->dragging) break;
+ if ( !dat || !dat->dragging) break;
{
TVHITTESTINFO hti;
@@ -697,7 +697,7 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA HTREEITEM it = hti.hItem;
hti.pt.y -= TreeView_GetItemHeight(GetDlgItem(hwndDlg, IDC_MENUITEMS))/2;
TreeView_HitTest(GetDlgItem(hwndDlg, IDC_MENUITEMS), &hti);
- if (!(hti.flags&TVHT_ABOVE))
+ if ( !(hti.flags&TVHT_ABOVE))
TreeView_SetInsertMark(GetDlgItem(hwndDlg, IDC_MENUITEMS), hti.hItem, 1);
else
TreeView_SetInsertMark(GetDlgItem(hwndDlg, IDC_MENUITEMS), it, 0);
@@ -710,7 +710,7 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA break;
case WM_LBUTTONUP:
- if (!dat->dragging)
+ if ( !dat->dragging)
break;
TreeView_SetInsertMark(GetDlgItem(hwndDlg, IDC_MENUITEMS), NULL, 0);
@@ -727,7 +727,7 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA if (hti.flags&TVHT_ABOVE) hti.hItem=TVI_FIRST;
if (dat->hDragItem == hti.hItem) break;
dat->hDragItem=NULL;
- if (hti.flags&(TVHT_ONITEM|TVHT_ONITEMRIGHT)||(hti.hItem == TVI_FIRST)) {
+ if (hti.flags&(TVHT_ONITEM|TVHT_ONITEMRIGHT) || (hti.hItem == TVI_FIRST)) {
HWND tvw;
HTREEITEM * pSIT;
HTREEITEM FirstItem=NULL;
@@ -760,7 +760,7 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA for (i=0; i<uSic; i++) {
if (insertAfter) insertAfter=MoveItemAbove(tvw, pSIT[i], insertAfter);
else break;
- if (!i) FirstItem=insertAfter;
+ if ( !i) FirstItem=insertAfter;
} }
// free pointers...
mir_free(pSIT);
@@ -773,11 +773,11 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA break;
case WM_DESTROY:
- if ( dat )
- mir_free( dat );
+ if (dat)
+ mir_free(dat);
ImageList_Destroy(TreeView_SetImageList(GetDlgItem(hwndDlg, IDC_MENUOBJECTS), NULL, TVSIL_NORMAL));
- FreeTreeData( hwndDlg );
+ FreeTreeData(hwndDlg);
break;
}
@@ -786,10 +786,10 @@ static INT_PTR CALLBACK GenMenuOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA long handleCustomDraw(HWND hWndTreeView, LPNMTVCUSTOMDRAW pNMTVCD)
{
- if ( pNMTVCD == NULL )
+ if (pNMTVCD == NULL)
return -1;
- switch ( pNMTVCD->nmcd.dwDrawStage ) {
+ switch (pNMTVCD->nmcd.dwDrawStage) {
case CDDS_PREPAINT:
return CDRF_NOTIFYITEMDRAW;
@@ -818,7 +818,7 @@ long handleCustomDraw(HWND hWndTreeView, LPNMTVCUSTOMDRAW pNMTVCD) and any subitems and return CDRF_NEWFONT. If the list-view control
is in report mode, you can simply return CDRF_NOTIFYSUBITEMREDRAW
to customize the item's subitems individually */
- if ( tvi.iImage == -1 ) {
+ if (tvi.iImage == -1) {
HBRUSH br;
SIZE sz;
RECT rc;
@@ -853,18 +853,18 @@ int GenMenuOptInit(WPARAM wParam, LPARAM) odp.pszGroup = LPGEN("Customize");
odp.position = -1000000000;
- odp.pszTemplate = MAKEINTRESOURCEA( IDD_OPT_GENMENU );
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_GENMENU);
odp.pszTitle = LPGEN("Menus");
odp.pfnDlgProc = GenMenuOpts;
odp.flags = ODPF_BOLDGROUPS;
- CallService( MS_OPT_ADDPAGE, wParam, ( LPARAM )&odp );
+ Options_AddPage(wParam, &odp);
odp.position = -10000000;
odp.groupPosition = 1000000;
- odp.pszTemplate = MAKEINTRESOURCEA( IDD_OPT_PROTOCOLORDER );
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_PROTOCOLORDER);
odp.pszTitle = LPGEN("Accounts");
odp.pfnDlgProc = ProtocolOrderOpts;
odp.flags = ODPF_BOLDGROUPS|ODPF_EXPERTONLY;
- CallService( MS_OPT_ADDPAGE, wParam, ( LPARAM )&odp );
+ Options_AddPage(wParam, &odp);
return 0;
}
diff --git a/src/modules/clist/groups.cpp b/src/modules/clist/groups.cpp index c741c02008..714ed0e223 100644 --- a/src/modules/clist/groups.cpp +++ b/src/modules/clist/groups.cpp @@ -55,7 +55,7 @@ static int GroupNameExists(const TCHAR *name, int skipGroup) _itoa(i, idstr, 10);
if (DBGetContactSettingTString(NULL, "CListGroups", idstr, &dbv))
break;
- if (!_tcscmp(dbv.ptszVal + 1, name)) {
+ if ( !_tcscmp(dbv.ptszVal + 1, name)) {
DBFreeVariant(&dbv);
return i+1;
}
@@ -78,13 +78,13 @@ static INT_PTR CreateGroup(WPARAM wParam, LPARAM lParam) if (DBGetContactSettingTString(NULL, "CListGroups", str, &dbv))
return 0;
- mir_sntprintf( newBaseName, SIZEOF(newBaseName), _T("%s\\%s"), dbv.ptszVal + 1, grpName );
+ mir_sntprintf(newBaseName, SIZEOF(newBaseName), _T("%s\\%s"), dbv.ptszVal + 1, grpName);
mir_free(dbv.pszVal);
}
- else lstrcpyn( newBaseName, grpName, SIZEOF( newBaseName ));
+ else lstrcpyn(newBaseName, grpName, SIZEOF(newBaseName));
_itoa(newId, str, 10);
- lstrcpyn( newName + 1, newBaseName, SIZEOF(newName) - 1);
+ lstrcpyn(newName + 1, newBaseName, SIZEOF(newName) - 1);
if (lParam) {
i = GroupNameExists(newBaseName, -1);
if (i) newId = i - 1;
@@ -93,7 +93,7 @@ static INT_PTR CreateGroup(WPARAM wParam, LPARAM lParam) else {
i = 1;
while (GroupNameExists(newName + 1, -1))
- mir_sntprintf( newName + 1, SIZEOF(newName) - 1, _T("%s (%d)"), newBaseName, ++i );
+ mir_sntprintf(newName + 1, SIZEOF(newName) - 1, _T("%s (%d)"), newBaseName, ++i);
}
if (i) {
const CLISTGROUPCHANGE grpChg = { sizeof(CLISTGROUPCHANGE), NULL, newName };
@@ -124,20 +124,20 @@ static INT_PTR GetGroupName2(WPARAM wParam, LPARAM lParam) return (INT_PTR) name;
}
-TCHAR* fnGetGroupName( int idx, DWORD* pdwFlags )
+TCHAR* fnGetGroupName(int idx, DWORD* pdwFlags)
{
char idstr[33];
DBVARIANT dbv;
static TCHAR name[128];
- _itoa( idx-1, idstr, 10);
- if (DBGetContactSettingTString( NULL, "CListGroups", idstr, &dbv ))
+ _itoa(idx-1, idstr, 10);
+ if (DBGetContactSettingTString(NULL, "CListGroups", idstr, &dbv))
return NULL;
- lstrcpyn( name, dbv.ptszVal + 1, SIZEOF( name ));
- if ( pdwFlags != NULL )
+ lstrcpyn(name, dbv.ptszVal + 1, SIZEOF(name));
+ if (pdwFlags != NULL)
*pdwFlags = dbv.ptszVal[0];
- DBFreeVariant( &dbv );
+ DBFreeVariant(&dbv);
return name;
}
@@ -167,7 +167,7 @@ static INT_PTR DeleteGroup(WPARAM wParam, LPARAM) if (DBGetContactSettingByte(NULL, "CList", "ConfirmDelete", SETTING_CONFIRMDELETE_DEFAULT))
{
TCHAR szQuestion[256+100];
- mir_sntprintf( szQuestion, SIZEOF(szQuestion), TranslateT("Are you sure you want to delete group '%s'? This operation can not be undone."), name );
+ mir_sntprintf(szQuestion, SIZEOF(szQuestion), TranslateT("Are you sure you want to delete group '%s'? This operation can not be undone."), name);
if (MessageBox(cli.hwndContactList, szQuestion, TranslateT("Delete Group"), MB_YESNO|MB_ICONQUESTION) == IDNO)
return 1;
}
@@ -230,7 +230,7 @@ static INT_PTR DeleteGroup(WPARAM wParam, LPARAM) _itoa(i, str, 10);
if (DBGetContactSettingTString(NULL, "CListGroups", str, &dbv))
break;
- if (!_tcsncmp(dbv.ptszVal + 1, name, len) && dbv.pszVal[len + 1] == '\\' && _tcschr(dbv.ptszVal + len + 2, '\\') == NULL) {
+ if ( !_tcsncmp(dbv.ptszVal + 1, name, len) && dbv.pszVal[len + 1] == '\\' && _tcschr(dbv.ptszVal + len + 2, '\\') == NULL) {
if (szNewParent[0])
mir_sntprintf(szNewName, SIZEOF(szNewName), _T("%s\\%s"), szNewParent, dbv.ptszVal + len + 2);
else
@@ -275,7 +275,7 @@ static int RenameGroupWithMove(int groupId, const TCHAR *szName, int move) //must rename setting in all child contacts too
hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
do {
- ClcCacheEntryBase* cache = cli.pfnGetCacheEntry( hContact );
+ ClcCacheEntryBase* cache = cli.pfnGetCacheEntry(hContact);
if ( !lstrcmp(cache->group, oldName)) {
DBWriteContactSettingTString(hContact, "CList", "Group", szName);
mir_free(cache->group);
@@ -298,7 +298,7 @@ static int RenameGroupWithMove(int groupId, const TCHAR *szName, int move) if (DBGetContactSettingTString(NULL, "CListGroups", idstr, &dbv))
break;
if ( !_tcsncmp(dbv.ptszVal + 1, oldName, len) && dbv.ptszVal[len + 1] == '\\' && _tcschr(dbv.ptszVal + len + 2, '\\') == NULL) {
- mir_sntprintf( szNewName, SIZEOF(szNewName), _T("%s\\%s"), szName, dbv.ptszVal + len + 2 );
+ mir_sntprintf(szNewName, SIZEOF(szNewName), _T("%s\\%s"), szName, dbv.ptszVal + len + 2);
RenameGroupWithMove(i, szNewName, 0); //luckily, child groups will never need reordering
}
DBFreeVariant(&dbv);
@@ -318,7 +318,7 @@ static int RenameGroupWithMove(int groupId, const TCHAR *szName, int move) _itoa(i, idstr, 10);
if (DBGetContactSettingTString(NULL, "CListGroups", idstr, &dbv))
break;
- if (!lstrcmp(dbv.ptszVal + 1, str)) {
+ if ( !lstrcmp(dbv.ptszVal + 1, str)) {
if (i < groupId)
break; //is OK
MoveGroupBefore(groupId + 1, i + 2);
@@ -335,16 +335,16 @@ static int RenameGroupWithMove(int groupId, const TCHAR *szName, int move) return 0;
}
-int fnRenameGroup( int groupID, TCHAR* newName )
+int fnRenameGroup(int groupID, TCHAR* newName)
{
- return -1 != RenameGroupWithMove( groupID-1, newName, 1);
+ return -1 != RenameGroupWithMove(groupID-1, newName, 1);
}
static INT_PTR RenameGroup(WPARAM wParam, LPARAM lParam)
{
- WCHAR* temp = mir_a2u(( char* )lParam );
- int result = ( -1 != RenameGroupWithMove(wParam - 1, temp, 1));
- mir_free( temp );
+ WCHAR* temp = mir_a2u((char*)lParam);
+ int result = (-1 != RenameGroupWithMove(wParam - 1, temp, 1));
+ mir_free(temp);
return result;
}
@@ -475,7 +475,7 @@ static INT_PTR BuildGroupMenu(WPARAM, LPARAM) pNextField = NULL;
}
else {
- lstrcpyn(szThisField, pNextField, min( SIZEOF(szThisField), pBackslash - pNextField + 1));
+ lstrcpyn(szThisField, pNextField, min(SIZEOF(szThisField), pBackslash - pNextField + 1));
pNextField = pBackslash + 1;
}
compareResult = 1;
@@ -567,7 +567,7 @@ int InitGroupServices(void) CreateServiceFunction(MS_CLIST_GROUPMOVEBEFORE, MoveGroupBefore);
CreateServiceFunction(MS_CLIST_GROUPBUILDMENU, BuildGroupMenu);
- hGroupChangeEvent = CreateHookableEvent( ME_CLIST_GROUPCHANGE );
+ hGroupChangeEvent = CreateHookableEvent(ME_CLIST_GROUPCHANGE);
return 0;
}
diff --git a/src/modules/clist/keyboard.cpp b/src/modules/clist/keyboard.cpp index 2f7345ff5b..28fc6d7be4 100644 --- a/src/modules/clist/keyboard.cpp +++ b/src/modules/clist/keyboard.cpp @@ -33,7 +33,7 @@ static INT_PTR hkHideShow(WPARAM, LPARAM) INT_PTR hkSearch(WPARAM wParam, LPARAM lParam)
{
DBVARIANT dbv={0};
- if (!DBGetContactSettingString(NULL, "CList", "SearchUrl", &dbv)) {
+ if ( !DBGetContactSettingString(NULL, "CList", "SearchUrl", &dbv)) {
CallService(MS_UTILS_OPENURL, DBGetContactSettingByte(NULL, "CList", "HKSearchNewWnd", 0), (LPARAM)dbv.pszVal);
DBFreeVariant(&dbv);
}
diff --git a/src/modules/clist/movetogroup.cpp b/src/modules/clist/movetogroup.cpp index 5fd05e87a0..2075fa3648 100644 --- a/src/modules/clist/movetogroup.cpp +++ b/src/modules/clist/movetogroup.cpp @@ -47,15 +47,15 @@ struct GroupItemSort { return _tcscoll(d1->name, d2->name); }
};
-static TCHAR* PrepareGroupName( TCHAR* str )
+static TCHAR* PrepareGroupName(TCHAR* str)
{
- TCHAR* p = _tcschr( str, '&' ), *d;
- if ( p == NULL )
- return mir_tstrdup( str );
+ TCHAR* p = _tcschr(str, '&'), *d;
+ if (p == NULL)
+ return mir_tstrdup(str);
- d = p = ( TCHAR* )mir_alloc( sizeof( TCHAR )*( 2*_tcslen( str )+1 ));
- while ( *str ) {
- if ( *str == '&' )
+ d = p = (TCHAR*)mir_alloc(sizeof(TCHAR)*(2*_tcslen(str)+1));
+ while (*str) {
+ if (*str == '&')
*d++ = '&';
*d++ = *str++;
}
@@ -71,13 +71,13 @@ static void AddGroupItem(HGENMENU hRoot, TCHAR* name, int pos, WPARAM param, boo mi.hParentMenu = hRoot;
mi.popupPosition = param; // param to pszService - only with CMIF_CHILDPOPUP !!!!!!
mi.position = pos;
- mi.ptszName = PrepareGroupName( name );
+ mi.ptszName = PrepareGroupName(name);
mi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED;
- if ( checked )
+ if (checked)
mi.flags |= CMIF_CHECKED;
mi.pszService = MTG_MOVE;
HANDLE result = Menu_AddContactMenuItem(&mi);
- mir_free( mi.ptszName );
+ mir_free(mi.ptszName);
lphGroupsItems.insert((HANDLE*)result);
}
@@ -87,7 +87,7 @@ static int OnContactMenuBuild(WPARAM wParam, LPARAM) int i;
OBJLIST<GroupItemSort> groups(10, GroupItemSort::compare);
- if (!hMoveToGroupItem)
+ if ( !hMoveToGroupItem)
{
CLISTMENUITEM mi = {0};
diff --git a/src/modules/clist/protocolorder.cpp b/src/modules/clist/protocolorder.cpp index 41a5b5beba..2eeb402f42 100644 --- a/src/modules/clist/protocolorder.cpp +++ b/src/modules/clist/protocolorder.cpp @@ -48,12 +48,12 @@ typedef struct { }
tempProtoItem;
-int isProtoSuitable( PROTO_INTERFACE* ppi )
+int isProtoSuitable(PROTO_INTERFACE* ppi)
{
- if ( ppi == NULL )
+ if (ppi == NULL)
return TRUE;
- return ppi->GetCaps( PFLAGNUM_2, 0 ) & ~ppi->GetCaps( PFLAGNUM_5, 0 );
+ return ppi->GetCaps(PFLAGNUM_2, 0) & ~ppi->GetCaps(PFLAGNUM_5, 0);
}
bool CheckProtocolOrder(void)
@@ -132,26 +132,26 @@ int FillTree(HWND hwnd) tvis.item.mask = TVIF_PARAM|TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE;
TreeView_DeleteAllItems(hwnd);
- if ( accounts.getCount() == 0 )
+ if (accounts.getCount() == 0)
return FALSE;
- for ( i = 0; i < accounts.getCount(); i++ ) {
- int idx = cli.pfnGetAccountIndexByPos( i );
- if ( idx == -1 )
+ for (i = 0; i < accounts.getCount(); i++) {
+ int idx = cli.pfnGetAccountIndexByPos(i);
+ if (idx == -1)
continue;
pa = accounts[idx];
- PD = ( ProtocolData* )mir_alloc( sizeof( ProtocolData ));
+ PD = (ProtocolData*)mir_alloc(sizeof(ProtocolData));
PD->RealName = pa->szModuleName;
PD->protopos = pa->iOrder;
- PD->enabled = Proto_IsAccountEnabled( pa ) && isProtoSuitable( pa->ppro );
+ PD->enabled = Proto_IsAccountEnabled(pa) && isProtoSuitable(pa->ppro);
PD->show = PD->enabled ? pa->bIsVisible : 100;
- tvis.item.lParam = ( LPARAM )PD;
+ tvis.item.lParam = (LPARAM)PD;
tvis.item.pszText = pa->tszAccountName;
tvis.item.iImage = tvis.item.iSelectedImage = PD->show;
- TreeView_InsertItem( hwnd, &tvis );
+ TreeView_InsertItem(hwnd, &tvis);
}
return 0;
@@ -166,7 +166,7 @@ INT_PTR CALLBACK ProtocolOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM {
case WM_DESTROY:
ImageList_Destroy(TreeView_GetImageList(hwndProtoOrder, TVSIL_NORMAL));
- mir_free( dat );
+ mir_free(dat);
break;
case WM_INITDIALOG:
@@ -177,7 +177,7 @@ INT_PTR CALLBACK ProtocolOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM SetWindowLongPtr(hwndProtoOrder, GWL_STYLE, GetWindowLongPtr(hwndProtoOrder, GWL_STYLE) | TVS_NOHSCROLL);
{
- HIMAGELIST himlCheckBoxes = ImageList_Create( GetSystemMetrics( SM_CXSMICON ), GetSystemMetrics( SM_CYSMICON ), ILC_COLOR32|ILC_MASK, 2, 2 );
+ HIMAGELIST himlCheckBoxes = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32|ILC_MASK, 2, 2);
ImageList_AddIcon_IconLibLoaded(himlCheckBoxes, SKINICON_OTHER_NOTICK);
ImageList_AddIcon_IconLibLoaded(himlCheckBoxes, SKINICON_OTHER_TICK);
TreeView_SetImageList(hwndProtoOrder, himlCheckBoxes, TVSIL_NORMAL);
@@ -189,7 +189,7 @@ INT_PTR CALLBACK ProtocolOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM case WM_COMMAND:
if (LOWORD(wParam) == IDC_RESETPROTOCOLDATA && HIWORD(wParam) == BN_CLICKED)
{
- for ( int i = 0; i < accounts.getCount(); i++ )
+ for (int i = 0; i < accounts.getCount(); i++)
accounts[i]->iOrder = i;
FillTree(hwndProtoOrder);
@@ -200,7 +200,7 @@ INT_PTR CALLBACK ProtocolOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM case WM_NOTIFY:
switch(((LPNMHDR)lParam)->idFrom) {
case 0:
- if (((LPNMHDR)lParam)->code == PSN_APPLY ) {
+ if (((LPNMHDR)lParam)->code == PSN_APPLY) {
int count = 0;
TVITEM tvi;
@@ -208,27 +208,27 @@ INT_PTR CALLBACK ProtocolOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM tvi.cchTextMax = 32;
tvi.mask = TVIF_PARAM | TVIF_HANDLE;
- while ( tvi.hItem != NULL ) {
+ while (tvi.hItem != NULL) {
TreeView_GetItem(hwndProtoOrder, &tvi);
if (tvi.lParam != 0) {
- ProtocolData* ppd = ( ProtocolData* )tvi.lParam;
- PROTOACCOUNT* pa = Proto_GetAccount( ppd->RealName );
- if ( pa != NULL ) {
+ ProtocolData* ppd = (ProtocolData*)tvi.lParam;
+ PROTOACCOUNT* pa = Proto_GetAccount(ppd->RealName);
+ if (pa != NULL) {
pa->iOrder = count++;
- if ( ppd->enabled )
+ if (ppd->enabled)
pa->bIsVisible = ppd->show;
}
}
- tvi.hItem = TreeView_GetNextSibling(hwndProtoOrder, tvi.hItem );
+ tvi.hItem = TreeView_GetNextSibling(hwndProtoOrder, tvi.hItem);
}
WriteDbAccounts();
cli.pfnReloadProtoMenus();
cli.pfnTrayIconIconsChanged();
- cli.pfnClcBroadcast( INTM_RELOADOPTIONS, 0, 0 );
- cli.pfnClcBroadcast( INTM_INVALIDATE, 0, 0 );
+ cli.pfnClcBroadcast(INTM_RELOADOPTIONS, 0, 0);
+ cli.pfnClcBroadcast(INTM_INVALIDATE, 0, 0);
}
break;
@@ -255,15 +255,15 @@ INT_PTR CALLBACK ProtocolOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM hti.pt.x=(short)LOWORD(GetMessagePos());
hti.pt.y=(short)HIWORD(GetMessagePos());
ScreenToClient(((LPNMHDR)lParam)->hwndFrom, &hti.pt);
- if ( TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom, &hti )) {
- if ( hti.flags & TVHT_ONITEMICON ) {
+ 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);
- ProtocolData *pData = ( ProtocolData* )tvi.lParam;
- if ( pData->enabled ) {
+ ProtocolData *pData = (ProtocolData*)tvi.lParam;
+ if (pData->enabled) {
tvi.iImage = tvi.iSelectedImage = !tvi.iImage;
pData->show = tvi.iImage;
TreeView_SetItem(((LPNMHDR)lParam)->hwndFrom, &tvi);
@@ -274,19 +274,19 @@ INT_PTR CALLBACK ProtocolOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM break;
case WM_MOUSEMOVE:
- if ( dat->dragging ) {
+ if (dat->dragging) {
TVHITTESTINFO hti;
hti.pt.x=(short)LOWORD(lParam);
hti.pt.y=(short)HIWORD(lParam);
ClientToScreen(hwndDlg, &hti.pt);
ScreenToClient(hwndProtoOrder, &hti.pt);
TreeView_HitTest(hwndProtoOrder, &hti);
- if ( hti.flags & (TVHT_ONITEM|TVHT_ONITEMRIGHT ))
+ if (hti.flags & (TVHT_ONITEM|TVHT_ONITEMRIGHT))
{
HTREEITEM it = hti.hItem;
hti.pt.y -= TreeView_GetItemHeight(hwndProtoOrder) / 2;
TreeView_HitTest(hwndProtoOrder, &hti);
- if ( !( hti.flags & TVHT_ABOVE ))
+ if ( !(hti.flags & TVHT_ABOVE))
TreeView_SetInsertMark(hwndProtoOrder, hti.hItem, 1);
else
TreeView_SetInsertMark(hwndProtoOrder, it, 0);
@@ -299,7 +299,7 @@ INT_PTR CALLBACK ProtocolOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM break;
case WM_LBUTTONUP:
- if ( dat->dragging ) {
+ if (dat->dragging) {
TVHITTESTINFO hti;
TVITEM tvi;
@@ -318,7 +318,7 @@ INT_PTR CALLBACK ProtocolOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM tvi.mask = TVIF_HANDLE|TVIF_PARAM;
tvi.hItem = dat->hDragItem;
TreeView_GetItem(hwndProtoOrder, &tvi);
- if ( hti.flags & (TVHT_ONITEM | TVHT_ONITEMRIGHT) || (hti.hItem == TVI_FIRST))
+ if (hti.flags & (TVHT_ONITEM | TVHT_ONITEMRIGHT) || (hti.hItem == TVI_FIRST))
{
TVINSERTSTRUCT tvis;
TCHAR name[128];
|