diff options
author | John Ankarström <john@ankarstrom.se> | 2022-08-04 17:48:52 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2022-08-04 17:48:52 +0200 |
commit | 1c218db34a3bd4aba5c1c088561b91b02e691fde (patch) | |
tree | 27df3923b92f907d459b1c150b2727a9f70ce838 | |
parent | 2ac7d06a503b256b290678f5bba158bf7d219bdd (diff) | |
download | EpisodeBrowser-1c218db34a3bd4aba5c1c088561b91b02e691fde.tar.gz |
Clean up.
-rw-r--r-- | c/main.cpp | 21 |
1 files changed, 7 insertions, 14 deletions
@@ -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<char*>("EpisodeBrowser"), NULL }; + char* argv[] = {const_cast<char*>("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(); |