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: faae7cbcee7a
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: c3ad881536f1
Choose a head ref
  • 1 commit
  • 4 files changed
  • 1 contributor

Commits on Feb 15, 2020

  1. Initial version of channel properties dialog. So far only allows chan…

    …ging the display name. Fixes #35.
    azonenberg committed Feb 15, 2020
    Copy the full SHA
    c3ad881 View commit details
Showing with 177 additions and 2 deletions.
  1. +1 −0 glscopeclient/CMakeLists.txt
  2. +102 −0 glscopeclient/ChannelPropertiesDialog.cpp
  3. +64 −0 glscopeclient/ChannelPropertiesDialog.h
  4. +10 −2 glscopeclient/WaveformArea_events.cpp
1 change: 1 addition & 0 deletions glscopeclient/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@ link_directories(${GTKMM_LIBRARY_DIRS} ${SIGCXX_LIBRARY_DIRS})
###############################################################################
#C++ compilation
add_executable(glscopeclient
ChannelPropertiesDialog.cpp
Framebuffer.cpp
HistoryWindow.cpp
MeasurementDialog.cpp
102 changes: 102 additions & 0 deletions glscopeclient/ChannelPropertiesDialog.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
/***********************************************************************************************************************
* *
* ANTIKERNEL v0.1 *
* *
* Copyright (c) 2012-2020 Andrew D. Zonenberg *
* All rights reserved. *
* *
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the *
* following conditions are met: *
* *
* * Redistributions of source code must retain the above copyright notice, this list of conditions, and the *
* following disclaimer. *
* *
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the *
* following disclaimer in the documentation and/or other materials provided with the distribution. *
* *
* * Neither the name of the author nor the names of any contributors may be used to endorse or promote products *
* derived from this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL *
* THE AUTHORS BE HELD LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES *
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR *
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE *
* POSSIBILITY OF SUCH DAMAGE. *
* *
***********************************************************************************************************************/

/**
@file
@author Andrew D. Zonenberg
@brief Implementation of ChannelPropertiesDialog
*/
#include "glscopeclient.h"
#include "OscilloscopeWindow.h"
#include "ChannelPropertiesDialog.h"

using namespace std;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Construction / destruction

ChannelPropertiesDialog::ChannelPropertiesDialog(
OscilloscopeWindow* parent,
OscilloscopeChannel* chan)
: Gtk::Dialog(string("Channel properties"), *parent, Gtk::DIALOG_MODAL)
, m_chan(chan)
{
add_button("OK", Gtk::RESPONSE_OK);
add_button("Cancel", Gtk::RESPONSE_CANCEL);

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_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);

get_vbox()->pack_start(m_channelDisplayNameBox, Gtk::PACK_SHRINK);
m_channelDisplayNameBox.pack_start(m_channelDisplayNameLabel, Gtk::PACK_SHRINK);
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_channelDisplayNameEntry.set_text(chan->m_displayname);

show_all();
}

ChannelPropertiesDialog::~ChannelPropertiesDialog()
{

}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Output

void ChannelPropertiesDialog::ConfigureChannel()
{
m_chan->m_displayname = m_channelDisplayNameEntry.get_text();
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Event handlers
64 changes: 64 additions & 0 deletions glscopeclient/ChannelPropertiesDialog.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/***********************************************************************************************************************
* *
* ANTIKERNEL v0.1 *
* *
* Copyright (c) 2012-2020 Andrew D. Zonenberg *
* All rights reserved. *
* *
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the *
* following conditions are met: *
* *
* * Redistributions of source code must retain the above copyright notice, this list of conditions, and the *
* following disclaimer. *
* *
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the *
* following disclaimer in the documentation and/or other materials provided with the distribution. *
* *
* * Neither the name of the author nor the names of any contributors may be used to endorse or promote products *
* derived from this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL *
* THE AUTHORS BE HELD LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES *
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR *
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE *
* POSSIBILITY OF SUCH DAMAGE. *
* *
***********************************************************************************************************************/

/**
@file
@author Andrew D. Zonenberg
@brief Dialog for configuring channel properties
*/

#ifndef ChannelPropertiesDialog_h
#define ChannelPropertiesDialog_h

/**
@brief Dialog for configuring a single scope channel
*/
class ChannelPropertiesDialog : public Gtk::Dialog
{
public:
ChannelPropertiesDialog(OscilloscopeWindow* parent, OscilloscopeChannel* chan);
virtual ~ChannelPropertiesDialog();

void ConfigureChannel();

protected:
Gtk::HBox m_scopeNameBox;
Gtk::Label m_scopeNameLabel;
Gtk::Label m_scopeNameEntry;
Gtk::HBox m_channelNameBox;
Gtk::Label m_channelNameLabel;
Gtk::Label m_channelNameEntry;
Gtk::HBox m_channelDisplayNameBox;
Gtk::Label m_channelDisplayNameLabel;
Gtk::Entry m_channelDisplayNameEntry;

OscilloscopeChannel* m_chan;
};

#endif
12 changes: 10 additions & 2 deletions glscopeclient/WaveformArea_events.cpp
Original file line number Diff line number Diff line change
@@ -39,6 +39,7 @@
#include <random>
#include "ProfileBlock.h"
#include "ProtocolDecoderDialog.h"
#include "ChannelPropertiesDialog.h"
#include "../../lib/scopeprotocols/EyeDecoder2.h"
#include "../../lib/scopeprotocols/WaterfallDecoder.h"

@@ -326,9 +327,16 @@ void WaveformArea::OnDoubleClick(GdkEventButton* /*event*/, int64_t /*timestamp*
{
switch(m_clickLocation)
{
//Double click on channel name to pop up the config dialog
case LOC_CHAN_NAME:
//Pop up channel configuration dialog
LogDebug("TODO: channel config dialog\n");
{
ChannelPropertiesDialog dialog(m_parent, m_selectedChannel);
if(dialog.run() == Gtk::RESPONSE_OK)
{
dialog.ConfigureChannel();
queue_draw();
}
}
break;

default: