2 * This file is part of the PulseView project.
4 * Copyright (C) 2012 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, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 #ifndef PULSEVIEW_PV_VIEW_LOGICSIGNAL_H
22 #define PULSEVIEW_PV_VIEW_LOGICSIGNAL_H
32 class TriggerMatchType;
43 class LogicSignal : public Signal
48 static const int SignalHeight;
49 static const int SignalMargin;
51 static const float Oversampling;
53 static const QColor EdgeColour;
54 static const QColor HighColour;
55 static const QColor LowColour;
57 static const QColor SignalColours[10];
60 LogicSignal(pv::SigSession &session,
61 std::shared_ptr<sigrok::Device> device,
62 std::shared_ptr<sigrok::Channel> channel,
63 std::shared_ptr<pv::data::Logic> data);
65 virtual ~LogicSignal();
67 std::shared_ptr<pv::data::SignalData> data() const;
69 std::shared_ptr<pv::data::Logic> logic_data() const;
72 * Computes the vertical extents of the contents of this row item.
73 * @return A pair containing the minimum and maximum y-values.
75 std::pair<int, int> v_extents() const;
78 * Paints the background layer of the signal with a QPainter
79 * @param p the QPainter to paint into.
80 * @param left the x-coordinate of the left edge of the signal.
81 * @param right the x-coordinate of the right edge of the signal.
83 void paint_back(QPainter &p, int left, int right);
86 * Paints the mid-layer of the signal with a QPainter
87 * @param p the QPainter to paint into.
88 * @param left the x-coordinate of the left edge of the signal.
89 * @param right the x-coordinate of the right edge of the signal.
91 void paint_mid(QPainter &p, int left, int right);
94 void paint_caps(QPainter &p, QLineF *const lines,
95 std::vector< std::pair<int64_t, bool> > &edges,
96 bool level, double samples_per_pixel, double pixels_offset,
97 float x_offset, float y_offset);
99 void init_trigger_actions(QWidget *parent);
101 QAction* match_action(const sigrok::TriggerMatchType *match);
102 const sigrok::TriggerMatchType *action_match(QAction *action);
103 void populate_popup_form(QWidget *parent, QFormLayout *form);
104 void modify_trigger();
110 std::shared_ptr<sigrok::Device> device_;
111 std::shared_ptr<pv::data::Logic> data_;
113 const sigrok::TriggerMatchType *trigger_match_;
114 QToolBar *trigger_bar_;
115 QAction *trigger_none_;
116 QAction *trigger_rising_;
117 QAction *trigger_high_;
118 QAction *trigger_falling_;
119 QAction *trigger_low_;
120 QAction *trigger_change_;
126 #endif // PULSEVIEW_PV_VIEW_LOGICSIGNAL_H