aboutsummaryrefslogtreecommitdiff
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
parent8fec209bfa1bdf7f2f20aa238fbada08da94d33e (diff)
downloadEpisodeBrowser-df61ed83d8511f3ecb26d5af119df619b430b2f9.tar.gz
Open only clicked episode on double-click.
-rw-r--r--c/common.c10
-rw-r--r--c/defs.h1
-rw-r--r--c/episodelistview.c33
3 files changed, 21 insertions, 23 deletions
diff --git a/c/common.c b/c/common.c
index fb76c71..7ee27ff 100644
--- a/c/common.c
+++ b/c/common.c
@@ -47,13 +47,3 @@ TszFromSz(const char *sz, int iCp)
return tsz;
}
-
-int
-Watched(int iEpisode)
-{
- term_t t;
- t = T(1);
- PI(t,iEpisode) return 0;
- P("track_episodes","watched",1,t) return 0;
- return 1;
-}
diff --git a/c/defs.h b/c/defs.h
index ea1d776..4707c48 100644
--- a/c/defs.h
+++ b/c/defs.h
@@ -7,7 +7,6 @@
/* common.c */
int Dpi(int);
TCHAR *TszFromSz(const char *, int);
-int Watched(int);
/* main.c */
void UpdateLayout();
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,