KsPlot::Mark uses colored point to highlight the selected trace event on CPU and Task plots. Here we add a combo point that will highlight the selected event in Combo plots, like "Virtual Combo" for example. Those Combo plots will be introduced at the level of the GUI code in successive patches. Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@xxxxxxxxx> --- src/KsPlotTools.cpp | 23 ++++++++++++++++++++++- src/KsPlotTools.hpp | 15 ++++++++++++++- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/src/KsPlotTools.cpp b/src/KsPlotTools.cpp index ac9c5b2..225dc34 100644 --- a/src/KsPlotTools.cpp +++ b/src/KsPlotTools.cpp @@ -701,7 +701,7 @@ void Mark::_draw(const Color &col, float size) const void Mark::setDPR(int dpr) { _size = 1.5 * dpr; - _task._size = _cpu._size = 1.5 + 4.0 * dpr; + _task._size = _cpu._size = _combo._size = 1.5 + 4.0 * dpr; } /** @@ -715,6 +715,7 @@ void Mark::setX(int x) _b.setX(x); _cpu.setX(x); _task.setX(x); + _combo.setX(x); } /** @@ -769,6 +770,26 @@ void Mark::setTaskVisible(bool v) _task._visible = v; } +/** + * @brief Set the visiblity of the Mark's Combo point. + * + * @param v: If True, the Task point will be visible. + */ +void Mark::setComboVisible(bool v) +{ + _combo._visible = v; +} + +/** + * @brief Set the Y coordinates (vertical) of the Mark's Combo points. + * + * @param yCombo: Y coordinate of the Mark's Task point. + */ +void Mark::setComboY(int yCombo) +{ + _combo.setY(yCombo); +} + /** * @brief Create a default Bin. */ diff --git a/src/KsPlotTools.hpp b/src/KsPlotTools.hpp index c993181..a9a5ba8 100644 --- a/src/KsPlotTools.hpp +++ b/src/KsPlotTools.hpp @@ -406,6 +406,16 @@ public: /** If True, the Mark will be plotted as a dashed line. */ void setDashed(bool d) {_dashed = d;} + /** Get the Y coordinate of the Mark's Combo point. */ + int comboY() const {return _combo.y();} + + void setComboY(int yCombo); + + /** Is the Combo point visible. */ + bool comboIsVisible() const {return _combo._visible;} + + void setComboVisible(bool v); + private: void _draw(const Color &col, float size = 1.) const override; @@ -421,7 +431,10 @@ private: /** A point indicating the position of the Mark in a Task graph. */ Point _task; - /* If True, plot the Mark as a dashed line. */ + /** A point indicating the position of the Mark in a Combo graph. */ + Point _combo; + + /** If True, plot the Mark as a dashed line. */ bool _dashed; }; -- 2.25.1