diff options
author | George Hazan <george.hazan@gmail.com> | 2014-08-21 19:44:23 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-08-21 19:44:23 +0000 |
commit | d8603c99f263b786652d821a3809156346ca9848 (patch) | |
tree | 0aa90c315295f854e188998138520f51bc63e95c /src/modules/findadd | |
parent | 3c58e2a8ed09a12a016ef2cce151aee68db4efd8 (diff) |
search dialog optimization
git-svn-id: http://svn.miranda-ng.org/main/trunk@10264 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/findadd')
-rw-r--r-- | src/modules/findadd/findadd.cpp | 228 | ||||
-rw-r--r-- | src/modules/findadd/findadd.h | 2 |
2 files changed, 115 insertions, 115 deletions
diff --git a/src/modules/findadd/findadd.cpp b/src/modules/findadd/findadd.cpp index b731607322..51af328507 100644 --- a/src/modules/findadd/findadd.cpp +++ b/src/modules/findadd/findadd.cpp @@ -40,57 +40,56 @@ static int FindAddDlgResizer(HWND, LPARAM lParam, UTILRESIZECONTROL *urc) static int y, nextY, oldTop;
FindAddDlgData *dat = (FindAddDlgData*)lParam;
- switch(urc->wId) {
+ switch (urc->wId) {
case IDC_RESULTS:
- return RD_ANCHORX_WIDTH|RD_ANCHORY_HEIGHT;
+ return RD_ANCHORX_WIDTH | RD_ANCHORY_HEIGHT;
case IDOK:
- dat->minDlgHeight = nextY+urc->rcItem.bottom-urc->rcItem.top;
- return RD_ANCHORX_LEFT|RD_ANCHORY_BOTTOM;
+ dat->minDlgHeight = nextY + urc->rcItem.bottom - urc->rcItem.top;
+ return RD_ANCHORX_LEFT | RD_ANCHORY_BOTTOM;
case IDC_ADD:
case IDC_MOREOPTIONS:
- return RD_ANCHORX_RIGHT|RD_ANCHORY_BOTTOM;
+ return RD_ANCHORX_RIGHT | RD_ANCHORY_BOTTOM;
case IDC_STATUSBAR:
- return RD_ANCHORX_WIDTH|RD_ANCHORY_BOTTOM;
+ return RD_ANCHORX_WIDTH | RD_ANCHORY_BOTTOM;
case IDC_PROTOIDGROUP: //the resize is always processed in template order
nextY = y = urc->rcItem.top;
- if (dat->showProtoId) nextY = y+urc->rcItem.bottom-urc->rcItem.top+7;
+ if (dat->showProtoId) nextY = y + urc->rcItem.bottom - urc->rcItem.top + 7;
break;
case IDC_EMAILGROUP:
oldTop = urc->rcItem.top;
y = nextY;
- if (dat->showEmail) nextY = y+urc->rcItem.bottom-urc->rcItem.top+7;
- OffsetRect(&urc->rcItem, 0, y-oldTop);
- return RD_ANCHORX_LEFT|RD_ANCHORY_CUSTOM;
+ if (dat->showEmail) nextY = y + urc->rcItem.bottom - urc->rcItem.top + 7;
+ 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);
- return RD_ANCHORX_LEFT|RD_ANCHORY_CUSTOM;
+ if (dat->showName) nextY = y + urc->rcItem.bottom - urc->rcItem.top + 7;
+ 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);
- return RD_ANCHORX_LEFT|RD_ANCHORY_CUSTOM;
+ if (dat->showAdvanced) nextY = y + urc->rcItem.bottom - urc->rcItem.top + 7;
+ OffsetRect(&urc->rcItem, 0, y - oldTop);
+ return RD_ANCHORX_LEFT | RD_ANCHORY_CUSTOM;
case IDC_TINYEXTENDEDGROUP:
oldTop = urc->rcItem.top;
y = nextY;
- if (dat->showTiny)
- {
- int height = urc->dlgNewSize.cy-y-(urc->dlgOriginalSize.cy-urc->rcItem.bottom);
- nextY = y+200; //min height for custom dialog
- urc->rcItem.top = urc->rcItem.bottom-height;
+ if (dat->showTiny) {
+ int height = urc->dlgNewSize.cy - y - (urc->dlgOriginalSize.cy - urc->rcItem.bottom);
+ nextY = y + 200; //min height for custom dialog
+ urc->rcItem.top = urc->rcItem.bottom - height;
}
- return RD_ANCHORX_LEFT|RD_ANCHORY_BOTTOM;
+ return RD_ANCHORX_LEFT | RD_ANCHORY_BOTTOM;
case IDC_BYEMAIL:
case IDC_EMAIL:
@@ -104,21 +103,21 @@ static int FindAddDlgResizer(HWND, LPARAM lParam, UTILRESIZECONTROL *urc) case IDC_BYADVANCED:
case IDC_BYCUSTOM:
case IDC_ADVANCED:
- OffsetRect(&urc->rcItem, 0, y-oldTop);
- return RD_ANCHORX_LEFT|RD_ANCHORY_CUSTOM;
+ 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;
+ return RD_ANCHORX_LEFT | RD_ANCHORY_TOP | RD_ANCHORX_WIDTH;
}
- return RD_ANCHORX_LEFT|RD_ANCHORY_TOP;
+ return RD_ANCHORX_LEFT | RD_ANCHORY_TOP;
}
static void RenderThrobber(HDC hdc, RECT *rcItem, int *throbbing, int *pivot)
{
InflateRect(rcItem, -1, 0);
- int width = rcItem->right-rcItem->left;
- int height = rcItem->bottom-rcItem->top;
- int height2 = height/2;
+ int width = rcItem->right - rcItem->left;
+ int height = rcItem->bottom - rcItem->top;
+ int height2 = height / 2;
if (*throbbing) {
/* create memdc */
@@ -136,32 +135,32 @@ static void RenderThrobber(HDC hdc, RECT *rcItem, int *throbbing, int *pivot) HPEN hPen = (HPEN)SelectObject(hMemDC, CreatePen(PS_SOLID, 4, GetSysColor(COLOR_BTNSHADOW)));
/* draw everything before the pivot */
int x = *pivot;
- while (x>(-height)) {
- MoveToEx(hMemDC, x+height2, 0, NULL);
- LineTo(hMemDC, x-height2, height);
- x-=12;
+ while (x > (-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);
- x+=12;
+ while (x < width + height) {
+ MoveToEx(hMemDC, x + height2, 0, NULL);
+ LineTo(hMemDC, x - height2, height);
+ x += 12;
}
/* move the pivot */
- *pivot+=2;
+ *pivot += 2;
/* reset the pivot point if it gets past the rect */
- if (*pivot>width) *pivot = 0;
+ if (*pivot > width) *pivot = 0;
/* put back the old pen and delete the new one */
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);
+ 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));
/* paint to screen */
@@ -190,14 +189,14 @@ static void StopThrobber(HWND hwndDlg, FindAddDlgData *dat) 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 LRESULT CALLBACK AdvancedSearchDlgSubclassProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
if (msg == WM_COMMAND) {
HWND parentHwnd = GetParent(hwndDlg);
- switch(LOWORD(wParam)) {
+ switch (LOWORD(wParam)) {
case IDOK:
SendMessage(parentHwnd, WM_COMMAND, MAKEWPARAM(IDOK, BN_CLICKED), (LPARAM)GetDlgItem(parentHwnd, IDOK));
SetFocus(GetDlgItem(parentHwnd, IDC_ADVANCED));
@@ -221,15 +220,15 @@ static void ShowAdvancedSearchDlg(HWND hwndDlg, FindAddDlgData *dat) if (dat->hwndAdvSearch == NULL) {
RECT rc;
- dat->hwndAdvSearch = (HWND)CallProtoServiceInt(NULL,szProto, PS_CREATEADVSEARCHUI, 0, (LPARAM)hwndDlg);
- if(dat->hwndAdvSearch != NULL)
+ dat->hwndAdvSearch = (HWND)CallProtoServiceInt(NULL, szProto, PS_CREATEADVSEARCHUI, 0, (LPARAM)hwndDlg);
+ if (dat->hwndAdvSearch != NULL)
mir_subclassWindow(dat->hwndAdvSearch, AdvancedSearchDlgSubclassProc);
- GetWindowRect( GetDlgItem(hwndDlg, IDC_RESULTS), &rc);
- SetWindowPos(dat->hwndAdvSearch, 0, rc.left, rc.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE);
+ GetWindowRect(GetDlgItem(hwndDlg, IDC_RESULTS), &rc);
+ SetWindowPos(dat->hwndAdvSearch, 0, rc.left, rc.top, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
}
- AnimateWindow(dat->hwndAdvSearch, 150, AW_ACTIVATE|AW_SLIDE|AW_HOR_POSITIVE);
- RedrawWindow(dat->hwndAdvSearch, NULL, NULL, RDW_INVALIDATE|RDW_UPDATENOW|RDW_ALLCHILDREN);
+ AnimateWindow(dat->hwndAdvSearch, 150, AW_ACTIVATE | AW_SLIDE | AW_HOR_POSITIVE);
+ RedrawWindow(dat->hwndAdvSearch, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN);
CheckDlgButton(hwndDlg, IDC_ADVANCED, BST_CHECKED);
}
@@ -241,13 +240,13 @@ static void ReposTinySearchDlg(HWND hwndDlg, FindAddDlgData *dat) RECT rc;
RECT clientRect;
- POINT pt = {0, 0};
- GetWindowRect( GetDlgItem(hwndDlg, IDC_TINYEXTENDEDGROUP), &rc);
+ 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(dat->hwndTinySearch, 0, pt.x + 5, pt.y + 15, rc.right - rc.left - 10, rc.bottom - rc.top - 30, SWP_NOZORDER);
}
static void ShowTinySearchDlg(HWND hwndDlg, FindAddDlgData *dat)
@@ -257,7 +256,7 @@ static void ShowTinySearchDlg(HWND hwndDlg, FindAddDlgData *dat) return;
if (dat->hwndTinySearch == NULL) {
- dat->hwndTinySearch = (HWND)CallProtoServiceInt(NULL,szProto, PS_CREATEADVSEARCHUI, 0, (LPARAM)/*GetDlgItem(*/hwndDlg/*, IDC_TINYEXTENDEDGROUP)*/);
+ dat->hwndTinySearch = (HWND)CallProtoServiceInt(NULL, szProto, PS_CREATEADVSEARCHUI, 0, (LPARAM)/*GetDlgItem(*/hwndDlg/*, IDC_TINYEXTENDEDGROUP)*/);
if (dat->hwndTinySearch)
ReposTinySearchDlg(hwndDlg, dat);
else
@@ -271,21 +270,21 @@ static void HideAdvancedSearchDlg(HWND hwndDlg, FindAddDlgData *dat) if (dat->hwndAdvSearch == NULL)
return;
- AnimateWindow(dat->hwndAdvSearch, 150, AW_HIDE|AW_BLEND);
+ AnimateWindow(dat->hwndAdvSearch, 150, AW_HIDE | AW_BLEND);
CheckDlgButton(hwndDlg, IDC_ADVANCED, BST_UNCHECKED);
}
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 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 };
static void CheckSearchTypeRadioButton(HWND hwndDlg, int idControl)
{
- for (int i=0; i < SIZEOF(controls); i++)
+ for (int i = 0; i < SIZEOF(controls); i++)
CheckDlgButton(hwndDlg, controls[i], idControl == controls[i] ? BST_CHECKED : BST_UNCHECKED);
}
@@ -294,12 +293,10 @@ static void CheckSearchTypeRadioButton(HWND hwndDlg, int idControl) static void SetListItemText(HWND hwndList, int idx, int col, TCHAR* szText)
{
- if (szText && szText[0])
- {
+ if (szText && szText[0]) {
ListView_SetItemText(hwndList, idx, col, szText);
}
- else
- {
+ else {
ListView_SetItemText(hwndList, idx, col, TranslateT("<not specified>"));
}
}
@@ -328,7 +325,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP LVCOLUMN lvc;
lvc.mask = LVCF_TEXT | LVCF_WIDTH;
lvc.pszText = TranslateT("Results");
- lvc.cx = rc.right-1;
+ lvc.cx = rc.right - 1;
ListView_InsertColumn(hwndList, 0, &lvc);
LVITEM lvi;
@@ -339,7 +336,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP ListView_InsertItem(hwndList, &lvi);
// Allocate a reasonable amount of space in the status bar
- HDC hdc = GetDC( GetDlgItem(hwndDlg, IDC_STATUSBAR));
+ HDC hdc = GetDC(GetDlgItem(hwndDlg, IDC_STATUSBAR));
SelectObject(hdc, (HFONT)SendDlgItemMessage(hwndDlg, IDC_STATUSBAR, WM_GETFONT, 0, 0));
SIZE textSize;
@@ -349,38 +346,38 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP partWidth[0] = textSize.cx;
GetTextExtentPoint32(hdc, _T("01234567890123456789"), 20, &textSize);
partWidth[0] += textSize.cx;
- ReleaseDC( GetDlgItem(hwndDlg, IDC_STATUSBAR), hdc);
- partWidth[1] = partWidth[0]+150;
+ 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_SETTEXT, 1 | SBT_OWNERDRAW, 0);
+ SetStatusBarSearchInfo(GetDlgItem(hwndDlg, IDC_STATUSBAR), dat);
TCHAR *szProto = NULL;
DBVARIANT dbv;
- if (!db_get_ts(NULL, "FindAdd", "LastSearched", &dbv)){
+ if (!db_get_ts(NULL, "FindAdd", "LastSearched", &dbv)) {
szProto = NEWTSTR_ALLOCA(dbv.ptszVal);
db_free(&dbv); /* free string szProto was fetched with */
}
int i, index = 0, cbwidth = 0, netProtoCount = 0;
- for (i=0; i < accounts.getCount(); i++) {
+ for (i = 0; i < accounts.getCount(); i++) {
if (!Proto_IsAccountEnabled(accounts[i]))
continue;
- DWORD caps = (DWORD)CallProtoServiceInt(NULL,accounts[i]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0);
- if (caps & PF1_BASICSEARCH || caps & PF1_EXTSEARCH || caps & PF1_SEARCHBYEMAIL || caps & PF1_SEARCHBYNAME)
+ DWORD caps = (DWORD)CallProtoServiceInt(NULL, accounts[i]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0);
+ if (caps & PF1_ANYSEARCH)
netProtoCount++;
}
- dat->himlComboIcons = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, netProtoCount+1, netProtoCount+1);
+ dat->himlComboIcons = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, netProtoCount + 1, netProtoCount + 1);
SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CBEM_SETIMAGELIST, 0, (LPARAM)dat->himlComboIcons);
COMBOBOXEXITEM cbei;
- cbei.mask = CBEIF_IMAGE|CBEIF_SELECTEDIMAGE|CBEIF_TEXT|CBEIF_LPARAM;
+ 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));
- if (netProtoCount>1) {
+ if (netProtoCount > 1) {
cbei.pszText = TranslateT("All networks");
GetTextExtentPoint32(hdc, cbei.pszText, lstrlen(cbei.pszText), &textSize);
if (textSize.cx > cbwidth)
@@ -391,13 +388,13 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP cbei.iItem++;
}
- for (i=0; i < accounts.getCount(); i++) {
+ for (i = 0; i < accounts.getCount(); i++) {
PROTOACCOUNT *pa = accounts[i];
if (!Proto_IsAccountEnabled(pa))
continue;
- DWORD caps = (DWORD)CallProtoServiceInt(NULL,pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0);
- if (!(caps&PF1_BASICSEARCH) && !(caps&PF1_EXTSEARCH) && !(caps&PF1_SEARCHBYEMAIL) && !(caps&PF1_SEARCHBYNAME))
+ DWORD caps = (DWORD)CallProtoServiceInt(NULL, pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0);
+ if (!(caps & PF1_ANYSEARCH))
continue;
cbei.pszText = pa->tszAccountName;
@@ -405,7 +402,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (textSize.cx > cbwidth)
cbwidth = textSize.cx;
- HICON hIcon = (HICON)CallProtoServiceInt(NULL,pa->szModuleName, PS_LOADICON, PLI_PROTOCOL|PLIF_SMALL, 0);
+ HICON hIcon = (HICON)CallProtoServiceInt(NULL, 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;
@@ -418,7 +415,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP RECT rect;
SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETDROPPEDCONTROLRECT, 0, (LPARAM)&rect);
- if ((rect.right-rect.left)<cbwidth)
+ if ((rect.right - rect.left) < cbwidth)
SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_SETDROPPEDWIDTH, cbwidth, 0);
SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_SETCURSEL, index, 0);
@@ -429,7 +426,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP case WM_SIZE:
{
- UTILRESIZEDIALOG urd = {0};
+ UTILRESIZEDIALOG urd = { 0 };
urd.cbSize = sizeof(urd);
urd.hwndDlg = hwndDlg;
urd.hInstance = hInst;
@@ -450,25 +447,25 @@ 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);
+ SetWindowPos(dat->hwndAdvSearch, 0, rc.left, rc.top, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
}
break;
case WM_GETMINMAXINFO:
+ RECT rc, rc2;
+ GetWindowRect(hwndList, &rc);
+ GetWindowRect(hwndDlg, &rc2);
{
- RECT rc, rc2;
- GetWindowRect(hwndList, &rc);
- GetWindowRect(hwndDlg, &rc2);
MINMAXINFO *mmi = (MINMAXINFO*)lParam;
- mmi->ptMinTrackSize.x = rc.left-rc2.left+10+GetSystemMetrics(SM_CXFRAME);
- GetClientRect( GetDlgItem(hwndDlg, IDC_MOREOPTIONS), &rc);
- mmi->ptMinTrackSize.x+=rc.right+5;
- GetClientRect( GetDlgItem(hwndDlg, IDC_ADD), &rc);
- mmi->ptMinTrackSize.x+=rc.right+5;
- 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);
- mmi->ptMinTrackSize.y+=rc.bottom;
+ mmi->ptMinTrackSize.x = rc.left - rc2.left + 10 + GetSystemMetrics(SM_CXFRAME);
+ GetClientRect(GetDlgItem(hwndDlg, IDC_MOREOPTIONS), &rc);
+ mmi->ptMinTrackSize.x += rc.right + 5;
+ GetClientRect(GetDlgItem(hwndDlg, IDC_ADD), &rc);
+ mmi->ptMinTrackSize.x += rc.right + 5;
+ 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);
+ mmi->ptMinTrackSize.y += rc.bottom;
}
return 0;
@@ -479,46 +476,44 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (szProto == (char *)CB_ERR)
break;
if (szProto == NULL) {
- for (int i=0; i < accounts.getCount(); i++) {
+ for (int i = 0; i < accounts.getCount(); i++) {
PROTOACCOUNT *pa = accounts[i];
- if ( Proto_IsAccountEnabled(pa)) {
- DWORD protoCaps = (DWORD)CallProtoServiceInt(NULL,pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0);
+ if (Proto_IsAccountEnabled(pa)) {
+ DWORD protoCaps = (DWORD)CallProtoServiceInt(NULL, pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0);
if (protoCaps & PF1_SEARCHBYEMAIL) dat->showEmail = 1;
if (protoCaps & PF1_SEARCHBYNAME) dat->showName = 1;
}
}
}
else {
- DWORD protoCaps = (DWORD)CallProtoServiceInt(NULL,szProto, PS_GETCAPS, PFLAGNUM_1, 0);
+ DWORD protoCaps = (DWORD)CallProtoServiceInt(NULL, 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;
- if (protoCaps & PF1_EXTSEARCH && !(protoCaps & PF1_EXTSEARCHUI)) dat->showTiny = 1;
+
if (protoCaps & PF1_EXTSEARCHUI) dat->showAdvanced = 1;
- if (protoCaps & PF1_USERIDISEMAIL && dat->showProtoId) {dat->showProtoId = 0; dat->showEmail = 1;}
+ else if (protoCaps & PF1_EXTSEARCH) dat->showTiny = 1;
+
+ if (protoCaps & PF1_USERIDISEMAIL && dat->showProtoId) { dat->showProtoId = 0; dat->showEmail = 1; }
if (dat->showProtoId) {
- char *szUniqueId = (char*)CallProtoServiceInt(NULL,szProto, PS_GETCAPS, PFLAG_UNIQUEIDTEXT, 0);
- if (szUniqueId) {
- TCHAR* p = mir_a2u(szUniqueId);
- SetDlgItemText(hwndDlg, IDC_BYPROTOID, p);
- mir_free(p);
- }
- else SetDlgItemText(hwndDlg, IDC_BYPROTOID, TranslateT("Handle"));
+ char *szUniqueId = (char*)CallProtoServiceInt(NULL, szProto, PS_GETCAPS, PFLAG_UNIQUEIDTEXT, 0);
+ if (szUniqueId)
+ SetDlgItemTextA(hwndDlg, IDC_BYPROTOID, szUniqueId);
+ 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);
+ 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);
+ SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_PROTOID), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_PROTOID), GWL_STYLE)&~ES_NUMBER);
}
}
if (dat->showTiny)
ShowTinySearchDlg(hwndDlg, dat);
- else {
- if (dat->hwndTinySearch) {
- DestroyWindow(dat->hwndTinySearch);
- dat->hwndTinySearch = NULL;
- }
+ else if (dat->hwndTinySearch) {
+ DestroyWindow(dat->hwndTinySearch);
+ dat->hwndTinySearch = NULL;
}
#define en(id, t) ShowWindow( GetDlgItem(hwndDlg, IDC_##id), dat->show##t?SW_SHOW:SW_HIDE)
@@ -736,7 +731,10 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP }
if (dat->searchCount == 0) {
- if (dat->hResultHook) {UnhookEvent(dat->hResultHook); dat->hResultHook = NULL;}
+ if (dat->hResultHook) {
+ UnhookEvent(dat->hResultHook);
+ dat->hResultHook = NULL;
+ }
break;
}
diff --git a/src/modules/findadd/findadd.h b/src/modules/findadd/findadd.h index 5fd5f24724..9026b69069 100644 --- a/src/modules/findadd/findadd.h +++ b/src/modules/findadd/findadd.h @@ -22,6 +22,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+#define PF1_ANYSEARCH (PF1_BASICSEARCH | PF1_EXTSEARCH | PF1_SEARCHBYEMAIL | PF1_SEARCHBYNAME | PF1_EXTSEARCH)
+
struct ListSearchResult
{
const char *szProto;
|