2017-01-02 21:07:43 -05:00
|
|
|
// Copyright (c) Charles J. Cliffe
|
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
|
|
|
|
2014-10-27 21:22:29 -04:00
|
|
|
#pragma once
|
|
|
|
|
2015-10-25 14:09:59 -04:00
|
|
|
#include <wx/frame.h>
|
|
|
|
#include <wx/panel.h>
|
|
|
|
#include <wx/splitter.h>
|
2015-10-27 01:56:49 -04:00
|
|
|
#include <wx/sizer.h>
|
2016-11-01 22:29:58 -04:00
|
|
|
#include <wx/bitmap.h>
|
|
|
|
#include <wx/statbmp.h>
|
2015-10-25 14:09:59 -04:00
|
|
|
|
2014-10-27 21:22:29 -04:00
|
|
|
#include "PrimaryGLContext.h"
|
2014-11-23 19:39:27 -05:00
|
|
|
|
2014-11-12 21:55:11 -05:00
|
|
|
#include "ScopeCanvas.h"
|
2014-11-15 23:41:41 -05:00
|
|
|
#include "SpectrumCanvas.h"
|
|
|
|
#include "WaterfallCanvas.h"
|
2014-12-31 19:45:01 -05:00
|
|
|
#include "MeterCanvas.h"
|
2015-01-04 17:11:20 -05:00
|
|
|
#include "TuningCanvas.h"
|
2015-01-05 19:12:16 -05:00
|
|
|
#include "ModeSelectorCanvas.h"
|
2015-10-27 01:56:49 -04:00
|
|
|
#include "GainCanvas.h"
|
2015-08-14 19:17:43 -04:00
|
|
|
#include "FFTVisualDataThread.h"
|
2015-10-20 23:00:10 -04:00
|
|
|
#include "SDRDeviceInfo.h"
|
2015-11-23 21:32:50 -05:00
|
|
|
#include "ModemProperties.h"
|
2015-08-14 19:17:43 -04:00
|
|
|
//#include "UITestCanvas.h"
|
2016-02-07 21:05:49 -05:00
|
|
|
#include "FrequencyDialog.h"
|
2016-09-14 19:46:57 -04:00
|
|
|
#include "BookmarkView.h"
|
2017-02-07 21:48:22 -05:00
|
|
|
#include "AboutDialog.h"
|
2014-12-31 19:45:01 -05:00
|
|
|
|
|
|
|
#include <map>
|
|
|
|
|
2014-12-31 22:38:59 -05:00
|
|
|
#define wxID_RT_AUDIO_DEVICE 1000
|
2015-01-06 00:57:57 -05:00
|
|
|
#define wxID_SET_FREQ_OFFSET 2001
|
2015-01-10 12:27:03 -05:00
|
|
|
#define wxID_RESET 2002
|
2015-04-13 21:18:45 -04:00
|
|
|
#define wxID_SET_PPM 2003
|
2016-02-08 22:43:11 -05:00
|
|
|
#define wxID_SET_TIPS 2004
|
2016-02-15 15:07:57 -05:00
|
|
|
#define wxID_SET_IQSWAP 2005
|
2015-10-04 16:07:14 -04:00
|
|
|
#define wxID_SDR_DEVICES 2008
|
2015-10-27 01:56:49 -04:00
|
|
|
#define wxID_AGC_CONTROL 2009
|
2016-02-28 23:16:56 -05:00
|
|
|
#define wxID_SDR_START_STOP 2010
|
2016-03-31 21:32:50 -04:00
|
|
|
#define wxID_LOW_PERF 2011
|
2016-10-20 21:44:33 -04:00
|
|
|
#define wxID_SET_DB_OFFSET 2012
|
2017-02-07 21:48:22 -05:00
|
|
|
#define wxID_ABOUT_CUBICSDR 2013
|
2014-11-19 17:41:49 -05:00
|
|
|
|
2015-10-25 14:09:59 -04:00
|
|
|
#define wxID_MAIN_SPLITTER 2050
|
|
|
|
#define wxID_VIS_SPLITTER 2051
|
2016-12-18 12:00:53 -05:00
|
|
|
#define wxID_BM_SPLITTER 2052
|
2014-11-19 17:41:49 -05:00
|
|
|
|
2015-01-11 03:09:59 -05:00
|
|
|
#define wxID_THEME_DEFAULT 2100
|
|
|
|
#define wxID_THEME_SHARP 2101
|
|
|
|
#define wxID_THEME_BW 2102
|
|
|
|
#define wxID_THEME_RAD 2103
|
|
|
|
#define wxID_THEME_TOUCH 2104
|
|
|
|
#define wxID_THEME_HD 2105
|
|
|
|
#define wxID_THEME_RADAR 2106
|
|
|
|
|
2016-12-27 15:36:33 -05:00
|
|
|
#define wxID_DISPLAY_BOOKMARKS 2107
|
|
|
|
|
2015-10-20 23:00:10 -04:00
|
|
|
#define wxID_BANDWIDTH_BASE 2150
|
2017-01-21 05:26:51 -05:00
|
|
|
#define wxID_BANDWIDTH_MANUAL_DIALOG 2199
|
2015-10-20 23:00:10 -04:00
|
|
|
#define wxID_BANDWIDTH_MANUAL 2200
|
2015-01-11 17:08:16 -05:00
|
|
|
|
2016-06-15 16:21:41 -04:00
|
|
|
#define wxID_DISPLAY_BASE 2250
|
|
|
|
|
2015-11-03 19:58:42 -05:00
|
|
|
#define wxID_SETTINGS_BASE 2300
|
2015-01-11 17:08:16 -05:00
|
|
|
|
2015-01-12 00:40:43 -05:00
|
|
|
#define wxID_DEVICE_ID 3500
|
|
|
|
|
2015-03-12 19:41:50 -04:00
|
|
|
#define wxID_AUDIO_BANDWIDTH_BASE 9000
|
|
|
|
#define wxID_AUDIO_DEVICE_MULTIPLIER 50
|
|
|
|
|
2016-01-03 19:00:26 -05:00
|
|
|
#ifdef USE_HAMLIB
|
|
|
|
#define wxID_RIG_TOGGLE 11900
|
|
|
|
#define wxID_RIG_PORT 11901
|
2016-01-09 00:09:46 -05:00
|
|
|
#define wxID_RIG_SDR_IF 11902
|
2016-02-16 01:13:26 -05:00
|
|
|
#define wxID_RIG_CONTROL 11903
|
|
|
|
#define wxID_RIG_FOLLOW 11904
|
2016-02-29 23:14:23 -05:00
|
|
|
#define wxID_RIG_CENTERLOCK 11905
|
|
|
|
#define wxID_RIG_FOLLOW_MODEM 11906
|
2016-01-03 19:00:26 -05:00
|
|
|
#define wxID_RIG_SERIAL_BASE 11950
|
|
|
|
#define wxID_RIG_MODEL_BASE 12000
|
|
|
|
#endif
|
|
|
|
|
2014-10-27 21:22:29 -04:00
|
|
|
// Define a new frame type
|
2014-10-28 21:39:59 -04:00
|
|
|
class AppFrame: public wxFrame {
|
2014-10-27 21:22:29 -04:00
|
|
|
public:
|
|
|
|
AppFrame();
|
2014-11-04 18:39:08 -05:00
|
|
|
~AppFrame();
|
2016-11-01 22:29:58 -04:00
|
|
|
|
2015-10-20 23:00:10 -04:00
|
|
|
void initDeviceParams(SDRDeviceInfo *devInfo);
|
2015-11-02 19:27:34 -05:00
|
|
|
void updateDeviceParams();
|
2014-11-16 16:51:45 -05:00
|
|
|
|
2015-01-09 17:17:56 -05:00
|
|
|
void saveSession(std::string fileName);
|
|
|
|
bool loadSession(std::string fileName);
|
|
|
|
|
2015-10-25 00:07:01 -04:00
|
|
|
FFTVisualDataThread *getWaterfallDataThread();
|
|
|
|
|
2016-07-28 10:46:18 -04:00
|
|
|
void notifyUpdateModemProperties();
|
2015-12-29 20:52:49 -05:00
|
|
|
void setMainWaterfallFFTSize(int fftSize);
|
2016-07-28 22:50:02 -04:00
|
|
|
void setScopeDeviceName(std::string deviceName);
|
2015-12-29 20:52:49 -05:00
|
|
|
|
2016-05-18 23:12:48 -04:00
|
|
|
void gkNudgeLeft(DemodulatorInstance *demod, int snap);
|
|
|
|
void gkNudgeRight(DemodulatorInstance *demod, int snap);
|
|
|
|
|
2016-02-07 18:01:11 -05:00
|
|
|
int OnGlobalKeyDown(wxKeyEvent &event);
|
|
|
|
int OnGlobalKeyUp(wxKeyEvent &event);
|
|
|
|
|
2016-02-07 21:05:49 -05:00
|
|
|
void setWaterfallLinesPerSecond(int lps);
|
|
|
|
void setSpectrumAvgSpeed(double avg);
|
|
|
|
|
|
|
|
FrequencyDialog::FrequencyDialogTarget getFrequencyDialogTarget();
|
2016-02-07 22:19:05 -05:00
|
|
|
void refreshGainUI();
|
2016-08-15 23:53:27 -04:00
|
|
|
void setViewState(long long center_freq, int bandwidth);
|
|
|
|
void setViewState(long long center_freq);
|
2016-12-27 00:06:25 -05:00
|
|
|
|
|
|
|
long long getViewCenterFreq();
|
|
|
|
int getViewBandwidth();
|
2016-08-16 17:55:40 -04:00
|
|
|
bool isUserDemodBusy();
|
2016-09-14 22:49:32 -04:00
|
|
|
|
|
|
|
BookmarkView *getBookmarkView();
|
2016-12-27 13:01:19 -05:00
|
|
|
void disableSave(bool state);
|
2017-01-21 05:26:51 -05:00
|
|
|
|
|
|
|
//call this in case the main UI is not
|
|
|
|
//the origin of device changes / sample rate by operator,
|
|
|
|
//and must be notified back to update its UI elements
|
|
|
|
//(ex: SDR Devices dialog changing the configuration)
|
|
|
|
void notifyDeviceChanged();
|
2016-09-14 22:49:32 -04:00
|
|
|
|
2016-05-30 00:17:08 -04:00
|
|
|
#ifdef _WIN32
|
2016-05-29 21:03:21 -04:00
|
|
|
bool canFocus();
|
2016-05-30 00:17:08 -04:00
|
|
|
#endif
|
2017-03-01 16:13:41 -05:00
|
|
|
//set tooltip to window
|
|
|
|
void setStatusText(wxWindow* window, std::string statusText);
|
|
|
|
void AppFrame::setStatusText(std::string statusText, int value);
|
2016-05-30 00:17:08 -04:00
|
|
|
|
2014-10-27 21:22:29 -04:00
|
|
|
private:
|
2014-12-31 21:31:37 -05:00
|
|
|
void OnMenu(wxCommandEvent& event);
|
2015-07-15 00:32:36 -04:00
|
|
|
void OnClose(wxCloseEvent& event);
|
2014-10-27 21:22:29 -04:00
|
|
|
void OnNewWindow(wxCommandEvent& event);
|
2014-10-28 21:39:59 -04:00
|
|
|
void OnIdle(wxIdleEvent& event);
|
2015-10-25 14:09:59 -04:00
|
|
|
void OnDoubleClickSash(wxSplitterEvent& event);
|
|
|
|
void OnUnSplit(wxSplitterEvent& event);
|
2017-02-07 21:48:22 -05:00
|
|
|
void OnAboutDialogClose(wxCommandEvent& event);
|
2016-06-20 13:28:26 -04:00
|
|
|
|
2017-02-26 05:18:09 -05:00
|
|
|
//actionXXXX manage menu actions, return true if the event has been
|
2017-01-25 15:28:44 -05:00
|
|
|
//treated.
|
2017-02-26 05:18:09 -05:00
|
|
|
bool actionOnMenuAbout(wxCommandEvent& event);
|
|
|
|
bool actionOnMenuReset(wxCommandEvent& event);
|
|
|
|
bool actionOnMenuSettings(wxCommandEvent& event);
|
|
|
|
bool actionOnMenuAGC(wxCommandEvent& event);
|
|
|
|
bool actionOnMenuSampleRate(wxCommandEvent& event);
|
|
|
|
bool actionOnMenuAudioSampleRate(wxCommandEvent& event);
|
2017-01-25 15:28:44 -05:00
|
|
|
bool actionOnMenuDisplay(wxCommandEvent& event);
|
2017-02-26 05:18:09 -05:00
|
|
|
bool actionOnMenuLoadSave(wxCommandEvent& event);
|
|
|
|
bool actionOnMenuRig(wxCommandEvent& event);
|
2017-01-25 15:28:44 -05:00
|
|
|
|
2014-11-15 23:41:41 -05:00
|
|
|
ScopeCanvas *scopeCanvas;
|
|
|
|
SpectrumCanvas *spectrumCanvas;
|
|
|
|
WaterfallCanvas *waterfallCanvas;
|
2015-01-05 19:12:16 -05:00
|
|
|
ModeSelectorCanvas *demodModeSelector;
|
2015-11-15 13:52:54 -05:00
|
|
|
#ifdef ENABLE_DIGITAL_LAB
|
2015-06-09 11:00:05 -04:00
|
|
|
ModeSelectorCanvas *demodModeSelectorAdv;
|
2015-11-15 13:52:54 -05:00
|
|
|
#endif
|
2014-12-29 00:24:10 -05:00
|
|
|
SpectrumCanvas *demodSpectrumCanvas;
|
2014-12-28 05:13:46 -05:00
|
|
|
WaterfallCanvas *demodWaterfallCanvas;
|
2014-12-31 19:45:01 -05:00
|
|
|
MeterCanvas *demodSignalMeter;
|
2015-01-10 20:33:30 -05:00
|
|
|
MeterCanvas *demodGainMeter;
|
2015-01-04 17:11:20 -05:00
|
|
|
TuningCanvas *demodTuner;
|
2015-08-11 23:52:03 -04:00
|
|
|
// UITestCanvas *testCanvas;
|
|
|
|
MeterCanvas *spectrumAvgMeter;
|
|
|
|
MeterCanvas *waterfallSpeedMeter;
|
2016-02-15 17:43:10 -05:00
|
|
|
ModeSelectorCanvas *demodMuteButton, *peakHoldButton, *soloModeButton, *deltaLockButton;
|
2015-10-27 01:56:49 -04:00
|
|
|
GainCanvas *gainCanvas;
|
|
|
|
wxSizerItem *gainSizerItem, *gainSpacerItem;
|
2016-09-14 22:10:27 -04:00
|
|
|
wxSplitterWindow *mainVisSplitter, *mainSplitter, *bookmarkSplitter;
|
2015-10-27 01:56:49 -04:00
|
|
|
wxBoxSizer *demodTray;
|
2016-09-14 22:49:32 -04:00
|
|
|
BookmarkView *bookmarkView;
|
2015-10-25 14:09:59 -04:00
|
|
|
|
2014-12-31 19:45:01 -05:00
|
|
|
DemodulatorInstance *activeDemodulator;
|
|
|
|
|
2014-12-31 22:38:59 -05:00
|
|
|
std::vector<RtAudio::DeviceInfo> devices;
|
2015-01-03 17:07:39 -05:00
|
|
|
std::map<int,RtAudio::DeviceInfo> inputDevices;
|
|
|
|
std::map<int,RtAudio::DeviceInfo> outputDevices;
|
2015-03-12 19:41:50 -04:00
|
|
|
std::map<int, wxMenuItem *> outputDeviceMenuItems;
|
|
|
|
std::map<int, wxMenuItem *> sampleRateMenuItems;
|
|
|
|
std::map<int, wxMenuItem *> audioSampleRateMenuItems;
|
2015-07-08 01:07:39 -04:00
|
|
|
std::map<int, wxMenuItem *> directSamplingMenuItems;
|
2015-11-02 21:04:02 -05:00
|
|
|
wxMenuBar *menuBar;
|
2016-06-20 13:28:26 -04:00
|
|
|
|
2017-01-28 08:57:27 -05:00
|
|
|
wxMenu *sampleRateMenu = nullptr;
|
|
|
|
wxMenu *displayMenu = nullptr;
|
|
|
|
wxMenuItem *agcMenuItem = nullptr;
|
|
|
|
wxMenuItem *iqSwapMenuItem = nullptr;
|
|
|
|
wxMenuItem *lowPerfMenuItem = nullptr;
|
|
|
|
wxMenu *settingsMenu = nullptr;
|
2016-06-20 13:28:26 -04:00
|
|
|
|
2015-11-03 23:44:35 -05:00
|
|
|
SoapySDR::ArgInfoList settingArgs;
|
|
|
|
int settingsIdMax;
|
2015-10-20 23:00:10 -04:00
|
|
|
std::vector<long> sampleRates;
|
2017-01-21 05:26:51 -05:00
|
|
|
long manualSampleRate = -1;
|
2015-05-31 22:13:14 -04:00
|
|
|
|
2015-01-09 17:17:56 -05:00
|
|
|
std::string currentSessionFile;
|
2015-08-08 13:26:53 -04:00
|
|
|
|
2015-08-14 19:17:43 -04:00
|
|
|
FFTVisualDataThread *waterfallDataThread;
|
2015-08-08 13:26:53 -04:00
|
|
|
|
2015-08-14 19:17:43 -04:00
|
|
|
std::thread *t_FFTData;
|
2015-11-02 19:27:34 -05:00
|
|
|
SDRDeviceInfo *devInfo;
|
|
|
|
std::atomic_bool deviceChanged;
|
2015-11-23 21:32:50 -05:00
|
|
|
|
|
|
|
ModemProperties *modemProps;
|
2015-11-23 22:03:14 -05:00
|
|
|
std::atomic_bool modemPropertiesUpdated;
|
2016-02-09 00:10:15 -05:00
|
|
|
wxMenuItem *showTipMenuItem;
|
2015-08-14 19:17:43 -04:00
|
|
|
|
2016-03-31 21:32:50 -04:00
|
|
|
bool lowPerfMode;
|
2016-11-01 22:29:58 -04:00
|
|
|
|
2017-01-03 12:41:38 -05:00
|
|
|
wxMenuItem *hideBookmarksItem;
|
|
|
|
bool saveDisabled;
|
2017-02-07 21:48:22 -05:00
|
|
|
|
|
|
|
AboutDialog *aboutDlg;
|
2017-01-03 12:41:38 -05:00
|
|
|
|
2017-03-01 16:13:41 -05:00
|
|
|
std::string lastToolTip;
|
|
|
|
|
2016-01-03 19:00:26 -05:00
|
|
|
#ifdef USE_HAMLIB
|
2016-02-16 01:13:26 -05:00
|
|
|
void enableRig();
|
|
|
|
void disableRig();
|
|
|
|
|
2016-01-03 19:00:26 -05:00
|
|
|
wxMenu *rigMenu;
|
|
|
|
wxMenuItem *rigEnableMenuItem;
|
|
|
|
wxMenuItem *rigPortMenuItem;
|
2016-02-16 01:13:26 -05:00
|
|
|
wxMenuItem *rigControlMenuItem;
|
|
|
|
wxMenuItem *rigFollowMenuItem;
|
2016-02-29 23:14:23 -05:00
|
|
|
wxMenuItem *rigCenterLockMenuItem;
|
|
|
|
wxMenuItem *rigFollowModemMenuItem;
|
2016-01-09 00:09:46 -05:00
|
|
|
wxMenuItem *sdrIFMenuItem;
|
2017-01-03 12:41:38 -05:00
|
|
|
|
2016-01-03 19:00:26 -05:00
|
|
|
std::map<int, wxMenuItem *> rigSerialMenuItems;
|
|
|
|
std::map<int, wxMenuItem *> rigModelMenuItems;
|
|
|
|
int rigModel;
|
|
|
|
int rigSerialRate;
|
2016-01-09 00:09:46 -05:00
|
|
|
long long rigSDRIF;
|
2016-01-03 19:00:26 -05:00
|
|
|
std::vector<int> rigSerialRates;
|
|
|
|
std::string rigPort;
|
|
|
|
int numRigs;
|
2016-02-16 01:13:26 -05:00
|
|
|
bool rigInit;
|
2016-01-03 19:00:26 -05:00
|
|
|
#endif
|
|
|
|
|
2014-12-28 05:13:46 -05:00
|
|
|
wxDECLARE_EVENT_TABLE();
|
2014-10-27 21:22:29 -04:00
|
|
|
};
|