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: 286e413c6601
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: bca8768a368e
Choose a head ref
  • 1 commit
  • 3 files changed
  • 1 contributor

Commits on Apr 28, 2021

  1. Copy the full SHA
    bca8768 View commit details
Showing with 49 additions and 13 deletions.
  1. +6 −1 src/glscopeclient/WaveformArea.h
  2. +35 −12 src/glscopeclient/WaveformArea_cairo.cpp
  3. +8 −0 src/glscopeclient/WaveformArea_events.cpp
7 changes: 6 additions & 1 deletion src/glscopeclient/WaveformArea.h
Original file line number Diff line number Diff line change
@@ -359,7 +359,12 @@ class WaveformArea : public Gtk::GLArea
void RenderInBandPower(Cairo::RefPtr< Cairo::Context > cr);
void RenderInsertionBar(Cairo::RefPtr< Cairo::Context > cr);
void RenderVerticalCursor(Cairo::RefPtr< Cairo::Context > cr, int64_t pos, Gdk::Color color, bool label_to_left);
void RenderHorizontalCursor(Cairo::RefPtr< Cairo::Context > cr, float pos, Gdk::Color color, bool label_to_top);
void RenderHorizontalCursor(
Cairo::RefPtr< Cairo::Context > cr,
float pos,
Gdk::Color color,
bool label_to_top,
bool show_delta);
void RenderChannelLabel(Cairo::RefPtr< Cairo::Context > cr);
void RenderEyeMask(Cairo::RefPtr< Cairo::Context > cr);
void RenderDecodeOverlays(Cairo::RefPtr< Cairo::Context > cr);
47 changes: 35 additions & 12 deletions src/glscopeclient/WaveformArea_cairo.cpp
Original file line number Diff line number Diff line change
@@ -762,17 +762,28 @@ void WaveformArea::RenderHorizontalCursor(
Cairo::RefPtr< Cairo::Context > cr,
float pos,
Gdk::Color color,
bool label_to_top)
bool label_to_top,
bool show_delta)
{
//Draw the actual cursor
//Don't draw offscreen cursors
double y = YAxisUnitsToYPosition(pos);
if( (y >= m_height) || (y <= 0) )
return;

//Draw the actual cursor
cr->set_source_rgb(color.get_red_p(), color.get_green_p(), color.get_blue_p());
cr->move_to(0, y);
cr->line_to(m_width, y);
cr->stroke();

//Draw the value label at the right side
string text = m_channel.m_channel->GetYAxisUnits().PrettyPrint(pos);
auto unit = m_channel.m_channel->GetYAxisUnits();
string text = unit.PrettyPrint(pos);
if(show_delta)
{
text += "\nΔY = ";
text += unit.PrettyPrint(m_group->m_yCursorPos[0] - m_group->m_yCursorPos[1]);
}

//Figure out text size
int twidth;
@@ -885,26 +896,38 @@ void WaveformArea::RenderCursors(Cairo::RefPtr< Cairo::Context > cr)
break;

//Render the second cursor
RenderHorizontalCursor(cr, m_group->m_yCursorPos[1], cursor2, false);
RenderHorizontalCursor(cr, m_group->m_yCursorPos[1], cursor2, false, true);

//Draw filled area between them
{
//Draw filled area between them
double y = YAxisUnitsToYPosition(m_group->m_yCursorPos[0]);
double y2 = YAxisUnitsToYPosition(m_group->m_yCursorPos[1]);
cr->set_source_rgba(cursor_fill.get_red_p(), cursor_fill.get_green_p(), cursor_fill.get_blue_p(), 0.2);
cr->move_to(0, y);
cr->line_to(m_width, y);
cr->line_to(m_width, y2);
cr->line_to(0, y2);
cr->fill();

//Skip if it's bigger than our entire FOV
if( (y <= 0) || (y2 >= m_height) )
{
}

else
{
cr->set_source_rgba(
cursor_fill.get_red_p(),
cursor_fill.get_green_p(),
cursor_fill.get_blue_p(), 0.2);
cr->move_to(0, y);
cr->line_to(m_width, y);
cr->line_to(m_width, y2);
cr->line_to(0, y2);
cr->fill();
}
}

//fall through

//Draw first horizontal cursor
case WaveformGroup::CURSOR_Y_SINGLE:
if(!IsDigital())
RenderHorizontalCursor(cr, m_group->m_yCursorPos[0], cursor1, true);
RenderHorizontalCursor(cr, m_group->m_yCursorPos[0], cursor1, true, false);
break;

default:
8 changes: 8 additions & 0 deletions src/glscopeclient/WaveformArea_events.cpp
Original file line number Diff line number Diff line change
@@ -1484,6 +1484,14 @@ void WaveformArea::UpdateContextMenu()
m_cursorDualVerticalItem.set_active(true);
break;

case WaveformGroup::CURSOR_Y_SINGLE:
m_cursorSingleHorizontalItem.set_active(true);
break;

case WaveformGroup::CURSOR_Y_DUAL:
m_cursorDualHorizontalItem.set_active(true);
break;

default:
break;
}