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: c5c43db3e1a4
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: 74f94adb076e
Choose a head ref
  • 1 commit
  • 4 files changed
  • 1 contributor

Commits on Oct 30, 2020

  1. Copy the full SHA
    74f94ad View commit details
Showing with 65 additions and 22 deletions.
  1. +4 −1 src/glscopeclient/OscilloscopeWindow.h
  2. +34 −0 src/glscopeclient/PreferenceManager.cpp
  3. +4 −6 src/glscopeclient/Timeline.cpp
  4. +23 −15 src/glscopeclient/WaveformArea_cairo.cpp
5 changes: 4 additions & 1 deletion src/glscopeclient/OscilloscopeWindow.h
Original file line number Diff line number Diff line change
@@ -132,6 +132,9 @@ class OscilloscopeWindow : public Gtk::Window
bool IsLoadInProgress()
{ return m_loadInProgress; }

PreferenceManager& GetPreferences()
{ return m_preferences; }

protected:
void SetTitle();

@@ -208,7 +211,7 @@ class OscilloscopeWindow : public Gtk::Window

//shared by all scopes/channels
std::map<Oscilloscope*, HistoryWindow*> m_historyWindows;

//Preferences state
PreferenceManager m_preferences;

34 changes: 34 additions & 0 deletions src/glscopeclient/PreferenceManager.cpp
Original file line number Diff line number Diff line change
@@ -85,6 +85,40 @@ static void CreateDirectory(const string& path)

void PreferenceManager::InitializeDefaults()
{
auto& appearance = this->m_treeRoot.AddCategory("Appearance");
auto& cursors = appearance.AddCategory("Cursors");
cursors.AddPreference(Preference(
"cursor_1_color",
"Cursor #1 color",
"Color for the left or top cursor",
Gdk::Color("yellow")));
cursors.AddPreference(Preference(
"cursor_2_color",
"Cursor #2 color",
"Color for the right or bottom cursor",
Gdk::Color("orange")));
cursors.AddPreference(Preference(
"cursor_fill_color",
"Cursor fill color",
"Color for the filled area between cursors",
Gdk::Color("yellow")));
cursors.AddPreference(Preference(
"cursor_fill_text_color",
"Cursor fill text color",
"Color for in-band power and other text drawn between cursors",
Gdk::Color("yellow")));
auto& windows = appearance.AddCategory("Windows");
windows.AddPreference(Preference(
"insertion_bar_color",
"Insertion bar color (insert)",
"Color for the insertion bar when dragging a waveform within a group",
Gdk::Color("yellow")));
windows.AddPreference(Preference(
"insertion_bar_split_color",
"Insertion bar color (split)",
"Color for the insertion bar when splitting a waveform group",
Gdk::Color("orange")));

auto& instrument = this->m_treeRoot.AddCategory("Instrument");
auto& trans = instrument.AddCategory("Transports");
trans.AddPreference(Preference("test_string", "Test string", "First test value", "string"));
10 changes: 4 additions & 6 deletions src/glscopeclient/Timeline.cpp
Original file line number Diff line number Diff line change
@@ -323,9 +323,6 @@ void Timeline::Render(const Cairo::RefPtr<Cairo::Context>& cr, OscilloscopeChann


//Draw cursor positions if requested
Gdk::Color yellow("yellow");
Gdk::Color orange("orange");

if( (m_group->m_cursorConfig == WaveformGroup::CURSOR_X_DUAL) ||
(m_group->m_cursorConfig == WaveformGroup::CURSOR_X_SINGLE) )
{
@@ -335,7 +332,8 @@ void Timeline::Render(const Cairo::RefPtr<Cairo::Context>& cr, OscilloscopeChann
//Draw filled area between them
double x = (m_group->m_xCursorPos[0] - m_group->m_xAxisOffset) * m_group->m_pixelsPerXUnit;
double x2 = (m_group->m_xCursorPos[1] - m_group->m_xAxisOffset) * m_group->m_pixelsPerXUnit;
cr->set_source_rgba(yellow.get_red_p(), yellow.get_green_p(), yellow.get_blue_p(), 0.2);
Gdk::Color cursor_fill = m_parent->GetPreferences().GetColor("Appearance.Cursors.cursor_fill_color");
cr->set_source_rgba(cursor_fill.get_red_p(), cursor_fill.get_green_p(), cursor_fill.get_blue_p(), 0.2);
cr->move_to(x, 0);
cr->line_to(x2, 0);
cr->line_to(x2, h);
@@ -347,7 +345,7 @@ void Timeline::Render(const Cairo::RefPtr<Cairo::Context>& cr, OscilloscopeChann
cr,
m_group->m_xCursorPos[1],
"X2",
orange,
m_parent->GetPreferences().GetColor("Appearance.Cursors.cursor_2_color"),
false,
true);
}
@@ -357,7 +355,7 @@ void Timeline::Render(const Cairo::RefPtr<Cairo::Context>& cr, OscilloscopeChann
cr,
m_group->m_xCursorPos[0],
"X1",
yellow,
m_parent->GetPreferences().GetColor("Appearance.Cursors.cursor_1_color"),
true,
false);
}
38 changes: 23 additions & 15 deletions src/glscopeclient/WaveformArea_cairo.cpp
Original file line number Diff line number Diff line change
@@ -747,26 +747,26 @@ void WaveformArea::RenderCursors(Cairo::RefPtr< Cairo::Context > cr)
int ytop = 0;
int ybot = m_height;

Gdk::Color yellow("yellow");
Gdk::Color orange("orange");
Gdk::Color red("red");
Gdk::Color cursor1 = m_parent->GetPreferences().GetColor("Appearance.Cursors.cursor_1_color");
Gdk::Color cursor2 = m_parent->GetPreferences().GetColor("Appearance.Cursors.cursor_2_color");

if( (m_group->m_cursorConfig == WaveformGroup::CURSOR_X_DUAL) ||
(m_group->m_cursorConfig == WaveformGroup::CURSOR_X_SINGLE) )
{
//Draw first vertical cursor
double x = XAxisUnitsToXPosition(m_group->m_xCursorPos[0]);
RenderCursor(cr, m_group->m_xCursorPos[0], yellow, true);
RenderCursor(cr, m_group->m_xCursorPos[0], cursor1, true);

//Dual cursors
if(m_group->m_cursorConfig == WaveformGroup::CURSOR_X_DUAL)
{
//Draw second vertical cursor
double x2 = XAxisUnitsToXPosition(m_group->m_xCursorPos[1]);
RenderCursor(cr, m_group->m_xCursorPos[1], orange, false);
RenderCursor(cr, m_group->m_xCursorPos[1], cursor2, false);

//Draw filled area between them
cr->set_source_rgba(yellow.get_red_p(), yellow.get_green_p(), yellow.get_blue_p(), 0.2);
Gdk::Color cursor_fill = m_parent->GetPreferences().GetColor("Appearance.Cursors.cursor_fill_color");
cr->set_source_rgba(cursor_fill.get_red_p(), cursor_fill.get_green_p(), cursor_fill.get_blue_p(), 0.2);
cr->move_to(x, ytop);
cr->line_to(x2, ytop);
cr->line_to(x2, ybot);
@@ -835,8 +835,8 @@ void WaveformArea::RenderInBandPower(Cairo::RefPtr< Cairo::Context > cr)
cr->fill();

//Draw the text
Gdk::Color yellow("yellow");
cr->set_source_rgb(yellow.get_red_p(), yellow.get_green_p(), yellow.get_blue_p());
Gdk::Color cursor_fill_text = m_parent->GetPreferences().GetColor("Appearance.Cursors.cursor_fill_text_color");
cr->set_source_rgb(cursor_fill_text.get_red_p(), cursor_fill_text.get_green_p(), cursor_fill_text.get_blue_p());
cr->save();
cr->move_to(left + margin, top + margin);
tlayout->update_from_cairo_context(cr);
@@ -848,8 +848,8 @@ void WaveformArea::RenderInsertionBar(Cairo::RefPtr< Cairo::Context > cr)
{
int barsize = 5;

Gdk::Color yellow("yellow");
Gdk::Color orange("orange");
Gdk::Color bar_color = m_parent->GetPreferences().GetColor("Appearance.Windows.insertion_bar_color");
Gdk::Color bar_split_color = m_parent->GetPreferences().GetColor("Appearance.Windows.insertion_bar_split_color");

if(m_insertionBarLocation != INSERT_NONE)
{
@@ -859,22 +859,30 @@ void WaveformArea::RenderInsertionBar(Cairo::RefPtr< Cairo::Context > cr)
switch(m_insertionBarLocation)
{
case INSERT_BOTTOM:
cr->set_source_rgba(yellow.get_red_p(), yellow.get_green_p(), yellow.get_blue_p(), alpha);
cr->set_source_rgba(bar_color.get_red_p(), bar_color.get_green_p(), bar_color.get_blue_p(), alpha);
barpos = m_height - barsize;
break;

case INSERT_BOTTOM_SPLIT:
cr->set_source_rgba(orange.get_red_p(), orange.get_green_p(), orange.get_blue_p(), alpha);
cr->set_source_rgba(
bar_split_color.get_red_p(),
bar_split_color.get_green_p(),
bar_split_color.get_blue_p(),
alpha);
barpos = m_height - barsize;
break;

case INSERT_TOP:
cr->set_source_rgba(yellow.get_red_p(), yellow.get_green_p(), yellow.get_blue_p(), alpha);
cr->set_source_rgba(bar_color.get_red_p(), bar_color.get_green_p(), bar_color.get_blue_p(), alpha);
barpos = 0;
break;

case INSERT_RIGHT_SPLIT:
cr->set_source_rgba(orange.get_red_p(), orange.get_green_p(), orange.get_blue_p(), alpha);
cr->set_source_rgba(
bar_split_color.get_red_p(),
bar_split_color.get_green_p(),
bar_split_color.get_blue_p(),
alpha);
barhorz = false;
barpos = m_plotRight - barsize;
break;
@@ -903,7 +911,7 @@ void WaveformArea::RenderInsertionBar(Cairo::RefPtr< Cairo::Context > cr)

else if(m_dragState == DRAG_OVERLAY)
{
cr->set_source_rgba(yellow.get_red_p(), yellow.get_green_p(), yellow.get_blue_p(), 0.75);
cr->set_source_rgba(bar_color.get_red_p(), bar_color.get_green_p(), bar_color.get_blue_p(), 0.75);
cr->move_to(0, m_dragOverlayPosition);
cr->line_to(m_plotRight, m_dragOverlayPosition);
cr->line_to(m_plotRight, m_dragOverlayPosition + barsize);