forked from Ivasoft/DSView
keep channel setting when reload @ LA mode
This commit is contained in:
@@ -667,6 +667,7 @@ void SigSession::init_signals()
|
||||
assert(_dev_inst);
|
||||
stop_capture();
|
||||
|
||||
vector< boost::shared_ptr<view::Signal> > sigs;
|
||||
boost::shared_ptr<view::Signal> signal;
|
||||
unsigned int logic_probe_count = 0;
|
||||
unsigned int dso_probe_count = 0;
|
||||
@@ -726,8 +727,6 @@ void SigSession::init_signals()
|
||||
|
||||
// Make the logic probe list
|
||||
{
|
||||
_signals.clear();
|
||||
|
||||
for (const GSList *l = _dev_inst->dev_inst()->channels; l; l = l->next) {
|
||||
const sr_channel *const probe =
|
||||
(const sr_channel *)l->data;
|
||||
@@ -752,8 +751,13 @@ void SigSession::init_signals()
|
||||
break;
|
||||
}
|
||||
if(signal.get())
|
||||
_signals.push_back(signal);
|
||||
sigs.push_back(signal);
|
||||
}
|
||||
|
||||
_signals.clear();
|
||||
vector< boost::shared_ptr<view::Signal> >().swap(_signals);
|
||||
_signals = sigs;
|
||||
|
||||
signals_changed();
|
||||
data_updated();
|
||||
}
|
||||
@@ -766,12 +770,11 @@ void SigSession::reload()
|
||||
if (_capture_state == Running)
|
||||
stop_capture();
|
||||
|
||||
vector< boost::shared_ptr<view::Signal> > sigs;
|
||||
boost::shared_ptr<view::Signal> signal;
|
||||
|
||||
// Make the logic probe list
|
||||
{
|
||||
_signals.clear();
|
||||
|
||||
for (const GSList *l = _dev_inst->dev_inst()->channels; l; l = l->next) {
|
||||
const sr_channel *const probe =
|
||||
(const sr_channel *)l->data;
|
||||
@@ -779,7 +782,10 @@ void SigSession::reload()
|
||||
signal.reset();
|
||||
switch(probe->type) {
|
||||
case SR_CHANNEL_LOGIC:
|
||||
if (probe->enabled)
|
||||
if (probe->enabled && probe->index < _signals.size())
|
||||
signal = boost::shared_ptr<view::Signal>(
|
||||
new view::LogicSignal(*_signals[probe->index].get(), _logic_data, probe));
|
||||
else if (probe->enabled)
|
||||
signal = boost::shared_ptr<view::Signal>(
|
||||
new view::LogicSignal(_dev_inst, _logic_data, probe));
|
||||
break;
|
||||
@@ -796,8 +802,12 @@ void SigSession::reload()
|
||||
break;
|
||||
}
|
||||
if (signal.get())
|
||||
_signals.push_back(signal);
|
||||
sigs.push_back(signal);
|
||||
}
|
||||
|
||||
_signals.clear();
|
||||
vector< boost::shared_ptr<view::Signal> >().swap(_signals);
|
||||
_signals = sigs;
|
||||
}
|
||||
|
||||
signals_changed();
|
||||
|
||||
@@ -117,7 +117,7 @@ const QColor DecodeTrace::OutlineColours[16] = {
|
||||
DecodeTrace::DecodeTrace(pv::SigSession &session,
|
||||
boost::shared_ptr<pv::data::DecoderStack> decoder_stack, int index) :
|
||||
Trace(QString::fromUtf8(
|
||||
decoder_stack->stack().front()->decoder()->name), Trace::DS_DECODER),
|
||||
decoder_stack->stack().front()->decoder()->name), index, Trace::DS_DECODER),
|
||||
_session(session),
|
||||
_decoder_stack(decoder_stack),
|
||||
_show_hide_mapper(this)
|
||||
|
||||
@@ -76,6 +76,15 @@ LogicSignal::LogicSignal(boost::shared_ptr<pv::device::DevInst> dev_inst,
|
||||
_colour = SignalColours[probe->index % countof(SignalColours)];
|
||||
}
|
||||
|
||||
LogicSignal::LogicSignal(const Signal &s,
|
||||
boost::shared_ptr<pv::data::Logic> data,
|
||||
const sr_channel * const probe) :
|
||||
Signal(s, probe),
|
||||
_data(data)
|
||||
{
|
||||
assert(probe->index >= 0);
|
||||
}
|
||||
|
||||
LogicSignal::~LogicSignal()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -58,6 +58,10 @@ public:
|
||||
boost::shared_ptr<pv::data::Logic> data,
|
||||
const sr_channel * const probe);
|
||||
|
||||
LogicSignal(const Signal &s,
|
||||
boost::shared_ptr<pv::data::Logic> data,
|
||||
const sr_channel * const probe);
|
||||
|
||||
virtual ~LogicSignal();
|
||||
|
||||
const sr_channel* probe() const;
|
||||
|
||||
@@ -42,6 +42,13 @@ Signal::Signal(boost::shared_ptr<pv::device::DevInst> dev_inst,
|
||||
{
|
||||
}
|
||||
|
||||
Signal::Signal(const Signal &s, const sr_channel * const probe) :
|
||||
Trace((const Trace &)s),
|
||||
_dev_inst(s._dev_inst),
|
||||
_probe(probe)
|
||||
{
|
||||
}
|
||||
|
||||
bool Signal::enabled() const
|
||||
{
|
||||
return _probe->enabled;
|
||||
|
||||
@@ -59,6 +59,11 @@ protected:
|
||||
Signal(boost::shared_ptr<pv::device::DevInst> dev_inst,
|
||||
const sr_channel * const probe, int type);
|
||||
|
||||
/**
|
||||
* Copy constructor
|
||||
*/
|
||||
Signal(const Signal &s, const sr_channel * const probe);
|
||||
|
||||
public:
|
||||
virtual boost::shared_ptr<pv::data::SignalData> data() const = 0;
|
||||
|
||||
|
||||
@@ -53,19 +53,9 @@ const QPen Trace::SignalAxisPen = QColor(128, 128, 128, 64);
|
||||
const QPen Trace::AxisPen(QColor(128, 128, 128, 64));
|
||||
const int Trace::LabelHitPadding = 2;
|
||||
|
||||
Trace::Trace(QString name, int type) :
|
||||
_name(name),
|
||||
_v_offset(0),
|
||||
_type(type),
|
||||
_sec_index(0),
|
||||
_signalHeight(30),
|
||||
_trig(0)
|
||||
{
|
||||
}
|
||||
|
||||
Trace::Trace(QString name, int index, int type) :
|
||||
_name(name),
|
||||
_v_offset(0),
|
||||
_v_offset(INT_MAX),
|
||||
_type(type),
|
||||
_sec_index(0),
|
||||
_signalHeight(30),
|
||||
@@ -76,7 +66,7 @@ Trace::Trace(QString name, int index, int type) :
|
||||
|
||||
Trace::Trace(QString name, std::list<int> index_list, int type, int sec_index) :
|
||||
_name(name),
|
||||
_v_offset(0),
|
||||
_v_offset(INT_MAX),
|
||||
_type(type),
|
||||
_index_list(index_list),
|
||||
_sec_index(sec_index),
|
||||
@@ -85,6 +75,21 @@ Trace::Trace(QString name, std::list<int> index_list, int type, int sec_index) :
|
||||
{
|
||||
}
|
||||
|
||||
Trace::Trace(const Trace &t) :
|
||||
_view(t._view),
|
||||
_name(t._name),
|
||||
_colour(t._colour),
|
||||
_v_offset(t._v_offset),
|
||||
_type(t._type),
|
||||
_index_list(t._index_list),
|
||||
_sec_index(t._sec_index),
|
||||
_old_v_offset(t._old_v_offset),
|
||||
_signalHeight(t._signalHeight),
|
||||
_trig(t._trig),
|
||||
_text_size(t._text_size)
|
||||
{
|
||||
}
|
||||
|
||||
QString Trace::get_name() const
|
||||
{
|
||||
return _name;
|
||||
|
||||
@@ -84,12 +84,16 @@ public:
|
||||
static const QPen SignalAxisPen;
|
||||
|
||||
protected:
|
||||
Trace(QString name, int type);
|
||||
Trace(QString name, int index, int type);
|
||||
Trace(QString name, std::list<int> index_list, int type, int sec_index);
|
||||
|
||||
/**
|
||||
* Copy constructor
|
||||
*/
|
||||
Trace(const Trace &t);
|
||||
|
||||
public:
|
||||
enum {DS_LOGIC = 0, DS_ANALOG, DS_GROUP, DS_DSO, DS_DECODER};
|
||||
enum {DS_LOGIC = 0, DS_ANALOG, DS_DSO, DS_GROUP, DS_DECODER};
|
||||
|
||||
public:
|
||||
/**
|
||||
|
||||
@@ -298,7 +298,10 @@ bool View::compare_trace_v_offsets(const boost::shared_ptr<Trace> &a,
|
||||
{
|
||||
assert(a);
|
||||
assert(b);
|
||||
return a->get_v_offset() < b->get_v_offset();
|
||||
if (a->get_type() != b->get_type())
|
||||
return a->get_type() > b->get_type();
|
||||
else
|
||||
return a->get_v_offset() < b->get_v_offset();
|
||||
}
|
||||
|
||||
bool View::cursors_shown() const
|
||||
|
||||
Reference in New Issue
Block a user