2017-01-02 21:07:43 -05:00
|
|
|
// Copyright (c) Charles J. Cliffe
|
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
|
|
|
|
2014-11-15 23:41:41 -05:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
#include <queue>
|
2017-08-13 12:49:47 -04:00
|
|
|
#include <memory>
|
2014-11-15 23:41:41 -05:00
|
|
|
|
2015-01-02 21:32:24 -05:00
|
|
|
#include "InteractiveCanvas.h"
|
2015-08-10 00:33:31 -04:00
|
|
|
#include "PrimaryGLContext.h"
|
2014-11-25 22:51:14 -05:00
|
|
|
#include "MouseTracker.h"
|
2015-08-03 01:38:38 -04:00
|
|
|
#include "SpectrumVisualProcessor.h"
|
2015-08-10 00:33:31 -04:00
|
|
|
#include "SpectrumPanel.h"
|
2014-11-15 23:41:41 -05:00
|
|
|
|
2015-01-01 21:10:54 -05:00
|
|
|
class WaterfallCanvas;
|
|
|
|
|
2015-01-02 21:32:24 -05:00
|
|
|
class SpectrumCanvas: public InteractiveCanvas {
|
2014-11-15 23:41:41 -05:00
|
|
|
public:
|
2018-03-10 02:34:39 -05:00
|
|
|
SpectrumCanvas(wxWindow *parent, const wxGLAttributes& dispAttrs);
|
2021-04-04 22:20:33 -04:00
|
|
|
~SpectrumCanvas() override;
|
2014-11-15 23:41:41 -05:00
|
|
|
|
2017-01-27 15:38:48 -05:00
|
|
|
//This is public because it is indeed forwarded from
|
|
|
|
//AppFrame::OnGlobalKeyDown, because global key handler intercepts
|
|
|
|
//calls in all windows.
|
|
|
|
void OnKeyDown(wxKeyEvent& event);
|
|
|
|
|
|
|
|
//This is public because it is indeed forwarded from
|
|
|
|
//AppFrame::OnGlobalKeyUp, because global key handler intercepts
|
|
|
|
//calls in all windows.
|
|
|
|
void OnKeyUp(wxKeyEvent& event);
|
|
|
|
|
2015-01-01 21:10:54 -05:00
|
|
|
void attachWaterfallCanvas(WaterfallCanvas *canvas_in);
|
2015-04-23 19:38:44 -04:00
|
|
|
void moveCenterFrequency(long long freqChange);
|
2015-01-01 21:10:54 -05:00
|
|
|
|
2015-08-17 21:52:38 -04:00
|
|
|
void setShowDb(bool showDb);
|
2015-08-17 23:31:22 -04:00
|
|
|
bool getShowDb();
|
2015-08-17 21:52:38 -04:00
|
|
|
|
2016-10-20 21:44:33 -04:00
|
|
|
void setUseDBOfs(bool showDb);
|
|
|
|
bool getUseDBOfs();
|
|
|
|
|
2015-10-25 00:07:01 -04:00
|
|
|
void setView(long long center_freq_in, int bandwidth_in);
|
2021-04-04 22:20:33 -04:00
|
|
|
void disableView() override;
|
2015-10-25 00:07:01 -04:00
|
|
|
|
2015-10-25 14:09:59 -04:00
|
|
|
void setScaleFactorEnabled(bool en);
|
2015-12-29 20:52:49 -05:00
|
|
|
void setFFTSize(int fftSize);
|
2015-10-25 14:09:59 -04:00
|
|
|
|
2017-08-13 12:49:47 -04:00
|
|
|
SpectrumVisualDataQueuePtr getVisualDataQueue();
|
2015-08-03 01:38:38 -04:00
|
|
|
|
2018-03-11 03:14:44 -04:00
|
|
|
// called by Waterfall to forward the update of the vertical scale.
|
|
|
|
void updateScaleFactorFromYMove(float yDeltaMouseMove);
|
|
|
|
|
2014-11-15 23:41:41 -05:00
|
|
|
private:
|
|
|
|
void OnPaint(wxPaintEvent& event);
|
|
|
|
|
|
|
|
void OnIdle(wxIdleEvent &event);
|
|
|
|
|
2015-01-03 17:07:39 -05:00
|
|
|
void OnMouseMoved(wxMouseEvent& event);
|
|
|
|
void OnMouseDown(wxMouseEvent& event);
|
|
|
|
void OnMouseWheelMoved(wxMouseEvent& event);
|
|
|
|
void OnMouseReleased(wxMouseEvent& event);
|
2015-08-16 19:47:49 -04:00
|
|
|
void OnMouseEnterWindow(wxMouseEvent& event);
|
2015-01-03 17:07:39 -05:00
|
|
|
void OnMouseLeftWindow(wxMouseEvent& event);
|
2015-10-25 00:07:01 -04:00
|
|
|
void OnMouseRightDown(wxMouseEvent& event);
|
|
|
|
void OnMouseRightReleased(wxMouseEvent& event);
|
2017-01-27 15:38:48 -05:00
|
|
|
|
2015-10-25 00:07:01 -04:00
|
|
|
void updateScaleFactor(float factor);
|
|
|
|
|
2015-08-10 00:33:31 -04:00
|
|
|
PrimaryGLContext *glContext;
|
2015-01-01 21:10:54 -05:00
|
|
|
WaterfallCanvas *waterfallCanvas;
|
2015-08-10 00:33:31 -04:00
|
|
|
SpectrumPanel spectrumPanel;
|
2015-10-25 00:07:01 -04:00
|
|
|
float scaleFactor;
|
|
|
|
int bwChange;
|
2015-10-25 14:09:59 -04:00
|
|
|
bool resetScaleFactor, scaleFactorEnabled;
|
2015-08-03 01:38:38 -04:00
|
|
|
|
2017-08-13 12:49:47 -04:00
|
|
|
SpectrumVisualDataQueuePtr visualDataQueue = std::make_shared<SpectrumVisualDataQueue>();
|
2015-08-03 01:38:38 -04:00
|
|
|
|
2014-11-15 23:41:41 -05:00
|
|
|
// event table
|
|
|
|
wxDECLARE_EVENT_TABLE();
|
|
|
|
};
|
|
|
|
|