diff options
author | John Ankarström <john@ankarstrom.se> | 2022-07-14 04:05:34 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2022-07-14 04:05:34 +0200 |
commit | 96f0accc818ad98abcb0d37e53d0a31e08ce4987 (patch) | |
tree | 0ff850793420b66cf78ac539d4dbe9f7c393ac11 /c/episodelistview.cpp | |
parent | 26f70ab37bee8ffd70b662ff999613c643215605 (diff) | |
download | EpisodeBrowser-96f0accc818ad98abcb0d37e53d0a31e08ce4987.tar.gz |
Minor formal changes.
Height(DLVSIKEY) was incorrect. The argument to Height is supposed to
be a boolean value, in this case false. It happened to work because
DLVSIKEY is 0 (because Key is the 0th column in the data list view).
Diffstat (limited to 'c/episodelistview.cpp')
-rw-r--r-- | c/episodelistview.cpp | 31 |
1 files changed, 11 insertions, 20 deletions
diff --git a/c/episodelistview.cpp b/c/episodelistview.cpp index e34fb34..15d7ba4 100644 --- a/c/episodelistview.cpp +++ b/c/episodelistview.cpp @@ -7,7 +7,7 @@ #include "defs.h" extern DataListView *g_lpDlv; -static int CALLBACK ElvSort(LPARAM, LPARAM, LPARAM); +int CALLBACK ElvSort(LPARAM, LPARAM, LPARAM); EpisodeListView::EpisodeListView() : ListView((HMENU)IDC_EPISODELISTVIEW, 0) { @@ -141,12 +141,6 @@ EpisodeListView::HandleNotify(LPARAM lParam) return 0; } -int -EpisodeListView::ISort() const -{ - return m_iSort; -} - void EpisodeListView::Redraw() { @@ -419,36 +413,34 @@ EpisodeListView::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return ListView::WndProc(hWnd, uMsg, wParam, lParam); } -/* Sort list view items, iSort being the 1-based index of the column - * to sort by. If iSort is negative, the order is descending. */ int CALLBACK -ElvSort(LPARAM iItem1, LPARAM iItem2, LPARAM lpLv) +ElvSort(LPARAM iItem1, LPARAM iItem2, LPARAM lExtra) { - EpisodeListView *lpThis = (EpisodeListView *)lpLv; + EpisodeListView *lpElv = (EpisodeListView *)lExtra; LVITEM lvi1, lvi2; lvi1.mask = lvi2.mask = LVIF_PARAM; lvi1.iItem = iItem1; lvi2.iItem = iItem2; - if (!ListView_GetItem(lpThis->HWnd(), &lvi1)) return 0; - if (!ListView_GetItem(lpThis->HWnd(), &lvi2)) return 0; + if (!ListView_GetItem(lpElv->HWnd(), &lvi1)) return 0; + if (!ListView_GetItem(lpElv->HWnd(), &lvi2)) return 0; - int iOrder = Cmp(lpThis->ISort(), 0); + /* abs(m_iSort) is the 1-based index of the column to sort by. + * If m_iSort is negative, the order is descending. */ + int iOrder = Cmp(lpElv->m_iSort, 0); - switch (abs(lpThis->ISort())-1) { + switch (abs(lpElv->m_iSort)-1) { case ELVSIEPISODE: return iOrder*Cmp(lvi1.lParam, lvi2.lParam); - break; case ELVSIRATING: { int iRating1, iRating2; - iRating1 = lpThis->ISort() > 0? 99: -1; - iRating2 = lpThis->ISort() > 0? 99: -1; + iRating1 = lpElv->m_iSort > 0? 99: -1; + iRating2 = lpElv->m_iSort > 0? 99: -1; Pl("episode_data","episode_rating","Ii",lvi1.lParam,&iRating1); Pl("episode_data","episode_rating","Ii",lvi2.lParam,&iRating2); if (iRating1 == iRating2) return Cmp(lvi1.lParam, lvi2.lParam); return iOrder*Cmp(iRating1, iRating2); - break; } case ELVSITITLE: { @@ -462,7 +454,6 @@ ElvSort(LPARAM iItem1, LPARAM iItem2, LPARAM lpLv) cch2 = strlen(sz2); cch = cch1 > cch2? cch2: cch1; return iOrder*_strnicmp(sz1, sz2, cch); - break; } default: return 0; |