aboutsummaryrefslogtreecommitdiff
path: root/c/episodelistview.c
diff options
context:
space:
mode:
Diffstat (limited to 'c/episodelistview.c')
-rw-r--r--c/episodelistview.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/c/episodelistview.c b/c/episodelistview.c
index b013bc8..30eef41 100644
--- a/c/episodelistview.c
+++ b/c/episodelistview.c
@@ -8,7 +8,7 @@
HWND HElv;
int ISort;
-LPLVITEM LpLviElvSelection; /* Most recently selected episode. */
+LVITEM LviElvFocus; /* Focused episode. */
static int CALLBACK ElvSort(LPARAM, LPARAM, LPARAM);
HWND
@@ -17,8 +17,6 @@ ElvCreate()
LVCOLUMN lvc;
term_t t;
- LpLviElvSelection = malloc(sizeof(LVITEM));
- if (!LpLviElvSelection) return NULL;
HElv = LvCreate((HMENU)IDC_EPISODELISTVIEW, 0);
lvc.mask = LVCF_WIDTH|LVCF_TEXT|LVCF_SUBITEM;
@@ -51,16 +49,16 @@ ElvHandleNotify(LPARAM lParam)
lpNmLv = (LPNMLISTVIEW)lParam;
switch (lpNmLv->hdr.code) {
- case LVN_ITEMCHANGED:
+ case LVN_ITEMCHANGED: /* Select/focus episode. */
if ((lpNmLv->uChanged & LVIF_STATE) &&
(lpNmLv->uNewState & LVIS_FOCUSED)) {
- LpLviElvSelection->iItem = lpNmLv->iItem;
- LpLviElvSelection->lParam = lpNmLv->lParam;
- ElvUpdateItem(LpLviElvSelection);
+ LviElvFocus.iItem = lpNmLv->iItem;
+ LviElvFocus.lParam = lpNmLv->lParam;
+ ElvUpdateItem(&LviElvFocus);
DlvShowEpisode(lpNmLv->lParam);
}
break;
- case LVN_COLUMNCLICK:
+ case LVN_COLUMNCLICK: /* Sort by column. */
{
int iColumn, iEpFocus;
term_t t;
@@ -102,7 +100,7 @@ ElvHandleNotify(LPARAM lParam)
{
term_t t;
t = T(1);
- PI(t,LpLviElvSelection->lParam) break;
+ PI(t,LviElvFocus.lParam) break;
P("local_episodes","open_episode",1,t);
break;
}
@@ -178,9 +176,9 @@ s: ListView_SetItemState(HElv, -1, LVIF_STATE, LVIS_SELECTED);
ElvSetTop(iItem > 5? iItem-5: 0);
ListView_SetItemState(HElv, iItem,
LVIS_SELECTED|LVIS_FOCUSED, LVIS_SELECTED|LVIS_FOCUSED);
- LpLviElvSelection->iItem = iItem;
- LpLviElvSelection->lParam = iEpisode;
- ElvUpdateItem(LpLviElvSelection);
+ LviElvFocus.iItem = iItem;
+ LviElvFocus.lParam = iEpisode;
+ ElvUpdateItem(&LviElvFocus);
DlvShowEpisode(iEpisode);
}