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: 237292102a6e
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: a65e48950340
Choose a head ref
  • 2 commits
  • 5 files changed
  • 1 contributor

Commits on May 26, 2020

  1. Copy the full SHA
    87830d6 View commit details
  2. Copy the full SHA
    a65e489 View commit details
Showing with 184 additions and 2 deletions.
  1. +1 −0 glscopeclient/CMakeLists.txt
  2. +104 −0 glscopeclient/InstrumentConnectionDialog.cpp
  3. +63 −0 glscopeclient/InstrumentConnectionDialog.h
  4. +4 −2 glscopeclient/WaveformArea_cairo.cpp
  5. +12 −0 glscopeclient/main.cpp
1 change: 1 addition & 0 deletions glscopeclient/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@ add_executable(glscopeclient
ChannelPropertiesDialog.cpp
Framebuffer.cpp
HistoryWindow.cpp
InstrumentConnectionDialog.cpp
OscilloscopeWindow.cpp
Program.cpp
ProtocolAnalyzerWindow.cpp
104 changes: 104 additions & 0 deletions glscopeclient/InstrumentConnectionDialog.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
/***********************************************************************************************************************
* *
* 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 InstrumentConnectionDialog
*/
#include "glscopeclient.h"
#include "OscilloscopeWindow.h"
#include "InstrumentConnectionDialog.h"

using namespace std;

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

InstrumentConnectionDialog::InstrumentConnectionDialog()
: Gtk::Dialog("Connect To Instrument", Gtk::DIALOG_MODAL)
{
add_button("OK", Gtk::RESPONSE_OK);
add_button("Cancel", Gtk::RESPONSE_CANCEL);

get_vbox()->pack_start(m_grid, Gtk::PACK_EXPAND_WIDGET);

m_grid.set_margin_left(10);
m_grid.set_margin_right(10);
m_grid.set_column_spacing(10);

m_grid.attach(m_nicknameLabel, 0, 0, 1, 1);
m_nicknameLabel.set_text("Nickname");
m_grid.attach_next_to(m_nicknameEntry, m_nicknameLabel, Gtk::POS_RIGHT, 1, 1);

m_grid.attach_next_to(m_driverLabel, m_nicknameLabel, Gtk::POS_BOTTOM, 1, 1);
m_driverLabel.set_text("Driver");
m_grid.attach_next_to(m_driverBox, m_driverLabel, Gtk::POS_RIGHT, 1, 1);

vector<string> drivers;
Oscilloscope::EnumDrivers(drivers);
for(auto d : drivers)
m_driverBox.append(d);

m_grid.attach_next_to(m_transportLabel, m_driverLabel, Gtk::POS_BOTTOM, 1, 1);
m_transportLabel.set_text("Transport");
m_grid.attach_next_to(m_transportBox, m_transportLabel, Gtk::POS_RIGHT, 1, 1);

vector<string> transports;
SCPITransport::EnumTransports(transports);
for(auto t : transports)
m_transportBox.append(t);

m_grid.attach_next_to(m_pathLabel, m_transportLabel, Gtk::POS_BOTTOM, 1, 1);
m_pathLabel.set_text("Path");
m_grid.attach_next_to(m_pathEntry, m_pathLabel, Gtk::POS_RIGHT, 1, 1);

m_pathEntry.set_size_request(250, 1);

show_all();
}

InstrumentConnectionDialog::~InstrumentConnectionDialog()
{

}

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

string InstrumentConnectionDialog::GetConnectionString()
{
char tmp[256];
snprintf(tmp, sizeof(tmp), "%s:%s:%s:%s",
m_nicknameEntry.get_text().c_str(),
m_driverBox.get_active_text().c_str(),
m_transportBox.get_active_text().c_str(),
m_pathEntry.get_text().c_str());
return tmp;
}
63 changes: 63 additions & 0 deletions glscopeclient/InstrumentConnectionDialog.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/***********************************************************************************************************************
* *
* 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 connecting to a scope
*/

#ifndef InstrumentConnectionDialog_h
#define InstrumentConnectionDialog_h

/**
@brief Dialog for connecting to a scope
*/
class InstrumentConnectionDialog : public Gtk::Dialog
{
public:
InstrumentConnectionDialog();
virtual ~InstrumentConnectionDialog();

std::string GetConnectionString();

protected:

Gtk::Grid m_grid;
Gtk::Label m_nicknameLabel;
Gtk::Entry m_nicknameEntry;
Gtk::Label m_driverLabel;
Gtk::ComboBoxText m_driverBox;
Gtk::Label m_transportLabel;
Gtk::ComboBoxText m_transportBox;
Gtk::Label m_pathLabel;
Gtk::Entry m_pathEntry;
};

#endif
6 changes: 4 additions & 2 deletions glscopeclient/WaveformArea_cairo.cpp
Original file line number Diff line number Diff line change
@@ -483,12 +483,14 @@ void WaveformArea::RenderChannelInfoBox(
tlayout->set_text(text);
tlayout->get_pixel_size(twidth, theight);

int left = 2;

//Channel-colored rounded outline
cr->save();

int labelheight = theight + labelmargin*2;

box.set_x(2);
box.set_x(left);
box.set_y(bottom - labelheight - 1);
box.set_width(twidth + labelmargin*2);
box.set_height(labelheight);
@@ -522,7 +524,7 @@ void WaveformArea::RenderChannelInfoBox(
//White text
cr->save();
cr->set_source_rgba(1, 1, 1, 1);
cr->move_to(labelmargin, bottom - theight - labelmargin);
cr->move_to(labelmargin + left, bottom - theight - labelmargin);
tlayout->update_from_cairo_context(cr);
tlayout->show_in_cairo_context(cr);
cr->restore();
12 changes: 12 additions & 0 deletions glscopeclient/main.cpp
Original file line number Diff line number Diff line change
@@ -41,6 +41,7 @@
#include "../scopehal/RigolOscilloscope.h"
#include "../scopehal/RohdeSchwarzOscilloscope.h"
#include "../scopehal/AntikernelLogicAnalyzer.h"
#include "InstrumentConnectionDialog.h"
#include <libgen.h>
#include <omp.h>

@@ -155,6 +156,17 @@ int main(int argc, char* argv[])
//Initialize object creation tables for plugins
InitializePlugins();

//If there are no scopes and we're not loading a file, show the dialog to connect.
//TODO: support multi-scope connection
if(scopes.empty() && fileToLoad.empty())
{
InstrumentConnectionDialog dlg;
if(dlg.run() != Gtk::RESPONSE_OK)
return 0;

scopes.push_back(dlg.GetConnectionString());
}

//Connect to the scope(s)
for(auto s : scopes)
{