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: 01ef2ea256be
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: db403620b537
Choose a head ref
  • 1 commit
  • 3 files changed
  • 1 contributor

Commits on Mar 14, 2020

  1. Copy the full SHA
    db40362 View commit details
Showing with 72 additions and 9 deletions.
  1. +55 −0 glscopeclient/OscilloscopeWindow.cpp
  2. +16 −9 glscopeclient/WaveformGroup.cpp
  3. +1 −0 glscopeclient/WaveformGroup.h
55 changes: 55 additions & 0 deletions glscopeclient/OscilloscopeWindow.cpp
Original file line number Diff line number Diff line change
@@ -594,6 +594,61 @@ void OscilloscopeWindow::LoadUIConfiguration(const YAML::Node& node, IDTable& ta
for(auto jt : overlays)
area->AddOverlay(static_cast<ProtocolDecoder*>(table[jt.second["id"].as<int>()]));
}

//Waveform groups
auto groups = node["groups"];
for(auto it : groups)
{
//Create the group
auto gn = it.second;
WaveformGroup* group = new WaveformGroup(this);
table.emplace(gn["id"].as<int>(), group);
group->m_measurementFrame.set_label(gn["name"].as<string>());
group->m_pixelsPerXUnit = gn["pixelsPerXUnit"].as<float>();
group->m_xAxisOffset = gn["xAxisOffset"].as<long>();
m_waveformGroups.emplace(group);

//Cursor config
string cursor = gn["cursorConfig"].as<string>();
if(cursor == "none")
group->m_cursorConfig = WaveformGroup::CURSOR_NONE;
else if(cursor == "x_single")
group->m_cursorConfig = WaveformGroup::CURSOR_X_SINGLE;
else if(cursor == "x_dual")
group->m_cursorConfig = WaveformGroup::CURSOR_X_DUAL;
else if(cursor == "y_single")
group->m_cursorConfig = WaveformGroup::CURSOR_Y_SINGLE;
else if(cursor == "y_dual")
group->m_cursorConfig = WaveformGroup::CURSOR_Y_DUAL;
group->m_xCursorPos[0] = gn["xcursor0"].as<long>();
group->m_xCursorPos[1] = gn["xcursor1"].as<long>();
group->m_yCursorPos[0] = gn["ycursor0"].as<float>();
group->m_yCursorPos[1] = gn["ycursor1"].as<float>();

//Measurements
auto measurements = gn["measurements"];
if(measurements)
{
for(auto jt : measurements)
{
auto mn = jt.second;

auto meas = Measurement::CreateMeasurement(mn["measurement"].as<string>());
table.emplace(mn["id"].as<int>(), meas);

//Configure the inputs
auto inputs = mn["inputs"];
for(auto kt : inputs)
{
meas->SetInput(
kt.first.as<string>(),
static_cast<OscilloscopeChannel*>(table[kt.second.as<int>()]) );
}

group->AddColumn(meas, mn["color"].as<string>(), mn["nick"].as<string>());
}
}
}
}

/**
25 changes: 16 additions & 9 deletions glscopeclient/WaveformGroup.cpp
Original file line number Diff line number Diff line change
@@ -130,11 +130,6 @@ void WaveformGroup::AddColumn(string name, OscilloscopeChannel* chan, string col
else
m->SetInput(0, chan);

//Make sure the measurements can actually be seen
m_measurementFrame.show();

//TODO: Don't allow adding the same measurement twice

//Short name of the channel (truncate if too long)
string shortname = chan->m_displayname;
if(shortname.length() > 12)
@@ -143,13 +138,25 @@ void WaveformGroup::AddColumn(string name, OscilloscopeChannel* chan, string col
shortname += "...";
}

//Create the column and figure out the title
auto col = new MeasurementColumn;
//Name the measurement
char tmp[256];
snprintf(tmp, sizeof(tmp), "%s: %s", shortname.c_str(), name.c_str());
col->m_title = tmp;

AddColumn(m, color, tmp);
}

void WaveformGroup::AddColumn(Measurement* meas, string color, string label)
{
//Make sure the measurements can actually be seen
m_measurementFrame.show();

//TODO: Don't allow adding the same measurement twice

//Create the column and figure out the title
auto col = new MeasurementColumn;
col->m_title = label;
m_measurementColumns.emplace(col);
col->m_measurement = m;
col->m_measurement = meas;

//Add to the box and show it
m_measurementBox.pack_start(col->m_label, Gtk::PACK_SHRINK, 5);
1 change: 1 addition & 0 deletions glscopeclient/WaveformGroup.h
Original file line number Diff line number Diff line change
@@ -63,6 +63,7 @@ class WaveformGroup
void RefreshMeasurements();

void AddColumn(std::string name, OscilloscopeChannel* chan, std::string color);
void AddColumn(Measurement* meas, std::string color, std::string label);

Gtk::Frame m_frame;
Gtk::VBox m_vbox;