summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-12-28 09:53:15 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-12-28 09:53:15 +0000
commitd2d076e523b7a5a10507fba40f58543a386dbec0 (patch)
tree0576e5629cb3a0ce937445f627e67d6fd7480d4b /src
parent9a89e7b722cffaaa4343a109e173e4fcde367f1c (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')
-rw-r--r--src/modules/findadd/findadd.cpp71
-rw-r--r--src/modules/findadd/findadd.h1
-rw-r--r--src/modules/findadd/searchresults.cpp5
-rw-r--r--src/res/arrow_sort_column_down.bmpbin150 -> 0 bytes
-rw-r--r--src/res/arrow_sort_column_up.bmpbin150 -> 0 bytes
-rw-r--r--src/resource.h2
-rw-r--r--src/resource.rc8
7 files changed, 34 insertions, 53 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);
}
diff --git a/src/res/arrow_sort_column_down.bmp b/src/res/arrow_sort_column_down.bmp
deleted file mode 100644
index 1fc197f530..0000000000
--- a/src/res/arrow_sort_column_down.bmp
+++ /dev/null
Binary files differ
diff --git a/src/res/arrow_sort_column_up.bmp b/src/res/arrow_sort_column_up.bmp
deleted file mode 100644
index 271acc970e..0000000000
--- a/src/res/arrow_sort_column_up.bmp
+++ /dev/null
Binary files differ
diff --git a/src/resource.h b/src/resource.h
index a56ae48eab..e21bd019cb 100644
--- a/src/resource.h
+++ b/src/resource.h
@@ -106,8 +106,6 @@
#define IDD_INSTALLINI 235
#define IDD_WARNINICHANGE 236
#define IDD_INIIMPORTDONE 237
-#define IDB_SORTCOLUP 239
-#define IDB_SORTCOLDOWN 240
#define IDD_OPT_NETLIB 246
#define IDD_NETLIBLOGOPTS 247
#define IDD_FILETRANSFERINFO 249
diff --git a/src/resource.rc b/src/resource.rc
index 22acbdc403..9395c2ee0f 100644
--- a/src/resource.rc
+++ b/src/resource.rc
@@ -1180,14 +1180,6 @@ BEGIN
END
END
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Bitmap
-//
-
-IDB_SORTCOLUP BITMAP "res/arrow_sort_column_up.bmp"
-IDB_SORTCOLDOWN BITMAP "res/arrow_sort_column_down.bmp"
#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////