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: 5404e93a506a
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: ea548624a1fe
Choose a head ref
  • 1 commit
  • 3 files changed
  • 1 contributor

Commits on Nov 4, 2020

  1. Verified

    This commit was signed with the committer’s verified signature.
    headius Charles Oliver Nutter
    Copy the full SHA
    ea54862 View commit details
Showing with 73 additions and 39 deletions.
  1. +61 −38 src/glscopeclient/OscilloscopeWindow.cpp
  2. +4 −0 src/glscopeclient/OscilloscopeWindow.h
  3. +8 −1 src/glscopeclient/PreferenceSchema.cpp
99 changes: 61 additions & 38 deletions src/glscopeclient/OscilloscopeWindow.cpp
Original file line number Diff line number Diff line change
@@ -61,16 +61,15 @@ using namespace std;
@brief Initializes the main window
*/
OscilloscopeWindow::OscilloscopeWindow(const vector<Oscilloscope*>& scopes, bool nodigital, bool nospectrum)
: m_iconEnterFullscreen("icons/24x24/fullscreen-enter.png")
, m_iconExitFullscreen("icons/24x24/fullscreen-exit.png")
, m_scopes(scopes)
: m_scopes(scopes)
, m_fullscreen(false)
, m_multiScopeFreeRun(false)
, m_scopeSyncWizard(NULL)
, m_haltConditionsDialog(this)
, m_triggerArmed(false)
, m_shuttingDown(false)
, m_loadInProgress(false)
, m_toolbarIconSize(0)
{
SetTitle();

@@ -279,41 +278,7 @@ void OscilloscopeWindow::CreateWidgets(bool nodigital, bool nospectrum)
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);

//TODO: preference for this (scopehal-apps:132)
//m_toolbar.set_toolbar_style(Gtk::TOOLBAR_BOTH);

m_toolbar.append(m_btnStart, sigc::mem_fun(*this, &OscilloscopeWindow::OnStart));
m_btnStart.set_tooltip_text("Start (normal trigger)");
m_btnStart.set_label("Start");
m_btnStart.set_icon_widget(*Gtk::manage(new Gtk::Image("icons/24x24/trigger-start.png")));
m_toolbar.append(m_btnStartSingle, sigc::mem_fun(*this, &OscilloscopeWindow::OnStartSingle));
m_btnStartSingle.set_tooltip_text("Start (single trigger)");
m_btnStartSingle.set_label("Single");
m_btnStartSingle.set_icon_widget(*Gtk::manage(new Gtk::Image("icons/24x24/trigger-single.png")));
m_toolbar.append(m_btnStop, sigc::mem_fun(*this, &OscilloscopeWindow::OnStop));
m_btnStop.set_tooltip_text("Stop trigger");
m_btnStop.set_label("Stop");
m_btnStop.set_icon_widget(*Gtk::manage(new Gtk::Image("icons/24x24/trigger-stop.png")));
m_toolbar.append(*Gtk::manage(new Gtk::SeparatorToolItem));
m_toolbar.append(m_btnHistory, sigc::mem_fun(*this, &OscilloscopeWindow::OnHistory));
m_btnHistory.set_tooltip_text("History");
m_btnHistory.set_label("History");
m_btnHistory.set_icon_widget(*Gtk::manage(new Gtk::Image("icons/24x24/history.png")));
m_toolbar.append(*Gtk::manage(new Gtk::SeparatorToolItem));
m_toolbar.append(m_btnRefresh, sigc::mem_fun(*this, &OscilloscopeWindow::OnRefreshConfig));
m_btnRefresh.set_tooltip_text("Reload configuration from scope");
m_btnRefresh.set_label("Reload Config");
m_btnRefresh.set_icon_widget(*Gtk::manage(new Gtk::Image("icons/24x24/refresh-settings.png")));
m_toolbar.append(m_btnClearSweeps, sigc::mem_fun(*this, &OscilloscopeWindow::OnClearSweeps));
m_btnClearSweeps.set_tooltip_text("Clear sweeps");
m_btnClearSweeps.set_label("Clear Sweeps");
m_btnClearSweeps.set_icon_widget(*Gtk::manage(new Gtk::Image("icons/24x24/clear-sweeps.png")));
m_toolbar.append(m_btnFullscreen, sigc::mem_fun(*this, &OscilloscopeWindow::OnFullscreen));
m_btnFullscreen.set_tooltip_text("Fullscreen");
m_btnFullscreen.set_label("Fullscreen");
m_btnFullscreen.set_icon_widget(m_iconEnterFullscreen);
m_toolbar.append(*Gtk::manage(new Gtk::SeparatorToolItem));
PopulateToolbar();
m_toolbox.pack_start(m_alphalabel, Gtk::PACK_SHRINK);
m_alphalabel.set_label("Opacity ");
m_alphalabel.get_style_context()->add_class("toolbar");
@@ -362,6 +327,60 @@ void OscilloscopeWindow::CreateWidgets(bool nodigital, bool nospectrum)
Gdk::Screen::get_default(), m_css, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
}

/**
@brief Populates the toolbar
*/
void OscilloscopeWindow::PopulateToolbar()
{
//Remove all existing toolbar items
auto children = m_toolbar.get_children();
for(auto c : children)
m_toolbar.remove(*c);

m_toolbarIconSize = m_preferences.GetEnum<int>("Appearance.Toolbar.icon_size");
string base_path = "icons/" + to_string(m_toolbarIconSize) + "x" + to_string(m_toolbarIconSize) + "/";

m_iconEnterFullscreen = Gtk::Image(base_path + "fullscreen-enter.png");
m_iconExitFullscreen = Gtk::Image(base_path + "fullscreen-exit.png");

//TODO: preference for this (scopehal-apps:132)
//m_toolbar.set_toolbar_style(Gtk::TOOLBAR_BOTH);

m_toolbar.append(m_btnStart, sigc::mem_fun(*this, &OscilloscopeWindow::OnStart));
m_btnStart.set_tooltip_text("Start (normal trigger)");
m_btnStart.set_label("Start");
m_btnStart.set_icon_widget(*Gtk::manage(new Gtk::Image(base_path + "trigger-start.png")));
m_toolbar.append(m_btnStartSingle, sigc::mem_fun(*this, &OscilloscopeWindow::OnStartSingle));
m_btnStartSingle.set_tooltip_text("Start (single trigger)");
m_btnStartSingle.set_label("Single");
m_btnStartSingle.set_icon_widget(*Gtk::manage(new Gtk::Image(base_path + "trigger-single.png")));
m_toolbar.append(m_btnStop, sigc::mem_fun(*this, &OscilloscopeWindow::OnStop));
m_btnStop.set_tooltip_text("Stop trigger");
m_btnStop.set_label("Stop");
m_btnStop.set_icon_widget(*Gtk::manage(new Gtk::Image(base_path + "trigger-stop.png")));
m_toolbar.append(*Gtk::manage(new Gtk::SeparatorToolItem));
m_toolbar.append(m_btnHistory, sigc::mem_fun(*this, &OscilloscopeWindow::OnHistory));
m_btnHistory.set_tooltip_text("History");
m_btnHistory.set_label("History");
m_btnHistory.set_icon_widget(*Gtk::manage(new Gtk::Image(base_path + "history.png")));
m_toolbar.append(*Gtk::manage(new Gtk::SeparatorToolItem));
m_toolbar.append(m_btnRefresh, sigc::mem_fun(*this, &OscilloscopeWindow::OnRefreshConfig));
m_btnRefresh.set_tooltip_text("Reload configuration from scope");
m_btnRefresh.set_label("Reload Config");
m_btnRefresh.set_icon_widget(*Gtk::manage(new Gtk::Image(base_path + "refresh-settings.png")));
m_toolbar.append(m_btnClearSweeps, sigc::mem_fun(*this, &OscilloscopeWindow::OnClearSweeps));
m_btnClearSweeps.set_tooltip_text("Clear sweeps");
m_btnClearSweeps.set_label("Clear Sweeps");
m_btnClearSweeps.set_icon_widget(*Gtk::manage(new Gtk::Image(base_path + "clear-sweeps.png")));
m_toolbar.append(m_btnFullscreen, sigc::mem_fun(*this, &OscilloscopeWindow::OnFullscreen));
m_btnFullscreen.set_tooltip_text("Fullscreen");
m_btnFullscreen.set_label("Fullscreen");
m_btnFullscreen.set_icon_widget(m_iconEnterFullscreen);
m_toolbar.append(*Gtk::manage(new Gtk::SeparatorToolItem));

m_toolbar.show_all();
}

/**
@brief Creates the waveform areas for a new scope.
*/
@@ -527,6 +546,10 @@ void OscilloscopeWindow::OnPreferenceDialogResponse(int response)
SyncFilterColors();
for(auto w : m_waveformAreas)
w->queue_draw();

//Update the toolbar if we changed the icon size
if(m_toolbarIconSize != m_preferences.GetEnum<int>("Appearance.Toolbar.icon_size"))
PopulateToolbar();
}

//Clean up the dialog
4 changes: 4 additions & 0 deletions src/glscopeclient/OscilloscopeWindow.h
Original file line number Diff line number Diff line change
@@ -153,6 +153,7 @@ class OscilloscopeWindow : public Gtk::Window

//Initialization
void CreateWidgets(bool nodigital, bool nospectrum);
void PopulateToolbar();

//Widgets
Gtk::VBox m_vbox;
@@ -347,6 +348,9 @@ class OscilloscopeWindow : public Gtk::Window

//True if file load is in progress
bool m_loadInProgress;

//Current toolbar icon size
int m_toolbarIconSize;
};

#endif
9 changes: 8 additions & 1 deletion src/glscopeclient/PreferenceSchema.cpp
Original file line number Diff line number Diff line change
@@ -132,7 +132,14 @@ void PreferenceManager::InitializeDefaults()
Preference::Color("default_color", Gdk::Color("#101010"))
.Label("Default color")
.Description("Color for packets that don't fit any other category"));

auto& toolbar = appearance.AddCategory("Toolbar");
toolbar.AddPreference(
Preference::Enum("icon_size", 24)
.Label("Icon Size")
.Description("Toolbar icon size, in pixels")
.EnumValue("24x24", 24)
.EnumValue("48x48", 48)
);

auto& windows = appearance.AddCategory("Windows");
windows.AddPreference(