Commit 0d581e10 authored by DreamSourceLab's avatar DreamSourceLab

fix minor display issues

parent ec3dc106
...@@ -50,7 +50,7 @@ const int64_t DecoderStack::DecodeChunkLength = 4 * 1024; ...@@ -50,7 +50,7 @@ const int64_t DecoderStack::DecodeChunkLength = 4 * 1024;
//const int64_t DecoderStack::DecodeChunkLength = 1024 * 1024; //const int64_t DecoderStack::DecodeChunkLength = 1024 * 1024;
const unsigned int DecoderStack::DecodeNotifyPeriod = 1024; const unsigned int DecoderStack::DecodeNotifyPeriod = 1024;
mutex DecoderStack::_global_decode_mutex; boost::mutex DecoderStack::_global_decode_mutex;
DecoderStack::DecoderStack(pv::SigSession &session, DecoderStack::DecoderStack(pv::SigSession &session,
const srd_decoder *const dec) : const srd_decoder *const dec) :
...@@ -179,7 +179,7 @@ void DecoderStack::build_row() ...@@ -179,7 +179,7 @@ void DecoderStack::build_row()
int64_t DecoderStack::samples_decoded() const int64_t DecoderStack::samples_decoded() const
{ {
lock_guard<boost::recursive_mutex> decode_lock(_output_mutex); boost::lock_guard<boost::recursive_mutex> decode_lock(_output_mutex);
return _samples_decoded; return _samples_decoded;
} }
...@@ -289,7 +289,7 @@ bool DecoderStack::has_annotations(const Row &row) const ...@@ -289,7 +289,7 @@ bool DecoderStack::has_annotations(const Row &row) const
uint64_t DecoderStack::list_annotation_size() const uint64_t DecoderStack::list_annotation_size() const
{ {
lock_guard<boost::recursive_mutex> lock(_output_mutex); boost::lock_guard<boost::recursive_mutex> lock(_output_mutex);
uint64_t max_annotation_size = 0; uint64_t max_annotation_size = 0;
for (map<const Row, RowData>::const_iterator i = _rows.begin(); for (map<const Row, RowData>::const_iterator i = _rows.begin();
i != _rows.end(); i++) { i != _rows.end(); i++) {
...@@ -555,7 +555,7 @@ void DecoderStack::decode_data( ...@@ -555,7 +555,7 @@ void DecoderStack::decode_data(
} }
{ {
lock_guard<boost::recursive_mutex> lock(_output_mutex); boost::lock_guard<boost::recursive_mutex> lock(_output_mutex);
_samples_decoded = i - decode_start + 1; _samples_decoded = i - decode_start + 1;
} }
...@@ -572,7 +572,7 @@ void DecoderStack::decode_data( ...@@ -572,7 +572,7 @@ void DecoderStack::decode_data(
void DecoderStack::decode_proc() void DecoderStack::decode_proc()
{ {
lock_guard<mutex> decode_lock(_global_decode_mutex); boost::lock_guard<boost::mutex> decode_lock(_global_decode_mutex);
optional<uint64_t> sample_count; optional<uint64_t> sample_count;
srd_session *session; srd_session *session;
...@@ -693,7 +693,7 @@ void DecoderStack::annotation_callback(srd_proto_data *pdata, void *decoder) ...@@ -693,7 +693,7 @@ void DecoderStack::annotation_callback(srd_proto_data *pdata, void *decoder)
} }
// Add the annotation // Add the annotation
lock_guard<boost::recursive_mutex> lock(d->_output_mutex); boost::lock_guard<boost::recursive_mutex> lock(d->_output_mutex);
if (!(*row_iter).second.push_annotation(a)) if (!(*row_iter).second.push_annotation(a))
d->_no_memory = true; d->_no_memory = true;
} }
......
...@@ -495,18 +495,22 @@ bool LogicSnapshot::get_sample(uint64_t index, int sig_index) ...@@ -495,18 +495,22 @@ bool LogicSnapshot::get_sample(uint64_t index, int sig_index)
int order = get_ch_order(sig_index); int order = get_ch_order(sig_index);
assert(order != -1); assert(order != -1);
assert(_ch_data[order].size() != 0); assert(_ch_data[order].size() != 0);
assert(index < get_sample_count()); //assert(index < get_sample_count());
uint64_t index_mask = 1ULL << (index & LevelMask[0]); if (index < get_sample_count()) {
uint64_t root_index = index >> (LeafBlockPower + RootScalePower); uint64_t index_mask = 1ULL << (index & LevelMask[0]);
uint8_t root_pos = (index & RootMask) >> LeafBlockPower; uint64_t root_index = index >> (LeafBlockPower + RootScalePower);
uint64_t root_pos_mask = 1ULL << root_pos; uint8_t root_pos = (index & RootMask) >> LeafBlockPower;
uint64_t root_pos_mask = 1ULL << root_pos;
if ((_ch_data[order][root_index].tog & root_pos_mask) == 0) { if ((_ch_data[order][root_index].tog & root_pos_mask) == 0) {
return (_ch_data[order][root_index].value & root_pos_mask) != 0; return (_ch_data[order][root_index].value & root_pos_mask) != 0;
} else {
uint64_t *lbp = (uint64_t *)_ch_data[order][root_index].lbp[root_pos];
return *(lbp + ((index & LeafMask) >> ScalePower)) & index_mask;
}
} else { } else {
uint64_t *lbp = (uint64_t *)_ch_data[order][root_index].lbp[root_pos]; return false;
return *(lbp + ((index & LeafMask) >> ScalePower)) & index_mask;
} }
} }
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <QDir> #include <QDir>
#include <QTextStream> #include <QTextStream>
#include <QScrollBar> #include <QScrollBar>
#include <QTextCodec>
#include "about.h" #include "about.h"
...@@ -68,7 +69,9 @@ About::About(QWidget *parent) : ...@@ -68,7 +69,9 @@ About::About(QWidget *parent) :
QString filename = dir.absolutePath() + "/NEWS"; QString filename = dir.absolutePath() + "/NEWS";
QFile news(filename); QFile news(filename);
if (news.open(QIODevice::ReadOnly)) { if (news.open(QIODevice::ReadOnly)) {
QTextCodec *code=QTextCodec::codecForName("UTF-8");
QTextStream stream(&news); QTextStream stream(&news);
stream.setCodec(code);
QString line; QString line;
while (!stream.atEnd()){ while (!stream.atEnd()){
line = stream.readLine(); line = stream.readLine();
......
...@@ -56,8 +56,8 @@ Search::Search(QWidget *parent, SigSession &session, std::map<uint16_t, QString> ...@@ -56,8 +56,8 @@ Search::Search(QWidget *parent, SigSession &session, std::map<uint16_t, QString>
boost::shared_ptr<view::LogicSignal> logic_sig; boost::shared_ptr<view::LogicSignal> logic_sig;
if (logic_sig = boost::dynamic_pointer_cast<view::LogicSignal>(sig)) { if (logic_sig = boost::dynamic_pointer_cast<view::LogicSignal>(sig)) {
QLineEdit *search_lineEdit = new QLineEdit(this); QLineEdit *search_lineEdit = new QLineEdit(this);
if (pattern.find(index) != pattern.end()) if (pattern.find(logic_sig->get_index()) != pattern.end())
search_lineEdit->setText(pattern[index]); search_lineEdit->setText(pattern[logic_sig->get_index()]);
else else
search_lineEdit->setText("X"); search_lineEdit->setText("X");
search_lineEdit->setValidator(value_validator); search_lineEdit->setValidator(value_validator);
...@@ -116,7 +116,7 @@ std::map<uint16_t, QString> Search::get_pattern() ...@@ -116,7 +116,7 @@ std::map<uint16_t, QString> Search::get_pattern()
assert(sig); assert(sig);
boost::shared_ptr<view::LogicSignal> logic_sig; boost::shared_ptr<view::LogicSignal> logic_sig;
if (logic_sig = boost::dynamic_pointer_cast<view::LogicSignal>(sig)) { if (logic_sig = boost::dynamic_pointer_cast<view::LogicSignal>(sig)) {
pattern[index] = _search_lineEdit_vec[index]->text(); pattern[logic_sig->get_index()] = _search_lineEdit_vec[index]->text();
index++; index++;
} }
} }
......
...@@ -254,7 +254,7 @@ TriggerDock::TriggerDock(QWidget *parent, SigSession &session) : ...@@ -254,7 +254,7 @@ TriggerDock::TriggerDock(QWidget *parent, SigSession &session) :
gLayout->addWidget(adv_radioButton, 1, 0); gLayout->addWidget(adv_radioButton, 1, 0);
gLayout->addWidget(position_label, 2, 0); gLayout->addWidget(position_label, 2, 0);
gLayout->addWidget(position_spinBox, 2, 1); gLayout->addWidget(position_spinBox, 2, 1);
gLayout->addWidget(new QLabel(_widget), 2, 2); gLayout->addWidget(new QLabel(tr("%"), _widget), 2, 2);
gLayout->addWidget(position_slider, 3, 0, 1, 3); gLayout->addWidget(position_slider, 3, 0, 1, 3);
gLayout->addWidget(stages_label, 4, 0); gLayout->addWidget(stages_label, 4, 0);
gLayout->addWidget(stages_comboBox, 4, 1); gLayout->addWidget(stages_comboBox, 4, 1);
......
...@@ -301,7 +301,8 @@ void DecodeTrace::paint_mid(QPainter &p, int left, int right) ...@@ -301,7 +301,8 @@ void DecodeTrace::paint_mid(QPainter &p, int left, int right)
const uint64_t max_annotation = const uint64_t max_annotation =
_decoder_stack->get_max_annotation(row); _decoder_stack->get_max_annotation(row);
const double max_annWidth = max_annotation / samples_per_pixel; const double max_annWidth = max_annotation / samples_per_pixel;
if ((max_annWidth > 10 && min_annWidth > 1) || if ((max_annWidth > 100) ||
(max_annWidth > 10 && min_annWidth > 1) ||
(max_annWidth == 0 && samples_per_pixel < 10)) { (max_annWidth == 0 && samples_per_pixel < 10)) {
vector<Annotation> annotations; vector<Annotation> annotations;
_decoder_stack->get_annotation_subset(annotations, row, _decoder_stack->get_annotation_subset(annotations, row,
......
...@@ -297,6 +297,10 @@ void Ruler::mouseReleaseEvent(QMouseEvent *event) ...@@ -297,6 +297,10 @@ void Ruler::mouseReleaseEvent(QMouseEvent *event)
_curs_moved = false; _curs_moved = false;
_view.cursor_moved(); _view.cursor_moved();
} }
if (_hitCursor && !_grabbed_marker) {
_hitCursor = false;
}
} }
if (event->button() & Qt::RightButton) { if (event->button() & Qt::RightButton) {
......
...@@ -578,7 +578,7 @@ void View::update_scroll() ...@@ -578,7 +578,7 @@ void View::update_scroll()
} else { } else {
horizontalScrollBar()->setRange(0, MaxScrollValue); horizontalScrollBar()->setRange(0, MaxScrollValue);
horizontalScrollBar()->setSliderPosition( horizontalScrollBar()->setSliderPosition(
_offset * MaxScrollValue / length); _offset * 1.0 / length * MaxScrollValue);
} }
_updating_scroll = false; _updating_scroll = false;
...@@ -824,7 +824,7 @@ void View::h_scroll_value_changed(int value) ...@@ -824,7 +824,7 @@ void View::h_scroll_value_changed(int value)
int64_t length = 0; int64_t length = 0;
int64_t offset = 0; int64_t offset = 0;
get_scroll_layout(length, offset); get_scroll_layout(length, offset);
_offset = floor(length * value / MaxScrollValue); _offset = floor(value * 1.0 / MaxScrollValue * length);
} }
_offset = max(min(_offset, get_max_offset()), get_min_offset()); _offset = max(min(_offset, get_max_offset()), get_min_offset());
......
...@@ -24,8 +24,6 @@ ...@@ -24,8 +24,6 @@
#include "dsl.h" #include "dsl.h"
#include "command.h" #include "command.h"
#undef min
#define min(a,b) ((a)<(b)?(a):(b))
static struct sr_dev_mode mode_list[] = { static struct sr_dev_mode mode_list[] = {
{"OSC", DSO}, {"OSC", DSO},
......
...@@ -24,14 +24,6 @@ ...@@ -24,14 +24,6 @@
#include "dsl.h" #include "dsl.h"
#include "command.h" #include "command.h"
#undef min
#define min(a,b) ((a)<(b)?(a):(b))
#undef max
#define max(a,b) ((a)>(b)?(a):(b))
static const unsigned int single_buffer_time = 20;
static const unsigned int total_buffer_time = 100;
static const unsigned int instant_buffer_size = 1024 * 1024;
static struct sr_dev_mode mode_list[] = { static struct sr_dev_mode mode_list[] = {
{"LA", LOGIC}, {"LA", LOGIC},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment