diff options
author | John Ankarström <john@ankarstrom.se> | 2022-09-07 01:22:30 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2022-09-07 01:22:30 +0200 |
commit | ac7d676a1c457f71f1d3ae17d74699dd95c9c985 (patch) | |
tree | 96d44cc6740de053db377ac51f3102b9871a90d4 /c/main.cpp | |
parent | b2a018ff822bcdb5b9b691025a5fc1eb6fc13b4b (diff) | |
download | EpisodeBrowser-ac7d676a1c457f71f1d3ae17d74699dd95c9c985.tar.gz |
Normalize error message formatting.
Diffstat (limited to 'c/main.cpp')
-rw-r--r-- | c/main.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
@@ -64,11 +64,11 @@ int WINAPI WinMain( icc.dwSize = sizeof(icc); icc.dwICC = ICC_WIN95_CLASSES; if (!InitCommonControlsEx(&icc)) - return EBMessageBox(Err(WINDOWS, L"Common controls could not be initialized: %s").what, + return EBMessageBox(Err(WINDOWS, L"Common controls could not be initialized: %s.").what, L"Initialization Error", MB_ICONERROR), 1; if (CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED) != S_OK) - return EBMessageBox(L"COM library could not be initialized", + return EBMessageBox(L"COM library could not be initialized.", L"Initialization Error", MB_ICONERROR), 1; WNDCLASSEX wc; @@ -83,7 +83,7 @@ int WINAPI WinMain( wc.lpszClassName = L"Episode Browser"; wc.hIconSm = LoadIconW(nullptr, IDI_APPLICATION); if (!RegisterClassExW(&wc)) - return EBMessageBox(Err(WINDOWS, L"Window class could not be registered: %s").what, + return EBMessageBox(Err(WINDOWS, L"Window class could not be registered: %s.").what, L"Initialization Error", MB_ICONERROR), 1; /* InitializeMainWindow is called before the first message is @@ -98,7 +98,7 @@ int WINAPI WinMain( WS_OVERLAPPEDWINDOW|WS_CLIPCHILDREN, XMAIN, YMAIN, 0, 0, nullptr, nullptr, hInstance, nullptr))) - return EBMessageBox(Err(WINDOWS, L"Main window could not be created: %s").what, + return EBMessageBox(Err(WINDOWS, L"Main window could not be created: %s.").what, L"Initialization Error", MB_ICONERROR), 1; if (!(g_window->hWndStatus = CreateWindowExW( @@ -108,7 +108,7 @@ int WINAPI WinMain( WS_CHILD|WS_VISIBLE|SBARS_SIZEGRIP, 0, 0, 0, 0, hWnd, reinterpret_cast<HMENU>(IDR_STATUS), hInstance, nullptr))) - return EBMessageBox(Err(WINDOWS, L"Status bar could not be created: %s").what, + return EBMessageBox(Err(WINDOWS, L"Status bar could not be created: %s.").what, L"Initialization Error", MB_ICONERROR), 1; ShowWindow(hWnd, nCmdShow); @@ -153,21 +153,21 @@ static void InitializeMainWindow(const HWND hWnd) #endif if (!SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICSW), &m, 0)) - throw Err(WINDOWS, L"Non-client metrics could not be queried: %s"); + throw Err(WINDOWS, L"Non-client metrics could not be queried: %s."); if (!(g_hfNormal = CreateFontIndirectW(&m.lfMessageFont))) - throw Err(WINDOWS, L"System message font could not be loaded: %s"); + throw Err(WINDOWS, L"System message font could not be loaded: %s."); } else if (!(g_hfNormal = static_cast<HFONT>(GetStockObject(DEFAULT_GUI_FONT)))) - throw Err(WINDOWS, L"System GUI font could not be loaded: %s"); + throw Err(WINDOWS, L"System GUI font could not be loaded: %s."); /* Load bold font. */ { LOGFONTW lf; if (!GetObjectW(g_hfNormal, sizeof(LOGFONTW), &lf)) - throw Err(WINDOWS, L"Logical system font could not be loaded: %s"); + throw Err(WINDOWS, L"Logical system font could not be loaded: %s."); lf.lfWeight = FW_BOLD; if (!(g_hfBold = CreateFontIndirectW(&lf))) - throw Err(WINDOWS, L"Bold font could not be loaded: %s"); + throw Err(WINDOWS, L"Bold font could not be loaded: %s."); } /* Load theme functions, if available. */ @@ -287,7 +287,7 @@ LRESULT CALLBACK Window::WndProc(const HWND hWnd, const UINT uMsg, const WPARAM r->right-r->left, r->bottom-r->top, SWP_NOZORDER|SWP_NOACTIVATE)) - throw Err(WINDOWS, L""); + throw Err(WINDOWS, L"."); UpdateLayout(r->right-r->left, r->bottom-r->top); } return 0; @@ -484,9 +484,9 @@ void Window::UpdateLayout(int w, int h) RECT rc, rrStatus; if (w && h) rc = {0, 0, w, h}; else if (!GetClientRect(hWnd, &rc)) - throw Err(WINDOWS, L"Window rectangle could not be retrieved: %s"); + throw Err(WINDOWS, L"Window rectangle could not be retrieved: %s."); if (!GetRelativeRect(hWndStatus, &rrStatus)) - throw Err(WINDOWS, L"Status bar rectangle could not be retrieved: %s"); + throw Err(WINDOWS, L"Status bar rectangle could not be retrieved: %s."); SendMessageW(hWnd, WM_SETREDRAW, FALSE, 0); @@ -494,9 +494,9 @@ void Window::UpdateLayout(int w, int h) const long pad = EBIsThemeActive()? Dpi(6): 0; /* Add padding in modern themes. */ const long cyDlv = rrStatus.top-dlv.Height()-pad; if (!SetWindowRect(dlv.hWnd, pad, cyDlv, rc.right-pad, rrStatus.top-pad)) - throw Err(WINDOWS, L"Data list view rectangle could not be updated: %s"); + throw Err(WINDOWS, L"Data list view rectangle could not be updated: %s."); if (!SetWindowRect(elv.hWnd, pad, pad, rc.right-pad, cyDlv-pad)) - throw Err(WINDOWS, L"Episode list view rectangle could not be updated: %s"); + throw Err(WINDOWS, L"Episode list view rectangle could not be updated: %s."); dlv.ResizeColumns(rc.right-pad-pad); elv.ResizeColumns(rc.right-pad-pad); |