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

Commits on Sep 16, 2020

  1. Copy the full SHA
    a37df80 View commit details
  2. Copy the full SHA
    4780fdc View commit details

Commits on Sep 18, 2020

  1. Copy the full SHA
    d828bec View commit details
  2. Copy the full SHA
    4ae6689 View commit details
  3. ProtocolAnalyzerWindow: Added menu bar with file|export item (see #174)…

    …. Doesn't do anything yet. Added foreground color customization support.
    azonenberg committed Sep 18, 2020
    Copy the full SHA
    3c2db63 View commit details
2 changes: 1 addition & 1 deletion lib
Submodule lib updated from d41f98 to 4f8385
18 changes: 15 additions & 3 deletions src/glscopeclient/ProtocolAnalyzerWindow.cpp
Original file line number Diff line number Diff line change
@@ -357,7 +357,8 @@ bool ProtocolDisplayFilterClause::Validate(vector<string> headers)
ProtocolAnalyzerColumns::ProtocolAnalyzerColumns(PacketDecoder* decoder)
{
add(m_visible);
add(m_color);
add(m_bgcolor);
add(m_fgcolor);
add(m_timestamp);
add(m_capturekey);
add(m_offset);
@@ -420,7 +421,10 @@ ProtocolAnalyzerWindow::ProtocolAnalyzerWindow(
auto pcol = m_tree.get_column(col);
vector<Gtk::CellRenderer*> cells = pcol->get_cells();
for(auto c : cells)
pcol->add_attribute(*c, "background-gdk", 1); //column 1 is color
{
pcol->add_attribute(*c, "background-gdk", 1); //column 1 is bg color
pcol->add_attribute(*c, "foreground-gdk", 2); //column 2 is fg color
}
}

m_tree.get_selection()->signal_changed().connect(
@@ -431,6 +435,13 @@ ProtocolAnalyzerWindow::ProtocolAnalyzerWindow(
sigc::mem_fun(*this, &ProtocolAnalyzerWindow::OnFilterChanged));

//Set up the widgets
get_vbox()->pack_start(m_menu, Gtk::PACK_SHRINK);
m_menu.append(m_fileMenuItem);
m_fileMenuItem.set_label("File");
m_fileMenuItem.set_submenu(m_fileMenu);
m_fileMenu.append(m_fileExportMenuItem);
m_fileExportMenuItem.set_label("Export...");

get_vbox()->pack_start(m_filterRow, Gtk::PACK_SHRINK);
m_filterRow.pack_start(m_filterBox, Gtk::PACK_EXPAND_WIDGET);
m_filterRow.pack_start(m_filterApplyButton, Gtk::PACK_SHRINK);
@@ -563,7 +574,8 @@ void ProtocolAnalyzerWindow::FillOutRow(
stime += tmp;

//Create the row
row[m_columns.m_color] = p->m_displayBackgroundColor;
row[m_columns.m_bgcolor] = p->m_displayBackgroundColor;
row[m_columns.m_fgcolor] = p->m_displayForegroundColor;
row[m_columns.m_timestamp] = stime;
row[m_columns.m_capturekey] = TimePoint(data->m_startTimestamp, data->m_startPicoseconds);
row[m_columns.m_offset] = p->m_offset;
7 changes: 6 additions & 1 deletion src/glscopeclient/ProtocolAnalyzerWindow.h
Original file line number Diff line number Diff line change
@@ -52,7 +52,8 @@ class ProtocolAnalyzerColumns : public Gtk::TreeModel::ColumnRecord
std::vector< Gtk::TreeModelColumn<Glib::ustring> > m_headers;
Gtk::TreeModelColumn<Glib::ustring> m_data;
Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf>> m_image;
Gtk::TreeModelColumn<Gdk::Color> m_color;
Gtk::TreeModelColumn<Gdk::Color> m_bgcolor;
Gtk::TreeModelColumn<Gdk::Color> m_fgcolor;
Gtk::TreeModelColumn<bool> m_visible;
};

@@ -135,6 +136,10 @@ class ProtocolAnalyzerWindow : public Gtk::Dialog
void OnApplyFilter();
void OnFilterChanged();

Gtk::MenuBar m_menu;
Gtk::MenuItem m_fileMenuItem;
Gtk::Menu m_fileMenu;
Gtk::MenuItem m_fileExportMenuItem;
Gtk::HBox m_filterRow;
Gtk::Entry m_filterBox;
Gtk::Button m_filterApplyButton;
21 changes: 14 additions & 7 deletions src/glscopeclient/Timeline.cpp
Original file line number Diff line number Diff line change
@@ -353,17 +353,24 @@ void Timeline::Render(const Cairo::RefPtr<Cairo::Context>& cr, OscilloscopeChann
if(chan)
{
auto scope = chan->GetScope();
if(scope == NULL)
return;
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);
auto trig = scope->GetTrigger();
if(trig)
{
Gdk::Color color(trig->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();
}

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

6 changes: 3 additions & 3 deletions src/glscopeclient/WaveformArea_cairo.cpp
Original file line number Diff line number Diff line change
@@ -44,7 +44,7 @@
#include <random>
#include <map>
#include "../scopeprotocols/EyePattern.h"
#include "../../lib/scopehal/WindowTrigger.h"
#include "../../lib/scopehal/TwoLevelTrigger.h"

using namespace std;
using namespace glm;
@@ -210,8 +210,8 @@ void WaveformArea::RenderGrid(Cairo::RefPtr< Cairo::Context > cr)
//Main arrow
RenderTriggerArrow(cr, trig->GetLevel(), (m_dragState == DRAG_TRIGGER), color );

//Secondary arrow for window trigger
auto wt = dynamic_cast<WindowTrigger*>(trig);
//Secondary arrow for two-level triggers
auto wt = dynamic_cast<TwoLevelTrigger*>(trig);
if(wt)
RenderTriggerArrow(cr, wt->GetLowerBound(), (m_dragState == DRAG_TRIGGER_SECONDARY), color );
}
57 changes: 30 additions & 27 deletions src/glscopeclient/WaveformArea_events.cpp
Original file line number Diff line number Diff line change
@@ -41,7 +41,7 @@
#include "ChannelPropertiesDialog.h"
#include "../../lib/scopeprotocols/EyePattern.h"
#include "../../lib/scopeprotocols/Waterfall.h"
#include "../../lib/scopehal/WindowTrigger.h"
#include "../../lib/scopehal/TwoLevelTrigger.h"

using namespace std;
using namespace glm;
@@ -427,7 +427,7 @@ bool WaveformArea::on_button_release_event(GdkEventButton* event)
if(event->button == 1)
{
auto scope = m_channel.m_channel->GetScope();
auto trig = dynamic_cast<WindowTrigger*>(scope->GetTrigger());
auto trig = dynamic_cast<TwoLevelTrigger*>(scope->GetTrigger());
if(trig)
{
trig->SetLowerBound(YPositionToVolts(event->y));
@@ -575,7 +575,7 @@ bool WaveformArea::on_motion_notify_event(GdkEventMotion* event)
case DRAG_TRIGGER_SECONDARY:
{
auto scope = m_channel.m_channel->GetScope();
auto trig = dynamic_cast<WindowTrigger*>(scope->GetTrigger());
auto trig = dynamic_cast<TwoLevelTrigger*>(scope->GetTrigger());
if(trig)
{
trig->SetLowerBound(YPositionToVolts(event->y));
@@ -1108,40 +1108,43 @@ WaveformArea::ClickLocation WaveformArea::HitTest(double x, double y)
{
//On the trigger button?
auto scope = m_channel.m_channel->GetScope();
auto trig = scope->GetTrigger();
if( (scope != NULL) && (trig != NULL) && (m_channel == trig->GetInput(0)) )
if(scope != NULL)
{
float vy = VoltsToYPosition(trig->GetLevel());
float radius = 20;
if(x < (m_plotRight + radius) )
auto trig = scope->GetTrigger();
if( (trig != NULL) && (m_channel == trig->GetInput(0)) )
{
//If on top of the trigger, obviously we're a hit
if(fabs(y - vy) < radius)
return LOC_TRIGGER;

//but also check the edges of the plot if trigger is off scale
if( (vy > m_height) && (fabs(m_height - y) < radius) )
return LOC_TRIGGER;
if( (vy < 0) && (y < radius) )
return LOC_TRIGGER;
}

//Check if it's a window trigger (second arrow)
auto wt = dynamic_cast<WindowTrigger*>(trig);
if(wt)
{
vy = VoltsToYPosition(wt->GetLowerBound());
float vy = VoltsToYPosition(trig->GetLevel());
float radius = 20;
if(x < (m_plotRight + radius) )
{
//If on top of the trigger, obviously we're a hit
if(fabs(y - vy) < radius)
return LOC_TRIGGER_SECONDARY;
return LOC_TRIGGER;

//but also check the edges of the plot if trigger is off scale
if( (vy > m_height) && (fabs(m_height - y) < radius) )
return LOC_TRIGGER_SECONDARY;
return LOC_TRIGGER;
if( (vy < 0) && (y < radius) )
return LOC_TRIGGER_SECONDARY;
return LOC_TRIGGER;
}

//Check if it's a two-level trigger (second arrow)
auto wt = dynamic_cast<TwoLevelTrigger*>(trig);
if(wt)
{
vy = VoltsToYPosition(wt->GetLowerBound());
if(x < (m_plotRight + radius) )
{
//If on top of the trigger, obviously we're a hit
if(fabs(y - vy) < radius)
return LOC_TRIGGER_SECONDARY;

//but also check the edges of the plot if trigger is off scale
if( (vy > m_height) && (fabs(m_height - y) < radius) )
return LOC_TRIGGER_SECONDARY;
if( (vy < 0) && (y < radius) )
return LOC_TRIGGER_SECONDARY;
}
}
}
}