fix: added delete confirmation dialog in color_scheme_editor

This commit is contained in:
2025-12-17 08:37:15 +03:00
parent 10516212bf
commit 5bb8a687ea
2 changed files with 28 additions and 1 deletions

View File

@@ -138,10 +138,36 @@ void color_scheme_editor::render_controls()
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(0.6f, 0.1f, 0.1f, 1.0f));
if (ImGui::Button("Delete"))
{
m_controller.delete_current_palette();
m_show_delete_confirmation = true;
}
ImGui::PopStyleColor(3);
if (m_show_delete_confirmation)
{
ImGui::OpenPopup("Delete Palette?");
m_show_delete_confirmation = false;
}
if (ImGui::BeginPopupModal("Delete Palette?", nullptr, ImGuiWindowFlags_AlwaysAutoResize))
{
ImGui::Text("Are you sure you want to delete '%s'?", current.name().c_str());
ImGui::Text("This action cannot be undone.");
ImGui::Separator();
if (ImGui::Button("Delete", ImVec2(120, 0)))
{
m_controller.delete_current_palette();
apply_themes();
ImGui::CloseCurrentPopup();
}
ImGui::SameLine();
if (ImGui::Button("Cancel", ImVec2(120, 0)))
{
ImGui::CloseCurrentPopup();
}
ImGui::EndPopup();
}
ImGui::SameLine();
if (ImGui::Button("Apply"))
{

View File

@@ -26,6 +26,7 @@ private:
color_table_renderer m_color_table;
preview_renderer m_preview;
template_editor* m_template_editor{nullptr};
bool m_show_delete_confirmation{false};
};
#endif // CLRSYNC_GUI_COLOR_SCHEME_EDITOR_HPP