[apps] Shared: Factorize code: all FunctionGraphView have a member

indicating the selected function
This commit is contained in:
Émilie Feral
2018-01-08 15:53:14 +01:00
committed by EmilieNumworks
parent 0dec52a708
commit a6050fda55
5 changed files with 16 additions and 14 deletions

View File

@@ -12,8 +12,7 @@ GraphView::GraphView(SequenceStore * sequenceStore, InteractiveCurveViewRange *
m_verticalCursor(false),
m_highlightedDotStart(-1),
m_highlightedDotEnd(-1),
m_shouldColorHighlighted(false),
m_selectedSequence(nullptr)
m_shouldColorHighlighted(false)
{
}
@@ -34,7 +33,7 @@ void GraphView::drawRect(KDContext * ctx, KDRect rect) const {
continue;
}
drawDot(ctx, rect, x, y, s->color());
if (x >= m_highlightedDotStart && x <= m_highlightedDotEnd && s == m_selectedSequence) {
if (x >= m_highlightedDotStart && x <= m_highlightedDotEnd && s == m_selectedFunction) {
KDColor color = m_shouldColorHighlighted ? s->color() : KDColorBlack;
if (y >= 0.0f) {
drawSegment(ctx, rect, Axis::Vertical, x, 0.0f, y, color, 1);
@@ -63,14 +62,6 @@ void GraphView::reload() {
}
}
void GraphView::selectSequence(Sequence * sequence) {
if (m_selectedSequence != sequence) {
reload();
m_selectedSequence = sequence;
reload();
}
}
void GraphView::setHighlight(int start, int end) {
if (m_highlightedDotStart != start || m_highlightedDotEnd != end) {
reload();