diff --git a/CMakeLists.txt b/CMakeLists.txt index 52ca508d..6f471db8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -245,25 +245,25 @@ if(imgui_bundle_ADDED) endif() CPMAddPackage( - NAME imgui_command_palette2 + NAME my_imgui_command_palette GITHUB_REPOSITORY wkjarosz/imgui-command-palette - GIT_TAG 1bddd4f004e5b001f6896dfda241a68a26df4a9e + GIT_TAG 428085688d88adf046c051c158de2fc5a8ef82bf DOWNLOAD_ONLY YES ) # CPMAddPackage("gh:wkjarosz/imgui-command-palette#66124ae045c11eb153c9c3f184b1e12f4d5a0e7b") -if(imgui_command_palette2_ADDED) +if(my_imgui_command_palette_ADDED) message(STATUS "imgui-command-palette library added") add_library( - imgui_command_palette2 - "${imgui_command_palette2_SOURCE_DIR}/imcmd_command_palette.h" - "${imgui_command_palette2_SOURCE_DIR}/imcmd_command_palette.cpp" - "${imgui_command_palette2_SOURCE_DIR}/imcmd_fuzzy_search.h" - "${imgui_command_palette2_SOURCE_DIR}/imcmd_fuzzy_search.cpp" + my_imgui_command_palette + "${my_imgui_command_palette_SOURCE_DIR}/imcmd_command_palette.h" + "${my_imgui_command_palette_SOURCE_DIR}/imcmd_command_palette.cpp" + "${my_imgui_command_palette_SOURCE_DIR}/imcmd_fuzzy_search.h" + "${my_imgui_command_palette_SOURCE_DIR}/imcmd_fuzzy_search.cpp" ) - target_compile_features(imgui_command_palette2 PUBLIC cxx_std_11) - target_include_directories(imgui_command_palette2 PUBLIC . ${imgui_command_palette2_SOURCE_DIR}) - target_link_libraries(imgui_command_palette2 PUBLIC imgui) + target_compile_features(my_imgui_command_palette PUBLIC cxx_std_11) + target_include_directories(my_imgui_command_palette PUBLIC . ${my_imgui_command_palette_SOURCE_DIR}) + target_link_libraries(my_imgui_command_palette PUBLIC imgui) endif() # CPMAddPackage("gh:pthom/hello_imgui#ed91f72da875b32ba96ef36d6633b9d7c0d95bee") if(hello_imgui_ADDED) message(STATUS @@ -432,7 +432,7 @@ target_link_libraries( stb implot cli11 - imgui_command_palette2 + my_imgui_command_palette ) target_compile_definitions(HDRView PRIVATE HELLOIMGUI_NO_FONT_AWESOME4) diff --git a/src/app.cpp b/src/app.cpp index 13ca0d82..9805b5fb 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -102,7 +102,7 @@ static constexpr size_t g_max_recent = 15; static bool g_show_help = false; static bool g_show_command_palette = false; static bool g_show_tweak_window = false; -#define g_blank_icon " " +#define g_blank_icon "" static const vector> g_help_strings = { {"h", "Toggle this help window"}, @@ -309,8 +309,8 @@ HDRViewApp::HDRViewApp(float exposure, float gamma, bool dither, bool sRGB, bool add_action({"Show pixel grid", ICON_FA_BORDER_ALL, ImGuiMod_Ctrl | ImGuiKey_G, 0, []() {}, []() { return true; }, false, &m_draw_grid}); - add_action({"Show pixel values", "", ImGuiMod_Ctrl | ImGuiKey_P, 0, []() {}, []() { return true; }, false, - &m_draw_pixel_info}); + add_action({"Show pixel values", g_blank_icon, ImGuiMod_Ctrl | ImGuiKey_P, 0, []() {}, []() { return true; }, + false, &m_draw_pixel_info}); add_action({"sRGB", g_blank_icon, 0, 0, []() {}, []() { return true; }, false, &m_sRGB}); add_action({"Decrease gamma", g_blank_icon, ImGuiKey_G, ImGuiInputFlags_Repeat, [this]() @@ -1839,7 +1839,7 @@ void HDRViewApp::draw_command_palette() if (a.second.enabled()) ImCmd::AddCommand({a.first, a.second.p_selected ? [a = a.second](){ a.callback(); - *a.p_selected = !*a.p_selected;} : a.second.callback, [](int){}, [](){}}); + *a.p_selected = !*a.p_selected;} : a.second.callback, [](int){}, [](){}, a.second.icon, ImGui::GetKeyChordNameTranslated(a.second.chord)}); } // set logging verbosity. This is a two-step command @@ -1876,13 +1876,13 @@ void HDRViewApp::draw_command_palette() HelloImGui::GetRunnerParams()->imGuiWindowParams.tweakedTheme.Theme = theme; ImGuiTheme::ApplyTheme(theme); }, - []() {}}); + []() {}, ICON_FA_PAINTBRUSH}); ImCmd::SetNextCommandPaletteSearchBoxFocused(); ImCmd::SetNextCommandPaletteSearch(""); } - ImCmd::CommandPalette("Command palette"); + ImCmd::CommandPalette("Command palette", "Filter commands..."); if (ImCmd::IsAnyItemSelected() || ImGui::Shortcut(ImGuiKey_Escape) || !ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows))