aboutsummaryrefslogtreecommitdiff
path: root/c
diff options
context:
space:
mode:
Diffstat (limited to 'c')
-rw-r--r--c/defs.h1
-rw-r--r--c/episodelistview.c23
-rw-r--r--c/listview.c14
3 files changed, 29 insertions, 9 deletions
diff --git a/c/defs.h b/c/defs.h
index f5feb3e..01e896d 100644
--- a/c/defs.h
+++ b/c/defs.h
@@ -16,6 +16,7 @@ void LvSetTheme(HWND, int);
/* episodelistview.c */
HWND ElvCreate();
+void ElvEnter(LPLVITEM);
LRESULT ElvHandleNotify(LPARAM);
void ElvRedraw(void);
void ElvSetTop(int);
diff --git a/c/episodelistview.c b/c/episodelistview.c
index 8ca64d5..cf6f392 100644
--- a/c/episodelistview.c
+++ b/c/episodelistview.c
@@ -36,6 +36,18 @@ ElvCreate()
return HElv;
}
+void
+ElvEnter(LPLVITEM lpLvi)
+{
+ fid_t f;
+ term_t t;
+ F(f);
+ t = T(1);
+ PI(t+0, lpLvi->lParam) goto b;
+ P("local_episodes","open_episode",1,t);
+b: Fd(f);
+}
+
LRESULT
ElvHandleNotify(LPARAM lParam)
{
@@ -70,16 +82,8 @@ ElvHandleNotify(LPARAM lParam)
break;
}
case NM_DBLCLK:
- {
- fid_t f;
- term_t t;
- F(f);
- t = T(1);
- PI(t+0, LpLviElvSelection->lParam) goto b;
- P("local_episodes","open_episode",1,t);
-b: Fd(f);
+ ElvEnter(LpLviElvSelection);
break;
- }
case NM_RCLICK:
{
DWORD dwPos;
@@ -94,6 +98,7 @@ b: Fd(f);
return 0;
}
+
void
ElvRedraw()
{
diff --git a/c/listview.c b/c/listview.c
index 7039e89..3025297 100644
--- a/c/listview.c
+++ b/c/listview.c
@@ -47,6 +47,20 @@ LvProc(HWND hLv, UINT uMsg, WPARAM wParam, LPARAM lParam)
return TRUE;
}
break;
+ case WM_GETDLGCODE: /* Open episode on Enter. */
+ {
+ LRESULT lResult;
+ extern HWND HElv;
+ extern LPLVITEM LpLviElvSelection;
+ if (hLv != HElv) break;
+ lResult = CallWindowProc(LvPrevProc, hLv, uMsg, wParam, lParam);
+ if (lParam && ((MSG *)lParam)->message == WM_KEYDOWN
+ && ((MSG *)lParam)->wParam == VK_RETURN) {
+ lResult &= ~DLGC_WANTMESSAGE;
+ ElvEnter(LpLviElvSelection);
+ }
+ return lResult;
+ }
}
return CallWindowProc(LvPrevProc, hLv, uMsg, wParam, lParam);