Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ngscopeclient/scopehal-apps
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 5eaeae80cd85
Choose a base ref
...
head repository: ngscopeclient/scopehal-apps
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 96afff9c8202
Choose a head ref
  • 3 commits
  • 6 files changed
  • 1 contributor

Commits on Nov 12, 2020

  1. Updated scopehal

    azonenberg committed Nov 12, 2020
    Copy the full SHA
    d69fa92 View commit details
  2. WaveformArea: Removed probe attenuation from context menu because it …

    …can have arbitrary values on most scopes so radio buttons don't make sense. Added attenuation to channel properties dialog. Fixes #192.
    azonenberg committed Nov 12, 2020
    Copy the full SHA
    9184c97 View commit details
  3. Removed edge trigger context menu now that we have a much more full f…

    …eatured trigger properties dialog.
    azonenberg committed Nov 12, 2020
    Copy the full SHA
    96afff9 View commit details
2 changes: 1 addition & 1 deletion lib
16 changes: 12 additions & 4 deletions src/glscopeclient/ChannelPropertiesDialog.cpp
Original file line number Diff line number Diff line change
@@ -99,19 +99,24 @@ ChannelPropertiesDialog::ChannelPropertiesDialog(
m_deskewLabel.set_text("Deskew");
m_deskewLabel.set_halign(Gtk::ALIGN_START);
m_grid.attach_next_to(m_deskewEntry, m_deskewLabel, Gtk::POS_RIGHT, 1, 1);

m_hasDeskew = true;

m_deskewEntry.set_text(ps.PrettyPrint(chan->GetDeskew()));

anchorLabel = &m_deskewLabel;
//Attenuation
m_grid.attach_next_to(m_attenuationLabel, m_deskewLabel, Gtk::POS_BOTTOM, 1, 1);
m_attenuationLabel.set_text("Attenuation");
m_attenuationLabel.set_halign(Gtk::ALIGN_START);
m_grid.attach_next_to(m_attenuationEntry, m_attenuationLabel, Gtk::POS_RIGHT, 1, 1);
m_hasAttenuation = true;
m_attenuationEntry.set_text(to_string(chan->GetAttenuation()));

anchorLabel = &m_attenuationLabel;

//Bandwidth limiters
m_grid.attach_next_to(m_bandwidthLabel, *anchorLabel, Gtk::POS_BOTTOM, 1, 1);
m_bandwidthLabel.set_text("BW Limit");
m_bandwidthLabel.set_halign(Gtk::ALIGN_START);
m_grid.attach_next_to(m_bandwidthBox, m_bandwidthLabel, Gtk::POS_RIGHT, 1, 1);

m_hasBandwidth = true;

//Populate bandwidth limiter box
@@ -235,6 +240,9 @@ void ChannelPropertiesDialog::ConfigureChannel()
if(m_hasDeskew)
m_chan->SetDeskew(ps.ParseString(m_deskewEntry.get_text()));

if(m_hasAttenuation)
m_chan->SetAttenuation(stof(m_attenuationEntry.get_text()));

if(m_hasBandwidth)
{
auto sbw = m_bandwidthBox.get_active_text();
3 changes: 3 additions & 0 deletions src/glscopeclient/ChannelPropertiesDialog.h
Original file line number Diff line number Diff line change
@@ -61,6 +61,8 @@ class ChannelPropertiesDialog : public Gtk::Dialog
Gtk::ColorButton m_channelColorButton;
Gtk::Label m_deskewLabel;
Gtk::Entry m_deskewEntry;
Gtk::Label m_attenuationLabel;
Gtk::Entry m_attenuationEntry;

//Analog channel configuration
Gtk::Label m_bandwidthLabel;
@@ -85,6 +87,7 @@ class ChannelPropertiesDialog : public Gtk::Dialog
bool m_hasFrequency;
bool m_hasBandwidth;
bool m_hasDeskew;
bool m_hasAttenuation;
};

#endif
55 changes: 2 additions & 53 deletions src/glscopeclient/WaveformArea.cpp
Original file line number Diff line number Diff line change
@@ -193,6 +193,8 @@ void WaveformArea::CreateWidgets()
m_copyNewGroupRightItem.signal_activate().connect(
sigc::mem_fun(*this, &WaveformArea::OnCopyNewRight));

m_contextMenu.append(*Gtk::manage(new Gtk::SeparatorMenuItem));

//Persistence
m_contextMenu.append(m_persistenceItem);
m_persistenceItem.set_label("Persistence");
@@ -232,59 +234,6 @@ void WaveformArea::CreateWidgets()

m_contextMenu.append(*Gtk::manage(new Gtk::SeparatorMenuItem));

//Trigger
m_contextMenu.append(m_triggerItem);
m_triggerItem.set_label("Trigger");
m_triggerItem.set_submenu(m_triggerMenu);
m_risingTriggerItem.set_label("Rising edge");
m_risingTriggerItem.signal_activate().connect(
sigc::bind<EdgeTrigger::EdgeType, Gtk::RadioMenuItem*>(
sigc::mem_fun(*this, &WaveformArea::OnTriggerMode),
EdgeTrigger::EDGE_RISING,
&m_risingTriggerItem));
m_risingTriggerItem.set_group(m_triggerGroup);
m_triggerMenu.append(m_risingTriggerItem);

m_fallingTriggerItem.set_label("Falling edge");
m_fallingTriggerItem.signal_activate().connect(
sigc::bind<EdgeTrigger::EdgeType, Gtk::RadioMenuItem*>(
sigc::mem_fun(*this, &WaveformArea::OnTriggerMode),
EdgeTrigger::EDGE_FALLING,
&m_fallingTriggerItem));
m_fallingTriggerItem.set_group(m_triggerGroup);
m_triggerMenu.append(m_fallingTriggerItem);

m_bothTriggerItem.set_label("Both edges");
m_bothTriggerItem.signal_activate().connect(
sigc::bind<EdgeTrigger::EdgeType, Gtk::RadioMenuItem*>(
sigc::mem_fun(*this, &WaveformArea::OnTriggerMode),
EdgeTrigger::EDGE_ANY,
&m_bothTriggerItem));
m_bothTriggerItem.set_group(m_triggerGroup);
m_triggerMenu.append(m_bothTriggerItem);

m_contextMenu.append(*Gtk::manage(new Gtk::SeparatorMenuItem));

//Attenuation
m_contextMenu.append(m_attenItem);
m_attenItem.set_label("Attenuation");
m_attenItem.set_submenu(m_attenMenu);
m_atten1xItem.set_label("1x");
m_atten1xItem.set_group(m_attenGroup);
m_atten1xItem.signal_activate().connect(sigc::bind<double, Gtk::RadioMenuItem*>(
sigc::mem_fun(*this, &WaveformArea::OnAttenuation), 1, &m_atten1xItem));
m_attenMenu.append(m_atten1xItem);
m_atten10xItem.set_label("10x");
m_atten10xItem.set_group(m_attenGroup);
m_atten10xItem.signal_activate().connect(sigc::bind<double, Gtk::RadioMenuItem*>(
sigc::mem_fun(*this, &WaveformArea::OnAttenuation), 10, &m_atten10xItem));
m_attenMenu.append(m_atten10xItem);
m_atten20xItem.set_label("20x");
m_atten20xItem.set_group(m_attenGroup);
m_atten20xItem.signal_activate().connect(sigc::bind<double, Gtk::RadioMenuItem*>(
sigc::mem_fun(*this, &WaveformArea::OnAttenuation), 20, &m_atten20xItem));
m_attenMenu.append(m_atten20xItem);

//Coupling
m_contextMenu.append(m_couplingItem);
m_couplingItem.set_label("Coupling");
14 changes: 0 additions & 14 deletions src/glscopeclient/WaveformArea.h
Original file line number Diff line number Diff line change
@@ -241,33 +241,19 @@ class WaveformArea : public Gtk::GLArea
Gtk::MenuItem m_decodeSignalIntegrityItem;
Gtk::Menu m_decodeSignalIntegrityMenu;
Gtk::CheckMenuItem m_statisticsItem;
Gtk::MenuItem m_triggerItem;
Gtk::Menu m_triggerMenu;
Gtk::RadioMenuItem::Group m_triggerGroup;
Gtk::RadioMenuItem m_risingTriggerItem;
Gtk::RadioMenuItem m_fallingTriggerItem;
Gtk::RadioMenuItem m_bothTriggerItem;
Gtk::MenuItem m_couplingItem;
Gtk::Menu m_couplingMenu;
Gtk::RadioMenuItem::Group m_couplingGroup;
Gtk::RadioMenuItem m_dc50CouplingItem;
Gtk::RadioMenuItem m_dc1MCouplingItem;
Gtk::RadioMenuItem m_ac1MCouplingItem;
Gtk::RadioMenuItem m_gndCouplingItem;
Gtk::MenuItem m_attenItem;
Gtk::Menu m_attenMenu;
Gtk::RadioMenuItem::Group m_attenGroup;
Gtk::RadioMenuItem m_atten1xItem;
Gtk::RadioMenuItem m_atten10xItem;
Gtk::RadioMenuItem m_atten20xItem;
void UpdateContextMenu();
bool m_updatingContextMenu;
void OnHide();
void OnTogglePersistence();

void OnTriggerMode(EdgeTrigger::EdgeType type, Gtk::RadioMenuItem* item);
void OnCoupling(OscilloscopeChannel::CouplingType type, Gtk::RadioMenuItem* item);
void OnAttenuation(double atten, Gtk::RadioMenuItem* item);
void OnMoveNewRight();
void OnMoveNewBelow();
void OnMoveToExistingGroup(WaveformGroup* group);
96 changes: 0 additions & 96 deletions src/glscopeclient/WaveformArea_events.cpp
Original file line number Diff line number Diff line change
@@ -1076,32 +1076,6 @@ void WaveformArea::OnCoupling(OscilloscopeChannel::CouplingType type, Gtk::Radio
m_selectedChannel.m_channel->SetCoupling(type);
}

void WaveformArea::OnAttenuation(double atten, Gtk::RadioMenuItem* item)
{
//ignore spurious events while loading menu config, or from item being deselected
if(m_updatingContextMenu || !item->get_active())
return;

m_selectedChannel.m_channel->SetAttenuation(atten);
}

void WaveformArea::OnTriggerMode(EdgeTrigger::EdgeType type, Gtk::RadioMenuItem* item)
{
//ignore spurious events while loading menu config, or from item being deselected
if(m_updatingContextMenu || !item->get_active())
return;

auto scope = m_channel.m_channel->GetScope();
auto trig = dynamic_cast<EdgeTrigger*>(scope->GetTrigger());
if(!trig)
return;
trig->SetInput(0, m_channel);
trig->SetType(type);
scope->PushTrigger();

m_parent->ClearAllPersistence();
}

void WaveformArea::OnWaveformDataReady()
{
//If we're a fixed width curve, refresh the parent's time scale
@@ -1320,7 +1294,6 @@ void WaveformArea::UpdateContextMenu()

if(m_selectedChannel.m_channel->IsPhysicalChannel())
{
m_attenMenu.set_sensitive(true);
m_couplingMenu.set_sensitive(true);

//Update the current coupling setting
@@ -1349,78 +1322,9 @@ void WaveformArea::UpdateContextMenu()
m_couplingItem.set_sensitive(false);
break;
}

//Update the current attenuation
int atten = static_cast<int>(m_selectedChannel.m_channel->GetAttenuation());
switch(atten)
{
case 1:
m_atten1xItem.set_active(true);
break;

case 10:
m_atten10xItem.set_active(true);
break;

case 20:
m_atten20xItem.set_active(true);
break;

default:
//TODO: how to handle this?
break;
}

auto trig = m_channel.m_channel->GetScope()->GetTrigger();
if( (trig == NULL) || (trig->GetInput(0) != m_channel) )
{
m_risingTriggerItem.set_inconsistent(true);
m_fallingTriggerItem.set_inconsistent(true);
m_bothTriggerItem.set_inconsistent(true);

m_risingTriggerItem.set_draw_as_radio(false);
m_fallingTriggerItem.set_draw_as_radio(false);
m_bothTriggerItem.set_draw_as_radio(false);
}
else
{
m_risingTriggerItem.set_inconsistent(false);
m_fallingTriggerItem.set_inconsistent(false);
m_bothTriggerItem.set_inconsistent(false);

m_risingTriggerItem.set_draw_as_radio(true);
m_fallingTriggerItem.set_draw_as_radio(true);
m_bothTriggerItem.set_draw_as_radio(true);

auto et = dynamic_cast<EdgeTrigger*>(trig);
if(et)
{
switch(et->GetType())
{
case EdgeTrigger::EDGE_RISING:
m_risingTriggerItem.set_active();
break;

case EdgeTrigger::EDGE_FALLING:
m_fallingTriggerItem.set_active();
break;

case EdgeTrigger::EDGE_ANY:
m_bothTriggerItem.set_active();
break;

//unsupported trigger
default:
break;
}
}
}
}
else
{
m_attenMenu.set_sensitive(false);
m_couplingMenu.set_sensitive(false);
}

//Select cursor config
switch(m_group->m_cursorConfig)