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: bee23816b8f5
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: a1bbbee09dc6
Choose a head ref
  • 1 commit
  • 6 files changed
  • 1 contributor

Commits on May 13, 2021

  1. Clicking on a packet in the protocol analyzer now does a better job o…

    …f centering packets in the view
    azonenberg committed May 13, 2021
    Copy the full SHA
    a1bbbee View commit details
2 changes: 1 addition & 1 deletion lib
4 changes: 3 additions & 1 deletion src/glscopeclient/ProtocolAnalyzerWindow.cpp
Original file line number Diff line number Diff line change
@@ -366,6 +366,7 @@ ProtocolAnalyzerColumns::ProtocolAnalyzerColumns(PacketDecoder* decoder)
add(m_timestamp);
add(m_capturekey);
add(m_offset);
add(m_len);

auto headers = decoder->GetHeaders();
for(size_t i=0; i<headers.size(); i++)
@@ -615,6 +616,7 @@ void ProtocolAnalyzerWindow::FillOutRow(
row[m_columns.m_timestamp] = stime;
row[m_columns.m_capturekey] = TimePoint(data->m_startTimestamp, data->m_startFemtoseconds);
row[m_columns.m_offset] = p->m_offset;
row[m_columns.m_len] = p->m_len;

//Just copy headers without any processing
for(size_t i=0; i<headers.size(); i++)
@@ -708,7 +710,7 @@ void ProtocolAnalyzerWindow::OnSelectionChanged()
m_parent->JumpToHistory(row[m_columns.m_capturekey]);

//Set the offset of the decoder's group
m_area->CenterTimestamp(row[m_columns.m_offset]);
m_area->CenterPacket(row[m_columns.m_offset], row[m_columns.m_len]);
m_area->m_group->m_frame.queue_draw();
}

2 changes: 2 additions & 0 deletions src/glscopeclient/ProtocolAnalyzerWindow.h
Original file line number Diff line number Diff line change
@@ -47,6 +47,7 @@ class ProtocolTreeRow
std::string m_timestamp;
TimePoint m_capturekey;
int64_t m_offset;
int64_t m_len;
std::vector<std::string> m_headers;
std::string m_data;
Glib::RefPtr<Gdk::Pixbuf> m_image;
@@ -117,6 +118,7 @@ class ProtocolAnalyzerColumns : public Gtk::TreeModel::ColumnRecord
Gtk::TreeModelColumn<Glib::ustring> m_timestamp;
Gtk::TreeModelColumn<TimePoint> m_capturekey;
Gtk::TreeModelColumn<int64_t> m_offset;
Gtk::TreeModelColumn<int64_t> m_len;
std::vector< Gtk::TreeModelColumn<Glib::ustring> > m_headers;
Gtk::TreeModelColumn<Glib::ustring> m_data;
Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf>> m_image;
14 changes: 11 additions & 3 deletions src/glscopeclient/ProtocolTreeModel.cpp
Original file line number Diff line number Diff line change
@@ -42,7 +42,7 @@ ProtocolTreeModel::ProtocolTreeModel(const Gtk::TreeModelColumnRecord& columns)
, Gtk::TreeModel()
, m_columns(columns)
{
m_nheaders = columns.size() - 9;
m_nheaders = columns.size() - 10;
}

Glib::RefPtr<ProtocolTreeModel> ProtocolTreeModel::create(const Gtk::TreeModelColumnRecord& columns)
@@ -341,10 +341,14 @@ void ProtocolTreeModel::set_value_impl(const iterator& row, int column, const Gl
p->m_offset = reinterpret_cast<const Gtk::TreeModelColumn<int64_t>::ValueType&>(value).get();
break;

case 7:
p->m_len = reinterpret_cast<const Gtk::TreeModelColumn<int64_t>::ValueType&>(value).get();
break;

//header, image, or data
default:
{
int ihead = column - 7;
int ihead = column - 8;
if(ihead < m_nheaders)
{
p->m_headers.resize(m_nheaders);
@@ -397,10 +401,14 @@ void ProtocolTreeModel::get_value_vfunc(const TreeModel::iterator& iter, int col
reinterpret_cast<Gtk::TreeModelColumn<int64_t>::ValueType&>(value).set(p->m_offset);
break;

case 7:
reinterpret_cast<Gtk::TreeModelColumn<int64_t>::ValueType&>(value).set(p->m_len);
break;

//header, image, or data
default:
{
int ihead = column - 7;
int ihead = column - 8;
if(ihead < m_nheaders)
reinterpret_cast<Gtk::TreeModelColumn<std::string>::ValueType&>(value).set(p->m_headers[ihead]);
else if(ihead == m_nheaders)
2 changes: 1 addition & 1 deletion src/glscopeclient/WaveformArea.h
Original file line number Diff line number Diff line change
@@ -197,7 +197,7 @@ class WaveformArea : public Gtk::GLArea
void UnmapAllBuffers(bool update_y);
void CalculateOverlayPositions();

void CenterTimestamp(int64_t time);
void CenterPacket(int64_t time, int64_t len);

static bool IsGLInitComplete()
{ return m_isGlewInitialized; }
15 changes: 12 additions & 3 deletions src/glscopeclient/WaveformArea_events.cpp
Original file line number Diff line number Diff line change
@@ -1586,11 +1586,20 @@ void WaveformArea::OnStatistics()
m_group->ToggleOff(m_selectedChannel.m_channel);
}

void WaveformArea::CenterTimestamp(int64_t time)
void WaveformArea::CenterPacket(int64_t time, int64_t len)
{
//Figure out how wide our view is, then offset the point by half that
//Figure out the width of the view, in time units
int64_t width = PixelsToXAxisUnits(m_width);
m_group->m_xAxisOffset = time - width/2;

//If the packet is too long to fit on screen at the current zoom, have it start 10% of the way across
if(len > width)
m_group->m_xAxisOffset = time - width*0.1;

//If the entire packet fits, center it
else
m_group->m_xAxisOffset = time - width/2 + len/2;

//Redraw everything
m_parent->ClearPersistence(m_group, false, true);

//If we have a single X cursor, move it to this point too