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/ext.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/ext.cpp')
-rw-r--r-- | c/ext.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
@@ -3,15 +3,14 @@ #include <string_view> #include "data.h" +#include "main.h" -extern CfgA& g_cfg; -extern FileView<ElvDataA> g_fvElv; -extern FileView<DlvDataA> g_fvDlv; +extern Window* g_window; bool OpenOnline(int iEp) { - wchar_t url[sizeof(g_cfg.url)+4]; - Swprintf(url, L"%s%d", g_cfg.url, iEp); + wchar_t url[sizeof(g_window->cfg.url)+4]; + Swprintf(url, L"%s%d", g_window->cfg.url, iEp); INT_PTR r = reinterpret_cast<INT_PTR>( ShellExecuteW(nullptr, L"open", url, nullptr, nullptr, SW_SHOWNORMAL)); if (r <= 32) @@ -21,7 +20,7 @@ bool OpenOnline(int iEp) bool OpenWiki(int iEp) { - const DlvDataA& d = g_fvDlv.At(iEp-1); + const DlvDataA& d = g_window->fvDlv.At(iEp-1); wchar_t url[sizeof(d.wiki)+35]; Swprintf(url, L"https://www.detectiveconanworld.com%s", d.wiki); INT_PTR r = reinterpret_cast<INT_PTR>( @@ -114,7 +113,7 @@ static bool FindMatchingFile(wchar_t (&file)[MAX_PATH], const wchar_t* const roo bool OpenLocally(int iEp) { wchar_t file[MAX_PATH]; - if (FindMatchingFile(file, g_cfg.root, g_fvElv.At(iEp-1).siEp)) { + if (FindMatchingFile(file, g_window->cfg.root, g_window->fvElv.At(iEp-1).siEp)) { INT_PTR r = reinterpret_cast<INT_PTR>( ShellExecuteW(nullptr, L"open", file, nullptr, nullptr, SW_SHOWNORMAL)); if (r <= 32) |