From ca56ce2c32b4479af32bf7fb5d065ee9a3a45d8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Mon, 11 Jul 2022 00:04:35 +0200 Subject: Refactor, adjust minimum window size. --- c/episodelistview.cpp | 60 ++++++++++++++++++++++++++++++--------------------- 1 file changed, 35 insertions(+), 25 deletions(-) (limited to 'c/episodelistview.cpp') diff --git a/c/episodelistview.cpp b/c/episodelistview.cpp index 8fb3ec7..7c79043 100644 --- a/c/episodelistview.cpp +++ b/c/episodelistview.cpp @@ -154,6 +154,16 @@ EpisodeListView::Redraw() RDW_ERASE|RDW_FRAME|RDW_INVALIDATE|RDW_ALLCHILDREN); } +void +EpisodeListView::SaveFocus() +{ + LVITEM lvi; + lvi.mask = LVIF_PARAM; + if ((lvi.iItem = ListView_GetNextItem(m_hWnd, -1, LVNI_FOCUSED)) != -1 + && ListView_GetItem(m_hWnd, &lvi)) + Pl("cfg","set_focus","I",lvi.lParam); +} + void EpisodeListView::SetTop(int iItem) { @@ -165,7 +175,7 @@ EpisodeListView::SetTop(int iItem) /* Select previously focused episode. */ void -EpisodeListView::SelectFocus() +EpisodeListView::RestoreFocus() { int i, iEpisode, iItem; LVFINDINFO lvfi; @@ -388,6 +398,30 @@ r: if (!Pl("episode_data","episode_rating","Ii",lpLvi->lParam,&iRating)) { f: if (tszName) free(tszName); } +LRESULT CALLBACK +EpisodeListView::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + switch (uMsg) { + case WM_GETDLGCODE: + { + LRESULT lResult; + + /* For the episode list view, the Enter key should not + * be handled by the dialog manager, but instead be sent + * along to the main window procedure, so that it may be + * handled by the NM_RETURN case in ElvHandleNotify. */ + + lResult = CallWindowProc(m_prevProc, hWnd, uMsg, wParam, lParam); + if (lParam && ((MSG *)lParam)->message == WM_KEYDOWN + && ((MSG *)lParam)->wParam == VK_RETURN) + return DLGC_WANTMESSAGE; + return lResult; + } + } + + return ListView::WndProc(hWnd, uMsg, wParam, lParam); +} + /* Sort list view items, iSort being the 1-based index of the column * to sort by. If iSort is negative, the order is descending. */ int CALLBACK @@ -434,27 +468,3 @@ ElvSort(LPARAM iItem1, LPARAM iItem2, LPARAM iSort) return 0; } } - -LRESULT CALLBACK -EpisodeListView::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) -{ - switch (uMsg) { - case WM_GETDLGCODE: - { - LRESULT lResult; - - /* For the episode list view, the Enter key should not - * be handled by the dialog manager, but instead be sent - * along to the main window procedure, so that it may be - * handled by the NM_RETURN case in ElvHandleNotify. */ - - lResult = CallWindowProc(m_prevProc, hWnd, uMsg, wParam, lParam); - if (lParam && ((MSG *)lParam)->message == WM_KEYDOWN - && ((MSG *)lParam)->wParam == VK_RETURN) - return DLGC_WANTMESSAGE; - return lResult; - } - } - - return ListView::WndProc(hWnd, uMsg, wParam, lParam); -} -- cgit v1.2.3