From 5b004563a06dd41e5ba474b82088b5ca516bda85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Tue, 31 May 2022 23:53:33 +0200 Subject: Remember focused episode. Previously, the episode most recently marked as watched would be selected on startup. --- c/main.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'c/main.c') diff --git a/c/main.c b/c/main.c index 4e13d7f..bcee867 100644 --- a/c/main.c +++ b/c/main.c @@ -92,7 +92,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, t = T(0); P("track_episodes","update_tracked_episodes",0,t); ElvUpdate(); - ElvSelectRecent(); + ElvSelectFocus(); while (GetMessage(&msg, NULL, 0, 0) > 0) { if (IsDialogMessage(hWnd, &msg)) continue; @@ -162,8 +162,20 @@ WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) DestroyWindow(hWnd); break; case WM_DESTROY: - PostQuitMessage(0); + { + LVITEM lvi; + extern HWND HElv; + lvi.mask = LVIF_PARAM; + if ((lvi.iItem=ListView_GetNextItem(HElv,-1,LVNI_FOCUSED)) != -1 + && ListView_GetItem(HElv, &lvi)) { + term_t t; + t = T(1); + PI(t,lvi.lParam) goto q; + P("cfg","set_focus",1,t); + } + q: PostQuitMessage(0); break; + } case WM_SIZE: SendMessage(HWndStatus, WM_SIZE, wParam, lParam); UpdateLayout(); @@ -221,9 +233,6 @@ WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case IDM_FILE_REFRESH: ElvUpdate(); break; - case IDM_FILE_RESET: - ElvSelectRecent(); - break; case IDM_FILE_FETCH_DATA: { term_t t; -- cgit v1.2.3