Demo: style editor output tweak so it is easier to modify the output code.. + TODO list update

This commit is contained in:
omar 2017-08-15 17:48:41 +08:00
parent 9693fd5351
commit b409d399c8

View File

@ -1847,13 +1847,13 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
ImGui::LogToClipboard(); ImGui::LogToClipboard();
else else
ImGui::LogToTTY(); ImGui::LogToTTY();
ImGui::LogText("ImGuiStyle& style = ImGui::GetStyle();" IM_NEWLINE); ImGui::LogText("ImVec4* colors = ImGui::GetStyle().Colors;" IM_NEWLINE);
for (int i = 0; i < ImGuiCol_COUNT; i++) for (int i = 0; i < ImGuiCol_COUNT; i++)
{ {
const ImVec4& col = style.Colors[i]; const ImVec4& col = style.Colors[i];
const char* name = ImGui::GetStyleColorName(i); const char* name = ImGui::GetStyleColorName(i);
if (!output_only_modified || memcmp(&col, (ref ? &ref->Colors[i] : &default_style.Colors[i]), sizeof(ImVec4)) != 0) if (!output_only_modified || memcmp(&col, (ref ? &ref->Colors[i] : &default_style.Colors[i]), sizeof(ImVec4)) != 0)
ImGui::LogText("style.Colors[ImGuiCol_%s]%*s= ImVec4(%.2ff, %.2ff, %.2ff, %.2ff);" IM_NEWLINE, name, 22 - (int)strlen(name), "", col.x, col.y, col.z, col.w); ImGui::LogText("colors[ImGuiCol_%s]%*s= ImVec4(%.2ff, %.2ff, %.2ff, %.2ff);" IM_NEWLINE, name, 23-(int)strlen(name), "", col.x, col.y, col.z, col.w);
} }
ImGui::LogFinish(); ImGui::LogFinish();
} }