MCPcopy Create free account
hub / github.com/analogdevicesinc/scopy / setupBufferPreviewer

Method setupBufferPreviewer

gui/src/widgets/plotbufferpreviewer.cpp:51–92  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49void PlotBufferPreviewer::setManualDataLimits(bool enabled) { m_manualDataLimits = enabled; }
50
51void PlotBufferPreviewer::setupBufferPreviewer()
52{
53 m_bufferPreviewer->setMinimumHeight(20);
54 m_bufferPreviewer->setCursorPos(0.5);
55 m_bufferPreviewer->setHighlightPos(0.05);
56 m_bufferPreviewer->setHighlightWidth(0.2);
57 m_bufferPreviewer->setCursorVisible(false);
58 m_bufferPreviewer->setWaveformPos(0.1);
59 m_bufferPreviewer->setWaveformWidth(0.5);
60
61 updateDataLimits(m_plot->xAxis()->min(), m_plot->xAxis()->max());
62
63 connect(m_bufferPreviewer, &BufferPreviewer::bufferStartDrag, this, [=]() {
64 // reset the buffer preview position to current visible section
65 m_lastMin = m_plot->xAxis()->visibleMin();
66 });
67
68 connect(m_bufferPreviewer, &BufferPreviewer::bufferMovedBy, this, [=](int bufferPos) {
69 double bufferWidth = m_bufferPreviewer->width();
70 double axisWidth = m_bufferDataLimitMax - m_bufferDataLimitMin;
71 double newAxisPos = bufferPos * axisWidth / bufferWidth;
72 double axisOffset = m_lastMin - m_plot->xAxis()->visibleMin();
73 if(axisWidth < 0)
74 axisOffset *= -1;
75
76 double panAmount = PlotMagnifier::scaleToFactor(newAxisPos + axisOffset, m_plot->xAxis()->axisId(),
77 m_plot->plot());
78
79 bool bounded = m_plot->navigator()->isBounded();
80 m_plot->navigator()->setBounded(false);
81 m_plot->navigator()->forcePan(m_plot->xAxis()->axisId(), panAmount);
82 m_plot->navigator()->setBounded(bounded);
83 updateBufferPreviewer();
84 });
85
86 connect(m_bufferPreviewer, &BufferPreviewer::bufferResetPosition, this, [=]() {
87 Q_EMIT m_plot->navigator()->reset();
88 updateBufferPreviewer();
89 });
90
91 connect(m_plot->navigator(), &PlotNavigator::rectChanged, this, [=]() { updateBufferPreviewer(); });
92}
93
94void PlotBufferPreviewer::updateDataLimits(double min, double max)
95{

Callers

nothing calls this directly

Calls 15

setCursorPosMethod · 0.80
setHighlightPosMethod · 0.80
setHighlightWidthMethod · 0.80
setCursorVisibleMethod · 0.80
setWaveformPosMethod · 0.80
setWaveformWidthMethod · 0.80
visibleMinMethod · 0.80
axisIdMethod · 0.80
navigatorMethod · 0.80
forcePanMethod · 0.80
connectFunction · 0.50
minMethod · 0.45

Tested by

no test coverage detected