From e12dafae0488d82d05be9dfde3d99f9e3cbb0ce0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Sat, 28 May 2022 20:50:33 +0200 Subject: Add option to show/hide other screenwriters. --- c/main.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 57 insertions(+), 3 deletions(-) (limited to 'c/main.c') diff --git a/c/main.c b/c/main.c index f312206..1ce77d9 100644 --- a/c/main.c +++ b/c/main.c @@ -6,6 +6,7 @@ #include "resource.h" #include "defs.h" +char SzLimitScreenwriter[64] = {0}; HFONT HfNormal; HFONT HfBold; HMENU HPopupMenu; @@ -127,7 +128,7 @@ WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) term_t t; t = T(1); P("cfg","get_view_watched",1,t) goto s; - GI(t,&BViewWatched); + GI(t,&BViewWatched) goto s; CheckMenuItem(GetMenu(hWnd), IDM_VIEW_WATCHED, BViewWatched? MF_CHECKED: MF_UNCHECKED); } @@ -135,11 +136,22 @@ WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) term_t t; t = T(1); P("cfg","get_view_tv_original",1,t) goto t; - GI(t,&BViewTVOriginal); + GI(t,&BViewTVOriginal) goto t; CheckMenuItem(GetMenu(hWnd), IDM_VIEW_TV_ORIGINAL, BViewTVOriginal? MF_CHECKED: MF_UNCHECKED); } - t: SetupFonts(); + t: { + char *sz; + term_t t; + t = T(1); + P("cfg","get_limit_screenwriter",1,t) goto u; + GAC(t,&sz) goto u; + strcpy_s(SzLimitScreenwriter, + sizeof(SzLimitScreenwriter), sz); + CheckMenuItem(GetMenu(hWnd), IDM_VIEW_OTHERS, + SzLimitScreenwriter[0]? MF_UNCHECKED: MF_CHECKED); + } + u: SetupFonts(); DlvCreate(); ElvCreate(); UpdateTheme(); @@ -270,6 +282,48 @@ WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) ListView_EnsureVisible(HElv, iEpFocus, TRUE); break; } + case IDM_VIEW_OTHERS: /* Show/hide other screenwriters. */ + { + atom_t a; + int iEpFocus; + term_t t; + extern HWND HElv; + if (SzLimitScreenwriter[0]) { + CheckMenuItem(GetMenu(hWnd), IDM_VIEW_OTHERS, + MF_CHECKED); + SzLimitScreenwriter[0] = 0; + } else { + atom_t a; + char *sz; + LVITEM lvi; + term_t t; + iEpFocus = ListView_GetNextItem(HElv, -1, LVNI_FOCUSED); + if (iEpFocus == -1) break; + lvi.iItem = iEpFocus; + lvi.mask = LVIF_PARAM; + if (!ListView_GetItem(HElv, &lvi)) break; + t = T(3); + a = A("Screenwriter"); + PI(t,lvi.lParam) break; + PA(t+1,a) break; + P("episode_data","episode_datum",3,t) break; + GAC(t+2,&sz) break; + strcpy_s(SzLimitScreenwriter, + sizeof(SzLimitScreenwriter), sz); + CheckMenuItem(GetMenu(hWnd), IDM_VIEW_OTHERS, + MF_UNCHECKED); + } + OutputDebugStringA(SzLimitScreenwriter); + ElvUpdate(); + t = T(1); + a = A(SzLimitScreenwriter); + PA(t,a) break; + P("cfg","set_limit_screenwriter",1,t); + iEpFocus = ListView_GetNextItem(HElv, -1, LVNI_FOCUSED); + if (iEpFocus == -1) break; + ListView_EnsureVisible(HElv, iEpFocus, TRUE); + break; + } case IDM_WATCH: case IDM_TOGGLE: case IDM_FORGET: -- cgit v1.2.3