aboutsummaryrefslogtreecommitdiff
path: root/c/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'c/main.c')
-rw-r--r--c/main.c56
1 files changed, 33 insertions, 23 deletions
diff --git a/c/main.c b/c/main.c
index b7986c1..6f317eb 100644
--- a/c/main.c
+++ b/c/main.c
@@ -162,33 +162,43 @@ WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
case ID_FORGET:
case ID_LOOKUP:
{
+ LVITEM lvi;
term_t t;
- extern LPLVITEM LpLviElvSelection;
+ extern HWND HElv;
+ /* Look through selected items, applying the
+ * selected command to each one. */
+
+ lvi.mask = LVIF_PARAM;
+ lvi.iItem = -1;
t = T(1);
- PI(t,LpLviElvSelection->lParam) break;
-
- switch (LOWORD(wParam)) {
- case ID_WATCH:
- P("local_episode","open_episode",1,t);
- break;
- case ID_TOGGLE:
- P("track_episodes","toggle_episode",1,t);
- ElvRedraw();
- break;
- case ID_FORGET:
- P("track_episodes","forget_episode",1,t);
- P("track_episodes","update_tracked_episodes",0,t);
- ElvRedraw();
- break;
- case ID_LOOKUP:
- P("episode_data","retract_episode",1,t);
- ElvUpdateName(LpLviElvSelection);
- ElvRedraw();
- DlvShowEpisode(LpLviElvSelection->lParam);
- break;
+ while ((lvi.iItem = ListView_GetNextItem(
+ HElv, lvi.iItem, LVNI_SELECTED)) != -1) {
+ if (!ListView_GetItem(HElv, &lvi)) goto b;
+ PI(t,lvi.lParam) goto b;
+
+ switch (LOWORD(wParam)) {
+ case ID_WATCH:
+ P("local_episode","open_episode",1,t);
+ break;
+ case ID_TOGGLE:
+ P("track_episodes","toggle_episode",1,t);
+ ElvRedraw();
+ break;
+ case ID_FORGET:
+ P("track_episodes","forget_episode",1,t);
+ P("track_episodes","update_tracked_episodes",0,t);
+ ElvRedraw();
+ break;
+ case ID_LOOKUP:
+ P("episode_data","retract_episode",1,t);
+ ElvUpdateName(&lvi);
+ ElvRedraw();
+ DlvShowEpisode(lvi.lParam);
+ break;
+ }
}
- break;
+ b: break;
}
}
break;