summaryrefslogtreecommitdiff
path: root/src/modules/findadd
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-06-14 15:51:34 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-06-14 15:51:34 +0000
commite58823d961a630eb62e60d2ccb443761ba5f1704 (patch)
tree62d071be480d57af2a53f154a1468abe0b9449ff /src/modules/findadd
parent721aea0764451e985d575236205808bbef298244 (diff)
- all MS_CLIST_ADD*ITEM services replaced with Menu_Add*Item stubs.
- massive cleanup of the menu-related code git-svn-id: http://svn.miranda-ng.org/main/trunk@410 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/findadd')
-rw-r--r--src/modules/findadd/findadd.cpp444
-rw-r--r--src/modules/findadd/findadd.h16
-rw-r--r--src/modules/findadd/searchresults.cpp118
3 files changed, 289 insertions, 289 deletions
diff --git a/src/modules/findadd/findadd.cpp b/src/modules/findadd/findadd.cpp
index 380e644228..d483844f9b 100644
--- a/src/modules/findadd/findadd.cpp
+++ b/src/modules/findadd/findadd.cpp
@@ -2,7 +2,7 @@
Miranda IM: the free IM client for Microsoft* Windows*
-Copyright 2000-2009 Miranda ICQ/IM project,
+Copyright 2000-2009 Miranda ICQ/IM project,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
@@ -11,7 +11,7 @@ modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
-This program is distributed in the hope that it will be useful,
+This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
@@ -31,11 +31,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
static HWND hwndFindAdd=NULL;
static HANDLE hHookModulesLoaded = 0;
static HANDLE hMainMenuItem = NULL;
-static int OnSystemModulesLoaded(WPARAM wParam,LPARAM lParam);
+static int OnSystemModulesLoaded(WPARAM wParam, LPARAM lParam);
-static int FindAddDlgResizer(HWND,LPARAM lParam,UTILRESIZECONTROL *urc)
+static int FindAddDlgResizer(HWND, LPARAM lParam, UTILRESIZECONTROL *urc)
{
- static int y,nextY,oldTop;
+ static int y, nextY, oldTop;
struct FindAddDlgData *dat;
dat=(struct FindAddDlgData*)lParam;
@@ -58,19 +58,19 @@ static int FindAddDlgResizer(HWND,LPARAM lParam,UTILRESIZECONTROL *urc)
oldTop=urc->rcItem.top;
y=nextY;
if (dat->showEmail) nextY=y+urc->rcItem.bottom-urc->rcItem.top+7;
- OffsetRect(&urc->rcItem,0,y-oldTop);
+ OffsetRect(&urc->rcItem, 0, y-oldTop);
return RD_ANCHORX_LEFT|RD_ANCHORY_CUSTOM;
case IDC_NAMEGROUP:
oldTop=urc->rcItem.top;
y=nextY;
if (dat->showName) nextY=y+urc->rcItem.bottom-urc->rcItem.top+7;
- OffsetRect(&urc->rcItem,0,y-oldTop);
+ OffsetRect(&urc->rcItem, 0, y-oldTop);
return RD_ANCHORX_LEFT|RD_ANCHORY_CUSTOM;
case IDC_ADVANCEDGROUP:
oldTop=urc->rcItem.top;
y=nextY;
if (dat->showAdvanced) nextY=y+urc->rcItem.bottom-urc->rcItem.top+7;
- OffsetRect(&urc->rcItem,0,y-oldTop);
+ OffsetRect(&urc->rcItem, 0, y-oldTop);
return RD_ANCHORX_LEFT|RD_ANCHORY_CUSTOM;
case IDC_TINYEXTENDEDGROUP:
oldTop=urc->rcItem.top;
@@ -94,7 +94,7 @@ static int FindAddDlgResizer(HWND,LPARAM lParam,UTILRESIZECONTROL *urc)
case IDC_BYADVANCED:
case IDC_BYCUSTOM:
case IDC_ADVANCED:
- OffsetRect(&urc->rcItem,0,y-oldTop);
+ OffsetRect(&urc->rcItem, 0, y-oldTop);
return RD_ANCHORX_LEFT|RD_ANCHORY_CUSTOM;
case IDC_HEADERBAR:
return RD_ANCHORX_LEFT|RD_ANCHORY_TOP|RD_ANCHORX_WIDTH;
@@ -102,16 +102,16 @@ static int FindAddDlgResizer(HWND,LPARAM lParam,UTILRESIZECONTROL *urc)
return RD_ANCHORX_LEFT|RD_ANCHORY_TOP;
}
-static void RenderThrobber(HDC hdc,RECT *rcItem,int *throbbing,int *pivot)
+static void RenderThrobber(HDC hdc, RECT *rcItem, int *throbbing, int *pivot)
{
HBRUSH hBr;
HDC hMemDC;
HBITMAP hBitmap;
HPEN hPen;
RECT rc;
- int x,width,height,height2;
+ int x, width, height, height2;
- InflateRect(rcItem,-1,0);
+ InflateRect(rcItem, -1, 0);
width=rcItem->right-rcItem->left;
height=rcItem->bottom-rcItem->top;
height2=height/2;
@@ -119,29 +119,29 @@ static void RenderThrobber(HDC hdc,RECT *rcItem,int *throbbing,int *pivot)
if (*throbbing) {
/* create memdc */
hMemDC=CreateCompatibleDC(0);
- hBitmap=( HBITMAP )SelectObject(hMemDC, CreateCompatibleBitmap(hdc,width,height));
+ hBitmap=( HBITMAP )SelectObject(hMemDC, CreateCompatibleBitmap(hdc, width, height));
/* flush it */
rc.left=rc.top=0;
rc.right=width;
rc.bottom=height;
hBr=GetSysColorBrush(COLOR_BTNFACE);
- FillRect(hMemDC,&rc,hBr);
+ FillRect(hMemDC, &rc, hBr);
DeleteObject(hBr);
/* set up the pen */
- hPen=(HPEN)SelectObject(hMemDC,CreatePen(PS_SOLID,4,GetSysColor(COLOR_BTNSHADOW)));
+ hPen=(HPEN)SelectObject(hMemDC, CreatePen(PS_SOLID, 4, GetSysColor(COLOR_BTNSHADOW)));
/* draw everything before the pivot */
x=*pivot;
while (x>(-height)) {
- MoveToEx(hMemDC,x+height2,0,NULL);
- LineTo(hMemDC,x-height2,height);
+ MoveToEx(hMemDC, x+height2, 0, NULL);
+ LineTo(hMemDC, x-height2, height);
x-=12;
}
/* draw everything after the pivot */
x = *pivot;
while (x < width+height) {
- MoveToEx(hMemDC,x+height2,0,NULL);
- LineTo(hMemDC,x-height2,height);
+ MoveToEx(hMemDC, x+height2, 0, NULL);
+ LineTo(hMemDC, x-height2, height);
x+=12;
}
@@ -150,111 +150,111 @@ static void RenderThrobber(HDC hdc,RECT *rcItem,int *throbbing,int *pivot)
/* reset the pivot point if it gets past the rect */
if (*pivot>width) *pivot=0;
/* put back the old pen and delete the new one */
- DeleteObject(SelectObject(hMemDC,hPen));
+ DeleteObject(SelectObject(hMemDC, hPen));
/* cap the top and bottom */
- hPen=(HPEN)SelectObject(hMemDC,CreatePen(PS_SOLID,1,GetSysColor(COLOR_BTNFACE)));
- MoveToEx(hMemDC,0,0,NULL);
- LineTo(hMemDC,width,0);
- MoveToEx(hMemDC,0,height-1,NULL);
- LineTo(hMemDC,width,height-1);
+ hPen=(HPEN)SelectObject(hMemDC, CreatePen(PS_SOLID, 1, GetSysColor(COLOR_BTNFACE)));
+ MoveToEx(hMemDC, 0, 0, NULL);
+ LineTo(hMemDC, width, 0);
+ MoveToEx(hMemDC, 0, height-1, NULL);
+ LineTo(hMemDC, width, height-1);
/* select in the old pen and delete the new pen */
- DeleteObject(SelectObject(hMemDC,hPen));
+ DeleteObject(SelectObject(hMemDC, hPen));
/* paint to screen */
- BitBlt(hdc,rcItem->left,rcItem->top,width,height,hMemDC,0,0,SRCCOPY);
+ BitBlt(hdc, rcItem->left, rcItem->top, width, height, hMemDC, 0, 0, SRCCOPY);
/* select back in the old bitmap and delete the created one, as well as freeing the mem dc. */
- hBitmap=( HBITMAP )SelectObject(hMemDC,hBitmap);
+ hBitmap=( HBITMAP )SelectObject(hMemDC, hBitmap);
DeleteObject(hBitmap);
DeleteDC(hMemDC);
}
else {
/* just flush the DC */
hBr=GetSysColorBrush(COLOR_BTNFACE);
- FillRect(hdc,rcItem,hBr);
+ FillRect(hdc, rcItem, hBr);
DeleteObject(hBr);
} }
-static void StartThrobber(HWND hwndDlg,struct FindAddDlgData *dat)
+static void StartThrobber(HWND hwndDlg, struct FindAddDlgData *dat)
{
dat->throbbing=1;
- SetTimer(hwndDlg,TIMERID_THROBBER,25,NULL);
+ SetTimer(hwndDlg, TIMERID_THROBBER, 25, NULL);
}
-static void StopThrobber(HWND hwndDlg,struct FindAddDlgData *dat)
+static void StopThrobber(HWND hwndDlg, struct FindAddDlgData *dat)
{
- KillTimer(hwndDlg,TIMERID_THROBBER);
+ KillTimer(hwndDlg, TIMERID_THROBBER);
dat->throbbing=0;
dat->pivot=0;
- InvalidateRect(GetDlgItem(hwndDlg,IDC_STATUSBAR),NULL,FALSE);
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_STATUSBAR), NULL, FALSE);
}
-static void ShowAdvancedSearchDlg(HWND hwndDlg,struct FindAddDlgData *dat)
+static void ShowAdvancedSearchDlg(HWND hwndDlg, struct FindAddDlgData *dat)
{
- char *szProto=(char*)SendDlgItemMessage(hwndDlg,IDC_PROTOLIST,CB_GETITEMDATA,SendDlgItemMessage(hwndDlg,IDC_PROTOLIST,CB_GETCURSEL,0,0),0);
+ char *szProto=(char*)SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETCURSEL, 0, 0), 0);
if (szProto == NULL) return;
if (dat->hwndAdvSearch == NULL) {
RECT rc;
- dat->hwndAdvSearch=(HWND)CallProtoService(szProto,PS_CREATEADVSEARCHUI,0,(LPARAM)hwndDlg);
- GetWindowRect(GetDlgItem(hwndDlg,IDC_RESULTS),&rc);
- SetWindowPos(dat->hwndAdvSearch,0,rc.left,rc.top,0,0,SWP_NOZORDER|SWP_NOSIZE);
+ dat->hwndAdvSearch=(HWND)CallProtoService(szProto, PS_CREATEADVSEARCHUI, 0, (LPARAM)hwndDlg);
+ GetWindowRect(GetDlgItem(hwndDlg, IDC_RESULTS), &rc);
+ SetWindowPos(dat->hwndAdvSearch, 0, rc.left, rc.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE);
}
if (animateWindow) {
- animateWindow(dat->hwndAdvSearch,150,AW_ACTIVATE|AW_SLIDE|AW_HOR_POSITIVE);
- RedrawWindow(dat->hwndAdvSearch,NULL,NULL,RDW_INVALIDATE|RDW_UPDATENOW|RDW_ALLCHILDREN);
- } else ShowWindow(dat->hwndAdvSearch,SW_SHOW);
- CheckDlgButton(hwndDlg,IDC_ADVANCED,BST_CHECKED);
+ animateWindow(dat->hwndAdvSearch, 150, AW_ACTIVATE|AW_SLIDE|AW_HOR_POSITIVE);
+ RedrawWindow(dat->hwndAdvSearch, NULL, NULL, RDW_INVALIDATE|RDW_UPDATENOW|RDW_ALLCHILDREN);
+ } else ShowWindow(dat->hwndAdvSearch, SW_SHOW);
+ CheckDlgButton(hwndDlg, IDC_ADVANCED, BST_CHECKED);
}
-static void ReposTinySearchDlg(HWND hwndDlg,struct FindAddDlgData *dat)
+static void ReposTinySearchDlg(HWND hwndDlg, struct FindAddDlgData *dat)
{
if ( dat->hwndTinySearch != NULL ) {
RECT rc;
RECT clientRect;
- POINT pt={0,0};
- GetWindowRect(GetDlgItem(hwndDlg,IDC_TINYEXTENDEDGROUP),&rc);
- GetWindowRect(dat->hwndTinySearch,&clientRect);
+ POINT pt={0, 0};
+ GetWindowRect(GetDlgItem(hwndDlg, IDC_TINYEXTENDEDGROUP), &rc);
+ GetWindowRect(dat->hwndTinySearch, &clientRect);
pt.x=rc.left;
pt.y=rc.top;
- ScreenToClient(hwndDlg,&pt);
- SetWindowPos(dat->hwndTinySearch,0,pt.x+5,pt.y+15,rc.right-rc.left-10,rc.bottom-rc.top-30,SWP_NOZORDER);
- //SetWindowPos(GetDlgItem(hwndDlg,IDC_TINYEXTENDEDGROUP),0,0,0,rc.right-rc.left,clientRect.bottom-clientRect.top+20,SWP_NOMOVE|SWP_NOZORDER);
+ ScreenToClient(hwndDlg, &pt);
+ SetWindowPos(dat->hwndTinySearch, 0, pt.x+5, pt.y+15, rc.right-rc.left-10, rc.bottom-rc.top-30, SWP_NOZORDER);
+ //SetWindowPos(GetDlgItem(hwndDlg, IDC_TINYEXTENDEDGROUP), 0, 0, 0, rc.right-rc.left, clientRect.bottom-clientRect.top+20, SWP_NOMOVE|SWP_NOZORDER);
} }
-static void ShowTinySearchDlg(HWND hwndDlg,struct FindAddDlgData *dat)
+static void ShowTinySearchDlg(HWND hwndDlg, struct FindAddDlgData *dat)
{
- char *szProto=(char*)SendDlgItemMessage(hwndDlg,IDC_PROTOLIST,CB_GETITEMDATA,SendDlgItemMessage(hwndDlg,IDC_PROTOLIST,CB_GETCURSEL,0,0),0);
+ char *szProto=(char*)SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETCURSEL, 0, 0), 0);
if (szProto == NULL) return;
if (dat->hwndTinySearch == NULL) {
- dat->hwndTinySearch=(HWND)CallProtoService(szProto,PS_CREATEADVSEARCHUI,0,(LPARAM)/*GetDlgItem(*/hwndDlg/*,IDC_TINYEXTENDEDGROUP)*/);
+ dat->hwndTinySearch=(HWND)CallProtoService(szProto, PS_CREATEADVSEARCHUI, 0, (LPARAM)/*GetDlgItem(*/hwndDlg/*, IDC_TINYEXTENDEDGROUP)*/);
if (dat->hwndTinySearch)
ReposTinySearchDlg(hwndDlg, dat);
else
dat->showTiny = false;
}
- ShowWindow(dat->hwndTinySearch,SW_SHOW);
+ ShowWindow(dat->hwndTinySearch, SW_SHOW);
}
-static void HideAdvancedSearchDlg(HWND hwndDlg,struct FindAddDlgData *dat)
+static void HideAdvancedSearchDlg(HWND hwndDlg, struct FindAddDlgData *dat)
{
if (dat->hwndAdvSearch == NULL) return;
if (animateWindow && IsWinVerXPPlus()) //blending is quite slow on win2k
- animateWindow(dat->hwndAdvSearch,150,AW_HIDE|AW_BLEND);
- else ShowWindow(dat->hwndAdvSearch,SW_HIDE);
- CheckDlgButton(hwndDlg,IDC_ADVANCED,BST_UNCHECKED);
+ animateWindow(dat->hwndAdvSearch, 150, AW_HIDE|AW_BLEND);
+ else ShowWindow(dat->hwndAdvSearch, SW_HIDE);
+ CheckDlgButton(hwndDlg, IDC_ADVANCED, BST_UNCHECKED);
}
-void EnableResultButtons(HWND hwndDlg,int enable)
+void EnableResultButtons(HWND hwndDlg, int enable)
{
- EnableWindow(GetDlgItem(hwndDlg,IDC_ADD), enable || IsDlgButtonChecked(hwndDlg, IDC_BYPROTOID));
- EnableWindow(GetDlgItem(hwndDlg,IDC_MOREOPTIONS),enable);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ADD), enable || IsDlgButtonChecked(hwndDlg, IDC_BYPROTOID));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_MOREOPTIONS), enable);
}
-static void CheckSearchTypeRadioButton(HWND hwndDlg,int idControl)
+static void CheckSearchTypeRadioButton(HWND hwndDlg, int idControl)
{
int i;
- static const int controls[]={IDC_BYPROTOID,IDC_BYEMAIL,IDC_BYNAME,IDC_BYADVANCED,IDC_BYCUSTOM};
+ static const int controls[]={IDC_BYPROTOID, IDC_BYEMAIL, IDC_BYNAME, IDC_BYADVANCED, IDC_BYCUSTOM};
for ( i=0; i < SIZEOF(controls); i++ )
- CheckDlgButton(hwndDlg,controls[i],idControl == controls[i]?BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, controls[i], idControl == controls[i]?BST_CHECKED:BST_UNCHECKED);
}
#define sttErrMsg TranslateT("You haven't filled in the search field. Please enter a search term and try again.")
@@ -280,7 +280,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
switch (msg) {
case WM_INITDIALOG:
{
- int i,netProtoCount;
+ int i, netProtoCount;
COMBOBOXEXITEM cbei;
HICON hIcon;
@@ -291,16 +291,16 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
dat->notSearchedYet=1;
dat->iLastColumnSortIndex=1;
dat->bSortAscending=1;
- dat->hBmpSortUp=(HBITMAP)LoadImage(hMirandaInst,MAKEINTRESOURCE(IDB_SORTCOLUP),IMAGE_BITMAP,0,0,LR_LOADMAP3DCOLORS);
- dat->hBmpSortDown=(HBITMAP)LoadImage(hMirandaInst,MAKEINTRESOURCE(IDB_SORTCOLDOWN),IMAGE_BITMAP,0,0,LR_LOADMAP3DCOLORS);
- SendDlgItemMessage(hwndDlg,IDC_MOREOPTIONS,BUTTONSETARROW,1,0);
- ListView_SetExtendedListViewStyle(hwndList,LVS_EX_FULLROWSELECT|LVS_EX_HEADERDRAGDROP);
+ dat->hBmpSortUp=(HBITMAP)LoadImage(hMirandaInst, MAKEINTRESOURCE(IDB_SORTCOLUP), IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS);
+ dat->hBmpSortDown=(HBITMAP)LoadImage(hMirandaInst, MAKEINTRESOURCE(IDB_SORTCOLDOWN), IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS);
+ SendDlgItemMessage(hwndDlg, IDC_MOREOPTIONS, BUTTONSETARROW, 1, 0);
+ ListView_SetExtendedListViewStyle(hwndList, LVS_EX_FULLROWSELECT|LVS_EX_HEADERDRAGDROP);
{ LVCOLUMN lvc;
RECT rc;
LVITEM lvi;
- GetClientRect(hwndList,&rc);
+ GetClientRect(hwndList, &rc);
lvc.mask = LVCF_TEXT | LVCF_WIDTH;
lvc.pszText = TranslateT("Results");
lvc.cx = rc.right-1;
@@ -317,18 +317,18 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
SIZE textSize;
HDC hdc;
- hdc=GetDC(GetDlgItem(hwndDlg,IDC_STATUSBAR));
- SelectObject(hdc,(HFONT)SendDlgItemMessage(hwndDlg,IDC_STATUSBAR,WM_GETFONT,0,0));
- GetTextExtentPoint32(hdc,TranslateT("Searching"),lstrlen(TranslateT("Searching")),&textSize);
+ hdc=GetDC(GetDlgItem(hwndDlg, IDC_STATUSBAR));
+ SelectObject(hdc, (HFONT)SendDlgItemMessage(hwndDlg, IDC_STATUSBAR, WM_GETFONT, 0, 0));
+ GetTextExtentPoint32(hdc, TranslateT("Searching"), lstrlen(TranslateT("Searching")), &textSize);
partWidth[0]=textSize.cx;
- GetTextExtentPoint32(hdc,_T("01234567890123456789"), 20, &textSize );
+ GetTextExtentPoint32(hdc, _T("01234567890123456789"), 20, &textSize );
partWidth[0]+=textSize.cx;
- ReleaseDC(GetDlgItem(hwndDlg,IDC_STATUSBAR),hdc);
+ ReleaseDC(GetDlgItem(hwndDlg, IDC_STATUSBAR), hdc);
partWidth[1]=partWidth[0]+150;
partWidth[2]=-1;
- SendDlgItemMessage(hwndDlg,IDC_STATUSBAR,SB_SETPARTS,SIZEOF(partWidth),(LPARAM)partWidth);
- SendDlgItemMessage(hwndDlg,IDC_STATUSBAR,SB_SETTEXT,1|SBT_OWNERDRAW,0);
- SetStatusBarSearchInfo(GetDlgItem(hwndDlg,IDC_STATUSBAR),dat);
+ SendDlgItemMessage(hwndDlg, IDC_STATUSBAR, SB_SETPARTS, SIZEOF(partWidth), (LPARAM)partWidth);
+ SendDlgItemMessage(hwndDlg, IDC_STATUSBAR, SB_SETTEXT, 1|SBT_OWNERDRAW, 0);
+ SetStatusBarSearchInfo(GetDlgItem(hwndDlg, IDC_STATUSBAR), dat);
}
{
TCHAR *szProto = NULL;
@@ -348,19 +348,19 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
if (caps & PF1_BASICSEARCH || caps & PF1_EXTSEARCH || caps & PF1_SEARCHBYEMAIL || caps & PF1_SEARCHBYNAME)
netProtoCount++;
}
- dat->himlComboIcons=ImageList_Create(GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),(IsWinVerXPPlus()?ILC_COLOR32:ILC_COLOR16)|ILC_MASK,netProtoCount+1,netProtoCount+1);
- SendDlgItemMessage(hwndDlg,IDC_PROTOLIST,CBEM_SETIMAGELIST,0,(LPARAM)dat->himlComboIcons);
+ dat->himlComboIcons=ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), (IsWinVerXPPlus()?ILC_COLOR32:ILC_COLOR16)|ILC_MASK, netProtoCount+1, netProtoCount+1);
+ SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CBEM_SETIMAGELIST, 0, (LPARAM)dat->himlComboIcons);
cbei.mask=CBEIF_IMAGE|CBEIF_SELECTEDIMAGE|CBEIF_TEXT|CBEIF_LPARAM;
cbei.iItem=0;
hdc=GetDC(hwndDlg);
- SelectObject(hdc,(HFONT)SendDlgItemMessage(hwndDlg,IDC_PROTOLIST,WM_GETFONT,0,0));
+ SelectObject(hdc, (HFONT)SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, WM_GETFONT, 0, 0));
if (netProtoCount>1) {
cbei.pszText=TranslateT("All Networks");
- GetTextExtentPoint32(hdc,cbei.pszText,lstrlen(cbei.pszText),&textSize);
+ GetTextExtentPoint32(hdc, cbei.pszText, lstrlen(cbei.pszText), &textSize);
if (textSize.cx>cbwidth) cbwidth = textSize.cx;
cbei.iImage=cbei.iSelectedImage=ImageList_AddIcon_IconLibLoaded(dat->himlComboIcons, SKINICON_OTHER_SEARCHALL);
cbei.lParam=0;
- SendDlgItemMessage(hwndDlg,IDC_PROTOLIST,CBEM_INSERTITEM,0,(LPARAM)&cbei);
+ SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CBEM_INSERTITEM, 0, (LPARAM)&cbei);
cbei.iItem++;
}
for ( i=0; i < accounts.getCount(); i++ ) {
@@ -371,26 +371,26 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
continue;
cbei.pszText = pa->tszAccountName;
- GetTextExtentPoint32(hdc,cbei.pszText,lstrlen(cbei.pszText),&textSize);
+ GetTextExtentPoint32(hdc, cbei.pszText, lstrlen(cbei.pszText), &textSize);
if (textSize.cx>cbwidth) cbwidth = textSize.cx;
- hIcon=(HICON)CallProtoService( pa->szModuleName,PS_LOADICON,PLI_PROTOCOL|PLIF_SMALL,0);
- cbei.iImage=cbei.iSelectedImage=ImageList_AddIcon(dat->himlComboIcons,hIcon);
+ hIcon=(HICON)CallProtoService( pa->szModuleName, PS_LOADICON, PLI_PROTOCOL|PLIF_SMALL, 0);
+ cbei.iImage=cbei.iSelectedImage=ImageList_AddIcon(dat->himlComboIcons, hIcon);
DestroyIcon(hIcon);
cbei.lParam=(LPARAM)pa->szModuleName;
- SendDlgItemMessageA(hwndDlg,IDC_PROTOLIST,CBEM_INSERTITEM,0,(LPARAM)&cbei);
+ SendDlgItemMessageA(hwndDlg, IDC_PROTOLIST, CBEM_INSERTITEM, 0, (LPARAM)&cbei);
if (szProto && cbei.pszText && !lstrcmp( szProto, pa->tszAccountName ))
index = cbei.iItem;
cbei.iItem++;
}
cbwidth+=32;
- SendDlgItemMessage(hwndDlg,IDC_PROTOLIST,CB_GETDROPPEDCONTROLRECT,0,(LPARAM)&rect);
+ SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETDROPPEDCONTROLRECT, 0, (LPARAM)&rect);
if ((rect.right-rect.left)<cbwidth)
- SendDlgItemMessage(hwndDlg,IDC_PROTOLIST,CB_SETDROPPEDWIDTH,cbwidth,0);
- SendDlgItemMessage(hwndDlg,IDC_PROTOLIST,CB_SETCURSEL,index,0);
+ SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_SETDROPPEDWIDTH, cbwidth, 0);
+ SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_SETCURSEL, index, 0);
DBFreeVariant(&dbv); /* free string szProto was fetched with */
}
- SendMessage(hwndDlg,M_SETGROUPVISIBILITIES,0,0);
- Utils_RestoreWindowPosition(hwndDlg,NULL,"FindAdd","");
+ SendMessage(hwndDlg, M_SETGROUPVISIBILITIES, 0, 0);
+ Utils_RestoreWindowPosition(hwndDlg, NULL, "FindAdd", "");
return TRUE;
}
@@ -402,13 +402,13 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
urd.lpTemplate=MAKEINTRESOURCEA(IDD_FINDADD);
urd.lParam=(LPARAM)dat;
urd.pfnResizer=FindAddDlgResizer;
- CallService(MS_UTILS_RESIZEDIALOG,0,(LPARAM)&urd);
+ CallService(MS_UTILS_RESIZEDIALOG, 0, (LPARAM)&urd);
ReposTinySearchDlg(hwndDlg, dat);
- SendDlgItemMessage(hwndDlg,IDC_STATUSBAR,WM_SIZE,0,0);
+ SendDlgItemMessage(hwndDlg, IDC_STATUSBAR, WM_SIZE, 0, 0);
if (dat->notSearchedYet) {
RECT rc;
- GetClientRect(hwndList,&rc);
- ListView_SetColumnWidth(hwndList,0,rc.right);
+ GetClientRect(hwndList, &rc);
+ ListView_SetColumnWidth(hwndList, 0, rc.right);
}
}
//fall through
@@ -416,23 +416,23 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
if (dat && dat->hwndAdvSearch)
{
RECT rc;
- GetWindowRect(hwndList,&rc);
- SetWindowPos(dat->hwndAdvSearch,0,rc.left,rc.top,0,0,SWP_NOZORDER|SWP_NOSIZE);
+ GetWindowRect(hwndList, &rc);
+ SetWindowPos(dat->hwndAdvSearch, 0, rc.left, rc.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE);
}
break;
case WM_GETMINMAXINFO:
{ MINMAXINFO *mmi=(MINMAXINFO*)lParam;
- RECT rc,rc2;
- GetWindowRect(hwndList,&rc);
- GetWindowRect(hwndDlg,&rc2);
+ RECT rc, rc2;
+ GetWindowRect(hwndList, &rc);
+ GetWindowRect(hwndDlg, &rc2);
mmi->ptMinTrackSize.x=rc.left-rc2.left+10+GetSystemMetrics(SM_CXFRAME);
- GetClientRect(GetDlgItem(hwndDlg,IDC_MOREOPTIONS),&rc);
+ GetClientRect(GetDlgItem(hwndDlg, IDC_MOREOPTIONS), &rc);
mmi->ptMinTrackSize.x+=rc.right+5;
- GetClientRect(GetDlgItem(hwndDlg,IDC_ADD),&rc);
+ GetClientRect(GetDlgItem(hwndDlg, IDC_ADD), &rc);
mmi->ptMinTrackSize.x+=rc.right+5;
- GetClientRect(GetDlgItem(hwndDlg,IDC_STATUSBAR),&rc);
+ GetClientRect(GetDlgItem(hwndDlg, IDC_STATUSBAR), &rc);
mmi->ptMinTrackSize.y=dat->minDlgHeight+20+GetSystemMetrics(SM_CYCAPTION)+2*GetSystemMetrics(SM_CYFRAME);
- GetClientRect(GetDlgItem(hwndDlg,IDC_STATUSBAR),&rc);
+ GetClientRect(GetDlgItem(hwndDlg, IDC_STATUSBAR), &rc);
mmi->ptMinTrackSize.y+=rc.bottom;
return 0;
}
@@ -445,20 +445,20 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
int checkmarkVisible;
dat->showAdvanced = dat->showEmail = dat->showName = dat->showProtoId = dat->showTiny = 0;
- szProto=(char*)SendDlgItemMessage(hwndDlg,IDC_PROTOLIST,CB_GETITEMDATA,SendDlgItemMessage(hwndDlg,IDC_PROTOLIST,CB_GETCURSEL,0,0),0);
+ szProto=(char*)SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETCURSEL, 0, 0), 0);
if ( szProto == (char *)CB_ERR )
break;
if ( szProto == NULL ) {
for ( i=0; i < accounts.getCount(); i++ ) {
PROTOACCOUNT* pa = accounts[i];
if (!Proto_IsAccountEnabled(pa)) continue;
- protoCaps=(DWORD)CallProtoService(pa->szModuleName,PS_GETCAPS,PFLAGNUM_1,0);
+ protoCaps=(DWORD)CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0);
if (protoCaps&PF1_SEARCHBYEMAIL) dat->showEmail=1;
if (protoCaps&PF1_SEARCHBYNAME) dat->showName=1;
}
}
else {
- protoCaps=(DWORD)CallProtoService(szProto,PS_GETCAPS,PFLAGNUM_1,0);
+ protoCaps=(DWORD)CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0);
if (protoCaps&PF1_BASICSEARCH) dat->showProtoId=1;
if (protoCaps&PF1_SEARCHBYEMAIL) dat->showEmail=1;
if (protoCaps&PF1_SEARCHBYNAME) dat->showName=1;
@@ -467,19 +467,19 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
if (protoCaps&PF1_USERIDISEMAIL && dat->showProtoId) {dat->showProtoId=0; dat->showEmail=1;}
if (dat->showProtoId) {
char *szUniqueId;
- szUniqueId=(char*)CallProtoService(szProto,PS_GETCAPS,PFLAG_UNIQUEIDTEXT,0);
+ szUniqueId=(char*)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDTEXT, 0);
if (szUniqueId) {
#if defined( _UNICODE )
TCHAR* p = mir_a2u(szUniqueId);
- SetDlgItemText(hwndDlg,IDC_BYPROTOID,p);
+ SetDlgItemText(hwndDlg, IDC_BYPROTOID, p);
mir_free(p);
#else
- SetDlgItemTextA(hwndDlg,IDC_BYPROTOID,szUniqueId);
+ SetDlgItemTextA(hwndDlg, IDC_BYPROTOID, szUniqueId);
#endif
}
- else SetDlgItemText(hwndDlg,IDC_BYPROTOID,TranslateT("Handle"));
- if (protoCaps&PF1_NUMERICUSERID) SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_PROTOID),GWL_STYLE,GetWindowLongPtr(GetDlgItem(hwndDlg,IDC_PROTOID),GWL_STYLE)|ES_NUMBER);
- else SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_PROTOID),GWL_STYLE,GetWindowLongPtr(GetDlgItem(hwndDlg,IDC_PROTOID),GWL_STYLE)&~ES_NUMBER);
+ else SetDlgItemText(hwndDlg, IDC_BYPROTOID, TranslateT("Handle"));
+ if (protoCaps&PF1_NUMERICUSERID) SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_PROTOID), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_PROTOID), GWL_STYLE)|ES_NUMBER);
+ else SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_PROTOID), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_PROTOID), GWL_STYLE)&~ES_NUMBER);
}
}
@@ -491,34 +491,34 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
dat->hwndTinySearch=NULL;
} }
-#define en(id,t) ShowWindow(GetDlgItem(hwndDlg,IDC_##id),dat->show##t?SW_SHOW:SW_HIDE)
- en(PROTOIDGROUP,ProtoId); en(BYPROTOID,ProtoId); en(PROTOID,ProtoId);
- en(EMAILGROUP,Email); en(BYEMAIL,Email); en(EMAIL,Email);
- en(NAMEGROUP,Name); en(BYNAME,Name);
- en(STNAMENICK,Name); en(NAMENICK,Name);
- en(STNAMEFIRST,Name); en(NAMEFIRST,Name);
- en(STNAMELAST,Name); en(NAMELAST,Name);
- en(ADVANCEDGROUP,Advanced); en(BYADVANCED,Advanced); en(ADVANCED,Advanced);
+#define en(id, t) ShowWindow(GetDlgItem(hwndDlg, IDC_##id), dat->show##t?SW_SHOW:SW_HIDE)
+ en(PROTOIDGROUP, ProtoId); en(BYPROTOID, ProtoId); en(PROTOID, ProtoId);
+ en(EMAILGROUP, Email); en(BYEMAIL, Email); en(EMAIL, Email);
+ en(NAMEGROUP, Name); en(BYNAME, Name);
+ en(STNAMENICK, Name); en(NAMENICK, Name);
+ en(STNAMEFIRST, Name); en(NAMEFIRST, Name);
+ en(STNAMELAST, Name); en(NAMELAST, Name);
+ en(ADVANCEDGROUP, Advanced); en(BYADVANCED, Advanced); en(ADVANCED, Advanced);
en(BYCUSTOM, Tiny); en(TINYEXTENDEDGROUP, Tiny);
#undef en
- checkmarkVisible=(dat->showAdvanced && IsDlgButtonChecked(hwndDlg,IDC_BYADVANCED)) ||
- (dat->showEmail && IsDlgButtonChecked(hwndDlg,IDC_BYEMAIL)) ||
- (dat->showTiny && IsDlgButtonChecked(hwndDlg,IDC_BYCUSTOM)) ||
- (dat->showName && IsDlgButtonChecked(hwndDlg,IDC_BYNAME)) ||
- (dat->showProtoId && IsDlgButtonChecked(hwndDlg,IDC_BYPROTOID));
+ checkmarkVisible=(dat->showAdvanced && IsDlgButtonChecked(hwndDlg, IDC_BYADVANCED)) ||
+ (dat->showEmail && IsDlgButtonChecked(hwndDlg, IDC_BYEMAIL)) ||
+ (dat->showTiny && IsDlgButtonChecked(hwndDlg, IDC_BYCUSTOM)) ||
+ (dat->showName && IsDlgButtonChecked(hwndDlg, IDC_BYNAME)) ||
+ (dat->showProtoId && IsDlgButtonChecked(hwndDlg, IDC_BYPROTOID));
if (!checkmarkVisible) {
- if (dat->showProtoId) CheckSearchTypeRadioButton(hwndDlg,IDC_BYPROTOID);
- else if (dat->showEmail) CheckSearchTypeRadioButton(hwndDlg,IDC_BYEMAIL);
- else if (dat->showName) CheckSearchTypeRadioButton(hwndDlg,IDC_BYNAME);
- else if (dat->showAdvanced) CheckSearchTypeRadioButton(hwndDlg,IDC_BYADVANCED);
- else if (dat->showTiny) CheckSearchTypeRadioButton(hwndDlg,IDC_BYCUSTOM);
+ if (dat->showProtoId) CheckSearchTypeRadioButton(hwndDlg, IDC_BYPROTOID);
+ else if (dat->showEmail) CheckSearchTypeRadioButton(hwndDlg, IDC_BYEMAIL);
+ else if (dat->showName) CheckSearchTypeRadioButton(hwndDlg, IDC_BYNAME);
+ else if (dat->showAdvanced) CheckSearchTypeRadioButton(hwndDlg, IDC_BYADVANCED);
+ else if (dat->showTiny) CheckSearchTypeRadioButton(hwndDlg, IDC_BYCUSTOM);
}
- SendMessage(hwndDlg,WM_SIZE,0,0);
- SendMessage(hwndDlg,WM_GETMINMAXINFO,0,(LPARAM)&mmi);
- GetWindowRect(hwndDlg,&rc);
- if (rc.bottom-rc.top<mmi.ptMinTrackSize.y) SetWindowPos(hwndDlg,0,0,0,rc.right-rc.left,mmi.ptMinTrackSize.y,SWP_NOZORDER|SWP_NOMOVE);
+ SendMessage(hwndDlg, WM_SIZE, 0, 0);
+ SendMessage(hwndDlg, WM_GETMINMAXINFO, 0, (LPARAM)&mmi);
+ GetWindowRect(hwndDlg, &rc);
+ if (rc.bottom-rc.top<mmi.ptMinTrackSize.y) SetWindowPos(hwndDlg, 0, 0, 0, rc.right-rc.left, mmi.ptMinTrackSize.y, SWP_NOZORDER|SWP_NOMOVE);
break;
}
case WM_TIMER:
@@ -526,18 +526,18 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
RECT rc;
HDC hdc;
int borders[3];
- SendDlgItemMessage(hwndDlg,IDC_STATUSBAR,SB_GETBORDERS,0,(LPARAM)borders);
- SendDlgItemMessage(hwndDlg,IDC_STATUSBAR,SB_GETRECT,1,(LPARAM)&rc);
- InflateRect(&rc,-borders[2]/2,-borders[1]/2);
- hdc=GetDC(GetDlgItem(hwndDlg,IDC_STATUSBAR));
- RenderThrobber(hdc,&rc,&dat->throbbing,&dat->pivot);
- ReleaseDC(GetDlgItem(hwndDlg,IDC_STATUSBAR),hdc);
+ SendDlgItemMessage(hwndDlg, IDC_STATUSBAR, SB_GETBORDERS, 0, (LPARAM)borders);
+ SendDlgItemMessage(hwndDlg, IDC_STATUSBAR, SB_GETRECT, 1, (LPARAM)&rc);
+ InflateRect(&rc, -borders[2]/2, -borders[1]/2);
+ hdc=GetDC(GetDlgItem(hwndDlg, IDC_STATUSBAR));
+ RenderThrobber(hdc, &rc, &dat->throbbing, &dat->pivot);
+ ReleaseDC(GetDlgItem(hwndDlg, IDC_STATUSBAR), hdc);
}
break;
case WM_DRAWITEM:
{ DRAWITEMSTRUCT *dis=(DRAWITEMSTRUCT*)lParam;
if (dis->CtlID == IDC_STATUSBAR && dis->itemID == 1) {
- RenderThrobber(dis->hDC,&dis->rcItem,&dat->throbbing,&dat->pivot);
+ RenderThrobber(dis->hDC, &dis->rcItem, &dat->throbbing, &dat->pivot);
return TRUE;
}
break;
@@ -548,7 +548,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
case LVN_ITEMCHANGED:
{ int count=ListView_GetSelectedCount(hwndList);
if (dat->notSearchedYet) count=0;
- EnableResultButtons(hwndDlg,count);
+ EnableResultButtons(hwndDlg, count);
break;
}
case LVN_COLUMNCLICK:
@@ -558,7 +558,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
hdi.mask=HDI_BITMAP|HDI_FORMAT;
hdi.fmt=HDF_LEFT|HDF_STRING;
- Header_SetItem(ListView_GetHeader(hwndList),dat->iLastColumnSortIndex,&hdi);
+ Header_SetItem(ListView_GetHeader(hwndList), dat->iLastColumnSortIndex, &hdi);
if (nmlv->iSubItem != dat->iLastColumnSortIndex)
{
@@ -569,7 +569,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
hdi.fmt=HDF_LEFT|HDF_BITMAP|HDF_STRING|HDF_BITMAP_ON_RIGHT;
hdi.hbm=dat->bSortAscending?dat->hBmpSortDown:dat->hBmpSortUp;
- Header_SetItem(ListView_GetHeader(hwndList),dat->iLastColumnSortIndex,&hdi);
+ Header_SetItem(ListView_GetHeader(hwndList), dat->iLastColumnSortIndex, &hdi);
ListView_SortItemsEx(hwndList, SearchResultsCompareFunc, (LPARAM)hwndDlg);
}
@@ -581,7 +581,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
switch(LOWORD(wParam)) {
case IDC_PROTOLIST:
if (HIWORD(wParam) == CBN_SELCHANGE) {
- HideAdvancedSearchDlg(hwndDlg,dat);
+ HideAdvancedSearchDlg(hwndDlg, dat);
if (dat->hwndAdvSearch) {
DestroyWindow(dat->hwndAdvSearch);
dat->hwndAdvSearch=NULL;
@@ -590,107 +590,107 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
DestroyWindow(dat->hwndTinySearch);
dat->hwndTinySearch=NULL;
}
- SendMessage(hwndDlg,M_SETGROUPVISIBILITIES,0,0);
+ SendMessage(hwndDlg, M_SETGROUPVISIBILITIES, 0, 0);
}
break;
case IDC_BYPROTOID:
- EnableWindow(GetDlgItem(hwndDlg,IDC_ADD),TRUE);
- HideAdvancedSearchDlg(hwndDlg,dat);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ADD), TRUE);
+ HideAdvancedSearchDlg(hwndDlg, dat);
break;
case IDC_BYEMAIL:
case IDC_BYNAME:
- EnableWindow(GetDlgItem(hwndDlg,IDC_ADD), ListView_GetSelectedCount(hwndList) > 0);
- HideAdvancedSearchDlg(hwndDlg,dat);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ADD), ListView_GetSelectedCount(hwndList) > 0);
+ HideAdvancedSearchDlg(hwndDlg, dat);
break;
case IDC_PROTOID:
if (HIWORD(wParam) == EN_CHANGE) {
- HideAdvancedSearchDlg(hwndDlg,dat);
- CheckSearchTypeRadioButton(hwndDlg,IDC_BYPROTOID);
- EnableWindow(GetDlgItem(hwndDlg,IDC_ADD),TRUE);
+ HideAdvancedSearchDlg(hwndDlg, dat);
+ CheckSearchTypeRadioButton(hwndDlg, IDC_BYPROTOID);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ADD), TRUE);
}
break;
case IDC_EMAIL:
if (HIWORD(wParam) == EN_CHANGE) {
- HideAdvancedSearchDlg(hwndDlg,dat);
- CheckSearchTypeRadioButton(hwndDlg,IDC_BYEMAIL);
+ HideAdvancedSearchDlg(hwndDlg, dat);
+ CheckSearchTypeRadioButton(hwndDlg, IDC_BYEMAIL);
}
break;
case IDC_NAMENICK:
case IDC_NAMEFIRST:
case IDC_NAMELAST:
if (HIWORD(wParam) == EN_CHANGE) {
- HideAdvancedSearchDlg(hwndDlg,dat);
- CheckSearchTypeRadioButton(hwndDlg,IDC_BYNAME);
+ HideAdvancedSearchDlg(hwndDlg, dat);
+ CheckSearchTypeRadioButton(hwndDlg, IDC_BYNAME);
}
break;
case IDC_ADVANCED:
- EnableWindow(GetDlgItem(hwndDlg,IDC_ADD), ListView_GetSelectedCount(hwndList) > 0);
- if (IsDlgButtonChecked(hwndDlg,IDC_ADVANCED))
- ShowAdvancedSearchDlg(hwndDlg,dat);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ADD), ListView_GetSelectedCount(hwndList) > 0);
+ if (IsDlgButtonChecked(hwndDlg, IDC_ADVANCED))
+ ShowAdvancedSearchDlg(hwndDlg, dat);
else
- HideAdvancedSearchDlg(hwndDlg,dat);
- CheckSearchTypeRadioButton(hwndDlg,IDC_BYADVANCED);
+ HideAdvancedSearchDlg(hwndDlg, dat);
+ CheckSearchTypeRadioButton(hwndDlg, IDC_BYADVANCED);
break;
case IDCANCEL:
DestroyWindow(hwndDlg);
break;
case IDOK:
{
- HideAdvancedSearchDlg(hwndDlg,dat);
+ HideAdvancedSearchDlg(hwndDlg, dat);
if (dat->searchCount) { //cancel search
- SetDlgItemText(hwndDlg,IDOK,TranslateT("&Search"));
+ SetDlgItemText(hwndDlg, IDOK, TranslateT("&Search"));
if (dat->hResultHook) {UnhookEvent(dat->hResultHook); dat->hResultHook=NULL;}
if (dat->search) {mir_free(dat->search); dat->search=NULL;}
dat->searchCount=0;
- StopThrobber(hwndDlg,dat);
- SetStatusBarSearchInfo(GetDlgItem(hwndDlg,IDC_STATUSBAR),dat);
+ StopThrobber(hwndDlg, dat);
+ SetStatusBarSearchInfo(GetDlgItem(hwndDlg, IDC_STATUSBAR), dat);
break;
}
- char *szProto=(char*)SendDlgItemMessage(hwndDlg,IDC_PROTOLIST,CB_GETITEMDATA,SendDlgItemMessage(hwndDlg,IDC_PROTOLIST,CB_GETCURSEL,0,0),0);
+ char *szProto=(char*)SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETCURSEL, 0, 0), 0);
if (dat->search) {mir_free(dat->search); dat->search=NULL;}
dat->searchCount=0;
- dat->hResultHook=HookEventMessage(ME_PROTO_ACK,hwndDlg,HM_SEARCHACK);
- if (IsDlgButtonChecked(hwndDlg,IDC_BYCUSTOM))
+ dat->hResultHook=HookEventMessage(ME_PROTO_ACK, hwndDlg, HM_SEARCHACK);
+ if (IsDlgButtonChecked(hwndDlg, IDC_BYCUSTOM))
{
- BeginSearch(hwndDlg,dat,szProto,PS_SEARCHBYADVANCED,PF1_EXTSEARCHUI,dat->hwndTinySearch);
+ BeginSearch(hwndDlg, dat, szProto, PS_SEARCHBYADVANCED, PF1_EXTSEARCHUI, dat->hwndTinySearch);
}
- else if (IsDlgButtonChecked(hwndDlg,IDC_BYPROTOID)) {
+ else if (IsDlgButtonChecked(hwndDlg, IDC_BYPROTOID)) {
TCHAR str[256];
- GetDlgItemText(hwndDlg,IDC_PROTOID,str,SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_PROTOID, str, SIZEOF(str));
rtrim(str);
if (str[0] == 0)
- MessageBox(hwndDlg,sttErrMsg,sttErrTitle,MB_OK);
+ MessageBox(hwndDlg, sttErrMsg, sttErrTitle, MB_OK);
else
- BeginSearch(hwndDlg,dat,szProto,PS_BASICSEARCHT,PF1_BASICSEARCH,str);
+ BeginSearch(hwndDlg, dat, szProto, PS_BASICSEARCHT, PF1_BASICSEARCH, str);
}
- else if (IsDlgButtonChecked(hwndDlg,IDC_BYEMAIL)) {
+ else if (IsDlgButtonChecked(hwndDlg, IDC_BYEMAIL)) {
TCHAR str[256];
- GetDlgItemText(hwndDlg,IDC_EMAIL,str,SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_EMAIL, str, SIZEOF(str));
rtrim(str);
if (str[0] == 0)
- MessageBox(hwndDlg,sttErrMsg,sttErrTitle,MB_OK);
+ MessageBox(hwndDlg, sttErrMsg, sttErrTitle, MB_OK);
else
- BeginSearch(hwndDlg,dat,szProto,PS_SEARCHBYEMAILT,PF1_SEARCHBYEMAIL,str);
+ BeginSearch(hwndDlg, dat, szProto, PS_SEARCHBYEMAILT, PF1_SEARCHBYEMAIL, str);
}
- else if (IsDlgButtonChecked(hwndDlg,IDC_BYNAME)) {
- TCHAR nick[256],first[256],last[256];
+ else if (IsDlgButtonChecked(hwndDlg, IDC_BYNAME)) {
+ TCHAR nick[256], first[256], last[256];
PROTOSEARCHBYNAME psbn;
- GetDlgItemText(hwndDlg,IDC_NAMENICK,nick,SIZEOF(nick));
- GetDlgItemText(hwndDlg,IDC_NAMEFIRST,first,SIZEOF(first));
- GetDlgItemText(hwndDlg,IDC_NAMELAST,last,SIZEOF(last));
+ GetDlgItemText(hwndDlg, IDC_NAMENICK, nick, SIZEOF(nick));
+ GetDlgItemText(hwndDlg, IDC_NAMEFIRST, first, SIZEOF(first));
+ GetDlgItemText(hwndDlg, IDC_NAMELAST, last, SIZEOF(last));
psbn.pszFirstName = first;
psbn.pszLastName = last;
psbn.pszNick = nick;
if (nick[0] == 0 && first[0] == 0 && last[0] == 0)
- MessageBox(hwndDlg,sttErrMsg,sttErrTitle,MB_OK);
+ MessageBox(hwndDlg, sttErrMsg, sttErrTitle, MB_OK);
else
- BeginSearch(hwndDlg,dat,szProto,PS_SEARCHBYNAMET,PF1_SEARCHBYNAME,&psbn);
+ BeginSearch(hwndDlg, dat, szProto, PS_SEARCHBYNAMET, PF1_SEARCHBYNAME, &psbn);
}
- else if (IsDlgButtonChecked(hwndDlg,IDC_BYADVANCED)) {
+ else if (IsDlgButtonChecked(hwndDlg, IDC_BYADVANCED)) {
if (dat->hwndAdvSearch == NULL)
- MessageBox(hwndDlg,sttErrMsg,sttErrTitle,MB_OK);
+ MessageBox(hwndDlg, sttErrMsg, sttErrTitle, MB_OK);
else
- BeginSearch(hwndDlg,dat,szProto,PS_SEARCHBYADVANCED,PF1_EXTSEARCHUI,dat->hwndAdvSearch);
+ BeginSearch(hwndDlg, dat, szProto, PS_SEARCHBYADVANCED, PF1_EXTSEARCHUI, dat->hwndAdvSearch);
}
if (dat->searchCount == 0) {
@@ -701,10 +701,10 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
dat->notSearchedYet=0;
FreeSearchResults(hwndList);
- CreateResultsColumns(hwndList,dat,szProto);
- SetStatusBarSearchInfo(GetDlgItem(hwndDlg,IDC_STATUSBAR),dat);
+ CreateResultsColumns(hwndList, dat, szProto);
+ SetStatusBarSearchInfo(GetDlgItem(hwndDlg, IDC_STATUSBAR), dat);
SetStatusBarResultInfo(hwndDlg);
- StartThrobber(hwndDlg,dat);
+ StartThrobber(hwndDlg, dat);
SetDlgItemText(hwndDlg, IDOK, TranslateT("Cancel"));
break;
}
@@ -734,7 +734,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
psr.id = str;
acs.psr = &psr;
- acs.szProto = (char*)SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETITEMDATA,
+ acs.szProto = (char*)SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETITEMDATA,
SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETCURSEL, 0, 0), 0);
}
@@ -744,8 +744,8 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
}
case IDC_MOREOPTIONS:
{ RECT rc;
- GetWindowRect(GetDlgItem(hwndDlg,IDC_MOREOPTIONS),&rc);
- ShowMoreOptionsMenu(hwndDlg,rc.left,rc.bottom);
+ GetWindowRect(GetDlgItem(hwndDlg, IDC_MOREOPTIONS), &rc);
+ ShowMoreOptionsMenu(hwndDlg, rc.left, rc.bottom);
break;
}
}
@@ -761,13 +761,13 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
pt.x=(short)LOWORD(lParam); pt.y=(short)HIWORD(lParam);
lvhti.pt=pt;
- ScreenToClient(hwndDlg,&pt);
- switch(GetDlgCtrlID(ChildWindowFromPoint(hwndDlg,pt))) {
+ ScreenToClient(hwndDlg, &pt);
+ switch(GetDlgCtrlID(ChildWindowFromPoint(hwndDlg, pt))) {
case IDC_RESULTS:
if (dat->notSearchedYet) return TRUE;
- ScreenToClient(hwndList,&lvhti.pt);
- if (ListView_HitTest(hwndList,&lvhti) == -1) break;
- ShowMoreOptionsMenu(hwndDlg,(short)LOWORD(lParam),(short)HIWORD(lParam));
+ ScreenToClient(hwndList, &lvhti.pt);
+ if (ListView_HitTest(hwndList, &lvhti) == -1) break;
+ ShowMoreOptionsMenu(hwndDlg, (short)LOWORD(lParam), (short)HIWORD(lParam));
return TRUE;
}
break;
@@ -778,21 +778,21 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
if (ack->type != ACKTYPE_SEARCH) break;
for (i=0;i<dat->searchCount;i++)
- if (dat->search[i].hProcess == ack->hProcess && dat->search[i].hProcess != NULL && !lstrcmpA(dat->search[i].szProto,ack->szModule)) break;
+ if (dat->search[i].hProcess == ack->hProcess && dat->search[i].hProcess != NULL && !lstrcmpA(dat->search[i].szProto, ack->szModule)) break;
if (i == dat->searchCount) break;
if (ack->result == ACKRESULT_SUCCESS || ack->result == ACKRESULT_FAILED) {
dat->searchCount--;
- memmove(dat->search+i,dat->search+i+1,sizeof(struct ProtoSearchInfo)*(dat->searchCount-i));
+ memmove(dat->search+i, dat->search+i+1, sizeof(struct ProtoSearchInfo)*(dat->searchCount-i));
if (dat->searchCount == 0) {
mir_free(dat->search);
dat->search=NULL;
UnhookEvent(dat->hResultHook);
dat->hResultHook=NULL;
SetDlgItemText(hwndDlg, IDOK, TranslateT("&Search"));
- StopThrobber(hwndDlg,dat);
+ StopThrobber(hwndDlg, dat);
}
ListView_SortItemsEx(hwndList, SearchResultsCompareFunc, (LPARAM)hwndDlg);
- SetStatusBarSearchInfo(GetDlgItem(hwndDlg,IDC_STATUSBAR),dat);
+ SetStatusBarSearchInfo(GetDlgItem(hwndDlg, IDC_STATUSBAR), dat);
}
else if (ack->result == ACKRESULT_SEARCHRESULT && ack->lParam) {
@@ -810,7 +810,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
FreeSearchResults(hwndList);
ListView_DeleteAllItems(hwndList); //not sure if previous delete list items too
//secondly remove all columns
- while (ListView_DeleteColumn(hwndList,1)); //will delete fist column till it possible
+ while (ListView_DeleteColumn(hwndList, 1)); //will delete fist column till it possible
//now will add columns and captions;
lvc.mask=LVCF_TEXT;
for (iColumn=0; iColumn<csr->nFieldCount; iColumn++)
@@ -827,7 +827,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
char *szComboProto;
COMBOBOXEXITEM cbei = {0};
- lsr = (struct ListSearchResult*)mir_alloc(offsetof(struct ListSearchResult,psr)+psr->cbSize);
+ lsr = (struct ListSearchResult*)mir_alloc(offsetof(struct ListSearchResult, psr)+psr->cbSize);
lsr->szProto = ack->szModule;
memcpy(&lsr->psr, psr, psr->cbSize);
@@ -857,11 +857,11 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
{
szComboProto=(char*)SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETITEMDATA, i, 0);
if (szComboProto == NULL) continue;
- if (!lstrcmpA(szComboProto,ack->szModule))
+ if (!lstrcmpA(szComboProto, ack->szModule))
{
cbei.mask = CBEIF_IMAGE;
cbei.iItem = i;
- SendDlgItemMessage(hwndDlg,IDC_PROTOLIST,CBEM_GETITEM,0,(LPARAM)&cbei);
+ SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CBEM_GETITEM, 0, (LPARAM)&cbei);
lvi.iImage = cbei.iImage;
}
}
@@ -878,13 +878,13 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
}
else if (ack->result == ACKRESULT_DATA) {
LVITEM lvi={0};
- int i,col;
+ int i, col;
PROTOSEARCHRESULT *psr=(PROTOSEARCHRESULT*)ack->lParam;
struct ListSearchResult *lsr;
char *szComboProto;
COMBOBOXEXITEM cbei={0};
dat->bFlexSearchResult=FALSE;
- lsr=(struct ListSearchResult*)mir_alloc(offsetof(struct ListSearchResult,psr)+psr->cbSize);
+ lsr=(struct ListSearchResult*)mir_alloc(offsetof(struct ListSearchResult, psr)+psr->cbSize);
lsr->szProto=ack->szModule;
CopyMemory(&lsr->psr, psr, psr->cbSize);
@@ -897,14 +897,14 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
lvi.mask = LVIF_PARAM|LVIF_IMAGE;
lvi.lParam=(LPARAM)lsr;
- for (i = SendDlgItemMessage(hwndDlg,IDC_PROTOLIST,CB_GETCOUNT,0,0); i--; )
+ for (i = SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETCOUNT, 0, 0); i--; )
{
- szComboProto=(char*)SendDlgItemMessage(hwndDlg,IDC_PROTOLIST,CB_GETITEMDATA,i,0);
+ szComboProto=(char*)SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETITEMDATA, i, 0);
if (szComboProto == NULL) continue;
- if (!lstrcmpA(szComboProto,ack->szModule)) {
+ if (!lstrcmpA(szComboProto, ack->szModule)) {
cbei.mask=CBEIF_IMAGE;
cbei.iItem=i;
- SendDlgItemMessage(hwndDlg,IDC_PROTOLIST,CBEM_GETITEM,0,(LPARAM)&cbei);
+ SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CBEM_GETITEM, 0, (LPARAM)&cbei);
lvi.iImage=cbei.iImage;
break;
}
@@ -926,10 +926,10 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
case WM_DESTROY:
{
TCHAR *szProto;
- int len = SendDlgItemMessage(hwndDlg,IDC_PROTOLIST,CB_GETLBTEXTLEN,SendDlgItemMessage(hwndDlg,IDC_PROTOLIST,CB_GETCURSEL,0,0),0);
+ int len = SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETLBTEXTLEN, SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETCURSEL, 0, 0), 0);
szProto = ( TCHAR* )alloca( sizeof(TCHAR)*( len+1 ));
*szProto='\0';
- SendDlgItemMessage(hwndDlg,IDC_PROTOLIST,CB_GETLBTEXT,SendDlgItemMessage(hwndDlg,IDC_PROTOLIST,CB_GETCURSEL,0,0),(LPARAM)szProto);
+ SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETLBTEXT, SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETCURSEL, 0, 0), (LPARAM)szProto);
DBWriteContactSettingTString(NULL, "FindAdd", "LastSearched", szProto?szProto:_T(""));
}
SaveColumnSizes(hwndList);
@@ -949,7 +949,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
DeleteObject(dat->hBmpSortUp);
mir_free(dat);
Window_FreeIcon_IcoLib(hwndDlg);
- Utils_SaveWindowPosition(hwndDlg,NULL,"FindAdd","");
+ Utils_SaveWindowPosition(hwndDlg, NULL, "FindAdd", "");
break;
}
@@ -959,7 +959,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
static INT_PTR FindAddCommand(WPARAM, LPARAM)
{
if (IsWindow(hwndFindAdd)) {
- ShowWindow(hwndFindAdd,SW_SHOWNORMAL);
+ ShowWindow(hwndFindAdd, SW_SHOWNORMAL);
SetForegroundWindow(hwndFindAdd);
SetFocus(hwndFindAdd);
}
@@ -995,10 +995,10 @@ int FindAddPreShutdown(WPARAM, LPARAM)
int LoadFindAddModule(void)
{
- CreateServiceFunction(MS_FINDADD_FINDADD,FindAddCommand);
+ CreateServiceFunction(MS_FINDADD_FINDADD, FindAddCommand);
HookEvent(ME_SYSTEM_MODULESLOADED, OnSystemModulesLoaded);
HookEvent(ME_PROTO_ACCLISTCHANGED, OnSystemModulesLoaded);
- HookEvent(ME_SYSTEM_PRESHUTDOWN,FindAddPreShutdown);
+ HookEvent(ME_SYSTEM_PRESHUTDOWN, FindAddPreShutdown);
CLISTMENUITEM mi = { 0 };
mi.cbSize = sizeof(mi);
@@ -1007,7 +1007,7 @@ int LoadFindAddModule(void)
mi.icolibItem = GetSkinIconHandle( SKINICON_OTHER_FINDUSER );
mi.pszName = LPGEN("&Find/Add Contacts...");
mi.pszService = MS_FINDADD_FINDADD;
- hMainMenuItem = ( HANDLE )CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM)&mi);
+ hMainMenuItem = Menu_AddMainMenuItem(&mi);
return 0;
}
diff --git a/src/modules/findadd/findadd.h b/src/modules/findadd/findadd.h
index 8e5fcb29e1..edd0c46bb9 100644
--- a/src/modules/findadd/findadd.h
+++ b/src/modules/findadd/findadd.h
@@ -11,7 +11,7 @@ modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
-This program is distributed in the hope that it will be useful,
+This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
@@ -35,12 +35,12 @@ struct FindAddDlgData {
int bSortAscending;
int iLastColumnSortIndex;
HIMAGELIST himlComboIcons;
- int showProtoId,showEmail,showName,showAdvanced,showTiny;
+ int showProtoId, showEmail, showName, showAdvanced, showTiny;
int minDlgHeight;
int notSearchedYet;
struct ProtoSearchInfo *search;
int searchCount;
- HBITMAP hBmpSortUp,hBmpSortDown;
+ HBITMAP hBmpSortUp, hBmpSortDown;
int throbbing;
int pivot;
HWND hwndAdvSearch;
@@ -50,10 +50,10 @@ struct FindAddDlgData {
int CALLBACK SearchResultsCompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
void FreeSearchResults(HWND hwndResults);
-int BeginSearch(HWND hwndDlg,struct FindAddDlgData *dat,const char *szProto,const char *szSearchService,DWORD requiredCapability,void *pvSearchParams);
-void SetStatusBarSearchInfo(HWND hwndStatus,struct FindAddDlgData *dat);
+int BeginSearch(HWND hwndDlg, struct FindAddDlgData *dat, const char *szProto, const char *szSearchService, DWORD requiredCapability, void *pvSearchParams);
+void SetStatusBarSearchInfo(HWND hwndStatus, struct FindAddDlgData *dat);
void SetStatusBarResultInfo(HWND hwndDlg);
-void CreateResultsColumns(HWND hwndResults,struct FindAddDlgData *dat,char *szProto);
-void EnableResultButtons(HWND hwndDlg,int enable);
-void ShowMoreOptionsMenu(HWND hwndDlg,int x,int y);
+void CreateResultsColumns(HWND hwndResults, struct FindAddDlgData *dat, char *szProto);
+void EnableResultButtons(HWND hwndDlg, int enable);
+void ShowMoreOptionsMenu(HWND hwndDlg, int x, int y);
void SaveColumnSizes(HWND hwndResults);
diff --git a/src/modules/findadd/searchresults.cpp b/src/modules/findadd/searchresults.cpp
index cc3622609f..827fe920b0 100644
--- a/src/modules/findadd/searchresults.cpp
+++ b/src/modules/findadd/searchresults.cpp
@@ -11,7 +11,7 @@ modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
-This program is distributed in the hope that it will be useful,
+This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
@@ -24,12 +24,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "findadd.h"
enum {
- COLUMNID_PROTO,
- COLUMNID_HANDLE,
- COLUMNID_NICK,
- COLUMNID_FIRST,
- COLUMNID_LAST,
- COLUMNID_EMAIL,
+ COLUMNID_PROTO,
+ COLUMNID_HANDLE,
+ COLUMNID_NICK,
+ COLUMNID_FIRST,
+ COLUMNID_LAST,
+ COLUMNID_EMAIL,
NUM_COLUMNID
};
@@ -41,24 +41,24 @@ void SaveColumnSizes(HWND hwndResults)
int i;
struct FindAddDlgData *dat;
- dat=(struct FindAddDlgData*)GetWindowLongPtr(GetParent(hwndResults),GWLP_USERDATA);
+ dat=(struct FindAddDlgData*)GetWindowLongPtr(GetParent(hwndResults), GWLP_USERDATA);
columnCount=Header_GetItemCount(ListView_GetHeader(hwndResults));
if (columnCount != NUM_COLUMNID) return;
- ListView_GetColumnOrderArray(hwndResults,columnCount,columnOrder);
+ ListView_GetColumnOrderArray(hwndResults, columnCount, columnOrder);
for (i=0; i < NUM_COLUMNID; i++) {
mir_snprintf(szSetting, SIZEOF(szSetting), "ColOrder%d", i);
- DBWriteContactSettingByte(NULL,"FindAdd",szSetting,(BYTE)columnOrder[i]);
+ DBWriteContactSettingByte(NULL, "FindAdd", szSetting, (BYTE)columnOrder[i]);
if (i>=columnCount) continue;
mir_snprintf(szSetting, SIZEOF(szSetting), "ColWidth%d", i);
- DBWriteContactSettingWord(NULL,"FindAdd",szSetting,(WORD)ListView_GetColumnWidth(hwndResults,i));
+ DBWriteContactSettingWord(NULL, "FindAdd", szSetting, (WORD)ListView_GetColumnWidth(hwndResults, i));
}
- DBWriteContactSettingByte(NULL,"FindAdd","SortColumn",(BYTE)dat->iLastColumnSortIndex);
- DBWriteContactSettingByte(NULL,"FindAdd","SortAscending",(BYTE)dat->bSortAscending);
+ DBWriteContactSettingByte(NULL, "FindAdd", "SortColumn", (BYTE)dat->iLastColumnSortIndex);
+ DBWriteContactSettingByte(NULL, "FindAdd", "SortAscending", (BYTE)dat->bSortAscending);
}
static const TCHAR *szColumnNames[] = { NULL, NULL, _T("Nick"), _T("First Name"), _T("Last Name"), _T("E-mail") };
-static int defaultColumnSizes[]={0,90,100,100,100,2000};
-void LoadColumnSizes(HWND hwndResults,const char *szProto)
+static int defaultColumnSizes[]={0, 90, 100, 100, 100, 2000};
+void LoadColumnSizes(HWND hwndResults, const char *szProto)
{
HDITEM hdi;
int columnOrder[NUM_COLUMNID];
@@ -88,9 +88,9 @@ void LoadColumnSizes(HWND hwndResults,const char *szProto)
{
#if defined( _UNICODE )
bNeedsFree = TRUE;
- lvc.pszText = mir_a2t((char*)CallProtoService(szProto,PS_GETCAPS,PFLAG_UNIQUEIDTEXT,0));
+ lvc.pszText = mir_a2t((char*)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDTEXT, 0));
#else
- lvc.pszText = (char*)CallProtoService(szProto,PS_GETCAPS,PFLAG_UNIQUEIDTEXT,0);
+ lvc.pszText = (char*)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDTEXT, 0);
#endif
}
else
@@ -128,7 +128,7 @@ static LPARAM ListView_GetItemLParam(HWND hwndList, int idx)
LVITEM lv;
lv.iItem = idx;
lv.mask = LVIF_PARAM;
- ListView_GetItem(hwndList,&lv);
+ ListView_GetItem(hwndList, &lv);
return lv.lParam;
}
@@ -168,8 +168,8 @@ int CALLBACK SearchResultsCompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lPa
{
TCHAR szText1[100];
TCHAR szText2[100];
- ListView_GetItemText(hList,(int)lParam1,sortCol,szText1,SIZEOF(szText1));
- ListView_GetItemText(hList,(int)lParam2,sortCol,szText2,SIZEOF(szText2));
+ ListView_GetItemText(hList, (int)lParam1, sortCol, szText1, SIZEOF(szText1));
+ ListView_GetItemText(hList, (int)lParam2, sortCol, szText2, SIZEOF(szText2));
return _tcsicmp(szText1, szText2)*sortMultiplier;
}
return 0;
@@ -181,7 +181,7 @@ void FreeSearchResults(HWND hwndResults)
struct ListSearchResult *lsr;
for (lvi.iItem=ListView_GetItemCount(hwndResults)-1;lvi.iItem>=0;lvi.iItem--) {
lvi.mask=LVIF_PARAM;
- ListView_GetItem(hwndResults,&lvi);
+ ListView_GetItem(hwndResults, &lvi);
lsr=(struct ListSearchResult*)lvi.lParam;
if (lsr == NULL) continue;
mir_free(lsr->psr.id);
@@ -192,7 +192,7 @@ void FreeSearchResults(HWND hwndResults)
mir_free(lsr);
}
ListView_DeleteAllItems(hwndResults);
- EnableResultButtons(GetParent(hwndResults),0);
+ EnableResultButtons(GetParent(hwndResults), 0);
}
// on its own thread
@@ -201,16 +201,16 @@ static void BeginSearchFailed(void * arg)
TCHAR buf[128];
if ( arg != NULL ) {
const TCHAR* protoName = (TCHAR*)arg;
- mir_sntprintf(buf,SIZEOF(buf),
- TranslateT("Could not start a search on '%s', there was a problem - is %s connected?"),
- protoName,protoName);
+ mir_sntprintf(buf, SIZEOF(buf),
+ TranslateT("Could not start a search on '%s', there was a problem - is %s connected?"),
+ protoName, protoName);
mir_free((char*)arg);
}
- else lstrcpyn(buf,TranslateT("Could not search on any of the protocols, are you online?"),SIZEOF(buf));
- MessageBox(0,buf,TranslateT("Problem with search"),MB_OK | MB_ICONERROR);
+ else lstrcpyn(buf, TranslateT("Could not search on any of the protocols, are you online?"), SIZEOF(buf));
+ MessageBox(0, buf, TranslateT("Problem with search"), MB_OK | MB_ICONERROR);
}
-int BeginSearch(HWND,struct FindAddDlgData *dat,const char *szProto,const char *szSearchService,DWORD requiredCapability,void *pvSearchParams)
+int BeginSearch(HWND, struct FindAddDlgData *dat, const char *szProto, const char *szSearchService, DWORD requiredCapability, void *pvSearchParams)
{
int i;
if ( szProto == NULL ) {
@@ -220,9 +220,9 @@ int BeginSearch(HWND,struct FindAddDlgData *dat,const char *szProto,const char *
for ( i=0; i < accounts.getCount();i++) {
PROTOACCOUNT* pa = accounts[i];
if (!Proto_IsAccountEnabled(pa)) continue;
- DWORD caps=(DWORD)CallProtoService(pa->szModuleName,PS_GETCAPS,PFLAGNUM_1,0);
+ DWORD caps=(DWORD)CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0);
if (!(caps&requiredCapability)) continue;
- dat->search[dat->searchCount].hProcess = (HANDLE)CallProtoService(pa->szModuleName,szSearchService,0,(LPARAM)pvSearchParams);
+ dat->search[dat->searchCount].hProcess = (HANDLE)CallProtoService(pa->szModuleName, szSearchService, 0, (LPARAM)pvSearchParams);
dat->search[dat->searchCount].szProto = pa->szModuleName;
if ( dat->search[dat->searchCount].hProcess == NULL ) failures++;
else dat->searchCount++;
@@ -230,7 +230,7 @@ int BeginSearch(HWND,struct FindAddDlgData *dat,const char *szProto,const char *
if (failures) {
//infuriatingly vague error message. fixme.
if (dat->searchCount == 0) {
- forkthread(BeginSearchFailed,0,NULL);
+ forkthread(BeginSearchFailed, 0, NULL);
mir_free(dat->search);
dat->search=NULL;
return 1;
@@ -239,7 +239,7 @@ int BeginSearch(HWND,struct FindAddDlgData *dat,const char *szProto,const char *
else {
dat->search=(struct ProtoSearchInfo*)mir_alloc(sizeof(struct ProtoSearchInfo));
dat->searchCount=1;
- dat->search[0].hProcess=(HANDLE)CallProtoService(szProto,szSearchService,0,(LPARAM)pvSearchParams);
+ dat->search[0].hProcess=(HANDLE)CallProtoService(szProto, szSearchService, 0, (LPARAM)pvSearchParams);
dat->search[0].szProto=szProto;
if (dat->search[0].hProcess == NULL) {
//infuriatingly vague error message. fixme.
@@ -255,7 +255,7 @@ int BeginSearch(HWND,struct FindAddDlgData *dat,const char *szProto,const char *
}
// !!!!!!!! this code is dangerous like a hell
-void SetStatusBarSearchInfo(HWND hwndStatus,struct FindAddDlgData *dat)
+void SetStatusBarSearchInfo(HWND hwndStatus, struct FindAddDlgData *dat)
{
TCHAR str[256];
@@ -268,7 +268,7 @@ void SetStatusBarSearchInfo(HWND hwndStatus,struct FindAddDlgData *dat)
if ( !pa )
continue;
- lstrcat(str, i ? _T(",") : _T( " " ));
+ lstrcat(str, i ? _T(", ") : _T( " " ));
lstrcat(str, pa->tszAccountName );
} }
else lstrcpy(str, TranslateT("Idle"));
@@ -282,19 +282,19 @@ struct ProtoResultsSummary {
};
void SetStatusBarResultInfo(HWND hwndDlg)
{
- HWND hwndStatus=GetDlgItem(hwndDlg,IDC_STATUSBAR);
- HWND hwndResults=GetDlgItem(hwndDlg,IDC_RESULTS);
+ HWND hwndStatus=GetDlgItem(hwndDlg, IDC_STATUSBAR);
+ HWND hwndResults=GetDlgItem(hwndDlg, IDC_RESULTS);
LV_ITEM lvi;
struct ListSearchResult *lsr;
struct ProtoResultsSummary *subtotal=NULL;
int subtotalCount=0;
- int i,total;
+ int i, total;
TCHAR str[256];
total=ListView_GetItemCount(hwndResults);
for (lvi.iItem=total-1;lvi.iItem>=0;lvi.iItem--) {
lvi.mask=LVIF_PARAM;
- ListView_GetItem(hwndResults,&lvi);
+ ListView_GetItem(hwndResults, &lvi);
lsr=(struct ListSearchResult*)lvi.lParam;
if (lsr == NULL) continue;
for (i=0;i<subtotalCount;i++) {
@@ -304,7 +304,7 @@ void SetStatusBarResultInfo(HWND hwndDlg)
}
}
if (i == subtotalCount) {
- subtotal=(struct ProtoResultsSummary*)mir_realloc(subtotal,sizeof(struct ProtoResultsSummary)*(subtotalCount+1));
+ subtotal=(struct ProtoResultsSummary*)mir_realloc(subtotal, sizeof(struct ProtoResultsSummary)*(subtotalCount+1));
subtotal[subtotalCount].szProto=lsr->szProto;
subtotal[subtotalCount++].count=1;
}
@@ -320,7 +320,7 @@ void SetStatusBarResultInfo(HWND hwndDlg)
else mir_sntprintf( str, SIZEOF(str), TranslateT("%d %s users found"), total, pa->tszAccountName );
}
else {
- mir_sntprintf( str, SIZEOF(str), TranslateT("%d users found ("),total);
+ mir_sntprintf( str, SIZEOF(str), TranslateT("%d users found ("), total);
for ( i=0; i < subtotalCount; i++ ) {
if ( i ) {
if (( pa = Proto_GetAccount( subtotal[i].szProto )) == NULL )
@@ -338,35 +338,35 @@ void SetStatusBarResultInfo(HWND hwndDlg)
SendMessage(hwndStatus, SB_SETTEXT, 2, (LPARAM)str );
}
-void CreateResultsColumns(HWND hwndResults,struct FindAddDlgData *dat,char *szProto)
+void CreateResultsColumns(HWND hwndResults, struct FindAddDlgData *dat, char *szProto)
{
SaveColumnSizes(hwndResults);
- while (ListView_DeleteColumn(hwndResults,0));
- ListView_SetImageList(hwndResults,dat->himlComboIcons,LVSIL_SMALL);
- LoadColumnSizes(hwndResults,szProto);
+ while (ListView_DeleteColumn(hwndResults, 0));
+ ListView_SetImageList(hwndResults, dat->himlComboIcons, LVSIL_SMALL);
+ LoadColumnSizes(hwndResults, szProto);
}
-void ShowMoreOptionsMenu(HWND hwndDlg,int x,int y)
+void ShowMoreOptionsMenu(HWND hwndDlg, int x, int y)
{
struct FindAddDlgData *dat;
- HMENU hPopupMenu,hMenu;
+ HMENU hPopupMenu, hMenu;
int commandId;
struct ListSearchResult *lsr;
- dat=(struct FindAddDlgData*)GetWindowLongPtr(hwndDlg,GWLP_USERDATA);
+ dat=(struct FindAddDlgData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
{ LVITEM lvi;
- if (ListView_GetSelectedCount(GetDlgItem(hwndDlg,IDC_RESULTS)) != 1) return;
+ if (ListView_GetSelectedCount(GetDlgItem(hwndDlg, IDC_RESULTS)) != 1) return;
lvi.mask=LVIF_PARAM;
- lvi.iItem=ListView_GetNextItem(GetDlgItem(hwndDlg,IDC_RESULTS),-1,LVNI_ALL|LVNI_SELECTED);
- ListView_GetItem(GetDlgItem(hwndDlg,IDC_RESULTS),&lvi);
+ lvi.iItem=ListView_GetNextItem(GetDlgItem(hwndDlg, IDC_RESULTS), -1, LVNI_ALL|LVNI_SELECTED);
+ ListView_GetItem(GetDlgItem(hwndDlg, IDC_RESULTS), &lvi);
lsr=(struct ListSearchResult*)lvi.lParam;
}
- hMenu=LoadMenu(hMirandaInst,MAKEINTRESOURCE(IDR_CONTEXT));
- hPopupMenu=GetSubMenu(hMenu,4);
- CallService(MS_LANGPACK_TRANSLATEMENU,(WPARAM)hPopupMenu,0);
- commandId=TrackPopupMenu(hPopupMenu,TPM_RIGHTBUTTON|TPM_RETURNCMD,x,y,0,hwndDlg,NULL);
+ hMenu=LoadMenu(hMirandaInst, MAKEINTRESOURCE(IDR_CONTEXT));
+ hPopupMenu=GetSubMenu(hMenu, 4);
+ CallService(MS_LANGPACK_TRANSLATEMENU, (WPARAM)hPopupMenu, 0);
+ commandId=TrackPopupMenu(hPopupMenu, TPM_RIGHTBUTTON|TPM_RETURNCMD, x, y, 0, hwndDlg, NULL);
switch(commandId) {
case IDC_ADD:
{ ADDCONTACTSTRUCT acs;
@@ -375,19 +375,19 @@ void ShowMoreOptionsMenu(HWND hwndDlg,int x,int y)
acs.handleType=HANDLE_SEARCHRESULT;
acs.szProto=lsr->szProto;
acs.psr=&lsr->psr;
- CallService(MS_ADDCONTACT_SHOW,(WPARAM)hwndDlg,(LPARAM)&acs);
+ CallService(MS_ADDCONTACT_SHOW, (WPARAM)hwndDlg, (LPARAM)&acs);
break;
}
case IDC_DETAILS:
{ HANDLE hContact;
- hContact=(HANDLE)CallProtoService(lsr->szProto,PS_ADDTOLIST,PALF_TEMPORARY,(LPARAM)&lsr->psr);
- CallService(MS_USERINFO_SHOWDIALOG,(WPARAM)hContact,0);
+ hContact=(HANDLE)CallProtoService(lsr->szProto, PS_ADDTOLIST, PALF_TEMPORARY, (LPARAM)&lsr->psr);
+ CallService(MS_USERINFO_SHOWDIALOG, (WPARAM)hContact, 0);
break;
}
case IDC_SENDMESSAGE:
{ HANDLE hContact;
- hContact=(HANDLE)CallProtoService(lsr->szProto,PS_ADDTOLIST,PALF_TEMPORARY,(LPARAM)&lsr->psr);
- CallService(MS_MSG_SENDMESSAGE,(WPARAM)hContact,(LPARAM)(const char*)NULL);
+ hContact=(HANDLE)CallProtoService(lsr->szProto, PS_ADDTOLIST, PALF_TEMPORARY, (LPARAM)&lsr->psr);
+ CallService(MS_MSG_SENDMESSAGE, (WPARAM)hContact, (LPARAM)(const char*)NULL);
break;
}
}