aboutsummaryrefslogtreecommitdiff
path: root/c/episodelistview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'c/episodelistview.cpp')
-rw-r--r--c/episodelistview.cpp98
1 files changed, 49 insertions, 49 deletions
diff --git a/c/episodelistview.cpp b/c/episodelistview.cpp
index 706c51a..a24c831 100644
--- a/c/episodelistview.cpp
+++ b/c/episodelistview.cpp
@@ -22,17 +22,17 @@ EpisodeListView::EpisodeListView(const HWND hWndParent)
lvc.iSubItem = ELVSIEPISODE;
lvc.pszText = TEXT("#");
lvc.cx = Dpi(42);
- ListView_InsertColumn(m_hWnd, ELVSIEPISODE, &lvc);
+ ListView_InsertColumn(hWnd, ELVSIEPISODE, &lvc);
lvc.iSubItem = ELVSITITLE;
lvc.pszText = TEXT("Title");
lvc.cx = 500;
- ListView_InsertColumn(m_hWnd, ELVSITITLE, &lvc);
+ ListView_InsertColumn(hWnd, ELVSITITLE, &lvc);
lvc.iSubItem = ELVSIRATING;
lvc.pszText = TEXT("/");
lvc.cx = Dpi(30);
- ListView_InsertColumn(m_hWnd, ELVSIRATING, &lvc);
+ ListView_InsertColumn(hWnd, ELVSIRATING, &lvc);
if (!Pl("cfg","get_sort",&m_iSort))
m_iSort = 1;
@@ -40,14 +40,14 @@ EpisodeListView::EpisodeListView(const HWND hWndParent)
void EpisodeListView::DoSort()
{
- ListView_SortItemsEx(m_hWnd, ElvSort, (LPARAM)this);
+ ListView_SortItemsEx(hWnd, ElvSort, (LPARAM)this);
}
void EpisodeListView::EnsureFocusVisible()
{
- const int iEpFocus = ListView_GetNextItem(m_hWnd, -1, LVNI_FOCUSED);
+ const int iEpFocus = ListView_GetNextItem(hWnd, -1, LVNI_FOCUSED);
if (iEpFocus == -1) return;
- ListView_EnsureVisible(m_hWnd, iEpFocus, TRUE);
+ ListView_EnsureVisible(hWnd, iEpFocus, TRUE);
}
LRESULT EpisodeListView::HandleNotify(const LPARAM lParam)
@@ -119,8 +119,8 @@ LRESULT EpisodeListView::HandleNotify(const LPARAM lParam)
lvi.mask = LVIF_PARAM;
lvi.iItem = -1;
while ((lvi.iItem = ListView_GetNextItem(
- m_hWnd, lvi.iItem, LVNI_SELECTED)) != -1) {
- if (!ListView_GetItem(m_hWnd, &lvi)) goto b;
+ hWnd, lvi.iItem, LVNI_SELECTED)) != -1) {
+ if (!ListView_GetItem(hWnd, &lvi)) goto b;
if (!Pl("local_episodes","open_episode_locally",
lvi.lParam))
Pl("local_episodes","open_episode_online",
@@ -144,7 +144,7 @@ LRESULT EpisodeListView::HandleNotify(const LPARAM lParam)
void EpisodeListView::Redraw()
{
- RedrawWindow(m_hWnd, NULL, NULL,
+ RedrawWindow(hWnd, NULL, NULL,
RDW_ERASE|RDW_FRAME|RDW_INVALIDATE|RDW_ALLCHILDREN);
}
@@ -152,16 +152,16 @@ void EpisodeListView::SaveFocus()
{
LVITEM lvi;
lvi.mask = LVIF_PARAM;
- if ((lvi.iItem = ListView_GetNextItem(m_hWnd, -1, LVNI_FOCUSED)) != -1
- && ListView_GetItem(m_hWnd, &lvi))
+ if ((lvi.iItem = ListView_GetNextItem(hWnd, -1, LVNI_FOCUSED)) != -1
+ && ListView_GetItem(hWnd, &lvi))
Pl("cfg","set_focus",lvi.lParam);
}
void EpisodeListView::SetTop(const int iItem)
{
- const int iLast = ListView_GetItemCount(m_hWnd)-1;
- ListView_EnsureVisible(m_hWnd, iLast, TRUE);
- ListView_EnsureVisible(m_hWnd, iItem, TRUE);
+ const int iLast = ListView_GetItemCount(hWnd)-1;
+ ListView_EnsureVisible(hWnd, iLast, TRUE);
+ ListView_EnsureVisible(hWnd, iItem, TRUE);
}
/* Select previously focused episode. */
@@ -176,21 +176,21 @@ void EpisodeListView::RestoreFocus()
lvfi.flags = LVFI_PARAM;
lvfi.lParam = iEpisode;
i = 0;
- while ((iItem = ListView_FindItem(m_hWnd, -1, &lvfi)) == -1 && i++ < 100)
+ while ((iItem = ListView_FindItem(hWnd, -1, &lvfi)) == -1 && i++ < 100)
lvfi.lParam = ++iEpisode;
if (iItem != -1) goto s;
iEpisode -= 100;
lvfi.lParam = iEpisode;
i = 0;
- while ((iItem = ListView_FindItem(m_hWnd, -1, &lvfi)) == -1 && i++ < 100)
+ while ((iItem = ListView_FindItem(hWnd, -1, &lvfi)) == -1 && i++ < 100)
lvfi.lParam = --iEpisode;
if (iItem != -1) goto s;
return;
-s: ListView_SetItemState(m_hWnd, -1, LVIF_STATE, LVIS_SELECTED);
+s: ListView_SetItemState(hWnd, -1, LVIF_STATE, LVIS_SELECTED);
SetTop(iItem > 5? iItem-5: 0);
- ListView_SetItemState(m_hWnd, iItem,
+ ListView_SetItemState(hWnd, iItem,
LVIS_SELECTED|LVIS_FOCUSED, LVIS_SELECTED|LVIS_FOCUSED);
m_lviFocus.iItem = iItem;
m_lviFocus.lParam = iEpisode;
@@ -204,8 +204,8 @@ void EpisodeListView::SelectUnwatched(int iDir)
/* Get focused episode. */
LVITEM lviFocus;
lviFocus.mask = LVIF_PARAM;
- if ((lviFocus.iItem = ListView_GetNextItem(m_hWnd, -1, LVNI_FOCUSED)) != -1
- && ListView_GetItem(m_hWnd, &lviFocus))
+ if ((lviFocus.iItem = ListView_GetNextItem(hWnd, -1, LVNI_FOCUSED)) != -1
+ && ListView_GetItem(hWnd, &lviFocus))
;
else
return;
@@ -222,14 +222,14 @@ void EpisodeListView::SelectUnwatched(int iDir)
return;
lvfi.lParam = iEpNew;
- if ((iItemNew = ListView_FindItem(m_hWnd, -1, &lvfi)) != -1) {
- ListView_SetItemState(m_hWnd,-1,LVIF_STATE,LVIS_SELECTED);
- ListView_SetSelectionMark(m_hWnd, iItemNew);
- ListView_SetItemState(m_hWnd, iItemNew,
+ if ((iItemNew = ListView_FindItem(hWnd, -1, &lvfi)) != -1) {
+ ListView_SetItemState(hWnd,-1,LVIF_STATE,LVIS_SELECTED);
+ ListView_SetSelectionMark(hWnd, iItemNew);
+ ListView_SetItemState(hWnd, iItemNew,
LVIS_SELECTED|LVIS_FOCUSED,
LVIS_SELECTED|LVIS_FOCUSED);
Redraw();
- ListView_EnsureVisible(m_hWnd, iItemNew, TRUE);
+ ListView_EnsureVisible(hWnd, iItemNew, TRUE);
return;
}
} while (i++ < 1000);
@@ -237,9 +237,9 @@ void EpisodeListView::SelectUnwatched(int iDir)
void EpisodeListView::ShowFocus()
{
- const int iEpFocus = ListView_GetNextItem(m_hWnd, -1, LVNI_FOCUSED);
+ const int iEpFocus = ListView_GetNextItem(hWnd, -1, LVNI_FOCUSED);
if (iEpFocus == -1) return;
- ListView_EnsureVisible(m_hWnd, iEpFocus, TRUE);
+ ListView_EnsureVisible(hWnd, iEpFocus, TRUE);
}
/* Update episode list. */
@@ -255,30 +255,30 @@ void EpisodeListView::Update()
lviEpisode.mask = LVIF_TEXT|LVIF_PARAM;
/* Save scrolling position. */
- lviTop.iItem = ListView_GetTopIndex(m_hWnd);
+ lviTop.iItem = ListView_GetTopIndex(hWnd);
lviTop.mask = LVIF_PARAM;
- ListView_GetItem(m_hWnd, &lviTop);
+ ListView_GetItem(hWnd, &lviTop);
/* Save selected episodes. */
i = 0;
lvi.mask = LVIF_PARAM;
lvi.iItem = -1;
while ((lvi.iItem = ListView_GetNextItem(
- m_hWnd, lvi.iItem, LVNI_SELECTED)) != -1
+ hWnd, lvi.iItem, LVNI_SELECTED)) != -1
&& i < 2048)
- if (ListView_GetItem(m_hWnd, &lvi))
+ if (ListView_GetItem(hWnd, &lvi))
aEpSel[i++] = lvi.lParam;
aEpSel[i] = 0;
- iItemMark = ListView_GetSelectionMark(m_hWnd);
+ iItemMark = ListView_GetSelectionMark(hWnd);
/* Save focus. */
iEpFocus = 0;
- if ((lvi.iItem = ListView_GetNextItem(m_hWnd, -1, LVNI_FOCUSED)) != -1
- && ListView_GetItem(m_hWnd, &lvi))
+ if ((lvi.iItem = ListView_GetNextItem(hWnd, -1, LVNI_FOCUSED)) != -1
+ && ListView_GetItem(hWnd, &lvi))
iEpFocus = lvi.lParam;
- SendMessage(m_hWnd, WM_SETREDRAW, FALSE, 0);
- ListView_DeleteAllItems(m_hWnd);
+ SendMessage(hWnd, WM_SETREDRAW, FALSE, 0);
+ ListView_DeleteAllItems(hWnd);
if (!Pl("episode_data","ensure_episode_data")) return;
if (!Pl("episode_data","episode_count",&cEp)) return;
@@ -305,7 +305,7 @@ void EpisodeListView::Update()
lviEpisode.iSubItem = ELVSIEPISODE;
lviEpisode.pszText = tszEpisode;
lviEpisode.lParam = iEp;
- ListView_InsertItem(m_hWnd, &lviEpisode);
+ ListView_InsertItem(hWnd, &lviEpisode);
UpdateItem(&lviEpisode);
}
@@ -317,12 +317,12 @@ void EpisodeListView::Update()
for (i = 0; aEpSel[i]; i++) {
int iItemSel;
lvfi.lParam = aEpSel[i];
- if ((iItemSel = ListView_FindItem(m_hWnd, -1, &lvfi)) != -1)
- ListView_SetItemState(m_hWnd, iItemSel,
+ if ((iItemSel = ListView_FindItem(hWnd, -1, &lvfi)) != -1)
+ ListView_SetItemState(hWnd, iItemSel,
LVIS_SELECTED, LVIS_SELECTED);
}
if (iItemMark != -1)
- ListView_SetSelectionMark(m_hWnd, iItemMark);
+ ListView_SetSelectionMark(hWnd, iItemMark);
/* Reset focus. */
if (iEpFocus) {
@@ -330,10 +330,10 @@ void EpisodeListView::Update()
i = 0;
do
lvfi.lParam = iEpFocus+i;
- while ((iItemFocus = ListView_FindItem(m_hWnd, -1, &lvfi)) == -1
+ while ((iItemFocus = ListView_FindItem(hWnd, -1, &lvfi)) == -1
&& i++ < 100);
if (iItemFocus != -1)
- ListView_SetItemState(m_hWnd, iItemFocus,
+ ListView_SetItemState(hWnd, iItemFocus,
LVIS_FOCUSED, LVIS_FOCUSED);
}
@@ -342,14 +342,14 @@ void EpisodeListView::Update()
i = 0;
do
lvfi.lParam = lviTop.lParam+i;
- while ((iItemTopNew = ListView_FindItem(m_hWnd, -1, &lvfi)) == -1
+ while ((iItemTopNew = ListView_FindItem(hWnd, -1, &lvfi)) == -1
&& i++ < 100);
if (iItemTopNew != -1)
SetTop(iItemTopNew);
_stprintf_s(tszDisp, sizeof(tszDisp), TEXT("%d"), iItem);
SendMessage(g_hWndStatus, SB_SETTEXT, MAKEWPARAM(1,0), (LPARAM)tszDisp);
- SendMessage(m_hWnd, WM_SETREDRAW, TRUE, 0);
+ SendMessage(hWnd, WM_SETREDRAW, TRUE, 0);
}
/* Update episode name and rating. */
@@ -364,15 +364,15 @@ void EpisodeListView::UpdateItem(const LVITEM* const pLvi)
if (!Pl("episode_data","episode_title",pLvi->lParam,&tszName))
goto r;
}
- ListView_SetItemText(m_hWnd, pLvi->iItem, ELVSITITLE, tszName);
+ ListView_SetItemText(hWnd, pLvi->iItem, ELVSITITLE, tszName);
r: if (!Pl("episode_data","episode_rating",pLvi->lParam,&iRating)) {
- ListView_SetItemText(m_hWnd, pLvi->iItem, ELVSIRATING, TEXT(""));
+ ListView_SetItemText(hWnd, pLvi->iItem, ELVSIRATING, TEXT(""));
return;
}
_stprintf_s(tszRating, sizeof(tszRating), TEXT("%d"), iRating);
- ListView_SetItemText(m_hWnd, pLvi->iItem, ELVSIRATING, tszRating);
+ ListView_SetItemText(hWnd, pLvi->iItem, ELVSIRATING, tszRating);
}
LRESULT CALLBACK EpisodeListView::WndProc(const HWND hWnd, const UINT uMsg,
@@ -404,8 +404,8 @@ int CALLBACK ElvSort(const LPARAM iItem1, const LPARAM iItem2, const LPARAM lExt
LVITEM lvi1, lvi2;
lvi1.mask = lvi2.mask = LVIF_PARAM;
lvi1.iItem = iItem1; lvi2.iItem = iItem2;
- if (!ListView_GetItem(pElv->Handle(), &lvi1)) return 0;
- if (!ListView_GetItem(pElv->Handle(), &lvi2)) return 0;
+ if (!ListView_GetItem(pElv->hWnd, &lvi1)) return 0;
+ if (!ListView_GetItem(pElv->hWnd, &lvi2)) return 0;
/* abs(m_iSort) is the 1-based index of the column to sort by.
* If m_iSort is negative, the order is descending. */