diff options
author | George Hazan <george.hazan@gmail.com> | 2013-12-28 09:53:15 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-12-28 09:53:15 +0000 |
commit | d2d076e523b7a5a10507fba40f58543a386dbec0 (patch) | |
tree | 0576e5629cb3a0ce937445f627e67d6fd7480d4b /src/modules/findadd | |
parent | 9a89e7b722cffaaa4343a109e173e4fcde367f1c (diff) |
Find/Add user dialog optimization: manually drawn bitmaps replaced with Windows native
git-svn-id: http://svn.miranda-ng.org/main/trunk@7404 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/findadd')
-rw-r--r-- | src/modules/findadd/findadd.cpp | 71 | ||||
-rw-r--r-- | src/modules/findadd/findadd.h | 1 | ||||
-rw-r--r-- | src/modules/findadd/searchresults.cpp | 5 |
3 files changed, 34 insertions, 43 deletions
diff --git a/src/modules/findadd/findadd.cpp b/src/modules/findadd/findadd.cpp index 4472116d2b..2a8919b125 100644 --- a/src/modules/findadd/findadd.cpp +++ b/src/modules/findadd/findadd.cpp @@ -317,8 +317,6 @@ 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(hInst, MAKEINTRESOURCE(IDB_SORTCOLUP), IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS);
- dat->hBmpSortDown = (HBITMAP)LoadImage(hInst, 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);
@@ -592,27 +590,24 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP EnableResultButtons(hwndDlg, count);
}
break;
+
case LVN_COLUMNCLICK:
- {
- HDITEM hdi;
- hdi.mask = HDI_BITMAP|HDI_FORMAT;
- hdi.fmt = HDF_LEFT|HDF_STRING;
- Header_SetItem(ListView_GetHeader(hwndList), dat->iLastColumnSortIndex, &hdi);
-
- LPNMLISTVIEW nmlv = (LPNMLISTVIEW)lParam;
- if (nmlv->iSubItem != dat->iLastColumnSortIndex) {
- dat->bSortAscending = TRUE;
- dat->iLastColumnSortIndex = nmlv->iSubItem;
- }
- else dat->bSortAscending = !dat->bSortAscending;
+ HDITEM hdi;
+ hdi.mask = HDI_FORMAT;
+ hdi.fmt = HDF_LEFT | HDF_STRING;
+ Header_SetItem(ListView_GetHeader(hwndList), dat->iLastColumnSortIndex, &hdi);
+
+ LPNMLISTVIEW nmlv = (LPNMLISTVIEW)lParam;
+ if (nmlv->iSubItem != dat->iLastColumnSortIndex) {
+ dat->bSortAscending = TRUE;
+ dat->iLastColumnSortIndex = nmlv->iSubItem;
+ }
+ else dat->bSortAscending = !dat->bSortAscending;
- 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);
+ hdi.fmt = HDF_LEFT | HDF_STRING | (dat->bSortAscending ? HDF_SORTDOWN : HDF_SORTUP);
+ Header_SetItem(ListView_GetHeader(hwndList), dat->iLastColumnSortIndex, &hdi);
- ListView_SortItemsEx(hwndList, SearchResultsCompareFunc, (LPARAM)hwndDlg);
- }
- break;
+ ListView_SortItemsEx(hwndList, SearchResultsCompareFunc, (LPARAM)hwndDlg);
}
}
break;
@@ -790,18 +785,17 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP break;
case IDC_MOREOPTIONS:
- {
- RECT rc;
- GetWindowRect( GetDlgItem(hwndDlg, IDC_MOREOPTIONS), &rc);
- ShowMoreOptionsMenu(hwndDlg, rc.left, rc.bottom);
- break;
- }
+ RECT rc;
+ GetWindowRect( GetDlgItem(hwndDlg, IDC_MOREOPTIONS), &rc);
+ ShowMoreOptionsMenu(hwndDlg, rc.left, rc.bottom);
+ break;
}
- if (lParam && dat->hwndTinySearch == (HWND)lParam
- && HIWORD(wParam) == EN_SETFOCUS && LOWORD(wParam) == 0
- && !IsDlgButtonChecked(hwndDlg, IDC_BYCUSTOM)) {
- CheckSearchTypeRadioButton(hwndDlg, IDC_BYCUSTOM);
+ if (lParam && dat->hwndTinySearch == (HWND)lParam &&
+ HIWORD(wParam) == EN_SETFOCUS && LOWORD(wParam) == 0 &&
+ !IsDlgButtonChecked(hwndDlg, IDC_BYCUSTOM))
+ {
+ CheckSearchTypeRadioButton(hwndDlg, IDC_BYCUSTOM);
}
break;
@@ -822,8 +816,9 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP ShowMoreOptionsMenu(hwndDlg, (short)LOWORD(lParam), (short)HIWORD(lParam));
return TRUE;
}
- break;
}
+ break;
+
case HM_SEARCHACK:
{
ACKDATA *ack = (ACKDATA*)lParam;
@@ -853,7 +848,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP else if (ack->result == ACKRESULT_SEARCHRESULT && ack->lParam) {
CUSTOMSEARCHRESULTS *csr = (CUSTOMSEARCHRESULTS*)ack->lParam;
dat->bFlexSearchResult = TRUE;
- PROTOSEARCHRESULT *psr = &(csr->psr);
+ PROTOSEARCHRESULT *psr = &csr->psr;
// check if this is column names data (psr->cbSize == 0)
if (psr->cbSize == 0) { // blob contain info about columns
//firstly remove all exist items
@@ -898,8 +893,8 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP for (int i = SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETCOUNT, 0, 0); i--;) {
char *szComboProto = (char*)SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETITEMDATA, i, 0);
if (szComboProto == NULL) continue;
- if ( !lstrcmpA(szComboProto, ack->szModule)) {
- COMBOBOXEXITEM cbei = {0};
+ if (!lstrcmpA(szComboProto, ack->szModule)) {
+ COMBOBOXEXITEM cbei = { 0 };
cbei.mask = CBEIF_IMAGE;
cbei.iItem = i;
SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CBEM_GETITEM, 0, (LPARAM)&cbei);
@@ -938,8 +933,8 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP for (int i = SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETCOUNT, 0, 0); i--;) {
char *szComboProto = (char*)SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETITEMDATA, i, 0);
if (szComboProto == NULL) continue;
- if ( !lstrcmpA(szComboProto, ack->szModule)) {
- COMBOBOXEXITEM cbei = {0};
+ if (!lstrcmpA(szComboProto, ack->szModule)) {
+ COMBOBOXEXITEM cbei = { 0 };
cbei.mask = CBEIF_IMAGE;
cbei.iItem = i;
SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CBEM_GETITEM, 0, (LPARAM)&cbei);
@@ -956,8 +951,8 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP SetListItemText(hwndList, iItem, col++, lsr->psr.email);
SetStatusBarResultInfo(hwndDlg);
}
- break;
}
+ break;
case WM_CLOSE:
DestroyWindow(hwndDlg);
@@ -984,8 +979,6 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP DestroyWindow(dat->hwndTinySearch);
dat->hwndTinySearch = NULL;
}
- DeleteObject(dat->hBmpSortDown);
- DeleteObject(dat->hBmpSortUp);
mir_free(dat);
Window_FreeIcon_IcoLib(hwndDlg);
Utils_SaveWindowPosition(hwndDlg, NULL, "FindAdd", "");
diff --git a/src/modules/findadd/findadd.h b/src/modules/findadd/findadd.h index 2334b746f1..e9c13610e4 100644 --- a/src/modules/findadd/findadd.h +++ b/src/modules/findadd/findadd.h @@ -44,7 +44,6 @@ struct FindAddDlgData int notSearchedYet;
struct ProtoSearchInfo *search;
int searchCount;
- HBITMAP hBmpSortUp, hBmpSortDown;
int throbbing;
int pivot;
HWND hwndAdvSearch;
diff --git a/src/modules/findadd/searchresults.cpp b/src/modules/findadd/searchresults.cpp index 1efff177d4..95b4c2826e 100644 --- a/src/modules/findadd/searchresults.cpp +++ b/src/modules/findadd/searchresults.cpp @@ -113,9 +113,8 @@ void LoadColumnSizes(HWND hwndResults, const char *szProto) if (dat->iLastColumnSortIndex >= columnCount) dat->iLastColumnSortIndex = COLUMNID_NICK;
dat->bSortAscending = db_get_b(NULL, "FindAdd", "SortAscending", TRUE);
- hdi.mask = HDI_BITMAP | HDI_FORMAT;
- hdi.fmt = HDF_LEFT | HDF_BITMAP | HDF_STRING | HDF_BITMAP_ON_RIGHT;
- hdi.hbm = dat->bSortAscending ? dat->hBmpSortDown : dat->hBmpSortUp;
+ hdi.mask = HDI_FORMAT;
+ hdi.fmt = HDF_LEFT | HDF_STRING | (dat->bSortAscending ? HDF_SORTDOWN : HDF_SORTUP);
Header_SetItem(ListView_GetHeader(hwndResults), dat->iLastColumnSortIndex, &hdi);
}
|