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: c3964ab590d4
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: 64b538f4f9f8
Choose a head ref
  • 2 commits
  • 5 files changed
  • 1 contributor

Commits on Sep 16, 2020

  1. Copy the full SHA
    5488366 View commit details
  2. Timeline now displays trigger position arrow. Might make it draggable…

    … later, but for now it can be changed by the trigger properties dialog. Fixes #12.
    azonenberg committed Sep 16, 2020
    Copy the full SHA
    64b538f View commit details
4 changes: 4 additions & 0 deletions src/glscopeclient/OscilloscopeWindow.cpp
Original file line number Diff line number Diff line change
@@ -1555,6 +1555,10 @@ void OscilloscopeWindow::OnTriggerProperties(Oscilloscope* scope)
if(Gtk::RESPONSE_OK != dlg.run())
return;
dlg.ConfigureTrigger();

//Redraw the timeline in case we changed the trigger channel etc
for(auto g : m_waveformGroups)
g->m_timeline.queue_draw();
}

void OscilloscopeWindow::OnEyeColorChanged(EyeColor color, Gtk::RadioMenuItem* item)
28 changes: 25 additions & 3 deletions src/glscopeclient/Timeline.cpp
Original file line number Diff line number Diff line change
@@ -181,21 +181,25 @@ bool Timeline::on_draw(const Cairo::RefPtr<Cairo::Context>& cr)

//Figure out the units to use for the axis
auto children = m_group->m_waveformBox.get_children();
OscilloscopeChannel* chan = NULL;
if(!children.empty())
{
auto view = dynamic_cast<WaveformArea*>(children[0]);
if(view != NULL)
m_xAxisUnit = view->GetChannel().m_channel->GetXAxisUnits();
{
chan = view->GetChannel().m_channel;
m_xAxisUnit = chan->GetXAxisUnits();
}
}

//And actually draw the rest
Render(cr);
Render(cr, chan);

cr->restore();
return true;
}

void Timeline::Render(const Cairo::RefPtr<Cairo::Context>& cr)
void Timeline::Render(const Cairo::RefPtr<Cairo::Context>& cr, OscilloscopeChannel* chan)
{
size_t w = get_width();
size_t h = get_height();
@@ -343,6 +347,24 @@ void Timeline::Render(const Cairo::RefPtr<Cairo::Context>& cr)
true,
false);
}

//Draw trigger position for the first scope in the plot
//TODO: handle more than one scope
if(chan)
{
auto scope = chan->GetScope();
int64_t timestamp = scope->GetTriggerOffset();
double x = (timestamp - m_group->m_xAxisOffset) * m_group->m_pixelsPerXUnit;

Gdk::Color color(scope->GetTrigger()->GetInput(0).m_channel->m_displaycolor);
cr->set_source_rgba(color.get_red_p(), color.get_green_p(), color.get_blue_p(), 1.0);

int size = 5;
cr->move_to(x-size, h-size);
cr->line_to(x, h);
cr->line_to(x+size, h-size);
cr->fill();
}
}

void Timeline::DrawCursor(
2 changes: 1 addition & 1 deletion src/glscopeclient/Timeline.h
Original file line number Diff line number Diff line change
@@ -58,7 +58,7 @@ class Timeline : public Gtk::Layout

virtual void on_realize();

void Render(const Cairo::RefPtr<Cairo::Context>& cr);
void Render(const Cairo::RefPtr<Cairo::Context>& cr, OscilloscopeChannel* chan);

virtual void DrawCursor(
const Cairo::RefPtr<Cairo::Context>& cr,
12 changes: 12 additions & 0 deletions src/glscopeclient/TriggerPropertiesDialog.cpp
Original file line number Diff line number Diff line change
@@ -80,6 +80,14 @@ TriggerPropertiesDialog::TriggerPropertiesDialog(
m_triggerTypeBox.signal_changed().connect(
sigc::mem_fun(*this, &TriggerPropertiesDialog::OnTriggerTypeChanged));

//Trigger horizontal offset
Unit ps(Unit::UNIT_PS);
m_grid.attach_next_to(m_triggerOffsetLabel, m_triggerTypeLabel, Gtk::POS_BOTTOM, 1, 1);
m_triggerOffsetLabel.set_text("Trigger Offset");
m_grid.attach_next_to(m_triggerOffsetEntry, m_triggerOffsetLabel, Gtk::POS_RIGHT, 1, 1);
auto offset = m_scope->GetTriggerOffset();
m_triggerOffsetEntry.set_text(ps.PrettyPrint(offset));

//Actual content
get_vbox()->pack_start(m_contentGrid, Gtk::PACK_SHRINK);
AddRows(trig);
@@ -120,6 +128,10 @@ void TriggerPropertiesDialog::ConfigureTrigger()

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

//Also, set the trigger offset
Unit ps(Unit::UNIT_PS);
m_scope->SetTriggerOffset(ps.ParseString(m_triggerOffsetEntry.get_text()));
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2 changes: 2 additions & 0 deletions src/glscopeclient/TriggerPropertiesDialog.h
Original file line number Diff line number Diff line change
@@ -60,6 +60,8 @@ class TriggerPropertiesDialog : public Gtk::Dialog
Gtk::Label m_scopeNameEntry;
Gtk::Label m_triggerTypeLabel;
Gtk::ComboBoxText m_triggerTypeBox;
Gtk::Label m_triggerOffsetLabel;
Gtk::Entry m_triggerOffsetEntry;
Gtk::Grid m_contentGrid;

Oscilloscope* m_scope;