From 407b6cab4093b3c0ee23412ac07cf83fd9f03b82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Wed, 3 Aug 2022 22:12:04 +0200 Subject: Minor changes. --- c/episodelistview.cpp | 6 +++--- c/main.cpp | 23 +++++++++++------------ 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/c/episodelistview.cpp b/c/episodelistview.cpp index c278a35..d35bebb 100644 --- a/c/episodelistview.cpp +++ b/c/episodelistview.cpp @@ -324,12 +324,12 @@ void EpisodeListView::Update() wchar_t siEp[16]; LVITEM lviEpisode = {LVIF_TEXT|LVIF_PARAM}; for (int iEp = 1; iEp <= cEp; iEp++) { - extern char g_currentScreenwriter[]; + extern char g_limitScreenwriter[]; extern int g_bViewTVOriginal, g_bViewWatched; - if (g_currentScreenwriter[0] + if (g_limitScreenwriter[0] && !Pl("episode_data","episode_datum", - iEp,"Screenwriter",g_currentScreenwriter)) + iEp,"Screenwriter",g_limitScreenwriter)) continue; if (!g_bViewWatched) diff --git a/c/main.cpp b/c/main.cpp index 26cc25d..24dd6da 100644 --- a/c/main.cpp +++ b/c/main.cpp @@ -41,7 +41,7 @@ DlvDragger g_dragDlv; /* View settings. */ int g_bViewWatched = 1; int g_bViewTVOriginal = 1; -char g_currentScreenwriter[64]; +char g_limitScreenwriter[64]; /* Optional Windows functions. */ BOOL (*IsThemeActive)(); @@ -191,9 +191,8 @@ static LRESULT CALLBACK CBTProc(const int nCode, const WPARAM wParam, const LPAR /* Load theme functions, if available. */ if (HMODULE hModule = LoadLibrary(L"uxtheme.dll")) { - IsThemeActive = (BOOL(*)())(void*)GetProcAddress(hModule, "IsThemeActive"); - SetWindowTheme = (BOOL(*)(HWND, LPCWSTR, LPCWSTR))(void*) - GetProcAddress(hModule, "SetWindowTheme"); + IsThemeActive = (decltype(IsThemeActive))(void*)GetProcAddress(hModule, "IsThemeActive"); + SetWindowTheme = (decltype(SetWindowTheme))(void*)GetProcAddress(hModule, "SetWindowTheme"); } /* Create child windows. */ @@ -206,7 +205,7 @@ static LRESULT CALLBACK CBTProc(const int nCode, const WPARAM wParam, const LPAR char* s; if (Pl("cfg","get_limit_screenwriter",&s)) - strcpy_s(g_currentScreenwriter, sizeof(g_currentScreenwriter), s); + strcpy_s(g_limitScreenwriter, sizeof(g_limitScreenwriter), s); int dlvHeight = 0; Pl("cfg","get_dlv_height",&dlvHeight); @@ -229,7 +228,7 @@ LRESULT CALLBACK WndProc(const HWND hWnd, const UINT uMsg, const WPARAM wParam, CheckMenuItem(GetMenu(hWnd), IDM_VIEW_TV_ORIGINAL, g_bViewTVOriginal? MF_CHECKED: MF_UNCHECKED); CheckMenuItem(GetMenu(hWnd), IDM_VIEW_OTHERS, - g_currentScreenwriter[0]? MF_UNCHECKED: MF_CHECKED); + g_limitScreenwriter[0]? MF_UNCHECKED: MF_CHECKED); break; case WM_CLOSE: DestroyWindow(hWnd); @@ -315,7 +314,7 @@ LRESULT CALLBACK WndProc(const HWND hWnd, const UINT uMsg, const WPARAM wParam, /*IDM_VIEW_TV_ORIGINAL*/(g_bViewTVOriginal? L"Click to hide TV original episodes.": L"Click to show TV original episodes."), - /*IDM_VIEW_OTHERS*/(g_currentScreenwriter? + /*IDM_VIEW_OTHERS*/(g_limitScreenwriter? L"Click to hide episodes by other screenwriters.": L"Click to show episodes by other screenwriters.") }; @@ -409,10 +408,10 @@ void HandleMainMenu(const HWND hWnd, unsigned short command) g_elv->EnsureFocusVisible(); break; case IDM_VIEW_OTHERS: /* Show/hide other screenwriters. */ - if (g_currentScreenwriter[0]) { + if (g_limitScreenwriter[0]) { CheckMenuItem(GetMenu(hWnd), IDM_VIEW_OTHERS, MF_CHECKED); - g_currentScreenwriter[0] = 0; + g_limitScreenwriter[0] = 0; } else { const int iEpFocus = ListView_GetNextItem(g_elv->hWnd, -1, LVNI_FOCUSED); if (iEpFocus == -1) break; @@ -423,12 +422,12 @@ void HandleMainMenu(const HWND hWnd, unsigned short command) char* s; if (!Pl("episode_data","episode_datum",lvi.lParam,"Screenwriter",&s)) break; - strcpy_s(g_currentScreenwriter, - sizeof(g_currentScreenwriter), s); + strcpy_s(g_limitScreenwriter, + sizeof(g_limitScreenwriter), s); CheckMenuItem(GetMenu(hWnd), IDM_VIEW_OTHERS, MF_UNCHECKED); } - Pl("cfg","set_limit_screenwriter",g_currentScreenwriter); + Pl("cfg","set_limit_screenwriter",g_limitScreenwriter); g_elv->Update(); g_elv->EnsureFocusVisible(); break; -- cgit v1.2.3