From 90c7bc237c9cf964c16f0cb48c308a92a8193a5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Fri, 2 Sep 2022 02:11:49 +0200 Subject: Use global Window object. This makes it easier to control initialization and maintain RAII. --- c/datalistview.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'c/datalistview.cpp') diff --git a/c/datalistview.cpp b/c/datalistview.cpp index b63a342..cdd8189 100644 --- a/c/datalistview.cpp +++ b/c/datalistview.cpp @@ -9,12 +9,10 @@ #include "episodelistview.h" #include "listview.h" #include "layout.h" +#include "main.h" -extern CfgA& g_cfg; -extern FileView g_fvDlv; - -DataListView::DataListView(const HWND hWndParent) - : ListView(hWndParent, reinterpret_cast(IDC_DATALISTVIEW), LVS_NOCOLUMNHEADER) +DataListView::DataListView(Window& parent) + : ListView(parent, reinterpret_cast(IDC_DATALISTVIEW), LVS_NOCOLUMNHEADER) { LVCOLUMN lvc; @@ -30,7 +28,7 @@ DataListView::DataListView(const HWND hWndParent) lvc.cx = 500; ListView_InsertColumn(hWnd, DLVSIVALUE, &lvc); - m_height = g_cfg.heightDlv; + m_height = parent.cfg.heightDlv; } int DataListView::Height() @@ -53,7 +51,7 @@ void DataListView::SetHeight(int h) void DataListView::ShowEpisode(const int iEpisode) { - const DlvDataA& d = g_fvDlv[iEpisode-1]; + const DlvDataA& d = parent.fvDlv[iEpisode-1]; ListView_DeleteAllItems(hWnd); if (d.version == Version) { @@ -88,8 +86,7 @@ void DataListView::ShowEpisode(const int iEpisode) LVFINDINFO lvfi; lvfi.flags = LVFI_PARAM; lvfi.lParam = iEpisode; - extern EpisodeListView* g_elv; - int iItem = ListView_FindItem(g_elv->hWnd, -1, &lvfi); + int iItem = ListView_FindItem(parent.elv.hWnd, -1, &lvfi); if (iItem != -1) - ListView_EnsureVisible(g_elv->hWnd, iItem, TRUE); + ListView_EnsureVisible(parent.elv.hWnd, iItem, TRUE); } -- cgit v1.2.3