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

Commits on Sep 16, 2020

  1. Copy the full SHA
    7f8afba View commit details
  2. Copy the full SHA
    c3964ab View commit details
2 changes: 1 addition & 1 deletion lib
Submodule lib updated from a12152 to d41f98
56 changes: 0 additions & 56 deletions src/glscopeclient/ProfileBlock.h

This file was deleted.

7 changes: 0 additions & 7 deletions src/glscopeclient/WaveformArea.cpp
Original file line number Diff line number Diff line change
@@ -36,7 +36,6 @@
#include "WaveformArea.h"
#include "OscilloscopeWindow.h"
#include <random>
#include "ProfileBlock.h"
#include "../../lib/scopeprotocols/scopeprotocols.h"

using namespace std;
@@ -638,8 +637,6 @@ void WaveformArea::CleanupGLHandles()

void WaveformArea::InitializeWaveformPass()
{
//ProfileBlock pb("Load waveform shaders");

ComputeShader dwc;
if(!dwc.Load("shaders/waveform-compute-digital.glsl"))
LogFatal("failed to load digital waveform compute shader, aborting\n");
@@ -657,8 +654,6 @@ void WaveformArea::InitializeWaveformPass()

void WaveformArea::InitializeColormapPass()
{
//ProfileBlock pb("Load colormap shaders");

//Set up shaders
VertexShader cvs;
FragmentShader cfs;
@@ -739,8 +734,6 @@ void WaveformArea::InitializeEyePass()

void WaveformArea::InitializePersistencePass()
{
//ProfileBlock pb("Load persistence shaders");

//Set up shaders
VertexShader cvs;
FragmentShader cfs;
3 changes: 3 additions & 0 deletions src/glscopeclient/WaveformArea.h
Original file line number Diff line number Diff line change
@@ -376,6 +376,7 @@ class WaveformArea : public Gtk::GLArea
void DoRenderCairoUnderlays(Cairo::RefPtr< Cairo::Context > cr);
void RenderBackgroundGradient(Cairo::RefPtr< Cairo::Context > cr);
void RenderGrid(Cairo::RefPtr< Cairo::Context > cr);
void RenderTriggerArrow(Cairo::RefPtr< Cairo::Context > cr, float voltage, bool dragging, Gdk::Color color);
void RenderCairoOverlays();
void DoRenderCairoOverlays(Cairo::RefPtr< Cairo::Context > cr);
void RenderCursors(Cairo::RefPtr< Cairo::Context > cr);
@@ -457,6 +458,7 @@ class WaveformArea : public Gtk::GLArea
LOC_PLOT,
LOC_VSCALE,
LOC_TRIGGER,
LOC_TRIGGER_SECONDARY, //lower spot for window trigger or similar
LOC_CHAN_NAME,
LOC_XCURSOR_0,
LOC_XCURSOR_1
@@ -471,6 +473,7 @@ class WaveformArea : public Gtk::GLArea
{
DRAG_NONE,
DRAG_TRIGGER,
DRAG_TRIGGER_SECONDARY,
DRAG_CURSOR_0,
DRAG_CURSOR_1,
DRAG_OFFSET,
118 changes: 66 additions & 52 deletions src/glscopeclient/WaveformArea_cairo.cpp
Original file line number Diff line number Diff line change
@@ -43,8 +43,8 @@
#include "OscilloscopeWindow.h"
#include <random>
#include <map>
#include "ProfileBlock.h"
#include "../scopeprotocols/EyePattern.h"
#include "../../lib/scopehal/WindowTrigger.h"

using namespace std;
using namespace glm;
@@ -207,64 +207,78 @@ void WaveformArea::RenderGrid(Cairo::RefPtr< Cairo::Context > cr)
auto trig = scope->GetTrigger();
if( (trig != NULL) && (trig->GetInput(0) == m_channel) )
{
float v = trig->GetLevel();
float y = VoltsToYPosition(v);
//Main arrow
RenderTriggerArrow(cr, trig->GetLevel(), (m_dragState == DRAG_TRIGGER), color );

float trisize = 5;
//Secondary arrow for window trigger
auto wt = dynamic_cast<WindowTrigger*>(trig);
if(wt)
RenderTriggerArrow(cr, wt->GetLowerBound(), (m_dragState == DRAG_TRIGGER_SECONDARY), color );
}
}

//Dragging? Arrow follows mouse
if(m_dragState == DRAG_TRIGGER)
{
cr->set_source_rgba(1, 0, 0, 1);
y = m_cursorY;
}
cr->restore();
}

else
{
cr->set_source_rgba(
color.get_red_p(),
color.get_green_p(),
color.get_blue_p(),
1);
cr->set_line_width(1);
float x = m_plotRight + trisize*2;

//If the trigger is outside the displayed area, clip to the edge of the displayed area
//and display an "out of range" symbol
float tbottom = m_height - trisize;
float ttop = trisize;
if(y > tbottom)
{
y = tbottom;

cr->move_to(x, y - trisize);
cr->line_to(x, y + trisize);
cr->line_to(x - trisize*0.5, y);
cr->move_to(x, y + trisize);
cr->line_to(x + trisize*0.5, y);
cr->stroke();
}
else if(y < ttop)
{
y = ttop;

cr->move_to(x, y + trisize);
cr->line_to(x, y - trisize);
cr->line_to(x - trisize*0.5, y);
cr->move_to(x, y - trisize);
cr->line_to(x + trisize*0.5, y);
cr->stroke();
}
}
void WaveformArea::RenderTriggerArrow(
Cairo::RefPtr< Cairo::Context > cr,
float voltage,
bool dragging,
Gdk::Color color)
{
float y = VoltsToYPosition(voltage);

cr->move_to(m_plotRight, y);
cr->line_to(m_plotRight + trisize, y + trisize);
cr->line_to(m_plotRight + trisize, y - trisize);
cr->fill();
float trisize = 5;

//Dragging? Arrow follows mouse
if(dragging)
{
cr->set_source_rgba(1, 0, 0, 1);
y = m_cursorY;
}

else
{
cr->set_source_rgba(
color.get_red_p(),
color.get_green_p(),
color.get_blue_p(),
1);
cr->set_line_width(1);
float x = m_plotRight + trisize*2;

//If the trigger is outside the displayed area, clip to the edge of the displayed area
//and display an "out of range" symbol
float tbottom = m_height - trisize;
float ttop = trisize;
if(y > tbottom)
{
y = tbottom;

cr->move_to(x, y - trisize);
cr->line_to(x, y + trisize);
cr->line_to(x - trisize*0.5, y);
cr->move_to(x, y + trisize);
cr->line_to(x + trisize*0.5, y);
cr->stroke();
}
else if(y < ttop)
{
y = ttop;

cr->move_to(x, y + trisize);
cr->line_to(x, y - trisize);
cr->line_to(x - trisize*0.5, y);
cr->move_to(x, y - trisize);
cr->line_to(x + trisize*0.5, y);
cr->stroke();
}
}

cr->restore();
cr->move_to(m_plotRight, y);
cr->line_to(m_plotRight + trisize, y + trisize);
cr->line_to(m_plotRight + trisize, y - trisize);
cr->fill();
}

void WaveformArea::DoRenderCairoOverlays(Cairo::RefPtr< Cairo::Context > cr)
71 changes: 68 additions & 3 deletions src/glscopeclient/WaveformArea_events.cpp
Original file line number Diff line number Diff line change
@@ -37,11 +37,11 @@
#include "WaveformArea.h"
#include "OscilloscopeWindow.h"
#include <random>
#include "ProfileBlock.h"
#include <map>
#include "ChannelPropertiesDialog.h"
#include "../../lib/scopeprotocols/EyePattern.h"
#include "../../lib/scopeprotocols/Waterfall.h"
#include <map>
#include "../../lib/scopehal/WindowTrigger.h"

using namespace std;
using namespace glm;
@@ -306,6 +306,23 @@ void WaveformArea::OnSingleClick(GdkEventButton* event, int64_t timestamp)
}
break;

case LOC_TRIGGER_SECONDARY:
{
switch(event->button)
{
//Left
case 1:
m_dragState = DRAG_TRIGGER_SECONDARY;
queue_draw();
break;

default:
//LogDebug("Button %d pressed on trigger\n", event->button);
break;
}
}
break;

//Drag channel name
case LOC_CHAN_NAME:
{
@@ -406,6 +423,21 @@ bool WaveformArea::on_button_release_event(GdkEventButton* event)
}
break;

case DRAG_TRIGGER_SECONDARY:
if(event->button == 1)
{
auto scope = m_channel.m_channel->GetScope();
auto trig = dynamic_cast<WindowTrigger*>(scope->GetTrigger());
if(trig)
{
trig->SetLowerBound(YPositionToVolts(event->y));
scope->PushTrigger();
}
m_parent->ClearAllPersistence();
queue_draw();
}
break;

//Move the cursor
case DRAG_CURSOR_0:
m_group->m_xCursorPos[0] = timestamp;
@@ -529,13 +561,26 @@ bool WaveformArea::on_motion_notify_event(GdkEventMotion* event)
switch(m_dragState)
{
//Trigger drag - update level and refresh
//TODO: what happens if window trigger arrows cross?
case DRAG_TRIGGER:
{
auto scope = m_channel.m_channel->GetScope();
auto trig = scope->GetTrigger();
trig->SetLevel(YPositionToVolts(event->y));
scope->PushTrigger();
m_parent->ClearAllPersistence();
queue_draw();
}
break;

case DRAG_TRIGGER_SECONDARY:
{
auto scope = m_channel.m_channel->GetScope();
auto trig = dynamic_cast<WindowTrigger*>(scope->GetTrigger());
if(trig)
{
trig->SetLowerBound(YPositionToVolts(event->y));
scope->PushTrigger();
}
queue_draw();
}
break;
@@ -710,6 +755,7 @@ bool WaveformArea::on_motion_notify_event(GdkEventMotion* event)
break;

case LOC_TRIGGER:
case LOC_TRIGGER_SECONDARY:
shape = "ns-resize";
break;

@@ -1079,6 +1125,25 @@ WaveformArea::ClickLocation WaveformArea::HitTest(double x, double y)
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());
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;
}
}
}

//Nope, just the scale bar
1 change: 0 additions & 1 deletion src/glscopeclient/WaveformArea_rendering.cpp
Original file line number Diff line number Diff line change
@@ -39,7 +39,6 @@
#include <random>
#include <map>
#include <immintrin.h>
#include "ProfileBlock.h"
#include "../../lib/scopeprotocols/EyePattern.h"
#include "../../lib/scopeprotocols/Waterfall.h"