MCPcopy Create free account
hub / github.com/IppClub/Dora-SSR / SetupFinish

Function SetupFinish

Source/3rdParty/implot/implot.cpp:2516–2821  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2514//-----------------------------------------------------------------------------
2515
2516void SetupFinish() {
2517 IM_ASSERT_USER_ERROR(GImPlot != nullptr, "No current context. Did you call ImPlot::CreateContext() or ImPlot::SetCurrentContext()?");
2518 ImPlotContext& gp = *GImPlot;
2519 IM_ASSERT_USER_ERROR(gp.CurrentPlot != nullptr, "SetupFinish needs to be called after BeginPlot!");
2520
2521 ImGuiContext& G = *GImGui;
2522 ImDrawList& DrawList = *G.CurrentWindow->DrawList;
2523 const ImGuiStyle& Style = G.Style;
2524
2525 ImPlotPlot &plot = *gp.CurrentPlot;
2526
2527 // lock setup
2528 plot.SetupLocked = true;
2529
2530 // finalize axes and set default formatter/locator
2531 for (int i = 0; i < ImAxis_COUNT; ++i) {
2532 ImPlotAxis& axis = plot.Axes[i];
2533 if (axis.Enabled) {
2534 axis.Constrain();
2535 if (!plot.Initialized && axis.CanInitFit())
2536 plot.FitThisFrame = axis.FitThisFrame = true;
2537 }
2538 if (axis.Formatter == nullptr) {
2539 axis.Formatter = Formatter_Default;
2540 if (axis.HasFormatSpec)
2541 axis.FormatterData = axis.FormatSpec;
2542 else
2543 axis.FormatterData = (void*)IMPLOT_LABEL_FORMAT;
2544 }
2545 if (axis.Locator == nullptr) {
2546 axis.Locator = Locator_Default;
2547 }
2548 }
2549
2550 // setup nullptr orthogonal axes
2551 const bool axis_equal = ImHasFlag(plot.Flags, ImPlotFlags_Equal);
2552 for (int ix = ImAxis_X1, iy = ImAxis_Y1; ix < ImAxis_Y1 || iy < ImAxis_COUNT; ++ix, ++iy) {
2553 ImPlotAxis& x_axis = plot.Axes[ix];
2554 ImPlotAxis& y_axis = plot.Axes[iy];
2555 if (x_axis.Enabled && y_axis.Enabled) {
2556 if (x_axis.OrthoAxis == nullptr)
2557 x_axis.OrthoAxis = &y_axis;
2558 if (y_axis.OrthoAxis == nullptr)
2559 y_axis.OrthoAxis = &x_axis;
2560 }
2561 else if (x_axis.Enabled)
2562 {
2563 if (x_axis.OrthoAxis == nullptr && !axis_equal)
2564 x_axis.OrthoAxis = &plot.Axes[ImAxis_Y1];
2565 }
2566 else if (y_axis.Enabled) {
2567 if (y_axis.OrthoAxis == nullptr && !axis_equal)
2568 y_axis.OrthoAxis = &plot.Axes[ImAxis_X1];
2569 }
2570 }
2571
2572 // canvas/axes bb
2573 plot.CanvasRect = ImRect(plot.FrameRect.Min + gp.Style.PlotPadding, plot.FrameRect.Max - gp.Style.PlotPadding);

Callers 1

SetupLockFunction · 0.85

Calls 15

ImHasFlagFunction · 0.85
CalcLegendSizeFunction · 0.85
PadAndDatumAxesXFunction · 0.85
PadAndDatumAxesYFunction · 0.85
ImVec2Function · 0.85
ImMinFunction · 0.85
ImMaxFunction · 0.85
ImAlmostEqualFunction · 0.85
UpdateInputFunction · 0.85
GetStyleColorU32Function · 0.85
RenderGridLinesXFunction · 0.85
RenderGridLinesYFunction · 0.85

Tested by

no test coverage detected