aboutsummaryrefslogtreecommitdiff
path: root/c/episodelistview.cpp
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2022-08-18 01:52:32 +0200
committerJohn Ankarström <john@ankarstrom.se>2022-08-18 01:52:32 +0200
commita9a4938f87cb3ce2a0214d45925bcdb4ba8d2a28 (patch)
treeff48d053aba1b93dc0771ed20b99d7e0211dd101 /c/episodelistview.cpp
parent5f92d1e00e12085bedc86c6274b254589053c411 (diff)
downloadEpisodeBrowser-a9a4938f87cb3ce2a0214d45925bcdb4ba8d2a28.tar.gz
Move file views out of EpisodeListView and DataListView.
Diffstat (limited to 'c/episodelistview.cpp')
-rw-r--r--c/episodelistview.cpp19
1 files changed, 8 insertions, 11 deletions
diff --git a/c/episodelistview.cpp b/c/episodelistview.cpp
index db53be3..6caff99 100644
--- a/c/episodelistview.cpp
+++ b/c/episodelistview.cpp
@@ -13,6 +13,7 @@
#include "win.h"
extern CfgA& g_cfg;
+extern FileView<ElvDataA> g_fvElv;
EpisodeListView::EpisodeListView(const HWND hWndParent)
: ListView(hWndParent, reinterpret_cast<HMENU>(IDC_EPISODELISTVIEW), 0)
@@ -55,7 +56,7 @@ void EpisodeListView::HandleContextMenu(const WORD command)
LVITEM lvi = {LVIF_PARAM, -1};
while (FindNextItem(&lvi, LVNI_SELECTED)) {
- ElvDataA& e = m_fv.At(lvi.lParam-1);
+ ElvDataA& e = g_fvElv.At(lvi.lParam-1);
if (ID_SUBGROUP(command) == IDG_CTX_RATE) {
/* Process rate commands. */
@@ -117,7 +118,7 @@ LRESULT EpisodeListView::HandleNotify(const LPARAM lParam)
case LVN_GETDISPINFO: /* Display item. */
{
NMLVDISPINFO* const nm = reinterpret_cast<NMLVDISPINFO*>(lParam);
- ElvDataA& e = m_fv.At(nm->item.lParam-1);
+ ElvDataA& e = g_fvElv.At(nm->item.lParam-1);
wchar_t* vs[] = {e.siEp, e.title, e.sRating}; /* ELVSIEPISODE, ELVSITITLE, ELVSIRATING */
nm->item.pszText = vs[nm->item.iSubItem];
return 0;
@@ -166,7 +167,7 @@ LRESULT EpisodeListView::HandleNotify(const LPARAM lParam)
break;
case CDDS_ITEMPREPAINT:
{
- const ElvDataA& e = m_fv.At(nm->nmcd.lItemlParam-1);
+ const ElvDataA& e = g_fvElv.At(nm->nmcd.lItemlParam-1);
if (!e.bWatched) {
extern HFONT g_hfBold;
Require(SelectObject(nm->nmcd.hdc, g_hfBold));
@@ -329,8 +330,8 @@ int CALLBACK EpisodeListView::SortProc(const LPARAM iItem1, const LPARAM iItem2,
* If m_iSortCol is negative, the order is descending. */
const int order = Cmp(elv->m_iSortCol, 0);
- const ElvDataA& e1 = elv->m_fv[lvi1.lParam-1];
- const ElvDataA& e2 = elv->m_fv.At(lvi2.lParam-1);
+ const ElvDataA& e1 = g_fvElv[lvi1.lParam-1];
+ const ElvDataA& e2 = g_fvElv.At(lvi2.lParam-1);
switch (abs(elv->m_iSortCol)-1) {
case ELVSIEPISODE:
@@ -387,18 +388,14 @@ void EpisodeListView::Update()
}
{
- int cEp;
- if (!Pl("episode_data","episode_count",&cEp))
- return;
-
int cItem = 0;
LVITEM lviEpisode = {LVIF_TEXT|LVIF_PARAM};
/* Retrieve episode data and add list view items. */
SendMessage(hWnd, WM_SETREDRAW, FALSE, 0);
ListView_DeleteAllItems(hWnd);
- for (int iEp = 1; iEp <= cEp; iEp++) {
- ElvDataA e = m_fv.At(iEp-1);
+ for (int iEp = 1; iEp <= g_cfg.cEp; iEp++) {
+ ElvDataA e = g_fvElv.At(iEp-1);
if (!e.siEp[0])
continue;