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: 5589b272a85e
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: 068822f270f5
Choose a head ref
  • 1 commit
  • 2 files changed
  • 1 contributor

Commits on May 3, 2020

  1. Copy the full SHA
    068822f View commit details
Showing with 26 additions and 1 deletion.
  1. +5 −1 glscopeclient/WaveformArea.h
  2. +21 −0 glscopeclient/WaveformArea_events.cpp
6 changes: 5 additions & 1 deletion glscopeclient/WaveformArea.h
Original file line number Diff line number Diff line change
@@ -392,9 +392,13 @@ class WaveformArea : public Gtk::GLArea
{
DRAG_NONE,
DRAG_TRIGGER,
DRAG_CURSOR
DRAG_CURSOR,
DRAG_OFFSET
} m_dragState;

//Start voltage of a drag (only used in DRAG_OFFSET mode)
double m_dragStartVoltage;

bool m_firstFrame;
};

21 changes: 21 additions & 0 deletions glscopeclient/WaveformArea_events.cpp
Original file line number Diff line number Diff line change
@@ -251,6 +251,17 @@ void WaveformArea::OnSingleClick(GdkEventButton* event, int64_t timestamp)
{
switch(event->button)
{
//Left
case 1:

//For now, can only change offset on voltage channels
if(m_channel->GetYAxisUnits() != Unit::UNIT_VOLTS)
return;

m_dragState = DRAG_OFFSET;
m_dragStartVoltage = YPositionToVolts(event->y);
break;

//Right
case 3:
break;
@@ -390,6 +401,16 @@ bool WaveformArea::on_motion_notify_event(GdkEventMotion* event)
}
break;

//Offset drag - update level and refresh
case DRAG_OFFSET:
{
double dv = YPositionToVolts(event->y) - m_dragStartVoltage;
double old_offset = m_channel->GetOffset();
m_channel->SetOffset(old_offset + dv);
queue_draw();
}
break;

//Nothing to do
default:
break;