diff options
author | John Ankarström <john@ankarstrom.se> | 2022-04-07 00:22:37 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2022-04-07 00:22:37 +0200 |
commit | 966a203ff8409972aefe3dd7d243d36adaf21fce (patch) | |
tree | f15b8ffefb867a4b7ac95a49bd6170a3ed58f070 | |
parent | c4e5a91da5f50b01cbf46d70830fdb7e51413e29 (diff) | |
download | EpisodeBrowser-966a203ff8409972aefe3dd7d243d36adaf21fce.tar.gz |
Add "View TV Originals" option.
-rw-r--r-- | c/episodelistview.c | 10 | ||||
-rw-r--r-- | c/main.c | 37 | ||||
-rw-r--r-- | c/resource.h | 1 | ||||
-rw-r--r-- | c/resource.rc | 1 | ||||
-rw-r--r-- | pl/cfg.pl | 7 | ||||
-rw-r--r-- | pl/episode_data.pl | 5 |
6 files changed, 53 insertions, 8 deletions
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)); @@ -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 @@ -38,3 +38,10 @@ get_view_watched(V) :- integer(V), ! ; V = 1 ). + +set_view_tv_original(V) :- set_key('ViewTVOriginal', V). +get_view_tv_original(V) :- + ( get_key('ViewTVOriginal', V), + integer(V), ! + ; V = 1 + ). diff --git a/pl/episode_data.pl b/pl/episode_data.pl index e944243..557cddf 100644 --- a/pl/episode_data.pl +++ b/pl/episode_data.pl @@ -2,7 +2,8 @@ retract_episode/1, episode_count/1, rate_episode/2, - episode_rating/2]). + episode_rating/2, + tv_original/1]). :- use_module(library(clpfd)). :- use_module(library(dcg/basics)). @@ -54,6 +55,8 @@ rate_episode(Ep, R) :- ; assert_episode_rating(Ep, R) ). +tv_original(Ep) :- episode_datum(Ep, 'Source', 'TV Original'). + % Remote data retrieval. episode_number(Ep) --> integer(Ep). |