From a9a4938f87cb3ce2a0214d45925bcdb4ba8d2a28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Thu, 18 Aug 2022 01:52:32 +0200 Subject: Move file views out of EpisodeListView and DataListView. --- c/episodelistview.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'c/episodelistview.cpp') 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 g_fvElv; EpisodeListView::EpisodeListView(const HWND hWndParent) : ListView(hWndParent, reinterpret_cast(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(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; -- cgit v1.2.3