diff options
author | John Ankarström <john@ankarstrom.se> | 2022-04-01 02:30:37 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2022-04-01 02:30:37 +0200 |
commit | 877aa7c7f6287168f9c809c8823ec939f6364040 (patch) | |
tree | aadf4397450b34b6b879f885d3b3ec5453112df1 | |
parent | d5b94e3704ab5d3e464101451a2d08a9c43d3ed6 (diff) | |
download | EpisodeBrowser-877aa7c7f6287168f9c809c8823ec939f6364040.tar.gz |
Apply context menu commands to all selected items.
-rw-r--r-- | c/main.c | 56 |
1 files changed, 33 insertions, 23 deletions
@@ -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; |