diff options
author | John Ankarström <john@ankarstrom.se> | 2022-09-03 01:15:01 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2022-09-03 01:15:01 +0200 |
commit | 2cd22c671c67deaf2c1fcb659e3262bf57552557 (patch) | |
tree | 825342c317a39022cd60d0aad6569e5f8ef11c0d /c/main.cpp | |
parent | d02e63924c92a6f0f2f88881a75680cb9a538962 (diff) | |
download | EpisodeBrowser-2cd22c671c67deaf2c1fcb659e3262bf57552557.tar.gz |
Add Preferences dialog (WIP).
Diffstat (limited to 'c/main.cpp')
-rw-r--r-- | c/main.cpp | 32 |
1 files changed, 30 insertions, 2 deletions
@@ -8,7 +8,7 @@ #include "debug.h" #include "drag.h" #include "episodelistview.h" -#include "resource.h" +#include "res.h" #include "test.h" #include "util.h" #include "window.h" @@ -45,6 +45,8 @@ static void InitializeMainWindow(HWND) noexcept; static LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); /* Handle messages to Help > About dialog. */ static INT_PTR CALLBACK AboutDlgProc(HWND, UINT, WPARAM, LPARAM); +/* Handle messages to File > Preferences... dialog. */ +static INT_PTR CALLBACK PreferencesDlgProc(HWND, UINT, WPARAM, LPARAM); int WINAPI WinMain( _In_ const HINSTANCE hInstance, @@ -200,6 +202,23 @@ INT_PTR CALLBACK AboutDlgProc(const HWND hWnd, const UINT uMsg, const WPARAM wPa } } +INT_PTR CALLBACK PreferencesDlgProc(const HWND hWnd, const UINT uMsg, const WPARAM wParam, const LPARAM) +{ + switch (uMsg) { + case WM_CLOSE: + EndDialog(hWnd, IDOK); + return TRUE; + + case WM_COMMAND: + if (LOWORD(wParam) == IDOK) + EndDialog(hWnd, IDOK); + return TRUE; + + default: + return FALSE; + } +} + LRESULT CALLBACK Window::WndProc(const HWND hWnd, const UINT uMsg, const WPARAM wParam, const LPARAM lParam) { switch (uMsg) { @@ -296,11 +315,12 @@ LRESULT CALLBACK Window::WndProc(const HWND hWnd, const UINT uMsg, const WPARAM { /* Look up status bar tip for menu command. The tip * strings are stored in arrays, whose indices - * correspond to the IDM_ values (see resource.h). */ + * correspond to the IDM_ values (see res.h). */ const wchar_t* vTipMenu[] = { /*IDM_FILE_EXIT*/L"Close Episode Browser.", /*IDM_FILE_REFRESH*/L"Quickly refresh episode list.", + /*IDM_FILE_PREFERENCES*/L"Configure Episode Browser.", /*IDM_FILE_FETCH_DATA*/L"Fetch episode data from the web (may take a few seconds).", /*IDM_FILE_FETCH_SCREENWRITERS*/L"Fetch screenwriters from the web (may take a minute).", /*IDM_FILE_FETCH_CANCEL*/L"Stop fetching data from the web.", @@ -375,6 +395,14 @@ void Window::HandleMainMenu(const HWND hWnd, const WORD command) elv.Update(); break; + case IDM_FILE_PREFERENCES: + DialogBox( + GetModuleHandle(nullptr), + MAKEINTRESOURCE(IDD_PREFERENCES), + hWnd, + PreferencesDlgProc); + break; + case IDM_FILE_FETCH_DATA: { WaitFor(*this, FetchData); |