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: f521d50c28df
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: 525c19d433d1
Choose a head ref
  • 2 commits
  • 4 files changed
  • 1 contributor

Commits on May 22, 2020

  1. Copy the full SHA
    346a953 View commit details
  2. Copy the full SHA
    525c19d View commit details
Showing with 89 additions and 75 deletions.
  1. +26 −24 glscopeclient/ChannelPropertiesDialog.cpp
  2. +6 −6 glscopeclient/ChannelPropertiesDialog.h
  3. +48 −45 glscopeclient/WaveformArea_cairo.cpp
  4. +9 −0 glscopeclient/WaveformArea_events.cpp
50 changes: 26 additions & 24 deletions glscopeclient/ChannelPropertiesDialog.cpp
Original file line number Diff line number Diff line change
@@ -52,36 +52,37 @@ ChannelPropertiesDialog::ChannelPropertiesDialog(

char buf[128];

get_vbox()->pack_start(m_scopeNameBox, Gtk::PACK_SHRINK);
m_scopeNameBox.pack_start(m_scopeNameLabel, Gtk::PACK_SHRINK);
m_scopeNameLabel.set_text("Scope");
m_scopeNameBox.pack_start(m_scopeNameEntry, Gtk::PACK_EXPAND_WIDGET);
m_scopeNameLabel.set_size_request(150, 1);
m_scopeNameLabel.set_halign(Gtk::ALIGN_START);
m_scopeNameEntry.set_halign(Gtk::ALIGN_START);
snprintf(buf, sizeof(buf), "%s (%s, serial %s)",
chan->GetScope()->m_nickname.c_str(),
chan->GetScope()->GetName().c_str(),
chan->GetScope()->GetSerial().c_str());
m_scopeNameEntry.set_text(buf);
get_vbox()->pack_start(m_grid, Gtk::PACK_EXPAND_WIDGET);
m_grid.attach(m_scopeNameLabel, 0, 0);
m_scopeNameLabel.set_text("Scope");
m_scopeNameLabel.set_halign(Gtk::ALIGN_START);
m_grid.attach_next_to(m_scopeNameEntry, m_scopeNameLabel, Gtk::POS_RIGHT);
m_scopeNameEntry.set_halign(Gtk::ALIGN_START);
snprintf(buf, sizeof(buf), "%s (%s, serial %s)",
chan->GetScope()->m_nickname.c_str(),
chan->GetScope()->GetName().c_str(),
chan->GetScope()->GetSerial().c_str());
m_scopeNameEntry.set_text(buf);

get_vbox()->pack_start(m_channelNameBox, Gtk::PACK_SHRINK);
m_channelNameBox.pack_start(m_channelNameLabel, Gtk::PACK_SHRINK);
m_channelNameLabel.set_text("Channel");
m_channelNameBox.pack_start(m_channelNameEntry, Gtk::PACK_EXPAND_WIDGET);
m_channelNameLabel.set_size_request(150, 1);
m_channelNameLabel.set_halign(Gtk::ALIGN_START);
m_channelNameEntry.set_text(chan->GetHwname());
m_channelNameEntry.set_halign(Gtk::ALIGN_START);
m_grid.attach_next_to(m_channelNameLabel, m_scopeNameLabel, Gtk::POS_BOTTOM);
m_channelNameLabel.set_text("Channel");
m_channelNameLabel.set_halign(Gtk::ALIGN_START);
m_grid.attach_next_to(m_channelNameEntry, m_channelNameLabel, Gtk::POS_RIGHT);
m_channelNameEntry.set_text(chan->GetHwname());
m_channelNameEntry.set_halign(Gtk::ALIGN_START);

get_vbox()->pack_start(m_channelDisplayNameBox, Gtk::PACK_SHRINK);
m_channelDisplayNameBox.pack_start(m_channelDisplayNameLabel, Gtk::PACK_SHRINK);
m_grid.attach_next_to(m_channelDisplayNameLabel, m_channelNameLabel, Gtk::POS_BOTTOM);
m_channelDisplayNameLabel.set_text("Display name");
m_channelDisplayNameBox.pack_start(m_channelDisplayNameEntry, Gtk::PACK_EXPAND_WIDGET);
m_channelDisplayNameLabel.set_size_request(150, 1);
m_channelDisplayNameLabel.set_halign(Gtk::ALIGN_START);
m_grid.attach_next_to(m_channelDisplayNameEntry, m_channelDisplayNameLabel, Gtk::POS_RIGHT);
m_channelDisplayNameEntry.set_text(chan->m_displayname);

m_grid.attach_next_to(m_channelColorLabel, m_channelDisplayNameLabel, Gtk::POS_BOTTOM);
m_channelColorLabel.set_text("Waveform color");
m_channelColorLabel.set_halign(Gtk::ALIGN_START);
m_grid.attach_next_to(m_channelColorButton, m_channelColorLabel, Gtk::POS_RIGHT);
m_channelColorButton.set_color(Gdk::Color(chan->m_displaycolor));

show_all();
}

@@ -96,6 +97,7 @@ ChannelPropertiesDialog::~ChannelPropertiesDialog()
void ChannelPropertiesDialog::ConfigureChannel()
{
m_chan->m_displayname = m_channelDisplayNameEntry.get_text();
m_chan->m_displaycolor = m_channelColorButton.get_color().to_string();
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
12 changes: 6 additions & 6 deletions glscopeclient/ChannelPropertiesDialog.h
Original file line number Diff line number Diff line change
@@ -48,15 +48,15 @@ class ChannelPropertiesDialog : public Gtk::Dialog
void ConfigureChannel();

protected:
Gtk::HBox m_scopeNameBox;
Gtk::Grid m_grid;
Gtk::Label m_scopeNameLabel;
Gtk::Label m_scopeNameEntry;
Gtk::HBox m_channelNameBox;
Gtk::Label m_scopeNameEntry;
Gtk::Label m_channelNameLabel;
Gtk::Label m_channelNameEntry;
Gtk::HBox m_channelDisplayNameBox;
Gtk::Label m_channelNameEntry;
Gtk::Label m_channelDisplayNameLabel;
Gtk::Entry m_channelDisplayNameEntry;
Gtk::Entry m_channelDisplayNameEntry;
Gtk::Label m_channelColorLabel;
Gtk::ColorButton m_channelColorButton;

OscilloscopeChannel* m_chan;
};
93 changes: 48 additions & 45 deletions glscopeclient/WaveformArea_cairo.cpp
Original file line number Diff line number Diff line change
@@ -572,54 +572,57 @@ void WaveformArea::RenderCursors(Cairo::RefPtr< Cairo::Context > cr)
}

//Render the insertion bar, if needed
Gdk::Color red("red");
int barpos = 0;
float alpha = 0.75;
int barsize = 5;
bool barhorz = true;
switch(m_insertionBarLocation)
if(m_insertionBarLocation != INSERT_NONE)
{
case INSERT_BOTTOM:
cr->set_source_rgba(yellow.get_red_p(), yellow.get_green_p(), yellow.get_blue_p(), alpha);
barpos = ybot - barsize;
break;

case INSERT_BOTTOM_SPLIT:
cr->set_source_rgba(orange.get_red_p(), orange.get_green_p(), orange.get_blue_p(), alpha);
barpos = ybot - barsize;
break;

case INSERT_TOP:
cr->set_source_rgba(yellow.get_red_p(), yellow.get_green_p(), yellow.get_blue_p(), alpha);
barpos = 0;
break;

case INSERT_RIGHT_SPLIT:
cr->set_source_rgba(orange.get_red_p(), orange.get_green_p(), orange.get_blue_p(), alpha);
barhorz = false;
barpos = m_width - barsize;
break;

//no bar to draw
default:
return;
}
Gdk::Color red("red");
int barpos = 0;
float alpha = 0.75;
int barsize = 5;
bool barhorz = true;
switch(m_insertionBarLocation)
{
case INSERT_BOTTOM:
cr->set_source_rgba(yellow.get_red_p(), yellow.get_green_p(), yellow.get_blue_p(), alpha);
barpos = ybot - barsize;
break;

if(barhorz)
{
cr->move_to(0, barpos);
cr->line_to(m_width, barpos);
cr->line_to(m_width, barpos + barsize);
cr->line_to(0, barpos + barsize);
}
else
{
cr->move_to(barpos, 0);
cr->line_to(barpos + barsize, 0);
cr->line_to(barpos + barsize, m_height);
cr->line_to(barpos, m_height);
case INSERT_BOTTOM_SPLIT:
cr->set_source_rgba(orange.get_red_p(), orange.get_green_p(), orange.get_blue_p(), alpha);
barpos = ybot - barsize;
break;

case INSERT_TOP:
cr->set_source_rgba(yellow.get_red_p(), yellow.get_green_p(), yellow.get_blue_p(), alpha);
barpos = 0;
break;

case INSERT_RIGHT_SPLIT:
cr->set_source_rgba(orange.get_red_p(), orange.get_green_p(), orange.get_blue_p(), alpha);
barhorz = false;
barpos = m_width - barsize;
break;

//no bar to draw
default:
break;
}

if(barhorz)
{
cr->move_to(0, barpos);
cr->line_to(m_width, barpos);
cr->line_to(m_width, barpos + barsize);
cr->line_to(0, barpos + barsize);
}
else
{
cr->move_to(barpos, 0);
cr->line_to(barpos + barsize, 0);
cr->line_to(barpos + barsize, m_height);
cr->line_to(barpos, m_height);
}
cr->fill();
}
cr->fill();
}


9 changes: 9 additions & 0 deletions glscopeclient/WaveformArea_events.cpp
Original file line number Diff line number Diff line change
@@ -320,6 +320,13 @@ void WaveformArea::OnSingleClick(GdkEventButton* event, int64_t timestamp)

void WaveformArea::OnDoubleClick(GdkEventButton* /*event*/, int64_t /*timestamp*/)
{
//Stop any in-progress drag if we double click
if(m_dragState != DRAG_NONE)
{
m_dragState = DRAG_NONE;
queue_draw();
}

switch(m_clickLocation)
{
//Double click on channel name to pop up the config dialog
@@ -378,11 +385,13 @@ bool WaveformArea::on_button_release_event(GdkEventButton* event)
}
break;

//Move the cursor
case DRAG_CURSOR:
if(m_group->m_cursorConfig == WaveformGroup::CURSOR_X_DUAL)
m_group->m_xCursorPos[1] = timestamp;
break;

//Drag the entire waveform area to a new location
case DRAG_WAVEFORM_AREA:
if(m_dropTarget != NULL)
{