#include <pv/widgets/decodergroupbox.h>
#include <pv/widgets/decodermenu.h>
+using boost::shared_lock;
+using boost::shared_mutex;
using std::dynamic_pointer_cast;
using std::list;
using std::lock_guard;
using std::make_pair;
using std::max;
+using std::make_pair;
using std::map;
using std::min;
-using std::mutex;
using std::pair;
using std::shared_ptr;
using std::tie;
return _decoder_stack;
}
+pair<int, int> DecodeTrace::v_extents() const
+{
+ /// @todo Replace this with an implementation that knows the true
+ /// height of the trace
+ QFontMetrics m(QApplication::font());
+ const int text_height = m.boundingRect(QRect(), 0, "Tg").height();
+ const int row_height = (text_height * 6) / 4;
+ return make_pair(-row_height / 2, row_height * 7 / 2);
+}
+
void DecodeTrace::paint_back(QPainter &p, int left, int right)
{
Trace::paint_back(p, left, right);
- paint_axis(p, get_y(), left, right);
+ paint_axis(p, get_visual_y(), left, right);
}
void DecodeTrace::paint_mid(QPainter &p, int left, int right)
}
// Iterate through the rows
- int y = get_y();
+ int y = get_visual_y();
pair<uint64_t, uint64_t> sample_range = get_sample_range(left, right);
assert(_decoder_stack);
for (size_t i = 0; i < _visible_rows.size(); i++)
{
- const int y = i * _row_height + get_y();
+ const int y = i * _row_height + get_visual_y();
p.setPen(QPen(Qt::NoPen));
p.setBrush(QApplication::palette().brush(QPalette::WindowText));
void DecodeTrace::draw_error(QPainter &p, const QString &message,
int left, int right)
{
- const int y = get_y();
+ const int y = get_visual_y();
p.setPen(ErrorBgColour.darker());
p.setBrush(ErrorBgColour);
if (sample_count == samples_decoded)
return;
- const int y = get_y();
+ const int y = get_visual_y();
tie(pixels_offset, samples_per_pixel) =
get_pixels_offset_samples_per_pixel();
if (!_row_height)
return -1;
- const int row = (point.y() - get_y() + _row_height / 2) / _row_height;
+ const int row = (point.y() - get_visual_y() + _row_height / 2) /
+ _row_height;
if (row < 0 || row >= (int)_visible_rows.size())
return -1;
// decode trace, not below.
hp.setX(hp.x() - (text_size.width() / 2) - padding);
- hp.setY(get_y() - (_row_height / 2) + (hover_row * _row_height)
- - _row_height - text_size.height());
+ hp.setY(get_visual_y() - (_row_height / 2) +
+ (hover_row * _row_height) -
+ _row_height - text_size.height());
QToolTip::showText(view->viewport()->mapToGlobal(hp), ann);
}
{
assert(dec);
- lock_guard<mutex> lock(_session.signals_mutex());
+ shared_lock<shared_mutex> lock(_session.signals_mutex());
const vector< shared_ptr<Signal> > &sigs(_session.signals());
assert(_decoder_stack);
map<const srd_channel*, shared_ptr<LogicSignal> > channel_map;
- lock_guard<mutex> lock(_session.signals_mutex());
+ shared_lock<shared_mutex> lock(_session.signals_mutex());
const vector< shared_ptr<Signal> > &sigs(_session.signals());
for (const ChannelSelector &s : _channel_selectors)