aboutsummaryrefslogtreecommitdiff
path: root/c/ext.cpp
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2022-09-02 20:16:04 +0200
committerJohn Ankarström <john@ankarstrom.se>2022-09-02 20:16:18 +0200
commitbc4cef92d8efbf97a9215122abc2d7247c287f12 (patch)
treea5ca307281c4f143b5f172428c9fd2b629d6b426 /c/ext.cpp
parent5c1c2ce2bdbf9735ad8a4d162609a8c22a4f0954 (diff)
downloadEpisodeBrowser-bc4cef92d8efbf97a9215122abc2d7247c287f12.tar.gz
Improve Window object.
Diffstat (limited to 'c/ext.cpp')
-rw-r--r--c/ext.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/c/ext.cpp b/c/ext.cpp
index 77028d1..ea6718a 100644
--- a/c/ext.cpp
+++ b/c/ext.cpp
@@ -3,14 +3,12 @@
#include <string_view>
#include "data.h"
-#include "main.h"
+#include "window.h"
-extern Window* g_window;
-
-bool OpenOnline(int iEp)
+bool OpenOnline(const CfgA& cfg, int iEp)
{
- wchar_t url[sizeof(g_window->cfg.url)+4];
- Swprintf(url, L"%s%d", g_window->cfg.url, iEp);
+ wchar_t url[sizeof(cfg.url)+4];
+ Swprintf(url, L"%s%d", cfg.url, iEp);
INT_PTR r = reinterpret_cast<INT_PTR>(
ShellExecuteW(nullptr, L"open", url, nullptr, nullptr, SW_SHOWNORMAL));
if (r <= 32)
@@ -18,9 +16,8 @@ bool OpenOnline(int iEp)
return true;
}
-bool OpenWiki(int iEp)
+bool OpenWiki(const DlvDataA& d)
{
- 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>(
@@ -110,10 +107,10 @@ static bool FindMatchingFile(wchar_t (&file)[MAX_PATH], const wchar_t* const roo
return false;
}
-bool OpenLocally(int iEp)
+bool OpenLocally(CfgA& cfg, const ElvDataA& e)
{
wchar_t file[MAX_PATH];
- if (FindMatchingFile(file, g_window->cfg.root, g_window->fvElv.At(iEp-1).siEp)) {
+ if (FindMatchingFile(file, cfg.root, e.siEp)) {
INT_PTR r = reinterpret_cast<INT_PTR>(
ShellExecuteW(nullptr, L"open", file, nullptr, nullptr, SW_SHOWNORMAL));
if (r <= 32)