| 5003 | |
| 5004 | |
| 5005 | void ShowStyleEditor(ImPlotStyle* ref) { |
| 5006 | ImPlotContext& gp = *GImPlot; |
| 5007 | ImPlotStyle& style = GetStyle(); |
| 5008 | static ImPlotStyle ref_saved_style; |
| 5009 | // Default to using internal storage as reference |
| 5010 | static bool init = true; |
| 5011 | if (init && ref == nullptr) |
| 5012 | ref_saved_style = style; |
| 5013 | init = false; |
| 5014 | if (ref == nullptr) |
| 5015 | ref = &ref_saved_style; |
| 5016 | |
| 5017 | if (ImPlot::ShowStyleSelector("Colors##Selector")) |
| 5018 | ref_saved_style = style; |
| 5019 | |
| 5020 | // Save/Revert button |
| 5021 | if (ImGui::Button("Save Ref")) |
| 5022 | *ref = ref_saved_style = style; |
| 5023 | ImGui::SameLine(); |
| 5024 | if (ImGui::Button("Revert Ref")) |
| 5025 | style = *ref; |
| 5026 | ImGui::SameLine(); |
| 5027 | HelpMarker("Save/Revert in local non-persistent storage. Default Colors definition are not affected. " |
| 5028 | "Use \"Export\" below to save them somewhere."); |
| 5029 | if (ImGui::BeginTabBar("##StyleEditor")) { |
| 5030 | if (ImGui::BeginTabItem("Variables")) { |
| 5031 | ImGui::Text("Plot Styling"); |
| 5032 | ImGui::SliderFloat2("PlotDefaultSize", (float*)&style.PlotDefaultSize, 0.0f, 1000, "%.0f"); |
| 5033 | ImGui::SliderFloat2("PlotMinSize", (float*)&style.PlotMinSize, 0.0f, 300, "%.0f"); |
| 5034 | ImGui::SliderFloat("PlotBorderSize", &style.PlotBorderSize, 0.0f, 2.0f, "%.0f"); |
| 5035 | ImGui::SliderFloat("MinorAlpha", &style.MinorAlpha, 0.0f, 1.0f, "%.2f"); |
| 5036 | ImGui::SliderFloat2("MajorTickLen", (float*)&style.MajorTickLen, 0.0f, 20.0f, "%.0f"); |
| 5037 | ImGui::SliderFloat2("MinorTickLen", (float*)&style.MinorTickLen, 0.0f, 20.0f, "%.0f"); |
| 5038 | ImGui::SliderFloat2("MajorTickSize", (float*)&style.MajorTickSize, 0.0f, 2.0f, "%.1f"); |
| 5039 | ImGui::SliderFloat2("MinorTickSize", (float*)&style.MinorTickSize, 0.0f, 2.0f, "%.1f"); |
| 5040 | ImGui::SliderFloat2("MajorGridSize", (float*)&style.MajorGridSize, 0.0f, 2.0f, "%.1f"); |
| 5041 | ImGui::SliderFloat2("MinorGridSize", (float*)&style.MinorGridSize, 0.0f, 2.0f, "%.1f"); |
| 5042 | ImGui::Text("Plot Padding"); |
| 5043 | ImGui::SliderFloat2("PlotPadding", (float*)&style.PlotPadding, 0.0f, 20.0f, "%.0f"); |
| 5044 | ImGui::SliderFloat2("LabelPadding", (float*)&style.LabelPadding, 0.0f, 20.0f, "%.0f"); |
| 5045 | ImGui::SliderFloat2("LegendPadding", (float*)&style.LegendPadding, 0.0f, 20.0f, "%.0f"); |
| 5046 | ImGui::SliderFloat2("LegendInnerPadding", (float*)&style.LegendInnerPadding, 0.0f, 10.0f, "%.0f"); |
| 5047 | ImGui::SliderFloat2("LegendSpacing", (float*)&style.LegendSpacing, 0.0f, 5.0f, "%.0f"); |
| 5048 | ImGui::SliderFloat2("MousePosPadding", (float*)&style.MousePosPadding, 0.0f, 20.0f, "%.0f"); |
| 5049 | ImGui::SliderFloat2("AnnotationPadding", (float*)&style.AnnotationPadding, 0.0f, 5.0f, "%.0f"); |
| 5050 | ImGui::SliderFloat2("FitPadding", (float*)&style.FitPadding, 0, 0.2f, "%.2f"); |
| 5051 | ImGui::SliderFloat("DigitalPadding", &style.DigitalPadding, 0.0f, 20.0f, "%.1f"); |
| 5052 | ImGui::SliderFloat("DigitalSpacing", &style.DigitalSpacing, 0.0f, 10.0f, "%.1f"); |
| 5053 | ImGui::EndTabItem(); |
| 5054 | } |
| 5055 | if (ImGui::BeginTabItem("Colors")) { |
| 5056 | static int output_dest = 0; |
| 5057 | static bool output_only_modified = false; |
| 5058 | |
| 5059 | if (ImGui::Button("Export", ImVec2(75,0))) { |
| 5060 | if (output_dest == 0) |
| 5061 | ImGui::LogToClipboard(); |
| 5062 | else |
no test coverage detected