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

Commits on Mar 15, 2020

  1. Copy the full SHA
    541a954 View commit details
  2. Added HistoryWindow::SetMaxWaveforms. History is no longer deleted if…

    … history view is hidden.
    azonenberg committed Mar 15, 2020
    Copy the full SHA
    1c6fb27 View commit details
Showing with 23 additions and 10 deletions.
  1. +8 −4 glscopeclient/HistoryWindow.cpp
  2. +2 −0 glscopeclient/HistoryWindow.h
  3. +13 −4 glscopeclient/OscilloscopeWindow.cpp
  4. +0 −2 glscopeclient/WaveformArea.cpp
12 changes: 8 additions & 4 deletions glscopeclient/HistoryWindow.cpp
Original file line number Diff line number Diff line change
@@ -75,7 +75,7 @@ HistoryWindow::HistoryWindow(OscilloscopeWindow* parent, Oscilloscope* scope)
m_hbox.pack_start(m_maxLabel, Gtk::PACK_SHRINK);
m_maxLabel.set_label("Max waveforms");
m_hbox.pack_start(m_maxBox, Gtk::PACK_EXPAND_WIDGET);
m_maxBox.set_text("100");
SetMaxWaveforms(10);
m_vbox.pack_start(m_scroller, Gtk::PACK_EXPAND_WIDGET);
m_scroller.add(m_tree);
m_scroller.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
@@ -105,6 +105,13 @@ HistoryWindow::~HistoryWindow()
}
}

void HistoryWindow::SetMaxWaveforms(int n)
{
char tmp[128];
snprintf(tmp, sizeof(tmp), "%d", n);
m_maxBox.set_text(tmp);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Event handlers

@@ -176,11 +183,8 @@ void HistoryWindow::OnWaveformDataReady()
m_tree.get_selection()->select(row);

//Remove extra waveforms, if we have any.
//If not visible, destroy all waveforms other than the most recent
string smax = m_maxBox.get_text();
size_t nmax = atoi(smax.c_str());
if(!is_visible())
nmax = 1;
auto children = m_model->children();
while(children.size() > nmax)
{
2 changes: 2 additions & 0 deletions glscopeclient/HistoryWindow.h
Original file line number Diff line number Diff line change
@@ -62,6 +62,8 @@ class HistoryWindow : public Gtk::Window
void OnWaveformDataReady();
void JumpToHistory(TimePoint timestamp);

void SetMaxWaveforms(int n);

protected:
virtual bool on_delete_event(GdkEventAny* ignored);
virtual void OnSelectionChanged();
17 changes: 13 additions & 4 deletions glscopeclient/OscilloscopeWindow.cpp
Original file line number Diff line number Diff line change
@@ -468,6 +468,15 @@ void OscilloscopeWindow::DoFileOpen(string filename, bool loadLayout, bool loadW
LoadDecodes(node["decodes"], table);
LoadUIConfiguration(node["ui_config"], table);
}
show_all();

//Create history windows for all of our scopes
for(auto scope : m_scopes)
{
auto hist = new HistoryWindow(this, scope);
hist->hide();
m_historyWindows[scope] = hist;
}

//Re-title the window for the new scope
SetTitle();
@@ -478,7 +487,6 @@ void OscilloscopeWindow::DoFileOpen(string filename, bool loadLayout, bool loadW

//Start threads to poll scopes etc
g_app->StartScopeThreads();
show_all();
}

/**
@@ -509,7 +517,7 @@ void OscilloscopeWindow::LoadInstruments(const YAML::Node& node, bool reconnect,

//Sanity check make/model/serial. If mismatch, stop
string message;
bool fail;
bool fail = false;
if(inst["name"].as<string>() != scope->GetName())
{
message = string("Unable to connect to oscilloscope: instrument has model name \"") +
@@ -678,8 +686,9 @@ void OscilloscopeWindow::LoadUIConfiguration(const YAML::Node& node, IDTable& ta
{
//Create the splitter
auto sn = it.second;
auto dir = sn["dir"].as<string>();
Gtk::Paned* split = NULL;
if(sn["dir"].as<string>() == "h")
if(dir == "h")
split = new Gtk::HPaned;
else
split = new Gtk::VPaned;
@@ -696,7 +705,7 @@ void OscilloscopeWindow::LoadUIConfiguration(const YAML::Node& node, IDTable& ta
if(a)
split->pack1(*a);
if(b)
split->pack1(*b);
split->pack2(*b);
split->set_position(sn["split"].as<int>());
}

2 changes: 0 additions & 2 deletions glscopeclient/WaveformArea.cpp
Original file line number Diff line number Diff line change
@@ -442,8 +442,6 @@ void WaveformArea::CreateWidgets()

void WaveformArea::on_realize()
{
LogDebug("realize waveform area\n");

//Let the base class create the GL context, then select it
Gtk::GLArea::on_realize();
make_current();