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

Commits on Sep 19, 2020

  1. Copy the full SHA
    51685ff View commit details
37 changes: 37 additions & 0 deletions src/glscopeclient/OscilloscopeWindow.cpp
Original file line number Diff line number Diff line change
@@ -249,6 +249,10 @@ void OscilloscopeWindow::CreateWidgets(bool nodigital)
m_menu.append(m_windowMenuItem);
m_windowMenuItem.set_label("Window");
m_windowMenuItem.set_submenu(m_windowMenu);
m_windowMenu.append(m_windowAnalyzerMenuItem);
m_windowAnalyzerMenuItem.set_label("Analyzer");
m_windowAnalyzerMenuItem.set_submenu(m_windowAnalyzerMenu);

m_vbox.pack_start(m_toolbox, Gtk::PACK_SHRINK);
m_vbox.get_style_context()->add_class("toolbar");
m_toolbox.pack_start(m_toolbar, Gtk::PACK_EXPAND_WIDGET);
@@ -602,6 +606,7 @@ void OscilloscopeWindow::DoFileOpen(string filename, bool loadLayout, bool loadW

//Reconfigure menus
RefreshChannelsMenu();
RefreshAnalyzerMenu();

//Make sure all resize etc events have been handled before replaying history.
//Otherwise eye patterns don't refresh right.
@@ -2484,6 +2489,9 @@ void OscilloscopeWindow::OnHaltConditions()
m_haltConditionsDialog.RefreshChannels();
}

/**
@brief Update the channels menu when we connect to a new instrument
*/
void OscilloscopeWindow::RefreshChannelsMenu()
{
//Remove the old items
@@ -2513,3 +2521,32 @@ void OscilloscopeWindow::RefreshChannelsMenu()

m_channelsMenu.show_all();
}

/**
@brief Update the protocol analyzer menu when we create or destroy an analyzer
*/
void OscilloscopeWindow::RefreshAnalyzerMenu()
{
LogDebug("RefreshAnalyzerMenu\n");

//Remove the old items
auto children = m_windowAnalyzerMenu.get_children();
for(auto c : children)
m_windowAnalyzerMenu.remove(*c);

//Add new ones
for(auto a : m_analyzers)
{
auto item = Gtk::manage(new Gtk::MenuItem(a->GetDecoder()->m_displayname, false));
item->signal_activate().connect(
sigc::bind<ProtocolAnalyzerWindow*>(sigc::mem_fun(*this, &OscilloscopeWindow::OnShowAnalyzer), a ));
m_windowAnalyzerMenu.append(*item);
}

m_windowAnalyzerMenu.show_all();
}

void OscilloscopeWindow::OnShowAnalyzer(ProtocolAnalyzerWindow* window)
{
window->show();
}
4 changes: 4 additions & 0 deletions src/glscopeclient/OscilloscopeWindow.h
Original file line number Diff line number Diff line change
@@ -169,6 +169,8 @@ class OscilloscopeWindow : public Gtk::Window
Gtk::RadioMenuItem m_eyeColorViridisItem;
Gtk::MenuItem m_windowMenuItem;
Gtk::Menu m_windowMenu;
Gtk::MenuItem m_windowAnalyzerMenuItem;
Gtk::Menu m_windowAnalyzerMenu;
Gtk::HBox m_toolbox;
Gtk::Toolbar m_toolbar;
Gtk::ToolButton m_btnStart;
@@ -238,9 +240,11 @@ class OscilloscopeWindow : public Gtk::Window
void OnTimebaseSettings();
void OnScopeSync();
void OnHaltConditions();
void OnShowAnalyzer(ProtocolAnalyzerWindow* window);

//Reconfigure menus
void RefreshChannelsMenu();
void RefreshAnalyzerMenu();

//Protocol decoding etc
void RefreshAllFilters();
3 changes: 3 additions & 0 deletions src/glscopeclient/ProtocolAnalyzerWindow.h
Original file line number Diff line number Diff line change
@@ -128,6 +128,9 @@ class ProtocolAnalyzerWindow : public Gtk::Dialog
void OnWaveformDataReady();
void RemoveHistory(TimePoint timestamp);

PacketDecoder* GetDecoder()
{ return m_decoder; }

protected:
OscilloscopeWindow* m_parent;
PacketDecoder* m_decoder;
3 changes: 1 addition & 2 deletions src/glscopeclient/WaveformArea_events.cpp
Original file line number Diff line number Diff line change
@@ -972,8 +972,6 @@ void WaveformArea::OnDecodeSetupComplete()
}

//If the decoder is a packet-oriented protocol, pop up a protocol analyzer
//TODO: UI for re-opening the analyzer if we close it?
//TODO: allow protocol decoder dialogs to reconfigure decoder in the future
auto pdecode = dynamic_cast<PacketDecoder*>(m_pendingDecode);
if(pdecode != NULL)
{
@@ -982,6 +980,7 @@ void WaveformArea::OnDecodeSetupComplete()

auto analyzer = new ProtocolAnalyzerWindow(title, m_parent, pdecode, this);
m_parent->m_analyzers.emplace(analyzer);
m_parent->RefreshAnalyzerMenu();

analyzer->OnWaveformDataReady();
analyzer->show();