From 1c218db34a3bd4aba5c1c088561b91b02e691fde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Thu, 4 Aug 2022 17:48:52 +0200 Subject: Clean up. --- c/main.cpp | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) (limited to 'c') diff --git a/c/main.cpp b/c/main.cpp index 7dcffa6..f428d49 100644 --- a/c/main.cpp +++ b/c/main.cpp @@ -100,7 +100,7 @@ int WINAPI WinMain(const HINSTANCE hInstance, const HINSTANCE, char* const, cons std::set_terminate(OnTerminate); /* Initialize Prolog. */ - char* argv[] = { const_cast("EpisodeBrowser"), NULL }; + char* argv[] = {const_cast("EpisodeBrowser"), NULL}; if (!PL_initialise(1, argv)) throw std::runtime_error("Could not initialize Prolog."); if (!Pl("track_episodes","attach") || !Pl("episode_data","attach")) @@ -419,23 +419,16 @@ void HandleMainMenu(const HWND hWnd, unsigned short command) break; case IDM_VIEW_OTHERS: /* Show/hide other screenwriters. */ if (g_limitScreenwriter[0]) { - CheckMenuItem(GetMenu(hWnd), IDM_VIEW_OTHERS, - MF_CHECKED); + CheckMenuItem(GetMenu(hWnd), IDM_VIEW_OTHERS, MF_CHECKED); g_limitScreenwriter[0] = 0; } else { - const int iEpFocus = ListView_GetNextItem(g_elv->hWnd, -1, LVNI_FOCUSED); - if (iEpFocus == -1) break; - - LVITEM lvi = {LVIF_PARAM, iEpFocus}; - if (!ListView_GetItem(g_elv->hWnd, &lvi)) break; + LVITEM lvi = {LVIF_PARAM, -1}; + if (!g_elv->FindNextItem(&lvi, LVNI_FOCUSED)) break; char* s; - if (!Pl("episode_data","episode_datum",lvi.lParam,"Screenwriter",&s)) - break; - strcpy_s(g_limitScreenwriter, - sizeof(g_limitScreenwriter), s); - CheckMenuItem(GetMenu(hWnd), IDM_VIEW_OTHERS, - MF_UNCHECKED); + if (!Pl("episode_data","episode_datum",lvi.lParam,"Screenwriter",&s)) break; + strcpy_s(g_limitScreenwriter, sizeof(g_limitScreenwriter), s); + CheckMenuItem(GetMenu(hWnd), IDM_VIEW_OTHERS, MF_UNCHECKED); } Pl("cfg","set_limit_screenwriter",g_limitScreenwriter); g_elv->Update(); -- cgit v1.2.3