aboutsummaryrefslogtreecommitdiff
path: root/c/episodelistview.c
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2022-04-02 03:40:44 +0200
committerJohn Ankarström <john@ankarstrom.se>2022-04-02 03:40:44 +0200
commitdf61ed83d8511f3ecb26d5af119df619b430b2f9 (patch)
treefe6fd8eec1b2f474d4a2dcb3a761a9ba52e274c9 /c/episodelistview.c
parent8fec209bfa1bdf7f2f20aa238fbada08da94d33e (diff)
downloadEpisodeBrowser-df61ed83d8511f3ecb26d5af119df619b430b2f9.tar.gz
Open only clicked episode on double-click.
Diffstat (limited to 'c/episodelistview.c')
-rw-r--r--c/episodelistview.c33
1 files changed, 21 insertions, 12 deletions
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,