From 1faa7e5510f22cde45c77edcc4063544b64181de Mon Sep 17 00:00:00 2001 From: Green Sky Date: Fri, 29 Nov 2024 19:25:45 +0100 Subject: [PATCH] light cg reformatting --- src/chat_gui4.cpp | 59 ++++++++++++++++++++++------------------------- 1 file changed, 28 insertions(+), 31 deletions(-) diff --git a/src/chat_gui4.cpp b/src/chat_gui4.cpp index a1c74e78..bf05c40d 100644 --- a/src/chat_gui4.cpp +++ b/src/chat_gui4.cpp @@ -915,39 +915,36 @@ float ChatGui4::render(float time_delta) { ); } - { - // TODO: add support for more than images - // !!! polling each frame can be VERY expensive !!! - //const auto* mime_type = clipboardHasImage(); - //ImGui::BeginDisabled(mime_type == nullptr); - if (ImGui::Button("paste\nfile", {-FLT_MIN, 0})) { - if (const auto* imt = clipboardHasImage(); imt != nullptr) { // making sure - pasteFile(imt); - } else if (const auto* fpmt = clipboardHasFileList(); fpmt != nullptr) { - pasteFile(fpmt); - } - //} else if (ImGui::IsItemClicked(ImGuiMouseButton_Right)) { - } else if (ImGui::BeginPopupContextItem(nullptr, ImGuiMouseButton_Right)) { - // TODO: use list instead - const static std::vector image_mime_types { - // add apng? - "image/png", - "image/webp", - "image/gif", - "image/jpeg", - "image/bmp", - "image/qoi", - }; - - for (const char* mime_type : image_mime_types) { - if (ImGui::MenuItem(mime_type)) { - pasteFile(mime_type); - } - } - ImGui::EndPopup(); + // TODO: add support for more than images + // !!! polling each frame can be VERY expensive !!! + //const auto* mime_type = clipboardHasImage(); + //ImGui::BeginDisabled(mime_type == nullptr); + if (ImGui::Button("paste\nfile", {-FLT_MIN, 0})) { + if (const auto* imt = clipboardHasImage(); imt != nullptr) { // making sure + pasteFile(imt); + } else if (const auto* fpmt = clipboardHasFileList(); fpmt != nullptr) { + pasteFile(fpmt); } - //ImGui::EndDisabled(); + } else if (ImGui::BeginPopupContextItem(nullptr, ImGuiMouseButton_Right)) { + // TODO: use list instead + const static std::vector image_mime_types { + // add apng? + "image/png", + "image/webp", + "image/gif", + "image/jpeg", + "image/bmp", + "image/qoi", + }; + + for (const char* mime_type : image_mime_types) { + if (ImGui::MenuItem(mime_type)) { + pasteFile(mime_type); + } + } + ImGui::EndPopup(); } + //ImGui::EndDisabled(); } ImGui::EndChild();