aboutsummaryrefslogtreecommitdiff
path: root/c/episodelistview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'c/episodelistview.cpp')
-rw-r--r--c/episodelistview.cpp35
1 files changed, 17 insertions, 18 deletions
diff --git a/c/episodelistview.cpp b/c/episodelistview.cpp
index 01b4c1a..4196062 100644
--- a/c/episodelistview.cpp
+++ b/c/episodelistview.cpp
@@ -13,7 +13,7 @@
extern DataListView *g_lpDlv;
int CALLBACK ElvSort(LPARAM, LPARAM, LPARAM);
-EpisodeListView::EpisodeListView(HWND hWndParent)
+EpisodeListView::EpisodeListView(const HWND hWndParent)
: ListView(hWndParent, (HMENU)IDC_EPISODELISTVIEW, 0)
{
LVCOLUMN lvc;
@@ -45,14 +45,14 @@ void EpisodeListView::DoSort()
void EpisodeListView::EnsureFocusVisible()
{
- int iEpFocus = ListView_GetNextItem(m_hWnd, -1, LVNI_FOCUSED);
+ const int iEpFocus = ListView_GetNextItem(m_hWnd, -1, LVNI_FOCUSED);
if (iEpFocus == -1) return;
ListView_EnsureVisible(m_hWnd, iEpFocus, TRUE);
}
-LRESULT EpisodeListView::HandleNotify(LPARAM lParam)
+LRESULT EpisodeListView::HandleNotify(const LPARAM lParam)
{
- LPNMLISTVIEW lpNmLv = (LPNMLISTVIEW)lParam;
+ const LPNMLISTVIEW lpNmLv = (LPNMLISTVIEW)lParam;
switch (lpNmLv->hdr.code) {
case LVN_ITEMCHANGED: /* Select/focus episode. */
@@ -66,7 +66,7 @@ LRESULT EpisodeListView::HandleNotify(LPARAM lParam)
break;
case LVN_COLUMNCLICK: /* Sort by column. */
{
- int iColumn = lpNmLv->iSubItem+1;
+ const int iColumn = lpNmLv->iSubItem+1;
m_iSort = abs(m_iSort) == iColumn? -m_iSort: iColumn;
Pl("cfg","set_sort",m_iSort);
DoSort();
@@ -75,7 +75,7 @@ LRESULT EpisodeListView::HandleNotify(LPARAM lParam)
}
case LVN_KEYDOWN: /* Navigate episodes by keyboard. */
{
- LPNMLVKEYDOWN lpNmLvKd = (LPNMLVKEYDOWN)lParam;
+ const LPNMLVKEYDOWN lpNmLvKd = (LPNMLVKEYDOWN)lParam;
switch (lpNmLvKd->wVKey) {
case VK_LEFT:
SelectUnwatched(-1);
@@ -88,7 +88,7 @@ LRESULT EpisodeListView::HandleNotify(LPARAM lParam)
}
case NM_CUSTOMDRAW: /* Make unwatched episodes bold. */
{
- LPNMLVCUSTOMDRAW lpLvCd = (LPNMLVCUSTOMDRAW)lParam;
+ const LPNMLVCUSTOMDRAW lpLvCd = (LPNMLVCUSTOMDRAW)lParam;
switch (lpLvCd->nmcd.dwDrawStage) {
case CDDS_PREPAINT:
return CDRF_NOTIFYITEMDRAW;
@@ -131,7 +131,7 @@ LRESULT EpisodeListView::HandleNotify(LPARAM lParam)
case NM_RCLICK:
{
extern HMENU g_hPopupMenu;
- DWORD dwPos = GetMessagePos();
+ const DWORD dwPos = GetMessagePos();
TrackPopupMenu(g_hPopupMenu, TPM_RIGHTBUTTON,
LOWORD(dwPos), HIWORD(dwPos), 0,
m_hWndParent, NULL);
@@ -157,9 +157,9 @@ void EpisodeListView::SaveFocus()
Pl("cfg","set_focus",lvi.lParam);
}
-void EpisodeListView::SetTop(int iItem)
+void EpisodeListView::SetTop(const int iItem)
{
- int iLast = ListView_GetItemCount(m_hWnd)-1;
+ const int iLast = ListView_GetItemCount(m_hWnd)-1;
ListView_EnsureVisible(m_hWnd, iLast, TRUE);
ListView_EnsureVisible(m_hWnd, iItem, TRUE);
}
@@ -237,7 +237,7 @@ void EpisodeListView::SelectUnwatched(int iDir)
void EpisodeListView::ShowFocus()
{
- int iEpFocus = ListView_GetNextItem(m_hWnd, -1, LVNI_FOCUSED);
+ const int iEpFocus = ListView_GetNextItem(m_hWnd, -1, LVNI_FOCUSED);
if (iEpFocus == -1) return;
ListView_EnsureVisible(m_hWnd, iEpFocus, TRUE);
}
@@ -353,7 +353,7 @@ void EpisodeListView::Update()
}
/* Update episode name and rating. */
-void EpisodeListView::UpdateItem(LPLVITEM lpLvi)
+void EpisodeListView::UpdateItem(const LPLVITEM lpLvi)
{
TCHAR *tszName;
int iRating;
@@ -375,19 +375,18 @@ r: if (!Pl("episode_data","episode_rating",lpLvi->lParam,&iRating)) {
ListView_SetItemText(m_hWnd, lpLvi->iItem, ELVSIRATING, tszRating);
}
-LRESULT CALLBACK EpisodeListView::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
+LRESULT CALLBACK EpisodeListView::WndProc(const HWND hWnd, const UINT uMsg,
+ const WPARAM wParam, const LPARAM lParam)
{
switch (uMsg) {
case WM_GETDLGCODE:
{
- LRESULT lResult;
-
/* For the episode list view, the Enter key should not
* be handled by the dialog manager, but instead be sent
* along to the main window procedure, so that it may be
* handled by the NM_RETURN case in ElvHandleNotify. */
- lResult = CallWindowProc(m_prevProc, hWnd, uMsg, wParam, lParam);
+ const LRESULT lResult = CallWindowProc(m_prevProc, hWnd, uMsg, wParam, lParam);
if (lParam && ((MSG *)lParam)->message == WM_KEYDOWN
&& ((MSG *)lParam)->wParam == VK_RETURN)
return DLGC_WANTMESSAGE;
@@ -398,7 +397,7 @@ LRESULT CALLBACK EpisodeListView::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, L
return ListView::WndProc(hWnd, uMsg, wParam, lParam);
}
-int CALLBACK ElvSort(LPARAM iItem1, LPARAM iItem2, LPARAM lExtra)
+int CALLBACK ElvSort(const LPARAM iItem1, const LPARAM iItem2, const LPARAM lExtra)
{
EpisodeListView *lpElv = (EpisodeListView *)lExtra;
@@ -410,7 +409,7 @@ int CALLBACK ElvSort(LPARAM iItem1, LPARAM iItem2, LPARAM lExtra)
/* 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);
+ const int iOrder = Cmp(lpElv->m_iSort, 0);
switch (abs(lpElv->m_iSort)-1) {
case ELVSIEPISODE: