aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--c/episodelistview.c13
-rw-r--r--c/main.c5
2 files changed, 14 insertions, 4 deletions
diff --git a/c/episodelistview.c b/c/episodelistview.c
index d3445e8..7d87b7a 100644
--- a/c/episodelistview.c
+++ b/c/episodelistview.c
@@ -165,11 +165,14 @@ ElvUpdate()
{
fid_t f;
HWND hListView;
+ int iTop;
LVITEM lviEpisode, lviName;
qid_t q;
term_t t;
hListView = GetDlgItem(gElv_hWnd, IDC_EPISODELISTVIEW);
+ SendMessage(hListView, WM_SETREDRAW, FALSE, 0);
+ iTop = ListView_GetTopIndex(hListView);
ListView_DeleteAllItems(hListView);
lviEpisode.mask = LVIF_TEXT|LVIF_PARAM;
@@ -198,7 +201,7 @@ ElvUpdate()
t2 = PL_new_term_refs(3);
if(!PL_put_integer(t2+0, iEpisode))
- return;
+ continue;
r = PL_call_predicate(NULL, PL_Q_NORMAL,
PL_predicate("lookup_episode_local", 3, "episode_data"),
@@ -240,14 +243,18 @@ ElvUpdate()
}
if (g_iSelectedItem != -1) {
+ int iLast;
+ iLast = ListView_GetItemCount(hListView)-1;
+ ListView_EnsureVisible(hListView, iLast, TRUE);
+ ListView_EnsureVisible(hListView, iTop, TRUE);
ListView_SetItemState(hListView, g_iSelectedItem,
LVIS_SELECTED, LVIS_SELECTED);
- ListView_EnsureVisible(hListView, g_iSelectedItem, TRUE);
}
close:
+ SendMessage(hListView, WM_SETREDRAW, TRUE, 0);
PL_cut_query(q);
- PL_close_foreign_frame(f);
+ PL_discard_foreign_frame(f);
}
/* Update episode name. */
diff --git a/c/main.c b/c/main.c
index 1ff91f5..3bbf832 100644
--- a/c/main.c
+++ b/c/main.c
@@ -160,6 +160,9 @@ WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
PL_call_predicate(NULL, PL_Q_NORMAL,
PL_predicate("forget_episode", 1,
"track_episodes"), t);
+ PL_call_predicate(NULL, PL_Q_NORMAL,
+ PL_predicate("update_tracked_episodes",
+ 0, "track_episodes"), t);
ListView_RedrawItems(hElv,
g_iSelectedItem, g_iSelectedItem);
break;
@@ -290,5 +293,5 @@ UpdateLayout(HWND hWnd)
ListView_SetColumnWidth(hElv, 1,
rc.right-cxColumn-cxVScroll-4);
- ListView_EnsureVisible(hElv, g_iSelectedItem, TRUE);
+ //ListView_EnsureVisible(hElv, g_iSelectedItem, TRUE);
}