aboutsummaryrefslogtreecommitdiff
path: root/c/main.c
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2022-05-31 23:53:33 +0200
committerJohn Ankarström <john@ankarstrom.se>2022-05-31 23:53:33 +0200
commit5b004563a06dd41e5ba474b82088b5ca516bda85 (patch)
tree99efa34e6b95b6eaba47153a2698482eb30dfa83 /c/main.c
parentd818325292f8af780d995d4bcd3bc3ea80133ebd (diff)
downloadEpisodeBrowser-5b004563a06dd41e5ba474b82088b5ca516bda85.tar.gz
Remember focused episode.
Previously, the episode most recently marked as watched would be selected on startup.
Diffstat (limited to 'c/main.c')
-rw-r--r--c/main.c19
1 files changed, 14 insertions, 5 deletions
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;