Debian Codegraph @

src/plotview.cpp

raw symbols SCIP
1 /*
2 * Copyright (C) 2015-2016, Mike Walters <[email protected]>
3 *
4 * This file is part of inspectrum.
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #include "plotview.h"cxx . . $ `<file>/src/plotview.h`/
21 #include <iostream>
22 #include <fstream>
23 #include <QtGlobal>
24 #include <QApplication>
25 #include <QClipboard>
26 #include <QDebug>
27 #include <QFileDialog>
28 #include <QGridLayout>
29 #include <QGroupBox>
30 #include <QMenu>
31 #include <QPainter>
32 #include <QProgressDialog>
33 #include <QRadioButton>
34 #include <QScrollBar>
35 #include <QSpinBox>
36 #include <QToolTip>
37 #include <QVBoxLayout>
38 #include "plots.h"cxx . . $ `<file>/src/plots.h`/
39
40 PlotViewcxx . . $ PlotView#::PlotViewcxx . . $ PlotView#PlotView(30dc97247bd3c294).(InputSourcecxx . . $ InputSource# *input) : cursorscxx . . $ PlotView#cursors.(this), viewRangecxx . . $ PlotView#viewRange.({0, 0})
41 {
42 mainSampleSourcecxx . . $ PlotView#mainSampleSource. = input;
43 setDragModecxx . . $ QGraphicsView#setDragMode(c2eb74fc82eb84d1).(QGraphicsViewcxx . . $ QGraphicsView#::ScrollHandDragcxx . . $ QGraphicsView#ScrollHandDrag.);
44 setHorizontalScrollBarPolicycxx . . $ QAbstractScrollArea#setHorizontalScrollBarPolicy(ec1b3becc657ee30).(Qtcxx . . $ Qt/::ScrollBarAlwaysOncxx . . $ Qt/ScrollBarAlwaysOn.);
45 setMouseTrackingcxx . . $ QWidget#setMouseTracking(b45ddcbc8423892c).(true);
46 enableCursorscxx . . $ PlotView#enableCursors(b45ddcbc8423892c).(false);
47 connectcxx . . $ QObject#connect(835f87066c895669).(&cursorscxx . . $ PlotView#cursors., &Cursorscxx . . $ Cursors#::cursorsMovedcxx . . $ Cursors#cursorsMoved(49f6e7a06ebc5aa8)., this, &PlotViewcxx . . $ PlotView#::cursorsMovedcxx . . $ PlotView#cursorsMoved(49f6e7a06ebc5aa8).);
48
49 spectrogramPlotcxx . . $ PlotView#spectrogramPlot. = new SpectrogramPlotcxx . . $ SpectrogramPlot#(stdcxx . . $ std/shared_ptr#shared_ptr(c412da0edac25070).::shared_ptrcxx . . $ std/shared_ptr#<SampleSourcecxx . . $ SampleSource#<stdcxx . . $ std/::complexcxx . . $ std/complex#<float>>>(mainSampleSourcecxx . . $ PlotView#mainSampleSource.));
50 auto tunerOutput = stdcxx . . $ std/shared_ptr#shared_ptr(c412da0edac25070).::dynamic_pointer_castcxx . . $ std/dynamic_pointer_cast(f7ae99698a17f8b6).<SampleSourcecxx . . $ SampleSource#<stdcxx . . $ std/::complexcxx . . $ std/complex#<float>>>(spectrogramPlotcxx . . $ PlotView#spectrogramPlot.->outputcxx . . $ SpectrogramPlot#output(aad09d7b1d4b04e1).());
51
52 enableScalescxx . . $ PlotView#enableScales(b45ddcbc8423892c).(true);
53
54 enableAnnotationscxx . . $ PlotView#enableAnnotations(b45ddcbc8423892c).(true);
55 enableAnnotationCommentsTooltipscxx . . $ PlotView#enableAnnotationCommentsTooltips(b45ddcbc8423892c).(true);
56
57 addPlotcxx . . $ PlotView#addPlot(df8cfcebfd347647).(spectrogramPlotcxx . . $ PlotView#spectrogramPlot.);
58
59 mainSampleSourcecxx . . $ PlotView#mainSampleSource.->subscribecxx . . $ AbstractSampleSource#subscribe(9fd1f6ac7dfa1247).(this);
60 }
61
62 void PlotViewcxx . . $ PlotView#::addPlotcxx . . $ PlotView#addPlot(df8cfcebfd347647).(Plotcxx . . $ Plot# *plot)
63 {
64 plotscxx . . $ PlotView#plots..emplace_backcxx . . $ std/vector#emplace_back(b3d147e3bb711c35).(plot);
65 connectcxx . . $ QObject#connect(835f87066c895669).(plot, &Plotcxx . . $ Plot#::repaintcxx . . $ Plot#repaint(49f6e7a06ebc5aa8)., this, &PlotViewcxx . . $ PlotView#::repaintcxx . . $ PlotView#repaint(49f6e7a06ebc5aa8).);
66 }
67
68 void PlotViewcxx . . $ PlotView#::mouseMoveEventcxx . . $ PlotView#mouseMoveEvent(702858a82d06265c).(QMouseEventcxx . . $ QMouseEvent# *event)
69 {
70 updateAnnotationTooltipcxx . . $ PlotView#updateAnnotationTooltip(702858a82d06265c).(event);
71 QGraphicsViewcxx . . $ QGraphicsView#::mouseMoveEventcxx . . $ QGraphicsView#mouseMoveEvent(702858a82d06265c).(event);
72 }
73
74 void PlotViewcxx . . $ PlotView#::mouseReleaseEventcxx . . $ PlotView#mouseReleaseEvent(702858a82d06265c).(QMouseEventcxx . . $ QMouseEvent# *event)
75 {
76 // This is used to show the tooltip again on drag release if the mouse is
77 // hovering over an annotation.
78 updateAnnotationTooltipcxx . . $ PlotView#updateAnnotationTooltip(702858a82d06265c).(event);
79 QGraphicsViewcxx . . $ QGraphicsView#::mouseReleaseEventcxx . . $ QGraphicsView#mouseReleaseEvent(702858a82d06265c).(event);
80 }
81
82 void PlotViewcxx . . $ PlotView#::updateAnnotationTooltipcxx . . $ PlotView#updateAnnotationTooltip(702858a82d06265c).(QMouseEventcxx . . $ QMouseEvent# *event)
83 {
84 // If there are any mouse buttons pressed, we assume
85 // that the plot is being dragged and hide the tooltip.
86 bool isDrag = event->buttonscxx . . $ QMouseEvent#buttons(4523555da7f36dd2).() != Qtcxx . . $ Qt/::NoButtoncxx . . $ Qt/NoButton.;
87 if (!annotationCommentsEnabledcxx . . $ PlotView#annotationCommentsEnabled.
88 || !spectrogramPlotcxx . . $ PlotView#spectrogramPlot.->isAnnotationsEnabledcxx . . $ SpectrogramPlot#isAnnotationsEnabled(c9857a73d68e59ba).()
89 || isDrag) {
90 QToolTipcxx . . $ QToolTip#::hideTextcxx . . $ QToolTip#hideText(49f6e7a06ebc5aa8).();
91 } else {
92 QStringcxx . . $ QString#* comment = spectrogramPlotcxx . . $ PlotView#spectrogramPlot.->mouseAnnotationCommentcxx . . $ SpectrogramPlot#mouseAnnotationComment(4b6ae5eff941c8bb).(event);
93 if (comment != nullptr) {
94 #if QT_VERSIONcxx . . $ `<external>/15045578679651060896/qglobal.h:57:9`! >= QT_VERSION_CHECKcxx . . $ `<external>/15045578679651060896/qglobal.h:61:9`!(6, 0, 0)
95 QToolTip::showText(event->globalPosition().toPoint(), *comment);
96 #else
97 QToolTipcxx . . $ QToolTip#::showTextcxx . . $ QToolTip#showText(e9f52f9969479d3b).(event->globalPoscxx . . $ QMouseEvent#globalPos(75d69cfbd3c4b2dd).(), *comment);
98 #endif
99 } else {
100 QToolTipcxx . . $ QToolTip#::hideTextcxx . . $ QToolTip#hideText(49f6e7a06ebc5aa8).();
101 }
102 }
103 }
104
105 void PlotViewcxx . . $ PlotView#::contextMenuEventcxx . . $ PlotView#contextMenuEvent(ebb2569a74e11126).(QContextMenuEventcxx . . $ QContextMenuEvent# * event)
106 {
107 QMenucxx . . $ QMenu# menucxx . . $ QMenu#QMenu(108f35f7aa7f3cf9).;
108
109 // Get selected plot
110 Plotcxx . . $ Plot# *selectedPlot = nullptr;
111 auto it = plotscxx . . $ PlotView#plots..begincxx . . $ std/vector#begin(33b10a496a38335b).();
112 int y = -verticalScrollBarcxx . . $ QAbstractScrollArea#verticalScrollBar(49d9510c6adf8c19).()->valuecxx . . $ QAbstractSlider#value(455f465bc33b4cdf).();
113 for (; it !=cxx . . $ __gnu_cxx/`operator!=`(ef3c5749062e825c). plotscxx . . $ PlotView#plots..endcxx . . $ std/vector#end(33b10a496a38335b).(); it++cxx . . $ __gnu_cxx/__normal_iterator#operator++(c443b773b1266d5a).) {
114 auto&& plot = *cxx . . $ __gnu_cxx/__normal_iterator#`operator*`(c076846f881f3e7e).it;
115 if (range_tcxx . . $ range_t#<int>{y, y + plot->cxx . . $ std/unique_ptr#`operator->`(ca399b2b6292c808).heightcxx . . $ Plot#height(455f465bc33b4cdf).()}.containscxx . . $ range_t#contains(8877ebe272b9620d).(event->poscxx . . $ QContextMenuEvent#pos(6de9f7a200ca710c).().ycxx . . $ QPoint#y(455f465bc33b4cdf).())) {
116 selectedPlot = plot.getcxx . . $ std/unique_ptr#get(ca399b2b6292c808).();
117 break;
118 }
119 y += plot->cxx . . $ std/unique_ptr#`operator->`(ca399b2b6292c808).heightcxx . . $ Plot#height(455f465bc33b4cdf).();
120 }
121 if (selectedPlot == nullptr)
122 return;
123
124 // Add actions to add derived plots
125 // that are compatible with selectedPlot's output
126 QMenucxx . . $ QMenu# *plotsMenu = menu.addMenucxx . . $ QMenu#addMenu(7bd5d996bbe37ddf).("Add derived plot"cxx . . $ QString#QString(85c52e162fed56f9).);
127 auto src = selectedPlotcxx . . $ std/shared_ptr#shared_ptr(c412da0edac25070).->outputcxx . . $ Plot#output(aad09d7b1d4b04e1).();
128 auto compatiblePlots = as_rangecxx . . $ as_range(8d1e2b332792edde).(Plotscxx . . $ Plots#::plotscxx . . $ Plots#plots..equal_rangecxx . . $ std/multimap#equal_range(4d0402d3bb6c21b7).(src->cxx . . $ std/__shared_ptr_access#`operator->`(5a2a78a048fb49a8).sampleTypecxx . . $ AbstractSampleSource#sampleType(11101e0a2e3ca7a8).()));
129 for (auto p : compatiblePlots) {
130 auto plotInfo = p.secondcxx . . $ std/pair#second.;
131 auto action = new QActioncxx . . $ QAction#QAction(6b24f83d17022bd9).(QStringcxx . . $ QString#QString(85c52e162fed56f9).("Add %1").argcxx . . $ QString#arg(bc823072288cbbb5).(plotInfocxx . . $ QString#QString(85c52e162fed56f9)..namecxx . . $ PlotInfo#name.), plotsMenu);
132 auto plotCreator = plotInfocxx . . $ std/function#function(ec20bd20f4acba43)..creatorcxx . . $ PlotInfo#creator.;
133 connectcxx . . $ QObject#connect(d9dbe0c0ad4eecec).(
134 action, &QActioncxx . . $ QAction#::triggeredcxx . . $ QAction#triggered(b45ddcbc8423892c).,
135 this, [=]() {
136 addPlotcxx . . $ PlotView#addPlot(df8cfcebfd347647).(plotCreator(cxx . . $ std/function#`operator()`(39e0826ffb540481).srccxx . . $ std/shared_ptr#shared_ptr(c44ffe56f5110b84).));
137 }
138 );
139 plotsMenu->addActioncxx . . $ QWidget#addAction(92b1e80c0a7f1406).(action);
140 }
141
142 // Add submenu for extracting symbols
143 QMenucxx . . $ QMenu# *extractMenu = menu.addMenucxx . . $ QMenu#addMenu(7bd5d996bbe37ddf).("Extract symbols"cxx . . $ QString#QString(85c52e162fed56f9).);
144 // Add action to extract symbols from selected plot to stdout
145 auto extract = new QActioncxx . . $ QAction#QAction(6b24f83d17022bd9).("To stdout"cxx . . $ QString#QString(85c52e162fed56f9)., extractMenu);
146 connectcxx . . $ QObject#connect(d9dbe0c0ad4eecec).(
147 extract, &QActioncxx . . $ QAction#::triggeredcxx . . $ QAction#triggered(b45ddcbc8423892c).,
148 this, [=]() {
149 extractSymbolscxx . . $ PlotView#extractSymbols(85844caa9ea15706).(srccxx . . $ std/shared_ptr#shared_ptr(c44ffe56f5110b84)., false);
150 }
151 );
152 extract->setEnabledcxx . . $ QAction#setEnabled(b45ddcbc8423892c).(cursorsEnabledcxx . . $ PlotView#cursorsEnabled. && (src->cxx . . $ std/__shared_ptr_access#`operator->`(5a2a78a048fb49a8).sampleTypecxx . . $ AbstractSampleSource#sampleType(11101e0a2e3ca7a8).() ==cxx . . $ std/type_index#`operator==`(a9b0933a7e2128a6). typeidcxx . . $ std/type_index#type_index(6397e2c0083b9fa0).(float)));
153 extractMenu->addActioncxx . . $ QWidget#addAction(92b1e80c0a7f1406).(extract);
154
155 // Add action to extract symbols from selected plot to clipboard
156 auto extractClipboard = new QActioncxx . . $ QAction#QAction(6b24f83d17022bd9).("Copy to clipboard"cxx . . $ QString#QString(85c52e162fed56f9)., extractMenu);
157 connectcxx . . $ QObject#connect(d9dbe0c0ad4eecec).(
158 extractClipboard, &QActioncxx . . $ QAction#::triggeredcxx . . $ QAction#triggered(b45ddcbc8423892c).,
159 this, [=]() {
160 extractSymbolscxx . . $ PlotView#extractSymbols(85844caa9ea15706).(srccxx . . $ std/shared_ptr#shared_ptr(c44ffe56f5110b84)., true);
161 }
162 );
163 extractClipboard->setEnabledcxx . . $ QAction#setEnabled(b45ddcbc8423892c).(cursorsEnabledcxx . . $ PlotView#cursorsEnabled. && (src->cxx . . $ std/__shared_ptr_access#`operator->`(5a2a78a048fb49a8).sampleTypecxx . . $ AbstractSampleSource#sampleType(11101e0a2e3ca7a8).() ==cxx . . $ std/type_index#`operator==`(a9b0933a7e2128a6). typeidcxx . . $ std/type_index#type_index(6397e2c0083b9fa0).(float)));
164 extractMenu->addActioncxx . . $ QWidget#addAction(92b1e80c0a7f1406).(extractClipboard);
165
166 // Add action to export the selected samples into a file
167 auto save = new QActioncxx . . $ QAction#QAction(6b24f83d17022bd9).("Export samples to file..."cxx . . $ QString#QString(85c52e162fed56f9)., &menu);
168 connectcxx . . $ QObject#connect(d9dbe0c0ad4eecec).(
169 save, &QActioncxx . . $ QAction#::triggeredcxx . . $ QAction#triggered(b45ddcbc8423892c).,
170 this, [=]() {
171 if (selectedPlot == spectrogramPlotcxx . . $ PlotView#spectrogramPlot.) {
172 exportSamplescxx . . $ PlotView#exportSamples(22d84a47a7b53cf1).(spectrogramPlotcxx . . $ std/shared_ptr#shared_ptr(c412da0edac25070).->tunerEnabledcxx . . $ SpectrogramPlot#tunerEnabled(c9857a73d68e59ba).() ? spectrogramPlotcxx . . $ std/shared_ptr#shared_ptr(c412da0edac25070).->outputcxx . . $ SpectrogramPlot#output(aad09d7b1d4b04e1).() : spectrogramPlotcxx . . $ std/shared_ptr#shared_ptr(c412da0edac25070).->inputcxx . . $ SpectrogramPlot#input(24423e5ec47f55b2).());
173 } else {
174 exportSamplescxx . . $ PlotView#exportSamples(22d84a47a7b53cf1).(srccxx . . $ std/shared_ptr#shared_ptr(c44ffe56f5110b84).);
175 }
176 }
177 );
178 menu.addActioncxx . . $ QWidget#addAction(92b1e80c0a7f1406).(save);
179
180 // Add action to remove the selected plot
181 auto rem = new QActioncxx . . $ QAction#QAction(6b24f83d17022bd9).("Remove plot"cxx . . $ QString#QString(85c52e162fed56f9)., &menu);
182 connectcxx . . $ QObject#connect(d9dbe0c0ad4eecec).(
183 rem, &QActioncxx . . $ QAction#::triggeredcxx . . $ QAction#triggered(b45ddcbc8423892c).,
184 this, [=]() {
185 plotscxx . . $ PlotView#plots..erasecxx . . $ std/vector#erase(351407f384f345bc).(itcxx . . $ __gnu_cxx/__normal_iterator#__normal_iterator(ea0f1a22ba5f21a0).);
186 }
187 );
188 // Don't allow remove the first plot (the spectrogram)
189 rem->setEnabledcxx . . $ QAction#setEnabled(b45ddcbc8423892c).(it !=cxx . . $ __gnu_cxx/`operator!=`(ef3c5749062e825c). plotscxx . . $ PlotView#plots..begincxx . . $ std/vector#begin(33b10a496a38335b).());
190 menu.addActioncxx . . $ QWidget#addAction(92b1e80c0a7f1406).(rem);
191
192 updateViewRangecxx . . $ PlotView#updateViewRange(b45ddcbc8423892c).(false);
193 if(menu.execcxx . . $ QMenu#exec(2535b15b88c544d4).(event->globalPoscxx . . $ QContextMenuEvent#globalPos(6de9f7a200ca710c).()))
194 updateViewcxx . . $ PlotView#updateView(b0b38cda41d4ede4).(false);
195 }
196
197 void PlotViewcxx . . $ PlotView#::cursorsMovedcxx . . $ PlotView#cursorsMoved(49f6e7a06ebc5aa8).()
198 {
199 selectedSamplescxx . . $ PlotView#selectedSamples. =cxx . . $ range_t#`operator=`(b7f9b018042febfd). {
200 columnToSamplecxx . . $ PlotView#columnToSample(c104ebd7d68b2193).(horizontalScrollBarcxx . . $ QAbstractScrollArea#horizontalScrollBar(49d9510c6adf8c19).()->valuecxx . . $ QAbstractSlider#value(455f465bc33b4cdf).() + cursorscxx . . $ PlotView#cursors..selectioncxx . . $ Cursors#selection(8edf043d21a94c0c).().minimumcxx . . $ range_t#minimum.),
201 columnToSamplecxx . . $ PlotView#columnToSample(c104ebd7d68b2193).(horizontalScrollBarcxx . . $ QAbstractScrollArea#horizontalScrollBar(49d9510c6adf8c19).()->valuecxx . . $ QAbstractSlider#value(455f465bc33b4cdf).() + cursorscxx . . $ PlotView#cursors..selectioncxx . . $ Cursors#selection(8edf043d21a94c0c).().maximumcxx . . $ range_t#maximum.)
202 };
203
204 emitTimeSelectioncxx . . $ PlotView#emitTimeSelection(49f6e7a06ebc5aa8).();
205 viewportcxx . . $ QAbstractScrollArea#viewport(27f420ad5cce8994).()->updatecxx . . $ QWidget#update(49f6e7a06ebc5aa8).();
206 }
207
208 void PlotViewcxx . . $ PlotView#::emitTimeSelectioncxx . . $ PlotView#emitTimeSelection(49f6e7a06ebc5aa8).()
209 {
210 size_t sampleCount = selectedSamplescxx . . $ PlotView#selectedSamples..lengthcxx . . $ range_t#length(f448638088200dcb).();
211 float selectionTime = sampleCount / (float)mainSampleSourcecxx . . $ PlotView#mainSampleSource.->ratecxx . . $ SampleSource#rate(31fa7155c10fdd13).();
212 emitcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:97:10`! timeSelectionChangedcxx . . $ PlotView#timeSelectionChanged(9364e6e7bff7660).(selectionTime);
213 }
214
215 void PlotViewcxx . . $ PlotView#::enableCursorscxx . . $ PlotView#enableCursors(b45ddcbc8423892c).(bool enabled)
216 {
217 cursorsEnabledcxx . . $ PlotView#cursorsEnabled. = enabled;
218 if (enabled) {
219 int margin = viewportcxx . . $ QAbstractScrollArea#viewport(27f420ad5cce8994).()->rectcxx . . $ QWidget#rect(d857385bac04cbf7).().widthcxx . . $ QRect#width(455f465bc33b4cdf).() / 3;
220 cursorscxx . . $ PlotView#cursors..setSelectioncxx . . $ Cursors#setSelection(3ae39a1630889ffb).({viewportcxx . . $ QAbstractScrollArea#viewport(27f420ad5cce8994).()->rectcxx . . $ QWidget#rect(d857385bac04cbf7).().leftcxx . . $ QRect#left(455f465bc33b4cdf).() + margin, viewportcxx . . $ QAbstractScrollArea#viewport(27f420ad5cce8994).()->rectcxx . . $ QWidget#rect(d857385bac04cbf7).().rightcxx . . $ QRect#right(455f465bc33b4cdf).() - margin});
221 cursorsMovedcxx . . $ PlotView#cursorsMoved(49f6e7a06ebc5aa8).();
222 }
223 viewportcxx . . $ QAbstractScrollArea#viewport(27f420ad5cce8994).()->updatecxx . . $ QWidget#update(49f6e7a06ebc5aa8).();
224 }
225
226 bool PlotViewcxx . . $ PlotView#::viewportEventcxx . . $ PlotView#viewportEvent(f123fa2ce489f0bd).(QEventcxx . . $ QEvent# *event) {
227 // Handle wheel events for zooming (before the parent's handler to stop normal scrolling)
228 if (event->typecxx . . $ QEvent#type(916a8de57f4d422b).() == QEventcxx . . $ QEvent#::Wheelcxx . . $ QEvent#Wheel.) {
229 QWheelEventcxx . . $ QWheelEvent# *wheelEvent = (QWheelEventcxx . . $ QWheelEvent#*)event;
230 if (QApplicationcxx . . $ QApplication#::keyboardModifierscxx . . $ QGuiApplication#keyboardModifiers(bd131f8973b1b71c).() &cxx . . $ QFlags#`operator&`(1933792fc5621fd5). Qtcxx . . $ Qt/::ControlModifiercxx . . $ Qt/ControlModifier.) {
231 bool canZoomIn = zoomLevelcxx . . $ PlotView#zoomLevel. < fftSizecxx . . $ PlotView#fftSize.;
232 bool canZoomOut = zoomLevelcxx . . $ PlotView#zoomLevel. > 1;
233 int delta = wheelEvent->angleDeltacxx . . $ QWheelEvent#angleDelta(75d69cfbd3c4b2dd).().ycxx . . $ QPoint#y(455f465bc33b4cdf).();
234 if ((delta > 0 && canZoomIn) || (delta < 0 && canZoomOut)) {
235 scrollZoomStepsAccumulatedcxx . . $ PlotView#scrollZoomStepsAccumulated. += delta;
236
237 // `updateViewRange()` keeps the center sample in the same place after zoom. Apply
238 // a scroll adjustment to keep the sample under the mouse cursor in the same place instead.
239 #if QT_VERSIONcxx . . $ `<external>/15045578679651060896/qglobal.h:57:9`! >= QT_VERSION_CHECKcxx . . $ `<external>/15045578679651060896/qglobal.h:61:9`!(5, 14, 0)
240 zoomPoscxx . . $ PlotView#zoomPos. = wheelEvent->positioncxx . . $ QWheelEvent#position(a5b3784bf6777acb).().xcxx . . $ QPointF#x(21b6c25e127938e2).();
241 #else
242 zoomPos = wheelEvent->pos().x();
243 #endif
244 zoomSamplecxx . . $ PlotView#zoomSample. = columnToSamplecxx . . $ PlotView#columnToSample(c104ebd7d68b2193).(horizontalScrollBarcxx . . $ QAbstractScrollArea#horizontalScrollBar(49d9510c6adf8c19).()->valuecxx . . $ QAbstractSlider#value(455f465bc33b4cdf).() + zoomPoscxx . . $ PlotView#zoomPos.);
245 if (scrollZoomStepsAccumulatedcxx . . $ PlotView#scrollZoomStepsAccumulated. >= 120) {
246 scrollZoomStepsAccumulatedcxx . . $ PlotView#scrollZoomStepsAccumulated. -= 120;
247 emitcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:97:10`! zoomIncxx . . $ PlotView#zoomIn(49f6e7a06ebc5aa8).();
248 } else if (scrollZoomStepsAccumulatedcxx . . $ PlotView#scrollZoomStepsAccumulated. <= -120) {
249 scrollZoomStepsAccumulatedcxx . . $ PlotView#scrollZoomStepsAccumulated. += 120;
250 emitcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:97:10`! zoomOutcxx . . $ PlotView#zoomOut(49f6e7a06ebc5aa8).();
251 }
252 }
253 return true;
254 }
255 }
256
257 // Pass mouse events to individual plot objects
258 if (event->typecxx . . $ QEvent#type(916a8de57f4d422b).() == QEventcxx . . $ QEvent#::MouseButtonPresscxx . . $ QEvent#MouseButtonPress. ||
259 event->typecxx . . $ QEvent#type(916a8de57f4d422b).() == QEventcxx . . $ QEvent#::MouseMovecxx . . $ QEvent#MouseMove. ||
260 event->typecxx . . $ QEvent#type(916a8de57f4d422b).() == QEventcxx . . $ QEvent#::MouseButtonReleasecxx . . $ QEvent#MouseButtonRelease.) {
261
262 QMouseEventcxx . . $ QMouseEvent# *mouseEvent = static_cast<QMouseEventcxx . . $ QMouseEvent# *>(event);
263
264 int plotY = -verticalScrollBarcxx . . $ QAbstractScrollArea#verticalScrollBar(49d9510c6adf8c19).()->valuecxx . . $ QAbstractSlider#value(455f465bc33b4cdf).();
265 for (auto&& plot : plotscxx . . $ PlotView#plots.) {
266 auto mouse_event = QMouseEventcxx . . $ QMouseEvent#QMouseEvent(990cda8c87b92972).(
267 event->typecxx . . $ QEvent#type(916a8de57f4d422b).(),
268 #if QT_VERSIONcxx . . $ `<external>/15045578679651060896/qglobal.h:57:9`! >= QT_VERSION_CHECKcxx . . $ `<external>/15045578679651060896/qglobal.h:61:9`!(6, 0, 0)
269 QPoint(mouseEvent->position().x(), mouseEvent->position().y() - plotY),
270 #else
271 QPointcxx . . $ QPointF#QPointF(4f9e9534be445c03).(mouseEvent->poscxx . . $ QMouseEvent#pos(75d69cfbd3c4b2dd).().xcxx . . $ QPoint#x(455f465bc33b4cdf).(), mouseEvent->poscxx . . $ QMouseEvent#pos(75d69cfbd3c4b2dd).().ycxx . . $ QPoint#y(455f465bc33b4cdf).() - plotY),
272 #endif
273 mouseEvent->buttoncxx . . $ QMouseEvent#button(4a2598559eeedfc9).(),
274 mouseEvent->buttonscxx . . $ QMouseEvent#buttons(4523555da7f36dd2).(),
275 QApplicationcxx . . $ QApplication#::keyboardModifierscxx . . $ QGuiApplication#keyboardModifiers(bd131f8973b1b71c).()
276 );
277 bool result = plot->cxx . . $ std/unique_ptr#`operator->`(ca399b2b6292c808).mouseEventcxx . . $ Plot#mouseEvent(bf65bbe40893342c).(
278 event->typecxx . . $ QEvent#type(916a8de57f4d422b).(),
279 &mouse_event
280 );
281 if (result)
282 return true;
283 plotY += plot->cxx . . $ std/unique_ptr#`operator->`(ca399b2b6292c808).heightcxx . . $ Plot#height(455f465bc33b4cdf).();
284 }
285
286 if (cursorsEnabledcxx . . $ PlotView#cursorsEnabled.)
287 if (cursorscxx . . $ PlotView#cursors..mouseEventcxx . . $ Cursors#mouseEvent(bf65bbe40893342c).(event->typecxx . . $ QEvent#type(916a8de57f4d422b).(), mouseEvent))
288 return true;
289 }
290
291 if (event->typecxx . . $ QEvent#type(916a8de57f4d422b).() == QEventcxx . . $ QEvent#::Leavecxx . . $ QEvent#Leave.) {
292 for (auto&& plot : plotscxx . . $ PlotView#plots.) {
293 plot->cxx . . $ std/unique_ptr#`operator->`(ca399b2b6292c808).leaveEventcxx . . $ Plot#leaveEvent(49f6e7a06ebc5aa8).();
294 }
295
296 if (cursorsEnabledcxx . . $ PlotView#cursorsEnabled.)
297 cursorscxx . . $ PlotView#cursors..leaveEventcxx . . $ Cursors#leaveEvent(49f6e7a06ebc5aa8).();
298 }
299
300 // Handle parent eveents
301 return QGraphicsViewcxx . . $ QGraphicsView#::viewportEventcxx . . $ QGraphicsView#viewportEvent(f123fa2ce489f0bd).(event);
302 }
303
304 void PlotViewcxx . . $ PlotView#::extractSymbolscxx . . $ PlotView#extractSymbols(85844caa9ea15706).(stdcxx . . $ std/::shared_ptrcxx . . $ std/shared_ptr#<AbstractSampleSourcecxx . . $ AbstractSampleSource#> src,
305 bool toClipboard)
306 {
307 if (!cursorsEnabledcxx . . $ PlotView#cursorsEnabled.)
308 return;
309 auto floatSrc = stdcxx . . $ std/shared_ptr#shared_ptr(c412da0edac25070).::dynamic_pointer_castcxx . . $ std/dynamic_pointer_cast(f7ae99698a17f8b6).<SampleSourcecxx . . $ SampleSource#<float>>(src);
310 if (!floatSrc)
311 return;
312 auto samples = floatSrccxx . . $ std/unique_ptr#unique_ptr(c72f3246697f2f97).->cxx . . $ std/__shared_ptr_access#`operator->`(5a2a78a048fb49a8).getSamplescxx . . $ SampleSource#getSamples(beb84398f18d5b52).(selectedSamplescxx . . $ PlotView#selectedSamples..minimumcxx . . $ range_t#minimum., selectedSamplescxx . . $ PlotView#selectedSamples..lengthcxx . . $ range_t#length(f448638088200dcb).());
313 auto step = (float)selectedSamplescxx . . $ PlotView#selectedSamples..lengthcxx . . $ range_t#length(f448638088200dcb).() / cursorscxx . . $ PlotView#cursors..segmentscxx . . $ Cursors#segments(b126dc7c1de90089).();
314 auto symbols = stdcxx . . $ std/vector#vector(b1ea180184b47f03).::vectorcxx . . $ std/vector#<float>();
315 for (auto i = step / 2; i < selectedSamplescxx . . $ PlotView#selectedSamples..lengthcxx . . $ range_t#length(f448638088200dcb).(); i += step)
316 {
317 symbols.push_backcxx . . $ std/vector#push_back(77d9f17553126ecb).(samples[cxx . . $ std/unique_ptr#`operator[]`(d29315ade3bf818e).i]);
318 }
319 if (!toClipboard) {
320 for (auto f : symbols)
321 stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/basic_ostream#`operator<<`(2b73cd0f0517cf77). f <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). ", ";
322 stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::endlcxx . . $ std/endl(345bf97a19cc83a9). <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). stdcxx . . $ std/::flushcxx . . $ std/flush(345bf97a19cc83a9).;
323 } else {
324 QClipboardcxx . . $ QClipboard# *clipboard = QGuiApplicationcxx . . $ QGuiApplication#::clipboardcxx . . $ QGuiApplication#clipboard(a5a00f8d44f5ac9e).();
325 QStringcxx . . $ QString# symbolTextcxx . . $ QString#QString(49f6e7a06ebc5aa8).;
326 QTextStreamcxx . . $ QTextStream# symbolStreamcxx . . $ QTextStream#QTextStream(16e3d097052a73db).(&symbolText);
327 for (auto f : symbols)
328 symbolStream <<cxx . . $ QTextStream#`operator<<`(13c5a264650b7b60). f <<cxx . . $ QTextStream#`operator<<`(a8e98279dde0dccf). ", ";
329 clipboard->setTextcxx . . $ QClipboard#setText(9f492b8a441aa8de).(symbolText);
330 }
331 }
332
333 void PlotViewcxx . . $ PlotView#::exportSamplescxx . . $ PlotView#exportSamples(22d84a47a7b53cf1).(stdcxx . . $ std/::shared_ptrcxx . . $ std/shared_ptr#<AbstractSampleSourcecxx . . $ AbstractSampleSource#> src)
334 {
335 if (src->cxx . . $ std/__shared_ptr_access#`operator->`(5a2a78a048fb49a8).sampleTypecxx . . $ AbstractSampleSource#sampleType(11101e0a2e3ca7a8).() ==cxx . . $ std/type_index#`operator==`(a9b0933a7e2128a6). typeidcxx . . $ std/type_index#type_index(6397e2c0083b9fa0).(stdcxx . . $ std/::complexcxx . . $ std/complex#<float>)) {
336 exportSamplescxx . . $ PlotView#exportSamples(22d84a47a7b53cf1).<stdcxx . . $ std/::complexcxx . . $ std/complex#<float>>(srccxx . . $ std/shared_ptr#shared_ptr(c44ffe56f5110b84).);
337 } else {
338 exportSamplescxx . . $ PlotView#exportSamples(22d84a47a7b53cf1).<float>(srccxx . . $ std/shared_ptr#shared_ptr(c44ffe56f5110b84).);
339 }
340 }
341
342 template<typename SOURCETYPE>
343 void PlotViewcxx . . $ PlotView#::exportSamplescxx . . $ PlotView#exportSamples(22d84a47a7b53cf1).(stdcxx . . $ std/::shared_ptrcxx . . $ std/shared_ptr#<AbstractSampleSourcecxx . . $ AbstractSampleSource#> src)
344 {
345 auto sampleSrc = stdcxx . . $ std/::dynamic_pointer_castcxx . . $ std/dynamic_pointer_cast(f0cc72547076afb9).<SampleSourcecxx . . $ SampleSource#<SOURCETYPE>>(src);
346 if (!sampleSrc) {
347 return;
348 }
349
350 QFileDialogcxx . . $ QFileDialog# dialogcxx . . $ QFileDialog#QFileDialog(455e03d1cb1d84d1).(this);
351 dialog.setAcceptModecxx . . $ QFileDialog#setAcceptMode(6f58cf79553d7077).(QFileDialogcxx . . $ QFileDialog#::AcceptSavecxx . . $ QFileDialog#AcceptSave.);
352 dialog.setFileModecxx . . $ QFileDialog#setFileMode(508d43a8df9137e8).(QFileDialogcxx . . $ QFileDialog#::AnyFilecxx . . $ QFileDialog#AnyFile.);
353 dialog.setNameFiltercxx . . $ QFileDialog#setNameFilter(3520e46b33348bf6).(getFileNameFiltercxx . . $ getFileNameFilter(33a1f659e94feb42).<SOURCETYPE>());
354 dialog.setOptioncxx . . $ QFileDialog#setOption(9efc47f2206199ad).(QFileDialogcxx . . $ QFileDialog#::DontUseNativeDialogcxx . . $ QFileDialog#DontUseNativeDialog., true);
355
356 QGroupBoxcxx . . $ QGroupBox# groupBoxcxx . . $ QGroupBox#QGroupBox(90d5708627041e22).("Selection To Export"cxx . . $ QString#QString(85c52e162fed56f9)., &dialog);
357 QVBoxLayoutcxx . . $ QVBoxLayout# vboxcxx . . $ QVBoxLayout#QVBoxLayout(108f35f7aa7f3cf9).(&groupBox);
358
359 QRadioButtoncxx . . $ QRadioButton# cursorSelectioncxx . . $ QRadioButton#QRadioButton(90d5708627041e22).("Cursor Selection"cxx . . $ QString#QString(85c52e162fed56f9)., &groupBox);
360 QRadioButtoncxx . . $ QRadioButton# currentViewcxx . . $ QRadioButton#QRadioButton(90d5708627041e22).("Current View"cxx . . $ QString#QString(85c52e162fed56f9)., &groupBox);
361 QRadioButtoncxx . . $ QRadioButton# completeFilecxx . . $ QRadioButton#QRadioButton(90d5708627041e22).("Complete File (Experimental)"cxx . . $ QString#QString(85c52e162fed56f9)., &groupBox);
362
363 if (cursorsEnabledcxx . . $ PlotView#cursorsEnabled.) {
364 cursorSelection.setCheckedcxx . . $ QAbstractButton#setChecked(b45ddcbc8423892c).(true);
365 } else {
366 currentView.setCheckedcxx . . $ QAbstractButton#setChecked(b45ddcbc8423892c).(true);
367 cursorSelection.setEnabledcxx . . $ QWidget#setEnabled(b45ddcbc8423892c).(false);
368 }
369
370 vbox.addWidgetcxx . . $ QBoxLayout#addWidget(d39963fa34d6acb).(&cursorSelection);
371 vbox.addWidgetcxx . . $ QBoxLayout#addWidget(d39963fa34d6acb).(&currentView);
372 vbox.addWidgetcxx . . $ QBoxLayout#addWidget(d39963fa34d6acb).(&completeFile);
373 vbox.addStretchcxx . . $ QBoxLayout#addStretch(d4f767463ce0a6b3).(1);
374
375 groupBox.setLayoutcxx . . $ QWidget#setLayout(23396b1058755fec).(&vbox);
376
377 QGridLayoutcxx . . $ QGridLayout# *l = dialog.findChildcxx . . $ QObject#findChild(d560e1421e3a90b4).<QGridLayoutcxx . . $ QGridLayout#*>();
378 l->addWidgetcxx . . $ QGridLayout#addWidget(17d1465fab362e2d).(&groupBox, 4, 1);
379
380 QGroupBoxcxx . . $ QGroupBox# groupBox2cxx . . $ QGroupBox#QGroupBox(90d5708627041e22).("Decimation"cxx . . $ QString#QString(85c52e162fed56f9).);
381 QSpinBoxcxx . . $ QSpinBox# decimationcxx . . $ QSpinBox#QSpinBox(108f35f7aa7f3cf9).(&groupBox2);
382 decimation.setMinimumcxx . . $ QSpinBox#setMinimum(d4f767463ce0a6b3).(1);
383 decimation.setValuecxx . . $ QSpinBox#setValue(d4f767463ce0a6b3).(1 /cxx . . $ `operator/`(68a6fbfab4d187bc). sampleSrc->relativeBandwidth());
384
385 QVBoxLayoutcxx . . $ QVBoxLayout# vbox2cxx . . $ QVBoxLayout#QVBoxLayout(49f6e7a06ebc5aa8).;
386 vbox2.addWidgetcxx . . $ QBoxLayout#addWidget(d39963fa34d6acb).(&decimation);
387
388 groupBox2.setLayoutcxx . . $ QWidget#setLayout(23396b1058755fec).(&vbox2);
389 l->addWidgetcxx . . $ QGridLayout#addWidget(17d1465fab362e2d).(&groupBox2, 4, 2);
390
391 if (dialog.execcxx . . $ QDialog#exec(b126dc7c1de90089).()) {
392 QStringListcxx . . $ QStringList# fileNames = dialog.selectedFilescxx . . $ QFileDialog#selectedFiles(e1dbd5c4feadc8f5).();
393
394 size_t start, end;
395 if (cursorSelection.isCheckedcxx . . $ QAbstractButton#isChecked(50ce9a9e25b4a850).()) {
396 start = selectedSamplescxx . . $ PlotView#selectedSamples..minimumcxx . . $ range_t#minimum.;
397 end = start + selectedSamplescxx . . $ PlotView#selectedSamples..lengthcxx . . $ range_t#length(f448638088200dcb).();
398 } else if(currentView.isCheckedcxx . . $ QAbstractButton#isChecked(50ce9a9e25b4a850).()) {
399 start = viewRangecxx . . $ PlotView#viewRange..minimumcxx . . $ range_t#minimum.;
400 end = start + viewRangecxx . . $ PlotView#viewRange..lengthcxx . . $ range_t#length(f448638088200dcb).();
401 } else {
402 start = 0;
403 end = sampleSrc->count();
404 }
405
406 stdcxx . . $ std/::ofstreamcxx . . $ std/ofstream# oscxx . . $ std/basic_ofstream#basic_ofstream(be6c264dafcf0985). (fileNames[cxx . . $ QList#`operator[]`(7a0ef1c7079e8533).0].toStdStringcxx . . $ QString#toStdString(219584694fe2b248).(), stdcxx . . $ std/::ioscxx . . $ std/ios#::binarycxx . . $ std/ios_base#binary.);
407
408 size_t index;
409 // viewRange.length() is used as some less arbitrary step value
410 size_t step = viewRangecxx . . $ PlotView#viewRange..lengthcxx . . $ range_t#length(f448638088200dcb).();
411
412 QProgressDialogcxx . . $ QProgressDialog# progresscxx . . $ QProgressDialog#QProgressDialog(5888373887ba94ae).("Exporting samples..."cxx . . $ QString#QString(85c52e162fed56f9)., "Cancel"cxx . . $ QString#QString(85c52e162fed56f9)., start, end, this);
413 progress.setWindowModalitycxx . . $ QWidget#setWindowModality(3df99ed04a148acc).(Qtcxx . . $ Qt/::WindowModalcxx . . $ Qt/WindowModal.);
414 for (index = start; index < end; index += step) {
415 progress.setValuecxx . . $ QProgressDialog#setValue(d4f767463ce0a6b3).(index);
416 if (progress.wasCanceledcxx . . $ QProgressDialog#wasCanceled(50ce9a9e25b4a850).())
417 break;
418
419 size_t length = stdcxx . . $ std/::mincxx . . $ std/min(2a338fce5842aa6a).(step, end - index);
420 auto samples = sampleSrc->getSamples(index, length);
421 if (samples !=cxx . . $ `operator!=`(d1ea73743db8cde9). nullptr) {
422 for (auto i = 0; i < length; i += decimation.valuecxx . . $ QSpinBox#value(455f465bc33b4cdf).()) {
423 os.writecxx . . $ std/basic_ostream#write(3c866fa06c201852).((const char*)&samples[i], sizeof(SOURCETYPE));
424 }
425 }
426 }
427 }
428 }
429
430 void PlotViewcxx . . $ PlotView#::invalidateEventcxx . . $ PlotView#invalidateEvent(49f6e7a06ebc5aa8).()
431 {
432 horizontalScrollBarcxx . . $ QAbstractScrollArea#horizontalScrollBar(49d9510c6adf8c19).()->setMinimumcxx . . $ QAbstractSlider#setMinimum(d4f767463ce0a6b3).(0);
433 horizontalScrollBarcxx . . $ QAbstractScrollArea#horizontalScrollBar(49d9510c6adf8c19).()->setMaximumcxx . . $ QAbstractSlider#setMaximum(d4f767463ce0a6b3).(sampleToColumncxx . . $ PlotView#sampleToColumn(15f694ef3c96d230).(mainSampleSourcecxx . . $ PlotView#mainSampleSource.->countcxx . . $ SampleSource#count(f708dce9a8856c70).()));
434 }
435
436 void PlotViewcxx . . $ PlotView#::repaintcxx . . $ PlotView#repaint(49f6e7a06ebc5aa8).()
437 {
438 viewportcxx . . $ QAbstractScrollArea#viewport(27f420ad5cce8994).()->updatecxx . . $ QWidget#update(49f6e7a06ebc5aa8).();
439 }
440
441 void PlotViewcxx . . $ PlotView#::setCursorSegmentscxx . . $ PlotView#setCursorSegments(d4f767463ce0a6b3).(int segments)
442 {
443 // Calculate number of samples per segment
444 float sampPerSeg = (float)selectedSamplescxx . . $ PlotView#selectedSamples..lengthcxx . . $ range_t#length(f448638088200dcb).() / cursorscxx . . $ PlotView#cursors..segmentscxx . . $ Cursors#segments(b126dc7c1de90089).();
445
446 // Alter selection to keep samples per segment the same
447 selectedSamplescxx . . $ PlotView#selectedSamples..maximumcxx . . $ range_t#maximum. = selectedSamplescxx . . $ PlotView#selectedSamples..minimumcxx . . $ range_t#minimum. + (segments * sampPerSeg + 0.5f);
448
449 cursorscxx . . $ PlotView#cursors..setSegmentscxx . . $ Cursors#setSegments(d4f767463ce0a6b3).(segments);
450 updateViewcxx . . $ PlotView#updateView(b0b38cda41d4ede4).();
451 emitTimeSelectioncxx . . $ PlotView#emitTimeSelection(49f6e7a06ebc5aa8).();
452 }
453
454 void PlotViewcxx . . $ PlotView#::setFFTAndZoomcxx . . $ PlotView#setFFTAndZoom(3e454b8ccf442868).(int size, int zoom)
455 {
456 auto oldSamplesPerColumn = samplesPerColumncxx . . $ PlotView#samplesPerColumn(f708dce9a8856c70).();
457
458 // Set new FFT size
459 fftSizecxx . . $ PlotView#fftSize. = size;
460 if (spectrogramPlotcxx . . $ PlotView#spectrogramPlot. != nullptr)
461 spectrogramPlotcxx . . $ PlotView#spectrogramPlot.->setFFTSizecxx . . $ SpectrogramPlot#setFFTSize(d4f767463ce0a6b3).(size);
462
463 // Set new zoom level
464 zoomLevelcxx . . $ PlotView#zoomLevel. = zoom;
465 if (spectrogramPlotcxx . . $ PlotView#spectrogramPlot. != nullptr)
466 spectrogramPlotcxx . . $ PlotView#spectrogramPlot.->setZoomLevelcxx . . $ SpectrogramPlot#setZoomLevel(d4f767463ce0a6b3).(zoom);
467
468 // Update horizontal (time) scrollbar
469 horizontalScrollBarcxx . . $ QAbstractScrollArea#horizontalScrollBar(49d9510c6adf8c19).()->setSingleStepcxx . . $ QAbstractSlider#setSingleStep(d4f767463ce0a6b3).(10);
470 horizontalScrollBarcxx . . $ QAbstractScrollArea#horizontalScrollBar(49d9510c6adf8c19).()->setPageStepcxx . . $ QAbstractSlider#setPageStep(d4f767463ce0a6b3).(100);
471
472 updateViewcxx . . $ PlotView#updateView(b0b38cda41d4ede4).(true, samplesPerColumncxx . . $ PlotView#samplesPerColumn(f708dce9a8856c70).() < oldSamplesPerColumn);
473 }
474
475 void PlotViewcxx . . $ PlotView#::setPowerMincxx . . $ PlotView#setPowerMin(d4f767463ce0a6b3).(int power)
476 {
477 powerMincxx . . $ PlotView#powerMin. = power;
478 if (spectrogramPlotcxx . . $ PlotView#spectrogramPlot. != nullptr)
479 spectrogramPlotcxx . . $ PlotView#spectrogramPlot.->setPowerMincxx . . $ SpectrogramPlot#setPowerMin(d4f767463ce0a6b3).(power);
480 updateViewcxx . . $ PlotView#updateView(b0b38cda41d4ede4).();
481 }
482
483 void PlotViewcxx . . $ PlotView#::setPowerMaxcxx . . $ PlotView#setPowerMax(d4f767463ce0a6b3).(int power)
484 {
485 powerMaxcxx . . $ PlotView#powerMax. = power;
486 if (spectrogramPlotcxx . . $ PlotView#spectrogramPlot. != nullptr)
487 spectrogramPlotcxx . . $ PlotView#spectrogramPlot.->setPowerMaxcxx . . $ SpectrogramPlot#setPowerMax(d4f767463ce0a6b3).(power);
488 updateViewcxx . . $ PlotView#updateView(b0b38cda41d4ede4).();
489 }
490
491 void PlotViewcxx . . $ PlotView#::paintEventcxx . . $ PlotView#paintEvent(f239c9e85d61a220).(QPaintEventcxx . . $ QPaintEvent# *event)
492 {
493 if (mainSampleSourcecxx . . $ PlotView#mainSampleSource. == nullptr) return;
494
495 QRectcxx . . $ QRect# rect = QRectcxx . . $ QRect#QRect(748afa4755bc9595).(0, 0, widthcxx . . $ QWidget#width(455f465bc33b4cdf).(), heightcxx . . $ QWidget#height(455f465bc33b4cdf).());
496 QPaintercxx . . $ QPainter# paintercxx . . $ QPainter#QPainter(dd2eedc069b0ab5f).(viewportcxx . . $ QAbstractScrollArea#viewport(27f420ad5cce8994).());
497 painter.fillRectcxx . . $ QPainter#fillRect(26a0210a6d40746b).(rect, Qtcxx . . $ Qt/::blackcxx . . $ Qt/black.);
498
499
500 #define PLOT_LAYERcxx . . $ `src/plotview.cpp:500:9`!(paintFunc) \
501 { \
502 int y = -verticalScrollBar()->value(); \
503 for (auto&& plot : plots) { \
504 QRect rect = QRect(0, y, width(), plot->height()); \
505 plot->paintFunc(painter, rect, viewRange); \
506 y += plot->height(); \
507 } \
508 }
509
510 PLOT_LAYERcxx . . $ `src/plotview.cpp:500:9`!(paintBack);
511 PLOT_LAYERcxx . . $ `src/plotview.cpp:500:9`!(paintMid);
512 PLOT_LAYERcxx . . $ `src/plotview.cpp:500:9`!(paintFront);
513 if (cursorsEnabledcxx . . $ PlotView#cursorsEnabled.)
514 cursorscxx . . $ PlotView#cursors..paintFrontcxx . . $ Cursors#paintFront(dba2c6533854c69f).(painter, rect, viewRangecxx . . $ PlotView#viewRange.);
515
516 if (timeScaleEnabledcxx . . $ PlotView#timeScaleEnabled.) {
517 paintTimeScalecxx . . $ PlotView#paintTimeScale(dba2c6533854c69f).(painter, rect, viewRangecxx . . $ PlotView#viewRange.);
518 }
519
520
521 #undef PLOT_LAYERcxx . . $ `src/plotview.cpp:500:9`!
522 }
523
524 void PlotViewcxx . . $ PlotView#::paintTimeScalecxx . . $ PlotView#paintTimeScale(dba2c6533854c69f).(QPaintercxx . . $ QPainter# &painter, QRectcxx . . $ QRect# &rect, range_tcxx . . $ range_t#<size_t> sampleRange)
525 {
526 float startTime = (float)sampleRange.minimumcxx . . $ range_t#minimum. / sampleRatecxx . . $ PlotView#sampleRate.;
527 float stopTime = (float)sampleRange.maximumcxx . . $ range_t#maximum. / sampleRatecxx . . $ PlotView#sampleRate.;
528 float duration = stopTime - startTime;
529
530 if (duration <= 0)
531 return;
532
533 painter.savecxx . . $ QPainter#save(49f6e7a06ebc5aa8).();
534
535 QPencxx . . $ QPen# pencxx . . $ QPen#QPen(c1f9b1cc0228302b).(Qtcxx . . $ QBrush#QBrush(1975e3c608654284).::whitecxx . . $ Qt/white., 1, Qtcxx . . $ Qt/::SolidLinecxx . . $ Qt/SolidLine.);
536 painter.setPencxx . . $ QPainter#setPen(af0a25dfda3214db).(pen);
537 QFontMetricscxx . . $ QFontMetrics# fmcxx . . $ QFontMetrics#QFontMetrics(d0a4bd0c8524b912).(painter.fontcxx . . $ QPainter#font(c5040538afc47120).());
538
539 int tickWidth = 80;
540 int maxTicks = rect.widthcxx . . $ QRect#width(455f465bc33b4cdf).() / tickWidth;
541
542 double durationPerTick = 10 * pow(10, floor(log(duration / maxTicks) / log(10)));
543
544 double firstTick = int(startTime / durationPerTick) * durationPerTick;
545
546 double tick = firstTick;
547
548 while (tick <= stopTime) {
549
550 size_t tickSample = tick * sampleRatecxx . . $ PlotView#sampleRate.;
551 int tickLine = sampleToColumncxx . . $ PlotView#sampleToColumn(15f694ef3c96d230).(tickSample - sampleRange.minimumcxx . . $ range_t#minimum.);
552
553 char buf[128];
554 snprintf(buf, sizeof(buf), "%.06f", tick);
555 painter.drawLinecxx . . $ QPainter#drawLine(748afa4755bc9595).(tickLine, 0, tickLine, 30);
556 painter.drawTextcxx . . $ QPainter#drawText(c89d651b24440698).(tickLine + 2, 25, bufcxx . . $ QString#QString(85c52e162fed56f9).);
557
558 tick += durationPerTick;
559 }
560
561 // Draw small ticks
562 durationPerTick /= 10;
563 firstTick = int(startTime / durationPerTick) * durationPerTick;
564 tick = firstTick;
565 while (tick <= stopTime) {
566
567 size_t tickSample = tick * sampleRatecxx . . $ PlotView#sampleRate.;
568 int tickLine = sampleToColumncxx . . $ PlotView#sampleToColumn(15f694ef3c96d230).(tickSample - sampleRange.minimumcxx . . $ range_t#minimum.);
569
570 painter.drawLinecxx . . $ QPainter#drawLine(748afa4755bc9595).(tickLine, 0, tickLine, 10);
571 tick += durationPerTick;
572 }
573
574 painter.restorecxx . . $ QPainter#restore(49f6e7a06ebc5aa8).();
575 }
576
577 int PlotViewcxx . . $ PlotView#::plotsHeightcxx . . $ PlotView#plotsHeight(b126dc7c1de90089).()
578 {
579 int height = 0;
580 for (auto&& plot : plotscxx . . $ PlotView#plots.) {
581 height += plot->cxx . . $ std/unique_ptr#`operator->`(ca399b2b6292c808).heightcxx . . $ Plot#height(455f465bc33b4cdf).();
582 }
583 return height;
584 }
585
586 void PlotViewcxx . . $ PlotView#::resizeEventcxx . . $ PlotView#resizeEvent(eeeec21cf8dc0387).(QResizeEventcxx . . $ QResizeEvent# * event)
587 {
588 updateViewcxx . . $ PlotView#updateView(b0b38cda41d4ede4).();
589 }
590
591 size_t PlotViewcxx . . $ PlotView#::samplesPerColumncxx . . $ PlotView#samplesPerColumn(f708dce9a8856c70).()
592 {
593 return fftSizecxx . . $ PlotView#fftSize. / zoomLevelcxx . . $ PlotView#zoomLevel.;
594 }
595
596 void PlotViewcxx . . $ PlotView#::scrollContentsBycxx . . $ PlotView#scrollContentsBy(3e454b8ccf442868).(int dx, int dy)
597 {
598 updateViewcxx . . $ PlotView#updateView(b0b38cda41d4ede4).();
599 }
600
601 void PlotViewcxx . . $ PlotView#::showEventcxx . . $ PlotView#showEvent(bc3b8402ee8753a7).(QShowEventcxx . . $ QShowEvent# *event)
602 {
603 // Intentionally left blank. See #171
604 }
605
606 void PlotViewcxx . . $ PlotView#::updateViewRangecxx . . $ PlotView#updateViewRange(b45ddcbc8423892c).(bool reCenter)
607 {
608 // Update current view
609 auto start = columnToSamplecxx . . $ PlotView#columnToSample(c104ebd7d68b2193).(horizontalScrollBarcxx . . $ QAbstractScrollArea#horizontalScrollBar(49d9510c6adf8c19).()->valuecxx . . $ QAbstractSlider#value(455f465bc33b4cdf).());
610 viewRangecxx . . $ PlotView#viewRange. =cxx . . $ range_t#`operator=`(b7f9b018042febfd). {start, stdcxx . . $ std/::mincxx . . $ std/min(2a338fce5842aa6a).(start + columnToSamplecxx . . $ PlotView#columnToSample(c104ebd7d68b2193).(widthcxx . . $ QWidget#width(455f465bc33b4cdf).()), mainSampleSourcecxx . . $ PlotView#mainSampleSource.->countcxx . . $ SampleSource#count(f708dce9a8856c70).())};
611
612 // Adjust time offset to zoom around central sample
613 if (reCenter) {
614 horizontalScrollBarcxx . . $ QAbstractScrollArea#horizontalScrollBar(49d9510c6adf8c19).()->setValuecxx . . $ QAbstractSlider#setValue(d4f767463ce0a6b3).(
615 sampleToColumncxx . . $ PlotView#sampleToColumn(15f694ef3c96d230).(zoomSamplecxx . . $ PlotView#zoomSample.) - zoomPoscxx . . $ PlotView#zoomPos.
616 );
617 }
618 zoomSamplecxx . . $ PlotView#zoomSample. = viewRangecxx . . $ PlotView#viewRange..minimumcxx . . $ range_t#minimum. + viewRangecxx . . $ PlotView#viewRange..lengthcxx . . $ range_t#length(f448638088200dcb).() / 2;
619 zoomPoscxx . . $ PlotView#zoomPos. = widthcxx . . $ QWidget#width(455f465bc33b4cdf).() / 2;
620 }
621
622 void PlotViewcxx . . $ PlotView#::updateViewcxx . . $ PlotView#updateView(b0b38cda41d4ede4).(bool reCenter, bool expanding)
623 {
624 if (!expanding) {
625 updateViewRangecxx . . $ PlotView#updateViewRange(b45ddcbc8423892c).(reCenter);
626 }
627 horizontalScrollBarcxx . . $ QAbstractScrollArea#horizontalScrollBar(49d9510c6adf8c19).()->setMaximumcxx . . $ QAbstractSlider#setMaximum(d4f767463ce0a6b3).(stdcxx . . $ std/::maxcxx . . $ std/max(2a338fce5842aa6a).(0, sampleToColumncxx . . $ PlotView#sampleToColumn(15f694ef3c96d230).(mainSampleSourcecxx . . $ PlotView#mainSampleSource.->countcxx . . $ SampleSource#count(f708dce9a8856c70).()) - widthcxx . . $ QWidget#width(455f465bc33b4cdf).()));
628 verticalScrollBarcxx . . $ QAbstractScrollArea#verticalScrollBar(49d9510c6adf8c19).()->setMaximumcxx . . $ QAbstractSlider#setMaximum(d4f767463ce0a6b3).(stdcxx . . $ std/::maxcxx . . $ std/max(2a338fce5842aa6a).(0, plotsHeightcxx . . $ PlotView#plotsHeight(b126dc7c1de90089).() - viewportcxx . . $ QAbstractScrollArea#viewport(27f420ad5cce8994).()->heightcxx . . $ QWidget#height(455f465bc33b4cdf).()));
629 if (expanding) {
630 updateViewRangecxx . . $ PlotView#updateViewRange(b45ddcbc8423892c).(reCenter);
631 }
632
633 // Update cursors
634 range_tcxx . . $ range_t#<int> newSelection = {
635 sampleToColumncxx . . $ PlotView#sampleToColumn(15f694ef3c96d230).(selectedSamplescxx . . $ PlotView#selectedSamples..minimumcxx . . $ range_t#minimum.) - horizontalScrollBarcxx . . $ QAbstractScrollArea#horizontalScrollBar(49d9510c6adf8c19).()->valuecxx . . $ QAbstractSlider#value(455f465bc33b4cdf).(),
636 sampleToColumncxx . . $ PlotView#sampleToColumn(15f694ef3c96d230).(selectedSamplescxx . . $ PlotView#selectedSamples..maximumcxx . . $ range_t#maximum.) - horizontalScrollBarcxx . . $ QAbstractScrollArea#horizontalScrollBar(49d9510c6adf8c19).()->valuecxx . . $ QAbstractSlider#value(455f465bc33b4cdf).()
637 };
638 cursorscxx . . $ PlotView#cursors..setSelectioncxx . . $ Cursors#setSelection(3ae39a1630889ffb).(newSelection);
639
640 // Re-paint
641 viewportcxx . . $ QAbstractScrollArea#viewport(27f420ad5cce8994).()->updatecxx . . $ QWidget#update(49f6e7a06ebc5aa8).();
642 }
643
644 void PlotViewcxx . . $ PlotView#::setSampleRatecxx . . $ PlotView#setSampleRate(ba8836b59fb42830).(double rate)
645 {
646 sampleRatecxx . . $ PlotView#sampleRate. = rate;
647
648 if (spectrogramPlotcxx . . $ PlotView#spectrogramPlot. != nullptr)
649 spectrogramPlotcxx . . $ PlotView#spectrogramPlot.->setSampleRatecxx . . $ SpectrogramPlot#setSampleRate(ba8836b59fb42830).(rate);
650
651 emitTimeSelectioncxx . . $ PlotView#emitTimeSelection(49f6e7a06ebc5aa8).();
652 }
653
654 void PlotViewcxx . . $ PlotView#::enableScalescxx . . $ PlotView#enableScales(b45ddcbc8423892c).(bool enabled)
655 {
656 timeScaleEnabledcxx . . $ PlotView#timeScaleEnabled. = enabled;
657
658 if (spectrogramPlotcxx . . $ PlotView#spectrogramPlot. != nullptr)
659 spectrogramPlotcxx . . $ PlotView#spectrogramPlot.->enableScalescxx . . $ SpectrogramPlot#enableScales(b45ddcbc8423892c).(enabled);
660
661 viewportcxx . . $ QAbstractScrollArea#viewport(27f420ad5cce8994).()->updatecxx . . $ QWidget#update(49f6e7a06ebc5aa8).();
662 }
663
664 void PlotViewcxx . . $ PlotView#::enableAnnotationscxx . . $ PlotView#enableAnnotations(b45ddcbc8423892c).(bool enabled)
665 {
666 if (spectrogramPlotcxx . . $ PlotView#spectrogramPlot. != nullptr)
667 spectrogramPlotcxx . . $ PlotView#spectrogramPlot.->enableAnnotationscxx . . $ SpectrogramPlot#enableAnnotations(b45ddcbc8423892c).(enabled);
668
669 viewportcxx . . $ QAbstractScrollArea#viewport(27f420ad5cce8994).()->updatecxx . . $ QWidget#update(49f6e7a06ebc5aa8).();
670 }
671
672 void PlotViewcxx . . $ PlotView#::enableAnnotationCommentsTooltipscxx . . $ PlotView#enableAnnotationCommentsTooltips(b45ddcbc8423892c).(bool enabled)
673 {
674 annotationCommentsEnabledcxx . . $ PlotView#annotationCommentsEnabled. = enabled;
675
676 viewportcxx . . $ QAbstractScrollArea#viewport(27f420ad5cce8994).()->updatecxx . . $ QWidget#update(49f6e7a06ebc5aa8).();
677 }
678
679 int PlotViewcxx . . $ PlotView#::sampleToColumncxx . . $ PlotView#sampleToColumn(15f694ef3c96d230).(size_t sample)
680 {
681 return sample / samplesPerColumncxx . . $ PlotView#samplesPerColumn(f708dce9a8856c70).();
682 }
683
684 size_t PlotViewcxx . . $ PlotView#::columnToSamplecxx . . $ PlotView#columnToSample(c104ebd7d68b2193).(int col)
685 {
686 return col * samplesPerColumncxx . . $ PlotView#samplesPerColumn(f708dce9a8856c70).();
687 }