2 * This file is part of the PulseView project.
4 * Copyright (C) 2014 Joel Holdsworth <joel@airwebreathe.org.uk>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, see <http://www.gnu.org/licenses/>.
20 #include "triggermarker.hpp"
27 const QColor
TriggerMarker::Colour(0x00, 0x00, 0xB0);
29 TriggerMarker::TriggerMarker(View
&view
, const pv::util::Timestamp
& time
) :
35 TriggerMarker::TriggerMarker(const TriggerMarker
&marker
) :
36 TimeItem(marker
.view_
),
41 bool TriggerMarker::enabled() const
46 bool TriggerMarker::is_draggable() const
51 void TriggerMarker::set_time(const pv::util::Timestamp
& time
)
55 view_
.time_item_appearance_changed(true, true);
58 float TriggerMarker::get_x() const
60 return ((time_
- view_
.offset()) / view_
.scale()).convert_to
<float>();
63 QPoint
TriggerMarker::point(const QRect
&rect
) const
65 return QPoint(get_x(), rect
.bottom());
68 void TriggerMarker::paint_fore(QPainter
&p
, const ViewItemPaintParams
&pp
)
74 pen
.setStyle(Qt::DashLine
);
76 const float x
= get_x();
78 p
.drawLine(QPointF(x
, pp
.top()), QPointF(x
, pp
.bottom()));
81 } // namespace TraceView