| 4923 | |
| 4924 | |
| 4925 | void ShowStyleEditor(ImPlotStyle* ref) { |
| 4926 | ImPlotContext& gp = *GImPlot; |
| 4927 | ImPlotStyle& style = GetStyle(); |
| 4928 | static ImPlotStyle ref_saved_style; |
| 4929 | // Default to using internal storage as reference |
| 4930 | static bool init = true; |
| 4931 | if (init && ref == nullptr) |
| 4932 | ref_saved_style = style; |
| 4933 | init = false; |
| 4934 | if (ref == nullptr) |
| 4935 | ref = &ref_saved_style; |
| 4936 | |
| 4937 | if (ImPlot::ShowStyleSelector("Colors##Selector")) |
| 4938 | ref_saved_style = style; |
| 4939 | |
| 4940 | // Save/Revert button |
| 4941 | if (ImGui::Button("Save Ref")) |
| 4942 | *ref = ref_saved_style = style; |
| 4943 | ImGui::SameLine(); |
| 4944 | if (ImGui::Button("Revert Ref")) |
| 4945 | style = *ref; |
| 4946 | ImGui::SameLine(); |
| 4947 | HelpMarker("Save/Revert in local non-persistent storage. Default Colors definition are not affected. " |
| 4948 | "Use \"Export\" below to save them somewhere."); |
| 4949 | if (ImGui::BeginTabBar("##StyleEditor")) { |
| 4950 | if (ImGui::BeginTabItem("Variables")) { |
| 4951 | ImGui::Text("Item Styling"); |
| 4952 | ImGui::SliderFloat("LineWeight", &style.LineWeight, 0.0f, 5.0f, "%.1f"); |
| 4953 | ImGui::SliderFloat("MarkerSize", &style.MarkerSize, 2.0f, 10.0f, "%.1f"); |
| 4954 | ImGui::SliderFloat("MarkerWeight", &style.MarkerWeight, 0.0f, 5.0f, "%.1f"); |
| 4955 | ImGui::SliderFloat("FillAlpha", &style.FillAlpha, 0.0f, 1.0f, "%.2f"); |
| 4956 | ImGui::SliderFloat("ErrorBarSize", &style.ErrorBarSize, 0.0f, 10.0f, "%.1f"); |
| 4957 | ImGui::SliderFloat("ErrorBarWeight", &style.ErrorBarWeight, 0.0f, 5.0f, "%.1f"); |
| 4958 | ImGui::SliderFloat("DigitalBitHeight", &style.DigitalBitHeight, 0.0f, 20.0f, "%.1f"); |
| 4959 | ImGui::SliderFloat("DigitalBitGap", &style.DigitalBitGap, 0.0f, 20.0f, "%.1f"); |
| 4960 | ImGui::Text("Plot Styling"); |
| 4961 | ImGui::SliderFloat("PlotBorderSize", &style.PlotBorderSize, 0.0f, 2.0f, "%.0f"); |
| 4962 | ImGui::SliderFloat("MinorAlpha", &style.MinorAlpha, 0.0f, 1.0f, "%.2f"); |
| 4963 | ImGui::SliderFloat2("MajorTickLen", (float*)&style.MajorTickLen, 0.0f, 20.0f, "%.0f"); |
| 4964 | ImGui::SliderFloat2("MinorTickLen", (float*)&style.MinorTickLen, 0.0f, 20.0f, "%.0f"); |
| 4965 | ImGui::SliderFloat2("MajorTickSize", (float*)&style.MajorTickSize, 0.0f, 2.0f, "%.1f"); |
| 4966 | ImGui::SliderFloat2("MinorTickSize", (float*)&style.MinorTickSize, 0.0f, 2.0f, "%.1f"); |
| 4967 | ImGui::SliderFloat2("MajorGridSize", (float*)&style.MajorGridSize, 0.0f, 2.0f, "%.1f"); |
| 4968 | ImGui::SliderFloat2("MinorGridSize", (float*)&style.MinorGridSize, 0.0f, 2.0f, "%.1f"); |
| 4969 | ImGui::SliderFloat2("PlotDefaultSize", (float*)&style.PlotDefaultSize, 0.0f, 1000, "%.0f"); |
| 4970 | ImGui::SliderFloat2("PlotMinSize", (float*)&style.PlotMinSize, 0.0f, 300, "%.0f"); |
| 4971 | ImGui::Text("Plot Padding"); |
| 4972 | ImGui::SliderFloat2("PlotPadding", (float*)&style.PlotPadding, 0.0f, 20.0f, "%.0f"); |
| 4973 | ImGui::SliderFloat2("LabelPadding", (float*)&style.LabelPadding, 0.0f, 20.0f, "%.0f"); |
| 4974 | ImGui::SliderFloat2("LegendPadding", (float*)&style.LegendPadding, 0.0f, 20.0f, "%.0f"); |
| 4975 | ImGui::SliderFloat2("LegendInnerPadding", (float*)&style.LegendInnerPadding, 0.0f, 10.0f, "%.0f"); |
| 4976 | ImGui::SliderFloat2("LegendSpacing", (float*)&style.LegendSpacing, 0.0f, 5.0f, "%.0f"); |
| 4977 | ImGui::SliderFloat2("MousePosPadding", (float*)&style.MousePosPadding, 0.0f, 20.0f, "%.0f"); |
| 4978 | ImGui::SliderFloat2("AnnotationPadding", (float*)&style.AnnotationPadding, 0.0f, 5.0f, "%.0f"); |
| 4979 | ImGui::SliderFloat2("FitPadding", (float*)&style.FitPadding, 0, 0.2f, "%.2f"); |
| 4980 | |
| 4981 | ImGui::EndTabItem(); |
| 4982 | } |
no test coverage detected