pos_vdivs_(1),
neg_vdivs_(1),
resolution_(0),
- display_type_(DisplayBoth),
+ display_type_(DisplayAnalog),
autoranging_(true)
{
axis_pen_ = AxisPen;
{
const int ph = pos_vdivs_ * div_height_;
const int nh = neg_vdivs_ * div_height_;
+
return make_pair(-ph, nh);
}
}
}
+ const bool showing_logic = (display_type_ == DisplayConverted) || (display_type_ == DisplayBoth);
+
// If there is still no positive div when we need it, add one
// (this can happen when pos_vdivs==neg_vdivs==0)
- if ((max > 0) && (pos_vdivs_ == 0)) {
+ if (((max > 0) && (pos_vdivs_ == 0)) || showing_logic) {
pos_vdivs_ = 1;
owner_->extents_changed(false, true);
}
// If there is still no negative div when we need it, add one
// (this can happen when pos_vdivs was 0 or 1 when trying to split)
- if ((min < 0) && (neg_vdivs_ == 0)) {
+ if (((min < 0) && (neg_vdivs_ == 0)) || showing_logic) {
neg_vdivs_ = 1;
owner_->extents_changed(false, true);
}
pvdiv_sb_ = new QSpinBox(parent);
pvdiv_sb_->setRange(0, MaximumVDivs);
pvdiv_sb_->setValue(pos_vdivs_);
+ pvdiv_sb_->setEnabled(!autoranging_);
connect(pvdiv_sb_, SIGNAL(valueChanged(int)),
this, SLOT(on_pos_vdivs_changed(int)));
form->addRow(tr("Number of pos vertical divs"), pvdiv_sb_);
nvdiv_sb_ = new QSpinBox(parent);
nvdiv_sb_->setRange(0, MaximumVDivs);
nvdiv_sb_->setValue(neg_vdivs_);
+ nvdiv_sb_->setEnabled(!autoranging_);
connect(nvdiv_sb_, SIGNAL(valueChanged(int)),
this, SLOT(on_neg_vdivs_changed(int)));
form->addRow(tr("Number of neg vertical divs"), nvdiv_sb_);
// Add the vertical resolution
resolution_cb_ = new QComboBox(parent);
+ resolution_cb_->setEnabled(!autoranging_);
for (int i = MinScaleIndex; i < MaxScaleIndex; i++) {
const QString label = QString("%1").arg(get_resolution(i));
{
autoranging_ = (state == Qt::Checked);
+ if (pvdiv_sb_)
+ pvdiv_sb_->setEnabled(!autoranging_);
+ if (nvdiv_sb_)
+ nvdiv_sb_->setEnabled(!autoranging_);
+ if (resolution_cb_)
+ resolution_cb_->setEnabled(!autoranging_);
+
if (autoranging_)
perform_autoranging(false, true);
base_->set_conversion_type(conv_type);
update_conversion_widgets();
+ if (conv_type == SignalBase::ConversionType::NoConversion)
+ on_display_type_changed(DisplayType::DisplayAnalog);
+ else
+ on_display_type_changed(DisplayType::DisplayBoth);
+
if (owner_)
owner_->row_item_appearance_changed(false, true);
}
void AnalogSignal::on_display_type_changed(int index)
{
+ const bool prev_showing_logic = (display_type_ == DisplayConverted) || (display_type_ == DisplayBoth);
+
display_type_ = (DisplayType)(display_type_cb_->itemData(index).toInt());
+ const bool showing_logic = (display_type_ == DisplayConverted) || (display_type_ == DisplayBoth);
+
+ // If we show a logic trace, make sure we have at least one div for each
+ // polarity as that's where we paint it
+ if (showing_logic && !prev_showing_logic) {
+ if (pos_vdivs_ == 0)
+ on_pos_vdivs_changed(1);
+ if (neg_vdivs_ == 0)
+ on_neg_vdivs_changed(1);
+ }
+
if (owner_)
owner_->row_item_appearance_changed(false, true);
}