From df61ed83d8511f3ecb26d5af119df619b430b2f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Sat, 2 Apr 2022 03:40:44 +0200 Subject: Open only clicked episode on double-click. --- c/episodelistview.c | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) (limited to 'c/episodelistview.c') diff --git a/c/episodelistview.c b/c/episodelistview.c index 657b099..39b5c8a 100644 --- a/c/episodelistview.c +++ b/c/episodelistview.c @@ -6,10 +6,8 @@ #include "resource.h" #include "defs.h" -extern HFONT HfBold; -extern HWND HWnd; HWND HElv; -LPLVITEM LpLviElvSelection; +LPLVITEM LpLviElvSelection; /* Most recently selected episode. */ HWND ElvCreate() @@ -47,15 +45,15 @@ ElvHandleNotify(LPARAM lParam) switch (lpNmLv->hdr.code) { case LVN_ITEMCHANGED: - if ((lpNmLv->uChanged & LVIF_STATE) - && (lpNmLv->uNewState & LVIS_FOCUSED)) { + if ((lpNmLv->uChanged & LVIF_STATE) && + (lpNmLv->uNewState & LVIS_FOCUSED)) { LpLviElvSelection->iItem = lpNmLv->iItem; LpLviElvSelection->lParam = lpNmLv->lParam; ElvUpdateName(LpLviElvSelection); DlvShowEpisode(lpNmLv->lParam); } break; - case NM_CUSTOMDRAW: + case NM_CUSTOMDRAW: /* Make unwatched episodes bold. */ { LPNMLVCUSTOMDRAW lpLvCd; lpLvCd = (LPNMLVCUSTOMDRAW)lParam; @@ -64,23 +62,33 @@ ElvHandleNotify(LPARAM lParam) return CDRF_NOTIFYITEMDRAW; break; case CDDS_ITEMPREPAINT: - if (!Watched(lpLvCd->nmcd.lItemlParam)) { + { + term_t t; + extern HFONT HfBold; + t = T(1); + PI(t,lpLvCd->nmcd.lItemlParam) break; + P("track_episodes","watched",1,t) { SelectObject(lpLvCd->nmcd.hdc, HfBold); return CDRF_NEWFONT; } break; + } } break; } - case NM_DBLCLK: - case NM_RETURN: + case NM_DBLCLK: /* Open clicked episode. */ + { + term_t t; + t = T(1); + PI(t,LpLviElvSelection->lParam) break; + P("local_episodes","open_episode",1,t); + break; + } + case NM_RETURN: /* Open all selected episodes. */ { LVITEM lvi; term_t t; extern HWND HElv; - - /* Open all selected episodes. */ - lvi.mask = LVIF_PARAM; lvi.iItem = -1; t = T(1); @@ -95,6 +103,7 @@ ElvHandleNotify(LPARAM lParam) case NM_RCLICK: { DWORD dwPos; + extern HWND HWnd; extern HMENU HPopupMenu; dwPos = GetMessagePos(); TrackPopupMenu(HPopupMenu, TPM_RIGHTBUTTON, -- cgit v1.2.3