diff options
author | John Ankarström <john@ankarstrom.se> | 2022-09-02 02:11:49 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2022-09-02 02:14:11 +0200 |
commit | 90c7bc237c9cf964c16f0cb48c308a92a8193a5c (patch) | |
tree | 53f165056dffa061a9dfe39b76913edab87056f4 /c/datalistview.cpp | |
parent | bb9280267bfb78a8d69adea02f5ed7894833b19d (diff) | |
download | EpisodeBrowser-90c7bc237c9cf964c16f0cb48c308a92a8193a5c.tar.gz |
Use global Window object.
This makes it easier to control initialization and maintain RAII.
Diffstat (limited to 'c/datalistview.cpp')
-rw-r--r-- | c/datalistview.cpp | 17 |
1 files changed, 7 insertions, 10 deletions
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<DlvDataA> g_fvDlv; - -DataListView::DataListView(const HWND hWndParent) - : ListView(hWndParent, reinterpret_cast<HMENU>(IDC_DATALISTVIEW), LVS_NOCOLUMNHEADER) +DataListView::DataListView(Window& parent) + : ListView(parent, reinterpret_cast<HMENU>(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<DlvDataA>) { @@ -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); } |