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: 914dbb04818e
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: 08362917fa71
Choose a head ref
  • 1 commit
  • 4 files changed
  • 1 contributor

Commits on Sep 15, 2020

  1. TriggerPropertiesDialog: now show list of trigger properties and allo…

    …w them to be configured
    azonenberg committed Sep 15, 2020
    Copy the full SHA
    0836291 View commit details
Showing with 89 additions and 20 deletions.
  1. +27 −19 src/glscopeclient/FilterDialog.cpp
  2. +3 −0 src/glscopeclient/FilterDialog.h
  3. +58 −1 src/glscopeclient/TriggerPropertiesDialog.cpp
  4. +1 −0 src/glscopeclient/TriggerPropertiesDialog.h
46 changes: 27 additions & 19 deletions src/glscopeclient/FilterDialog.cpp
Original file line number Diff line number Diff line change
@@ -388,48 +388,56 @@ void FilterDialog::ConfigureDecoder()
string old_name = m_filter->m_displayname;
bool default_name = (m_filter->GetHwname() == old_name);

for(size_t i=0; i<m_rows.size(); i++)
ConfigureInputs(m_filter, m_rows);
ConfigureParameters(m_filter, m_prows);

m_filter->m_displaycolor = m_channelColorButton.get_color().to_string();

//Set the name of the decoder based on the input channels etc.
//If the user specified a new name, use that.
//But if they left the old autogenerated name, update appropriately.
m_filter->SetDefaultName();
auto dname = m_channelDisplayNameEntry.get_text();
if( (dname != "") && (!default_name || (old_name != dname)) )
m_filter->m_displayname = dname;
}

void FilterDialog::ConfigureInputs(FlowGraphNode* node, vector<ChannelSelectorRow*>& rows)
{
//Hook up input(s)
for(size_t i=0; i<rows.size(); i++)
{
auto chname = m_rows[i]->m_chans.get_active_text();
m_filter->SetInput(i, m_rows[i]->m_chanptrs[chname]);
auto chname = rows[i]->m_chans.get_active_text();
node->SetInput(i, rows[i]->m_chanptrs[chname]);
}
}

//Extract file names
for(size_t i=0; i<m_prows.size(); i++)
void FilterDialog::ConfigureParameters(FlowGraphNode* node, vector<ParameterRowBase*>& rows)
{
for(auto row : rows)
{
auto row = m_prows[i];
auto srow = dynamic_cast<ParameterRowString*>(row);
auto erow = dynamic_cast<ParameterRowEnum*>(row);
auto frow = dynamic_cast<ParameterRowFilenames*>(row);
auto name = row->m_label.get_label();

//Strings are easy
if(srow)
m_filter->GetParameter(name).ParseString(srow->m_entry.get_text());
node->GetParameter(name).ParseString(srow->m_entry.get_text());

//Enums
else if(erow)
m_filter->GetParameter(name).ParseString(erow->m_box.get_active_text());
node->GetParameter(name).ParseString(erow->m_box.get_active_text());

//List of file names
else if(frow)
{
vector<string> paths;
for(size_t j=0; j<frow->m_list.size(); j++)
paths.push_back(frow->m_list.get_text(j));
m_filter->GetParameter(name).SetFileNames(paths);
node->GetParameter(name).SetFileNames(paths);
}
}

m_filter->m_displaycolor = m_channelColorButton.get_color().to_string();

//Set the name of the decoder based on the input channels etc.
//If the user specified a new name, use that.
//But if they left the old autogenerated name, update appropriately.
m_filter->SetDefaultName();
auto dname = m_channelDisplayNameEntry.get_text();
if( (dname != "") && (!default_name || (old_name != dname)) )
m_filter->m_displayname = dname;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
3 changes: 3 additions & 0 deletions src/glscopeclient/FilterDialog.h
Original file line number Diff line number Diff line change
@@ -127,6 +127,9 @@ class FilterDialog : public Gtk::Dialog
Gtk::Widget*& last_label,
Gtk::Dialog* parent);

static void ConfigureInputs(FlowGraphNode* node, std::vector<ChannelSelectorRow*>& rows);
static void ConfigureParameters(FlowGraphNode* node, std::vector<ParameterRowBase*>& rows);

protected:
Filter* m_filter;

59 changes: 58 additions & 1 deletion src/glscopeclient/TriggerPropertiesDialog.cpp
Original file line number Diff line number Diff line change
@@ -98,8 +98,11 @@ void TriggerPropertiesDialog::Clear()
for(auto c : children)
m_contentGrid.remove(*c);

for(auto r : m_rows)
delete r;
for(auto r : m_prows)
delete r;
m_rows.clear();
m_prows.clear();
}

@@ -108,7 +111,15 @@ void TriggerPropertiesDialog::Clear()

void TriggerPropertiesDialog::ConfigureTrigger()
{
//m_chan->m_displayname = m_channelDisplayNameEntry.get_text();
//Create the trigger
auto trig = Trigger::CreateTrigger(m_triggerTypeBox.get_active_text(), m_scope);

//Hook up the input(s)
FilterDialog::ConfigureInputs(trig, m_rows);
FilterDialog::ConfigureParameters(trig, m_prows);

//and feed it to the scope
m_scope->SetTrigger(trig);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -131,7 +142,11 @@ void TriggerPropertiesDialog::OnTriggerTypeChanged()
else
{
auto temp_trig = Trigger::CreateTrigger(type, m_scope);

//Copy level and first input from the current trigger
temp_trig->SetLevel(current_trig->GetLevel());
temp_trig->SetInput(0, current_trig->GetInput(0));

AddRows(temp_trig);
delete temp_trig;
}
@@ -140,6 +155,48 @@ void TriggerPropertiesDialog::OnTriggerTypeChanged()
void TriggerPropertiesDialog::AddRows(Trigger* trig)
{
Gtk::Widget* last_label = NULL;

//Add inputs
for(size_t i=0; i<trig->GetInputCount(); i++)
{
//Add the row
auto row = new ChannelSelectorRow;
if(last_label)
m_contentGrid.attach_next_to(row->m_label, *last_label, Gtk::POS_BOTTOM, 1, 1);
else
{
m_contentGrid.attach(row->m_label, 0, 0, 1, 1);
last_label = &row->m_label;
}
m_contentGrid.attach_next_to(row->m_chans, row->m_label, Gtk::POS_RIGHT, 1, 1);
m_rows.push_back(row);
last_label = &row->m_label;

auto cur_in = trig->GetInput(i);

//Label is just the channel name
row->m_label.set_label(trig->GetInputName(i));

//Fill the channel list with all channels that are legal to use here.
//They must be from the current instrument, so don't bother checking others.
//TODO: multiple streams
for(size_t k=0; k<m_scope->GetChannelCount(); k++)
{
auto c = StreamDescriptor(m_scope->GetChannel(k), 0);
if(trig->ValidateChannel(i, c))
{
auto name = c.m_channel->m_displayname;
row->m_chans.append(name);
row->m_chanptrs[name] = c;

if(c == cur_in)
row->m_chans.set_active_text(name);
}
}

}

//Add parameters
for(auto it = trig->GetParamBegin(); it != trig->GetParamEnd(); it ++)
m_prows.push_back(FilterDialog::CreateRow(m_contentGrid, it->first, it->second, last_label, this));

1 change: 1 addition & 0 deletions src/glscopeclient/TriggerPropertiesDialog.h
Original file line number Diff line number Diff line change
@@ -64,6 +64,7 @@ class TriggerPropertiesDialog : public Gtk::Dialog

Oscilloscope* m_scope;

std::vector<ChannelSelectorRow*> m_rows;
std::vector<ParameterRowBase*> m_prows;
};