diff options
author | John Ankarström <john@ankarstrom.se> | 2022-04-06 23:12:45 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2022-04-06 23:12:45 +0200 |
commit | d986aecac89c2029743c87da87160ec388025b47 (patch) | |
tree | 5926b50a8174de6e287fd51cff8c42ade898250d | |
parent | ca091cc1be997b981c2980fb8d2865f2bcfee65b (diff) | |
download | EpisodeBrowser-d986aecac89c2029743c87da87160ec388025b47.tar.gz |
Re-select correct episode after toggling "View Watched".
-rw-r--r-- | c/episodelistview.c | 17 | ||||
-rw-r--r-- | c/resource.rc | 2 |
2 files changed, 13 insertions, 6 deletions
diff --git a/c/episodelistview.c b/c/episodelistview.c index 925ce23..985a8ca 100644 --- a/c/episodelistview.c +++ b/c/episodelistview.c @@ -166,7 +166,7 @@ s: ListView_SetItemState(HElv, -1, LVIF_STATE, LVIS_SELECTED); void ElvUpdate() { - int i, iEpisode, iEpisodes, iItem, iTopNew; + int i, iEpisode, iEpisodes, iItem, iItemFound; LVITEM lviEpisode, lviTop; LVFINDINFO lvfiTopNew; term_t t; @@ -219,13 +219,20 @@ ElvUpdate() lvfiTopNew.flags = LVFI_PARAM; do lvfiTopNew.lParam = lviTop.lParam+i; - while ((iTopNew = ListView_FindItem(HElv, -1, &lvfiTopNew)) == -1 && i++ < 100); - if (iTopNew != -1) - ElvSetTop(iTopNew); + while ((iItemFound = ListView_FindItem(HElv, -1, &lvfiTopNew)) == -1 + && i++ < 100); + if (iItemFound != -1) + ElvSetTop(iItemFound); /* Reset selection. */ + i = 0; + lvfiTopNew.flags = LVFI_PARAM; + do + lvfiTopNew.lParam = LpLviElvSelection->lParam+i; + while ((iItemFound = ListView_FindItem(HElv, -1, &lvfiTopNew)) == -1 + && i++ < 100); if (LpLviElvSelection) - ListView_SetItemState(HElv, LpLviElvSelection->iItem, + ListView_SetItemState(HElv, iItemFound, LVIS_SELECTED, LVIS_SELECTED); SendMessage(HElv, WM_SETREDRAW, TRUE, 0); diff --git a/c/resource.rc b/c/resource.rc index 0541cbd..e970565 100644 --- a/c/resource.rc +++ b/c/resource.rc @@ -13,7 +13,7 @@ BEGIN END POPUP "&View" BEGIN - MENUITEM "&Watched Episodes", ID_VIEW_WATCHED, CHECKED + MENUITEM "&Watched", ID_VIEW_WATCHED, CHECKED END POPUP "&Help" BEGIN |