From 7186f94b44837eedc94ffe1f8a21f2094a0a3e3d Mon Sep 17 00:00:00 2001 From: mthierman Date: Fri, 20 Sep 2024 06:33:17 -0600 Subject: [PATCH] Windows SA: Run clang-format --- .../standalone/windows/windows_standalone.cpp | 226 +++++++++--------- 1 file changed, 113 insertions(+), 113 deletions(-) diff --git a/src/detail/standalone/windows/windows_standalone.cpp b/src/detail/standalone/windows/windows_standalone.cpp index c5011107..6acfd415 100644 --- a/src/detail/standalone/windows/windows_standalone.cpp +++ b/src/detail/standalone/windows/windows_standalone.cpp @@ -704,132 +704,132 @@ Plugin::Plugin(const clap_plugin_entry* entry, int argc, char** argv) return 0; }); - message.on( - WM_SYSCOMMAND, - [this](Message msg) - { - switch (msg.wparam) - { - case Menu::Identifier::AudioMidiSettings: - { - settings.isVisible() ? settings.hide() : settings.show(); - - return 0; - } - - case Menu::Identifier::MuteInput: - { - if (menu.item[1].fState == MFS_UNCHECKED) - { - sah->audioInputUsed = false; - menu.item[1].fState = MFS_CHECKED; - } - else - { - sah->audioInputUsed = true; - menu.item[1].fState = MFS_UNCHECKED; - } - - SetMenuItemInfoW(getSystemMenu(hwnd.get()), 1, FALSE, &menu.item[1]); - - saveSettings(); - startAudio(); - - return 0; - } - - case Menu::Identifier::SaveState: - { - auto fileSaveDialog{wil::CoCreateInstance<::IFileSaveDialog>(CLSID_FileSaveDialog)}; - - fileSaveDialog->SetDefaultExtension(fileTypes.at(0).pszName); - fileSaveDialog->SetFileTypes(static_cast<::UINT>(fileTypes.size()), fileTypes.data()); - fileSaveDialog->Show(hwnd.get()); - - wil::com_ptr<::IShellItem> shellItem; - - if (auto hr{fileSaveDialog->GetResult(&shellItem)}; SUCCEEDED(hr)) - { - wil::unique_cotaskmem_string result; - shellItem->GetDisplayName(SIGDN_FILESYSPATH, &result); - - auto saveFile{std::filesystem::path(result.get())}; - - try - { - sah->saveStandaloneAndPluginSettings(saveFile.parent_path(), saveFile.filename()); - } - catch (const fs::filesystem_error& e) - { - message.error("Unable to save state: {}", e.what()); - } - } - - return 0; - } + message.on(WM_SYSCOMMAND, + [this](Message msg) + { + switch (msg.wparam) + { + case Menu::Identifier::AudioMidiSettings: + { + settings.isVisible() ? settings.hide() : settings.show(); - case Menu::Identifier::LoadState: - { - auto fileOpenDialog{wil::CoCreateInstance<::IFileOpenDialog>(CLSID_FileOpenDialog)}; + return 0; + } - fileOpenDialog->SetDefaultExtension(fileTypes.at(0).pszName); - fileOpenDialog->SetFileTypes(static_cast<::UINT>(fileTypes.size()), fileTypes.data()); - fileOpenDialog->Show(hwnd.get()); + case Menu::Identifier::MuteInput: + { + if (menu.item[1].fState == MFS_UNCHECKED) + { + sah->audioInputUsed = false; + menu.item[1].fState = MFS_CHECKED; + } + else + { + sah->audioInputUsed = true; + menu.item[1].fState = MFS_UNCHECKED; + } + + SetMenuItemInfoW(getSystemMenu(hwnd.get()), 1, FALSE, &menu.item[1]); + + saveSettings(); + startAudio(); + + return 0; + } - wil::com_ptr<::IShellItem> shellItem; + case Menu::Identifier::SaveState: + { + auto fileSaveDialog{wil::CoCreateInstance<::IFileSaveDialog>(CLSID_FileSaveDialog)}; - if (auto hr{fileOpenDialog->GetResult(&shellItem)}; SUCCEEDED(hr)) - { - wil::unique_cotaskmem_string result; - shellItem->GetDisplayName(SIGDN_FILESYSPATH, &result); + fileSaveDialog->SetDefaultExtension(fileTypes.at(0).pszName); + fileSaveDialog->SetFileTypes(static_cast<::UINT>(fileTypes.size()), fileTypes.data()); + fileSaveDialog->Show(hwnd.get()); - auto saveFile{std::filesystem::path(result.get())}; + wil::com_ptr<::IShellItem> shellItem; - try - { - if (fs::exists(saveFile)) - { - sah->tryLoadStandaloneAndPluginSettings(saveFile.parent_path(), saveFile.filename()); - } - } - catch (const fs::filesystem_error& e) - { - message.error("Unable to load state: {}", e.what()); - } - } + if (auto hr{fileSaveDialog->GetResult(&shellItem)}; SUCCEEDED(hr)) + { + wil::unique_cotaskmem_string result; + shellItem->GetDisplayName(SIGDN_FILESYSPATH, &result); - return 0; - } + auto saveFile{std::filesystem::path(result.get())}; - case Menu::Identifier::ResetState: - { - auto pt{freeaudio::clap_wrapper::standalone::getStandaloneSettingsPath()}; + try + { + sah->saveStandaloneAndPluginSettings(saveFile.parent_path(), saveFile.filename()); + } + catch (const fs::filesystem_error& e) + { + message.error("Unable to save state: {}", e.what()); + } + } - if (pt.has_value()) - { - auto loadPath{*pt / plugin.plugin->desc->id}; + return 0; + } - try - { - if (fs::exists(loadPath / "defaults.clapwrapper")) - { - sah->tryLoadStandaloneAndPluginSettings(loadPath, "defaults.clapwrapper"); - } - } - catch (const fs::filesystem_error& e) - { - message.error("Unable to reset state: {}", e.what()); - } - } + case Menu::Identifier::LoadState: + { + auto fileOpenDialog{wil::CoCreateInstance<::IFileOpenDialog>(CLSID_FileOpenDialog)}; + + fileOpenDialog->SetDefaultExtension(fileTypes.at(0).pszName); + fileOpenDialog->SetFileTypes(static_cast<::UINT>(fileTypes.size()), fileTypes.data()); + fileOpenDialog->Show(hwnd.get()); + + wil::com_ptr<::IShellItem> shellItem; + + if (auto hr{fileOpenDialog->GetResult(&shellItem)}; SUCCEEDED(hr)) + { + wil::unique_cotaskmem_string result; + shellItem->GetDisplayName(SIGDN_FILESYSPATH, &result); + + auto saveFile{std::filesystem::path(result.get())}; + + try + { + if (fs::exists(saveFile)) + { + sah->tryLoadStandaloneAndPluginSettings(saveFile.parent_path(), + saveFile.filename()); + } + } + catch (const fs::filesystem_error& e) + { + message.error("Unable to load state: {}", e.what()); + } + } + + return 0; + } - return 0; - } - } + case Menu::Identifier::ResetState: + { + auto pt{freeaudio::clap_wrapper::standalone::getStandaloneSettingsPath()}; + + if (pt.has_value()) + { + auto loadPath{*pt / plugin.plugin->desc->id}; + + try + { + if (fs::exists(loadPath / "defaults.clapwrapper")) + { + sah->tryLoadStandaloneAndPluginSettings(loadPath, "defaults.clapwrapper"); + } + } + catch (const fs::filesystem_error& e) + { + message.error("Unable to reset state: {}", e.what()); + } + } + + return 0; + } + } - ::DefWindowProcW(msg.hwnd, msg.msg, msg.wparam, msg.lparam); + ::DefWindowProcW(msg.hwnd, msg.msg, msg.wparam, msg.lparam); - return 0; - }); + return 0; + }); settings.message.on( WM_COMMAND,