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: e4a181c7c9a6
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: 99e321e13275
Choose a head ref
  • 2 commits
  • 6 files changed
  • 1 contributor

Commits on Nov 4, 2020

  1. Copy the full SHA
    7734e6a View commit details
  2. Copy the full SHA
    99e321e View commit details
5 changes: 5 additions & 0 deletions src/glscopeclient/OscilloscopeWindow.cpp
Original file line number Diff line number Diff line change
@@ -544,7 +544,12 @@ void OscilloscopeWindow::OnPreferenceDialogResponse(int response)
SyncFilterColors();
PopulateToolbar();
for(auto w : m_waveformAreas)
{
w->SyncFontPreferences();
w->queue_draw();
}
for(auto g : m_waveformGroups)
g->m_timeline.queue_draw();
}

//Clean up the dialog
52 changes: 37 additions & 15 deletions src/glscopeclient/PreferenceSchema.cpp
Original file line number Diff line number Diff line change
@@ -56,39 +56,49 @@ void PreferenceManager::InitializeDefaults()
Preference::Color("cursor_fill_text_color", Gdk::Color("yellow"))
.Label("Cursor fill text color")
.Description("Color for in-band power and other text drawn between cursors"));
auto& decode_colors = appearance.AddCategory("Decodes");
decode_colors.AddPreference(
cursors.AddPreference(
Preference::Font("label_font", "sans normal 10")
.Label("Cursor label font")
.Description("Font used for voltage measurements displayed next to cursors"));

auto& decodes = appearance.AddCategory("Decodes");
decodes.AddPreference(
Preference::Font("protocol_font", "sans normal 10")
.Label("Protocol font")
.Description("Font used for protocol decode overlay text"));
decodes.AddPreference(
Preference::Color("address_color", Gdk::Color("#ffff00"))
.Label("Address color")
.Description("Color for register/memory addresses"));
decode_colors.AddPreference(
decodes.AddPreference(
Preference::Color("checksum_bad_color", Gdk::Color("#ff0000"))
.Label("Checksum/CRC color (Bad)")
.Description("Color for incorrect checksums/CRCs"));
decode_colors.AddPreference(
decodes.AddPreference(
Preference::Color("checksum_ok_color", Gdk::Color("#00ff00"))
.Label("Checksum/CRC color (OK)")
.Description("Color for correct checksums/CRCs"));
decode_colors.AddPreference(
decodes.AddPreference(
Preference::Color("control_color", Gdk::Color("#c000a0"))
.Label("Control color")
.Description("Color for control events"));
decode_colors.AddPreference(
decodes.AddPreference(
Preference::Color("data_color", Gdk::Color("#336699"))
.Label("Data color")
.Description("Color for generic protocol data bytes"));
decode_colors.AddPreference(
decodes.AddPreference(
Preference::Color("error_color", Gdk::Color("#ff0000"))
.Label("Error color")
.Description("Color for malformed data or error conditions"));
decode_colors.AddPreference(
decodes.AddPreference(
Preference::Color("idle_color", Gdk::Color("#404040"))
.Label("Idle color")
.Description("Color for idle sequences between meaningful data"));
decode_colors.AddPreference(
decodes.AddPreference(
Preference::Color("preamble_color", Gdk::Color("#808080"))
.Label("Preamble color")
.Description("Color for preambles, sync bytes, and other fixed header data"));

auto& peaks = appearance.AddCategory("Peaks");
peaks.AddPreference(
Preference::Color("peak_outline_color", Gdk::Color("#009900"))
@@ -132,7 +142,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");

auto& timeline = appearance.AddCategory("Timeline");
timeline.AddPreference(
Preference::Font("tick_label_font", "sans normal 10")
.Label("Tick font")
.Description("Font used for tickmark labels on the timeline"));

auto& toolbar = appearance.AddCategory("Toolbar");
toolbar.AddPreference(
Preference::Enum("button_style", Gtk::TOOLBAR_ICONS)
.Label("Button Style")
@@ -149,6 +166,16 @@ void PreferenceManager::InitializeDefaults()
.EnumValue("48x48", 48)
);

auto& waveforms = appearance.AddCategory("Waveforms");
waveforms.AddPreference(
Preference::Font("infobox_font", "sans normal 10")
.Label("Info box font")
.Description("Font used for channel information box"));
waveforms.AddPreference(
Preference::Font("y_axis_font", "monospace normal 10")
.Label("Y axis font")
.Description("Font used for text on the vertical axis of waveforms"));

auto& windows = appearance.AddCategory("Windows");
windows.AddPreference(
Preference::Color("insertion_bar_color", Gdk::Color("yellow"))
@@ -182,11 +209,6 @@ void PreferenceManager::InitializeDefaults()
.EnumValue("Choice 2", TestEnum::Choice2)
.EnumValue("Choice 3", TestEnum::Choice3)
);
trans.AddPreference(
Preference::Font("test_font", "sans normal 10")
.Label("Test font")
.Description("Fifth test value")
);
auto& decode = instrument.AddCategory("Decoders");
decode.AddPreference(
Preference::Real("hidden_setting", 13.37)
4 changes: 2 additions & 2 deletions src/glscopeclient/Timeline.cpp
Original file line number Diff line number Diff line change
@@ -279,7 +279,7 @@ void Timeline::Render(const Cairo::RefPtr<Cairo::Context>& cr, OscilloscopeChann

//Print tick marks and labels
Glib::RefPtr<Pango::Layout> tlayout = Pango::Layout::create(get_pango_context());
Pango::FontDescription font("sans normal 10");
Pango::FontDescription font = m_parent->GetPreferences().GetFont("Appearance.Timeline.tick_label_font");
font.set_weight(Pango::WEIGHT_NORMAL);
tlayout->set_font_description(font);
int swidth;
@@ -405,7 +405,7 @@ void Timeline::DrawCursor(
Gdk::Color black("black");

Glib::RefPtr<Pango::Layout> tlayout = Pango::Layout::create(get_pango_context());
Pango::FontDescription font("sans normal 10");
Pango::FontDescription font = m_parent->GetPreferences().GetFont("Appearance.Cursors.label_font");
font.set_weight(Pango::WEIGHT_NORMAL);
tlayout->set_font_description(font);
int swidth;
11 changes: 3 additions & 8 deletions src/glscopeclient/WaveformArea.cpp
Original file line number Diff line number Diff line change
@@ -51,15 +51,7 @@ WaveformArea::WaveformArea(
, m_channel(channel)
, m_parent(parent)
, m_pixelsPerVolt(1)
, m_axisLabelFont("monospace normal 10")
, m_infoBoxFont("sans normal 10")
, m_cursorLabelFont("sans normal 10")
, m_decodeFont("sans normal 10")
{
m_axisLabelFont.set_weight(Pango::WEIGHT_NORMAL);
m_infoBoxFont.set_weight(Pango::WEIGHT_NORMAL);
m_cursorLabelFont.set_weight(Pango::WEIGHT_NORMAL);
m_decodeFont.set_weight(Pango::WEIGHT_NORMAL);
SharedCtorInit();
}

@@ -167,6 +159,9 @@ void WaveformArea::OnRemoveOverlay(StreamDescriptor filter)

void WaveformArea::CreateWidgets()
{
//Set up fonts
SyncFontPreferences();

//Delete
auto item = Gtk::manage(new Gtk::MenuItem("Delete", false));
item->signal_activate().connect(
2 changes: 2 additions & 0 deletions src/glscopeclient/WaveformArea.h
Original file line number Diff line number Diff line change
@@ -176,6 +176,8 @@ class WaveformArea : public Gtk::GLArea
static bool IsGLInitComplete()
{ return m_isGlewInitialized; }

void SyncFontPreferences();

protected:
void SharedCtorInit();

8 changes: 8 additions & 0 deletions src/glscopeclient/WaveformArea_events.cpp
Original file line number Diff line number Diff line change
@@ -1463,3 +1463,11 @@ void WaveformArea::CenterTimestamp(int64_t time)
m_group->m_xAxisOffset = time - width/2;
m_parent->ClearPersistence(m_group, false, true);
}

void WaveformArea::SyncFontPreferences()
{
m_axisLabelFont = m_parent->GetPreferences().GetFont("Appearance.Waveforms.y_axis_font");
m_infoBoxFont = m_parent->GetPreferences().GetFont("Appearance.Waveforms.infobox_font");
m_cursorLabelFont = m_parent->GetPreferences().GetFont("Appearance.Cursors.label_font");
m_decodeFont = m_parent->GetPreferences().GetFont("Appearance.Decodes.protocol_font");
}