From d671e9086fc0e447d93b9592534dbd06b1d5fd4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Sat, 6 Aug 2022 17:07:21 +0200 Subject: Minor changes. --- c/main.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'c') diff --git a/c/main.cpp b/c/main.cpp index a06002a..2f668c0 100644 --- a/c/main.cpp +++ b/c/main.cpp @@ -348,7 +348,7 @@ LRESULT CALLBACK WndProc(const HWND hWnd, const UINT uMsg, const WPARAM wParam, const WORD group = ID_GROUP(command); const wchar_t* tip = {0}; if (group) { - const wchar_t** const vTip = group==IDG_MENU? vTipMenu: vTipCtx; + const wchar_t** const vTip = group == IDG_MENU? vTipMenu: vTipCtx; tip = vTip[ID_INDEX(command)]; } SendMessage(g_hWndStatus, SB_SETTEXT, MAKEWPARAM(0,0), reinterpret_cast(tip)); @@ -490,7 +490,7 @@ void HandleContextMenu(const HWND, WORD command) void WaitFor(const char* mod, const char* pred) { static atom_t aThread; - static int bActive; + static bool bActive; static int iTimer; static WcharPtr activePred; @@ -502,7 +502,7 @@ void WaitFor(const char* mod, const char* pred) if (EBMessageBox(msg, L"Error", MB_YESNO|MB_ICONWARNING) != IDYES) return; KillTimer(nullptr, iTimer); - bActive = 0; + bActive = false; g_elv->Update(); } @@ -512,15 +512,16 @@ void WaitFor(const char* mod, const char* pred) static auto proc = [](HWND, UINT, UINT_PTR, DWORD) -> void { static int i = 0; + static const wchar_t* text[] = {L".", L"..", L"...", L""}; if (Pl("episode_data","thread_running",aThread)) { - i = (i+1)%4; + i = (i+1)%(sizeof(text)/sizeof(*text)); SendMessage(g_hWndStatus, SB_SETTEXT, MAKEWPARAM(1,0), - reinterpret_cast(i==0? L".": i==1? L"..": i==2? L"...": L"")); + reinterpret_cast(text[i])); } else { KillTimer(nullptr, iTimer); i = 0; - bActive = 0; + bActive = false; g_elv->Update(); } }; @@ -529,7 +530,7 @@ void WaitFor(const char* mod, const char* pred) SendMessage(g_hWndStatus, SB_SETTEXT, MAKEWPARAM(1,0), reinterpret_cast(L".")); if (Prefer(iTimer = SetTimer(nullptr, -1, 500, proc))) { activePred = WcharPtr::FromNarrow(pred); - bActive = 1; + bActive = true; } } -- cgit v1.2.3