From d23bd30a44ff0e6b2a7f36376d6785fa3ea56a7c Mon Sep 17 00:00:00 2001 From: epezent Date: Sun, 6 Sep 2020 01:48:47 -0500 Subject: [PATCH] header cleanup --- implot.h | 48 +++++++++++++++++++++++------------------------ implot_internal.h | 26 +++++++++---------------- 2 files changed, 33 insertions(+), 41 deletions(-) diff --git a/implot.h b/implot.h index 9b47235..444ce01 100644 --- a/implot.h +++ b/implot.h @@ -207,31 +207,31 @@ struct ImPlotLimits { // Plot style structure struct ImPlotStyle { // item styling variables - float LineWeight; // = 1, item line weight in pixels - ImPlotMarker Marker; // = ImPlotMarker_None, marker specification - float MarkerSize; // = 4, marker size in pixels (roughly the marker's "radius") - float MarkerWeight; // = 1, outline weight of markers in pixels - float FillAlpha; // = 1, alpha modifier applied to plot fills - float ErrorBarSize; // = 5, error bar whisker width in pixels - float ErrorBarWeight; // = 1.5, error bar whisker weight in pixels - float DigitalBitHeight; // = 8, digital channels bit height (at y = 1.0f) in pixels - float DigitalBitGap; // = 4, digital channels bit padding gap in pixels + float LineWeight; // = 1, item line weight in pixels + int Marker; // = ImPlotMarker_None, marker specification + float MarkerSize; // = 4, marker size in pixels (roughly the marker's "radius") + float MarkerWeight; // = 1, outline weight of markers in pixels + float FillAlpha; // = 1, alpha modifier applied to plot fills + float ErrorBarSize; // = 5, error bar whisker width in pixels + float ErrorBarWeight; // = 1.5, error bar whisker weight in pixels + float DigitalBitHeight; // = 8, digital channels bit height (at y = 1.0f) in pixels + float DigitalBitGap; // = 4, digital channels bit padding gap in pixels // plot styling variables - bool AntiAliasedLines; // = false, enable global anti-aliasing on plot lines (overrides ImPlotFlags_AntiAliased) - float PlotBorderSize; // = 1, line thickness of border around plot area - float MinorAlpha; // = 0.25 alpha multiplier applied to minor axis grid lines - ImVec2 MajorTickLen; // = 10,10 major tick lengths for X and Y axes - ImVec2 MinorTickLen; // = 5,5 minor tick lengths for X and Y axes - ImVec2 MajorTickSize; // = 1,1 line thickness of major ticks - ImVec2 MinorTickSize; // = 1,1 line thickness of minor ticks - ImVec2 MajorGridSize; // = 1,1 line thickness of major grid lines - ImVec2 MinorGridSize; // = 1,1 line thickness of minor grid lines - ImVec2 PlotPadding; // = 8,8 padding between widget frame and plot area and/or labels - ImVec2 LabelPadding; // = 5,5 padding between axes labels, tick labels, and plot edge - ImVec2 LegendPadding; // = 10,10 legend padding from top-left of plot - ImVec2 InfoPadding; // = 10,10 padding between plot edge and interior info text - ImVec2 PlotMinSize; // = 300,225 minimum size plot frame can be when shrunk - ImVec4 Colors[ImPlotCol_COUNT]; // array of plot specific colors + bool AntiAliasedLines; // = false, enable global anti-aliasing on plot lines (overrides ImPlotFlags_AntiAliased) + float PlotBorderSize; // = 1, line thickness of border around plot area + float MinorAlpha; // = 0.25 alpha multiplier applied to minor axis grid lines + ImVec2 MajorTickLen; // = 10,10 major tick lengths for X and Y axes + ImVec2 MinorTickLen; // = 5,5 minor tick lengths for X and Y axes + ImVec2 MajorTickSize; // = 1,1 line thickness of major ticks + ImVec2 MinorTickSize; // = 1,1 line thickness of minor ticks + ImVec2 MajorGridSize; // = 1,1 line thickness of major grid lines + ImVec2 MinorGridSize; // = 1,1 line thickness of minor grid lines + ImVec2 PlotPadding; // = 8,8 padding between widget frame and plot area and/or labels + ImVec2 LabelPadding; // = 5,5 padding between axes labels, tick labels, and plot edge + ImVec2 LegendPadding; // = 10,10 legend padding from top-left of plot + ImVec2 InfoPadding; // = 10,10 padding between plot edge and interior info text + ImVec2 PlotMinSize; // = 300,225 minimum size plot frame can be when shrunk + ImVec4 Colors[ImPlotCol_COUNT]; // array of plot specific colors ImPlotStyle(); }; diff --git a/implot_internal.h b/implot_internal.h index b01a6dc..de76130 100644 --- a/implot_internal.h +++ b/implot_internal.h @@ -183,8 +183,8 @@ enum ImPlotTimeUnit_ { }; enum ImPlotTimeFmt_ { - ImPlotTimeFmt_Us, // .428552 - ImPlotTimeFmt_SUs, // :29.428552 + ImPlotTimeFmt_Us, // .428 552 + ImPlotTimeFmt_SUs, // :29.428 552 ImPlotTimeFmt_SMs, // :29.428 ImPlotTimeFmt_S, // :29 ImPlotTimeFmt_HrMinS, // 7:21:29pm @@ -579,21 +579,13 @@ struct ImPlotAxisScale /// Two part time struct. struct ImPlotTime { - time_t S; - int Us; + time_t S; // second part + int Us; // microsecond part ImPlotTime() { S = 0; Us = 0; } - ImPlotTime(time_t s, int us = 0) { - S = s + us / 1000000; - Us = us % 1000000; - } - void RollOver() { - S = S + Us / 1000000; - Us = Us % 1000000; - } - static ImPlotTime FromDouble(double t) { - return ImPlotTime((time_t)t, (int)(t * 1000000 - floor(t) * 1000000)); - } - double ToDouble() const { return (double)S + (double)Us / 1000000.0; } + ImPlotTime(time_t s, int us = 0) { S = s + us / 1000000; Us = us % 1000000; } + void RollOver() { S = S + Us / 1000000; Us = Us % 1000000; } + double ToDouble() const { return (double)S + (double)Us / 1000000.0; } + static ImPlotTime FromDouble(double t) { return ImPlotTime((time_t)t, (int)(t * 1000000 - floor(t) * 1000000)); } }; static inline ImPlotTime operator+(const ImPlotTime& lhs, const ImPlotTime& rhs) @@ -785,7 +777,7 @@ inline T OffsetAndStride(const T* data, int idx, int count, int offset, int stri // Time Utils //----------------------------------------------------------------------------- -// NB: These functions only work if there is a currnet context because the +// NB: These functions only work if there is a current ImPlotContext because the // internal tm struct is owned by the context! // Returns true if year is leap year (366 days long)