From 966a203ff8409972aefe3dd7d243d36adaf21fce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Thu, 7 Apr 2022 00:22:37 +0200 Subject: Add "View TV Originals" option. --- c/episodelistview.c | 10 +++++++++- c/main.c | 37 +++++++++++++++++++++++++++++++------ c/resource.h | 1 + c/resource.rc | 1 + 4 files changed, 42 insertions(+), 7 deletions(-) (limited to 'c') diff --git a/c/episodelistview.c b/c/episodelistview.c index f1cc819..73a97ff 100644 --- a/c/episodelistview.c +++ b/c/episodelistview.c @@ -202,7 +202,7 @@ ElvUpdate() for (iItem = 0, iEpisode = 1; iEpisode <= iEpisodes; iEpisode++) { int cb; TCHAR *tszEpisode; - extern int BViewWatched; + extern int BViewTVOriginal, BViewWatched; if (!BViewWatched) { term_t t; @@ -212,6 +212,14 @@ ElvUpdate() continue; } + if (!BViewTVOriginal) { + term_t t; + t = T(1); + PI(t,iEpisode) goto ep; + P("episode_data","tv_original",1,t) goto ep; + continue; + } + /* Format episode number string. */ ep: cb = 100; tszEpisode = malloc(cb*sizeof(TCHAR)); diff --git a/c/main.c b/c/main.c index cbc3167..b959417 100644 --- a/c/main.c +++ b/c/main.c @@ -11,6 +11,7 @@ HFONT HfBold; HMENU HPopupMenu; HWND HFocus; HWND HWnd; +int BViewTVOriginal = 1; int BViewWatched = 1; int IDPI = -1; static int BThemes; @@ -110,7 +111,6 @@ WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { HMODULE hModule; FARPROC GetDpiForWindow; - term_t t; extern HWND HWnd, HElv; HWnd = hWnd; IDPI = 96; @@ -120,10 +120,22 @@ WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) FreeLibrary(hModule); } SetWindowPos(hWnd, NULL, -1, -1, Dpi(510), Dpi(400), SWP_NOMOVE); - t = T(1); - P("cfg","get_view_watched",1,t) goto s; - GI(t,&BViewWatched); - CheckMenuItem(GetMenu(hWnd), ID_VIEW_WATCHED, BViewWatched? MF_CHECKED: MF_UNCHECKED); + { + term_t t; + t = T(1); + P("cfg","get_view_watched",1,t) goto s; + GI(t,&BViewWatched); + CheckMenuItem(GetMenu(hWnd), ID_VIEW_WATCHED, + BViewWatched? MF_CHECKED: MF_UNCHECKED); + } + { + term_t t; + t = T(1); + P("cfg","get_view_tv_original",1,t) goto s; + GI(t,&BViewTVOriginal); + CheckMenuItem(GetMenu(hWnd), ID_VIEW_TV_ORIGINAL, + BViewTVOriginal? MF_CHECKED: MF_UNCHECKED); + } s: SetupFonts(); DlvCreate(); ElvCreate(); @@ -207,7 +219,8 @@ WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case ID_VIEW_WATCHED: { term_t t; - CheckMenuItem(GetMenu(hWnd), ID_VIEW_WATCHED, BViewWatched? MF_UNCHECKED: MF_CHECKED); + CheckMenuItem(GetMenu(hWnd), ID_VIEW_WATCHED, + BViewWatched? MF_UNCHECKED: MF_CHECKED); BViewWatched = !BViewWatched; ElvUpdate(); t = T(1); @@ -215,6 +228,18 @@ WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) P("cfg","set_view_watched",1,t); break; } + case ID_VIEW_TV_ORIGINAL: + { + term_t t; + CheckMenuItem(GetMenu(hWnd), ID_VIEW_TV_ORIGINAL, + BViewTVOriginal? MF_UNCHECKED: MF_CHECKED); + BViewTVOriginal = !BViewTVOriginal; + ElvUpdate(); + t = T(1); + PI(t,BViewTVOriginal) break; + P("cfg","set_view_tv_original",1,t); + break; + } case ID_WATCH: case ID_TOGGLE: case ID_FORGET: diff --git a/c/resource.h b/c/resource.h index f816463..b60432a 100644 --- a/c/resource.h +++ b/c/resource.h @@ -12,6 +12,7 @@ #define ID_FILE_RESET 403 #define ID_FILE_ABOUT 411 #define ID_VIEW_WATCHED 421 +#define ID_VIEW_TV_ORIGINAL 422 #define ID_WATCH 501 #define ID_TOGGLE 502 #define ID_FORGET 503 diff --git a/c/resource.rc b/c/resource.rc index e970565..68fdc5f 100644 --- a/c/resource.rc +++ b/c/resource.rc @@ -14,6 +14,7 @@ BEGIN POPUP "&View" BEGIN MENUITEM "&Watched", ID_VIEW_WATCHED, CHECKED + MENUITEM "&TV Originals", ID_VIEW_TV_ORIGINAL, CHECKED END POPUP "&Help" BEGIN -- cgit v1.2.3