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: b33d998e568f
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: 202ff55b2e20
Choose a head ref
  • 1 commit
  • 3 files changed
  • 1 contributor

Commits on Mar 5, 2020

  1. Refactored configuration serialization for WaveformGroup out into a s…

    …eparate function. Began work on measurement serialization. See #3.
    azonenberg committed Mar 5, 2020
    Copy the full SHA
    202ff55 View commit details
Showing with 68 additions and 46 deletions.
  1. +1 −46 glscopeclient/OscilloscopeWindow.cpp
  2. +65 −0 glscopeclient/WaveformGroup.cpp
  3. +2 −0 glscopeclient/WaveformGroup.h
47 changes: 1 addition & 46 deletions glscopeclient/OscilloscopeWindow.cpp
Original file line number Diff line number Diff line change
@@ -606,52 +606,7 @@ string OscilloscopeWindow::SerializeUIConfiguration(std::map<void*, int>& idmap,
for(auto group : m_waveformGroups)
idmap[group] = nextID++;
for(auto group : m_waveformGroups)
{
int id = idmap[group];
snprintf(tmp, sizeof(tmp), " : %%\n");
config += tmp;
snprintf(tmp, sizeof(tmp), " id: %d\n", id);
config += tmp;

config += " name: \"" + group->m_frame.get_label() + "\"\n";

snprintf(tmp, sizeof(tmp), " pixelsPerXUnit: %f\n", group->m_pixelsPerXUnit);
config += tmp;
snprintf(tmp, sizeof(tmp), " xAxisOffset: %ld\n", group->m_xAxisOffset);
config += tmp;

switch(group->m_cursorConfig)
{
case WaveformGroup::CURSOR_NONE:
config += " cursorConfig: none\n";
break;

case WaveformGroup::CURSOR_X_SINGLE:
config += " cursorConfig: x_single\n";
break;

case WaveformGroup::CURSOR_Y_SINGLE:
config += " cursorConfig: y_single\n";
break;

case WaveformGroup::CURSOR_X_DUAL:
config += " cursorConfig: x_dual\n";
break;

case WaveformGroup::CURSOR_Y_DUAL:
config += " cursorConfig: y_dual\n";
break;
}

snprintf(tmp, sizeof(tmp), " xcursor0: %ld\n", group->m_xCursorPos[0]);
config += tmp;
snprintf(tmp, sizeof(tmp), " xcursor1: %ld\n", group->m_xCursorPos[1]);
config += tmp;
snprintf(tmp, sizeof(tmp), " ycursor0: %f\n", group->m_yCursorPos[0]);
config += tmp;
snprintf(tmp, sizeof(tmp), " ycursor1: %f\n", group->m_yCursorPos[1]);
config += tmp;
}
config += group->SerializeConfiguration(idmap, nextID);

//Splitters
config += " splitters: @\n";
65 changes: 65 additions & 0 deletions glscopeclient/WaveformGroup.cpp
Original file line number Diff line number Diff line change
@@ -188,3 +188,68 @@ void WaveformGroup::OnRemoveMeasurementItem()
if(m_measurementColumns.empty())
m_measurementFrame.hide();
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

string WaveformGroup::SerializeConfiguration(std::map<void*, int>& idmap, int& nextID)
{
char tmp[1024];

int id = idmap[this];
snprintf(tmp, sizeof(tmp), " : %%\n");
string config = tmp;
snprintf(tmp, sizeof(tmp), " id: %d\n", id);
config += tmp;

config += " name: \"" + m_frame.get_label() + "\"\n";

snprintf(tmp, sizeof(tmp), " pixelsPerXUnit: %f\n", m_pixelsPerXUnit);
config += tmp;
snprintf(tmp, sizeof(tmp), " xAxisOffset: %ld\n", m_xAxisOffset);
config += tmp;

switch(m_cursorConfig)
{
case WaveformGroup::CURSOR_NONE:
config += " cursorConfig: none\n";
break;

case WaveformGroup::CURSOR_X_SINGLE:
config += " cursorConfig: x_single\n";
break;

case WaveformGroup::CURSOR_Y_SINGLE:
config += " cursorConfig: y_single\n";
break;

case WaveformGroup::CURSOR_X_DUAL:
config += " cursorConfig: x_dual\n";
break;

case WaveformGroup::CURSOR_Y_DUAL:
config += " cursorConfig: y_dual\n";
break;
}

snprintf(tmp, sizeof(tmp), " xcursor0: %ld\n", m_xCursorPos[0]);
config += tmp;
snprintf(tmp, sizeof(tmp), " xcursor1: %ld\n", m_xCursorPos[1]);
config += tmp;
snprintf(tmp, sizeof(tmp), " ycursor0: %f\n", m_yCursorPos[0]);
config += tmp;
snprintf(tmp, sizeof(tmp), " ycursor1: %f\n", m_yCursorPos[1]);
config += tmp;

//Measurements
if(!m_measurementColumns.empty())
{
config += " measurements: %%\n";

for(auto col : m_measurementColumns)
{

}
}

return config;
}
2 changes: 2 additions & 0 deletions glscopeclient/WaveformGroup.h
Original file line number Diff line number Diff line change
@@ -93,6 +93,8 @@ class WaveformGroup
OscilloscopeWindow* GetParent()
{ return m_parent; }

virtual std::string SerializeConfiguration(std::map<void*, int>& idmap, int& nextID);

protected:
MeasurementColumn* m_selectedColumn;
bool OnMeasurementContextMenu(GdkEventButton* event, MeasurementColumn* col);