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: e2efbc9dcd55
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: 71e3f222ce09
Choose a head ref
  • 2 commits
  • 6 files changed
  • 1 contributor

Commits on Oct 10, 2020

  1. Copy the full SHA
    6335a1a View commit details
  2. Removed bandwidth limiter controls from context menu to reduce clutte…

    …r, since they're already in the properties dialog. Fixes #193.
    azonenberg committed Oct 10, 2020
    Copy the full SHA
    71e3f22 View commit details
45 changes: 42 additions & 3 deletions src/glscopeclient/ChannelPropertiesDialog.cpp
Original file line number Diff line number Diff line change
@@ -50,6 +50,8 @@ ChannelPropertiesDialog::ChannelPropertiesDialog(
, m_hasThreshold(false)
, m_hasHysteresis(false)
, m_hasFrequency(false)
, m_hasBandwidth(false)
, m_hasDeskew(false)
{
add_button("OK", Gtk::RESPONSE_OK);
add_button("Cancel", Gtk::RESPONSE_CANCEL);
@@ -89,18 +91,45 @@ ChannelPropertiesDialog::ChannelPropertiesDialog(
m_grid.attach_next_to(m_channelColorButton, m_channelColorLabel, Gtk::POS_RIGHT, 1, 1);
m_channelColorButton.set_color(Gdk::Color(chan->m_displaycolor));

//Deskew - only on physical analog channels for now
Gtk::Label* anchorLabel = &m_channelColorLabel;
if(chan->IsPhysicalChannel() && chan->GetType() == (OscilloscopeChannel::CHANNEL_TYPE_ANALOG) )
{
//Deskew - only on physical analog channels for now
m_grid.attach_next_to(m_deskewLabel, m_channelColorLabel, Gtk::POS_BOTTOM, 1, 1);
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;

//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
auto limits = scope->GetChannelBandwidthLimiters(index);
for(auto limit : limits)
{
if(limit == 0)
m_bandwidthBox.append("Full");
else
m_bandwidthBox.append(hz.PrettyPrint(limit * 1e6));
}
unsigned int limit = scope->GetChannelBandwidthLimit(index);
if(limit == 0)
m_bandwidthBox.set_active_text("Full");
else
m_bandwidthBox.set_active_text(hz.PrettyPrint(limit * 1e6));

anchorLabel = &m_bandwidthLabel;
}

//Logic properties - only on physical digital channels
@@ -148,7 +177,7 @@ ChannelPropertiesDialog::ChannelPropertiesDialog(
if(c == chan)
continue;

m_groupList.append(c->GetDisplayName().c_str());
m_groupList.append(c->GetDisplayName());
}

m_groupList.set_headers_visible(false);
@@ -201,7 +230,17 @@ void ChannelPropertiesDialog::ConfigureChannel()
if(m_hasFrequency)
m_chan->SetCenterFrequency(hz.ParseString(m_centerEntry.get_text()));

m_chan->SetDeskew(ps.ParseString(m_deskewEntry.get_text()));
if(m_hasDeskew)
m_chan->SetDeskew(ps.ParseString(m_deskewEntry.get_text()));

if(m_hasBandwidth)
{
auto sbw = m_bandwidthBox.get_active_text();
if(sbw == "Full")
m_chan->SetBandwidthLimit(0);
else
m_chan->SetBandwidthLimit(Unit(Unit::UNIT_HZ).ParseString(sbw)/1e6);
}
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
6 changes: 6 additions & 0 deletions src/glscopeclient/ChannelPropertiesDialog.h
Original file line number Diff line number Diff line change
@@ -62,6 +62,10 @@ class ChannelPropertiesDialog : public Gtk::Dialog
Gtk::Label m_deskewLabel;
Gtk::Entry m_deskewEntry;

//Analog channel configuration
Gtk::Label m_bandwidthLabel;
Gtk::ComboBoxText m_bandwidthBox;

//Logic channel configuration
Gtk::Label m_thresholdLabel;
Gtk::Entry m_thresholdEntry;
@@ -79,6 +83,8 @@ class ChannelPropertiesDialog : public Gtk::Dialog
bool m_hasThreshold;
bool m_hasHysteresis;
bool m_hasFrequency;
bool m_hasBandwidth;
bool m_hasDeskew;
};

#endif
20 changes: 0 additions & 20 deletions src/glscopeclient/WaveformArea.cpp
Original file line number Diff line number Diff line change
@@ -292,26 +292,6 @@ void WaveformArea::CreateWidgets()
sigc::mem_fun(*this, &WaveformArea::OnAttenuation), 20, &m_atten20xItem));
m_attenMenu.append(m_atten20xItem);

//Bandwidth
m_contextMenu.append(m_bwItem);
m_bwItem.set_label("Bandwidth");
m_bwItem.set_submenu(m_bwMenu);
m_bwFullItem.set_label("Full");
m_bwFullItem.set_group(m_bwGroup);
m_bwFullItem.signal_activate().connect(sigc::bind<int, Gtk::RadioMenuItem*>(
sigc::mem_fun(*this, &WaveformArea::OnBandwidthLimit), 0, &m_bwFullItem));
m_bwMenu.append(m_bwFullItem);
m_bw200Item.set_label("200 MHz");
m_bw200Item.set_group(m_bwGroup);
m_bw200Item.signal_activate().connect(sigc::bind<int, Gtk::RadioMenuItem*>(
sigc::mem_fun(*this, &WaveformArea::OnBandwidthLimit), 200, &m_bw200Item));
m_bwMenu.append(m_bw200Item);
m_bw20Item.set_label("20 MHz");
m_bw20Item.set_group(m_bwGroup);
m_bw20Item.signal_activate().connect(sigc::bind<int, Gtk::RadioMenuItem*>(
sigc::mem_fun(*this, &WaveformArea::OnBandwidthLimit), 20, &m_bw20Item));
m_bwMenu.append(m_bw20Item);

//Coupling
m_contextMenu.append(m_couplingItem);
m_couplingItem.set_label("Coupling");
7 changes: 0 additions & 7 deletions src/glscopeclient/WaveformArea.h
Original file line number Diff line number Diff line change
@@ -247,19 +247,12 @@ class WaveformArea : public Gtk::GLArea
Gtk::RadioMenuItem m_atten1xItem;
Gtk::RadioMenuItem m_atten10xItem;
Gtk::RadioMenuItem m_atten20xItem;
Gtk::MenuItem m_bwItem;
Gtk::Menu m_bwMenu;
Gtk::RadioMenuItem::Group m_bwGroup;
Gtk::RadioMenuItem m_bwFullItem;
Gtk::RadioMenuItem m_bw200Item;
Gtk::RadioMenuItem m_bw20Item;
void UpdateContextMenu();
bool m_updatingContextMenu;
void OnHide();
void OnTogglePersistence();

void OnTriggerMode(EdgeTrigger::EdgeType type, Gtk::RadioMenuItem* item);
void OnBandwidthLimit(int mhz, Gtk::RadioMenuItem* item);
void OnCoupling(OscilloscopeChannel::CouplingType type, Gtk::RadioMenuItem* item);
void OnAttenuation(double atten, Gtk::RadioMenuItem* item);
void OnMoveNewRight();
33 changes: 0 additions & 33 deletions src/glscopeclient/WaveformArea_events.cpp
Original file line number Diff line number Diff line change
@@ -1016,16 +1016,6 @@ void WaveformArea::OnDecodeSetupComplete()
m_parent->RefreshChannelsMenu();
}

void WaveformArea::OnBandwidthLimit(int mhz, 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->SetBandwidthLimit(mhz);
ClearPersistence();
}

void WaveformArea::OnCoupling(OscilloscopeChannel::CouplingType type, Gtk::RadioMenuItem* item)
{
//ignore spurious events while loading menu config, or from item being deselected
@@ -1276,7 +1266,6 @@ void WaveformArea::UpdateContextMenu()

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

@@ -1328,27 +1317,6 @@ void WaveformArea::UpdateContextMenu()
break;
}

//Update the bandwidth limit
int bwl = m_selectedChannel.m_channel->GetBandwidthLimit();
switch(bwl)
{
case 0:
m_bwFullItem.set_active(true);
break;

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

case 200:
m_bw200Item.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) )
{
@@ -1396,7 +1364,6 @@ void WaveformArea::UpdateContextMenu()
}
else
{
m_bwMenu.set_sensitive(false);
m_attenMenu.set_sensitive(false);
m_couplingMenu.set_sensitive(false);
}