diff options
author | John Ankarström <john@ankarstrom.se> | 2022-02-16 16:56:28 +0100 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2022-02-16 16:56:28 +0100 |
commit | 7086bfe3e7bf04dd61f16216c659fc5534c2796a (patch) | |
tree | 90b5a4327a7815b758f29241a76b70efeea0bfd2 /c | |
parent | 8e70cba63a8109bc663f06c9e8b79a241a968bcc (diff) | |
download | EpisodeBrowser-7086bfe3e7bf04dd61f16216c659fc5534c2796a.tar.gz |
Make refresh smoother.
Diffstat (limited to 'c')
-rw-r--r-- | c/episodelistview.c | 13 | ||||
-rw-r--r-- | c/main.c | 5 |
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. */ @@ -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); } |